Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: fpdfsdk/pdfwindow/PWL_EditCtrl.cpp

Issue 2144813002: Cleanup some PWL interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@ifx_cleanup
Patch Set: Rebase to master Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/pdfwindow/PWL_EditCtrl.h ('k') | fpdfsdk/pdfwindow/PWL_Wnd.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "core/fpdfdoc/include/cpvt_section.h" 9 #include "core/fpdfdoc/include/cpvt_section.h"
10 #include "core/fpdfdoc/include/cpvt_word.h" 10 #include "core/fpdfdoc/include/cpvt_word.h"
11 #include "fpdfsdk/fxedit/include/fxet_edit.h" 11 #include "fpdfsdk/fxedit/include/fxet_edit.h"
12 #include "fpdfsdk/pdfwindow/PWL_Caret.h" 12 #include "fpdfsdk/pdfwindow/PWL_Caret.h"
13 #include "fpdfsdk/pdfwindow/PWL_FontMap.h" 13 #include "fpdfsdk/pdfwindow/PWL_FontMap.h"
14 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" 14 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
15 #include "fpdfsdk/pdfwindow/PWL_Utils.h" 15 #include "fpdfsdk/pdfwindow/PWL_Utils.h"
16 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" 16 #include "fpdfsdk/pdfwindow/PWL_Wnd.h"
17 #include "public/fpdf_fwlevent.h" 17 #include "public/fpdf_fwlevent.h"
18 18
19 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) 19 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001)
20 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) 20 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb)))
21 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) 21 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb)))
22 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) 22 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb))
23 23
24 CPWL_EditCtrl::CPWL_EditCtrl() 24 CPWL_EditCtrl::CPWL_EditCtrl()
25 : m_pEdit(new CFX_Edit), 25 : m_pEdit(new CFX_Edit),
26 m_pEditCaret(nullptr), 26 m_pEditCaret(nullptr),
27 m_bMouseDown(FALSE), 27 m_bMouseDown(FALSE),
28 m_pEditNotify(nullptr),
29 m_nCharSet(DEFAULT_CHARSET), 28 m_nCharSet(DEFAULT_CHARSET),
30 m_nCodePage(0) {} 29 m_nCodePage(0) {}
31 30
32 CPWL_EditCtrl::~CPWL_EditCtrl() { 31 CPWL_EditCtrl::~CPWL_EditCtrl() {}
33 }
34 32
35 void CPWL_EditCtrl::OnCreate(PWL_CREATEPARAM& cp) { 33 void CPWL_EditCtrl::OnCreate(PWL_CREATEPARAM& cp) {
36 cp.eCursorType = FXCT_VBEAM; 34 cp.eCursorType = FXCT_VBEAM;
37 } 35 }
38 36
39 void CPWL_EditCtrl::OnCreated() { 37 void CPWL_EditCtrl::OnCreated() {
40 SetFontSize(GetCreationParam().fFontSize); 38 SetFontSize(GetCreationParam().fFontSize);
41 39
42 m_pEdit->SetFontMap(GetFontMap()); 40 m_pEdit->SetFontMap(GetFontMap());
43 m_pEdit->SetNotify(this); 41 m_pEdit->SetNotify(this);
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 const CFX_FloatPoint& ptFoot, 557 const CFX_FloatPoint& ptFoot,
560 const CPVT_WordPlace& place) { 558 const CPVT_WordPlace& place) {
561 PWL_CARET_INFO cInfo; 559 PWL_CARET_INFO cInfo;
562 cInfo.bVisible = bVisible; 560 cInfo.bVisible = bVisible;
563 cInfo.ptHead = ptHead; 561 cInfo.ptHead = ptHead;
564 cInfo.ptFoot = ptFoot; 562 cInfo.ptFoot = ptFoot;
565 563
566 OnNotify(this, PNM_SETCARETINFO, (intptr_t)&cInfo, (intptr_t) nullptr); 564 OnNotify(this, PNM_SETCARETINFO, (intptr_t)&cInfo, (intptr_t) nullptr);
567 } 565 }
568 566
569 void CPWL_EditCtrl::IOnContentChange(const CFX_FloatRect& rcContent) { 567 void CPWL_EditCtrl::IOnCaretChange(const CPVT_SecProps& secProps,
570 if (IsValid()) { 568 const CPVT_WordProps& wordProps) {}
571 if (m_pEditNotify) { 569
572 m_pEditNotify->OnContentChange(rcContent); 570 void CPWL_EditCtrl::IOnContentChange(const CFX_FloatRect& rcContent) {}
573 }
574 }
575 }
576 571
577 void CPWL_EditCtrl::IOnInvalidateRect(CFX_FloatRect* pRect) { 572 void CPWL_EditCtrl::IOnInvalidateRect(CFX_FloatRect* pRect) {
578 InvalidateRect(pRect); 573 InvalidateRect(pRect);
579 } 574 }
580 575
581 int32_t CPWL_EditCtrl::GetCharSet() const { 576 int32_t CPWL_EditCtrl::GetCharSet() const {
582 return m_nCharSet < 0 ? DEFAULT_CHARSET : m_nCharSet; 577 return m_nCharSet < 0 ? DEFAULT_CHARSET : m_nCharSet;
583 } 578 }
584 579
585 void CPWL_EditCtrl::GetTextRange(const CFX_FloatRect& rect, 580 void CPWL_EditCtrl::GetTextRange(const CFX_FloatRect& rect,
(...skipping 11 matching lines...) Expand all
597 CPVT_WordPlace wpEnd = m_pEdit->WordIndexToWordPlace(nEndChar); 592 CPVT_WordPlace wpEnd = m_pEdit->WordIndexToWordPlace(nEndChar);
598 return m_pEdit->GetRangeText(CPVT_WordRange(wpStart, wpEnd)); 593 return m_pEdit->GetRangeText(CPVT_WordRange(wpStart, wpEnd));
599 } 594 }
600 595
601 void CPWL_EditCtrl::SetReadyToInput() { 596 void CPWL_EditCtrl::SetReadyToInput() {
602 if (m_bMouseDown) { 597 if (m_bMouseDown) {
603 ReleaseCapture(); 598 ReleaseCapture();
604 m_bMouseDown = FALSE; 599 m_bMouseDown = FALSE;
605 } 600 }
606 } 601 }
OLDNEW
« no previous file with comments | « fpdfsdk/pdfwindow/PWL_EditCtrl.h ('k') | fpdfsdk/pdfwindow/PWL_Wnd.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698