riched20: Add support for TXTBIT_ALLOWBEEP.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2021-03-31 12:23:03 +01:00 committed by Alexandre Julliard
parent 7f7fdd6c86
commit ac6ddbc954
1 changed files with 12 additions and 6 deletions

View File

@ -279,6 +279,11 @@ ME_Paragraph *editor_end_para( ME_TextEditor *editor )
return &editor->pBuffer->pLast->member.para; return &editor->pBuffer->pLast->member.para;
} }
static BOOL editor_beep( ME_TextEditor *editor, UINT type )
{
return editor->props & TXTBIT_ALLOWBEEP && MessageBeep( type );
}
static LRESULT ME_StreamInText(ME_TextEditor *editor, DWORD dwFormat, ME_InStream *stream, ME_Style *style) static LRESULT ME_StreamInText(ME_TextEditor *editor, DWORD dwFormat, ME_InStream *stream, ME_Style *style)
{ {
WCHAR *pText; WCHAR *pText;
@ -2281,7 +2286,7 @@ static BOOL paste_special(ME_TextEditor *editor, UINT cf, REPASTESPECIAL *ps, BO
/* Protect read-only edit control from modification */ /* Protect read-only edit control from modification */
if (editor->props & TXTBIT_READONLY) if (editor->props & TXTBIT_READONLY)
{ {
if (!check_only) MessageBeep(MB_ICONERROR); if (!check_only) editor_beep( editor, MB_ICONERROR );
return FALSE; return FALSE;
} }
@ -2379,7 +2384,7 @@ static BOOL copy_or_cut( ME_TextEditor *editor, BOOL cut )
count -= offs; count -= offs;
hr = editor_copy_or_cut( editor, cut, sel_start, count, NULL ); hr = editor_copy_or_cut( editor, cut, sel_start, count, NULL );
if (FAILED( hr )) MessageBeep( MB_ICONERROR ); if (FAILED( hr )) editor_beep( editor, MB_ICONERROR );
return SUCCEEDED( hr ); return SUCCEEDED( hr );
} }
@ -2422,7 +2427,7 @@ static BOOL handle_enter(ME_TextEditor *editor)
if (editor->props & TXTBIT_READONLY) if (editor->props & TXTBIT_READONLY)
{ {
MessageBeep(MB_ICONERROR); editor_beep( editor, MB_ICONERROR );
return TRUE; return TRUE;
} }
@ -2683,7 +2688,7 @@ static LRESULT handle_wm_char( ME_TextEditor *editor, WCHAR wstr, LPARAM flags )
if (editor->props & TXTBIT_READONLY) if (editor->props & TXTBIT_READONLY)
{ {
MessageBeep(MB_ICONERROR); editor_beep( editor, MB_ICONERROR );
return 0; /* FIXME really 0 ? */ return 0; /* FIXME really 0 ? */
} }
@ -2737,7 +2742,7 @@ static LRESULT handle_wm_char( ME_TextEditor *editor, WCHAR wstr, LPARAM flags )
if (para_in_table( para ) && cursor.run->nFlags & MERF_ENDPARA && from == to) if (para_in_table( para ) && cursor.run->nFlags & MERF_ENDPARA && from == to)
{ {
/* Text should not be inserted at the end of the table. */ /* Text should not be inserted at the end of the table. */
MessageBeep(-1); editor_beep( editor, -1 );
return 0; return 0;
} }
} }
@ -2951,7 +2956,8 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
ed->total_rows = 0; ed->total_rows = 0;
ITextHost_TxGetPropertyBits( ed->texthost, TXTBIT_RICHTEXT | TXTBIT_MULTILINE | TXTBIT_READONLY | ITextHost_TxGetPropertyBits( ed->texthost, TXTBIT_RICHTEXT | TXTBIT_MULTILINE | TXTBIT_READONLY |
TXTBIT_USEPASSWORD | TXTBIT_HIDESELECTION | TXTBIT_SAVESELECTION | TXTBIT_USEPASSWORD | TXTBIT_HIDESELECTION | TXTBIT_SAVESELECTION |
TXTBIT_AUTOWORDSEL | TXTBIT_VERTICAL | TXTBIT_WORDWRAP | TXTBIT_DISABLEDRAG, TXTBIT_AUTOWORDSEL | TXTBIT_VERTICAL | TXTBIT_WORDWRAP | TXTBIT_ALLOWBEEP |
TXTBIT_DISABLEDRAG,
&ed->props ); &ed->props );
ITextHost_TxGetScrollBars( ed->texthost, &ed->scrollbars ); ITextHost_TxGetScrollBars( ed->texthost, &ed->scrollbars );
ed->pBuffer = ME_MakeText(); ed->pBuffer = ME_MakeText();