diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-08-16 16:38:27 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-17 16:13:14 +0000 |
commit | 0d2349b634bef51070f9ba4115ead47d240063bf (patch) | |
tree | 1d3f6240c445cd1ec59a49894bf03d297cad2914 /xfa/fwl/cfwl_edit.cpp | |
parent | 022b4397f98e7bb6d283918c836a4d1d386ac9cc (diff) | |
download | pdfium-0d2349b634bef51070f9ba4115ead47d240063bf.tar.xz |
Turn caret movement into an enum class
This CL changes caret movement into an enum class and removes the
MoveNone flag.
Change-Id: I8a01b057942d45ceae9a6c3b95cfe3b8dc9ce9a5
Reviewed-on: https://pdfium-review.googlesource.com/11274
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fwl/cfwl_edit.cpp')
-rw-r--r-- | xfa/fwl/cfwl_edit.cpp | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index 38f8f70498..0045c36858 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -1387,43 +1387,34 @@ void CFWL_Edit::OnMouseMove(CFWL_MessageMouse* pMsg) { } void CFWL_Edit::OnKeyDown(CFWL_MessageKey* pMsg) { - FDE_TXTEDTMOVECARET MoveCaret = MC_MoveNone; bool bShift = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Shift); bool bCtrl = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl); - uint32_t dwKeyCode = pMsg->m_dwKeyCode; - switch (dwKeyCode) { - case FWL_VKEY_Left: { - MoveCaret = MC_Left; + switch (pMsg->m_dwKeyCode) { + case FWL_VKEY_Left: + m_EdtEngine.MoveCaretPos(FDE_CaretMove::Left, bShift); break; - } - case FWL_VKEY_Right: { - MoveCaret = MC_Right; + case FWL_VKEY_Right: + m_EdtEngine.MoveCaretPos(FDE_CaretMove::Right, bShift); break; - } - case FWL_VKEY_Up: { - MoveCaret = MC_Up; + case FWL_VKEY_Up: + m_EdtEngine.MoveCaretPos(FDE_CaretMove::Up, bShift); break; - } - case FWL_VKEY_Down: { - MoveCaret = MC_Down; - break; - } - case FWL_VKEY_Home: { - MoveCaret = bCtrl ? MC_Home : MC_LineStart; + case FWL_VKEY_Down: + m_EdtEngine.MoveCaretPos(FDE_CaretMove::Down, bShift); break; - } - case FWL_VKEY_End: { - MoveCaret = bCtrl ? MC_End : MC_LineEnd; + case FWL_VKEY_Home: + m_EdtEngine.MoveCaretPos( + bCtrl ? FDE_CaretMove::Home : FDE_CaretMove::LineStart, bShift); break; - } - case FWL_VKEY_Insert: + case FWL_VKEY_End: + m_EdtEngine.MoveCaretPos( + bCtrl ? FDE_CaretMove::End : FDE_CaretMove::LineEnd, bShift); break; case FWL_VKEY_Delete: { if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ReadOnly) || (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) { break; } - #if (_FX_OS_ == _FX_MACOSX_) m_EdtEngine.Delete(true); #else @@ -1431,13 +1422,12 @@ void CFWL_Edit::OnKeyDown(CFWL_MessageKey* pMsg) { #endif break; } + case FWL_VKEY_Insert: case FWL_VKEY_F2: case FWL_VKEY_Tab: default: break; } - if (MoveCaret != MC_MoveNone) - m_EdtEngine.MoveCaretPos(MoveCaret, bShift, bCtrl); } void CFWL_Edit::OnChar(CFWL_MessageKey* pMsg) { |