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

Side by Side Diff: fpdfsdk/src/pdfwindow/PWL_Note.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, 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_ListCtrl.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_ScrollBar.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_Note.h" 7 #include "fpdfsdk/include/pdfwindow/PWL_Note.h"
8 8
9 #include "fpdfsdk/include/pdfwindow/PWL_Button.h" 9 #include "fpdfsdk/include/pdfwindow/PWL_Button.h"
10 #include "fpdfsdk/include/pdfwindow/PWL_Caret.h" 10 #include "fpdfsdk/include/pdfwindow/PWL_Caret.h"
(...skipping 24 matching lines...) Expand all
35 35
36 void CPWL_Note_Options::SetTextColor(const CPWL_Color& color) { 36 void CPWL_Note_Options::SetTextColor(const CPWL_Color& color) {
37 CPWL_Wnd::SetTextColor(color); 37 CPWL_Wnd::SetTextColor(color);
38 38
39 if (m_pText) 39 if (m_pText)
40 m_pText->SetTextColor(color); 40 m_pText->SetTextColor(color);
41 } 41 }
42 42
43 void CPWL_Note_Options::RePosChildWnd() { 43 void CPWL_Note_Options::RePosChildWnd() {
44 if (IsValid()) { 44 if (IsValid()) {
45 CPDF_Rect rcClient = GetClientRect(); 45 CFX_FloatRect rcClient = GetClientRect();
46 46
47 if (rcClient.Width() > 15.0f) { 47 if (rcClient.Width() > 15.0f) {
48 rcClient.right -= 15.0f; 48 rcClient.right -= 15.0f;
49 m_pText->Move(rcClient, TRUE, FALSE); 49 m_pText->Move(rcClient, TRUE, FALSE);
50 m_pText->SetVisible(TRUE); 50 m_pText->SetVisible(TRUE);
51 } else { 51 } else {
52 m_pText->Move(CPDF_Rect(0, 0, 0, 0), TRUE, FALSE); 52 m_pText->Move(CFX_FloatRect(0, 0, 0, 0), TRUE, FALSE);
53 m_pText->SetVisible(FALSE); 53 m_pText->SetVisible(FALSE);
54 } 54 }
55 } 55 }
56 } 56 }
57 57
58 void CPWL_Note_Options::CreateChildWnd(const PWL_CREATEPARAM& cp) { 58 void CPWL_Note_Options::CreateChildWnd(const PWL_CREATEPARAM& cp) {
59 m_pText = new CPWL_Label; 59 m_pText = new CPWL_Label;
60 PWL_CREATEPARAM tcp = cp; 60 PWL_CREATEPARAM tcp = cp;
61 tcp.pParentWnd = this; 61 tcp.pParentWnd = this;
62 tcp.dwFlags = PWS_CHILD | PWS_VISIBLE; 62 tcp.dwFlags = PWS_CHILD | PWS_VISIBLE;
63 m_pText->Create(tcp); 63 m_pText->Create(tcp);
64 } 64 }
65 65
66 void CPWL_Note_Options::SetText(const CFX_WideString& sText) { 66 void CPWL_Note_Options::SetText(const CFX_WideString& sText) {
67 m_pText->SetText(sText.c_str()); 67 m_pText->SetText(sText.c_str());
68 } 68 }
69 69
70 void CPWL_Note_Options::DrawThisAppearance(CFX_RenderDevice* pDevice, 70 void CPWL_Note_Options::DrawThisAppearance(CFX_RenderDevice* pDevice,
71 CFX_Matrix* pUser2Device) { 71 CFX_Matrix* pUser2Device) {
72 CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); 72 CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
73 73
74 CPDF_Rect rcClient = GetClientRect(); 74 CFX_FloatRect rcClient = GetClientRect();
75 rcClient.left = rcClient.right - 15.0f; 75 rcClient.left = rcClient.right - 15.0f;
76 76
77 CPDF_Point ptCenter = CPDF_Point((rcClient.left + rcClient.right) * 0.5f, 77 CFX_FloatPoint ptCenter =
78 (rcClient.top + rcClient.bottom) * 0.5f); 78 CFX_FloatPoint((rcClient.left + rcClient.right) * 0.5f,
79 (rcClient.top + rcClient.bottom) * 0.5f);
79 80
80 CPDF_Point pt1(ptCenter.x - 2.0f, ptCenter.y + 2.0f * 0.5f); 81 CFX_FloatPoint pt1(ptCenter.x - 2.0f, ptCenter.y + 2.0f * 0.5f);
81 CPDF_Point pt2(ptCenter.x + 2.0f, ptCenter.y + 2.0f * 0.5f); 82 CFX_FloatPoint pt2(ptCenter.x + 2.0f, ptCenter.y + 2.0f * 0.5f);
82 CPDF_Point pt3(ptCenter.x, ptCenter.y - 3.0f * 0.5f); 83 CFX_FloatPoint pt3(ptCenter.x, ptCenter.y - 3.0f * 0.5f);
83 84
84 CFX_PathData path; 85 CFX_PathData path;
85 86
86 path.SetPointCount(4); 87 path.SetPointCount(4);
87 path.SetPoint(0, pt1.x, pt1.y, FXPT_MOVETO); 88 path.SetPoint(0, pt1.x, pt1.y, FXPT_MOVETO);
88 path.SetPoint(1, pt2.x, pt2.y, FXPT_LINETO); 89 path.SetPoint(1, pt2.x, pt2.y, FXPT_LINETO);
89 path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); 90 path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO);
90 path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); 91 path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO);
91 92
92 pDevice->DrawPath( 93 pDevice->DrawPath(
93 &path, pUser2Device, NULL, 94 &path, pUser2Device, NULL,
94 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), 0, 95 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), 0,
95 FXFILL_ALTERNATE); 96 FXFILL_ALTERNATE);
96 } 97 }
97 98
98 CPDF_Rect CPWL_Note_Options::GetContentRect() const { 99 CFX_FloatRect CPWL_Note_Options::GetContentRect() const {
99 CPDF_Rect rcText = m_pText->GetContentRect(); 100 CFX_FloatRect rcText = m_pText->GetContentRect();
100 rcText.right += 15.0f; 101 rcText.right += 15.0f;
101 return rcText; 102 return rcText;
102 } 103 }
103 104
104 CPWL_Note_Edit::CPWL_Note_Edit() 105 CPWL_Note_Edit::CPWL_Note_Edit()
105 : m_bEnableNotify(TRUE), 106 : m_bEnableNotify(TRUE),
106 m_fOldItemHeight(0.0f), 107 m_fOldItemHeight(0.0f),
107 m_bSizeChanged(FALSE), 108 m_bSizeChanged(FALSE),
108 m_fOldMin(0.0f), 109 m_fOldMin(0.0f),
109 m_fOldMax(0.0f) {} 110 m_fOldMax(0.0f) {}
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 if (fLimitWidth > 0) { 199 if (fLimitWidth > 0) {
199 if (!m_bSizeChanged) 200 if (!m_bSizeChanged)
200 return m_fOldItemHeight; 201 return m_fOldItemHeight;
201 202
202 m_bSizeChanged = FALSE; 203 m_bSizeChanged = FALSE;
203 204
204 EnableNotify(FALSE); 205 EnableNotify(FALSE);
205 EnableRefresh(FALSE); 206 EnableRefresh(FALSE);
206 m_pEdit->EnableNotify(FALSE); 207 m_pEdit->EnableNotify(FALSE);
207 208
208 Move(CPDF_Rect(0, 0, fLimitWidth, 0), TRUE, FALSE); 209 Move(CFX_FloatRect(0, 0, fLimitWidth, 0), TRUE, FALSE);
209 FX_FLOAT fRet = GetContentRect().Height(); 210 FX_FLOAT fRet = GetContentRect().Height();
210 211
211 m_pEdit->EnableNotify(TRUE); 212 m_pEdit->EnableNotify(TRUE);
212 EnableNotify(TRUE); 213 EnableNotify(TRUE);
213 EnableRefresh(TRUE); 214 EnableRefresh(TRUE);
214 215
215 return fRet; 216 return fRet;
216 } 217 }
217 218
218 return 0; 219 return 0;
219 } 220 }
220 221
221 FX_FLOAT CPWL_Note_Edit::GetItemLeftMargin() { 222 FX_FLOAT CPWL_Note_Edit::GetItemLeftMargin() {
222 return POPUP_ITEM_TEXT_INDENT; 223 return POPUP_ITEM_TEXT_INDENT;
223 } 224 }
224 225
225 FX_FLOAT CPWL_Note_Edit::GetItemRightMargin() { 226 FX_FLOAT CPWL_Note_Edit::GetItemRightMargin() {
226 return POPUP_ITEM_TEXT_INDENT; 227 return POPUP_ITEM_TEXT_INDENT;
227 } 228 }
228 229
229 CPWL_Note_LBBox::CPWL_Note_LBBox() {} 230 CPWL_Note_LBBox::CPWL_Note_LBBox() {}
230 231
231 CPWL_Note_LBBox::~CPWL_Note_LBBox() {} 232 CPWL_Note_LBBox::~CPWL_Note_LBBox() {}
232 233
233 void CPWL_Note_LBBox::DrawThisAppearance(CFX_RenderDevice* pDevice, 234 void CPWL_Note_LBBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
234 CFX_Matrix* pUser2Device) { 235 CFX_Matrix* pUser2Device) {
235 CPDF_Rect rcClient = GetClientRect(); 236 CFX_FloatRect rcClient = GetClientRect();
236 237
237 CFX_GraphStateData gsd; 238 CFX_GraphStateData gsd;
238 gsd.m_LineWidth = 1.0f; 239 gsd.m_LineWidth = 1.0f;
239 240
240 CFX_PathData pathCross; 241 CFX_PathData pathCross;
241 242
242 pathCross.SetPointCount(4); 243 pathCross.SetPointCount(4);
243 pathCross.SetPoint(0, rcClient.left, rcClient.top, FXPT_MOVETO); 244 pathCross.SetPoint(0, rcClient.left, rcClient.top, FXPT_MOVETO);
244 pathCross.SetPoint(1, rcClient.right, rcClient.bottom, FXPT_LINETO); 245 pathCross.SetPoint(1, rcClient.right, rcClient.bottom, FXPT_LINETO);
245 pathCross.SetPoint(2, rcClient.left, 246 pathCross.SetPoint(2, rcClient.left,
246 rcClient.bottom + rcClient.Height() * 0.5f, FXPT_MOVETO); 247 rcClient.bottom + rcClient.Height() * 0.5f, FXPT_MOVETO);
247 pathCross.SetPoint(3, rcClient.left + rcClient.Width() * 0.5f, 248 pathCross.SetPoint(3, rcClient.left + rcClient.Width() * 0.5f,
248 rcClient.bottom, FXPT_LINETO); 249 rcClient.bottom, FXPT_LINETO);
249 250
250 pDevice->DrawPath( 251 pDevice->DrawPath(
251 &pathCross, pUser2Device, &gsd, 0, 252 &pathCross, pUser2Device, &gsd, 0,
252 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), 253 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
253 FXFILL_ALTERNATE); 254 FXFILL_ALTERNATE);
254 } 255 }
255 256
256 CPWL_Note_RBBox::CPWL_Note_RBBox() {} 257 CPWL_Note_RBBox::CPWL_Note_RBBox() {}
257 258
258 CPWL_Note_RBBox::~CPWL_Note_RBBox() {} 259 CPWL_Note_RBBox::~CPWL_Note_RBBox() {}
259 260
260 void CPWL_Note_RBBox::DrawThisAppearance(CFX_RenderDevice* pDevice, 261 void CPWL_Note_RBBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
261 CFX_Matrix* pUser2Device) { 262 CFX_Matrix* pUser2Device) {
262 CPDF_Rect rcClient = GetClientRect(); 263 CFX_FloatRect rcClient = GetClientRect();
263 264
264 CFX_GraphStateData gsd; 265 CFX_GraphStateData gsd;
265 gsd.m_LineWidth = 1.0f; 266 gsd.m_LineWidth = 1.0f;
266 267
267 CFX_PathData pathCross; 268 CFX_PathData pathCross;
268 269
269 pathCross.SetPointCount(4); 270 pathCross.SetPointCount(4);
270 pathCross.SetPoint(0, rcClient.right, rcClient.top, FXPT_MOVETO); 271 pathCross.SetPoint(0, rcClient.right, rcClient.top, FXPT_MOVETO);
271 pathCross.SetPoint(1, rcClient.left, rcClient.bottom, FXPT_LINETO); 272 pathCross.SetPoint(1, rcClient.left, rcClient.bottom, FXPT_LINETO);
272 pathCross.SetPoint(2, rcClient.right, 273 pathCross.SetPoint(2, rcClient.right,
(...skipping 23 matching lines...) Expand all
296 } 297 }
297 298
298 CPWL_Note_CloseBox::CPWL_Note_CloseBox() : m_bMouseDown(FALSE) {} 299 CPWL_Note_CloseBox::CPWL_Note_CloseBox() : m_bMouseDown(FALSE) {}
299 300
300 CPWL_Note_CloseBox::~CPWL_Note_CloseBox() {} 301 CPWL_Note_CloseBox::~CPWL_Note_CloseBox() {}
301 302
302 void CPWL_Note_CloseBox::DrawThisAppearance(CFX_RenderDevice* pDevice, 303 void CPWL_Note_CloseBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
303 CFX_Matrix* pUser2Device) { 304 CFX_Matrix* pUser2Device) {
304 CPWL_Button::DrawThisAppearance(pDevice, pUser2Device); 305 CPWL_Button::DrawThisAppearance(pDevice, pUser2Device);
305 306
306 CPDF_Rect rcClient = GetClientRect(); 307 CFX_FloatRect rcClient = GetClientRect();
307 rcClient = CPWL_Utils::DeflateRect(rcClient, 2.0f); 308 rcClient = CPWL_Utils::DeflateRect(rcClient, 2.0f);
308 309
309 CFX_GraphStateData gsd; 310 CFX_GraphStateData gsd;
310 gsd.m_LineWidth = 1.0f; 311 gsd.m_LineWidth = 1.0f;
311 312
312 CFX_PathData pathCross; 313 CFX_PathData pathCross;
313 314
314 if (m_bMouseDown) { 315 if (m_bMouseDown) {
315 rcClient.left += 0.5f; 316 rcClient.left += 0.5f;
316 rcClient.right += 0.5f; 317 rcClient.right += 0.5f;
317 rcClient.top -= 0.5f; 318 rcClient.top -= 0.5f;
318 rcClient.bottom -= 0.5f; 319 rcClient.bottom -= 0.5f;
319 } 320 }
320 321
321 pathCross.SetPointCount(4); 322 pathCross.SetPointCount(4);
322 pathCross.SetPoint(0, rcClient.left, rcClient.bottom, FXPT_MOVETO); 323 pathCross.SetPoint(0, rcClient.left, rcClient.bottom, FXPT_MOVETO);
323 pathCross.SetPoint(1, rcClient.right, rcClient.top, FXPT_LINETO); 324 pathCross.SetPoint(1, rcClient.right, rcClient.top, FXPT_LINETO);
324 pathCross.SetPoint(2, rcClient.left, rcClient.top, FXPT_MOVETO); 325 pathCross.SetPoint(2, rcClient.left, rcClient.top, FXPT_MOVETO);
325 pathCross.SetPoint(3, rcClient.right, rcClient.bottom, FXPT_LINETO); 326 pathCross.SetPoint(3, rcClient.right, rcClient.bottom, FXPT_LINETO);
326 327
327 pDevice->DrawPath( 328 pDevice->DrawPath(
328 &pathCross, pUser2Device, &gsd, 0, 329 &pathCross, pUser2Device, &gsd, 0,
329 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), 330 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
330 FXFILL_ALTERNATE); 331 FXFILL_ALTERNATE);
331 } 332 }
332 333
333 FX_BOOL CPWL_Note_CloseBox::OnLButtonDown(const CPDF_Point& point, 334 FX_BOOL CPWL_Note_CloseBox::OnLButtonDown(const CFX_FloatPoint& point,
334 FX_DWORD nFlag) { 335 FX_DWORD nFlag) {
335 SetBorderStyle(PBS_INSET); 336 SetBorderStyle(PBS_INSET);
336 InvalidateRect(NULL); 337 InvalidateRect(NULL);
337 338
338 m_bMouseDown = TRUE; 339 m_bMouseDown = TRUE;
339 340
340 return CPWL_Button::OnLButtonDown(point, nFlag); 341 return CPWL_Button::OnLButtonDown(point, nFlag);
341 } 342 }
342 343
343 FX_BOOL CPWL_Note_CloseBox::OnLButtonUp(const CPDF_Point& point, 344 FX_BOOL CPWL_Note_CloseBox::OnLButtonUp(const CFX_FloatPoint& point,
344 FX_DWORD nFlag) { 345 FX_DWORD nFlag) {
345 m_bMouseDown = FALSE; 346 m_bMouseDown = FALSE;
346 347
347 SetBorderStyle(PBS_BEVELED); 348 SetBorderStyle(PBS_BEVELED);
348 InvalidateRect(NULL); 349 InvalidateRect(NULL);
349 350
350 return CPWL_Button::OnLButtonUp(point, nFlag); 351 return CPWL_Button::OnLButtonUp(point, nFlag);
351 } 352 }
352 353
353 CPWL_Note_Contents::CPWL_Note_Contents() : m_pEdit(NULL) {} 354 CPWL_Note_Contents::CPWL_Note_Contents() : m_pEdit(NULL) {}
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 ASSERT(pChild->GetClassName() == "CPWL_NoteItem"); 442 ASSERT(pChild->GetClassName() == "CPWL_NoteItem");
442 CPWL_NoteItem* pItem = (CPWL_NoteItem*)pChild; 443 CPWL_NoteItem* pItem = (CPWL_NoteItem*)pChild;
443 pItem->ResetSubjectName(i); 444 pItem->ResetSubjectName(i);
444 } 445 }
445 } 446 }
446 447
447 OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); 448 OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0);
448 } 449 }
449 } 450 }
450 451
451 IPWL_NoteItem* CPWL_Note_Contents::GetHitNoteItem(const CPDF_Point& point) { 452 IPWL_NoteItem* CPWL_Note_Contents::GetHitNoteItem(const CFX_FloatPoint& point) {
452 CPDF_Point pt = ParentToChild(point); 453 CFX_FloatPoint pt = ParentToChild(point);
453 454
454 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { 455 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) {
455 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { 456 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) {
456 if (pChild->GetClassName() == "CPWL_NoteItem") { 457 if (pChild->GetClassName() == "CPWL_NoteItem") {
457 CPWL_NoteItem* pNoteItem = (CPWL_NoteItem*)pChild; 458 CPWL_NoteItem* pNoteItem = (CPWL_NoteItem*)pChild;
458 if (IPWL_NoteItem* pRet = pNoteItem->GetHitNoteItem(pt)) 459 if (IPWL_NoteItem* pRet = pNoteItem->GetHitNoteItem(pt))
459 return pRet; 460 return pRet;
460 } 461 }
461 } 462 }
462 } 463 }
(...skipping 18 matching lines...) Expand all
481 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 482 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
482 pChild->OnNotify(this, PNM_NOTERESET, 0, 0); 483 pChild->OnNotify(this, PNM_NOTERESET, 0, 0);
483 } 484 }
484 485
485 if (CPWL_Wnd* pParent = GetParentWindow()) { 486 if (CPWL_Wnd* pParent = GetParentWindow()) {
486 pParent->OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); 487 pParent->OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0);
487 } 488 }
488 } 489 }
489 return; 490 return;
490 case PNM_SCROLLWINDOW: 491 case PNM_SCROLLWINDOW:
491 SetScrollPos(CPDF_Point(0.0f, *(FX_FLOAT*)lParam)); 492 SetScrollPos(CFX_FloatPoint(0.0f, *(FX_FLOAT*)lParam));
492 ResetFace(); 493 ResetFace();
493 InvalidateRect(NULL); 494 InvalidateRect(NULL);
494 return; 495 return;
495 case PNM_SETCARETINFO: 496 case PNM_SETCARETINFO:
496 if (PWL_CARET_INFO* pInfo = (PWL_CARET_INFO*)wParam) { 497 if (PWL_CARET_INFO* pInfo = (PWL_CARET_INFO*)wParam) {
497 PWL_CARET_INFO newInfo = *pInfo; 498 PWL_CARET_INFO newInfo = *pInfo;
498 newInfo.bVisible = TRUE; 499 newInfo.bVisible = TRUE;
499 newInfo.ptHead = ChildToParent(pInfo->ptHead); 500 newInfo.ptHead = ChildToParent(pInfo->ptHead);
500 newInfo.ptFoot = ChildToParent(pInfo->ptFoot); 501 newInfo.ptFoot = ChildToParent(pInfo->ptFoot);
501 502
(...skipping 15 matching lines...) Expand all
517 m_pEdit->EnableNotify(FALSE); 518 m_pEdit->EnableNotify(FALSE);
518 ResetContent(0); 519 ResetContent(0);
519 m_pEdit->EnableNotify(TRUE); 520 m_pEdit->EnableNotify(TRUE);
520 } 521 }
521 return; 522 return;
522 } 523 }
523 524
524 CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); 525 CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam);
525 } 526 }
526 527
527 FX_BOOL CPWL_Note_Contents::OnLButtonDown(const CPDF_Point& point, 528 FX_BOOL CPWL_Note_Contents::OnLButtonDown(const CFX_FloatPoint& point,
528 FX_DWORD nFlag) { 529 FX_DWORD nFlag) {
529 if (CPWL_Wnd::OnLButtonDown(point, nFlag)) 530 if (CPWL_Wnd::OnLButtonDown(point, nFlag))
530 return TRUE; 531 return TRUE;
531 532
532 if (!m_pEdit->IsFocused()) { 533 if (!m_pEdit->IsFocused()) {
533 m_pEdit->SetFocus(); 534 m_pEdit->SetFocus();
534 } 535 }
535 536
536 return TRUE; 537 return TRUE;
537 } 538 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 CPWL_Color(COLORTYPE_RGB, 240 / 255.0f, 240 / 255.0f, 240 / 255.0f); 625 CPWL_Color(COLORTYPE_RGB, 240 / 255.0f, 240 / 255.0f, 240 / 255.0f);
625 ccp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BACKGROUND; 626 ccp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BACKGROUND;
626 m_pContents->Create(ccp); 627 m_pContents->Create(ccp);
627 m_pContents->SetItemSpace(POPUP_ITEM_SPACE); 628 m_pContents->SetItemSpace(POPUP_ITEM_SPACE);
628 m_pContents->SetTopSpace(POPUP_ITEM_SPACE); 629 m_pContents->SetTopSpace(POPUP_ITEM_SPACE);
629 m_pContents->SetBottomSpace(POPUP_ITEM_SPACE); 630 m_pContents->SetBottomSpace(POPUP_ITEM_SPACE);
630 } 631 }
631 632
632 void CPWL_NoteItem::RePosChildWnd() { 633 void CPWL_NoteItem::RePosChildWnd() {
633 if (IsValid()) { 634 if (IsValid()) {
634 CPDF_Rect rcClient = GetClientRect(); 635 CFX_FloatRect rcClient = GetClientRect();
635 636
636 CPDF_Rect rcSubject = rcClient; 637 CFX_FloatRect rcSubject = rcClient;
637 rcSubject.left += POPUP_ITEM_TEXT_INDENT; 638 rcSubject.left += POPUP_ITEM_TEXT_INDENT;
638 rcSubject.top = rcClient.top; 639 rcSubject.top = rcClient.top;
639 rcSubject.right = 640 rcSubject.right =
640 PWL_MIN(rcSubject.left + m_pSubject->GetContentRect().Width() + 1.0f, 641 PWL_MIN(rcSubject.left + m_pSubject->GetContentRect().Width() + 1.0f,
641 rcClient.right); 642 rcClient.right);
642 rcSubject.bottom = rcSubject.top - m_pSubject->GetContentRect().Height(); 643 rcSubject.bottom = rcSubject.top - m_pSubject->GetContentRect().Height();
643 rcSubject.Normalize(); 644 rcSubject.Normalize();
644 m_pSubject->Move(rcSubject, TRUE, FALSE); 645 m_pSubject->Move(rcSubject, TRUE, FALSE);
645 m_pSubject->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcSubject)); 646 m_pSubject->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcSubject));
646 647
647 CPDF_Rect rcDate = rcClient; 648 CFX_FloatRect rcDate = rcClient;
648 rcDate.right -= POPUP_ITEM_TEXT_INDENT; 649 rcDate.right -= POPUP_ITEM_TEXT_INDENT;
649 rcDate.left = 650 rcDate.left =
650 PWL_MAX(rcDate.right - m_pDateTime->GetContentRect().Width() - 1.0f, 651 PWL_MAX(rcDate.right - m_pDateTime->GetContentRect().Width() - 1.0f,
651 rcSubject.right); 652 rcSubject.right);
652 rcDate.bottom = rcDate.top - m_pDateTime->GetContentRect().Height(); 653 rcDate.bottom = rcDate.top - m_pDateTime->GetContentRect().Height();
653 rcDate.Normalize(); 654 rcDate.Normalize();
654 m_pDateTime->Move(rcDate, TRUE, FALSE); 655 m_pDateTime->Move(rcDate, TRUE, FALSE);
655 m_pDateTime->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcDate)); 656 m_pDateTime->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcDate));
656 657
657 CPDF_Rect rcContents = rcClient; 658 CFX_FloatRect rcContents = rcClient;
658 rcContents.left += 1.0f; 659 rcContents.left += 1.0f;
659 rcContents.right -= 1.0f; 660 rcContents.right -= 1.0f;
660 rcContents.top = rcDate.bottom - POPUP_ITEM_HEAD_BOTTOM; 661 rcContents.top = rcDate.bottom - POPUP_ITEM_HEAD_BOTTOM;
661 rcContents.bottom += POPUP_ITEM_BOTTOMWIDTH; 662 rcContents.bottom += POPUP_ITEM_BOTTOMWIDTH;
662 rcContents.Normalize(); 663 rcContents.Normalize();
663 m_pContents->Move(rcContents, TRUE, FALSE); 664 m_pContents->Move(rcContents, TRUE, FALSE);
664 m_pContents->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcContents)); 665 m_pContents->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcContents));
665 } 666 }
666 667
667 SetClipRect(CPWL_Utils::InflateRect(GetWindowRect(), 1.0f)); 668 SetClipRect(CPWL_Utils::InflateRect(GetWindowRect(), 1.0f));
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 KillFocus(); 844 KillFocus();
844 845
845 if (IPWL_NoteNotify* pNotify = GetNoteNotify()) { 846 if (IPWL_NoteNotify* pNotify = GetNoteNotify()) {
846 pNotify->OnItemDelete(pNoteItem); 847 pNotify->OnItemDelete(pNoteItem);
847 } 848 }
848 849
849 if (m_pContents) 850 if (m_pContents)
850 m_pContents->DeleteSubItem(pNoteItem); 851 m_pContents->DeleteSubItem(pNoteItem);
851 } 852 }
852 853
853 IPWL_NoteItem* CPWL_NoteItem::GetHitNoteItem(const CPDF_Point& point) { 854 IPWL_NoteItem* CPWL_NoteItem::GetHitNoteItem(const CFX_FloatPoint& point) {
854 CPDF_Point pt = ParentToChild(point); 855 CFX_FloatPoint pt = ParentToChild(point);
855 856
856 if (WndHitTest(pt)) { 857 if (WndHitTest(pt)) {
857 if (m_pContents) { 858 if (m_pContents) {
858 if (IPWL_NoteItem* pNoteItem = m_pContents->GetHitNoteItem(pt)) 859 if (IPWL_NoteItem* pNoteItem = m_pContents->GetHitNoteItem(pt))
859 return pNoteItem; 860 return pNoteItem;
860 } 861 }
861 862
862 return this; 863 return this;
863 } 864 }
864 865
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 } 903 }
903 904
904 FX_FLOAT CPWL_NoteItem::GetItemLeftMargin() { 905 FX_FLOAT CPWL_NoteItem::GetItemLeftMargin() {
905 return POPUP_ITEM_SIDEMARGIN; 906 return POPUP_ITEM_SIDEMARGIN;
906 } 907 }
907 908
908 FX_FLOAT CPWL_NoteItem::GetItemRightMargin() { 909 FX_FLOAT CPWL_NoteItem::GetItemRightMargin() {
909 return POPUP_ITEM_SIDEMARGIN; 910 return POPUP_ITEM_SIDEMARGIN;
910 } 911 }
911 912
912 FX_BOOL CPWL_NoteItem::OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) { 913 FX_BOOL CPWL_NoteItem::OnLButtonDown(const CFX_FloatPoint& point,
914 FX_DWORD nFlag) {
913 if (!m_pContents->WndHitTest(m_pContents->ParentToChild(point))) { 915 if (!m_pContents->WndHitTest(m_pContents->ParentToChild(point))) {
914 SetNoteFocus(FALSE); 916 SetNoteFocus(FALSE);
915 } 917 }
916 918
917 CPWL_Wnd::OnLButtonDown(point, nFlag); 919 CPWL_Wnd::OnLButtonDown(point, nFlag);
918 920
919 return TRUE; 921 return TRUE;
920 } 922 }
921 923
922 FX_BOOL CPWL_NoteItem::OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { 924 FX_BOOL CPWL_NoteItem::OnRButtonUp(const CFX_FloatPoint& point,
925 FX_DWORD nFlag) {
923 if (!m_pContents->WndHitTest(m_pContents->ParentToChild(point))) { 926 if (!m_pContents->WndHitTest(m_pContents->ParentToChild(point))) {
924 SetNoteFocus(FALSE); 927 SetNoteFocus(FALSE);
925 PopupNoteItemMenu(point); 928 PopupNoteItemMenu(point);
926 929
927 return TRUE; 930 return TRUE;
928 } 931 }
929 932
930 return CPWL_Wnd::OnRButtonUp(point, nFlag); 933 return CPWL_Wnd::OnRButtonUp(point, nFlag);
931 } 934 }
932 935
(...skipping 24 matching lines...) Expand all
957 case PNM_NOTERESET: 960 case PNM_NOTERESET:
958 m_bSizeChanged = TRUE; 961 m_bSizeChanged = TRUE;
959 m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0); 962 m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0);
960 963
961 return; 964 return;
962 } 965 }
963 966
964 CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); 967 CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam);
965 } 968 }
966 969
967 void CPWL_NoteItem::PopupNoteItemMenu(const CPDF_Point& point) { 970 void CPWL_NoteItem::PopupNoteItemMenu(const CFX_FloatPoint& point) {
968 if (IPWL_NoteNotify* pNotify = GetNoteNotify()) { 971 if (IPWL_NoteNotify* pNotify = GetNoteNotify()) {
969 int32_t x, y; 972 int32_t x, y;
970 PWLtoWnd(point, x, y); 973 PWLtoWnd(point, x, y);
971 if (IFX_SystemHandler* pSH = GetSystemHandler()) 974 if (IFX_SystemHandler* pSH = GetSystemHandler())
972 pSH->ClientToScreen(GetAttachedHWnd(), x, y); 975 pSH->ClientToScreen(GetAttachedHWnd(), x, y);
973 pNotify->OnPopupMenu(this, x, y); 976 pNotify->OnPopupMenu(this, x, y);
974 } 977 }
975 } 978 }
976 979
977 const CPWL_Note* CPWL_NoteItem::GetNote() const { 980 const CPWL_Note* CPWL_NoteItem::GetNote() const {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 } else { 1073 } else {
1071 if (m_pContentsBar->IsVisible()) { 1074 if (m_pContentsBar->IsVisible()) {
1072 m_pContentsBar->SetVisible(FALSE); 1075 m_pContentsBar->SetVisible(FALSE);
1073 m_pContentsBar->InvalidateRect(NULL); 1076 m_pContentsBar->InvalidateRect(NULL);
1074 1077
1075 bScrollChanged = TRUE; 1078 bScrollChanged = TRUE;
1076 } 1079 }
1077 } 1080 }
1078 1081
1079 if (bScrollChanged) { 1082 if (bScrollChanged) {
1080 CPDF_Rect rcNote = GetClientRect(); 1083 CFX_FloatRect rcNote = GetClientRect();
1081 CPDF_Rect rcContents = m_pContents->GetWindowRect(); 1084 CFX_FloatRect rcContents = m_pContents->GetWindowRect();
1082 rcContents.right = rcNote.right - 3.0f; 1085 rcContents.right = rcNote.right - 3.0f;
1083 if (m_pContentsBar->IsVisible()) 1086 if (m_pContentsBar->IsVisible())
1084 rcContents.right -= PWL_SCROLLBAR_WIDTH; 1087 rcContents.right -= PWL_SCROLLBAR_WIDTH;
1085 m_pContents->Move(rcContents, TRUE, TRUE); 1088 m_pContents->Move(rcContents, TRUE, TRUE);
1086 m_pContents->SetScrollPos(CPDF_Point(0.0f, 0.0f)); 1089 m_pContents->SetScrollPos(CFX_FloatPoint(0.0f, 0.0f));
1087 m_pContents->InvalidateRect(NULL); 1090 m_pContents->InvalidateRect(NULL);
1088 } 1091 }
1089 1092
1090 return bScrollChanged; 1093 return bScrollChanged;
1091 } 1094 }
1092 1095
1093 FX_BOOL CPWL_Note::ScrollBarShouldVisible() { 1096 FX_BOOL CPWL_Note::ScrollBarShouldVisible() {
1094 CPDF_Rect rcContentsFact = m_pContents->GetScrollArea(); 1097 CFX_FloatRect rcContentsFact = m_pContents->GetScrollArea();
1095 CPDF_Rect rcContentsClient = m_pContents->GetClientRect(); 1098 CFX_FloatRect rcContentsClient = m_pContents->GetClientRect();
1096 1099
1097 return rcContentsFact.Height() > rcContentsClient.Height(); 1100 return rcContentsFact.Height() > rcContentsClient.Height();
1098 } 1101 }
1099 1102
1100 void CPWL_Note::SetOptionsText(const CFX_WideString& sText) { 1103 void CPWL_Note::SetOptionsText(const CFX_WideString& sText) {
1101 if (m_pOptions) 1104 if (m_pOptions)
1102 m_pOptions->SetText(sText); 1105 m_pOptions->SetText(sText);
1103 1106
1104 RePosNoteChildren(); 1107 RePosNoteChildren();
1105 } 1108 }
1106 1109
1107 void CPWL_Note::RePosNoteChildren() { 1110 void CPWL_Note::RePosNoteChildren() {
1108 if (m_bResizing) 1111 if (m_bResizing)
1109 return; 1112 return;
1110 1113
1111 m_bResizing = TRUE; 1114 m_bResizing = TRUE;
1112 1115
1113 if (IsValid()) { 1116 if (IsValid()) {
1114 CPDF_Rect rcClient = GetClientRect(); 1117 CFX_FloatRect rcClient = GetClientRect();
1115 1118
1116 CPDF_Rect rcIcon = rcClient; 1119 CFX_FloatRect rcIcon = rcClient;
1117 rcIcon.top -= 2.0f; 1120 rcIcon.top -= 2.0f;
1118 rcIcon.right = rcIcon.left + 14.0f; 1121 rcIcon.right = rcIcon.left + 14.0f;
1119 rcIcon.bottom = rcIcon.top - 14.0f; 1122 rcIcon.bottom = rcIcon.top - 14.0f;
1120 rcIcon.Normalize(); 1123 rcIcon.Normalize();
1121 m_pIcon->Move(rcIcon, TRUE, FALSE); 1124 m_pIcon->Move(rcIcon, TRUE, FALSE);
1122 m_pIcon->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcIcon)); 1125 m_pIcon->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcIcon));
1123 1126
1124 CPDF_Rect rcCloseBox = rcClient; 1127 CFX_FloatRect rcCloseBox = rcClient;
1125 rcCloseBox.right -= 1.0f; 1128 rcCloseBox.right -= 1.0f;
1126 rcCloseBox.top -= 1.0f; 1129 rcCloseBox.top -= 1.0f;
1127 rcCloseBox.left = rcCloseBox.right - 14.0f; 1130 rcCloseBox.left = rcCloseBox.right - 14.0f;
1128 rcCloseBox.bottom = rcCloseBox.top - 14.0f; 1131 rcCloseBox.bottom = rcCloseBox.top - 14.0f;
1129 rcCloseBox.Normalize(); 1132 rcCloseBox.Normalize();
1130 m_pCloseBox->Move(rcCloseBox, TRUE, FALSE); 1133 m_pCloseBox->Move(rcCloseBox, TRUE, FALSE);
1131 m_pCloseBox->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcCloseBox)); 1134 m_pCloseBox->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcCloseBox));
1132 1135
1133 CPDF_Rect rcDate = rcClient; 1136 CFX_FloatRect rcDate = rcClient;
1134 rcDate.right = rcCloseBox.left - POPUP_ITEM_TEXT_INDENT; 1137 rcDate.right = rcCloseBox.left - POPUP_ITEM_TEXT_INDENT;
1135 rcDate.left = 1138 rcDate.left =
1136 PWL_MAX(rcDate.right - m_pDateTime->GetContentRect().Width() - 1.0f, 1139 PWL_MAX(rcDate.right - m_pDateTime->GetContentRect().Width() - 1.0f,
1137 rcIcon.right + 1.0f); 1140 rcIcon.right + 1.0f);
1138 rcDate.top = rcClient.top - 2.0f; 1141 rcDate.top = rcClient.top - 2.0f;
1139 rcDate.bottom = rcDate.top - m_pDateTime->GetContentRect().Height(); 1142 rcDate.bottom = rcDate.top - m_pDateTime->GetContentRect().Height();
1140 rcDate.Normalize(); 1143 rcDate.Normalize();
1141 m_pDateTime->Move(rcDate, TRUE, FALSE); 1144 m_pDateTime->Move(rcDate, TRUE, FALSE);
1142 m_pDateTime->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcDate)); 1145 m_pDateTime->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcDate));
1143 1146
1144 CPDF_Rect rcSubject = rcClient; 1147 CFX_FloatRect rcSubject = rcClient;
1145 rcSubject.top = rcClient.top - 2.0f; 1148 rcSubject.top = rcClient.top - 2.0f;
1146 rcSubject.left = rcIcon.right + POPUP_ITEM_TEXT_INDENT; 1149 rcSubject.left = rcIcon.right + POPUP_ITEM_TEXT_INDENT;
1147 rcSubject.right = 1150 rcSubject.right =
1148 PWL_MIN(rcSubject.left + m_pSubject->GetContentRect().Width() + 1.0f, 1151 PWL_MIN(rcSubject.left + m_pSubject->GetContentRect().Width() + 1.0f,
1149 rcDate.left - 1.0f); 1152 rcDate.left - 1.0f);
1150 rcSubject.bottom = rcSubject.top - m_pSubject->GetContentRect().Height(); 1153 rcSubject.bottom = rcSubject.top - m_pSubject->GetContentRect().Height();
1151 rcSubject.Normalize(); 1154 rcSubject.Normalize();
1152 m_pSubject->Move(rcSubject, TRUE, FALSE); 1155 m_pSubject->Move(rcSubject, TRUE, FALSE);
1153 m_pSubject->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcSubject)); 1156 m_pSubject->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcSubject));
1154 1157
1155 CPDF_Rect rcOptions = rcClient; 1158 CFX_FloatRect rcOptions = rcClient;
1156 rcOptions.left = 1159 rcOptions.left =
1157 PWL_MAX(rcOptions.right - m_pOptions->GetContentRect().Width(), 1160 PWL_MAX(rcOptions.right - m_pOptions->GetContentRect().Width(),
1158 rcIcon.right + 1.0f); 1161 rcIcon.right + 1.0f);
1159 rcOptions.top = rcSubject.bottom - 4.0f; 1162 rcOptions.top = rcSubject.bottom - 4.0f;
1160 rcOptions.bottom = rcOptions.top - m_pOptions->GetContentRect().Height(); 1163 rcOptions.bottom = rcOptions.top - m_pOptions->GetContentRect().Height();
1161 rcOptions.Normalize(); 1164 rcOptions.Normalize();
1162 m_pOptions->Move(rcOptions, TRUE, FALSE); 1165 m_pOptions->Move(rcOptions, TRUE, FALSE);
1163 m_pOptions->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcOptions)); 1166 m_pOptions->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcOptions));
1164 1167
1165 CPDF_Rect rcAuthor = rcClient; 1168 CFX_FloatRect rcAuthor = rcClient;
1166 rcAuthor.top = rcSubject.bottom - 4.0f; 1169 rcAuthor.top = rcSubject.bottom - 4.0f;
1167 rcAuthor.left = rcSubject.left; 1170 rcAuthor.left = rcSubject.left;
1168 rcAuthor.right = 1171 rcAuthor.right =
1169 PWL_MIN(rcSubject.left + m_pAuthor->GetContentRect().Width() + 1.0f, 1172 PWL_MIN(rcSubject.left + m_pAuthor->GetContentRect().Width() + 1.0f,
1170 rcOptions.left - 1.0f); 1173 rcOptions.left - 1.0f);
1171 rcAuthor.bottom = rcAuthor.top - m_pAuthor->GetContentRect().Height(); 1174 rcAuthor.bottom = rcAuthor.top - m_pAuthor->GetContentRect().Height();
1172 rcAuthor.Normalize(); 1175 rcAuthor.Normalize();
1173 m_pAuthor->Move(rcAuthor, TRUE, FALSE); 1176 m_pAuthor->Move(rcAuthor, TRUE, FALSE);
1174 m_pAuthor->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcAuthor)); 1177 m_pAuthor->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcAuthor));
1175 1178
1176 CPDF_Rect rcLBBox = rcClient; 1179 CFX_FloatRect rcLBBox = rcClient;
1177 rcLBBox.top = rcLBBox.bottom + 7.0f; 1180 rcLBBox.top = rcLBBox.bottom + 7.0f;
1178 rcLBBox.right = rcLBBox.left + 7.0f; 1181 rcLBBox.right = rcLBBox.left + 7.0f;
1179 rcLBBox.Normalize(); 1182 rcLBBox.Normalize();
1180 m_pLBBox->Move(rcLBBox, TRUE, FALSE); 1183 m_pLBBox->Move(rcLBBox, TRUE, FALSE);
1181 m_pLBBox->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcLBBox)); 1184 m_pLBBox->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcLBBox));
1182 1185
1183 CPDF_Rect rcRBBox = rcClient; 1186 CFX_FloatRect rcRBBox = rcClient;
1184 rcRBBox.top = rcRBBox.bottom + 7.0f; 1187 rcRBBox.top = rcRBBox.bottom + 7.0f;
1185 rcRBBox.left = rcRBBox.right - 7.0f; 1188 rcRBBox.left = rcRBBox.right - 7.0f;
1186 rcRBBox.Normalize(); 1189 rcRBBox.Normalize();
1187 m_pRBBox->Move(rcRBBox, TRUE, FALSE); 1190 m_pRBBox->Move(rcRBBox, TRUE, FALSE);
1188 m_pRBBox->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcRBBox)); 1191 m_pRBBox->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcRBBox));
1189 1192
1190 CPDF_Rect rcContents = rcClient; 1193 CFX_FloatRect rcContents = rcClient;
1191 rcContents.top = rcAuthor.bottom - POPUP_ITEM_HEAD_BOTTOM; 1194 rcContents.top = rcAuthor.bottom - POPUP_ITEM_HEAD_BOTTOM;
1192 rcContents.left += 3.0f; 1195 rcContents.left += 3.0f;
1193 rcContents.right -= 3.0f; 1196 rcContents.right -= 3.0f;
1194 if (m_pContentsBar->IsVisible()) 1197 if (m_pContentsBar->IsVisible())
1195 rcContents.right -= PWL_SCROLLBAR_WIDTH; 1198 rcContents.right -= PWL_SCROLLBAR_WIDTH;
1196 rcContents.bottom += 14.0f; 1199 rcContents.bottom += 14.0f;
1197 rcContents.Normalize(); 1200 rcContents.Normalize();
1198 m_pContents->Move(rcContents, FALSE, FALSE); 1201 m_pContents->Move(rcContents, FALSE, FALSE);
1199 m_pContents->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcContents)); 1202 m_pContents->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcContents));
1200 1203
1201 CPDF_Rect rcContentsBar = rcContents; 1204 CFX_FloatRect rcContentsBar = rcContents;
1202 rcContentsBar.right = rcClient.right - 3.0f; 1205 rcContentsBar.right = rcClient.right - 3.0f;
1203 rcContentsBar.left = rcContentsBar.right - PWL_SCROLLBAR_WIDTH; 1206 rcContentsBar.left = rcContentsBar.right - PWL_SCROLLBAR_WIDTH;
1204 rcContentsBar.Normalize(); 1207 rcContentsBar.Normalize();
1205 m_pContentsBar->Move(rcContentsBar, TRUE, FALSE); 1208 m_pContentsBar->Move(rcContentsBar, TRUE, FALSE);
1206 } 1209 }
1207 1210
1208 m_bResizing = FALSE; 1211 m_bResizing = FALSE;
1209 } 1212 }
1210 1213
1211 void CPWL_Note::CreateChildWnd(const PWL_CREATEPARAM& cp) { 1214 void CPWL_Note::CreateChildWnd(const PWL_CREATEPARAM& cp) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 } 1293 }
1291 1294
1292 CFX_WideString CPWL_Note::GetAuthorName() const { 1295 CFX_WideString CPWL_Note::GetAuthorName() const {
1293 if (m_pAuthor) 1296 if (m_pAuthor)
1294 return m_pAuthor->GetText(); 1297 return m_pAuthor->GetText();
1295 1298
1296 return L""; 1299 return L"";
1297 } 1300 }
1298 1301
1299 FX_BOOL CPWL_Note::OnMouseWheel(short zDelta, 1302 FX_BOOL CPWL_Note::OnMouseWheel(short zDelta,
1300 const CPDF_Point& point, 1303 const CFX_FloatPoint& point,
1301 FX_DWORD nFlag) { 1304 FX_DWORD nFlag) {
1302 CPDF_Point ptScroll = m_pContents->GetScrollPos(); 1305 CFX_FloatPoint ptScroll = m_pContents->GetScrollPos();
1303 CPDF_Rect rcScroll = m_pContents->GetScrollArea(); 1306 CFX_FloatRect rcScroll = m_pContents->GetScrollArea();
1304 CPDF_Rect rcContents = m_pContents->GetClientRect(); 1307 CFX_FloatRect rcContents = m_pContents->GetClientRect();
1305 1308
1306 if (rcScroll.top - rcScroll.bottom > rcContents.Height()) { 1309 if (rcScroll.top - rcScroll.bottom > rcContents.Height()) {
1307 CPDF_Point ptNew = ptScroll; 1310 CFX_FloatPoint ptNew = ptScroll;
1308 1311
1309 if (zDelta > 0) 1312 if (zDelta > 0)
1310 ptNew.y += 30; 1313 ptNew.y += 30;
1311 else 1314 else
1312 ptNew.y -= 30; 1315 ptNew.y -= 30;
1313 1316
1314 if (ptNew.y > rcScroll.top) 1317 if (ptNew.y > rcScroll.top)
1315 ptNew.y = rcScroll.top; 1318 ptNew.y = rcScroll.top;
1316 if (ptNew.y < rcScroll.bottom + rcContents.Height()) 1319 if (ptNew.y < rcScroll.bottom + rcContents.Height())
1317 ptNew.y = rcScroll.bottom + rcContents.Height(); 1320 ptNew.y = rcScroll.bottom + rcContents.Height();
(...skipping 13 matching lines...) Expand all
1331 1334
1332 return FALSE; 1335 return FALSE;
1333 } 1336 }
1334 1337
1335 void CPWL_Note::OnNotify(CPWL_Wnd* pWnd, 1338 void CPWL_Note::OnNotify(CPWL_Wnd* pWnd,
1336 FX_DWORD msg, 1339 FX_DWORD msg,
1337 intptr_t wParam, 1340 intptr_t wParam,
1338 intptr_t lParam) { 1341 intptr_t lParam) {
1339 switch (msg) { 1342 switch (msg) {
1340 case PNM_NOTEEDITCHANGED: { 1343 case PNM_NOTEEDITCHANGED: {
1341 CPDF_Rect rcScroll = m_pContents->GetScrollArea(); 1344 CFX_FloatRect rcScroll = m_pContents->GetScrollArea();
1342 1345
1343 PWL_SCROLL_INFO sInfo; 1346 PWL_SCROLL_INFO sInfo;
1344 sInfo.fContentMin = rcScroll.bottom; 1347 sInfo.fContentMin = rcScroll.bottom;
1345 sInfo.fContentMax = rcScroll.top; 1348 sInfo.fContentMax = rcScroll.top;
1346 sInfo.fPlateWidth = m_pContents->GetClientRect().Height(); 1349 sInfo.fPlateWidth = m_pContents->GetClientRect().Height();
1347 sInfo.fSmallStep = 13.0f; 1350 sInfo.fSmallStep = 13.0f;
1348 sInfo.fBigStep = sInfo.fPlateWidth; 1351 sInfo.fBigStep = sInfo.fPlateWidth;
1349 1352
1350 if (FXSYS_memcmp(&m_OldScrollInfo, &sInfo, sizeof(PWL_SCROLL_INFO)) != 1353 if (FXSYS_memcmp(&m_OldScrollInfo, &sInfo, sizeof(PWL_SCROLL_INFO)) !=
1351 0) { 1354 0) {
1352 FX_BOOL bScrollChanged = FALSE; 1355 FX_BOOL bScrollChanged = FALSE;
1353 1356
1354 if (lParam < 3) { 1357 if (lParam < 3) {
1355 bScrollChanged = ResetScrollBar(); 1358 bScrollChanged = ResetScrollBar();
1356 if (bScrollChanged) { 1359 if (bScrollChanged) {
1357 lParam++; 1360 lParam++;
1358 m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0); 1361 m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0);
1359 OnNotify(this, PNM_NOTEEDITCHANGED, 0, lParam); 1362 OnNotify(this, PNM_NOTEEDITCHANGED, 0, lParam);
1360 } 1363 }
1361 } 1364 }
1362 1365
1363 if (!bScrollChanged) { 1366 if (!bScrollChanged) {
1364 if (m_pContentsBar->IsVisible()) { 1367 if (m_pContentsBar->IsVisible()) {
1365 m_pContentsBar->OnNotify(pWnd, PNM_SETSCROLLINFO, SBT_VSCROLL, 1368 m_pContentsBar->OnNotify(pWnd, PNM_SETSCROLLINFO, SBT_VSCROLL,
1366 (intptr_t)&sInfo); 1369 (intptr_t)&sInfo);
1367 m_OldScrollInfo = sInfo; 1370 m_OldScrollInfo = sInfo;
1368 1371
1369 CPDF_Point ptScroll = m_pContents->GetScrollPos(); 1372 CFX_FloatPoint ptScroll = m_pContents->GetScrollPos();
1370 CPDF_Point ptOld = ptScroll; 1373 CFX_FloatPoint ptOld = ptScroll;
1371 1374
1372 if (ptScroll.y > sInfo.fContentMax) 1375 if (ptScroll.y > sInfo.fContentMax)
1373 ptScroll.y = sInfo.fContentMax; 1376 ptScroll.y = sInfo.fContentMax;
1374 if (ptScroll.y < sInfo.fContentMin + sInfo.fPlateWidth) 1377 if (ptScroll.y < sInfo.fContentMin + sInfo.fPlateWidth)
1375 ptScroll.y = sInfo.fContentMin + sInfo.fPlateWidth; 1378 ptScroll.y = sInfo.fContentMin + sInfo.fPlateWidth;
1376 if (ptScroll.y < sInfo.fContentMin) 1379 if (ptScroll.y < sInfo.fContentMin)
1377 ptScroll.y = sInfo.fContentMin; 1380 ptScroll.y = sInfo.fContentMin;
1378 1381
1379 if (ptOld.y != ptScroll.y) { 1382 if (ptOld.y != ptScroll.y) {
1380 m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, 1383 m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL,
(...skipping 16 matching lines...) Expand all
1397 return; 1400 return;
1398 case PNM_SETSCROLLPOS: 1401 case PNM_SETSCROLLPOS:
1399 if (m_pContentsBar) 1402 if (m_pContentsBar)
1400 m_pContentsBar->OnNotify(pWnd, PNM_SETSCROLLPOS, wParam, lParam); 1403 m_pContentsBar->OnNotify(pWnd, PNM_SETSCROLLPOS, wParam, lParam);
1401 return; 1404 return;
1402 } 1405 }
1403 1406
1404 if (msg == PNM_SETCARETINFO && IsValid()) { 1407 if (msg == PNM_SETCARETINFO && IsValid()) {
1405 if (PWL_CARET_INFO* pInfo = (PWL_CARET_INFO*)wParam) { 1408 if (PWL_CARET_INFO* pInfo = (PWL_CARET_INFO*)wParam) {
1406 if (m_pContents) { 1409 if (m_pContents) {
1407 CPDF_Rect rcClient = m_pContents->GetClientRect(); 1410 CFX_FloatRect rcClient = m_pContents->GetClientRect();
1408 if (pInfo->ptHead.y > rcClient.top) { 1411 if (pInfo->ptHead.y > rcClient.top) {
1409 CPDF_Point pt = m_pContents->OutToIn(pInfo->ptHead); 1412 CFX_FloatPoint pt = m_pContents->OutToIn(pInfo->ptHead);
1410 m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, 1413 m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL,
1411 (intptr_t)&pt.y); 1414 (intptr_t)&pt.y);
1412 1415
1413 CPDF_Point ptScroll = m_pContents->GetScrollPos(); 1416 CFX_FloatPoint ptScroll = m_pContents->GetScrollPos();
1414 m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, 1417 m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL,
1415 (intptr_t)&ptScroll.y); 1418 (intptr_t)&ptScroll.y);
1416 1419
1417 return; 1420 return;
1418 } 1421 }
1419 1422
1420 if (pInfo->ptFoot.y < rcClient.bottom) { 1423 if (pInfo->ptFoot.y < rcClient.bottom) {
1421 CPDF_Point pt = m_pContents->OutToIn(pInfo->ptFoot); 1424 CFX_FloatPoint pt = m_pContents->OutToIn(pInfo->ptFoot);
1422 pt.y += rcClient.Height(); 1425 pt.y += rcClient.Height();
1423 m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, 1426 m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL,
1424 (intptr_t)&pt.y); 1427 (intptr_t)&pt.y);
1425 1428
1426 CPDF_Point ptScroll = m_pContents->GetScrollPos(); 1429 CFX_FloatPoint ptScroll = m_pContents->GetScrollPos();
1427 m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, 1430 m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL,
1428 (intptr_t)&ptScroll.y); 1431 (intptr_t)&ptScroll.y);
1429 1432
1430 return; 1433 return;
1431 } 1434 }
1432 } 1435 }
1433 } 1436 }
1434 } 1437 }
1435 1438
1436 CPWL_NoteItem::OnNotify(pWnd, msg, wParam, lParam); 1439 CPWL_NoteItem::OnNotify(pWnd, msg, wParam, lParam);
(...skipping 14 matching lines...) Expand all
1451 if (m_pAuthor) 1454 if (m_pAuthor)
1452 m_pAuthor->SetTextColor(sTextColor); 1455 m_pAuthor->SetTextColor(sTextColor);
1453 if (m_pOptions) 1456 if (m_pOptions)
1454 m_pOptions->SetTextColor(sTextColor); 1457 m_pOptions->SetTextColor(sTextColor);
1455 if (m_pLBBox) 1458 if (m_pLBBox)
1456 m_pLBBox->SetTextColor(sTextColor); 1459 m_pLBBox->SetTextColor(sTextColor);
1457 if (m_pRBBox) 1460 if (m_pRBBox)
1458 m_pRBBox->SetTextColor(sTextColor); 1461 m_pRBBox->SetTextColor(sTextColor);
1459 } 1462 }
1460 1463
1461 FX_BOOL CPWL_Note::OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) { 1464 FX_BOOL CPWL_Note::OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag) {
1462 if (m_pOptions->WndHitTest(m_pOptions->ParentToChild(point))) { 1465 if (m_pOptions->WndHitTest(m_pOptions->ParentToChild(point))) {
1463 if (IPWL_NoteNotify* pNotify = GetNoteNotify()) { 1466 if (IPWL_NoteNotify* pNotify = GetNoteNotify()) {
1464 int32_t x, y; 1467 int32_t x, y;
1465 PWLtoWnd(point, x, y); 1468 PWLtoWnd(point, x, y);
1466 if (IFX_SystemHandler* pSH = GetSystemHandler()) 1469 if (IFX_SystemHandler* pSH = GetSystemHandler())
1467 pSH->ClientToScreen(GetAttachedHWnd(), x, y); 1470 pSH->ClientToScreen(GetAttachedHWnd(), x, y);
1468 KillFocus(); 1471 KillFocus();
1469 pNotify->OnPopupMenu(x, y); 1472 pNotify->OnPopupMenu(x, y);
1470 1473
1471 return TRUE; 1474 return TRUE;
1472 } 1475 }
1473 } 1476 }
1474 1477
1475 return CPWL_Wnd::OnLButtonDown(point, nFlag); 1478 return CPWL_Wnd::OnLButtonDown(point, nFlag);
1476 } 1479 }
1477 1480
1478 FX_BOOL CPWL_Note::OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { 1481 FX_BOOL CPWL_Note::OnRButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) {
1479 return CPWL_Wnd::OnRButtonUp(point, nFlag); 1482 return CPWL_Wnd::OnRButtonUp(point, nFlag);
1480 } 1483 }
1481 1484
1482 const CPWL_Note* CPWL_Note::GetNote() const { 1485 const CPWL_Note* CPWL_Note::GetNote() const {
1483 return this; 1486 return this;
1484 } 1487 }
1485 1488
1486 IPWL_NoteNotify* CPWL_Note::GetNoteNotify() const { 1489 IPWL_NoteNotify* CPWL_Note::GetNoteNotify() const {
1487 return m_bEnableNotify ? m_pNoteNotify : nullptr; 1490 return m_bEnableNotify ? m_pNoteNotify : nullptr;
1488 } 1491 }
(...skipping 11 matching lines...) Expand all
1500 m_pContents->EnableRead(bEnabled); 1503 m_pContents->EnableRead(bEnabled);
1501 } 1504 }
1502 1505
1503 CFX_WideString CPWL_Note::GetReplyString() const { 1506 CFX_WideString CPWL_Note::GetReplyString() const {
1504 return m_sReplyString; 1507 return m_sReplyString;
1505 } 1508 }
1506 1509
1507 void CPWL_Note::SetReplyString(const CFX_WideString& string) { 1510 void CPWL_Note::SetReplyString(const CFX_WideString& string) {
1508 m_sReplyString = string; 1511 m_sReplyString = string;
1509 } 1512 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698