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/include/pdfwindow/PWL_EditCtrl.h" | 7 #include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h" |
8 | 8 |
9 #include "fpdfsdk/include/pdfwindow/PWL_Caret.h" | 9 #include "fpdfsdk/include/pdfwindow/PWL_Caret.h" |
10 #include "fpdfsdk/include/pdfwindow/PWL_FontMap.h" | 10 #include "fpdfsdk/include/pdfwindow/PWL_FontMap.h" |
(...skipping 124 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(FX_WORD nChar, FX_DWORD nFlag) { | 145 FX_BOOL CPWL_EditCtrl::OnKeyDown(uint16_t nChar, FX_DWORD 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(FX_WORD nChar, FX_DWORD nFlag) { | 220 FX_BOOL CPWL_EditCtrl::OnChar(uint16_t nChar, FX_DWORD 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; |
231 default: | 231 default: |
232 break; | 232 break; |
233 } | 233 } |
234 | 234 |
235 FX_BOOL bCtrl = IsCTRLpressed(nFlag); | 235 FX_BOOL bCtrl = IsCTRLpressed(nFlag); |
236 FX_BOOL bAlt = IsALTpressed(nFlag); | 236 FX_BOOL bAlt = IsALTpressed(nFlag); |
237 FX_BOOL bShift = IsSHIFTpressed(nFlag); | 237 FX_BOOL bShift = IsSHIFTpressed(nFlag); |
238 | 238 |
239 FX_WORD word = nChar; | 239 uint16_t word = nChar; |
240 | 240 |
241 if (bCtrl && !bAlt) { | 241 if (bCtrl && !bAlt) { |
242 switch (nChar) { | 242 switch (nChar) { |
243 case 'C' - 'A' + 1: | 243 case 'C' - 'A' + 1: |
244 CopyText(); | 244 CopyText(); |
245 return TRUE; | 245 return TRUE; |
246 case 'V' - 'A' + 1: | 246 case 'V' - 'A' + 1: |
247 PasteText(); | 247 PasteText(); |
248 return TRUE; | 248 return TRUE; |
249 case 'X' - 'A' + 1: | 249 case 'X' - 'A' + 1: |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 | 501 |
502 void CPWL_EditCtrl::CutText() {} | 502 void CPWL_EditCtrl::CutText() {} |
503 | 503 |
504 void CPWL_EditCtrl::ShowVScrollBar(FX_BOOL bShow) {} | 504 void CPWL_EditCtrl::ShowVScrollBar(FX_BOOL bShow) {} |
505 | 505 |
506 void CPWL_EditCtrl::InsertText(const FX_WCHAR* csText) { | 506 void CPWL_EditCtrl::InsertText(const FX_WCHAR* csText) { |
507 if (!IsReadOnly()) | 507 if (!IsReadOnly()) |
508 m_pEdit->InsertText(csText); | 508 m_pEdit->InsertText(csText); |
509 } | 509 } |
510 | 510 |
511 void CPWL_EditCtrl::InsertWord(FX_WORD word, int32_t nCharset) { | 511 void CPWL_EditCtrl::InsertWord(uint16_t word, int32_t nCharset) { |
512 if (!IsReadOnly()) | 512 if (!IsReadOnly()) |
513 m_pEdit->InsertWord(word, nCharset); | 513 m_pEdit->InsertWord(word, nCharset); |
514 } | 514 } |
515 | 515 |
516 void CPWL_EditCtrl::InsertReturn() { | 516 void CPWL_EditCtrl::InsertReturn() { |
517 if (!IsReadOnly()) | 517 if (!IsReadOnly()) |
518 m_pEdit->InsertReturn(); | 518 m_pEdit->InsertReturn(); |
519 } | 519 } |
520 | 520 |
521 void CPWL_EditCtrl::Delete() { | 521 void CPWL_EditCtrl::Delete() { |
(...skipping 98 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 |