Author: akhaldi
Date: Sat Apr 26 16:54:06 2014
New Revision: 62982
URL:
http://svn.reactos.org/svn/reactos?rev=62982&view=rev
Log:
[RICHED20]
* Sync with Wine 1.7.17.
CORE-8080
Modified:
trunk/reactos/dll/win32/riched20/CMakeLists.txt
trunk/reactos/dll/win32/riched20/caret.c
trunk/reactos/dll/win32/riched20/editor.c
trunk/reactos/dll/win32/riched20/editor.h
trunk/reactos/dll/win32/riched20/editstr.h
trunk/reactos/dll/win32/riched20/list.c
trunk/reactos/dll/win32/riched20/msvc-thiscall.c
trunk/reactos/dll/win32/riched20/msvc.h
trunk/reactos/dll/win32/riched20/paint.c
trunk/reactos/dll/win32/riched20/reader.c
trunk/reactos/dll/win32/riched20/richole.c
trunk/reactos/dll/win32/riched20/row.c
trunk/reactos/dll/win32/riched20/rtf.h
trunk/reactos/dll/win32/riched20/run.c
trunk/reactos/dll/win32/riched20/string.c
trunk/reactos/dll/win32/riched20/style.c
trunk/reactos/dll/win32/riched20/table.c
trunk/reactos/dll/win32/riched20/txtsrv.c
trunk/reactos/dll/win32/riched20/wrap.c
trunk/reactos/dll/win32/riched20/writer.c
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/riched20/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/CMakeLi…
==============================================================================
--- trunk/reactos/dll/win32/riched20/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/CMakeLists.txt [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -40,6 +40,6 @@
add_library(riched20 SHARED ${SOURCE} ${ADDITIONAL_SOURCE})
set_module_type(riched20 win32dll)
target_link_libraries(riched20 wine uuid)
-add_importlibs(riched20 ole32 oleaut32 imm32 user32 gdi32 msvcrt kernel32 ntdll)
+add_importlibs(riched20 ole32 oleaut32 usp10 imm32 user32 gdi32 msvcrt kernel32 ntdll)
add_pch(riched20 editor.h SOURCE)
add_cd_file(TARGET riched20 DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/dll/win32/riched20/caret.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/caret.c…
==============================================================================
--- trunk/reactos/dll/win32/riched20/caret.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/caret.c [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
#include "editor.h"
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
@@ -55,7 +56,19 @@
int ME_GetSelection(ME_TextEditor *editor, ME_Cursor **from, ME_Cursor **to)
{
- if (ME_GetCursorOfs(&editor->pCursors[0]) <
ME_GetCursorOfs(&editor->pCursors[1]))
+ int from_ofs = ME_GetCursorOfs( &editor->pCursors[0] );
+ int to_ofs = ME_GetCursorOfs( &editor->pCursors[1] );
+ BOOL swap = (from_ofs > to_ofs);
+
+ if (from_ofs == to_ofs)
+ {
+ /* If cursor[0] is at the beginning of a run and cursor[1] at the end
+ of the prev run then we need to swap. */
+ if (editor->pCursors[0].nOffset < editor->pCursors[1].nOffset)
+ swap = TRUE;
+ }
+
+ if (!swap)
{
*from = &editor->pCursors[0];
*to = &editor->pCursors[1];
@@ -127,7 +140,6 @@
ME_SetCursorToStart(editor, &editor->pCursors[1]);
ME_SetCursorToEnd(editor, &editor->pCursors[0]);
ME_InvalidateSelection(editor);
- ME_ClearTempStyle(editor);
return len + 1;
}
@@ -150,7 +162,6 @@
editor->pCursors[1] = editor->pCursors[0];
ME_Repaint(editor);
}
- ME_ClearTempStyle(editor);
return end;
}
@@ -179,7 +190,6 @@
ME_SetCursorToEnd(editor, &editor->pCursors[0]);
editor->pCursors[1] = editor->pCursors[0];
ME_InvalidateSelection(editor);
- ME_ClearTempStyle(editor);
return len;
}
@@ -283,13 +293,15 @@
int nChars, BOOL bForce)
{
ME_Cursor c = *start;
- int nOfs = ME_GetCursorOfs(start);
+ int nOfs = ME_GetCursorOfs(start), text_len = ME_GetTextLength( editor );
int shift = 0;
int totalChars = nChars;
ME_DisplayItem *start_para;
+ BOOL delete_all = FALSE;
/* Prevent deletion past last end of paragraph run. */
- nChars = min(nChars, ME_GetTextLength(editor) - nOfs);
+ nChars = min(nChars, text_len - nOfs);
+ if (nChars == text_len) delete_all = TRUE;
start_para = c.pPara;
if (!bForce)
@@ -423,6 +435,7 @@
continue;
}
}
+ if (delete_all) ME_SetDefaultParaFormat( start_para->member.para.pFmt );
return TRUE;
}
@@ -526,7 +539,7 @@
ME_InternalInsertTextFromCursor(editor, nCursor, &tab, 1, style, MERF_TAB);
pos++;
} else { /* handle EOLs */
- ME_DisplayItem *tp, *end_run;
+ ME_DisplayItem *tp, *end_run, *run, *prev;
ME_Style *tmp_style;
int eol_len = 0;
@@ -560,17 +573,43 @@
}
p = &editor->pCursors[nCursor];
- if (p->nOffset)
- ME_SplitRunSimple(editor, p);
+
+ if (p->nOffset == p->pRun->member.run.len)
+ {
+ run = ME_FindItemFwd( p->pRun, diRun );
+ if (!run) run = p->pRun;
+ }
+ else
+ {
+ if (p->nOffset) ME_SplitRunSimple(editor, p);
+ run = p->pRun;
+ }
+
tmp_style = ME_GetInsertStyle(editor, nCursor);
/* ME_SplitParagraph increases style refcount */
- tp = ME_SplitParagraph(editor, p->pRun, p->pRun->member.run.style,
eol_str, eol_len, 0);
- p->pRun = ME_FindItemFwd(tp, diRun);
- p->pPara = tp;
+ tp = ME_SplitParagraph(editor, run, run->member.run.style, eol_str, eol_len,
0);
+
end_run = ME_FindItemBack(tp, diRun);
ME_ReleaseStyle(end_run->member.run.style);
end_run->member.run.style = tmp_style;
- p->nOffset = 0;
+
+ /* Move any cursors that were at the end of the previous run to the beginning of
the new para */
+ prev = ME_FindItemBack( end_run, diRun );
+ if (prev)
+ {
+ int i;
+ for (i = 0; i < editor->nCursors; i++)
+ {
+ if (editor->pCursors[i].pRun == prev &&
+ editor->pCursors[i].nOffset == prev->member.run.len)
+ {
+ editor->pCursors[i].pPara = tp;
+ editor->pCursors[i].pRun = run;
+ editor->pCursors[i].nOffset = 0;
+ }
+ }
+ }
+
}
}
len -= pos - str;
@@ -865,7 +904,7 @@
}
static BOOL ME_FindRunInRow(ME_TextEditor *editor, ME_DisplayItem *pRow,
- int x, ME_Cursor *cursor, int *pbCaretAtEnd)
+ int x, ME_Cursor *cursor, BOOL *pbCaretAtEnd)
{
ME_DisplayItem *pNext, *pLastRun;
ME_Row *row = &pRow->member.row;
@@ -925,7 +964,7 @@
y -= editor->rcFormat.top;
if (is_eol)
- *is_eol = 0;
+ *is_eol = FALSE;
/* find paragraph */
for (; p != editor->pBuffer->pLast; p = p->member.para.next_para)
@@ -1070,8 +1109,7 @@
void ME_LButtonDown(ME_TextEditor *editor, int x, int y, int clickNum)
{
ME_Cursor tmp_cursor;
- int is_selection = 0;
- BOOL is_shift;
+ BOOL is_selection = FALSE, is_shift;
editor->nUDArrowX = -1;
@@ -1128,7 +1166,6 @@
ME_InvalidateSelection(editor);
ITextHost_TxShowCaret(editor->texthost, FALSE);
ME_ShowCaret(editor);
- ME_ClearTempStyle(editor);
ME_SendSelChange(editor);
}
@@ -1447,7 +1484,9 @@
{
int from, to;
int nStartCursor = ME_GetSelectionOfs(editor, &from, &to);
+ int nEndCursor = nStartCursor ^ 1;
ME_DeleteTextAtCursor(editor, nStartCursor, to - from);
+ editor->pCursors[nEndCursor] = editor->pCursors[nStartCursor];
}
ME_Style *ME_GetSelectionInsertStyle(ME_TextEditor *editor)
@@ -1495,14 +1534,14 @@
ME_CheckCharOffsets(editor);
switch(nVKey) {
case VK_LEFT:
- editor->bCaretAtEnd = 0;
+ editor->bCaretAtEnd = FALSE;
if (ctrl)
success = ME_MoveCursorWords(editor, &tmp_curs, -1);
else
success = ME_MoveCursorChars(editor, &tmp_curs, -1);
break;
case VK_RIGHT:
- editor->bCaretAtEnd = 0;
+ editor->bCaretAtEnd = FALSE;
if (ctrl)
success = ME_MoveCursorWords(editor, &tmp_curs, +1);
else
@@ -1525,7 +1564,7 @@
ME_ArrowCtrlHome(editor, &tmp_curs);
else
ME_ArrowHome(editor, &tmp_curs);
- editor->bCaretAtEnd = 0;
+ editor->bCaretAtEnd = FALSE;
break;
}
case VK_END:
Modified: trunk/reactos/dll/win32/riched20/editor.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/editor.…
==============================================================================
--- trunk/reactos/dll/win32/riched20/editor.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/editor.c [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -245,13 +245,13 @@
static const WCHAR REComboBox20W[] =
{'R','E','C','o','m','b','o','B','o','x','2','0','W',
0};
static HCURSOR hLeft;
-int me_debug = 0;
+BOOL me_debug = FALSE;
HANDLE me_heap = NULL;
static BOOL ME_ListBoxRegistered = FALSE;
static BOOL ME_ComboBoxRegistered = FALSE;
-static inline int is_version_nt(void)
+static inline BOOL is_version_nt(void)
{
return !(GetVersion() & 0x80000000);
}
@@ -284,6 +284,9 @@
WCHAR *pText;
LRESULT total_bytes_read = 0;
BOOL is_read = FALSE;
+ DWORD cp = CP_ACP, copy = 0;
+ char conv_buf[4 + STREAMIN_BUFFER_SIZE]; /* up to 4 additional UTF-8 bytes */
+
static const char bom_utf8[] = {0xEF, 0xBB, 0xBF};
TRACE("%08x %p\n", dwFormat, stream);
@@ -305,8 +308,7 @@
if (!(dwFormat & SF_UNICODE))
{
char * buf = stream->buffer;
- DWORD size = stream->dwSize;
- DWORD cp = CP_ACP;
+ DWORD size = stream->dwSize, end;
if (!is_read)
{
@@ -319,8 +321,56 @@
}
}
- nWideChars = MultiByteToWideChar(cp, 0, buf, size, wszText, STREAMIN_BUFFER_SIZE);
+ if (cp == CP_UTF8)
+ {
+ if (copy)
+ {
+ memcpy(conv_buf + copy, buf, size);
+ buf = conv_buf;
+ size += copy;
+ }
+ end = size;
+ while ((buf[end-1] & 0xC0) == 0x80)
+ {
+ --end;
+ --total_bytes_read; /* strange, but seems to match windows */
+ }
+ if (buf[end-1] & 0x80)
+ {
+ DWORD need = 0;
+ if ((buf[end-1] & 0xE0) == 0xC0)
+ need = 1;
+ if ((buf[end-1] & 0xF0) == 0xE0)
+ need = 2;
+ if ((buf[end-1] & 0xF8) == 0xF0)
+ need = 3;
+
+ if (size - end >= need)
+ {
+ /* we have enough bytes for this sequence */
+ end = size;
+ }
+ else
+ {
+ /* need more bytes, so don't transcode this sequence */
+ --end;
+ }
+ }
+ }
+ else
+ end = size;
+
+ nWideChars = MultiByteToWideChar(cp, 0, buf, end, wszText, STREAMIN_BUFFER_SIZE);
pText = wszText;
+
+ if (cp == CP_UTF8)
+ {
+ if (end != size)
+ {
+ memcpy(conv_buf, buf + end, size - end);
+ copy = size - end;
+ }
+ }
}
else
{
@@ -1146,11 +1196,8 @@
}
if (OleCreateDefaultHandler(&CLSID_NULL, NULL, &IID_IOleObject,
(void**)&lpObject) == S_OK &&
-#if 0
- /* FIXME: enable it when rich-edit properly implements this method */
IRichEditOle_GetClientSite(info->lpRichEditOle, &lpClientSite) == S_OK
&&
IOleObject_SetClientSite(lpObject, lpClientSite) == S_OK &&
-#endif
IOleObject_GetUserClassID(lpObject, &clsid) == S_OK &&
IOleObject_QueryInterface(lpObject, &IID_IOleCache, (void**)&lpOleCache) ==
S_OK &&
IOleCache_Cache(lpOleCache, &fm, 0, &conn) == S_OK &&
@@ -1581,7 +1628,7 @@
ME_Cursor linebreakCursor = *selEnd;
ME_MoveCursorChars(editor, &linebreakCursor, -linebreakSize);
- ME_GetTextW(editor, lastchar, 2, &linebreakCursor, linebreakSize, 0);
+ ME_GetTextW(editor, lastchar, 2, &linebreakCursor, linebreakSize, FALSE);
if (lastchar[0] == '\r' && (lastchar[1] == '\n' ||
lastchar[1] == '\0')) {
ME_InternalDeleteText(editor, &linebreakCursor, linebreakSize, FALSE);
}
@@ -1916,7 +1963,7 @@
ME_SetCursorToStart(editor, &start);
nChars = INT_MAX;
}
- if (ex->codepage == 1200)
+ if (ex->codepage == CP_UNICODE)
{
return ME_GetTextW(editor, (LPWSTR)pText, ex->cb / sizeof(WCHAR) - 1,
&start, nChars, ex->flags & GT_USECRLF);
@@ -1951,17 +1998,33 @@
{
if (!strText) return 0;
if (unicode) {
- return ME_GetTextW(editor, strText, INT_MAX, start, nLen, 0);
+ return ME_GetTextW(editor, strText, INT_MAX, start, nLen, FALSE);
} else {
int nChars;
WCHAR *p = ALLOC_N_OBJ(WCHAR, nLen+1);
if (!p) return 0;
- nChars = ME_GetTextW(editor, p, nLen, start, nLen, 0);
+ nChars = ME_GetTextW(editor, p, nLen, start, nLen, FALSE);
WideCharToMultiByte(CP_ACP, 0, p, nChars+1, (char *)strText,
nLen+1, NULL, NULL);
FREE_OBJ(p);
return nChars;
}
+}
+
+static int handle_EM_EXSETSEL( ME_TextEditor *editor, int to, int from )
+{
+ int end;
+
+ TRACE("%d - %d\n", to, from );
+
+ ME_InvalidateSelection( editor );
+ end = ME_SetSelection( editor, to, from );
+ ME_InvalidateSelection( editor );
+ ITextHost_TxShowCaret( editor->texthost, FALSE );
+ ME_ShowCaret( editor );
+ ME_SendSelChange( editor );
+
+ return end;
}
typedef struct tagME_GlobalDestStruct
@@ -2331,7 +2394,7 @@
case 'A':
if (ctrl_is_down)
{
- ME_SetSelection(editor, 0, -1);
+ handle_EM_EXSETSEL( editor, 0, -1 );
return TRUE;
}
break;
@@ -2790,6 +2853,8 @@
ed->horz_si.nPage = 0;
ed->horz_si.nPos = 0;
+ ed->wheel_remain = 0;
+
OleInitialize(NULL);
return ed;
@@ -2857,6 +2922,23 @@
return TRUE;
}
+static inline int get_default_line_height( ME_TextEditor *editor )
+{
+ int height = 0;
+
+ if (editor->pBuffer && editor->pBuffer->pDefaultStyle)
+ height = editor->pBuffer->pDefaultStyle->tm.tmHeight;
+ if (height <= 0) height = 24;
+
+ return height;
+}
+
+static inline int calc_wheel_change( int *remain, int amount_per_click )
+{
+ int change = amount_per_click * (float)*remain / WHEEL_DELTA;
+ *remain -= WHEEL_DELTA * change / amount_per_click;
+ return change;
+}
static const char * const edit_messages[] = {
"EM_GETSEL",
@@ -3074,11 +3156,14 @@
return ME_StreamOut(editor, wParam, (EDITSTREAM *)lParam);
case WM_GETDLGCODE:
{
- UINT code = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL;
+ UINT code = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS;
+
if (lParam)
editor->bDialogMode = TRUE;
if (editor->styleFlags & ES_MULTILINE)
code |= DLGC_WANTMESSAGE;
+ if (!(editor->styleFlags & ES_SAVESEL))
+ code |= DLGC_HASSETSEL;
return code;
}
case EM_EMPTYUNDOBUFFER:
@@ -3194,12 +3279,7 @@
}
case EM_SETSEL:
{
- ME_InvalidateSelection(editor);
- ME_SetSelection(editor, wParam, lParam);
- ME_InvalidateSelection(editor);
- ITextHost_TxShowCaret(editor->texthost, FALSE);
- ME_ShowCaret(editor);
- ME_SendSelChange(editor);
+ handle_EM_EXSETSEL( editor, wParam, lParam );
return 0;
}
case EM_SETSCROLLPOS:
@@ -3223,19 +3303,9 @@
}
case EM_EXSETSEL:
{
- int end;
CHARRANGE range = *(CHARRANGE *)lParam;
- TRACE("EM_EXSETSEL (%d,%d)\n", range.cpMin, range.cpMax);
-
- ME_InvalidateSelection(editor);
- end = ME_SetSelection(editor, range.cpMin, range.cpMax);
- ME_InvalidateSelection(editor);
- ITextHost_TxShowCaret(editor->texthost, FALSE);
- ME_ShowCaret(editor);
- ME_SendSelChange(editor);
-
- return end;
+ return handle_EM_EXSETSEL( editor, range.cpMin, range.cpMax );
}
case EM_SHOWSCROLLBAR:
{
@@ -3274,11 +3344,11 @@
{
LPWSTR wszText;
SETTEXTEX *pStruct = (SETTEXTEX *)wParam;
- size_t len = 0;
- int from, to;
+ int from, to, len;
ME_Style *style;
- BOOL bRtf, bUnicode, bSelection;
+ BOOL bRtf, bUnicode, bSelection, bUTF8;
int oldModify = editor->nModifyStep;
+ static const char utf8_bom[] = {0xef, 0xbb, 0xbf};
if (!pStruct) return 0;
@@ -3286,7 +3356,8 @@
* we know it isn't unicode. */
bRtf = (lParam && (!strncmp((char *)lParam, "{\\rtf", 5) ||
!strncmp((char *)lParam, "{\\urtf", 6)));
- bUnicode = !bRtf && pStruct->codepage == 1200;
+ bUnicode = !bRtf && pStruct->codepage == CP_UNICODE;
+ bUTF8 = (lParam && (!strncmp((char *)lParam, utf8_bom, 3)));
TRACE("EM_SETTEXTEX - %s, flags %d, cp %d\n",
bUnicode ? debugstr_w((LPCWSTR)lParam) : debugstr_a((LPCSTR)lParam),
@@ -3312,11 +3383,15 @@
len = lParam ? strlen((char *)lParam) : 0;
}
} else {
- /* FIXME: make use of pStruct->codepage in the to unicode translation */
- wszText = lParam ? ME_ToUnicode(bUnicode, (void *)lParam) : NULL;
- len = wszText ? lstrlenW(wszText) : 0;
- ME_InsertTextFromCursor(editor, 0, wszText, len, style);
- ME_EndToUnicode(bUnicode, wszText);
+ if (bUTF8 && !bUnicode) {
+ wszText = ME_ToUnicode(CP_UTF8, (void *)(lParam+3), &len);
+ ME_InsertTextFromCursor(editor, 0, wszText, len, style);
+ ME_EndToUnicode(CP_UTF8, wszText);
+ } else {
+ wszText = ME_ToUnicode(pStruct->codepage, (void *)lParam, &len);
+ ME_InsertTextFromCursor(editor, 0, wszText, len, style);
+ ME_EndToUnicode(pStruct->codepage, wszText);
+ }
}
if (bSelection) {
@@ -3487,7 +3562,7 @@
{
if (!(editor->styleFlags & ES_MULTILINE))
return FALSE;
- ME_ScrollDown(editor, lParam * 8); /* FIXME follow the original */
+ ME_ScrollDown( editor, lParam * get_default_line_height( editor ) );
return TRUE;
}
case WM_CLEAR:
@@ -3503,8 +3578,9 @@
{
int from, to, nStartCursor;
ME_Style *style;
- LPWSTR wszText = lParam ? ME_ToUnicode(unicode, (void *)lParam) : NULL;
- size_t len = wszText ? lstrlenW(wszText) : 0;
+ int len = 0;
+ LONG codepage = unicode ? CP_UNICODE : CP_ACP;
+ LPWSTR wszText = ME_ToUnicode(codepage, (void *)lParam, &len);
TRACE("EM_REPLACESEL - %s\n", debugstr_w(wszText));
nStartCursor = ME_GetSelectionOfs(editor, &from, &to);
@@ -3519,7 +3595,7 @@
*/
if (len>0 && wszText[len-1] == '\n')
ME_ClearTempStyle(editor);
- ME_EndToUnicode(unicode, wszText);
+ ME_EndToUnicode(codepage, wszText);
ME_CommitUndo(editor);
ME_UpdateSelectionLinkAttribute(editor);
if (!wParam)
@@ -3574,9 +3650,11 @@
}
else
{
- LPWSTR wszText = ME_ToUnicode(unicode, (void *)lParam);
+ int textLen;
+ LONG codepage = unicode ? CP_UNICODE : CP_ACP;
+ LPWSTR wszText = ME_ToUnicode(codepage, (void *)lParam, &textLen);
TRACE("WM_SETTEXT - %s\n", debugstr_w(wszText)); /* debugstr_w() */
- if (lstrlenW(wszText) > 0)
+ if (textLen > 0)
{
int len = -1;
@@ -3591,7 +3669,7 @@
}
ME_InsertTextFromCursor(editor, 0, wszText, len,
editor->pBuffer->pDefaultStyle);
}
- ME_EndToUnicode(unicode, wszText);
+ ME_EndToUnicode(codepage, wszText);
}
}
else
@@ -3639,7 +3717,7 @@
/* CR/LF conversion required in 2.0 mode, verbatim in 1.0 mode */
how.flags = GTL_CLOSE | (editor->bEmulateVersion10 ? 0 : GTL_USECRLF) |
GTL_NUMCHARS;
- how.codepage = unicode ? 1200 : CP_ACP;
+ how.codepage = unicode ? CP_UNICODE : CP_ACP;
return ME_GetTextLengthEx(editor, &how);
}
case EM_GETTEXTLENGTHEX:
@@ -3649,7 +3727,7 @@
GETTEXTEX ex;
ex.cb = wParam * (unicode ? sizeof(WCHAR) : sizeof(CHAR));
ex.flags = GT_USECRLF;
- ex.codepage = unicode ? 1200 : CP_ACP;
+ ex.codepage = unicode ? CP_UNICODE : CP_ACP;
ex.lpDefaultChar = NULL;
ex.lpUsedDefChar = NULL;
return ME_GetTextEx(editor, &ex, lParam);
@@ -3948,6 +4026,7 @@
}
case WM_CREATE:
{
+ void *text = NULL;
INT max;
ME_SetDefaultFormatRect(editor);
@@ -3971,6 +4050,29 @@
ITextHost_TxEnableScrollBar(editor->texthost, SB_HORZ, ESB_DISABLE_BOTH);
ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ, TRUE);
}
+ }
+
+ if (lParam)
+ {
+ text = (unicode ? (void*)((CREATESTRUCTW*)lParam)->lpszName
+ : (void*)((CREATESTRUCTA*)lParam)->lpszName);
+ }
+ if (text)
+ {
+ WCHAR *textW;
+ int len;
+ LONG codepage = unicode ? CP_UNICODE : CP_ACP;
+ textW = ME_ToUnicode(codepage, text, &len);
+ if (!(editor->styleFlags & ES_MULTILINE))
+ {
+ len = 0;
+ while(textW[len] != '\0' && textW[len] != '\r' &&
textW[len] != '\n')
+ len++;
+ }
+ ME_InsertTextFromCursor(editor, 0, textW, len,
editor->pBuffer->pDefaultStyle);
+ ME_EndToUnicode(codepage, textW);
+ ME_SetCursorToStart(editor, &editor->pCursors[0]);
+ ME_SetCursorToStart(editor, &editor->pCursors[1]);
}
ME_CommitUndo(editor);
@@ -4047,6 +4149,7 @@
case WM_KILLFOCUS:
ME_CommitUndo(editor); /* End coalesced undos for typed characters */
editor->bHaveFocus = FALSE;
+ editor->wheel_remain = 0;
ME_HideCaret(editor);
ME_SendOldNotify(editor, EN_KILLFOCUS);
return 0;
@@ -4133,14 +4236,9 @@
case WM_VSCROLL:
{
int origNPos;
- int lineHeight;
+ int lineHeight = get_default_line_height( editor );
origNPos = editor->vert_si.nPos;
- lineHeight = 24;
-
- if (editor->pBuffer && editor->pBuffer->pDefaultStyle)
- lineHeight = editor->pBuffer->pDefaultStyle->tm.tmHeight;
- if (lineHeight <= 0) lineHeight = 24;
switch(LOWORD(wParam))
{
@@ -4180,8 +4278,7 @@
}
case WM_MOUSEWHEEL:
{
- int gcWheelDelta;
- UINT pulScrollLines;
+ int delta;
BOOL ctrl_is_down;
if ((editor->nEventMask & ENM_MOUSEEVENTS) &&
@@ -4190,9 +4287,16 @@
ctrl_is_down = GetKeyState(VK_CONTROL) & 0x8000;
- gcWheelDelta = GET_WHEEL_DELTA_WPARAM(wParam);
-
- if (abs(gcWheelDelta) >= WHEEL_DELTA)
+ delta = GET_WHEEL_DELTA_WPARAM(wParam);
+
+ /* if scrolling changes direction, ignore left overs */
+ if ((delta < 0 && editor->wheel_remain < 0) ||
+ (delta > 0 && editor->wheel_remain > 0))
+ editor->wheel_remain += delta;
+ else
+ editor->wheel_remain = delta;
+
+ if (editor->wheel_remain)
{
if (ctrl_is_down) {
int numerator;
@@ -4202,14 +4306,18 @@
} else {
numerator = editor->nZoomNumerator * 100 / editor->nZoomDenominator;
}
- numerator = numerator + (gcWheelDelta / WHEEL_DELTA) * 10;
+ numerator += calc_wheel_change( &editor->wheel_remain, 10 );
if (numerator >= 10 && numerator <= 500)
ME_SetZoom(editor, numerator, 100);
} else {
- SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
- /* FIXME follow the original */
- if (pulScrollLines)
- ME_ScrollDown(editor,pulScrollLines * (-gcWheelDelta / WHEEL_DELTA) * 8);
+ UINT max_lines = 3;
+ int lines = 0;
+
+ SystemParametersInfoW( SPI_GETWHEELSCROLLLINES, 0, &max_lines, 0 );
+ if (max_lines)
+ lines = calc_wheel_change( &editor->wheel_remain, (int)max_lines );
+ if (lines)
+ ME_ScrollDown( editor, -lines * get_default_line_height( editor ) );
}
}
break;
@@ -4617,7 +4725,7 @@
int nLen;
/* bCRLF flag is only honored in 2.0 and up. 1.0 must always return text verbatim */
- if (editor->bEmulateVersion10) bCRLF = 0;
+ if (editor->bEmulateVersion10) bCRLF = FALSE;
pRun = start->pRun;
assert(pRun);
@@ -4902,7 +5010,7 @@
WCHAR bufferW[MAX_PREFIX_LEN + 1];
unsigned int i;
- ME_GetTextW(editor, bufferW, MAX_PREFIX_LEN, start, nChars, 0);
+ ME_GetTextW(editor, bufferW, MAX_PREFIX_LEN, start, nChars, FALSE);
for (i = 0; i < sizeof(prefixes) / sizeof(*prefixes); i++)
{
if (nChars < prefixes[i].length) continue;
Modified: trunk/reactos/dll/win32/riched20/editor.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/editor.…
==============================================================================
--- trunk/reactos/dll/win32/riched20/editor.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/editor.h [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -47,6 +47,7 @@
#include <richole.h>
#include <imm.h>
#include <textserv.h>
+#include <usp10.h>
#include <wine/debug.h>
#include <wine/list.h>
@@ -128,7 +129,6 @@
ME_DisplayItem *ME_MakeDI(ME_DIType type) DECLSPEC_HIDDEN;
void ME_DestroyDisplayItem(ME_DisplayItem *item) DECLSPEC_HIDDEN;
void ME_DumpDocument(ME_TextBuffer *buffer) DECLSPEC_HIDDEN;
-const char *ME_GetDITypeName(ME_DIType type) DECLSPEC_HIDDEN;
/* string.c */
ME_String *ME_MakeStringN(LPCWSTR szText, int nMaxChars) DECLSPEC_HIDDEN;
@@ -141,9 +141,11 @@
void ME_StrDeleteV(ME_String *s, int nVChar, int nChars) DECLSPEC_HIDDEN;
BOOL ME_InsertString(ME_String *s, int ofs, const WCHAR *insert, int len)
DECLSPEC_HIDDEN;
+#define CP_UNICODE 1200
+
/* smart helpers for A<->W conversions, they reserve/free memory and call
MultiByte<->WideChar functions */
-LPWSTR ME_ToUnicode(BOOL unicode, LPVOID psz) DECLSPEC_HIDDEN;
-void ME_EndToUnicode(BOOL unicode, LPVOID psz) DECLSPEC_HIDDEN;
+LPWSTR ME_ToUnicode(LONG codepage, LPVOID psz, INT *len) DECLSPEC_HIDDEN;
+void ME_EndToUnicode(LONG codepage, LPVOID psz) DECLSPEC_HIDDEN;
static inline int ME_IsWSpace(WCHAR ch)
{
@@ -177,7 +179,7 @@
int ME_CharFromPoint(ME_TextEditor *editor, int cx, ME_Run *run, BOOL closest, BOOL
visual_order) DECLSPEC_HIDDEN;
int ME_PointFromCharContext(ME_Context *c, ME_Run *pRun, int nOffset, BOOL visual_order)
DECLSPEC_HIDDEN;
int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset, BOOL visual_order)
DECLSPEC_HIDDEN;
-int ME_CanJoinRuns(const ME_Run *run1, const ME_Run *run2) DECLSPEC_HIDDEN;
+BOOL ME_CanJoinRuns(const ME_Run *run1, const ME_Run *run2) DECLSPEC_HIDDEN;
void ME_JoinRuns(ME_TextEditor *editor, ME_DisplayItem *p) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_SplitRunSimple(ME_TextEditor *editor, ME_Cursor *cursor)
DECLSPEC_HIDDEN;
void ME_UpdateRunFlags(ME_TextEditor *editor, ME_Run *run) DECLSPEC_HIDDEN;
@@ -290,7 +292,7 @@
void ME_RTFTblAttrHook(struct _RTF_Info *info) DECLSPEC_HIDDEN;
void ME_RTFSpecialCharHook(struct _RTF_Info *info) DECLSPEC_HIDDEN;
void ME_StreamInFill(ME_InStream *stream) DECLSPEC_HIDDEN;
-extern int me_debug DECLSPEC_HIDDEN;
+extern BOOL me_debug DECLSPEC_HIDDEN;
/* table.c */
BOOL ME_IsInTable(ME_DisplayItem *pItem) DECLSPEC_HIDDEN;
Modified: trunk/reactos/dll/win32/riched20/editstr.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/editstr…
==============================================================================
--- trunk/reactos/dll/win32/riched20/editstr.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/editstr.h [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -38,6 +38,7 @@
HFONT hFont; /* cached font for the style */
TEXTMETRICW tm; /* cached font metrics for the style */
int nRefs; /* reference count */
+ SCRIPT_CACHE script_cache;
} ME_Style;
typedef enum {
@@ -104,6 +105,7 @@
#define MEPF_CELL 0x04 /* The paragraph is nested in a cell */
#define MEPF_ROWSTART 0x08 /* Hidden empty paragraph at the start of the row */
#define MEPF_ROWEND 0x10 /* Visible empty paragraph at the end of the row */
+#define MEPF_COMPLEX 0x20 /* Use uniscribe */
/******************************** structures *************************/
@@ -120,6 +122,15 @@
int nAscent, nDescent; /* pixels above/below baseline */
POINT pt; /* relative to para's position */
REOBJECT *ole_obj; /* FIXME: should be a union with strText (at least) */
+
+ SCRIPT_ANALYSIS script_analysis;
+ int num_glyphs, max_glyphs;
+ WORD *glyphs;
+ SCRIPT_VISATTR *vis_attrs;
+ int *advances;
+ GOFFSET *offsets;
+ int max_clusters;
+ WORD *clusters;
} ME_Run;
typedef struct tagME_Border
@@ -401,6 +412,7 @@
SCROLLINFO vert_si, horz_si;
BOOL bMouseCaptured;
+ int wheel_remain;
} ME_TextEditor;
typedef struct tagME_Context
Modified: trunk/reactos/dll/win32/riched20/list.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/list.c?…
==============================================================================
--- trunk/reactos/dll/win32/riched20/list.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/list.c [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -17,6 +17,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
#include "editor.h"
@@ -138,40 +139,7 @@
return NULL;
}
-void ME_DestroyDisplayItem(ME_DisplayItem *item)
-{
-/* TRACE("type=%s\n", ME_GetDITypeName(item->type)); */
- if (item->type==diParagraph)
- {
- FREE_OBJ(item->member.para.pFmt);
- ME_DestroyString(item->member.para.text);
- }
-
- if (item->type==diRun)
- {
- if (item->member.run.ole_obj) ME_DeleteReObject(item->member.run.ole_obj);
- ME_ReleaseStyle(item->member.run.style);
- }
- FREE_OBJ(item);
-}
-
-ME_DisplayItem *ME_MakeDI(ME_DIType type)
-{
- ME_DisplayItem *item = ALLOC_OBJ(ME_DisplayItem);
- ZeroMemory(item, sizeof(ME_DisplayItem));
- item->type = type;
- item->prev = item->next = NULL;
- if (type == diParagraph)
- {
- item->member.para.pFmt = ALLOC_OBJ(PARAFORMAT2);
- ME_SetDefaultParaFormat(item->member.para.pFmt);
- item->member.para.nFlags = MEPF_REWRAP;
- }
-
- return item;
-}
-
-const char *ME_GetDITypeName(ME_DIType type)
+static const char *ME_GetDITypeName(ME_DIType type)
{
switch(type)
{
@@ -183,6 +151,42 @@
case diStartRow: return "diStartRow";
default: return "?";
}
+}
+
+void ME_DestroyDisplayItem(ME_DisplayItem *item)
+{
+ if (0)
+ TRACE("type=%s\n", ME_GetDITypeName(item->type));
+ if (item->type==diParagraph)
+ {
+ FREE_OBJ(item->member.para.pFmt);
+ ME_DestroyString(item->member.para.text);
+ }
+
+ if (item->type==diRun)
+ {
+ if (item->member.run.ole_obj) ME_DeleteReObject(item->member.run.ole_obj);
+ heap_free( item->member.run.glyphs );
+ heap_free( item->member.run.clusters );
+ ME_ReleaseStyle(item->member.run.style);
+ }
+ FREE_OBJ(item);
+}
+
+ME_DisplayItem *ME_MakeDI(ME_DIType type)
+{
+ ME_DisplayItem *item = ALLOC_OBJ(ME_DisplayItem);
+ ZeroMemory(item, sizeof(ME_DisplayItem));
+ item->type = type;
+ item->prev = item->next = NULL;
+ if (type == diParagraph)
+ {
+ item->member.para.pFmt = ALLOC_OBJ(PARAFORMAT2);
+ ME_SetDefaultParaFormat(item->member.para.pFmt);
+ item->member.para.nFlags = MEPF_REWRAP;
+ }
+
+ return item;
}
void ME_DumpDocument(ME_TextBuffer *buffer)
Modified: trunk/reactos/dll/win32/riched20/msvc-thiscall.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/msvc-th…
==============================================================================
--- trunk/reactos/dll/win32/riched20/msvc-thiscall.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/msvc-thiscall.c [iso-8859-1] Sat Apr 26 16:54:06
2014
@@ -113,7 +113,7 @@
DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxUIDeactivate,4)
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetText,8)
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSetText,8)
-DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCurrentTargetX,8)
+DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCurTargetX,8)
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetBaseLinePos,8)
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetNaturalSize,36)
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetDropTarget,8)
Modified: trunk/reactos/dll/win32/riched20/msvc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/msvc.h?…
==============================================================================
--- trunk/reactos/dll/win32/riched20/msvc.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/msvc.h [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -101,7 +101,7 @@
typedef HRESULT (WINAPI typeof(fnTextSrv_OnTxUIDeactivate))(ITextServices *iface);
typedef HRESULT (WINAPI typeof(fnTextSrv_TxGetText))(ITextServices *iface,BSTR*
pbstrText);
typedef HRESULT (WINAPI typeof(fnTextSrv_TxSetText))(ITextServices *iface,LPCWSTR
pszText);
-typedef HRESULT (WINAPI typeof(fnTextSrv_TxGetCurrentTargetX))(ITextServices *iface,LONG*
x);
+typedef HRESULT (WINAPI typeof(fnTextSrv_TxGetCurTargetX))(ITextServices *iface,LONG*
x);
typedef HRESULT (WINAPI typeof(fnTextSrv_TxGetBaseLinePos))(ITextServices *iface,LONG*
x);
typedef HRESULT (WINAPI typeof(fnTextSrv_TxGetNaturalSize))(ITextServices *iface,DWORD
dwAspect,HDC hdcDraw,HDC hicTargetDev,DVTARGETDEVICE* ptd,DWORD dwMode,const SIZEL*
psizelExtent,LONG* pwidth,LONG* pheight);
typedef HRESULT (WINAPI typeof(fnTextSrv_TxGetDropTarget))(ITextServices *iface,struct
IDropTarget** ppDropTarget);
Modified: trunk/reactos/dll/win32/riched20/paint.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/paint.c…
==============================================================================
--- trunk/reactos/dll/win32/riched20/paint.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/paint.c [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -331,7 +331,12 @@
old_text = SetTextColor( c->hDC, text_color );
if (selected) old_back = SetBkColor( c->hDC, back_color );
- ExtTextOutW( c->hDC, x, y, selected ? ETO_OPAQUE : 0, sel_rect, text, run->len,
NULL );
+ if (run->para->nFlags & MEPF_COMPLEX)
+ ScriptTextOut( c->hDC, &run->style->script_cache, x, y, selected ?
ETO_OPAQUE : 0, sel_rect,
+ &run->script_analysis, NULL, 0, run->glyphs,
run->num_glyphs, run->advances,
+ NULL, run->offsets );
+ else
+ ExtTextOutW( c->hDC, x, y, selected ? ETO_OPAQUE : 0, sel_rect, text,
run->len, NULL );
if (selected) SetBkColor( c->hDC, old_back );
SetTextColor( c->hDC, old_text );
Modified: trunk/reactos/dll/win32/riched20/reader.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/reader.…
==============================================================================
--- trunk/reactos/dll/win32/riched20/reader.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/reader.c [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -41,8 +41,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
-extern HANDLE me_heap;
-
static int _RTFGetChar(RTF_Info *);
static void _RTFGetToken (RTF_Info *);
static void _RTFGetToken2 (RTF_Info *);
@@ -247,7 +245,7 @@
info->rtfLineNum = 0;
info->rtfLinePos = 0;
info->prevChar = EOF;
- info->bumpLine = 0;
+ info->bumpLine = FALSE;
info->dwCPOutputCount = 0;
if (!info->cpOutputBuffer)
@@ -713,7 +711,7 @@
static int GetChar(RTF_Info *info)
{
int c;
- int oldBumpLine;
+ BOOL oldBumpLine;
if ((c = _RTFGetChar(info)) != EOF)
{
@@ -721,16 +719,16 @@
info->rtfTextBuf[info->rtfTextLen] = '\0';
}
if (info->prevChar == EOF)
- info->bumpLine = 1;
- oldBumpLine = info->bumpLine; /* non-zero if prev char was line ending */
- info->bumpLine = 0;
+ info->bumpLine = TRUE;
+ oldBumpLine = info->bumpLine; /* TRUE if prev char was line ending */
+ info->bumpLine = FALSE;
if (c == '\r')
- info->bumpLine = 1;
+ info->bumpLine = TRUE;
else if (c == '\n')
{
- info->bumpLine = 1;
+ info->bumpLine = TRUE;
if (info->prevChar == '\r') /* oops, previous \r wasn't */
- oldBumpLine = 0; /* really a line ending */
+ oldBumpLine = FALSE; /* really a line ending */
}
++info->rtfLinePos;
if (oldBumpLine) /* were we supposed to increment the */
Modified: trunk/reactos/dll/win32/riched20/richole.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/richole…
==============================================================================
--- trunk/reactos/dll/win32/riched20/richole.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/richole.c [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -503,6 +503,9 @@
{
IRichEditOleImpl *This = impl_from_ITextDocument(me);
TRACE("(%p)\n", me);
+
+ if(!ppSel)
+ return E_INVALIDARG;
*ppSel = &This->txtSel->ITextSelection_iface;
ITextSelection_AddRef(*ppSel);
return S_OK;
@@ -1502,7 +1505,7 @@
return 0;
}
reo->clientSite = CreateOleClientSite(reo);
- if (!reo->txtSel)
+ if (!reo->clientSite)
{
ITextSelection_Release(&reo->txtSel->ITextSelection_iface);
heap_free(reo);
Modified: trunk/reactos/dll/win32/riched20/row.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/row.c?r…
==============================================================================
--- trunk/reactos/dll/win32/riched20/row.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/row.c [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -20,6 +20,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
#include "editor.h"
Modified: trunk/reactos/dll/win32/riched20/rtf.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/rtf.h?r…
==============================================================================
--- trunk/reactos/dll/win32/riched20/rtf.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/rtf.h [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -1129,7 +1129,7 @@
char *pushedTextBuf;
int prevChar;
- int bumpLine;
+ BOOL bumpLine;
/* Document-wide attributes */
RTFFont *fontList; /* these lists MUST be */
Modified: trunk/reactos/dll/win32/riched20/run.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/run.c?r…
==============================================================================
--- trunk/reactos/dll/win32/riched20/run.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/run.c [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -30,17 +30,17 @@
/******************************************************************************
* ME_CanJoinRuns
*
- * Returns 1 if two runs can be safely merged into one, 0 otherwise.
- */
-int ME_CanJoinRuns(const ME_Run *run1, const ME_Run *run2)
+ * Returns TRUE if two runs can be safely merged into one, FALSE otherwise.
+ */
+BOOL ME_CanJoinRuns(const ME_Run *run1, const ME_Run *run2)
{
if ((run1->nFlags | run2->nFlags) & MERF_NOJOIN)
- return 0;
+ return FALSE;
if (run1->style != run2->style)
- return 0;
+ return FALSE;
if ((run1->nFlags & MERF_STYLEFLAGS) != (run2->nFlags &
MERF_STYLEFLAGS))
- return 0;
- return 1;
+ return FALSE;
+ return TRUE;
}
void ME_SkipAndPropagateCharOffset(ME_DisplayItem *p, int shift)
@@ -295,6 +295,14 @@
item->member.run.nCharOfs = -1;
item->member.run.len = 0;
item->member.run.para = NULL;
+ item->member.run.num_glyphs = 0;
+ item->member.run.max_glyphs = 0;
+ item->member.run.glyphs = NULL;
+ item->member.run.vis_attrs = NULL;
+ item->member.run.advances = NULL;
+ item->member.run.offsets = NULL;
+ item->member.run.max_clusters = 0;
+ item->member.run.clusters = NULL;
ME_AddRefStyle(s);
return item;
}
@@ -310,23 +318,52 @@
ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style,
const WCHAR *str, int len, int flags)
{
- ME_DisplayItem *pDI;
+ ME_DisplayItem *pDI, *insert_before = cursor->pRun, *prev;
if (cursor->nOffset)
- ME_SplitRunSimple(editor, cursor);
-
- add_undo_delete_run( editor, cursor->pPara->member.para.nCharOfs +
- cursor->pRun->member.run.nCharOfs, len );
+ {
+ if (cursor->nOffset == cursor->pRun->member.run.len)
+ {
+ insert_before = ME_FindItemFwd( cursor->pRun, diRun );
+ if (!insert_before) insert_before = cursor->pRun; /* Always insert before the
final eop run */
+ }
+ else
+ {
+ ME_SplitRunSimple( editor, cursor );
+ insert_before = cursor->pRun;
+ }
+ }
+
+ add_undo_delete_run( editor, insert_before->member.run.para->nCharOfs +
+ insert_before->member.run.nCharOfs, len );
pDI = ME_MakeRun(style, flags);
- pDI->member.run.nCharOfs = cursor->pRun->member.run.nCharOfs;
+ pDI->member.run.nCharOfs = insert_before->member.run.nCharOfs;
pDI->member.run.len = len;
- pDI->member.run.para = cursor->pRun->member.run.para;
+ pDI->member.run.para = insert_before->member.run.para;
ME_InsertString( pDI->member.run.para->text, pDI->member.run.nCharOfs, str,
len );
- ME_InsertBefore(cursor->pRun, pDI);
+ ME_InsertBefore( insert_before, pDI );
TRACE("Shift length:%d\n", len);
- ME_PropagateCharOffset(cursor->pRun, len);
- cursor->pPara->member.para.nFlags |= MEPF_REWRAP;
+ ME_PropagateCharOffset( insert_before, len );
+ insert_before->member.run.para->nFlags |= MEPF_REWRAP;
+
+ /* Move any cursors that were at the end of the previous run to the end of the inserted
run */
+ prev = ME_FindItemBack( pDI, diRun );
+ if (prev)
+ {
+ int i;
+
+ for (i = 0; i < editor->nCursors; i++)
+ {
+ if (editor->pCursors[i].pRun == prev &&
+ editor->pCursors[i].nOffset == prev->member.run.len)
+ {
+ editor->pCursors[i].pRun = pDI;
+ editor->pCursors[i].nOffset = len;
+ }
+ }
+ }
+
return pDI;
}
@@ -439,6 +476,18 @@
return 1;
}
+ if (run->para->nFlags & MEPF_COMPLEX)
+ {
+ int cp, trailing;
+ if (visual_order && run->script_analysis.fRTL) cx = run->nWidth - cx
- 1;
+
+ ScriptXtoCP( cx, run->len, run->num_glyphs, run->clusters,
run->vis_attrs, run->advances, &run->script_analysis,
+ &cp, &trailing );
+ TRACE("x %d cp %d trailing %d (run width %d) rtl %d log order %d\n", cx,
cp, trailing, run->nWidth,
+ run->script_analysis.fRTL, run->script_analysis.fLogicalOrder);
+ return closest ? cp + trailing : cp;
+ }
+
if (c->editor->cPasswordMask)
{
mask_text = ME_MakeStringR( c->editor->cPasswordMask, run->len );
@@ -514,6 +563,14 @@
nOffset = 0;
}
+ if (pRun->para->nFlags & MEPF_COMPLEX)
+ {
+ int x;
+ ScriptCPtoX( nOffset, FALSE, pRun->len, pRun->num_glyphs, pRun->clusters,
+ pRun->vis_attrs, pRun->advances, &pRun->script_analysis,
&x );
+ if (visual_order && pRun->script_analysis.fRTL) x = pRun->nWidth - x
- 1;
+ return x;
+ }
if (c->editor->cPasswordMask)
{
mask_text = ME_MakeStringR(c->editor->cPasswordMask, pRun->len);
@@ -563,8 +620,12 @@
* this is wasteful for MERF_NONTEXT runs, but that shouldn't matter
* in practice
*/
-
- if (c->editor->cPasswordMask)
+
+ if (para->nFlags & MEPF_COMPLEX)
+ {
+ size.cx = run->nWidth;
+ }
+ else if (c->editor->cPasswordMask)
{
ME_String *szMasked = ME_MakeStringR(c->editor->cPasswordMask,nLen);
ME_GetTextExtent(c, szMasked->szData, nLen,run->style, &size);
@@ -658,19 +719,20 @@
*/
void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end,
CHARFORMAT2W *pFmt)
{
- ME_DisplayItem *para;
- ME_DisplayItem *run;
- ME_DisplayItem *end_run = NULL;
+ ME_DisplayItem *run, *start_run = start->pRun, *end_run = NULL;
if (end && start->pRun == end->pRun && start->nOffset ==
end->nOffset)
return;
- if (start->nOffset)
+ if (start->nOffset == start->pRun->member.run.len)
+ start_run = ME_FindItemFwd( start->pRun, diRun );
+ else if (start->nOffset)
{
/* SplitRunSimple may or may not update the cursors, depending on whether they
* are selection cursors, but we need to make sure they are valid. */
int split_offset = start->nOffset;
ME_DisplayItem *split_run = ME_SplitRunSimple(editor, start);
+ start_run = start->pRun;
if (end && end->pRun == split_run)
{
end->pRun = start->pRun;
@@ -678,31 +740,26 @@
}
}
- if (end && end->nOffset)
- ME_SplitRunSimple(editor, end);
- end_run = end ? end->pRun : NULL;
-
- run = start->pRun;
- para = start->pPara;
- para->member.para.nFlags |= MEPF_REWRAP;
-
- while(run != end_run)
+ if (end)
+ {
+ if (end->nOffset == end->pRun->member.run.len)
+ end_run = ME_FindItemFwd( end->pRun, diRun );
+ else
+ {
+ if (end->nOffset) ME_SplitRunSimple(editor, end);
+ end_run = end->pRun;
+ }
+ }
+
+ for (run = start_run; run != end_run; run = ME_FindItemFwd( run, diRun ))
{
ME_Style *new_style = ME_ApplyStyle(run->member.run.style, pFmt);
- /* ME_DumpStyle(new_style); */
-
- add_undo_set_char_fmt( editor, para->member.para.nCharOfs +
run->member.run.nCharOfs,
+
+ add_undo_set_char_fmt( editor, run->member.run.para->nCharOfs +
run->member.run.nCharOfs,
run->member.run.len, &run->member.run.style->fmt
);
ME_ReleaseStyle(run->member.run.style);
run->member.run.style = new_style;
- run = ME_FindItemFwd(run, diRunOrParagraph);
- if (run && run->type == diParagraph)
- {
- para = run;
- run = ME_FindItemFwd(run, diRun);
- if (run != end_run)
- para->member.para.nFlags |= MEPF_REWRAP;
- }
+ run->member.run.para->nFlags |= MEPF_REWRAP;
}
}
Modified: trunk/reactos/dll/win32/riched20/string.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/string.…
==============================================================================
--- trunk/reactos/dll/win32/riched20/string.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/string.c [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -172,23 +172,30 @@
}
}
-LPWSTR ME_ToUnicode(BOOL unicode, LPVOID psz)
-{
- assert(psz != NULL);
-
- if (unicode)
+LPWSTR ME_ToUnicode(LONG codepage, LPVOID psz, INT *len)
+{
+ *len = 0;
+ if (!psz) return NULL;
+
+ if (codepage == CP_UNICODE)
+ {
+ *len = lstrlenW(psz);
return psz;
+ }
else {
WCHAR *tmp;
- int nChars = MultiByteToWideChar(CP_ACP, 0, psz, -1, NULL, 0);
+ int nChars = MultiByteToWideChar(codepage, 0, psz, -1, NULL, 0);
+
+ if(!nChars) return NULL;
+
if((tmp = ALLOC_N_OBJ(WCHAR, nChars)) != NULL)
- MultiByteToWideChar(CP_ACP, 0, psz, -1, tmp, nChars);
+ *len = MultiByteToWideChar(codepage, 0, psz, -1, tmp, nChars) - 1;
return tmp;
}
}
-void ME_EndToUnicode(BOOL unicode, LPVOID psz)
-{
- if (!unicode)
+void ME_EndToUnicode(LONG codepage, LPVOID psz)
+{
+ if (codepage != CP_UNICODE)
FREE_OBJ(psz);
}
Modified: trunk/reactos/dll/win32/riched20/style.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/style.c…
==============================================================================
--- trunk/reactos/dll/win32/riched20/style.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/style.c [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -149,6 +149,7 @@
s->hFont = NULL;
memset(&s->tm, 0, sizeof(s->tm));
s->tm.tmAscent = -1;
+ s->script_cache = NULL;
all_refs++;
TRACE_(richedit_style)("ME_MakeStyle %p, total refs=%d\n", s, all_refs);
return s;
@@ -435,6 +436,7 @@
DeleteObject(s->hFont);
s->hFont = NULL;
}
+ ScriptFreeCache( &s->script_cache );
FREE_OBJ(s);
}
Modified: trunk/reactos/dll/win32/riched20/table.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/table.c…
==============================================================================
--- trunk/reactos/dll/win32/riched20/table.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/table.c [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -34,7 +34,7 @@
*
* Richedit version 4.1:
* Tables are implemented such that cells can contain multiple paragraphs,
- * each with it's own paragraph format, and cells may even contain tables
+ * each with its own paragraph format, and cells may even contain tables
* nested within the cell.
*
* There is also a paragraph at the start of each table row that contains
Modified: trunk/reactos/dll/win32/riched20/txtsrv.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/txtsrv.…
==============================================================================
--- trunk/reactos/dll/win32/riched20/txtsrv.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/txtsrv.c [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -278,7 +278,7 @@
return S_OK;
}
-DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetCurrentTargetX(ITextServices *iface, LONG
*x)
+DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetCurTargetX(ITextServices *iface, LONG *x)
{
ITextServicesImpl *This = impl_from_ITextServices(iface);
@@ -340,7 +340,7 @@
DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxUIDeactivate,4)
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetText,8)
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSetText,8)
-DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCurrentTargetX,8)
+DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCurTargetX,8)
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetBaseLinePos,8)
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetNaturalSize,36)
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetDropTarget,8)
@@ -364,7 +364,7 @@
THISCALL(fnTextSrv_OnTxUIDeactivate),
THISCALL(fnTextSrv_TxGetText),
THISCALL(fnTextSrv_TxSetText),
- THISCALL(fnTextSrv_TxGetCurrentTargetX),
+ THISCALL(fnTextSrv_TxGetCurTargetX),
THISCALL(fnTextSrv_TxGetBaseLinePos),
THISCALL(fnTextSrv_TxGetNaturalSize),
THISCALL(fnTextSrv_TxGetDropTarget),
Modified: trunk/reactos/dll/win32/riched20/wrap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/wrap.c?…
==============================================================================
--- trunk/reactos/dll/win32/riched20/wrap.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/wrap.c [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
#include "editor.h"
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
@@ -30,6 +31,66 @@
* - objects/images are not handled yet
* - no tabs
*/
+
+
+static BOOL get_run_glyph_buffers( ME_Run *run )
+{
+ heap_free( run->glyphs );
+ run->glyphs = heap_alloc( run->max_glyphs * (sizeof(WORD) +
sizeof(SCRIPT_VISATTR) + sizeof(int) + sizeof(GOFFSET)) );
+ if (!run->glyphs) return FALSE;
+
+ run->vis_attrs = (SCRIPT_VISATTR*)((char*)run->glyphs + run->max_glyphs *
sizeof(WORD));
+ run->advances = (int*)((char*)run->glyphs + run->max_glyphs * (sizeof(WORD)
+ sizeof(SCRIPT_VISATTR)));
+ run->offsets = (GOFFSET*)((char*)run->glyphs + run->max_glyphs *
(sizeof(WORD) + sizeof(SCRIPT_VISATTR) + sizeof(int)));
+
+ return TRUE;
+}
+
+static HRESULT shape_run( ME_Context *c, ME_Run *run )
+{
+ HRESULT hr;
+ HFONT old_font;
+ int i;
+
+ if (!run->glyphs)
+ {
+ run->max_glyphs = 1.5 * run->len + 16; /* This is suggested in the
uniscribe documentation */
+ run->max_glyphs = (run->max_glyphs + 7) & ~7; /* Keep alignment simple
*/
+ get_run_glyph_buffers( run );
+ }
+
+ if (run->max_clusters < run->len)
+ {
+ heap_free( run->clusters );
+ run->max_clusters = run->len * 2;
+ run->clusters = heap_alloc( run->max_clusters * sizeof(WORD) );
+ }
+
+ old_font = ME_SelectStyleFont( c, run->style );
+ while (1)
+ {
+ hr = ScriptShape( c->hDC, &run->style->script_cache, get_text( run,
0 ), run->len, run->max_glyphs,
+ &run->script_analysis, run->glyphs, run->clusters,
run->vis_attrs, &run->num_glyphs );
+ if (hr != E_OUTOFMEMORY) break;
+ if (run->max_glyphs > 10 * run->len) break; /* something has clearly
gone wrong */
+ run->max_glyphs *= 2;
+ get_run_glyph_buffers( run );
+ }
+
+ if (SUCCEEDED(hr))
+ hr = ScriptPlace( c->hDC, &run->style->script_cache, run->glyphs,
run->num_glyphs, run->vis_attrs,
+ &run->script_analysis, run->advances,
run->offsets, NULL );
+
+ if (SUCCEEDED(hr))
+ {
+ for (i = 0, run->nWidth = 0; i < run->num_glyphs; i++)
+ run->nWidth += run->advances[i];
+ }
+
+ ME_UnselectStyleFont( c, run->style, old_font );
+
+ return hr;
+}
/******************************************************************************
* calc_run_extent
@@ -77,7 +138,10 @@
ME_SplitRunSimple(editor, &cursor);
run2 = &cursor.pRun->member.run;
-
+ run2->script_analysis = run->script_analysis;
+
+ shape_run( wc->context, run );
+ shape_run( wc->context, run2 );
calc_run_extent(wc->context, para, wc->nRow ? wc->nLeftMargin :
wc->nFirstMargin, run);
run2->pt.x = run->pt.x+run->nWidth;
@@ -165,15 +229,73 @@
wc->pt.y++;
}
+static void layout_row( ME_DisplayItem *start, const ME_DisplayItem *end )
+{
+ ME_DisplayItem *p;
+ int i, num_runs = 0;
+ int buf[16 * 5]; /* 5 arrays - 4 of int & 1 of BYTE, alloc space for 5 of ints
*/
+ int *vis_to_log = buf, *log_to_vis, *widths, *pos;
+ BYTE *levels;
+ BOOL found_black = FALSE;
+
+ for (p = end->prev; p != start->prev; p = p->prev)
+ {
+ if (p->type == diRun)
+ {
+ if (!found_black) found_black = !(p->member.run.nFlags &
(MERF_WHITESPACE | MERF_ENDPARA));
+ if (found_black) num_runs++;
+ }
+ }
+
+ TRACE("%d runs\n", num_runs);
+ if (!num_runs) return;
+
+ if (num_runs > sizeof(buf) / (sizeof(buf[0]) * 5))
+ vis_to_log = heap_alloc( num_runs * sizeof(int) * 5 );
+
+ log_to_vis = vis_to_log + num_runs;
+ widths = vis_to_log + 2 * num_runs;
+ pos = vis_to_log + 3 * num_runs;
+ levels = (BYTE*)(vis_to_log + 4 * num_runs);
+
+ for (i = 0, p = start; i < num_runs; p = p->next)
+ {
+ if (p->type == diRun)
+ {
+ levels[i] = p->member.run.script_analysis.s.uBidiLevel;
+ widths[i] = p->member.run.nWidth;
+ TRACE( "%d: level %d width %d\n", i, levels[i], widths[i] );
+ i++;
+ }
+ }
+
+ ScriptLayout( num_runs, levels, vis_to_log, log_to_vis );
+
+ pos[0] = start->member.run.para->pt.x;
+ for (i = 1; i < num_runs; i++)
+ pos[i] = pos[i - 1] + widths[ vis_to_log[ i - 1 ] ];
+
+ for (i = 0, p = start; i < num_runs; p = p->next)
+ {
+ if (p->type == diRun)
+ {
+ p->member.run.pt.x = pos[ log_to_vis[ i ] ];
+ TRACE( "%d: x = %d\n", i, p->member.run.pt.x );
+ i++;
+ }
+ }
+
+ if (vis_to_log != buf) heap_free( vis_to_log );
+}
+
static void ME_InsertRowStart(ME_WrapContext *wc, const ME_DisplayItem *pEnd)
{
- ME_DisplayItem *p, *row, *para;
+ ME_DisplayItem *p, *row;
+ ME_Paragraph *para = &wc->pPara->member.para;
BOOL bSkippingSpaces = TRUE;
int ascent = 0, descent = 0, width=0, shift = 0, align = 0;
- PARAFORMAT2 *pFmt;
+
/* wrap text */
- para = wc->pPara;
- pFmt = para->member.para.pFmt;
for (p = pEnd->prev; p!=wc->pRowStart->prev; p = p->prev)
{
@@ -207,10 +329,10 @@
}
}
- para->member.para.nWidth = max(para->member.para.nWidth, width);
+ para->nWidth = max(para->nWidth, width);
row = ME_MakeRow(ascent+descent, ascent, width);
if (wc->context->editor->bEmulateVersion10 && /* v1.0 - 3.0 */
- pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE)
+ (para->pFmt->dwMask & PFM_TABLE) && (para->pFmt->wEffects
& PFE_TABLE))
{
/* The text was shifted down in ME_BeginRow so move the wrap context
* back to where it should be. */
@@ -221,12 +343,15 @@
row->member.row.pt = wc->pt;
row->member.row.nLMargin = (!wc->nRow ? wc->nFirstMargin :
wc->nLeftMargin);
row->member.row.nRMargin = wc->nRightMargin;
- assert(para->member.para.pFmt->dwMask & PFM_ALIGNMENT);
- align = para->member.para.pFmt->wAlignment;
+ assert(para->pFmt->dwMask & PFM_ALIGNMENT);
+ align = para->pFmt->wAlignment;
if (align == PFA_CENTER)
shift = max((wc->nAvailWidth-width)/2, 0);
if (align == PFA_RIGHT)
shift = max(wc->nAvailWidth-width, 0);
+
+ if (para->nFlags & MEPF_COMPLEX) layout_row( wc->pRowStart, pEnd );
+
row->member.row.pt.x = row->member.row.nLMargin + shift;
for (p = wc->pRowStart; p!=pEnd; p = p->next)
{
@@ -613,6 +738,111 @@
}
}
+static HRESULT itemize_para( ME_Context *c, ME_DisplayItem *p )
+{
+ ME_Paragraph *para = &p->member.para;
+ ME_Run *run;
+ ME_DisplayItem *di;
+ SCRIPT_ITEM buf[16], *items = buf;
+ int items_passed = sizeof( buf ) / sizeof( buf[0] ), num_items, cur_item;
+ SCRIPT_CONTROL control = { LANG_USER_DEFAULT, FALSE, FALSE, FALSE, FALSE, FALSE,
FALSE, FALSE,
+ FALSE, FALSE, 0 };
+ SCRIPT_STATE state = { 0, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 0,
0 };
+ HRESULT hr;
+
+ assert( p->type == diParagraph );
+
+ while (1)
+ {
+ hr = ScriptItemize( para->text->szData, para->text->nLen,
items_passed, &control,
+ &state, items, &num_items );
+ if (hr != E_OUTOFMEMORY) break; /* may not be enough items if hr == E_OUTOFMEMORY
*/
+ if (items_passed > para->text->nLen + 1) break; /* something else has
gone wrong */
+ items_passed *= 2;
+ if (items == buf)
+ items = heap_alloc( items_passed * sizeof( *items ) );
+ else
+ items = heap_realloc( items, items_passed * sizeof( *items ) );
+ if (!items) break;
+ }
+ if (FAILED( hr )) goto end;
+
+ if (TRACE_ON( richedit ))
+ {
+ TRACE( "got items:\n" );
+ for (cur_item = 0; cur_item < num_items; cur_item++)
+ {
+ TRACE( "\t%d - %d RTL %d bidi level %d\n",
items[cur_item].iCharPos, items[cur_item+1].iCharPos - 1,
+ items[cur_item].a.fRTL, items[cur_item].a.s.uBidiLevel );
+ }
+
+ TRACE( "before splitting runs into ranges\n" );
+ for (di = p->next; di != p->member.para.next_para; di = di->next)
+ {
+ if (di->type != diRun) continue;
+ TRACE( "\t%d: %s\n", di->member.run.nCharOfs, debugstr_run(
&di->member.run ) );
+ }
+ }
+
+ /* split runs into ranges at item boundaries */
+ for (di = p->next, cur_item = 0; di != p->member.para.next_para; di =
di->next)
+ {
+ if (di->type != diRun) continue;
+ run = &di->member.run;
+
+ if (run->nCharOfs == items[cur_item+1].iCharPos) cur_item++;
+
+ items[cur_item].a.fLogicalOrder = TRUE;
+ run->script_analysis = items[cur_item].a;
+
+ if (run->nFlags & MERF_ENDPARA) break; /* don't split eop runs */
+
+ if (run->nCharOfs + run->len > items[cur_item+1].iCharPos)
+ {
+ ME_Cursor cursor = {p, di, items[cur_item+1].iCharPos - run->nCharOfs};
+ ME_SplitRunSimple( c->editor, &cursor );
+ }
+ }
+
+ if (TRACE_ON( richedit ))
+ {
+ TRACE( "after splitting into ranges\n" );
+ for (di = p->next; di != p->member.para.next_para; di = di->next)
+ {
+ if (di->type != diRun) continue;
+ TRACE( "\t%d: %s\n", di->member.run.nCharOfs, debugstr_run(
&di->member.run ) );
+ }
+ }
+
+ para->nFlags |= MEPF_COMPLEX;
+
+end:
+ if (items != buf) heap_free( items );
+ return hr;
+}
+
+
+static HRESULT shape_para( ME_Context *c, ME_DisplayItem *p )
+{
+ ME_DisplayItem *di;
+ ME_Run *run;
+ HRESULT hr;
+
+ for (di = p->next; di != p->member.para.next_para; di = di->next)
+ {
+ if (di->type != diRun) continue;
+ run = &di->member.run;
+
+ hr = shape_run( c, run );
+ if (FAILED( hr ))
+ {
+ run->para->nFlags &= ~MEPF_COMPLEX;
+ return hr;
+ }
+ }
+ return hr;
+}
+
static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) {
ME_DisplayItem *p;
ME_WrapContext wc;
@@ -625,6 +855,15 @@
return;
}
ME_PrepareParagraphForWrapping(c, tp);
+
+ /* For now treating all non-password text as complex for better testing */
+ if (!c->editor->cPasswordMask /* &&
+ ScriptIsComplex( tp->member.para.text->szData,
tp->member.para.text->nLen, SIC_COMPLEX ) == S_OK */)
+ {
+ if (SUCCEEDED( itemize_para( c, tp ) ))
+ shape_para( c, tp );
+ }
+
pFmt = tp->member.para.pFmt;
wc.context = c;
Modified: trunk/reactos/dll/win32/riched20/writer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/writer.…
==============================================================================
--- trunk/reactos/dll/win32/riched20/writer.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/riched20/writer.c [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -22,6 +22,7 @@
#include "rtf.h"
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
+
static BOOL
ME_StreamOutRTFText(ME_OutStream *pStream, const WCHAR *text, LONG nChars);
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Apr 26 16:54:06 2014
@@ -164,7 +164,7 @@
reactos/dll/win32/query # Synced to Wine-1.7.1
reactos/dll/win32/rasapi32 # Synced to Wine-1.7.1
reactos/dll/win32/resutils # Synced to Wine-1.7.1
-reactos/dll/win32/riched20 # Synced to Wine-1.7.1
+reactos/dll/win32/riched20 # Synced to Wine-1.7.17
reactos/dll/win32/riched32 # Synced to Wine-1.7.1
reactos/dll/win32/rpcrt4 # Synced to Wine-1.7.1
reactos/dll/win32/rsabase # Synced to Wine-1.7.1