diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-14 11:52:07 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-14 18:12:34 +0000 |
commit | f528eee136a602643a7777d87a2cce52cf83f38a (patch) | |
tree | 94643b8f0b26a8cd61437db4b9867b9a60a00ef8 /fpdfsdk/fxedit | |
parent | 22da8c268d2228203b40a8c73a2d3f6c25fc9acc (diff) | |
download | pdfium-f528eee136a602643a7777d87a2cce52cf83f38a.tar.xz |
Reland "Convert CFX_FloatPoint to CFX_PointF"
This CL updates the CFX_FloatPoint Cl to accommodate for the Origin CL being
reverted.
Change-Id: I345fe1117938a49ad9ee5f310fe7b5e21d9f1948
Reviewed-on: https://pdfium-review.googlesource.com/2697
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fxedit')
-rw-r--r-- | fpdfsdk/fxedit/fxet_edit.cpp | 94 | ||||
-rw-r--r-- | fpdfsdk/fxedit/fxet_edit.h | 33 | ||||
-rw-r--r-- | fpdfsdk/fxedit/fxet_list.cpp | 36 | ||||
-rw-r--r-- | fpdfsdk/fxedit/fxet_list.h | 56 |
4 files changed, 102 insertions, 117 deletions
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index f71876f26b..5b6fd55685 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -57,7 +57,7 @@ CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap, } void DrawTextString(CFX_RenderDevice* pDevice, - const CFX_FloatPoint& pt, + const CFX_PointF& pt, CPDF_Font* pFont, FX_FLOAT fFontSize, CFX_Matrix* pUser2Device, @@ -78,8 +78,8 @@ void DrawTextString(CFX_RenderDevice* pDevice, ro.m_ColorMode = RENDER_COLOR_NORMAL; if (crTextStroke != 0) { - CFX_FloatPoint pt1; - CFX_FloatPoint pt2; + CFX_PointF pt1; + CFX_PointF pt2; pUser2Device->TransformPoint(pt1.x, pt1.y); pUser2Device->TransformPoint(pt2.x, pt2.y); CFX_GraphStateData gsd; @@ -99,8 +99,8 @@ void DrawTextString(CFX_RenderDevice* pDevice, ro.m_ColorMode = RENDER_COLOR_NORMAL; if (crTextStroke != 0) { - CFX_FloatPoint pt1; - CFX_FloatPoint pt2; + CFX_PointF pt1; + CFX_PointF pt2; pUser2Device->TransformPoint(pt1.x, pt1.y); pUser2Device->TransformPoint(pt2.x, pt2.y); CFX_GraphStateData gsd; @@ -602,7 +602,7 @@ void CFXEU_InsertText::Undo() { // static CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, bool bContinuous, uint16_t SubWord) { @@ -615,8 +615,8 @@ CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit, CFX_ByteTextBuf sEditStream; CFX_ByteTextBuf sWords; int32_t nCurFontIndex = -1; - CFX_FloatPoint ptOld; - CFX_FloatPoint ptNew; + CFX_PointF ptOld; + CFX_PointF ptNew; CPVT_WordPlace oldplace; while (pIterator->NextWord()) { @@ -633,13 +633,13 @@ CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit, CPVT_Word word; if (pIterator->GetWord(word)) { - ptNew = CFX_FloatPoint(word.ptWord.x + ptOffset.x, - word.ptWord.y + ptOffset.y); + ptNew = CFX_PointF(word.ptWord.x + ptOffset.x, + word.ptWord.y + ptOffset.y); } else { CPVT_Line line; pIterator->GetLine(line); - ptNew = CFX_FloatPoint(line.ptLine.x + ptOffset.x, - line.ptLine.y + ptOffset.y); + ptNew = CFX_PointF(line.ptLine.x + ptOffset.x, + line.ptLine.y + ptOffset.y); } if (ptNew.x != ptOld.x || ptNew.y != ptOld.y) { @@ -670,8 +670,8 @@ CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit, } else { CPVT_Word word; if (pIterator->GetWord(word)) { - ptNew = CFX_FloatPoint(word.ptWord.x + ptOffset.x, - word.ptWord.y + ptOffset.y); + ptNew = + CFX_PointF(word.ptWord.x + ptOffset.x, word.ptWord.y + ptOffset.y); if (ptNew.x != ptOld.x || ptNew.y != ptOld.y) { sEditStream << ptNew.x - ptOld.x << " " << ptNew.y - ptOld.y @@ -717,7 +717,7 @@ CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit, // static CFX_ByteString CFX_Edit::GetSelectAppearanceStream( CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange) { if (!pRange || !pRange->IsExist()) return CFX_ByteString(); @@ -750,7 +750,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, FX_COLORREF crTextFill, FX_COLORREF crTextStroke, const CFX_FloatRect& rcClip, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, CFX_SystemHandler* pSystemHandler, CFFL_FormFiller* pFFLData) { @@ -770,7 +770,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CFX_ByteTextBuf sTextBuf; int32_t nFontIndex = -1; - CFX_FloatPoint ptBT; + CFX_PointF ptBT; pDevice->SaveState(); if (!rcClip.IsEmpty()) { CFX_FloatRect rcTemp = rcClip; @@ -828,8 +828,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, crOldFill != crCurFill) { if (sTextBuf.GetLength() > 0) { DrawTextString( - pDevice, - CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), + pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, sTextBuf.MakeString(), crOldFill, crTextStroke, nHorzScale); @@ -845,8 +844,8 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, .AsStringC(); } else { DrawTextString( - pDevice, CFX_FloatPoint(word.ptWord.x + ptOffset.x, - word.ptWord.y + ptOffset.y), + pDevice, CFX_PointF(word.ptWord.x + ptOffset.x, + word.ptWord.y + ptOffset.y), pFontMap->GetPDFFont(word.nFontIndex), fFontSize, pUser2Device, GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord), crCurFill, crTextStroke, nHorzScale); @@ -857,7 +856,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, if (sTextBuf.GetLength() > 0) { DrawTextString( - pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), + pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, sTextBuf.MakeString(), crOldFill, crTextStroke, nHorzScale); } @@ -921,7 +920,7 @@ IPVT_FontMap* CFX_Edit::GetFontMap() { void CFX_Edit::SetPlateRect(const CFX_FloatRect& rect) { m_pVT->SetPlateRect(rect); - m_ptScrollPos = CFX_FloatPoint(rect.left, rect.top); + m_ptScrollPos = CFX_PointF(rect.left, rect.top); Paint(); } @@ -1209,10 +1208,10 @@ CPVT_WordRange CFX_Edit::GetVisibleWordRange() const { if (m_pVT->IsValid()) { CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); - CPVT_WordPlace place1 = m_pVT->SearchWordPlace( - EditToVT(CFX_FloatPoint(rcPlate.left, rcPlate.top))); + CPVT_WordPlace place1 = + m_pVT->SearchWordPlace(EditToVT(CFX_PointF(rcPlate.left, rcPlate.top))); CPVT_WordPlace place2 = m_pVT->SearchWordPlace( - EditToVT(CFX_FloatPoint(rcPlate.right, rcPlate.bottom))); + EditToVT(CFX_PointF(rcPlate.right, rcPlate.bottom))); return CPVT_WordRange(place1, place2); } @@ -1220,7 +1219,7 @@ CPVT_WordRange CFX_Edit::GetVisibleWordRange() const { return CPVT_WordRange(); } -CPVT_WordPlace CFX_Edit::SearchWordPlace(const CFX_FloatPoint& point) const { +CPVT_WordPlace CFX_Edit::SearchWordPlace(const CFX_PointF& point) const { if (m_pVT->IsValid()) { return m_pVT->SearchWordPlace(EditToVT(point)); } @@ -1297,7 +1296,7 @@ bool CFX_Edit::IsSelected() const { return m_SelState.IsExist(); } -CFX_FloatPoint CFX_Edit::VTToEdit(const CFX_FloatPoint& point) const { +CFX_PointF CFX_Edit::VTToEdit(const CFX_PointF& point) const { CFX_FloatRect rcContent = m_pVT->GetContentRect(); CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); @@ -1315,11 +1314,11 @@ CFX_FloatPoint CFX_Edit::VTToEdit(const CFX_FloatPoint& point) const { break; } - return CFX_FloatPoint(point.x - (m_ptScrollPos.x - rcPlate.left), - point.y - (m_ptScrollPos.y + fPadding - rcPlate.top)); + return CFX_PointF(point.x - (m_ptScrollPos.x - rcPlate.left), + point.y - (m_ptScrollPos.y + fPadding - rcPlate.top)); } -CFX_FloatPoint CFX_Edit::EditToVT(const CFX_FloatPoint& point) const { +CFX_PointF CFX_Edit::EditToVT(const CFX_PointF& point) const { CFX_FloatRect rcContent = m_pVT->GetContentRect(); CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); @@ -1337,14 +1336,13 @@ CFX_FloatPoint CFX_Edit::EditToVT(const CFX_FloatPoint& point) const { break; } - return CFX_FloatPoint(point.x + (m_ptScrollPos.x - rcPlate.left), - point.y + (m_ptScrollPos.y + fPadding - rcPlate.top)); + return CFX_PointF(point.x + (m_ptScrollPos.x - rcPlate.left), + point.y + (m_ptScrollPos.y + fPadding - rcPlate.top)); } CFX_FloatRect CFX_Edit::VTToEdit(const CFX_FloatRect& rect) const { - CFX_FloatPoint ptLeftBottom = - VTToEdit(CFX_FloatPoint(rect.left, rect.bottom)); - CFX_FloatPoint ptRightTop = VTToEdit(CFX_FloatPoint(rect.right, rect.top)); + CFX_PointF ptLeftBottom = VTToEdit(CFX_PointF(rect.left, rect.bottom)); + CFX_PointF ptRightTop = VTToEdit(CFX_PointF(rect.right, rect.top)); return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y); @@ -1397,14 +1395,14 @@ void CFX_Edit::SetScrollPosY(FX_FLOAT fy) { } } -void CFX_Edit::SetScrollPos(const CFX_FloatPoint& point) { +void CFX_Edit::SetScrollPos(const CFX_PointF& point) { SetScrollPosX(point.x); SetScrollPosY(point.y); SetScrollLimit(); SetCaretInfo(); } -CFX_FloatPoint CFX_Edit::GetScrollPos() const { +CFX_PointF CFX_Edit::GetScrollPos() const { return m_ptScrollPos; } @@ -1446,8 +1444,8 @@ void CFX_Edit::ScrollToCaret() { CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); pIterator->SetAt(m_wpCaret); - CFX_FloatPoint ptHead; - CFX_FloatPoint ptFoot; + CFX_PointF ptHead; + CFX_PointF ptFoot; CPVT_Word word; CPVT_Line line; if (pIterator->GetWord(word)) { @@ -1462,8 +1460,8 @@ void CFX_Edit::ScrollToCaret() { ptFoot.y = line.ptLine.y + line.fLineDescent; } - CFX_FloatPoint ptHeadEdit = VTToEdit(ptHead); - CFX_FloatPoint ptFootEdit = VTToEdit(ptFoot); + CFX_PointF ptHeadEdit = VTToEdit(ptHead); + CFX_PointF ptFootEdit = VTToEdit(ptFoot); CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); if (!IsFloatEqual(rcPlate.left, rcPlate.right)) { if (IsFloatSmaller(ptHeadEdit.x, rcPlate.left) || @@ -1605,8 +1603,8 @@ void CFX_Edit::SetCaretInfo() { CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); pIterator->SetAt(m_wpCaret); - CFX_FloatPoint ptHead; - CFX_FloatPoint ptFoot; + CFX_PointF ptHead; + CFX_PointF ptFoot; CPVT_Word word; CPVT_Line line; if (pIterator->GetWord(word)) { @@ -1641,9 +1639,7 @@ void CFX_Edit::SetCaret(int32_t nPos) { } } -void CFX_Edit::OnMouseDown(const CFX_FloatPoint& point, - bool bShift, - bool bCtrl) { +void CFX_Edit::OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { SelectNone(); SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); @@ -1655,9 +1651,7 @@ void CFX_Edit::OnMouseDown(const CFX_FloatPoint& point, } } -void CFX_Edit::OnMouseMove(const CFX_FloatPoint& point, - bool bShift, - bool bCtrl) { +void CFX_Edit::OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); diff --git a/fpdfsdk/fxedit/fxet_edit.h b/fpdfsdk/fxedit/fxet_edit.h index 9c3e826ecb..c8caeb9844 100644 --- a/fpdfsdk/fxedit/fxet_edit.h +++ b/fpdfsdk/fxedit/fxet_edit.h @@ -313,21 +313,20 @@ class CFXEU_InsertText : public CFX_Edit_UndoItem { class CFX_Edit { public: static CFX_ByteString GetEditAppearanceStream(CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, bool bContinuous, uint16_t SubWord); - static CFX_ByteString GetSelectAppearanceStream( - CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, - const CPVT_WordRange* pRange); + static CFX_ByteString GetSelectAppearanceStream(CFX_Edit* pEdit, + const CFX_PointF& ptOffset, + const CPVT_WordRange* pRange); static void DrawEdit(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, CFX_Edit* pEdit, FX_COLORREF crTextFill, FX_COLORREF crTextStroke, const CFX_FloatRect& rcClip, - const CFX_FloatPoint& ptOffset, + const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, CFX_SystemHandler* pSystemHandler, CFFL_FormFiller* pFFLData); @@ -346,7 +345,7 @@ class CFX_Edit { // Set the bounding box of the text area. void SetPlateRect(const CFX_FloatRect& rect); - void SetScrollPos(const CFX_FloatPoint& point); + void SetScrollPos(const CFX_PointF& point); // Set the horizontal text alignment. (nFormat [0:left, 1:middle, 2:right]) void SetAlignmentH(int32_t nFormat, bool bPaint); @@ -366,8 +365,8 @@ class CFX_Edit { void SetAutoScroll(bool bAuto, bool bPaint); void SetFontSize(FX_FLOAT fFontSize); void SetTextOverflow(bool bAllowed, bool bPaint); - void OnMouseDown(const CFX_FloatPoint& point, bool bShift, bool bCtrl); - void OnMouseMove(const CFX_FloatPoint& point, bool bShift, bool bCtrl); + void OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl); + void OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl); void OnVK_UP(bool bShift, bool bCtrl); void OnVK_DOWN(bool bShift, bool bCtrl); void OnVK_LEFT(bool bShift, bool bCtrl); @@ -385,14 +384,14 @@ class CFX_Edit { bool Undo(); int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const; CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; - CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; + CPVT_WordPlace SearchWordPlace(const CFX_PointF& point) const; int32_t GetCaret() const; CPVT_WordPlace GetCaretWordPlace() const; CFX_WideString GetSelText() const; CFX_WideString GetText() const; FX_FLOAT GetFontSize() const; uint16_t GetPasswordChar() const; - CFX_FloatPoint GetScrollPos() const; + CFX_PointF GetScrollPos() const; int32_t GetCharArray() const; CFX_FloatRect GetContentRect() const; CFX_WideString GetRangeText(const CPVT_WordRange& range) const; @@ -466,8 +465,8 @@ class CFX_Edit { void PaintInsertText(const CPVT_WordPlace& wpOld, const CPVT_WordPlace& wpNew); - inline CFX_FloatPoint VTToEdit(const CFX_FloatPoint& point) const; - inline CFX_FloatPoint EditToVT(const CFX_FloatPoint& point) const; + inline CFX_PointF VTToEdit(const CFX_PointF& point) const; + inline CFX_PointF EditToVT(const CFX_PointF& point) const; inline CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const; void Refresh(); @@ -484,17 +483,15 @@ class CFX_Edit { CPWL_EditCtrl* m_pNotify; CPWL_Edit* m_pOprNotify; std::unique_ptr<CFX_Edit_Provider> m_pVTProvider; - CPVT_WordPlace m_wpCaret; CPVT_WordPlace m_wpOldCaret; CFX_Edit_Select m_SelState; - - CFX_FloatPoint m_ptScrollPos; - CFX_FloatPoint m_ptRefreshScrollPos; + CFX_PointF m_ptScrollPos; + CFX_PointF m_ptRefreshScrollPos; bool m_bEnableScroll; std::unique_ptr<CFX_Edit_Iterator> m_pIterator; CFX_Edit_Refresh m_Refresh; - CFX_FloatPoint m_ptCaret; + CFX_PointF m_ptCaret; CFX_Edit_Undo m_Undo; int32_t m_nAlignment; bool m_bNotifyFlag; diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp index cf718b9acb..39877c955f 100644 --- a/fpdfsdk/fxedit/fxet_list.cpp +++ b/fpdfsdk/fxedit/fxet_list.cpp @@ -207,37 +207,33 @@ void CFX_ListCtrl::SetNotify(CPWL_List_Notify* pNotify) { m_pNotify = pNotify; } -CFX_FloatPoint CFX_ListCtrl::InToOut(const CFX_FloatPoint& point) const { +CFX_PointF CFX_ListCtrl::InToOut(const CFX_PointF& point) const { CFX_FloatRect rcPlate = GetPlateRect(); - - return CFX_FloatPoint(point.x - (m_ptScrollPos.x - rcPlate.left), - point.y - (m_ptScrollPos.y - rcPlate.top)); + return CFX_PointF(point.x - (m_ptScrollPos.x - rcPlate.left), + point.y - (m_ptScrollPos.y - rcPlate.top)); } -CFX_FloatPoint CFX_ListCtrl::OutToIn(const CFX_FloatPoint& point) const { +CFX_PointF CFX_ListCtrl::OutToIn(const CFX_PointF& point) const { CFX_FloatRect rcPlate = GetPlateRect(); - - return CFX_FloatPoint(point.x + (m_ptScrollPos.x - rcPlate.left), - point.y + (m_ptScrollPos.y - rcPlate.top)); + return CFX_PointF(point.x + (m_ptScrollPos.x - rcPlate.left), + point.y + (m_ptScrollPos.y - rcPlate.top)); } CFX_FloatRect CFX_ListCtrl::InToOut(const CFX_FloatRect& rect) const { - CFX_FloatPoint ptLeftBottom = InToOut(CFX_FloatPoint(rect.left, rect.bottom)); - CFX_FloatPoint ptRightTop = InToOut(CFX_FloatPoint(rect.right, rect.top)); - + CFX_PointF ptLeftBottom = InToOut(CFX_PointF(rect.left, rect.bottom)); + CFX_PointF ptRightTop = InToOut(CFX_PointF(rect.right, rect.top)); return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y); } CFX_FloatRect CFX_ListCtrl::OutToIn(const CFX_FloatRect& rect) const { - CFX_FloatPoint ptLeftBottom = OutToIn(CFX_FloatPoint(rect.left, rect.bottom)); - CFX_FloatPoint ptRightTop = OutToIn(CFX_FloatPoint(rect.right, rect.top)); - + CFX_PointF ptLeftBottom = OutToIn(CFX_PointF(rect.left, rect.bottom)); + CFX_PointF ptRightTop = OutToIn(CFX_PointF(rect.right, rect.top)); return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y); } -void CFX_ListCtrl::OnMouseDown(const CFX_FloatPoint& point, +void CFX_ListCtrl::OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl) { int32_t nHitIndex = GetItemIndex(point); @@ -276,7 +272,7 @@ void CFX_ListCtrl::OnMouseDown(const CFX_FloatPoint& point, ScrollToListItem(nHitIndex); } -void CFX_ListCtrl::OnMouseMove(const CFX_FloatPoint& point, +void CFX_ListCtrl::OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl) { int32_t nHitIndex = GetItemIndex(point); @@ -367,7 +363,7 @@ bool CFX_ListCtrl::OnChar(uint16_t nChar, bool bShift, bool bCtrl) { void CFX_ListCtrl::SetPlateRect(const CFX_FloatRect& rect) { CFX_ListContainer::SetPlateRect(rect); m_ptScrollPos.x = rect.left; - SetScrollPos(CFX_FloatPoint(rect.left, rect.top)); + SetScrollPos(CFX_PointF(rect.left, rect.top)); ReArrange(0); InvalidateItem(-1); } @@ -542,7 +538,7 @@ void CFX_ListCtrl::SetScrollInfo() { } } -void CFX_ListCtrl::SetScrollPos(const CFX_FloatPoint& point) { +void CFX_ListCtrl::SetScrollPos(const CFX_PointF& point) { SetScrollPosY(point.y); } @@ -630,8 +626,8 @@ void CFX_ListCtrl::Cancel() { m_aSelItems.DeselectAll(); } -int32_t CFX_ListCtrl::GetItemIndex(const CFX_FloatPoint& point) const { - CFX_FloatPoint pt = OuterToInner(OutToIn(point)); +int32_t CFX_ListCtrl::GetItemIndex(const CFX_PointF& point) const { + CFX_PointF pt = OuterToInner(OutToIn(point)); bool bFirst = true; bool bLast = true; diff --git a/fpdfsdk/fxedit/fxet_list.h b/fpdfsdk/fxedit/fxet_list.h index 38d1957e00..01e18bc000 100644 --- a/fpdfsdk/fxedit/fxet_list.h +++ b/fpdfsdk/fxedit/fxet_list.h @@ -64,11 +64,11 @@ class CLST_Rect : public CFX_FloatRect { return bottom - top; } - CFX_FloatPoint LeftTop() const { return CFX_FloatPoint(left, top); } + CFX_PointF LeftTop() const { return CFX_PointF(left, top); } - CFX_FloatPoint RightBottom() const { return CFX_FloatPoint(right, bottom); } + CFX_PointF RightBottom() const { return CFX_PointF(right, bottom); } - const CLST_Rect operator+=(const CFX_FloatPoint& point) { + const CLST_Rect operator+=(const CFX_PointF& point) { left += point.x; right += point.x; top += point.y; @@ -77,7 +77,7 @@ class CLST_Rect : public CFX_FloatRect { return *this; } - const CLST_Rect operator-=(const CFX_FloatPoint& point) { + const CLST_Rect operator-=(const CFX_PointF& point) { left -= point.x; right -= point.x; top -= point.y; @@ -86,12 +86,12 @@ class CLST_Rect : public CFX_FloatRect { return *this; } - CLST_Rect operator+(const CFX_FloatPoint& point) const { + CLST_Rect operator+(const CFX_PointF& point) const { return CLST_Rect(left + point.x, top + point.y, right + point.x, bottom + point.y); } - CLST_Rect operator-(const CFX_FloatPoint& point) const { + CLST_Rect operator-(const CFX_PointF& point) const { return CLST_Rect(left - point.x, top - point.y, right - point.x, bottom - point.y); } @@ -134,33 +134,31 @@ class CFX_ListContainer { CFX_FloatRect GetPlateRect() const { return m_rcPlate; } void SetContentRect(const CLST_Rect& rect) { m_rcContent = rect; } CLST_Rect GetContentRect() const { return m_rcContent; } - CFX_FloatPoint GetBTPoint() const { - return CFX_FloatPoint(m_rcPlate.left, m_rcPlate.top); + CFX_PointF GetBTPoint() const { + return CFX_PointF(m_rcPlate.left, m_rcPlate.top); } - CFX_FloatPoint GetETPoint() const { - return CFX_FloatPoint(m_rcPlate.right, m_rcPlate.bottom); + CFX_PointF GetETPoint() const { + return CFX_PointF(m_rcPlate.right, m_rcPlate.bottom); } public: - CFX_FloatPoint InnerToOuter(const CFX_FloatPoint& point) const { - return CFX_FloatPoint(point.x + GetBTPoint().x, GetBTPoint().y - point.y); + CFX_PointF InnerToOuter(const CFX_PointF& point) const { + return CFX_PointF(point.x + GetBTPoint().x, GetBTPoint().y - point.y); } - CFX_FloatPoint OuterToInner(const CFX_FloatPoint& point) const { - return CFX_FloatPoint(point.x - GetBTPoint().x, GetBTPoint().y - point.y); + CFX_PointF OuterToInner(const CFX_PointF& point) const { + return CFX_PointF(point.x - GetBTPoint().x, GetBTPoint().y - point.y); } CFX_FloatRect InnerToOuter(const CLST_Rect& rect) const { - CFX_FloatPoint ptLeftTop = - InnerToOuter(CFX_FloatPoint(rect.left, rect.top)); - CFX_FloatPoint ptRightBottom = - InnerToOuter(CFX_FloatPoint(rect.right, rect.bottom)); + CFX_PointF ptLeftTop = InnerToOuter(CFX_PointF(rect.left, rect.top)); + CFX_PointF ptRightBottom = + InnerToOuter(CFX_PointF(rect.right, rect.bottom)); return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, ptLeftTop.y); } CLST_Rect OuterToInner(const CFX_FloatRect& rect) const { - CFX_FloatPoint ptLeftTop = - OuterToInner(CFX_FloatPoint(rect.left, rect.top)); - CFX_FloatPoint ptRightBottom = - OuterToInner(CFX_FloatPoint(rect.right, rect.bottom)); + CFX_PointF ptLeftTop = OuterToInner(CFX_PointF(rect.left, rect.top)); + CFX_PointF ptRightBottom = + OuterToInner(CFX_PointF(rect.right, rect.bottom)); return CLST_Rect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, ptRightBottom.y); } @@ -226,8 +224,8 @@ class CFX_ListCtrl : protected CFX_ListContainer { void SetPlateRect(const CFX_FloatRect& rect) override; void SetNotify(CPWL_List_Notify* pNotify); - void OnMouseDown(const CFX_FloatPoint& point, bool bShift, bool bCtrl); - void OnMouseMove(const CFX_FloatPoint& point, bool bShift, bool bCtrl); + void OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl); + void OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl); void OnVK_UP(bool bShift, bool bCtrl); void OnVK_DOWN(bool bShift, bool bCtrl); void OnVK_LEFT(bool bShift, bool bCtrl); @@ -237,14 +235,14 @@ class CFX_ListCtrl : protected CFX_ListContainer { void OnVK(int32_t nItemIndex, bool bShift, bool bCtrl); bool OnChar(uint16_t nChar, bool bShift, bool bCtrl); - void SetScrollPos(const CFX_FloatPoint& point); + void SetScrollPos(const CFX_PointF& point); void ScrollToListItem(int32_t nItemIndex); CFX_FloatRect GetItemRect(int32_t nIndex) const; int32_t GetCaret() const; int32_t GetSelect() const; int32_t GetTopItem() const; CFX_FloatRect GetContentRect() const; - int32_t GetItemIndex(const CFX_FloatPoint& point) const; + int32_t GetItemIndex(const CFX_PointF& point) const; void AddString(const CFX_WideString& str); void SetTopItem(int32_t nIndex); void Select(int32_t nItemIndex); @@ -267,8 +265,8 @@ class CFX_ListCtrl : protected CFX_ListContainer { int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const; int32_t GetFirstSelected() const; - CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const; - CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const; + CFX_PointF InToOut(const CFX_PointF& point) const; + CFX_PointF OutToIn(const CFX_PointF& point) const; CFX_FloatRect InToOut(const CFX_FloatRect& rect) const; CFX_FloatRect OutToIn(const CFX_FloatRect& rect) const; @@ -291,7 +289,7 @@ class CFX_ListCtrl : protected CFX_ListContainer { CPWL_List_Notify* m_pNotify; bool m_bNotifyFlag; - CFX_FloatPoint m_ptScrollPos; + CFX_PointF m_ptScrollPos; CPLST_Select m_aSelItems; // for multiple int32_t m_nSelItem; // for single int32_t m_nFootIndex; // for multiple |