diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-27 14:57:44 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-27 14:57:44 +0000 |
commit | 09cace2f7d8fdbfb047eba9a6396d79d59422443 (patch) | |
tree | cca8e0062d7403b9c6a7a87849a50a4ccd89ff9a /plugins/Scriver | |
parent | d4feadd097aff1815404597953c3c59527b96598 (diff) |
massive ansi cleaning for Scriver
git-svn-id: http://svn.miranda-ng.org/main/trunk@13860 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Scriver')
-rw-r--r-- | plugins/Scriver/res/ansi.ico | bin | 1150 -> 0 bytes | |||
-rw-r--r-- | plugins/Scriver/res/resource.rc | 2 | ||||
-rw-r--r-- | plugins/Scriver/res/unicode.ico | bin | 1150 -> 0 bytes | |||
-rw-r--r-- | plugins/Scriver/src/Version.h | 4 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/main.cpp | 6 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/window.cpp | 15 | ||||
-rw-r--r-- | plugins/Scriver/src/cmdlist.cpp | 75 | ||||
-rw-r--r-- | plugins/Scriver/src/cmdlist.h | 27 | ||||
-rw-r--r-- | plugins/Scriver/src/globals.cpp | 29 | ||||
-rw-r--r-- | plugins/Scriver/src/globals.h | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/input.cpp | 19 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 122 | ||||
-rw-r--r-- | plugins/Scriver/src/msglog.cpp | 14 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.cpp | 30 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.h | 4 | ||||
-rw-r--r-- | plugins/Scriver/src/msgwindow.h | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/resource.h | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/utils.cpp | 59 | ||||
-rw-r--r-- | plugins/Scriver/src/utils.h | 6 |
19 files changed, 122 insertions, 296 deletions
diff --git a/plugins/Scriver/res/ansi.ico b/plugins/Scriver/res/ansi.ico Binary files differdeleted file mode 100644 index f03c26da98..0000000000 --- a/plugins/Scriver/res/ansi.ico +++ /dev/null diff --git a/plugins/Scriver/res/resource.rc b/plugins/Scriver/res/resource.rc index ac83451263..f9a27eb23a 100644 --- a/plugins/Scriver/res/resource.rc +++ b/plugins/Scriver/res/resource.rc @@ -468,8 +468,6 @@ IDI_SEND ICON "send.ico" IDI_SMILEY ICON "smiley.ico"
IDI_TYPING ICON "typing.ico"
IDI_TYPINGOFF ICON "typingoff.ico"
-IDI_UNICODEON ICON "unicode.ico"
-IDI_UNICODEOFF ICON "ansi.ico"
IDI_TIMESTAMP ICON "clock.ico"
IDI_QUOTE ICON "quote.ico"
IDI_INCOMING ICON "message.ico"
diff --git a/plugins/Scriver/res/unicode.ico b/plugins/Scriver/res/unicode.ico Binary files differdeleted file mode 100644 index 2e2c35969e..0000000000 --- a/plugins/Scriver/res/unicode.ico +++ /dev/null diff --git a/plugins/Scriver/src/Version.h b/plugins/Scriver/src/Version.h index 96baae06e0..70283a3adc 100644 --- a/plugins/Scriver/src/Version.h +++ b/plugins/Scriver/src/Version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 2
#define __MINOR_VERSION 12
-#define __RELEASE_NUM 1
-#define __BUILD_NUM 2
+#define __RELEASE_NUM 2
+#define __BUILD_NUM 1
#include <stdver.h>
diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index 2d121c4806..e8fed79470 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -53,11 +53,6 @@ static void OnAddLog(SESSION_INFO *si, int isOk) SendMessage(si->hWnd, GC_REDRAWLOG2, 0, 0);
}
-static void OnCreateSession(SESSION_INFO *si, MODULEINFO*)
-{
- si->flags = CWDF_RTF_INPUT;
-}
-
static void OnDblClickSession(SESSION_INFO *si)
{
PostMessage(si->hWnd, GC_CLOSEWINDOW, 0, 0);
@@ -171,7 +166,6 @@ int Chat_Load() pci->OnAddLog = OnAddLog;
- pci->OnCreateSession = OnCreateSession;
pci->OnRemoveSession = OnRemoveSession;
pci->OnRenameSession = OnRenameSession;
pci->OnReplaceSession = OnReplaceSession;
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index cef4c6f3dc..47080766e5 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -1108,7 +1108,6 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR iee.iType = IEE_CLEAR_LOG;
iee.hwnd = si->hwndLog;
iee.hContact = si->hContact;
- iee.codepage = si->codePage;
iee.pszProto = si->pszModule;
CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&iee);
}
@@ -1225,15 +1224,6 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR }
break;
- case DM_GETCODEPAGE:
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, si->codePage);
- return TRUE;
-
- case DM_SETCODEPAGE:
- si->codePage = (int)lParam;
- SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
- break;
-
case DM_SWITCHINFOBAR:
case DM_SWITCHTOOLBAR:
SendMessage(hwndDlg, WM_SIZE, 0, 0);
@@ -1703,7 +1693,7 @@ LABEL_SHOWWINDOW: case IDOK:
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) {
- ptrA pszRtf(GetRichTextRTF(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)));
+ char *pszRtf = GetRichTextRTF(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
if (pszRtf == NULL)
break;
@@ -1717,6 +1707,7 @@ LABEL_SHOWWINDOW: cmdListNew = tcmdlist_last(si->cmdList);
}
+ // takes pszRtf to a queue, no leak here
si->cmdList = tcmdlist_append(si->cmdList, pszRtf, 20, FALSE);
CMString ptszText(ptrT(mir_utf8decodeT(pszRtf)));
@@ -1753,7 +1744,7 @@ LABEL_SHOWWINDOW: case IDC_CHAT_MESSAGE:
if (HIWORD(wParam) == EN_CHANGE) {
si->cmdListCurrent = NULL;
- EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), si->codePage, FALSE) != 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), 1200, FALSE) != 0);
}
break;
diff --git a/plugins/Scriver/src/cmdlist.cpp b/plugins/Scriver/src/cmdlist.cpp index 7cbdd96b4f..29731070cc 100644 --- a/plugins/Scriver/src/cmdlist.cpp +++ b/plugins/Scriver/src/cmdlist.cpp @@ -23,25 +23,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h"
-TCmdList *tcmdlist_append(TCmdList *list, const char *data, int maxSize, BOOL temporary)
+TCmdList* tcmdlist_append(TCmdList *list, char *data, int maxSize, BOOL temporary)
{
- TCmdList *new_list = (TCmdList *)mir_alloc(sizeof(TCmdList));
- TCmdList *attach_to = NULL;
-
- if (!data) {
- mir_free(new_list);
+ if (!data)
return list;
- }
+
+ TCmdList *new_list = (TCmdList *)mir_calloc(sizeof(TCmdList));
new_list->temporary = temporary;
- new_list->next = NULL;
- new_list->szCmd = mir_strdup(data);
+ new_list->szCmd = data;
+
+ TCmdList *attach_to = NULL;
for (TCmdList *n = list; n != NULL; n = n->next)
attach_to = n;
- if (attach_to == NULL) {
- new_list->prev = NULL;
+ if (attach_to == NULL)
return new_list;
- }
new_list->prev = attach_to;
attach_to->next = new_list;
@@ -50,7 +46,7 @@ TCmdList *tcmdlist_append(TCmdList *list, const char *data, int maxSize, BOOL te return list;
}
-TCmdList *tcmdlist_remove_first(TCmdList *list)
+TCmdList* tcmdlist_remove_first(TCmdList *list)
{
TCmdList *n = list;
if (n->next) n->next->prev = n->prev;
@@ -71,57 +67,6 @@ TCmdList *tcmdlist_remove(TCmdList *list, TCmdList *n) return list;
}
-TCmdList *tcmdlist_append2(TCmdList *list, MCONTACT hContact, const char *data)
-{
- TCmdList *new_list = (TCmdList *)mir_alloc(sizeof(TCmdList));
- TCmdList *attach_to = NULL;
-
- if (!data) {
- mir_free(new_list);
- return list;
- }
- new_list->temporary = FALSE;
- new_list->next = NULL;
- new_list->hContact = hContact;
- new_list->szCmd = mir_strdup(data);
- list = tcmdlist_remove2(list, hContact);
- for (TCmdList *n = list; n != NULL; n = n->next)
- attach_to = n;
-
- if (attach_to == NULL) {
- new_list->prev = NULL;
- return new_list;
- }
-
- new_list->prev = attach_to;
- attach_to->next = new_list;
- return list;
-}
-
-TCmdList *tcmdlist_remove2(TCmdList *list, MCONTACT hContact)
-{
- for (TCmdList *n = list; n != NULL; n = n->next) {
- if (n->hContact == hContact) {
- if (n->next) n->next->prev = n->prev;
- if (n->prev) n->prev->next = n->next;
- if (n == list) list = n->next;
- mir_free(n->szCmd);
- mir_free(n);
- return list;
- }
- }
- return list;
-}
-
-TCmdList *tcmdlist_get2(TCmdList *list, MCONTACT hContact)
-{
- for (TCmdList *n = list; n != NULL; n = n->next)
- if (n->hContact == hContact)
- return n;
-
- return NULL;
-}
-
int tcmdlist_len(TCmdList *list)
{
int i = 0;
@@ -131,7 +76,7 @@ int tcmdlist_len(TCmdList *list) return i;
}
-TCmdList *tcmdlist_last(TCmdList *list)
+TCmdList* tcmdlist_last(TCmdList *list)
{
for (TCmdList *n = list; n != NULL; n = n->next)
if (!n->next)
diff --git a/plugins/Scriver/src/cmdlist.h b/plugins/Scriver/src/cmdlist.h index 7198be8437..249515ed10 100644 --- a/plugins/Scriver/src/cmdlist.h +++ b/plugins/Scriver/src/cmdlist.h @@ -20,23 +20,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef SRMM_CMDLIST_H
#define SRMM_CMDLIST_H
-
-typedef struct _TCmdList {
- struct _TCmdList *next;
- struct _TCmdList *prev;
+struct TCmdList
+{
MCONTACT hContact;
char *szCmd;
- BOOL temporary;
-} TCmdList;
-
-TCmdList *tcmdlist_append(TCmdList *list, const char *data, int maxSize, BOOL temporary);
-TCmdList *tcmdlist_remove(TCmdList *list, TCmdList *n);
-TCmdList *tcmdlist_remove_first(TCmdList *list);
-TCmdList *tcmdlist_append2(TCmdList *list, MCONTACT hContact, const char *data);
-TCmdList *tcmdlist_remove2(TCmdList *list, MCONTACT hContact);
-TCmdList *tcmdlist_get2(TCmdList *list, MCONTACT hContact);
+ BOOL temporary;
+ TCmdList *next, *prev;
+};
+
+TCmdList* tcmdlist_append(TCmdList *list, char *data, int maxSize, BOOL temporary);
+TCmdList* tcmdlist_remove(TCmdList *list, TCmdList *n);
+TCmdList* tcmdlist_remove_first(TCmdList *list);
+TCmdList* tcmdlist_last(TCmdList *list);
+
int tcmdlist_len(TCmdList *list);
-TCmdList *tcmdlist_last(TCmdList *list);
-void tcmdlist_free(TCmdList * list);
+void tcmdlist_free(TCmdList *list);
#endif
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index aa3d58ea1f..8a35da30a5 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -45,16 +45,14 @@ static IconItem iconList[] = { LPGEN("Send message"), "scriver_SEND", IDI_SEND }, // 4
{ LPGEN("Smiley button"), "scriver_SMILEY", IDI_SMILEY }, // 5
{ LPGEN("User is typing"), "scriver_TYPING", IDI_TYPING }, // 6
- { LPGEN("Typing notification off"), "scriver_TYPINGOFF", IDI_TYPINGOFF }, // 7
- { LPGEN("Unicode is on"), "scriver_UNICODEON", IDI_UNICODEON }, // 8
- { LPGEN("Unicode is off"), "scriver_UNICODEOFF", IDI_UNICODEOFF }, // 9
- { LPGEN("Sending"), "scriver_DELIVERING", IDI_TIMESTAMP }, // 10
- { LPGEN("Quote button"), "scriver_QUOTE", IDI_QUOTE }, // 11
- { LPGEN("Close button"), "scriver_CLOSEX", IDI_CLOSEX }, // 12
- { LPGEN("Icon overlay"), "scriver_OVERLAY", IDI_OVERLAY }, // 13
- { LPGEN("Incoming message (10x10)"),"scriver_INCOMING", IDI_INCOMING, 10}, // 14
- { LPGEN("Outgoing message (10x10)"),"scriver_OUTGOING", IDI_OUTGOING, 10}, // 15
- { LPGEN("Notice (10x10)"), "scriver_NOTICE", IDI_NOTICE, 10}, // 16
+ { LPGEN("Typing notification off"), "scriver_TYPINGOFF", IDI_TYPINGOFF }, // 7
+ { LPGEN("Sending"), "scriver_DELIVERING", IDI_TIMESTAMP }, // 8
+ { LPGEN("Quote button"), "scriver_QUOTE", IDI_QUOTE }, // 9
+ { LPGEN("Close button"), "scriver_CLOSEX", IDI_CLOSEX }, // 10
+ { LPGEN("Icon overlay"), "scriver_OVERLAY", IDI_OVERLAY }, // 11
+ { LPGEN("Incoming message (10x10)"),"scriver_INCOMING", IDI_INCOMING, 10}, // 12
+ { LPGEN("Outgoing message (10x10)"),"scriver_OUTGOING", IDI_OUTGOING, 10}, // 13
+ { LPGEN("Notice (10x10)"), "scriver_NOTICE", IDI_NOTICE, 10}, // 14
{ LPGEN("Window Icon"), "chat_window", IDI_CHANMGR }, // 1
{ LPGEN("Text color"), "chat_fgcol", IDI_COLOR }, // 2
@@ -97,9 +95,9 @@ void RegisterIcons(void) {
HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
- Icon_Register(g_hInst, LPGEN("Single Messaging"), iconList, 16);
- Icon_Register(g_hInst, LPGEN("Group chats"), iconList+16, 20);
- Icon_Register(g_hInst, LPGEN("Single Messaging"), iconList+36, 14);
+ Icon_Register(g_hInst, LPGEN("Single Messaging"), iconList, 14);
+ Icon_Register(g_hInst, LPGEN("Group chats"), iconList+14, 20);
+ Icon_Register(g_hInst, LPGEN("Single Messaging"), iconList+34, 14);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -302,7 +300,6 @@ void InitGlobals() g_dat.hTabIconList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0);
g_dat.hHelperIconList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0);
g_dat.hSearchEngineIconList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0);
- g_dat.draftList = NULL;
g_dat.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
g_dat.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
LoadInfobarFonts();
@@ -313,8 +310,6 @@ void FreeGlobals() {
if (g_dat.hInfobarBrush != NULL)
DeleteObject(g_dat.hInfobarBrush);
- if (g_dat.draftList != NULL)
- tcmdlist_free(g_dat.draftList);
if (g_dat.hTabIconList)
ImageList_Destroy(g_dat.hTabIconList);
if (g_dat.hButtonIconList)
@@ -325,8 +320,6 @@ void FreeGlobals() ImageList_Destroy(g_dat.hHelperIconList);
if (g_dat.hSearchEngineIconList)
ImageList_Destroy(g_dat.hSearchEngineIconList);
- if (g_dat.hMenuANSIEncoding)
- DestroyMenu(g_dat.hMenuANSIEncoding);
mir_free(g_dat.tabIconListUsage);
WindowList_Destroy(g_dat.hMessageWindowList);
diff --git a/plugins/Scriver/src/globals.h b/plugins/Scriver/src/globals.h index 8fa58f6d4f..c5a2d6e7a6 100644 --- a/plugins/Scriver/src/globals.h +++ b/plugins/Scriver/src/globals.h @@ -90,10 +90,8 @@ struct GlobalMessageData DWORD limitNamesLength;
int activeAlpha;
int inactiveAlpha;
- HMENU hMenuANSIEncoding;
int tabIconListUsageSize;
ImageListUsageEntry *tabIconListUsage;
- TCmdList *draftList;
int smileyAddInstalled;
int popupInstalled;
int ieviewInstalled;
diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index 81c3b5c8d7..69f6691c09 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -210,16 +210,10 @@ int InputAreaShortcuts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, Common cmdListNew = tcmdlist_last(windowData->cmdList);
}
if (cmdListNew != NULL) {
- char *textBuffer;
- if (windowData->flags & CWDF_RTF_INPUT)
- textBuffer = GetRichTextRTF(hwnd);
- else
- textBuffer = GetRichTextEncoded(hwnd, windowData->codePage);
-
- if (textBuffer != NULL) {
+ char *textBuffer = GetRichTextUtf(hwnd);
+ if (textBuffer != NULL)
+ // takes textBuffer to a queue, no leak here
windowData->cmdList = tcmdlist_append(windowData->cmdList, textBuffer, 20, TRUE);
- mir_free(textBuffer);
- }
}
}
else if (windowData->cmdListCurrent->prev != NULL)
@@ -234,12 +228,9 @@ int InputAreaShortcuts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, Common }
}
if (cmdListNew != NULL) {
- int iLen;
SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
- if (windowData->flags & CWDF_RTF_INPUT)
- iLen = SetRichTextRTF(hwnd, cmdListNew->szCmd);
- else
- iLen = SetRichTextEncoded(hwnd, cmdListNew->szCmd);
+
+ int iLen = SetRichText(hwnd, ptrT(mir_utf8decodeT(cmdListNew->szCmd)));
SendMessage(hwnd, EM_SCROLLCARET, 0, 0);
SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index ecb1b77b01..61415b37d2 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -46,7 +46,6 @@ static ToolbarButton toolbarButtons[] = { static TCHAR* GetIEViewSelection(SrmmWindowData *dat)
{
IEVIEWEVENT evt = { sizeof(evt) };
- evt.codepage = dat->codePage;
evt.hwnd = dat->hwndLog;
evt.hContact = dat->hContact;
evt.iType = IEE_GET_SELECTION;
@@ -80,7 +79,7 @@ static TCHAR* GetQuotedTextW(TCHAR *text) }
}
j += 3;
-
+
TCHAR *out = (TCHAR*)mir_alloc(sizeof(TCHAR)* j);
newLine = 1;
wasCR = 0;
@@ -117,16 +116,6 @@ static TCHAR* GetQuotedTextW(TCHAR *text) return out;
}
-static void saveDraftMessage(HWND hwnd, MCONTACT hContact, int codepage)
-{
- char *textBuffer = GetRichTextEncoded(hwnd, codepage);
- if (textBuffer != NULL) {
- g_dat.draftList = tcmdlist_append2(g_dat.draftList, hContact, textBuffer);
- mir_free(textBuffer);
- }
- else g_dat.draftList = tcmdlist_remove2(g_dat.draftList, hContact);
-}
-
void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type)
{
if (hContact == NULL || hwnd == NULL)
@@ -177,12 +166,12 @@ static void AddToFileList(TCHAR ***pppFiles, int *totalCount, const TCHAR* szFil if (GetFileAttributes(szFilename) & FILE_ATTRIBUTE_DIRECTORY) {
WIN32_FIND_DATA fd;
TCHAR szPath[MAX_PATH];
- mir_sntprintf(szPath, SIZEOF(szPath), _T("%s\\*"),szFilename);
+ mir_sntprintf(szPath, SIZEOF(szPath), _T("%s\\*"), szFilename);
HANDLE hFind = FindFirstFile(szPath, &fd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
if (!mir_tstrcmp(fd.cFileName, _T(".")) || !mir_tstrcmp(fd.cFileName, _T(".."))) continue;
- mir_sntprintf(szPath, SIZEOF(szPath),_T("%s\\%s"), szFilename, fd.cFileName);
+ mir_sntprintf(szPath, SIZEOF(szPath), _T("%s\\%s"), szFilename, fd.cFileName);
AddToFileList(pppFiles, totalCount, szPath);
} while (FindNextFile(hFind, &fd));
FindClose(hFind);
@@ -219,7 +208,7 @@ static void SetDialogToType(HWND hwndDlg) ShowWindow(GetDlgItem(hwndDlg, IDC_SPLITTER), SW_SHOW);
UpdateReadChars(hwndDlg, dat);
- EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->codePage, FALSE) ? TRUE : FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), 1200, FALSE) ? TRUE : FALSE);
SendMessage(hwndDlg, DM_CLISTSETTINGSCHANGED, 0, 0);
SendMessage(hwndDlg, WM_SIZE, 0, 0);
}
@@ -565,7 +554,7 @@ static void UpdateReadChars(HWND hwndDlg, SrmmWindowData *dat) {
if (dat->parent->hwndActive == hwndDlg) {
TCHAR szText[256];
- int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->codePage, FALSE);
+ int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), 1200, FALSE);
StatusBarData sbd;
sbd.iItem = 1;
@@ -682,6 +671,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP PARAFORMAT2 pf2;
CHARFORMAT2 cf2;
LPNMHDR pNmhdr;
+ HCURSOR hCur;
static HMENU hToolbarMenu;
@@ -760,7 +750,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP else
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG), GWL_EXSTYLE) & ~WS_EX_LEFTSCROLLBAR);
}
- dat->codePage = db_get_w(dat->hContact, SRMMMOD, "CodePage", (WORD)CP_ACP);
dat->ace = NULL;
GetWindowRect(GetDlgItem(hwndDlg, IDC_MESSAGE), &minEditInit);
dat->minEditBoxHeight = minEditInit.bottom - minEditInit.top;
@@ -778,9 +767,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText);
}
else if (g_dat.flags & SMF_SAVEDRAFTS) {
- TCmdList *draft = tcmdlist_get2(g_dat.draftList, dat->hContact);
- if (draft != NULL)
- len = SetRichTextEncoded(GetDlgItem(hwndDlg, IDC_MESSAGE), draft->szCmd);
+ ptrT ptszSavedMsg(db_get_tsa(dat->hContact, "SRMM", "SavedMsg"));
+ if (ptszSavedMsg)
+ len = SetRichText(GetDlgItem(hwndDlg, IDC_MESSAGE), ptszSavedMsg);
PostMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETSEL, len, len);
}
@@ -1151,15 +1140,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetDialogToType(hwndDlg);
break;
- case DM_GETCODEPAGE:
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, dat->codePage);
- return TRUE;
-
- case DM_SETCODEPAGE:
- dat->codePage = (int)lParam;
- SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
- break;
-
case DM_SWITCHTYPING:
if (IsTypingNotificationSupported(dat)) {
StatusIconData sid = { sizeof(sid) };
@@ -1423,7 +1403,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP evt.dwFlags = ((dat->flags & SMF_RTL) ? IEEF_RTL : 0);
evt.hwnd = dat->hwndLog;
evt.hContact = dat->hContact;
- evt.codepage = dat->codePage;
evt.pszProto = dat->szProto;
CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&evt);
}
@@ -1477,7 +1456,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP item->hContact = dat->hContact;
item->proto = mir_strdup(dat->szProto);
item->flags = msi->flags;
- item->codepage = dat->codePage;
item->sendBufferSize = msi->sendBufferSize;
item->sendBuffer = mir_strndup(msi->sendBuffer, msi->sendBufferSize);
SendSendQueueItem(item);
@@ -1597,7 +1575,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break;
case IDOK:
- //this is a 'send' button
+ // this is a 'send' button
if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDOK)))
break;
@@ -1617,7 +1595,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP GETTEXTEX gt = { 0 };
gt.flags = GT_USECRLF;
gt.cb = bufSize;
- gt.codepage = 1200;
+ gt.codepage = 1200; // Unicode
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM)>, ptszUnicode);
if (RTL_Detect(ptszUnicode))
msi.flags |= PREF_RTL;
@@ -1751,7 +1729,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDC_MESSAGE:
if (HIWORD(wParam) == EN_CHANGE) {
- int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->codePage, FALSE);
+ int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), 1200, FALSE);
dat->cmdListCurrent = NULL;
UpdateReadChars(hwndDlg, dat);
EnableWindow(GetDlgItem(hwndDlg, IDOK), len != 0);
@@ -1775,44 +1753,43 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDC_LOG:
switch (pNmhdr->code) {
case EN_MSGFILTER:
- {
- int result = InputAreaShortcuts(GetDlgItem(hwndDlg, IDC_MESSAGE), ((MSGFILTER *)lParam)->msg, ((MSGFILTER *)lParam)->wParam, ((MSGFILTER *)lParam)->lParam, dat);
- if (result != -1) {
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- }
- switch (((MSGFILTER *)lParam)->msg) {
- case WM_CHAR:
- if (!(GetKeyState(VK_CONTROL) & 0x8000)) {
- SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, ((MSGFILTER *)lParam)->msg, ((MSGFILTER *)lParam)->wParam, ((MSGFILTER *)lParam)->lParam);
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
+ {
+ int result = InputAreaShortcuts(GetDlgItem(hwndDlg, IDC_MESSAGE), ((MSGFILTER *)lParam)->msg, ((MSGFILTER *)lParam)->wParam, ((MSGFILTER *)lParam)->lParam, dat);
+ if (result != -1) {
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+ }
}
- return TRUE;
- case WM_LBUTTONDOWN:
- {
- HCURSOR hCur = GetCursor();
- if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE)
- || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE)) {
+
+ switch (((MSGFILTER *)lParam)->msg) {
+ case WM_CHAR:
+ if (!(GetKeyState(VK_CONTROL) & 0x8000)) {
+ SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, ((MSGFILTER *)lParam)->msg, ((MSGFILTER *)lParam)->wParam, ((MSGFILTER *)lParam)->lParam);
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
+ }
+ return TRUE;
+
+ case WM_LBUTTONDOWN:
+ hCur = GetCursor();
+ if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE) || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE)) {
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+ }
+ break;
+
+ case WM_MOUSEMOVE:
+ hCur = GetCursor();
+ if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE) || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE))
+ SetCursor(LoadCursor(NULL, IDC_ARROW));
+ break;
+
+ case WM_RBUTTONUP:
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
return TRUE;
}
break;
- }
- case WM_MOUSEMOVE:
- {
- HCURSOR hCur = GetCursor();
- if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE)
- || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE))
- SetCursor(LoadCursor(NULL, IDC_ARROW));
- break;
- }
- case WM_RBUTTONUP:
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- break;
+
case EN_LINK:
switch (((ENLINK *)lParam)->msg) {
case WM_SETCURSOR:
@@ -1830,6 +1807,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
}
break;
+
case IDC_MESSAGE:
switch (((NMHDR *)lParam)->code) {
case EN_MSGFILTER:
@@ -1871,10 +1849,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->statusIcon = NULL;
dat->statusIconOverlay = NULL;
ReleaseSendQueueItems(hwndDlg);
- if (g_dat.flags & SMF_SAVEDRAFTS)
- saveDraftMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->hContact, dat->codePage);
- else
- g_dat.draftList = tcmdlist_remove2(g_dat.draftList, dat->hContact);
+ if (g_dat.flags & SMF_SAVEDRAFTS) {
+ ptrA szText(GetRichTextUtf(GetDlgItem(hwndDlg, IDC_MESSAGE)));
+ if (szText)
+ db_set_utf(dat->hContact, "SRMM", "SavedMsg", szText);
+ }
tcmdlist_free(dat->cmdList);
WindowList_Remove(g_dat.hMessageWindowList, hwndDlg);
@@ -1884,7 +1863,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DeleteObject(hFont);
db_set_b(dat->hContact, SRMMMOD, "UseRTL", (BYTE)((dat->flags & SMF_RTL) ? 1 : 0));
- db_set_w(dat->hContact, SRMMMOD, "CodePage", (WORD)dat->codePage);
if (dat->hContact && (g_dat.flags & SMF_DELTEMP))
if (db_get_b(dat->hContact, "CList", "NotOnList", 0))
CallService(MS_DB_CONTACT_DELETE, dat->hContact, 0);
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 8c5c4e020a..86a2751f2c 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -66,7 +66,6 @@ struct EventData };
DWORD time;
DWORD eventType;
- int codePage;
BOOL custom;
EventData *next;
};
@@ -182,7 +181,6 @@ EventData* getEventFromDB(SrmmWindowData *dat, MCONTACT hContact, MEVENT hDbEven evt->time = dbei.timestamp;
evt->pszNick = NULL;
- evt->codePage = dat->codePage;
if (evt->dwFlags & IEEDF_SENT)
evt->pszNickT = GetNickname(NULL, dat->szProto);
@@ -196,7 +194,7 @@ EventData* getEventFromDB(SrmmWindowData *dat, MCONTACT hContact, MEVENT hDbEven if (*descr != 0)
evt->pszText2T = DbGetEventStringT(&dbei, descr);
}
- else evt->pszTextT = DbGetEventTextT(&dbei, dat->codePage);
+ else evt->pszTextT = DbGetEventTextT(&dbei, CP_UTF8);
if (!(dat->flags & SMF_RTL) && RTL_Detect(evt->pszTextT))
evt->dwFlags |= IEEDF_RTL;
@@ -212,7 +210,6 @@ static EventData* GetTestEvent(DWORD flags) evt->dwFlags = IEEDF_READ | flags;
evt->dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
evt->time = time(NULL);
- evt->codePage = CP_ACP;
return evt;
}
@@ -821,7 +818,6 @@ void StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAppend) evt.dwFlags = ((dat->flags & SMF_RTL) ? IEEF_RTL : 0);
evt.hwnd = dat->hwndLog;
evt.hContact = dat->hContact;
- evt.codepage = dat->codePage;
evt.pszProto = dat->szProto;
if (!fAppend) {
evt.iType = IEE_CLEAR_LOG;
@@ -849,7 +845,7 @@ void StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAppend) streamData.hDbEventLast = dat->hDbEventLast;
streamData.dlgDat = dat;
streamData.eventsToInsert = count;
- streamData.isFirst = fAppend ? GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->codePage, FALSE) == 0 : 1;
+ streamData.isFirst = fAppend ? GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), CP_ACP, FALSE) == 0 : 1;
streamData.gdat = &g_dat;
stream.pfnCallback = LogStreamInEvents;
stream.dwCookie = (DWORD_PTR)& streamData;
@@ -859,14 +855,14 @@ void StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAppend) gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMCHARS;
gtxl.codepage = 1200;
fi.chrg.cpMin = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0);
- sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->codePage, FALSE);
+ sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), 1200, FALSE);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)&sel);
}
else {
SendDlgItemMessage(hwndDlg, IDC_LOG, WM_SETREDRAW, FALSE, 0);
SetDlgItemText(hwndDlg, IDC_LOG, _T(""));
sel.cpMin = 0;
- sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->codePage, FALSE);
+ sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), 1200, FALSE);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)&sel);
fi.chrg.cpMin = 0;
dat->isMixed = 0;
@@ -896,7 +892,7 @@ void StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAppend) CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&smre);
}
- int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->codePage, FALSE);
+ int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), 1200, FALSE);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETSEL, len - 1, len - 1);
if (!fAppend)
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index c557fc6776..572bcedf47 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -410,35 +410,15 @@ void ChangeStatusIcons() int StatusIconPressed(WPARAM wParam, LPARAM lParam)
{
StatusIconClickData *sicd = (StatusIconClickData *) lParam;
+ if (mir_strcmp(SRMMMOD, sicd->szModule))
+ return 0;
+
HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, wParam);
if (hwnd == NULL)
hwnd = SM_FindWindowByContact(wParam);
- if (hwnd != NULL) {
- if (!mir_strcmp(SRMMMOD, sicd->szModule)) {
- if (sicd->dwId == 0 && g_dat.hMenuANSIEncoding) {
- if (sicd->flags & MBCF_RIGHTBUTTON) {
- int codePage = (int) SendMessage(hwnd, DM_GETCODEPAGE, 0, 0);
- if (codePage != 1200) {
- for (int i = 0; i < GetMenuItemCount(g_dat.hMenuANSIEncoding); i++)
- CheckMenuItem (g_dat.hMenuANSIEncoding, i, MF_BYPOSITION | MF_UNCHECKED);
-
- if (codePage == CP_ACP)
- CheckMenuItem(g_dat.hMenuANSIEncoding, 0, MF_BYPOSITION | MF_CHECKED);
- else
- CheckMenuItem(g_dat.hMenuANSIEncoding, codePage, MF_BYCOMMAND | MF_CHECKED);
-
- int iSel = TrackPopupMenu(g_dat.hMenuANSIEncoding, TPM_RETURNCMD, sicd->clickLocation.x, sicd->clickLocation.y, 0, GetParent(hwnd), NULL);
- if (iSel >= 500) {
- if (iSel == 500) iSel = CP_ACP;
- SendMessage(hwnd, DM_SETCODEPAGE, 0, iSel);
- }
- }
- }
- }
- else SendMessage(hwnd, DM_SWITCHTYPING, 0, 0);
- }
- }
+ if (hwnd != NULL)
+ SendMessage(hwnd, DM_SWITCHTYPING, 0, 0);
return 0;
}
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index cbd32beb0b..da1bc278ae 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -101,13 +101,9 @@ struct NewMessageWindowLParam int flags;
};
-#define CWDF_RTF_INPUT 1
-
struct CommonWindowData
{
ParentWindowData *parent;
- int codePage;
- DWORD flags;
HWND hwndLog;
int minLogBoxHeight, minEditBoxHeight;
TCmdList *cmdList, *cmdListCurrent;
diff --git a/plugins/Scriver/src/msgwindow.h b/plugins/Scriver/src/msgwindow.h index 500e671cf3..c5ec63c224 100644 --- a/plugins/Scriver/src/msgwindow.h +++ b/plugins/Scriver/src/msgwindow.h @@ -50,8 +50,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DM_SETPARENT (WM_USER+0x203)
#define DM_ACTIVATE (WM_USER+0x206)
#define DM_GETCONTEXTMENU (WM_USER+0x207)
-#define DM_GETCODEPAGE (WM_USER+0x208)
-#define DM_SETCODEPAGE (WM_USER+0x209)
#define DM_SETFOCUS (WM_USER+0x20A)
#define DM_CLISTSETTINGSCHANGED (WM_USER+0x20B)
diff --git a/plugins/Scriver/src/resource.h b/plugins/Scriver/src/resource.h index b516adfe7f..f1eca2d5f9 100644 --- a/plugins/Scriver/src/resource.h +++ b/plugins/Scriver/src/resource.h @@ -19,8 +19,6 @@ #define IDI_SEND 123
#define IDI_SMILEY 125
#define IDI_TYPING 126
-#define IDI_UNICODEON 127
-#define IDI_UNICODEOFF 128
#define IDI_TIMESTAMP 129
#define IDI_QUOTE 130
#define IDI_INCOMING 132
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index 1d4e9b829f..f0f01ef9dc 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -94,53 +94,28 @@ int GetRichTextLength(HWND hwnd, int codepage, BOOL inBytes) return (int)SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)>l, 0);
}
-
-TCHAR *GetRichText(HWND hwnd, int codepage)
+char* GetRichTextUtf(HWND hwnd)
{
+ int textBufferSize = GetRichTextLength(hwnd, CP_UTF8, TRUE);
+ if (textBufferSize == 0)
+ return NULL;
+
+ textBufferSize++;
+ char *textBuffer = (char*)mir_alloc(textBufferSize);
+
GETTEXTEX gt = { 0 };
- TCHAR *textBuffer = NULL;
- int textBufferSize;
- codepage = 1200;
- textBufferSize = GetRichTextLength(hwnd, codepage, TRUE);
- if (textBufferSize > 0) {
- textBufferSize += sizeof(TCHAR);
- textBuffer = (TCHAR*)mir_alloc(textBufferSize);
- gt.cb = textBufferSize;
- gt.flags = GT_USECRLF;
- gt.codepage = codepage;
- SendMessage(hwnd, EM_GETTEXTEX, (WPARAM)>, (LPARAM)textBuffer);
- }
+ gt.cb = textBufferSize;
+ gt.flags = GT_USECRLF;
+ gt.codepage = CP_UTF8;
+ SendMessage(hwnd, EM_GETTEXTEX, (WPARAM)>, (LPARAM)textBuffer);
return textBuffer;
}
-char *GetRichTextEncoded(HWND hwnd, int codepage)
+int SetRichText(HWND hwnd, const TCHAR *text)
{
- TCHAR *textBuffer = GetRichText(hwnd, codepage);
- char *textUtf = NULL;
- if (textBuffer != NULL) {
- textUtf = mir_utf8encodeW(textBuffer);
- mir_free(textBuffer);
- }
- return textUtf;
-}
-
-int SetRichTextEncoded(HWND hwnd, const char *text)
-{
- TCHAR *textToSet;
- SETTEXTEX st;
+ SETTEXTEX st;
st.flags = ST_DEFAULT;
st.codepage = 1200;
- textToSet = mir_utf8decodeW(text);
- SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)textToSet);
- mir_free(textToSet);
- return GetRichTextLength(hwnd, st.codepage, FALSE);
-}
-
-int SetRichTextRTF(HWND hwnd, const char *text)
-{
- SETTEXTEX st;
- st.flags = ST_DEFAULT;
- st.codepage = CP_ACP;
SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)text);
return GetRichTextLength(hwnd, st.codepage, FALSE);
}
@@ -158,7 +133,7 @@ static DWORD CALLBACK RichTextStreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, dwRead = cb;
}
else {
- char *p = (char*)mir_alloc(dwRead + cb + 1);
+ char *p = (char*)mir_alloc(dwRead + cb + 1);
memcpy(p, *ppText, dwRead);
memcpy(p + dwRead, pbBuff, cb);
p[dwRead + cb] = 0;
@@ -213,8 +188,8 @@ TCHAR* GetRichTextWord(HWND hwnd, POINTL *ptl) if (pszWord == NULL) {
iCharIndex = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM)ptl);
if (iCharIndex >= 0) {
- start = SendMessage(hwnd, EM_FINDWORDBREAK, WB_LEFT, iCharIndex);//-iChars;
- end = SendMessage(hwnd, EM_FINDWORDBREAK, WB_RIGHT, iCharIndex);//-iChars;
+ start = SendMessage(hwnd, EM_FINDWORDBREAK, WB_LEFT, iCharIndex); //-iChars;
+ end = SendMessage(hwnd, EM_FINDWORDBREAK, WB_RIGHT, iCharIndex); //-iChars;
if (end - start > 0) {
TEXTRANGE tr;
CHARRANGE cr;
diff --git a/plugins/Scriver/src/utils.h b/plugins/Scriver/src/utils.h index bd5464e7f2..db7c357bd7 100644 --- a/plugins/Scriver/src/utils.h +++ b/plugins/Scriver/src/utils.h @@ -38,13 +38,11 @@ int IsUnicodeMIM(); TCHAR *limitText(TCHAR *text, int limit);
void logInfo(const char *fmt, ...);
int GetRichTextLength(HWND hwnd, int codepage, BOOL inBytes);
-TCHAR* GetRichText(HWND hwnd, int codepage);
TCHAR *GetRichEditSelection(HWND hwnd);
char* GetRichTextRTF(HWND hwnd);
-char* GetRichTextEncoded(HWND hwnd, int codepage);
+char* GetRichTextUtf(HWND hwnd);
TCHAR *GetRichTextWord(HWND hwnd, POINTL *pt);
-int SetRichTextRTF(HWND hwnd, const char *text);
-int SetRichTextEncoded(HWND hwnd, const char *text);
+int SetRichText(HWND hwnd, const TCHAR *text);
void SearchWord(TCHAR * word, int engine);
HDWP ResizeToolbar(HWND hwnd, HDWP hdwp, int width, int vPos, int height, int cControls, const ToolbarButton * buttons, int controlVisibility);
void ShowToolbarControls(HWND hwndDlg, int cControls, const ToolbarButton * buttons, int controlVisibility, int state);
|