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

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

Issue 1737593006: Re-land "Replace CPDF_Rect and CPDF_Point with CFX types." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Ooops. Created 4 years, 9 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_Note.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_Signature.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 "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h" 7 #include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h"
8 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" 8 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
9 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" 9 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h"
10 10
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 125 }
126 126
127 void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { 127 void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
128 CPWL_Wnd::GetThisAppearanceStream(sAppStream); 128 CPWL_Wnd::GetThisAppearanceStream(sAppStream);
129 129
130 if (!IsVisible()) 130 if (!IsVisible())
131 return; 131 return;
132 132
133 CFX_ByteTextBuf sButton; 133 CFX_ByteTextBuf sButton;
134 134
135 CPDF_Rect rectWnd = GetWindowRect(); 135 CFX_FloatRect rectWnd = GetWindowRect();
136 136
137 if (rectWnd.IsEmpty()) 137 if (rectWnd.IsEmpty())
138 return; 138 return;
139 139
140 sAppStream << "q\n"; 140 sAppStream << "q\n";
141 141
142 CPDF_Point ptCenter = GetCenterPoint(); 142 CFX_FloatPoint ptCenter = GetCenterPoint();
143 143
144 switch (m_eScrollBarType) { 144 switch (m_eScrollBarType) {
145 case SBT_HSCROLL: 145 case SBT_HSCROLL:
146 switch (m_eSBButtonType) { 146 switch (m_eSBButtonType) {
147 case PSBT_MIN: { 147 case PSBT_MIN: {
148 CPDF_Point pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); 148 CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
149 CPDF_Point pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, 149 ptCenter.y);
150 ptCenter.y + PWL_TRIANGLE_HALFLEN); 150 CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
151 CPDF_Point pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, 151 ptCenter.y + PWL_TRIANGLE_HALFLEN);
152 ptCenter.y - PWL_TRIANGLE_HALFLEN); 152 CFX_FloatPoint pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
153 ptCenter.y - PWL_TRIANGLE_HALFLEN);
153 154
154 if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && 155 if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
155 rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { 156 rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
156 sButton << "0 g\n"; 157 sButton << "0 g\n";
157 sButton << pt1.x << " " << pt1.y << " m\n"; 158 sButton << pt1.x << " " << pt1.y << " m\n";
158 sButton << pt2.x << " " << pt2.y << " l\n"; 159 sButton << pt2.x << " " << pt2.y << " l\n";
159 sButton << pt3.x << " " << pt3.y << " l\n"; 160 sButton << pt3.x << " " << pt3.y << " l\n";
160 sButton << pt1.x << " " << pt1.y << " l f\n"; 161 sButton << pt1.x << " " << pt1.y << " l f\n";
161 162
162 sAppStream << sButton; 163 sAppStream << sButton;
163 } 164 }
164 } break; 165 } break;
165 case PSBT_MAX: { 166 case PSBT_MAX: {
166 CPDF_Point pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); 167 CFX_FloatPoint pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
167 CPDF_Point pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, 168 ptCenter.y);
168 ptCenter.y + PWL_TRIANGLE_HALFLEN); 169 CFX_FloatPoint pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
169 CPDF_Point pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, 170 ptCenter.y + PWL_TRIANGLE_HALFLEN);
170 ptCenter.y - PWL_TRIANGLE_HALFLEN); 171 CFX_FloatPoint pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
172 ptCenter.y - PWL_TRIANGLE_HALFLEN);
171 173
172 if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && 174 if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
173 rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { 175 rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
174 sButton << "0 g\n"; 176 sButton << "0 g\n";
175 sButton << pt1.x << " " << pt1.y << " m\n"; 177 sButton << pt1.x << " " << pt1.y << " m\n";
176 sButton << pt2.x << " " << pt2.y << " l\n"; 178 sButton << pt2.x << " " << pt2.y << " l\n";
177 sButton << pt3.x << " " << pt3.y << " l\n"; 179 sButton << pt3.x << " " << pt3.y << " l\n";
178 sButton << pt1.x << " " << pt1.y << " l f\n"; 180 sButton << pt1.x << " " << pt1.y << " l f\n";
179 181
180 sAppStream << sButton; 182 sAppStream << sButton;
181 } 183 }
182 } break; 184 } break;
183 default: 185 default:
184 break; 186 break;
185 } 187 }
186 break; 188 break;
187 case SBT_VSCROLL: 189 case SBT_VSCROLL:
188 switch (m_eSBButtonType) { 190 switch (m_eSBButtonType) {
189 case PSBT_MIN: { 191 case PSBT_MIN: {
190 CPDF_Point pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN, 192 CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN,
191 ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); 193 ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f);
192 CPDF_Point pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN, 194 CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN,
193 ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); 195 ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f);
194 CPDF_Point pt3(ptCenter.x, ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); 196 CFX_FloatPoint pt3(ptCenter.x,
197 ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f);
195 198
196 if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && 199 if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
197 rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { 200 rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
198 sButton << "0 g\n"; 201 sButton << "0 g\n";
199 sButton << pt1.x << " " << pt1.y << " m\n"; 202 sButton << pt1.x << " " << pt1.y << " m\n";
200 sButton << pt2.x << " " << pt2.y << " l\n"; 203 sButton << pt2.x << " " << pt2.y << " l\n";
201 sButton << pt3.x << " " << pt3.y << " l\n"; 204 sButton << pt3.x << " " << pt3.y << " l\n";
202 sButton << pt1.x << " " << pt1.y << " l f\n"; 205 sButton << pt1.x << " " << pt1.y << " l f\n";
203 206
204 sAppStream << sButton; 207 sAppStream << sButton;
205 } 208 }
206 } break; 209 } break;
207 case PSBT_MAX: { 210 case PSBT_MAX: {
208 CPDF_Point pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN, 211 CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN,
209 ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); 212 ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f);
210 CPDF_Point pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN, 213 CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN,
211 ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); 214 ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f);
212 CPDF_Point pt3(ptCenter.x, ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); 215 CFX_FloatPoint pt3(ptCenter.x,
216 ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f);
213 217
214 if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && 218 if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
215 rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { 219 rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
216 sButton << "0 g\n"; 220 sButton << "0 g\n";
217 sButton << pt1.x << " " << pt1.y << " m\n"; 221 sButton << pt1.x << " " << pt1.y << " m\n";
218 sButton << pt2.x << " " << pt2.y << " l\n"; 222 sButton << pt2.x << " " << pt2.y << " l\n";
219 sButton << pt3.x << " " << pt3.y << " l\n"; 223 sButton << pt3.x << " " << pt3.y << " l\n";
220 sButton << pt1.x << " " << pt1.y << " l f\n"; 224 sButton << pt1.x << " " << pt1.y << " l f\n";
221 225
222 sAppStream << sButton; 226 sAppStream << sButton;
223 } 227 }
224 } break; 228 } break;
225 default: 229 default:
226 break; 230 break;
227 } 231 }
228 break; 232 break;
229 default: 233 default:
230 break; 234 break;
231 } 235 }
232 236
233 sAppStream << "Q\n"; 237 sAppStream << "Q\n";
234 } 238 }
235 239
236 void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, 240 void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
237 CFX_Matrix* pUser2Device) { 241 CFX_Matrix* pUser2Device) {
238 if (!IsVisible()) 242 if (!IsVisible())
239 return; 243 return;
240 244
241 CPDF_Rect rectWnd = GetWindowRect(); 245 CFX_FloatRect rectWnd = GetWindowRect();
242 if (rectWnd.IsEmpty()) 246 if (rectWnd.IsEmpty())
243 return; 247 return;
244 248
245 CPDF_Point ptCenter = GetCenterPoint(); 249 CFX_FloatPoint ptCenter = GetCenterPoint();
246 int32_t nTransparancy = GetTransparency(); 250 int32_t nTransparancy = GetTransparency();
247 251
248 switch (m_eScrollBarType) { 252 switch (m_eScrollBarType) {
249 case SBT_HSCROLL: 253 case SBT_HSCROLL:
250 CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); 254 CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
251 switch (m_eSBButtonType) { 255 switch (m_eSBButtonType) {
252 case PSBT_MIN: { 256 case PSBT_MIN: {
253 CPDF_Point pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); 257 CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
254 CPDF_Point pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, 258 ptCenter.y);
255 ptCenter.y + PWL_TRIANGLE_HALFLEN); 259 CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
256 CPDF_Point pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, 260 ptCenter.y + PWL_TRIANGLE_HALFLEN);
257 ptCenter.y - PWL_TRIANGLE_HALFLEN); 261 CFX_FloatPoint pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
262 ptCenter.y - PWL_TRIANGLE_HALFLEN);
258 263
259 if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && 264 if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
260 rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { 265 rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
261 CFX_PathData path; 266 CFX_PathData path;
262 267
263 path.SetPointCount(4); 268 path.SetPointCount(4);
264 path.SetPoint(0, pt1.x, pt1.y, FXPT_MOVETO); 269 path.SetPoint(0, pt1.x, pt1.y, FXPT_MOVETO);
265 path.SetPoint(1, pt2.x, pt2.y, FXPT_LINETO); 270 path.SetPoint(1, pt2.x, pt2.y, FXPT_LINETO);
266 path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); 271 path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO);
267 path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); 272 path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO);
268 273
269 pDevice->DrawPath(&path, pUser2Device, NULL, 274 pDevice->DrawPath(&path, pUser2Device, NULL,
270 CPWL_Utils::PWLColorToFXColor( 275 CPWL_Utils::PWLColorToFXColor(
271 PWL_DEFAULT_BLACKCOLOR, nTransparancy), 276 PWL_DEFAULT_BLACKCOLOR, nTransparancy),
272 0, FXFILL_ALTERNATE); 277 0, FXFILL_ALTERNATE);
273 } 278 }
274 } break; 279 } break;
275 case PSBT_MAX: { 280 case PSBT_MAX: {
276 CPDF_Point pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); 281 CFX_FloatPoint pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
277 CPDF_Point pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, 282 ptCenter.y);
278 ptCenter.y + PWL_TRIANGLE_HALFLEN); 283 CFX_FloatPoint pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
279 CPDF_Point pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, 284 ptCenter.y + PWL_TRIANGLE_HALFLEN);
280 ptCenter.y - PWL_TRIANGLE_HALFLEN); 285 CFX_FloatPoint pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
286 ptCenter.y - PWL_TRIANGLE_HALFLEN);
281 287
282 if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && 288 if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
283 rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { 289 rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
284 CFX_PathData path; 290 CFX_PathData path;
285 291
286 path.SetPointCount(4); 292 path.SetPointCount(4);
287 path.SetPoint(0, pt1.x, pt1.y, FXPT_MOVETO); 293 path.SetPoint(0, pt1.x, pt1.y, FXPT_MOVETO);
288 path.SetPoint(1, pt2.x, pt2.y, FXPT_LINETO); 294 path.SetPoint(1, pt2.x, pt2.y, FXPT_LINETO);
289 path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); 295 path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO);
290 path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); 296 path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO);
291 297
292 pDevice->DrawPath(&path, pUser2Device, NULL, 298 pDevice->DrawPath(&path, pUser2Device, NULL,
293 CPWL_Utils::PWLColorToFXColor( 299 CPWL_Utils::PWLColorToFXColor(
294 PWL_DEFAULT_BLACKCOLOR, nTransparancy), 300 PWL_DEFAULT_BLACKCOLOR, nTransparancy),
295 0, FXFILL_ALTERNATE); 301 0, FXFILL_ALTERNATE);
296 } 302 }
297 } break; 303 } break;
298 default: 304 default:
299 break; 305 break;
300 } 306 }
301 break; 307 break;
302 case SBT_VSCROLL: 308 case SBT_VSCROLL:
303 switch (m_eSBButtonType) { 309 switch (m_eSBButtonType) {
304 case PSBT_MIN: { 310 case PSBT_MIN: {
305 // draw border 311 // draw border
306 CPDF_Rect rcDraw = rectWnd; 312 CFX_FloatRect rcDraw = rectWnd;
307 CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, 313 CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
308 ArgbEncode(nTransparancy, 100, 100, 100), 314 ArgbEncode(nTransparancy, 100, 100, 100),
309 0.0f); 315 0.0f);
310 316
311 // draw inner border 317 // draw inner border
312 rcDraw = CPWL_Utils::DeflateRect(rectWnd, 0.5f); 318 rcDraw = CPWL_Utils::DeflateRect(rectWnd, 0.5f);
313 CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, 319 CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
314 ArgbEncode(nTransparancy, 255, 255, 255), 320 ArgbEncode(nTransparancy, 255, 255, 255),
315 1.0f); 321 1.0f);
316 322
317 // draw background 323 // draw background
318 324
319 rcDraw = CPWL_Utils::DeflateRect(rectWnd, 1.0f); 325 rcDraw = CPWL_Utils::DeflateRect(rectWnd, 1.0f);
320 326
321 if (IsEnabled()) 327 if (IsEnabled())
322 CPWL_Utils::DrawShadow(pDevice, pUser2Device, TRUE, FALSE, rcDraw, 328 CPWL_Utils::DrawShadow(pDevice, pUser2Device, TRUE, FALSE, rcDraw,
323 nTransparancy, 80, 220); 329 nTransparancy, 80, 220);
324 else 330 else
325 CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw, 331 CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw,
326 ArgbEncode(255, 255, 255, 255)); 332 ArgbEncode(255, 255, 255, 255));
327 333
328 // draw arrow 334 // draw arrow
329 335
330 if (rectWnd.top - rectWnd.bottom > 6.0f) { 336 if (rectWnd.top - rectWnd.bottom > 6.0f) {
331 FX_FLOAT fX = rectWnd.left + 1.5f; 337 FX_FLOAT fX = rectWnd.left + 1.5f;
332 FX_FLOAT fY = rectWnd.bottom; 338 FX_FLOAT fY = rectWnd.bottom;
333 CPDF_Point pts[7] = {CPDF_Point(fX + 2.5f, fY + 4.0f), 339 CFX_FloatPoint pts[7] = {CFX_FloatPoint(fX + 2.5f, fY + 4.0f),
334 CPDF_Point(fX + 2.5f, fY + 3.0f), 340 CFX_FloatPoint(fX + 2.5f, fY + 3.0f),
335 CPDF_Point(fX + 4.5f, fY + 5.0f), 341 CFX_FloatPoint(fX + 4.5f, fY + 5.0f),
336 CPDF_Point(fX + 6.5f, fY + 3.0f), 342 CFX_FloatPoint(fX + 6.5f, fY + 3.0f),
337 CPDF_Point(fX + 6.5f, fY + 4.0f), 343 CFX_FloatPoint(fX + 6.5f, fY + 4.0f),
338 CPDF_Point(fX + 4.5f, fY + 6.0f), 344 CFX_FloatPoint(fX + 4.5f, fY + 6.0f),
339 CPDF_Point(fX + 2.5f, fY + 4.0f)}; 345 CFX_FloatPoint(fX + 2.5f, fY + 4.0f)};
340 346
341 if (IsEnabled()) 347 if (IsEnabled())
342 CPWL_Utils::DrawFillArea( 348 CPWL_Utils::DrawFillArea(
343 pDevice, pUser2Device, pts, 7, 349 pDevice, pUser2Device, pts, 7,
344 ArgbEncode(nTransparancy, 255, 255, 255)); 350 ArgbEncode(nTransparancy, 255, 255, 255));
345 else 351 else
346 CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7, 352 CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7,
347 CPWL_Utils::PWLColorToFXColor( 353 CPWL_Utils::PWLColorToFXColor(
348 PWL_DEFAULT_HEAVYGRAYCOLOR, 255)); 354 PWL_DEFAULT_HEAVYGRAYCOLOR, 255));
349 } 355 }
350 } break; 356 } break;
351 case PSBT_MAX: { 357 case PSBT_MAX: {
352 // draw border 358 // draw border
353 CPDF_Rect rcDraw = rectWnd; 359 CFX_FloatRect rcDraw = rectWnd;
354 CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, 360 CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
355 ArgbEncode(nTransparancy, 100, 100, 100), 361 ArgbEncode(nTransparancy, 100, 100, 100),
356 0.0f); 362 0.0f);
357 363
358 // draw inner border 364 // draw inner border
359 rcDraw = CPWL_Utils::DeflateRect(rectWnd, 0.5f); 365 rcDraw = CPWL_Utils::DeflateRect(rectWnd, 0.5f);
360 CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, 366 CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
361 ArgbEncode(nTransparancy, 255, 255, 255), 367 ArgbEncode(nTransparancy, 255, 255, 255),
362 1.0f); 368 1.0f);
363 369
364 // draw background 370 // draw background
365 rcDraw = CPWL_Utils::DeflateRect(rectWnd, 1.0f); 371 rcDraw = CPWL_Utils::DeflateRect(rectWnd, 1.0f);
366 if (IsEnabled()) 372 if (IsEnabled())
367 CPWL_Utils::DrawShadow(pDevice, pUser2Device, TRUE, FALSE, rcDraw, 373 CPWL_Utils::DrawShadow(pDevice, pUser2Device, TRUE, FALSE, rcDraw,
368 nTransparancy, 80, 220); 374 nTransparancy, 80, 220);
369 else 375 else
370 CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw, 376 CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw,
371 ArgbEncode(255, 255, 255, 255)); 377 ArgbEncode(255, 255, 255, 255));
372 378
373 // draw arrow 379 // draw arrow
374 380
375 if (rectWnd.top - rectWnd.bottom > 6.0f) { 381 if (rectWnd.top - rectWnd.bottom > 6.0f) {
376 FX_FLOAT fX = rectWnd.left + 1.5f; 382 FX_FLOAT fX = rectWnd.left + 1.5f;
377 FX_FLOAT fY = rectWnd.bottom; 383 FX_FLOAT fY = rectWnd.bottom;
378 384
379 CPDF_Point pts[7] = {CPDF_Point(fX + 2.5f, fY + 5.0f), 385 CFX_FloatPoint pts[7] = {CFX_FloatPoint(fX + 2.5f, fY + 5.0f),
380 CPDF_Point(fX + 2.5f, fY + 6.0f), 386 CFX_FloatPoint(fX + 2.5f, fY + 6.0f),
381 CPDF_Point(fX + 4.5f, fY + 4.0f), 387 CFX_FloatPoint(fX + 4.5f, fY + 4.0f),
382 CPDF_Point(fX + 6.5f, fY + 6.0f), 388 CFX_FloatPoint(fX + 6.5f, fY + 6.0f),
383 CPDF_Point(fX + 6.5f, fY + 5.0f), 389 CFX_FloatPoint(fX + 6.5f, fY + 5.0f),
384 CPDF_Point(fX + 4.5f, fY + 3.0f), 390 CFX_FloatPoint(fX + 4.5f, fY + 3.0f),
385 CPDF_Point(fX + 2.5f, fY + 5.0f)}; 391 CFX_FloatPoint(fX + 2.5f, fY + 5.0f)};
386 392
387 if (IsEnabled()) 393 if (IsEnabled())
388 CPWL_Utils::DrawFillArea( 394 CPWL_Utils::DrawFillArea(
389 pDevice, pUser2Device, pts, 7, 395 pDevice, pUser2Device, pts, 7,
390 ArgbEncode(nTransparancy, 255, 255, 255)); 396 ArgbEncode(nTransparancy, 255, 255, 255));
391 else 397 else
392 CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7, 398 CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7,
393 CPWL_Utils::PWLColorToFXColor( 399 CPWL_Utils::PWLColorToFXColor(
394 PWL_DEFAULT_HEAVYGRAYCOLOR, 255)); 400 PWL_DEFAULT_HEAVYGRAYCOLOR, 255));
395 } 401 }
396 } break; 402 } break;
397 case PSBT_POS: { 403 case PSBT_POS: {
398 // draw border 404 // draw border
399 CPDF_Rect rcDraw = rectWnd; 405 CFX_FloatRect rcDraw = rectWnd;
400 CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, 406 CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
401 ArgbEncode(nTransparancy, 100, 100, 100), 407 ArgbEncode(nTransparancy, 100, 100, 100),
402 0.0f); 408 0.0f);
403 409
404 // draw inner border 410 // draw inner border
405 rcDraw = CPWL_Utils::DeflateRect(rectWnd, 0.5f); 411 rcDraw = CPWL_Utils::DeflateRect(rectWnd, 0.5f);
406 CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, 412 CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw,
407 ArgbEncode(nTransparancy, 255, 255, 255), 413 ArgbEncode(nTransparancy, 255, 255, 255),
408 1.0f); 414 1.0f);
409 415
410 if (IsEnabled()) { 416 if (IsEnabled()) {
411 // draw shadow effect 417 // draw shadow effect
412 418
413 CPDF_Point ptTop = CPDF_Point(rectWnd.left, rectWnd.top - 1.0f); 419 CFX_FloatPoint ptTop =
414 CPDF_Point ptBottom = 420 CFX_FloatPoint(rectWnd.left, rectWnd.top - 1.0f);
415 CPDF_Point(rectWnd.left, rectWnd.bottom + 1.0f); 421 CFX_FloatPoint ptBottom =
422 CFX_FloatPoint(rectWnd.left, rectWnd.bottom + 1.0f);
416 423
417 ptTop.x += 1.5f; 424 ptTop.x += 1.5f;
418 ptBottom.x += 1.5f; 425 ptBottom.x += 1.5f;
419 426
420 CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, 427 CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom,
421 ArgbEncode(nTransparancy, 210, 210, 210), 428 ArgbEncode(nTransparancy, 210, 210, 210),
422 1.0f); 429 1.0f);
423 430
424 ptTop.x += 1.0f; 431 ptTop.x += 1.0f;
425 ptBottom.x += 1.0f; 432 ptBottom.x += 1.0f;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 499
493 if (rectWnd.Height() > 8.0f) { 500 if (rectWnd.Height() > 8.0f) {
494 FX_COLORREF crStroke = ArgbEncode(nTransparancy, 120, 120, 120); 501 FX_COLORREF crStroke = ArgbEncode(nTransparancy, 120, 120, 120);
495 if (!IsEnabled()) 502 if (!IsEnabled())
496 crStroke = CPWL_Utils::PWLColorToFXColor( 503 crStroke = CPWL_Utils::PWLColorToFXColor(
497 PWL_DEFAULT_HEAVYGRAYCOLOR, 255); 504 PWL_DEFAULT_HEAVYGRAYCOLOR, 255);
498 505
499 FX_FLOAT nFrictionWidth = 5.0f; 506 FX_FLOAT nFrictionWidth = 5.0f;
500 FX_FLOAT nFrictionHeight = 5.5f; 507 FX_FLOAT nFrictionHeight = 5.5f;
501 508
502 CPDF_Point ptLeft = 509 CFX_FloatPoint ptLeft =
503 CPDF_Point(ptCenter.x - nFrictionWidth / 2.0f, 510 CFX_FloatPoint(ptCenter.x - nFrictionWidth / 2.0f,
504 ptCenter.y - nFrictionHeight / 2.0f + 0.5f); 511 ptCenter.y - nFrictionHeight / 2.0f + 0.5f);
505 CPDF_Point ptRight = 512 CFX_FloatPoint ptRight =
506 CPDF_Point(ptCenter.x + nFrictionWidth / 2.0f, 513 CFX_FloatPoint(ptCenter.x + nFrictionWidth / 2.0f,
507 ptCenter.y - nFrictionHeight / 2.0f + 0.5f); 514 ptCenter.y - nFrictionHeight / 2.0f + 0.5f);
508 515
509 CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, 516 CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight,
510 crStroke, 1.0f); 517 crStroke, 1.0f);
511 518
512 ptLeft.y += 2.0f; 519 ptLeft.y += 2.0f;
513 ptRight.y += 2.0f; 520 ptRight.y += 2.0f;
514 521
515 CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, 522 CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight,
516 crStroke, 1.0f); 523 crStroke, 1.0f);
517 524
518 ptLeft.y += 2.0f; 525 ptLeft.y += 2.0f;
519 ptRight.y += 2.0f; 526 ptRight.y += 2.0f;
520 527
521 CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, 528 CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight,
522 crStroke, 1.0f); 529 crStroke, 1.0f);
523 } 530 }
524 } break; 531 } break;
525 default: 532 default:
526 break; 533 break;
527 } 534 }
528 break; 535 break;
529 default: 536 default:
530 break; 537 break;
531 } 538 }
532 } 539 }
533 540
534 FX_BOOL CPWL_SBButton::OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) { 541 FX_BOOL CPWL_SBButton::OnLButtonDown(const CFX_FloatPoint& point,
542 FX_DWORD nFlag) {
535 CPWL_Wnd::OnLButtonDown(point, nFlag); 543 CPWL_Wnd::OnLButtonDown(point, nFlag);
536 544
537 if (CPWL_Wnd* pParent = GetParentWindow()) 545 if (CPWL_Wnd* pParent = GetParentWindow())
538 pParent->OnNotify(this, PNM_LBUTTONDOWN, 0, (intptr_t)&point); 546 pParent->OnNotify(this, PNM_LBUTTONDOWN, 0, (intptr_t)&point);
539 547
540 m_bMouseDown = TRUE; 548 m_bMouseDown = TRUE;
541 SetCapture(); 549 SetCapture();
542 550
543 return TRUE; 551 return TRUE;
544 } 552 }
545 553
546 FX_BOOL CPWL_SBButton::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { 554 FX_BOOL CPWL_SBButton::OnLButtonUp(const CFX_FloatPoint& point,
555 FX_DWORD nFlag) {
547 CPWL_Wnd::OnLButtonUp(point, nFlag); 556 CPWL_Wnd::OnLButtonUp(point, nFlag);
548 557
549 if (CPWL_Wnd* pParent = GetParentWindow()) 558 if (CPWL_Wnd* pParent = GetParentWindow())
550 pParent->OnNotify(this, PNM_LBUTTONUP, 0, (intptr_t)&point); 559 pParent->OnNotify(this, PNM_LBUTTONUP, 0, (intptr_t)&point);
551 560
552 m_bMouseDown = FALSE; 561 m_bMouseDown = FALSE;
553 ReleaseCapture(); 562 ReleaseCapture();
554 563
555 return TRUE; 564 return TRUE;
556 } 565 }
557 566
558 FX_BOOL CPWL_SBButton::OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag) { 567 FX_BOOL CPWL_SBButton::OnMouseMove(const CFX_FloatPoint& point,
568 FX_DWORD nFlag) {
559 CPWL_Wnd::OnMouseMove(point, nFlag); 569 CPWL_Wnd::OnMouseMove(point, nFlag);
560 570
561 if (CPWL_Wnd* pParent = GetParentWindow()) { 571 if (CPWL_Wnd* pParent = GetParentWindow()) {
562 pParent->OnNotify(this, PNM_MOUSEMOVE, 0, (intptr_t)&point); 572 pParent->OnNotify(this, PNM_MOUSEMOVE, 0, (intptr_t)&point);
563 } 573 }
564 574
565 return TRUE; 575 return TRUE;
566 } 576 }
567 577
568 CPWL_ScrollBar::CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType) 578 CPWL_ScrollBar::CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType)
569 : m_sbType(sbType), 579 : m_sbType(sbType),
570 m_pMinButton(NULL), 580 m_pMinButton(NULL),
571 m_pMaxButton(NULL), 581 m_pMaxButton(NULL),
572 m_pPosButton(NULL), 582 m_pPosButton(NULL),
573 m_bMouseDown(FALSE), 583 m_bMouseDown(FALSE),
574 m_bMinOrMax(FALSE), 584 m_bMinOrMax(FALSE),
575 m_bNotifyForever(TRUE) {} 585 m_bNotifyForever(TRUE) {}
576 586
577 CPWL_ScrollBar::~CPWL_ScrollBar() {} 587 CPWL_ScrollBar::~CPWL_ScrollBar() {}
578 588
579 CFX_ByteString CPWL_ScrollBar::GetClassName() const { 589 CFX_ByteString CPWL_ScrollBar::GetClassName() const {
580 return "CPWL_ScrollBar"; 590 return "CPWL_ScrollBar";
581 } 591 }
582 592
583 void CPWL_ScrollBar::OnCreate(PWL_CREATEPARAM& cp) { 593 void CPWL_ScrollBar::OnCreate(PWL_CREATEPARAM& cp) {
584 cp.eCursorType = FXCT_ARROW; 594 cp.eCursorType = FXCT_ARROW;
585 } 595 }
586 596
587 void CPWL_ScrollBar::RePosChildWnd() { 597 void CPWL_ScrollBar::RePosChildWnd() {
588 CPDF_Rect rcClient = GetClientRect(); 598 CFX_FloatRect rcClient = GetClientRect();
589 CPDF_Rect rcMinButton, rcMaxButton; 599 CFX_FloatRect rcMinButton, rcMaxButton;
590 FX_FLOAT fBWidth = 0; 600 FX_FLOAT fBWidth = 0;
591 601
592 switch (m_sbType) { 602 switch (m_sbType) {
593 case SBT_HSCROLL: 603 case SBT_HSCROLL:
594 if (rcClient.right - rcClient.left > 604 if (rcClient.right - rcClient.left >
595 PWL_SCROLLBAR_BUTTON_WIDTH * 2 + PWL_SCROLLBAR_POSBUTTON_MINWIDTH + 605 PWL_SCROLLBAR_BUTTON_WIDTH * 2 + PWL_SCROLLBAR_POSBUTTON_MINWIDTH +
596 2) { 606 2) {
597 rcMinButton = 607 rcMinButton = CFX_FloatRect(rcClient.left, rcClient.bottom,
598 CPDF_Rect(rcClient.left, rcClient.bottom, 608 rcClient.left + PWL_SCROLLBAR_BUTTON_WIDTH,
599 rcClient.left + PWL_SCROLLBAR_BUTTON_WIDTH, rcClient.top); 609 rcClient.top);
600 rcMaxButton = CPDF_Rect(rcClient.right - PWL_SCROLLBAR_BUTTON_WIDTH, 610 rcMaxButton =
601 rcClient.bottom, rcClient.right, rcClient.top); 611 CFX_FloatRect(rcClient.right - PWL_SCROLLBAR_BUTTON_WIDTH,
612 rcClient.bottom, rcClient.right, rcClient.top);
602 } else { 613 } else {
603 fBWidth = (rcClient.right - rcClient.left - 614 fBWidth = (rcClient.right - rcClient.left -
604 PWL_SCROLLBAR_POSBUTTON_MINWIDTH - 2) / 615 PWL_SCROLLBAR_POSBUTTON_MINWIDTH - 2) /
605 2; 616 2;
606 617
607 if (fBWidth > 0) { 618 if (fBWidth > 0) {
608 rcMinButton = CPDF_Rect(rcClient.left, rcClient.bottom, 619 rcMinButton = CFX_FloatRect(rcClient.left, rcClient.bottom,
609 rcClient.left + fBWidth, rcClient.top); 620 rcClient.left + fBWidth, rcClient.top);
610 rcMaxButton = CPDF_Rect(rcClient.right - fBWidth, rcClient.bottom, 621 rcMaxButton = CFX_FloatRect(rcClient.right - fBWidth, rcClient.bottom,
611 rcClient.right, rcClient.top); 622 rcClient.right, rcClient.top);
612 } else { 623 } else {
613 SetVisible(FALSE); 624 SetVisible(FALSE);
614 } 625 }
615 } 626 }
616 break; 627 break;
617 case SBT_VSCROLL: 628 case SBT_VSCROLL:
618 if (IsFloatBigger(rcClient.top - rcClient.bottom, 629 if (IsFloatBigger(rcClient.top - rcClient.bottom,
619 PWL_SCROLLBAR_BUTTON_WIDTH * 2 + 630 PWL_SCROLLBAR_BUTTON_WIDTH * 2 +
620 PWL_SCROLLBAR_POSBUTTON_MINWIDTH + 2)) { 631 PWL_SCROLLBAR_POSBUTTON_MINWIDTH + 2)) {
621 rcMinButton = 632 rcMinButton = CFX_FloatRect(rcClient.left,
622 CPDF_Rect(rcClient.left, rcClient.top - PWL_SCROLLBAR_BUTTON_WIDTH, 633 rcClient.top - PWL_SCROLLBAR_BUTTON_WIDTH,
623 rcClient.right, rcClient.top); 634 rcClient.right, rcClient.top);
624 rcMaxButton = CPDF_Rect(rcClient.left, rcClient.bottom, rcClient.right, 635 rcMaxButton =
625 rcClient.bottom + PWL_SCROLLBAR_BUTTON_WIDTH); 636 CFX_FloatRect(rcClient.left, rcClient.bottom, rcClient.right,
637 rcClient.bottom + PWL_SCROLLBAR_BUTTON_WIDTH);
626 } else { 638 } else {
627 fBWidth = (rcClient.top - rcClient.bottom - 639 fBWidth = (rcClient.top - rcClient.bottom -
628 PWL_SCROLLBAR_POSBUTTON_MINWIDTH - 2) / 640 PWL_SCROLLBAR_POSBUTTON_MINWIDTH - 2) /
629 2; 641 2;
630 642
631 if (IsFloatBigger(fBWidth, 0)) { 643 if (IsFloatBigger(fBWidth, 0)) {
632 rcMinButton = CPDF_Rect(rcClient.left, rcClient.top - fBWidth, 644 rcMinButton = CFX_FloatRect(rcClient.left, rcClient.top - fBWidth,
633 rcClient.right, rcClient.top); 645 rcClient.right, rcClient.top);
634 rcMaxButton = CPDF_Rect(rcClient.left, rcClient.bottom, 646 rcMaxButton =
635 rcClient.right, rcClient.bottom + fBWidth); 647 CFX_FloatRect(rcClient.left, rcClient.bottom, rcClient.right,
648 rcClient.bottom + fBWidth);
636 } else { 649 } else {
637 SetVisible(FALSE); 650 SetVisible(FALSE);
638 } 651 }
639 } 652 }
640 break; 653 break;
641 } 654 }
642 655
643 if (m_pMinButton) 656 if (m_pMinButton)
644 m_pMinButton->Move(rcMinButton, TRUE, FALSE); 657 m_pMinButton->Move(rcMinButton, TRUE, FALSE);
645 if (m_pMaxButton) 658 if (m_pMaxButton)
646 m_pMaxButton->Move(rcMaxButton, TRUE, FALSE); 659 m_pMaxButton->Move(rcMaxButton, TRUE, FALSE);
647 MovePosButton(FALSE); 660 MovePosButton(FALSE);
648 } 661 }
649 662
650 void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { 663 void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
651 CPDF_Rect rectWnd = GetWindowRect(); 664 CFX_FloatRect rectWnd = GetWindowRect();
652 665
653 if (IsVisible() && !rectWnd.IsEmpty()) { 666 if (IsVisible() && !rectWnd.IsEmpty()) {
654 CFX_ByteTextBuf sButton; 667 CFX_ByteTextBuf sButton;
655 668
656 sButton << "q\n"; 669 sButton << "q\n";
657 sButton << "0 w\n" 670 sButton << "0 w\n"
658 << CPWL_Utils::GetColorAppStream(GetBackgroundColor(), TRUE); 671 << CPWL_Utils::GetColorAppStream(GetBackgroundColor(), TRUE);
659 sButton << rectWnd.left << " " << rectWnd.bottom << " " 672 sButton << rectWnd.left << " " << rectWnd.bottom << " "
660 << rectWnd.right - rectWnd.left << " " 673 << rectWnd.right - rectWnd.left << " "
661 << rectWnd.top - rectWnd.bottom << " re b Q\n"; 674 << rectWnd.top - rectWnd.bottom << " re b Q\n";
662 675
663 sAppStream << sButton; 676 sAppStream << sButton;
664 } 677 }
665 } 678 }
666 679
667 void CPWL_ScrollBar::DrawThisAppearance(CFX_RenderDevice* pDevice, 680 void CPWL_ScrollBar::DrawThisAppearance(CFX_RenderDevice* pDevice,
668 CFX_Matrix* pUser2Device) { 681 CFX_Matrix* pUser2Device) {
669 CPDF_Rect rectWnd = GetWindowRect(); 682 CFX_FloatRect rectWnd = GetWindowRect();
670 683
671 if (IsVisible() && !rectWnd.IsEmpty()) { 684 if (IsVisible() && !rectWnd.IsEmpty()) {
672 CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rectWnd, 685 CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rectWnd,
673 GetBackgroundColor(), GetTransparency()); 686 GetBackgroundColor(), GetTransparency());
674 687
675 CPWL_Utils::DrawStrokeLine( 688 CPWL_Utils::DrawStrokeLine(
676 pDevice, pUser2Device, 689 pDevice, pUser2Device,
677 CPDF_Point(rectWnd.left + 2.0f, rectWnd.top - 2.0f), 690 CFX_FloatPoint(rectWnd.left + 2.0f, rectWnd.top - 2.0f),
678 CPDF_Point(rectWnd.left + 2.0f, rectWnd.bottom + 2.0f), 691 CFX_FloatPoint(rectWnd.left + 2.0f, rectWnd.bottom + 2.0f),
679 ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f); 692 ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f);
680 693
681 CPWL_Utils::DrawStrokeLine( 694 CPWL_Utils::DrawStrokeLine(
682 pDevice, pUser2Device, 695 pDevice, pUser2Device,
683 CPDF_Point(rectWnd.right - 2.0f, rectWnd.top - 2.0f), 696 CFX_FloatPoint(rectWnd.right - 2.0f, rectWnd.top - 2.0f),
684 CPDF_Point(rectWnd.right - 2.0f, rectWnd.bottom + 2.0f), 697 CFX_FloatPoint(rectWnd.right - 2.0f, rectWnd.bottom + 2.0f),
685 ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f); 698 ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f);
686 } 699 }
687 } 700 }
688 701
689 FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) { 702 FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CFX_FloatPoint& point,
703 FX_DWORD nFlag) {
690 CPWL_Wnd::OnLButtonDown(point, nFlag); 704 CPWL_Wnd::OnLButtonDown(point, nFlag);
691 705
692 if (HasFlag(PWS_AUTOTRANSPARENT)) { 706 if (HasFlag(PWS_AUTOTRANSPARENT)) {
693 if (GetTransparency() != 255) { 707 if (GetTransparency() != 255) {
694 SetTransparency(255); 708 SetTransparency(255);
695 InvalidateRect(); 709 InvalidateRect();
696 } 710 }
697 } 711 }
698 712
699 CPDF_Rect rcMinArea, rcMaxArea; 713 CFX_FloatRect rcMinArea, rcMaxArea;
700 714
701 if (m_pPosButton && m_pPosButton->IsVisible()) { 715 if (m_pPosButton && m_pPosButton->IsVisible()) {
702 CPDF_Rect rcClient = GetClientRect(); 716 CFX_FloatRect rcClient = GetClientRect();
703 CPDF_Rect rcPosButton = m_pPosButton->GetWindowRect(); 717 CFX_FloatRect rcPosButton = m_pPosButton->GetWindowRect();
704 718
705 switch (m_sbType) { 719 switch (m_sbType) {
706 case SBT_HSCROLL: 720 case SBT_HSCROLL:
707 rcMinArea = CPDF_Rect(rcClient.left + PWL_SCROLLBAR_BUTTON_WIDTH, 721 rcMinArea =
708 rcClient.bottom, rcPosButton.left, rcClient.top); 722 CFX_FloatRect(rcClient.left + PWL_SCROLLBAR_BUTTON_WIDTH,
709 rcMaxArea = CPDF_Rect(rcPosButton.right, rcClient.bottom, 723 rcClient.bottom, rcPosButton.left, rcClient.top);
710 rcClient.right - PWL_SCROLLBAR_BUTTON_WIDTH, 724 rcMaxArea = CFX_FloatRect(rcPosButton.right, rcClient.bottom,
711 rcClient.top); 725 rcClient.right - PWL_SCROLLBAR_BUTTON_WIDTH,
726 rcClient.top);
712 727
713 break; 728 break;
714 case SBT_VSCROLL: 729 case SBT_VSCROLL:
715 rcMinArea = CPDF_Rect(rcClient.left, rcPosButton.top, rcClient.right, 730 rcMinArea =
716 rcClient.top - PWL_SCROLLBAR_BUTTON_WIDTH); 731 CFX_FloatRect(rcClient.left, rcPosButton.top, rcClient.right,
717 rcMaxArea = CPDF_Rect(rcClient.left, 732 rcClient.top - PWL_SCROLLBAR_BUTTON_WIDTH);
718 rcClient.bottom + PWL_SCROLLBAR_BUTTON_WIDTH, 733 rcMaxArea = CFX_FloatRect(rcClient.left,
719 rcClient.right, rcPosButton.bottom); 734 rcClient.bottom + PWL_SCROLLBAR_BUTTON_WIDTH,
735 rcClient.right, rcPosButton.bottom);
720 break; 736 break;
721 } 737 }
722 738
723 rcMinArea.Normalize(); 739 rcMinArea.Normalize();
724 rcMaxArea.Normalize(); 740 rcMaxArea.Normalize();
725 741
726 if (rcMinArea.Contains(point.x, point.y)) { 742 if (rcMinArea.Contains(point.x, point.y)) {
727 m_sData.SubBig(); 743 m_sData.SubBig();
728 MovePosButton(TRUE); 744 MovePosButton(TRUE);
729 NotifyScrollWindow(); 745 NotifyScrollWindow();
730 } 746 }
731 747
732 if (rcMaxArea.Contains(point.x, point.y)) { 748 if (rcMaxArea.Contains(point.x, point.y)) {
733 m_sData.AddBig(); 749 m_sData.AddBig();
734 MovePosButton(TRUE); 750 MovePosButton(TRUE);
735 NotifyScrollWindow(); 751 NotifyScrollWindow();
736 } 752 }
737 } 753 }
738 754
739 return TRUE; 755 return TRUE;
740 } 756 }
741 757
742 FX_BOOL CPWL_ScrollBar::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { 758 FX_BOOL CPWL_ScrollBar::OnLButtonUp(const CFX_FloatPoint& point,
759 FX_DWORD nFlag) {
743 CPWL_Wnd::OnLButtonUp(point, nFlag); 760 CPWL_Wnd::OnLButtonUp(point, nFlag);
744 761
745 if (HasFlag(PWS_AUTOTRANSPARENT)) { 762 if (HasFlag(PWS_AUTOTRANSPARENT)) {
746 if (GetTransparency() != PWL_SCROLLBAR_TRANSPARANCY) { 763 if (GetTransparency() != PWL_SCROLLBAR_TRANSPARANCY) {
747 SetTransparency(PWL_SCROLLBAR_TRANSPARANCY); 764 SetTransparency(PWL_SCROLLBAR_TRANSPARANCY);
748 InvalidateRect(); 765 InvalidateRect();
749 } 766 }
750 } 767 }
751 768
752 EndTimer(); 769 EndTimer();
753 m_bMouseDown = FALSE; 770 m_bMouseDown = FALSE;
754 771
755 return TRUE; 772 return TRUE;
756 } 773 }
757 774
758 void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, 775 void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd,
759 FX_DWORD msg, 776 FX_DWORD msg,
760 intptr_t wParam, 777 intptr_t wParam,
761 intptr_t lParam) { 778 intptr_t lParam) {
762 CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); 779 CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam);
763 780
764 switch (msg) { 781 switch (msg) {
765 case PNM_LBUTTONDOWN: 782 case PNM_LBUTTONDOWN:
766 if (pWnd == m_pMinButton) { 783 if (pWnd == m_pMinButton) {
767 OnMinButtonLBDown(*(CPDF_Point*)lParam); 784 OnMinButtonLBDown(*(CFX_FloatPoint*)lParam);
768 } 785 }
769 786
770 if (pWnd == m_pMaxButton) { 787 if (pWnd == m_pMaxButton) {
771 OnMaxButtonLBDown(*(CPDF_Point*)lParam); 788 OnMaxButtonLBDown(*(CFX_FloatPoint*)lParam);
772 } 789 }
773 790
774 if (pWnd == m_pPosButton) { 791 if (pWnd == m_pPosButton) {
775 OnPosButtonLBDown(*(CPDF_Point*)lParam); 792 OnPosButtonLBDown(*(CFX_FloatPoint*)lParam);
776 } 793 }
777 break; 794 break;
778 case PNM_LBUTTONUP: 795 case PNM_LBUTTONUP:
779 if (pWnd == m_pMinButton) { 796 if (pWnd == m_pMinButton) {
780 OnMinButtonLBUp(*(CPDF_Point*)lParam); 797 OnMinButtonLBUp(*(CFX_FloatPoint*)lParam);
781 } 798 }
782 799
783 if (pWnd == m_pMaxButton) { 800 if (pWnd == m_pMaxButton) {
784 OnMaxButtonLBUp(*(CPDF_Point*)lParam); 801 OnMaxButtonLBUp(*(CFX_FloatPoint*)lParam);
785 } 802 }
786 803
787 if (pWnd == m_pPosButton) { 804 if (pWnd == m_pPosButton) {
788 OnPosButtonLBUp(*(CPDF_Point*)lParam); 805 OnPosButtonLBUp(*(CFX_FloatPoint*)lParam);
789 } 806 }
790 break; 807 break;
791 case PNM_MOUSEMOVE: 808 case PNM_MOUSEMOVE:
792 if (pWnd == m_pMinButton) { 809 if (pWnd == m_pMinButton) {
793 OnMinButtonMouseMove(*(CPDF_Point*)lParam); 810 OnMinButtonMouseMove(*(CFX_FloatPoint*)lParam);
794 } 811 }
795 812
796 if (pWnd == m_pMaxButton) { 813 if (pWnd == m_pMaxButton) {
797 OnMaxButtonMouseMove(*(CPDF_Point*)lParam); 814 OnMaxButtonMouseMove(*(CFX_FloatPoint*)lParam);
798 } 815 }
799 816
800 if (pWnd == m_pPosButton) { 817 if (pWnd == m_pPosButton) {
801 OnPosButtonMouseMove(*(CPDF_Point*)lParam); 818 OnPosButtonMouseMove(*(CFX_FloatPoint*)lParam);
802 } 819 }
803 break; 820 break;
804 case PNM_SETSCROLLINFO: { 821 case PNM_SETSCROLLINFO: {
805 if (PWL_SCROLL_INFO* pInfo = (PWL_SCROLL_INFO*)lParam) { 822 if (PWL_SCROLL_INFO* pInfo = (PWL_SCROLL_INFO*)lParam) {
806 if (FXSYS_memcmp(&m_OriginInfo, pInfo, sizeof(PWL_SCROLL_INFO)) != 0) { 823 if (FXSYS_memcmp(&m_OriginInfo, pInfo, sizeof(PWL_SCROLL_INFO)) != 0) {
807 m_OriginInfo = *pInfo; 824 m_OriginInfo = *pInfo;
808 FX_FLOAT fMax = 825 FX_FLOAT fMax =
809 pInfo->fContentMax - pInfo->fContentMin - pInfo->fPlateWidth; 826 pInfo->fContentMax - pInfo->fContentMin - pInfo->fPlateWidth;
810 fMax = fMax > 0.0f ? fMax : 0.0f; 827 fMax = fMax > 0.0f ? fMax : 0.0f;
811 SetScrollRange(0, fMax, pInfo->fPlateWidth); 828 SetScrollRange(0, fMax, pInfo->fPlateWidth);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 void CPWL_ScrollBar::SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep) { 906 void CPWL_ScrollBar::SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep) {
890 m_sData.SetBigStep(fBigStep); 907 m_sData.SetBigStep(fBigStep);
891 m_sData.SetSmallStep(fSmallStep); 908 m_sData.SetSmallStep(fSmallStep);
892 } 909 }
893 910
894 void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) { 911 void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) {
895 ASSERT(m_pMinButton); 912 ASSERT(m_pMinButton);
896 ASSERT(m_pMaxButton); 913 ASSERT(m_pMaxButton);
897 914
898 if (m_pPosButton->IsVisible()) { 915 if (m_pPosButton->IsVisible()) {
899 CPDF_Rect rcClient; 916 CFX_FloatRect rcClient;
900 CPDF_Rect rcPosArea, rcPosButton; 917 CFX_FloatRect rcPosArea, rcPosButton;
901 918
902 rcClient = GetClientRect(); 919 rcClient = GetClientRect();
903 rcPosArea = GetScrollArea(); 920 rcPosArea = GetScrollArea();
904 921
905 FX_FLOAT fLeft, fRight, fTop, fBottom; 922 FX_FLOAT fLeft, fRight, fTop, fBottom;
906 923
907 switch (m_sbType) { 924 switch (m_sbType) {
908 case SBT_HSCROLL: 925 case SBT_HSCROLL:
909 fLeft = TrueToFace(m_sData.fScrollPos); 926 fLeft = TrueToFace(m_sData.fScrollPos);
910 fRight = TrueToFace(m_sData.fScrollPos + m_sData.fClientWidth); 927 fRight = TrueToFace(m_sData.fScrollPos + m_sData.fClientWidth);
911 928
912 if (fRight - fLeft < PWL_SCROLLBAR_POSBUTTON_MINWIDTH) 929 if (fRight - fLeft < PWL_SCROLLBAR_POSBUTTON_MINWIDTH)
913 fRight = fLeft + PWL_SCROLLBAR_POSBUTTON_MINWIDTH; 930 fRight = fLeft + PWL_SCROLLBAR_POSBUTTON_MINWIDTH;
914 931
915 if (fRight > rcPosArea.right) { 932 if (fRight > rcPosArea.right) {
916 fRight = rcPosArea.right; 933 fRight = rcPosArea.right;
917 fLeft = fRight - PWL_SCROLLBAR_POSBUTTON_MINWIDTH; 934 fLeft = fRight - PWL_SCROLLBAR_POSBUTTON_MINWIDTH;
918 } 935 }
919 936
920 rcPosButton = CPDF_Rect(fLeft, rcPosArea.bottom, fRight, rcPosArea.top); 937 rcPosButton =
938 CFX_FloatRect(fLeft, rcPosArea.bottom, fRight, rcPosArea.top);
921 939
922 break; 940 break;
923 case SBT_VSCROLL: 941 case SBT_VSCROLL:
924 fBottom = TrueToFace(m_sData.fScrollPos + m_sData.fClientWidth); 942 fBottom = TrueToFace(m_sData.fScrollPos + m_sData.fClientWidth);
925 fTop = TrueToFace(m_sData.fScrollPos); 943 fTop = TrueToFace(m_sData.fScrollPos);
926 944
927 if (IsFloatSmaller(fTop - fBottom, PWL_SCROLLBAR_POSBUTTON_MINWIDTH)) 945 if (IsFloatSmaller(fTop - fBottom, PWL_SCROLLBAR_POSBUTTON_MINWIDTH))
928 fBottom = fTop - PWL_SCROLLBAR_POSBUTTON_MINWIDTH; 946 fBottom = fTop - PWL_SCROLLBAR_POSBUTTON_MINWIDTH;
929 947
930 if (IsFloatSmaller(fBottom, rcPosArea.bottom)) { 948 if (IsFloatSmaller(fBottom, rcPosArea.bottom)) {
931 fBottom = rcPosArea.bottom; 949 fBottom = rcPosArea.bottom;
932 fTop = fBottom + PWL_SCROLLBAR_POSBUTTON_MINWIDTH; 950 fTop = fBottom + PWL_SCROLLBAR_POSBUTTON_MINWIDTH;
933 } 951 }
934 952
935 rcPosButton = CPDF_Rect(rcPosArea.left, fBottom, rcPosArea.right, fTop); 953 rcPosButton =
954 CFX_FloatRect(rcPosArea.left, fBottom, rcPosArea.right, fTop);
936 955
937 break; 956 break;
938 } 957 }
939 958
940 m_pPosButton->Move(rcPosButton, TRUE, bRefresh); 959 m_pPosButton->Move(rcPosButton, TRUE, bRefresh);
941 } 960 }
942 } 961 }
943 962
944 void CPWL_ScrollBar::OnMinButtonLBDown(const CPDF_Point& point) { 963 void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_FloatPoint& point) {
945 m_sData.SubSmall(); 964 m_sData.SubSmall();
946 MovePosButton(TRUE); 965 MovePosButton(TRUE);
947 NotifyScrollWindow(); 966 NotifyScrollWindow();
948 967
949 m_bMinOrMax = TRUE; 968 m_bMinOrMax = TRUE;
950 969
951 EndTimer(); 970 EndTimer();
952 BeginTimer(100); 971 BeginTimer(100);
953 } 972 }
954 973
955 void CPWL_ScrollBar::OnMinButtonLBUp(const CPDF_Point& point) {} 974 void CPWL_ScrollBar::OnMinButtonLBUp(const CFX_FloatPoint& point) {}
956 975
957 void CPWL_ScrollBar::OnMinButtonMouseMove(const CPDF_Point& point) {} 976 void CPWL_ScrollBar::OnMinButtonMouseMove(const CFX_FloatPoint& point) {}
958 977
959 void CPWL_ScrollBar::OnMaxButtonLBDown(const CPDF_Point& point) { 978 void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_FloatPoint& point) {
960 m_sData.AddSmall(); 979 m_sData.AddSmall();
961 MovePosButton(TRUE); 980 MovePosButton(TRUE);
962 NotifyScrollWindow(); 981 NotifyScrollWindow();
963 982
964 m_bMinOrMax = FALSE; 983 m_bMinOrMax = FALSE;
965 984
966 EndTimer(); 985 EndTimer();
967 BeginTimer(100); 986 BeginTimer(100);
968 } 987 }
969 988
970 void CPWL_ScrollBar::OnMaxButtonLBUp(const CPDF_Point& point) {} 989 void CPWL_ScrollBar::OnMaxButtonLBUp(const CFX_FloatPoint& point) {}
971 990
972 void CPWL_ScrollBar::OnMaxButtonMouseMove(const CPDF_Point& point) {} 991 void CPWL_ScrollBar::OnMaxButtonMouseMove(const CFX_FloatPoint& point) {}
973 992
974 void CPWL_ScrollBar::OnPosButtonLBDown(const CPDF_Point& point) { 993 void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_FloatPoint& point) {
975 m_bMouseDown = TRUE; 994 m_bMouseDown = TRUE;
976 995
977 if (m_pPosButton) { 996 if (m_pPosButton) {
978 CPDF_Rect rcPosButton = m_pPosButton->GetWindowRect(); 997 CFX_FloatRect rcPosButton = m_pPosButton->GetWindowRect();
979 998
980 switch (m_sbType) { 999 switch (m_sbType) {
981 case SBT_HSCROLL: 1000 case SBT_HSCROLL:
982 m_nOldPos = point.x; 1001 m_nOldPos = point.x;
983 m_fOldPosButton = rcPosButton.left; 1002 m_fOldPosButton = rcPosButton.left;
984 break; 1003 break;
985 case SBT_VSCROLL: 1004 case SBT_VSCROLL:
986 m_nOldPos = point.y; 1005 m_nOldPos = point.y;
987 m_fOldPosButton = rcPosButton.top; 1006 m_fOldPosButton = rcPosButton.top;
988 break; 1007 break;
989 } 1008 }
990 } 1009 }
991 } 1010 }
992 1011
993 void CPWL_ScrollBar::OnPosButtonLBUp(const CPDF_Point& point) { 1012 void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_FloatPoint& point) {
994 if (m_bMouseDown) { 1013 if (m_bMouseDown) {
995 if (!m_bNotifyForever) 1014 if (!m_bNotifyForever)
996 NotifyScrollWindow(); 1015 NotifyScrollWindow();
997 } 1016 }
998 m_bMouseDown = FALSE; 1017 m_bMouseDown = FALSE;
999 } 1018 }
1000 1019
1001 void CPWL_ScrollBar::OnPosButtonMouseMove(const CPDF_Point& point) { 1020 void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_FloatPoint& point) {
1002 FX_FLOAT fOldScrollPos = m_sData.fScrollPos; 1021 FX_FLOAT fOldScrollPos = m_sData.fScrollPos;
1003 1022
1004 FX_FLOAT fNewPos = 0; 1023 FX_FLOAT fNewPos = 0;
1005 1024
1006 switch (m_sbType) { 1025 switch (m_sbType) {
1007 case SBT_HSCROLL: 1026 case SBT_HSCROLL:
1008 if (FXSYS_fabs(point.x - m_nOldPos) < 1) 1027 if (FXSYS_fabs(point.x - m_nOldPos) < 1)
1009 return; 1028 return;
1010 fNewPos = FaceToTrue(m_fOldPosButton + point.x - m_nOldPos); 1029 fNewPos = FaceToTrue(m_fOldPosButton + point.x - m_nOldPos);
1011 break; 1030 break;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 break; 1083 break;
1065 case SBT_VSCROLL: 1084 case SBT_VSCROLL:
1066 fPos = m_OriginInfo.fContentMax - m_sData.fScrollPos; 1085 fPos = m_OriginInfo.fContentMax - m_sData.fScrollPos;
1067 break; 1086 break;
1068 } 1087 }
1069 pParent->OnNotify(this, PNM_SCROLLWINDOW, (intptr_t)m_sbType, 1088 pParent->OnNotify(this, PNM_SCROLLWINDOW, (intptr_t)m_sbType,
1070 (intptr_t)&fPos); 1089 (intptr_t)&fPos);
1071 } 1090 }
1072 } 1091 }
1073 1092
1074 CPDF_Rect CPWL_ScrollBar::GetScrollArea() const { 1093 CFX_FloatRect CPWL_ScrollBar::GetScrollArea() const {
1075 CPDF_Rect rcClient = GetClientRect(); 1094 CFX_FloatRect rcClient = GetClientRect();
1076 CPDF_Rect rcArea; 1095 CFX_FloatRect rcArea;
1077 1096
1078 if (!m_pMinButton || !m_pMaxButton) 1097 if (!m_pMinButton || !m_pMaxButton)
1079 return rcClient; 1098 return rcClient;
1080 1099
1081 CPDF_Rect rcMin = m_pMinButton->GetWindowRect(); 1100 CFX_FloatRect rcMin = m_pMinButton->GetWindowRect();
1082 CPDF_Rect rcMax = m_pMaxButton->GetWindowRect(); 1101 CFX_FloatRect rcMax = m_pMaxButton->GetWindowRect();
1083 1102
1084 FX_FLOAT fMinWidth = rcMin.right - rcMin.left; 1103 FX_FLOAT fMinWidth = rcMin.right - rcMin.left;
1085 FX_FLOAT fMinHeight = rcMin.top - rcMin.bottom; 1104 FX_FLOAT fMinHeight = rcMin.top - rcMin.bottom;
1086 FX_FLOAT fMaxWidth = rcMax.right - rcMax.left; 1105 FX_FLOAT fMaxWidth = rcMax.right - rcMax.left;
1087 FX_FLOAT fMaxHeight = rcMax.top - rcMax.bottom; 1106 FX_FLOAT fMaxHeight = rcMax.top - rcMax.bottom;
1088 1107
1089 switch (m_sbType) { 1108 switch (m_sbType) {
1090 case SBT_HSCROLL: 1109 case SBT_HSCROLL:
1091 if (rcClient.right - rcClient.left > fMinWidth + fMaxWidth + 2) { 1110 if (rcClient.right - rcClient.left > fMinWidth + fMaxWidth + 2) {
1092 rcArea = CPDF_Rect(rcClient.left + fMinWidth + 1, rcClient.bottom, 1111 rcArea = CFX_FloatRect(rcClient.left + fMinWidth + 1, rcClient.bottom,
1093 rcClient.right - fMaxWidth - 1, rcClient.top); 1112 rcClient.right - fMaxWidth - 1, rcClient.top);
1094 } else { 1113 } else {
1095 rcArea = CPDF_Rect(rcClient.left + fMinWidth + 1, rcClient.bottom, 1114 rcArea = CFX_FloatRect(rcClient.left + fMinWidth + 1, rcClient.bottom,
1096 rcClient.left + fMinWidth + 1, rcClient.top); 1115 rcClient.left + fMinWidth + 1, rcClient.top);
1097 } 1116 }
1098 break; 1117 break;
1099 case SBT_VSCROLL: 1118 case SBT_VSCROLL:
1100 if (rcClient.top - rcClient.bottom > fMinHeight + fMaxHeight + 2) { 1119 if (rcClient.top - rcClient.bottom > fMinHeight + fMaxHeight + 2) {
1101 rcArea = CPDF_Rect(rcClient.left, rcClient.bottom + fMinHeight + 1, 1120 rcArea = CFX_FloatRect(rcClient.left, rcClient.bottom + fMinHeight + 1,
1102 rcClient.right, rcClient.top - fMaxHeight - 1); 1121 rcClient.right, rcClient.top - fMaxHeight - 1);
1103 } else { 1122 } else {
1104 rcArea = CPDF_Rect(rcClient.left, rcClient.bottom + fMinHeight + 1, 1123 rcArea =
1105 rcClient.right, rcClient.bottom + fMinHeight + 1); 1124 CFX_FloatRect(rcClient.left, rcClient.bottom + fMinHeight + 1,
1125 rcClient.right, rcClient.bottom + fMinHeight + 1);
1106 } 1126 }
1107 break; 1127 break;
1108 } 1128 }
1109 1129
1110 rcArea.Normalize(); 1130 rcArea.Normalize();
1111 1131
1112 return rcArea; 1132 return rcArea;
1113 } 1133 }
1114 1134
1115 FX_FLOAT CPWL_ScrollBar::TrueToFace(FX_FLOAT fTrue) { 1135 FX_FLOAT CPWL_ScrollBar::TrueToFace(FX_FLOAT fTrue) {
1116 CPDF_Rect rcPosArea; 1136 CFX_FloatRect rcPosArea;
1117 rcPosArea = GetScrollArea(); 1137 rcPosArea = GetScrollArea();
1118 1138
1119 FX_FLOAT fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth; 1139 FX_FLOAT fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth;
1120 fFactWidth = fFactWidth == 0 ? 1 : fFactWidth; 1140 fFactWidth = fFactWidth == 0 ? 1 : fFactWidth;
1121 1141
1122 FX_FLOAT fFace = 0; 1142 FX_FLOAT fFace = 0;
1123 1143
1124 switch (m_sbType) { 1144 switch (m_sbType) {
1125 case SBT_HSCROLL: 1145 case SBT_HSCROLL:
1126 fFace = rcPosArea.left + 1146 fFace = rcPosArea.left +
1127 fTrue * (rcPosArea.right - rcPosArea.left) / fFactWidth; 1147 fTrue * (rcPosArea.right - rcPosArea.left) / fFactWidth;
1128 break; 1148 break;
1129 case SBT_VSCROLL: 1149 case SBT_VSCROLL:
1130 fFace = rcPosArea.top - 1150 fFace = rcPosArea.top -
1131 fTrue * (rcPosArea.top - rcPosArea.bottom) / fFactWidth; 1151 fTrue * (rcPosArea.top - rcPosArea.bottom) / fFactWidth;
1132 break; 1152 break;
1133 } 1153 }
1134 1154
1135 return fFace; 1155 return fFace;
1136 } 1156 }
1137 1157
1138 FX_FLOAT CPWL_ScrollBar::FaceToTrue(FX_FLOAT fFace) { 1158 FX_FLOAT CPWL_ScrollBar::FaceToTrue(FX_FLOAT fFace) {
1139 CPDF_Rect rcPosArea; 1159 CFX_FloatRect rcPosArea;
1140 rcPosArea = GetScrollArea(); 1160 rcPosArea = GetScrollArea();
1141 1161
1142 FX_FLOAT fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth; 1162 FX_FLOAT fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth;
1143 fFactWidth = fFactWidth == 0 ? 1 : fFactWidth; 1163 fFactWidth = fFactWidth == 0 ? 1 : fFactWidth;
1144 1164
1145 FX_FLOAT fTrue = 0; 1165 FX_FLOAT fTrue = 0;
1146 1166
1147 switch (m_sbType) { 1167 switch (m_sbType) {
1148 case SBT_HSCROLL: 1168 case SBT_HSCROLL:
1149 fTrue = (fFace - rcPosArea.left) * fFactWidth / 1169 fTrue = (fFace - rcPosArea.left) * fFactWidth /
(...skipping 18 matching lines...) Expand all
1168 if (m_bMinOrMax) 1188 if (m_bMinOrMax)
1169 m_sData.SubSmall(); 1189 m_sData.SubSmall();
1170 else 1190 else
1171 m_sData.AddSmall(); 1191 m_sData.AddSmall();
1172 1192
1173 if (FXSYS_memcmp(&m_sData, &sTemp, sizeof(PWL_SCROLL_PRIVATEDATA)) != 0) { 1193 if (FXSYS_memcmp(&m_sData, &sTemp, sizeof(PWL_SCROLL_PRIVATEDATA)) != 0) {
1174 MovePosButton(TRUE); 1194 MovePosButton(TRUE);
1175 NotifyScrollWindow(); 1195 NotifyScrollWindow();
1176 } 1196 }
1177 } 1197 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_Note.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_Signature.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698