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

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

Issue 1547843003: Merge to XFA: Cleanup: Remove some dead code in CPWL_Note. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 12 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/include/pdfwindow/PWL_Note.h ('k') | no next file » | 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/PDFWindow.h" 7 #include "fpdfsdk/include/pdfwindow/PDFWindow.h"
8 #include "fpdfsdk/include/pdfwindow/PWL_Button.h" 8 #include "fpdfsdk/include/pdfwindow/PWL_Button.h"
9 #include "fpdfsdk/include/pdfwindow/PWL_Caret.h" 9 #include "fpdfsdk/include/pdfwindow/PWL_Caret.h"
10 #include "fpdfsdk/include/pdfwindow/PWL_Edit.h" 10 #include "fpdfsdk/include/pdfwindow/PWL_Edit.h"
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 IPWL_NoteHandler* pNoteHandler) 1052 IPWL_NoteHandler* pNoteHandler)
1053 : m_pAuthor(NULL), 1053 : m_pAuthor(NULL),
1054 m_pIcon(NULL), 1054 m_pIcon(NULL),
1055 m_pCloseBox(NULL), 1055 m_pCloseBox(NULL),
1056 m_pLBBox(NULL), 1056 m_pLBBox(NULL),
1057 m_pRBBox(NULL), 1057 m_pRBBox(NULL),
1058 m_pContentsBar(NULL), 1058 m_pContentsBar(NULL),
1059 m_pOptions(NULL), 1059 m_pOptions(NULL),
1060 m_pNoteNotify(pNoteNotify), 1060 m_pNoteNotify(pNoteNotify),
1061 m_bResizing(FALSE), 1061 m_bResizing(FALSE),
1062 m_rcCaption(0, 0, 0, 0), 1062 m_bEnableNotify(TRUE) {}
1063 m_bEnalbleNotify(TRUE),
1064 m_pPopupNote(pPopupNote) {}
1065 1063
1066 CPWL_Note::~CPWL_Note() {} 1064 CPWL_Note::~CPWL_Note() {}
1067 1065
1068 IPWL_NoteItem* CPWL_Note::Reply() { 1066 IPWL_NoteItem* CPWL_Note::Reply() {
1069 return CreateNoteItem(); 1067 return CreateNoteItem();
1070 } 1068 }
1071 1069
1072 void CPWL_Note::EnableNotify(FX_BOOL bEnabled) { 1070 void CPWL_Note::EnableNotify(FX_BOOL bEnabled) {
1073 m_bEnalbleNotify = bEnabled; 1071 m_bEnableNotify = bEnabled;
1074 } 1072 }
1075 1073
1076 void CPWL_Note::RePosChildWnd() { 1074 void CPWL_Note::RePosChildWnd() {
1077 RePosNoteChildren(); 1075 RePosNoteChildren();
1078 m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0); 1076 m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0);
1079 ResetScrollBar(); 1077 ResetScrollBar();
1080 m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0); 1078 m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0);
1081 OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); 1079 OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0);
1082 if (const CPWL_Wnd* pWnd = GetFocused()) { 1080 if (const CPWL_Wnd* pWnd = GetFocused()) {
1083 if (pWnd->GetClassName() == "CPWL_Edit") { 1081 if (pWnd->GetClassName() == "CPWL_Edit") {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 rcContents.bottom += 14.0f; 1225 rcContents.bottom += 14.0f;
1228 rcContents.Normalize(); 1226 rcContents.Normalize();
1229 m_pContents->Move(rcContents, FALSE, FALSE); 1227 m_pContents->Move(rcContents, FALSE, FALSE);
1230 m_pContents->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcContents)); 1228 m_pContents->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcContents));
1231 1229
1232 CPDF_Rect rcContentsBar = rcContents; 1230 CPDF_Rect rcContentsBar = rcContents;
1233 rcContentsBar.right = rcClient.right - 3.0f; 1231 rcContentsBar.right = rcClient.right - 3.0f;
1234 rcContentsBar.left = rcContentsBar.right - PWL_SCROLLBAR_WIDTH; 1232 rcContentsBar.left = rcContentsBar.right - PWL_SCROLLBAR_WIDTH;
1235 rcContentsBar.Normalize(); 1233 rcContentsBar.Normalize();
1236 m_pContentsBar->Move(rcContentsBar, TRUE, FALSE); 1234 m_pContentsBar->Move(rcContentsBar, TRUE, FALSE);
1237
1238 m_rcCaption = rcClient;
1239 m_rcCaption.bottom = rcContents.top;
1240 } 1235 }
1241 1236
1242 m_bResizing = FALSE; 1237 m_bResizing = FALSE;
1243 } 1238 }
1244 1239
1245 // TODO(thestig): Make this return an enum.
1246 // 0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close /
1247 // 5-options
1248 int32_t CPWL_Note::NoteHitTest(const CPDF_Point& point) const {
1249 GetClientRect();
1250
1251 if (m_pSubject->WndHitTest(m_pSubject->ParentToChild(point)))
1252 return 1;
1253 if (m_pDateTime->WndHitTest(m_pDateTime->ParentToChild(point)))
1254 return 1;
1255 if (m_pAuthor->WndHitTest(m_pAuthor->ParentToChild(point)))
1256 return 1;
1257 if (m_pIcon->WndHitTest(m_pIcon->ParentToChild(point)))
1258 return 1;
1259
1260 if (m_pContents->WndHitTest(m_pContents->ParentToChild(point)))
1261 return 0;
1262 if (m_pContentsBar->WndHitTest(m_pContentsBar->ParentToChild(point)))
1263 return 0;
1264
1265 if (m_pCloseBox->WndHitTest(m_pCloseBox->ParentToChild(point)))
1266 return 4;
1267 if (m_pLBBox->WndHitTest(m_pLBBox->ParentToChild(point)))
1268 return 2;
1269 if (m_pRBBox->WndHitTest(m_pRBBox->ParentToChild(point)))
1270 return 3;
1271 if (m_pOptions->WndHitTest(m_pOptions->ParentToChild(point)))
1272 return 5;
1273
1274 return 1;
1275 }
1276
1277 void CPWL_Note::CreateChildWnd(const PWL_CREATEPARAM& cp) { 1240 void CPWL_Note::CreateChildWnd(const PWL_CREATEPARAM& cp) {
1278 CPWL_NoteItem::CreateChildWnd(cp); 1241 CPWL_NoteItem::CreateChildWnd(cp);
1279 1242
1280 CPWL_Color sTextColor; 1243 CPWL_Color sTextColor;
1281 1244
1282 if (CPWL_Utils::IsBlackOrWhite(GetBackgroundColor())) 1245 if (CPWL_Utils::IsBlackOrWhite(GetBackgroundColor()))
1283 sTextColor = PWL_DEFAULT_WHITECOLOR; 1246 sTextColor = PWL_DEFAULT_WHITECOLOR;
1284 else 1247 else
1285 sTextColor = PWL_DEFAULT_BLACKCOLOR; 1248 sTextColor = PWL_DEFAULT_BLACKCOLOR;
1286 1249
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 1507
1545 FX_BOOL CPWL_Note::OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { 1508 FX_BOOL CPWL_Note::OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag) {
1546 return CPWL_Wnd::OnRButtonUp(point, nFlag); 1509 return CPWL_Wnd::OnRButtonUp(point, nFlag);
1547 } 1510 }
1548 1511
1549 const CPWL_Note* CPWL_Note::GetNote() const { 1512 const CPWL_Note* CPWL_Note::GetNote() const {
1550 return this; 1513 return this;
1551 } 1514 }
1552 1515
1553 IPWL_NoteNotify* CPWL_Note::GetNoteNotify() const { 1516 IPWL_NoteNotify* CPWL_Note::GetNoteNotify() const {
1554 if (m_bEnalbleNotify) 1517 return m_bEnableNotify ? m_pNoteNotify : nullptr;
1555 return m_pNoteNotify;
1556
1557 return NULL;
1558 } 1518 }
1559 1519
1560 void CPWL_Note::SetIconType(int32_t nType) { 1520 void CPWL_Note::SetIconType(int32_t nType) {
1561 if (m_pIcon) 1521 if (m_pIcon)
1562 m_pIcon->SetIconType(nType); 1522 m_pIcon->SetIconType(nType);
1563 } 1523 }
1564 1524
1565 void CPWL_Note::EnableModify(FX_BOOL bEnabled) { 1525 void CPWL_Note::EnableModify(FX_BOOL bEnabled) {
1566 m_pContents->EnableModify(bEnabled); 1526 m_pContents->EnableModify(bEnabled);
1567 } 1527 }
1568 1528
1569 void CPWL_Note::EnableRead(FX_BOOL bEnabled) { 1529 void CPWL_Note::EnableRead(FX_BOOL bEnabled) {
1570 m_pContents->EnableRead(bEnabled); 1530 m_pContents->EnableRead(bEnabled);
1571 } 1531 }
1572 1532
1573 CFX_WideString CPWL_Note::GetReplyString() const { 1533 CFX_WideString CPWL_Note::GetReplyString() const {
1574 return m_sReplyString; 1534 return m_sReplyString;
1575 } 1535 }
1576 1536
1577 void CPWL_Note::SetReplyString(const CFX_WideString& string) { 1537 void CPWL_Note::SetReplyString(const CFX_WideString& string) {
1578 m_sReplyString = string; 1538 m_sReplyString = string;
1579 } 1539 }
OLDNEW
« no previous file with comments | « fpdfsdk/include/pdfwindow/PWL_Note.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698