OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" | 7 #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" |
8 | 8 |
9 #include "fpdfsdk/pdfwindow/PWL_Caret.h" | 9 #include "fpdfsdk/pdfwindow/PWL_Caret.h" |
10 #include "fpdfsdk/pdfwindow/PWL_FontMap.h" | 10 #include "fpdfsdk/pdfwindow/PWL_FontMap.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 pSH->SetCursor(FXCT_HBEAM); | 65 pSH->SetCursor(FXCT_HBEAM); |
66 } | 66 } |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 void CPWL_EditCtrl::RePosChildWnd() { | 70 void CPWL_EditCtrl::RePosChildWnd() { |
71 m_pEdit->SetPlateRect(GetClientRect()); | 71 m_pEdit->SetPlateRect(GetClientRect()); |
72 } | 72 } |
73 | 73 |
74 void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd, | 74 void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd, |
75 FX_DWORD msg, | 75 uint32_t msg, |
76 intptr_t wParam, | 76 intptr_t wParam, |
77 intptr_t lParam) { | 77 intptr_t lParam) { |
78 CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); | 78 CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); |
79 | 79 |
80 switch (msg) { | 80 switch (msg) { |
81 case PNM_SETSCROLLINFO: | 81 case PNM_SETSCROLLINFO: |
82 switch (wParam) { | 82 switch (wParam) { |
83 case SBT_VSCROLL: | 83 case SBT_VSCROLL: |
84 if (CPWL_Wnd* pChild = GetVScrollBar()) { | 84 if (CPWL_Wnd* pChild = GetVScrollBar()) { |
85 pChild->OnNotify(pWnd, PNM_SETSCROLLINFO, wParam, lParam); | 85 pChild->OnNotify(pWnd, PNM_SETSCROLLINFO, wParam, lParam); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 | 136 |
137 void CPWL_EditCtrl::SetFontSize(FX_FLOAT fFontSize) { | 137 void CPWL_EditCtrl::SetFontSize(FX_FLOAT fFontSize) { |
138 m_pEdit->SetFontSize(fFontSize); | 138 m_pEdit->SetFontSize(fFontSize); |
139 } | 139 } |
140 | 140 |
141 FX_FLOAT CPWL_EditCtrl::GetFontSize() const { | 141 FX_FLOAT CPWL_EditCtrl::GetFontSize() const { |
142 return m_pEdit->GetFontSize(); | 142 return m_pEdit->GetFontSize(); |
143 } | 143 } |
144 | 144 |
145 FX_BOOL CPWL_EditCtrl::OnKeyDown(uint16_t nChar, FX_DWORD nFlag) { | 145 FX_BOOL CPWL_EditCtrl::OnKeyDown(uint16_t nChar, uint32_t nFlag) { |
146 if (m_bMouseDown) | 146 if (m_bMouseDown) |
147 return TRUE; | 147 return TRUE; |
148 | 148 |
149 FX_BOOL bRet = CPWL_Wnd::OnKeyDown(nChar, nFlag); | 149 FX_BOOL bRet = CPWL_Wnd::OnKeyDown(nChar, nFlag); |
150 | 150 |
151 // FILTER | 151 // FILTER |
152 switch (nChar) { | 152 switch (nChar) { |
153 default: | 153 default: |
154 return FALSE; | 154 return FALSE; |
155 case FWL_VKEY_Delete: | 155 case FWL_VKEY_Delete: |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 else | 210 else |
211 CutText(); | 211 CutText(); |
212 return TRUE; | 212 return TRUE; |
213 default: | 213 default: |
214 break; | 214 break; |
215 } | 215 } |
216 | 216 |
217 return bRet; | 217 return bRet; |
218 } | 218 } |
219 | 219 |
220 FX_BOOL CPWL_EditCtrl::OnChar(uint16_t nChar, FX_DWORD nFlag) { | 220 FX_BOOL CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { |
221 if (m_bMouseDown) | 221 if (m_bMouseDown) |
222 return TRUE; | 222 return TRUE; |
223 | 223 |
224 CPWL_Wnd::OnChar(nChar, nFlag); | 224 CPWL_Wnd::OnChar(nChar, nFlag); |
225 | 225 |
226 // FILTER | 226 // FILTER |
227 switch (nChar) { | 227 switch (nChar) { |
228 case 0x0A: | 228 case 0x0A: |
229 case 0x1B: | 229 case 0x1B: |
230 return FALSE; | 230 return FALSE; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 if (IsINSERTpressed(nFlag)) | 285 if (IsINSERTpressed(nFlag)) |
286 Delete(); | 286 Delete(); |
287 InsertWord(word, GetCharSet()); | 287 InsertWord(word, GetCharSet()); |
288 break; | 288 break; |
289 } | 289 } |
290 | 290 |
291 return TRUE; | 291 return TRUE; |
292 } | 292 } |
293 | 293 |
294 FX_BOOL CPWL_EditCtrl::OnLButtonDown(const CFX_FloatPoint& point, | 294 FX_BOOL CPWL_EditCtrl::OnLButtonDown(const CFX_FloatPoint& point, |
295 FX_DWORD nFlag) { | 295 uint32_t nFlag) { |
296 CPWL_Wnd::OnLButtonDown(point, nFlag); | 296 CPWL_Wnd::OnLButtonDown(point, nFlag); |
297 | 297 |
298 if (ClientHitTest(point)) { | 298 if (ClientHitTest(point)) { |
299 if (m_bMouseDown) | 299 if (m_bMouseDown) |
300 InvalidateRect(); | 300 InvalidateRect(); |
301 | 301 |
302 m_bMouseDown = TRUE; | 302 m_bMouseDown = TRUE; |
303 SetCapture(); | 303 SetCapture(); |
304 | 304 |
305 m_pEdit->OnMouseDown(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); | 305 m_pEdit->OnMouseDown(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); |
306 } | 306 } |
307 | 307 |
308 return TRUE; | 308 return TRUE; |
309 } | 309 } |
310 | 310 |
311 FX_BOOL CPWL_EditCtrl::OnLButtonUp(const CFX_FloatPoint& point, | 311 FX_BOOL CPWL_EditCtrl::OnLButtonUp(const CFX_FloatPoint& point, |
312 FX_DWORD nFlag) { | 312 uint32_t nFlag) { |
313 CPWL_Wnd::OnLButtonUp(point, nFlag); | 313 CPWL_Wnd::OnLButtonUp(point, nFlag); |
314 | 314 |
315 if (m_bMouseDown) { | 315 if (m_bMouseDown) { |
316 // can receive keybord message | 316 // can receive keybord message |
317 if (ClientHitTest(point) && !IsFocused()) | 317 if (ClientHitTest(point) && !IsFocused()) |
318 SetFocus(); | 318 SetFocus(); |
319 | 319 |
320 ReleaseCapture(); | 320 ReleaseCapture(); |
321 m_bMouseDown = FALSE; | 321 m_bMouseDown = FALSE; |
322 } | 322 } |
323 | 323 |
324 return TRUE; | 324 return TRUE; |
325 } | 325 } |
326 | 326 |
327 FX_BOOL CPWL_EditCtrl::OnMouseMove(const CFX_FloatPoint& point, | 327 FX_BOOL CPWL_EditCtrl::OnMouseMove(const CFX_FloatPoint& point, |
328 FX_DWORD nFlag) { | 328 uint32_t nFlag) { |
329 CPWL_Wnd::OnMouseMove(point, nFlag); | 329 CPWL_Wnd::OnMouseMove(point, nFlag); |
330 | 330 |
331 if (m_bMouseDown) | 331 if (m_bMouseDown) |
332 m_pEdit->OnMouseMove(point, FALSE, FALSE); | 332 m_pEdit->OnMouseMove(point, FALSE, FALSE); |
333 | 333 |
334 return TRUE; | 334 return TRUE; |
335 } | 335 } |
336 | 336 |
337 CFX_FloatRect CPWL_EditCtrl::GetContentRect() const { | 337 CFX_FloatRect CPWL_EditCtrl::GetContentRect() const { |
338 return m_pEdit->GetContentRect(); | 338 return m_pEdit->GetContentRect(); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 CPVT_WordPlace wpEnd = m_pEdit->WordIndexToWordPlace(nEndChar); | 620 CPVT_WordPlace wpEnd = m_pEdit->WordIndexToWordPlace(nEndChar); |
621 return m_pEdit->GetRangeText(CPVT_WordRange(wpStart, wpEnd)); | 621 return m_pEdit->GetRangeText(CPVT_WordRange(wpStart, wpEnd)); |
622 } | 622 } |
623 | 623 |
624 void CPWL_EditCtrl::SetReadyToInput() { | 624 void CPWL_EditCtrl::SetReadyToInput() { |
625 if (m_bMouseDown) { | 625 if (m_bMouseDown) { |
626 ReleaseCapture(); | 626 ReleaseCapture(); |
627 m_bMouseDown = FALSE; | 627 m_bMouseDown = FALSE; |
628 } | 628 } |
629 } | 629 } |
OLD | NEW |