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

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

Issue 2453683011: Remove FX_BOOL from fpdfsdk. (Closed)
Patch Set: Regenerate patch after rebase. Created 4 years, 1 month 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_Caret.h ('k') | fpdfsdk/pdfwindow/PWL_ComboBox.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_Caret.h" 7 #include "fpdfsdk/pdfwindow/PWL_Caret.h"
8 8
9 #include "core/fxge/cfx_graphstatedata.h" 9 #include "core/fxge/cfx_graphstatedata.h"
10 #include "core/fxge/cfx_pathdata.h" 10 #include "core/fxge/cfx_pathdata.h"
11 #include "core/fxge/cfx_renderdevice.h" 11 #include "core/fxge/cfx_renderdevice.h"
12 #include "fpdfsdk/pdfwindow/PWL_Utils.h" 12 #include "fpdfsdk/pdfwindow/PWL_Utils.h"
13 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" 13 #include "fpdfsdk/pdfwindow/PWL_Wnd.h"
14 14
15 #define PWL_CARET_FLASHINTERVAL 500 15 #define PWL_CARET_FLASHINTERVAL 500
16 16
17 CPWL_Caret::CPWL_Caret() : m_bFlash(FALSE), m_fWidth(0.4f), m_nDelay(0) {} 17 CPWL_Caret::CPWL_Caret() : m_bFlash(false), m_fWidth(0.4f), m_nDelay(0) {}
18 18
19 CPWL_Caret::~CPWL_Caret() {} 19 CPWL_Caret::~CPWL_Caret() {}
20 20
21 CFX_ByteString CPWL_Caret::GetClassName() const { 21 CFX_ByteString CPWL_Caret::GetClassName() const {
22 return "CPWL_Caret"; 22 return "CPWL_Caret";
23 } 23 }
24 24
25 void CPWL_Caret::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { 25 void CPWL_Caret::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
26 GetCaretApp(sAppStream, CFX_FloatPoint(0.0f, 0.0f)); 26 GetCaretApp(sAppStream, CFX_FloatPoint(0.0f, 0.0f));
27 } 27 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 m_bFlash = !m_bFlash; 98 m_bFlash = !m_bFlash;
99 InvalidateRect(); 99 InvalidateRect();
100 } 100 }
101 } 101 }
102 102
103 CFX_FloatRect CPWL_Caret::GetCaretRect() const { 103 CFX_FloatRect CPWL_Caret::GetCaretRect() const {
104 return CFX_FloatRect(m_ptFoot.x, m_ptFoot.y, m_ptHead.x + m_fWidth, 104 return CFX_FloatRect(m_ptFoot.x, m_ptFoot.y, m_ptHead.x + m_fWidth,
105 m_ptHead.y); 105 m_ptHead.y);
106 } 106 }
107 107
108 void CPWL_Caret::SetCaret(FX_BOOL bVisible, 108 void CPWL_Caret::SetCaret(bool bVisible,
109 const CFX_FloatPoint& ptHead, 109 const CFX_FloatPoint& ptHead,
110 const CFX_FloatPoint& ptFoot) { 110 const CFX_FloatPoint& ptFoot) {
111 if (bVisible) { 111 if (bVisible) {
112 if (IsVisible()) { 112 if (IsVisible()) {
113 if (m_ptHead != ptHead || m_ptFoot != ptFoot) { 113 if (m_ptHead != ptHead || m_ptFoot != ptFoot) {
114 m_ptHead = ptHead; 114 m_ptHead = ptHead;
115 m_ptFoot = ptFoot; 115 m_ptFoot = ptFoot;
116 m_bFlash = TRUE; 116 m_bFlash = true;
117 Move(m_rcInvalid, FALSE, TRUE); 117 Move(m_rcInvalid, false, true);
118 } 118 }
119 } else { 119 } else {
120 m_ptHead = ptHead; 120 m_ptHead = ptHead;
121 m_ptFoot = ptFoot; 121 m_ptFoot = ptFoot;
122 EndTimer(); 122 EndTimer();
123 BeginTimer(PWL_CARET_FLASHINTERVAL); 123 BeginTimer(PWL_CARET_FLASHINTERVAL);
124 CPWL_Wnd::SetVisible(TRUE); 124 CPWL_Wnd::SetVisible(true);
125 m_bFlash = TRUE; 125 m_bFlash = true;
126 Move(m_rcInvalid, FALSE, TRUE); 126 Move(m_rcInvalid, false, true);
127 } 127 }
128 } else { 128 } else {
129 m_ptHead = CFX_FloatPoint(); 129 m_ptHead = CFX_FloatPoint();
130 m_ptFoot = CFX_FloatPoint(); 130 m_ptFoot = CFX_FloatPoint();
131 m_bFlash = FALSE; 131 m_bFlash = false;
132 if (IsVisible()) { 132 if (IsVisible()) {
133 EndTimer(); 133 EndTimer();
134 CPWL_Wnd::SetVisible(FALSE); 134 CPWL_Wnd::SetVisible(false);
135 } 135 }
136 } 136 }
137 } 137 }
138 138
139 void CPWL_Caret::InvalidateRect(CFX_FloatRect* pRect) { 139 void CPWL_Caret::InvalidateRect(CFX_FloatRect* pRect) {
140 if (pRect) { 140 if (pRect) {
141 CFX_FloatRect rcRefresh = CPWL_Utils::InflateRect(*pRect, 0.5f); 141 CFX_FloatRect rcRefresh = CPWL_Utils::InflateRect(*pRect, 0.5f);
142 rcRefresh.top += 1; 142 rcRefresh.top += 1;
143 rcRefresh.bottom -= 1; 143 rcRefresh.bottom -= 1;
144 CPWL_Wnd::InvalidateRect(&rcRefresh); 144 CPWL_Wnd::InvalidateRect(&rcRefresh);
145 } else { 145 } else {
146 CPWL_Wnd::InvalidateRect(pRect); 146 CPWL_Wnd::InvalidateRect(pRect);
147 } 147 }
148 } 148 }
OLDNEW
« no previous file with comments | « fpdfsdk/pdfwindow/PWL_Caret.h ('k') | fpdfsdk/pdfwindow/PWL_ComboBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698