[PATCH 2/2 v2] riched20: Use ME_GetSelectionType() in ME_ShowContextMenu() for getting type of selection.
Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> --- dlls/riched20/editor.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index eb67e11fdd..696b588b94 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -3005,19 +3005,12 @@ static BOOL ME_ShowContextMenu(ME_TextEditor *editor, int x, int y) { CHARRANGE selrange; HMENU menu; - int seltype = 0; + int seltype = SEL_EMPTY; + if(!editor->lpOleCallback || !editor->hWnd) return FALSE; ME_GetSelectionOfs(editor, &selrange.cpMin, &selrange.cpMax); - if(selrange.cpMin == selrange.cpMax) - seltype |= SEL_EMPTY; - else - { - /* FIXME: Handle objects */ - seltype |= SEL_TEXT; - if(selrange.cpMax-selrange.cpMin > 1) - seltype |= SEL_MULTICHAR; - } + seltype = ME_GetSelectionType(editor); if(SUCCEEDED(IRichEditOleCallback_GetContextMenu(editor->lpOleCallback, seltype, NULL, &selrange, &menu))) { TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, x, y, 0, editor->hwndParent, NULL); -- 2.17.0
On Thu, Apr 19, 2018 at 04:09:03PM +0800, Jactry Zeng wrote:
Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> --- dlls/riched20/editor.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index eb67e11fdd..696b588b94 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -3005,19 +3005,12 @@ static BOOL ME_ShowContextMenu(ME_TextEditor *editor, int x, int y) { CHARRANGE selrange; HMENU menu; - int seltype = 0; + int seltype = SEL_EMPTY;
Now there's no need for this initialization.
+ if(!editor->lpOleCallback || !editor->hWnd) return FALSE; ME_GetSelectionOfs(editor, &selrange.cpMin, &selrange.cpMax); - if(selrange.cpMin == selrange.cpMax) - seltype |= SEL_EMPTY; - else - { - /* FIXME: Handle objects */ - seltype |= SEL_TEXT; - if(selrange.cpMax-selrange.cpMin > 1) - seltype |= SEL_MULTICHAR; - } + seltype = ME_GetSelectionType(editor); if(SUCCEEDED(IRichEditOleCallback_GetContextMenu(editor->lpOleCallback, seltype, NULL, &selrange, &menu))) { TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, x, y, 0, editor->hwndParent, NULL); -- 2.17.0
participants (2)
-
Huw Davies -
Jactry Zeng