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

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

Issue 1254703002: FX_BOOL considered harmful, part 2. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 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/src/pdfwindow/PWL_Button.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp » ('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 "../../include/pdfwindow/PDFWindow.h" 7 #include "../../include/pdfwindow/PDFWindow.h"
8 #include "../../include/pdfwindow/PWL_Wnd.h" 8 #include "../../include/pdfwindow/PWL_Wnd.h"
9 #include "../../include/pdfwindow/PWL_Caret.h" 9 #include "../../include/pdfwindow/PWL_Caret.h"
10 #include "../../include/pdfwindow/PWL_Utils.h" 10 #include "../../include/pdfwindow/PWL_Utils.h"
11 11
12 #define PWL_CARET_FLASHINTERVAL 500 12 #define PWL_CARET_FLASHINTERVAL 500
13 13
14 ////////////////////////////////////////////////////////////////////// 14 //////////////////////////////////////////////////////////////////////
15 // Construction/Destruction 15 // Construction/Destruction
16 ////////////////////////////////////////////////////////////////////// 16 //////////////////////////////////////////////////////////////////////
17 17
18 CPWL_Caret::CPWL_Caret() : 18 CPWL_Caret::CPWL_Caret() :
19 » m_bFlash(FALSE), 19 » m_bFlash(false),
20 m_ptHead(0,0), 20 m_ptHead(0,0),
21 m_ptFoot(0,0), 21 m_ptFoot(0,0),
22 m_fWidth(0.4f), 22 m_fWidth(0.4f),
23 m_nDelay(0) 23 m_nDelay(0)
24 { 24 {
25 } 25 }
26 26
27 CPWL_Caret::~CPWL_Caret() 27 CPWL_Caret::~CPWL_Caret()
28 { 28 {
29 } 29 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 129
130 CPDF_Rect CPWL_Caret::GetCaretRect() const 130 CPDF_Rect CPWL_Caret::GetCaretRect() const
131 { 131 {
132 return CPDF_Rect(m_ptFoot.x, 132 return CPDF_Rect(m_ptFoot.x,
133 m_ptFoot.y, 133 m_ptFoot.y,
134 m_ptHead.x + m_fWidth, 134 m_ptHead.x + m_fWidth,
135 m_ptHead.y); 135 m_ptHead.y);
136 } 136 }
137 137
138 void CPWL_Caret::SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPD F_Point & ptFoot) 138 void CPWL_Caret::SetCaret(bool bVisible, const CPDF_Point & ptHead, const CPDF_P oint & ptFoot)
139 { 139 {
140 if (bVisible) 140 if (bVisible)
141 { 141 {
142 if (IsVisible()) 142 if (IsVisible())
143 { 143 {
144 if (m_ptHead.x != ptHead.x || m_ptHead.y != ptHead.y || 144 if (m_ptHead.x != ptHead.x || m_ptHead.y != ptHead.y ||
145 m_ptFoot.x != ptFoot.x || m_ptFoot.y != ptFoot.y) 145 m_ptFoot.x != ptFoot.x || m_ptFoot.y != ptFoot.y)
146 { 146 {
147 m_ptHead = ptHead; 147 m_ptHead = ptHead;
148 m_ptFoot = ptFoot; 148 m_ptFoot = ptFoot;
149 149
150 » » » » m_bFlash = TRUE; 150 » » » » m_bFlash = true;
151 » » » » //Move(GetCaretRect(),FALSE,TRUE); 151 » » » » //Move(GetCaretRect(),false,true);
152 » » » » Move(m_rcInvalid, FALSE, TRUE); 152 » » » » Move(m_rcInvalid, false, true);
153 } 153 }
154 } 154 }
155 else 155 else
156 { 156 {
157 m_ptHead = ptHead; 157 m_ptHead = ptHead;
158 m_ptFoot = ptFoot; 158 m_ptFoot = ptFoot;
159 159
160 EndTimer(); 160 EndTimer();
161 BeginTimer(PWL_CARET_FLASHINTERVAL); 161 BeginTimer(PWL_CARET_FLASHINTERVAL);
162 162
163 » » » CPWL_Wnd::SetVisible(TRUE); 163 » » » CPWL_Wnd::SetVisible(true);
164 » » » m_bFlash = TRUE; 164 » » » m_bFlash = true;
165 165
166 » » » //Move(GetCaretRect(),FALSE,TRUE); 166 » » » //Move(GetCaretRect(),false,true);
167 » » » Move(m_rcInvalid, FALSE, TRUE); 167 » » » Move(m_rcInvalid, false, true);
168 } 168 }
169 } 169 }
170 else 170 else
171 { 171 {
172 m_ptHead = CPDF_Point(0, 0); 172 m_ptHead = CPDF_Point(0, 0);
173 m_ptFoot = CPDF_Point(0, 0); 173 m_ptFoot = CPDF_Point(0, 0);
174 174
175 » » m_bFlash = FALSE; 175 » » m_bFlash = false;
176 if (IsVisible()) 176 if (IsVisible())
177 { 177 {
178 EndTimer(); 178 EndTimer();
179 » » » CPWL_Wnd::SetVisible(FALSE); 179 » » » CPWL_Wnd::SetVisible(false);
180 } 180 }
181 } 181 }
182 } 182 }
183 183
184 void CPWL_Caret::InvalidateRect(CPDF_Rect * pRect) 184 void CPWL_Caret::InvalidateRect(CPDF_Rect * pRect)
185 { 185 {
186 if (pRect) 186 if (pRect)
187 { 187 {
188 CPDF_Rect rcRefresh = CPWL_Utils::InflateRect(*pRect,0.5f); 188 CPDF_Rect rcRefresh = CPWL_Utils::InflateRect(*pRect,0.5f);
189 rcRefresh.top += 1; 189 rcRefresh.top += 1;
190 rcRefresh.bottom -= 1; 190 rcRefresh.bottom -= 1;
191 191
192 CPWL_Wnd::InvalidateRect(&rcRefresh); 192 CPWL_Wnd::InvalidateRect(&rcRefresh);
193 } 193 }
194 else 194 else
195 CPWL_Wnd::InvalidateRect(pRect); 195 CPWL_Wnd::InvalidateRect(pRect);
196 } 196 }
197 197
OLDNEW
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_Button.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698