mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 00:23:37 +00:00
riched20: Implement ITextDocument::Freeze and ITextDocument::Unfreeze.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54617
This commit is contained in:
parent
2027be7e03
commit
3fe15349d3
|
@ -2994,6 +2994,7 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
|
|||
ed->mode |= (ed->props & TXTBIT_RICHTEXT) ? TM_RICHTEXT : TM_PLAINTEXT;
|
||||
ed->AutoURLDetect_bEnable = FALSE;
|
||||
ed->bHaveFocus = FALSE;
|
||||
ed->freeze_count = 0;
|
||||
ed->bMouseCaptured = FALSE;
|
||||
ed->caret_hidden = FALSE;
|
||||
ed->caret_height = 0;
|
||||
|
|
|
@ -429,6 +429,7 @@ typedef struct tagME_TextEditor
|
|||
BOOL AutoURLDetect_bEnable;
|
||||
WCHAR password_char;
|
||||
BOOL bHaveFocus;
|
||||
DWORD freeze_count;
|
||||
/*for IME */
|
||||
int imeStartIndex;
|
||||
DWORD selofs; /* The size of the selection bar on the left side of control */
|
||||
|
|
|
@ -123,7 +123,8 @@ void ME_Repaint(ME_TextEditor *editor)
|
|||
ME_UpdateScrollBar(editor);
|
||||
FIXME("ME_Repaint had to call ME_WrapMarkedParagraphs\n");
|
||||
}
|
||||
ITextHost_TxViewChange(editor->texthost, TRUE);
|
||||
if (!editor->freeze_count)
|
||||
ITextHost_TxViewChange(editor->texthost, TRUE);
|
||||
}
|
||||
|
||||
void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now)
|
||||
|
@ -140,7 +141,8 @@ void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now)
|
|||
|
||||
update_caret( editor );
|
||||
|
||||
ITextHost_TxViewChange(editor->texthost, update_now);
|
||||
if (!editor->freeze_count)
|
||||
ITextHost_TxViewChange(editor->texthost, update_now);
|
||||
|
||||
ME_SendSelChange(editor);
|
||||
|
||||
|
|
|
@ -4217,15 +4217,22 @@ static HRESULT WINAPI ITextDocument2Old_fnSave(ITextDocument2Old *iface, VARIANT
|
|||
static HRESULT WINAPI ITextDocument2Old_fnFreeze(ITextDocument2Old *iface, LONG *pCount)
|
||||
{
|
||||
struct text_services *services = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n", services);
|
||||
return E_NOTIMPL;
|
||||
|
||||
if (services->editor->freeze_count < LONG_MAX) services->editor->freeze_count++;
|
||||
|
||||
if (pCount) *pCount = services->editor->freeze_count;
|
||||
return services->editor->freeze_count != 0 ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnUnfreeze(ITextDocument2Old *iface, LONG *pCount)
|
||||
{
|
||||
struct text_services *services = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n", services);
|
||||
return E_NOTIMPL;
|
||||
|
||||
if (services->editor->freeze_count && !--services->editor->freeze_count)
|
||||
ME_RewrapRepaint(services->editor);
|
||||
|
||||
if (pCount) *pCount = services->editor->freeze_count;
|
||||
return services->editor->freeze_count == 0 ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnBeginEditCollection(ITextDocument2Old *iface)
|
||||
|
|
|
@ -5518,9 +5518,7 @@ static void test_freeze(void)
|
|||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Freeze(doc, &count);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Freeze returned %#lx\n", hr);
|
||||
todo_wine
|
||||
ok(count == 1, "expected count to be %d, got %ld\n", 1, count);
|
||||
|
||||
style2 = GetWindowLongW(hwnd, GWL_STYLE);
|
||||
|
@ -5528,54 +5526,40 @@ static void test_freeze(void)
|
|||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Freeze(doc, &count);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Freeze returned %#lx\n", hr);
|
||||
todo_wine
|
||||
ok(count == 2, "expected count to be %d, got %ld\n", 2, count);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Unfreeze(doc, &count);
|
||||
todo_wine
|
||||
ok(hr == S_FALSE, "ITextDocument_Unfreeze returned %#lx\n", hr);
|
||||
todo_wine
|
||||
ok(count == 1, "expected count to be %d, got %ld\n", 1, count);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Unfreeze(doc, &count);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Unfreeze returned %#lx\n", hr);
|
||||
todo_wine
|
||||
ok(count == 0, "expected count to be %d, got %ld\n", 0, count);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Unfreeze(doc, &count);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Unfreeze returned %#lx\n", hr);
|
||||
todo_wine
|
||||
ok(count == 0, "expected count to be %d, got %ld\n", 0, count);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Freeze(doc, &count);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Freeze returned %#lx\n", hr);
|
||||
todo_wine
|
||||
ok(count == 1, "expected count to be %d, got %ld\n", 1, count);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Unfreeze(doc, &count);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Unfreeze returned %#lx\n", hr);
|
||||
todo_wine
|
||||
ok(count == 0, "expected count to be %d, got %ld\n", 0, count);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Freeze(doc, NULL);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Freeze returned %#lx\n", hr);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Unfreeze(doc, NULL);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Unfreeze returned %#lx\n", hr);
|
||||
|
||||
release_interfaces(&hwnd, &reole, &doc, &selection);
|
||||
|
|
|
@ -863,9 +863,7 @@ static void test_TxDraw(void)
|
|||
|
||||
freeze_count = 0xdeadbeef;
|
||||
hr = ITextDocument_Freeze( txtdoc, &freeze_count );
|
||||
todo_wine
|
||||
ok( hr == S_OK, "ITextDocument_Freeze returned %#lx\n", hr );
|
||||
todo_wine
|
||||
ok( freeze_count == 1, "expected count to be %d, got %ld\n", 1, freeze_count );
|
||||
|
||||
hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
|
||||
|
@ -873,14 +871,11 @@ static void test_TxDraw(void)
|
|||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
|
||||
NULL, NULL, 0, TXTVIEW_ACTIVE );
|
||||
todo_wine
|
||||
ok( hr == E_UNEXPECTED, "got %08lx\n", hr );
|
||||
|
||||
freeze_count = 0xdeadbeef;
|
||||
hr = ITextDocument_Unfreeze( txtdoc, &freeze_count );
|
||||
todo_wine
|
||||
ok( hr == S_OK, "ITextDocument_Unfreeze returned %#lx\n", hr );
|
||||
todo_wine
|
||||
ok( freeze_count == 0, "expected count to be %d, got %ld\n", 0, freeze_count );
|
||||
|
||||
hr = ITextServices_OnTxInPlaceDeactivate( txtserv );
|
||||
|
|
|
@ -1313,18 +1313,22 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
|
|||
RECT rc, client, update;
|
||||
PAINTSTRUCT ps;
|
||||
HBRUSH brush, old_brush;
|
||||
LONG view_id;
|
||||
|
||||
ITextHost_TxGetClientRect( &host->ITextHost_iface, &client );
|
||||
|
||||
if (msg == WM_PAINT)
|
||||
{
|
||||
/* TODO retrieve if the text document is frozen */
|
||||
hdc = BeginPaint( hwnd, &ps );
|
||||
update = ps.rcPaint;
|
||||
view_id = TXTVIEW_ACTIVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
hdc = (HDC)wparam;
|
||||
update = client;
|
||||
view_id = TXTVIEW_INACTIVE;
|
||||
}
|
||||
|
||||
brush = CreateSolidBrush( ITextHost_TxGetSysColor( &host->ITextHost_iface, COLOR_WINDOW ) );
|
||||
|
@ -1361,7 +1365,7 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
|
|||
}
|
||||
|
||||
ITextServices_TxDraw( host->text_srv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, NULL, NULL,
|
||||
&update, NULL, 0, TXTVIEW_ACTIVE );
|
||||
&update, NULL, 0, view_id );
|
||||
SelectObject( hdc, old_brush );
|
||||
DeleteObject( brush );
|
||||
if (msg == WM_PAINT) EndPaint( hwnd, &ps );
|
||||
|
|
|
@ -168,6 +168,8 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxDraw( ITextServices *iface, DWORD
|
|||
if (aspect != DVASPECT_CONTENT || aspect_info || td || target || mf_bounds || continue_fn )
|
||||
FIXME( "Many arguments are ignored\n" );
|
||||
|
||||
if (view_id == TXTVIEW_ACTIVE && services->editor->freeze_count) return E_UNEXPECTED;
|
||||
|
||||
hr = update_client_rect( services, (RECT *)bounds );
|
||||
if (FAILED( hr )) return hr;
|
||||
if (hr == S_OK) rewrap = TRUE;
|
||||
|
|
Loading…
Reference in a new issue