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

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

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