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