Commit 8724c37c authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

riched20: Set the window title in the host.

parent a1f88602
......@@ -3207,16 +3207,10 @@ static void ME_SetText(ME_TextEditor *editor, void *text, BOOL unicode)
ME_EndToUnicode(codepage, wszText);
}
static LRESULT ME_WmCreate(ME_TextEditor *editor, LPARAM lParam, BOOL unicode)
static LRESULT ME_WmCreate( ME_TextEditor *editor )
{
CREATESTRUCTW *createW = (CREATESTRUCTW*)lParam;
CREATESTRUCTA *createA = (CREATESTRUCTA*)lParam;
void *text = NULL;
INT max;
if (lParam)
text = unicode ? (void*)createW->lpszName : (void*)createA->lpszName;
max = (editor->scrollbars & ES_DISABLENOSCROLL) ? 1 : 0;
if (~editor->scrollbars & ES_DISABLENOSCROLL || editor->scrollbars & WS_VSCROLL)
ITextHost_TxSetScrollRange(editor->texthost, SB_VERT, 0, max, TRUE);
......@@ -3237,17 +3231,6 @@ static LRESULT ME_WmCreate(ME_TextEditor *editor, LPARAM lParam, BOOL unicode)
ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ, TRUE);
}
}
if (text)
{
ME_SetText(editor, text, unicode);
ME_SetCursorToStart(editor, &editor->pCursors[0]);
ME_SetCursorToStart(editor, &editor->pCursors[1]);
}
ME_CommitUndo(editor);
ME_WrapMarkedParagraphs(editor);
update_caret(editor);
return 0;
}
......@@ -3312,8 +3295,8 @@ static LRESULT handle_EM_SETCHARFORMAT( ME_TextEditor *editor, WPARAM flags, con
* The LRESULT that is returned is a return value for window procs,
* and the phresult parameter is the COM return code needed by the
* text services interface. */
LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL unicode, HRESULT* phresult)
LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
LPARAM lParam, HRESULT* phresult )
{
*phresult = S_OK;
......@@ -3978,7 +3961,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
return (wParam >= 0x40000) ? 0 : MAKELONG( pt.x, pt.y );
}
case WM_CREATE:
return ME_WmCreate(editor, lParam, unicode);
return ME_WmCreate( editor );
case WM_SETCURSOR:
{
POINT cursor_pos;
......@@ -4060,23 +4043,19 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
case WM_CHAR:
return handle_wm_char( editor, wParam, lParam );
case WM_UNICHAR:
if (unicode)
{
if(wParam == UNICODE_NOCHAR) return TRUE;
if(wParam <= 0x000fffff)
{
if(wParam > 0xffff) /* convert to surrogates */
{
wParam -= 0x10000;
handle_wm_char( editor, (wParam >> 10) + 0xd800, 0 );
handle_wm_char( editor, (wParam & 0x03ff) + 0xdc00, 0 );
}
else
handle_wm_char( editor, wParam, 0 );
}
return 0;
}
break;
if (wParam == UNICODE_NOCHAR) return TRUE;
if (wParam <= 0x000fffff)
{
if (wParam > 0xffff) /* convert to surrogates */
{
wParam -= 0x10000;
handle_wm_char( editor, (wParam >> 10) + 0xd800, 0 );
handle_wm_char( editor, (wParam & 0x03ff) + 0xdc00, 0 );
}
else
handle_wm_char( editor, wParam, 0 );
}
return 0;
case EM_STOPGROUPTYPING:
ME_CommitUndo(editor); /* End coalesced undos for typed characters */
return 0;
......
......@@ -271,8 +271,8 @@ void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN;
/* editor.c */
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) DECLSPEC_HIDDEN;
void ME_DestroyEditor(ME_TextEditor *editor) DECLSPEC_HIDDEN;
LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL unicode, HRESULT* phresult) DECLSPEC_HIDDEN;
LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
LPARAM lParam, HRESULT* phresult ) DECLSPEC_HIDDEN;
void ME_SendOldNotify(ME_TextEditor *editor, int nCode) DECLSPEC_HIDDEN;
int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int buflen,
const ME_Cursor *start, int srcChars, BOOL bCRLF, BOOL bEOP) DECLSPEC_HIDDEN;
......
......@@ -963,10 +963,27 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
}
case WM_CREATE:
{
CREATESTRUCTW *createW = (CREATESTRUCTW *)lparam;
CREATESTRUCTA *createA = (CREATESTRUCTA *)lparam;
void *text;
WCHAR *textW = NULL;
LONG codepage = unicode ? CP_UNICODE : CP_ACP;
int len;
ITextServices_OnTxPropertyBitsChange( host->text_srv, TXTBIT_CLIENTRECTCHANGE, 0 );
res = ME_HandleMessage( editor, msg, wparam, lparam, unicode, &hr );
break;
if (lparam)
{
text = unicode ? (void *)createW->lpszName : (void *)createA->lpszName;
textW = ME_ToUnicode( codepage, text, &len );
}
ITextServices_TxSetText( host->text_srv, textW );
if (lparam) ME_EndToUnicode( codepage, textW );
hr = ITextServices_TxSendMessage( host->text_srv, msg, wparam, lparam, &res );
break;
}
case WM_DESTROY:
ITextHost_Release( &host->ITextHost_iface );
return 0;
......@@ -1254,7 +1271,7 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
break;
}
default:
res = ME_HandleMessage( editor, msg, wparam, lparam, unicode, &hr );
hr = ITextServices_TxSendMessage( host->text_srv, msg, wparam, lparam, &res );
}
if (hr == S_FALSE)
......
......@@ -130,16 +130,16 @@ static ULONG WINAPI fnTextSrv_Release(ITextServices *iface)
}
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSendMessage,20)
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSendMessage(ITextServices *iface, UINT msg, WPARAM wparam,
LPARAM lparam, LRESULT *plresult)
DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxSendMessage( ITextServices *iface, UINT msg, WPARAM wparam,
LPARAM lparam, LRESULT *result )
{
struct text_services *services = impl_from_ITextServices( iface );
HRESULT hresult;
LRESULT lresult;
struct text_services *services = impl_from_ITextServices( iface );
HRESULT hr;
LRESULT res;
lresult = ME_HandleMessage( services->editor, msg, wparam, lparam, TRUE, &hresult );
if (plresult) *plresult = lresult;
return hresult;
res = editor_handle_message( services->editor, msg, wparam, lparam, &hr );
if (result) *result = res;
return hr;
}
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxDraw,52)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment