diff options
Diffstat (limited to 'fpdfsdk/pdfwindow')
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Button.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Button.h | 4 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Caret.cpp | 16 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Caret.h | 18 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ComboBox.cpp | 34 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ComboBox.h | 6 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Edit.cpp | 37 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Edit.h | 23 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_EditCtrl.cpp | 40 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_EditCtrl.h | 20 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ListBox.cpp | 14 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ListBox.h | 12 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ScrollBar.cpp | 172 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ScrollBar.h | 28 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_SpecialButton.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_SpecialButton.h | 4 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Utils.cpp | 68 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Utils.h | 22 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Wnd.cpp | 29 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Wnd.h | 32 |
20 files changed, 302 insertions, 286 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_Button.cpp b/fpdfsdk/pdfwindow/PWL_Button.cpp index 96be469454..972e55edad 100644 --- a/fpdfsdk/pdfwindow/PWL_Button.cpp +++ b/fpdfsdk/pdfwindow/PWL_Button.cpp @@ -20,7 +20,7 @@ void CPWL_Button::OnCreate(PWL_CREATEPARAM& cp) { cp.eCursorType = FXCT_HAND; } -bool CPWL_Button::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_Button::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); m_bMouseDown = true; @@ -29,7 +29,7 @@ bool CPWL_Button::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_Button::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_Button::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); ReleaseCapture(); diff --git a/fpdfsdk/pdfwindow/PWL_Button.h b/fpdfsdk/pdfwindow/PWL_Button.h index 2d1193f89d..f35e9adf36 100644 --- a/fpdfsdk/pdfwindow/PWL_Button.h +++ b/fpdfsdk/pdfwindow/PWL_Button.h @@ -17,8 +17,8 @@ class CPWL_Button : public CPWL_Wnd { // CPWL_Wnd CFX_ByteString GetClassName() const override; void OnCreate(PWL_CREATEPARAM& cp) override; - bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; protected: bool m_bMouseDown; diff --git a/fpdfsdk/pdfwindow/PWL_Caret.cpp b/fpdfsdk/pdfwindow/PWL_Caret.cpp index 06c8e31ce7..6636170e81 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.cpp +++ b/fpdfsdk/pdfwindow/PWL_Caret.cpp @@ -14,8 +14,6 @@ #define PWL_CARET_FLASHINTERVAL 500 -PWL_CARET_INFO::PWL_CARET_INFO() : bVisible(false) {} - CPWL_Caret::CPWL_Caret() : m_bFlash(false), m_fWidth(0.4f), m_nDelay(0) {} CPWL_Caret::~CPWL_Caret() {} @@ -25,7 +23,7 @@ CFX_ByteString CPWL_Caret::GetClassName() const { } void CPWL_Caret::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { - GetCaretApp(sAppStream, CFX_PointF()); + GetCaretApp(sAppStream, CFX_FloatPoint(0.0f, 0.0f)); } void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice, @@ -62,7 +60,7 @@ void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice, } void CPWL_Caret::GetCaretApp(CFX_ByteTextBuf& sAppStream, - const CFX_PointF& ptOffset) { + const CFX_FloatPoint& ptOffset) { if (IsVisible() && m_bFlash) { CFX_ByteTextBuf sCaret; @@ -87,7 +85,7 @@ void CPWL_Caret::GetCaretApp(CFX_ByteTextBuf& sAppStream, } CFX_ByteString CPWL_Caret::GetCaretAppearanceStream( - const CFX_PointF& ptOffset) { + const CFX_FloatPoint& ptOffset) { CFX_ByteTextBuf sCaret; GetCaretApp(sCaret, ptOffset); return sCaret.MakeString(); @@ -108,8 +106,8 @@ CFX_FloatRect CPWL_Caret::GetCaretRect() const { } void CPWL_Caret::SetCaret(bool bVisible, - const CFX_PointF& ptHead, - const CFX_PointF& ptFoot) { + const CFX_FloatPoint& ptHead, + const CFX_FloatPoint& ptFoot) { if (bVisible) { if (IsVisible()) { if (m_ptHead != ptHead || m_ptFoot != ptFoot) { @@ -128,8 +126,8 @@ void CPWL_Caret::SetCaret(bool bVisible, Move(m_rcInvalid, false, true); } } else { - m_ptHead = CFX_PointF(); - m_ptFoot = CFX_PointF(); + m_ptHead = CFX_FloatPoint(); + m_ptFoot = CFX_FloatPoint(); m_bFlash = false; if (IsVisible()) { EndTimer(); diff --git a/fpdfsdk/pdfwindow/PWL_Caret.h b/fpdfsdk/pdfwindow/PWL_Caret.h index 60ebbdc8e1..ccee96109e 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.h +++ b/fpdfsdk/pdfwindow/PWL_Caret.h @@ -11,11 +11,11 @@ struct PWL_CARET_INFO { public: - PWL_CARET_INFO(); + PWL_CARET_INFO() : bVisible(false) {} bool bVisible; - CFX_PointF ptHead; - CFX_PointF ptFoot; + CFX_FloatPoint ptHead; + CFX_FloatPoint ptFoot; }; class CPWL_Caret : public CPWL_Wnd { @@ -33,18 +33,18 @@ class CPWL_Caret : public CPWL_Wnd { void TimerProc() override; void SetCaret(bool bVisible, - const CFX_PointF& ptHead, - const CFX_PointF& ptFoot); - CFX_ByteString GetCaretAppearanceStream(const CFX_PointF& ptOffset); + const CFX_FloatPoint& ptHead, + const CFX_FloatPoint& ptFoot); + CFX_ByteString GetCaretAppearanceStream(const CFX_FloatPoint& ptOffset); void SetInvalidRect(CFX_FloatRect rc) { m_rcInvalid = rc; } private: - void GetCaretApp(CFX_ByteTextBuf& sAppStream, const CFX_PointF& ptOffset); + void GetCaretApp(CFX_ByteTextBuf& sAppStream, const CFX_FloatPoint& ptOffset); CFX_FloatRect GetCaretRect() const; bool m_bFlash; - CFX_PointF m_ptHead; - CFX_PointF m_ptFoot; + CFX_FloatPoint m_ptHead; + CFX_FloatPoint m_ptFoot; FX_FLOAT m_fWidth; int32_t m_nDelay; CFX_FloatRect m_rcInvalid; diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp index 1bf1adfbcf..acee850024 100644 --- a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp @@ -18,7 +18,7 @@ #define PWLCB_DEFAULTFONTSIZE 12.0f -bool CPWL_CBListBox::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_CBListBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (!m_bMouseDown) @@ -102,14 +102,14 @@ void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (IsVisible() && !rectWnd.IsEmpty()) { CFX_ByteTextBuf sButton; - CFX_PointF ptCenter = GetCenterPoint(); + CFX_FloatPoint ptCenter = GetCenterPoint(); - CFX_PointF pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, - ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); - CFX_PointF pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, - ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); - CFX_PointF pt3(ptCenter.x, - ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_FloatPoint pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, + ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_FloatPoint pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, + ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_FloatPoint pt3(ptCenter.x, + ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); if (IsFloatBigger(rectWnd.right - rectWnd.left, PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) && @@ -133,14 +133,14 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_FloatRect rectWnd = CPWL_Wnd::GetWindowRect(); if (IsVisible() && !rectWnd.IsEmpty()) { - CFX_PointF ptCenter = GetCenterPoint(); + CFX_FloatPoint ptCenter = GetCenterPoint(); - CFX_PointF pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, - ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); - CFX_PointF pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, - ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); - CFX_PointF pt3(ptCenter.x, - ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_FloatPoint pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN, + ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_FloatPoint pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN, + ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); + CFX_FloatPoint pt3(ptCenter.x, + ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); if (IsFloatBigger(rectWnd.right - rectWnd.left, PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) && @@ -162,7 +162,7 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } -bool CPWL_CBButton::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_CBButton::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); SetCapture(); @@ -175,7 +175,7 @@ bool CPWL_CBButton::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_CBButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_CBButton::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); ReleaseCapture(); diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.h b/fpdfsdk/pdfwindow/PWL_ComboBox.h index e1a8df7561..84261199e9 100644 --- a/fpdfsdk/pdfwindow/PWL_ComboBox.h +++ b/fpdfsdk/pdfwindow/PWL_ComboBox.h @@ -23,7 +23,7 @@ class CPWL_CBListBox : public CPWL_ListBox { ~CPWL_CBListBox() override {} // CPWL_ListBox - bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; bool OnKeyDownWithExit(uint16_t nChar, bool& bExit, uint32_t nFlag); bool OnCharWithExit(uint16_t nChar, bool& bExit, uint32_t nFlag); @@ -40,8 +40,8 @@ class CPWL_CBButton : public CPWL_Wnd { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; }; class CPWL_ComboBox : public CPWL_Wnd { diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index 8b46d22f13..b9958a3128 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -243,7 +243,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { sAppStream << sLine; CFX_ByteTextBuf sText; - CFX_PointF ptOffset; + CFX_FloatPoint ptOffset = CFX_FloatPoint(); CPVT_WordRange wrWhole = m_pEdit->GetWholeWordRange(); CPVT_WordRange wrSelect = GetSelectWordRange(); CPVT_WordRange wrVisible = @@ -395,10 +395,10 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, pDevice, pUser2Device, m_pEdit.get(), CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), - rcClip, CFX_PointF(), pRange, pSysHandler, m_pFormFiller); + rcClip, CFX_FloatPoint(), pRange, pSysHandler, m_pFormFiller); } -bool CPWL_Edit::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_Edit::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { @@ -414,7 +414,7 @@ bool CPWL_Edit::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_Edit::OnLButtonDblClk(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_Edit::OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDblClk(point, nFlag); if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { @@ -424,7 +424,7 @@ bool CPWL_Edit::OnLButtonDblClk(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_Edit::OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { if (m_bMouseDown) return false; @@ -454,7 +454,7 @@ void CPWL_Edit::OnSetFocus() { void CPWL_Edit::OnKillFocus() { ShowVScrollBar(false); m_pEdit->SelectNone(); - SetCaret(false, CFX_PointF(), CFX_PointF()); + SetCaret(false, CFX_FloatPoint(), CFX_FloatPoint()); SetCharSet(FXFONT_ANSI_CHARSET); m_bFocus = false; } @@ -464,7 +464,7 @@ void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace) { } CFX_ByteString CPWL_Edit::GetSelectAppearanceStream( - const CFX_PointF& ptOffset) const { + const CFX_FloatPoint& ptOffset) const { CPVT_WordRange wr = GetSelectWordRange(); return CPWL_Utils::GetEditSelAppStream(m_pEdit.get(), ptOffset, &wr); } @@ -486,7 +486,7 @@ CPVT_WordRange CPWL_Edit::GetSelectWordRange() const { } CFX_ByteString CPWL_Edit::GetTextAppearanceStream( - const CFX_PointF& ptOffset) const { + const CFX_FloatPoint& ptOffset) const { CFX_ByteTextBuf sRet; CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit.get(), ptOffset); if (sEdit.GetLength() > 0) { @@ -497,22 +497,24 @@ CFX_ByteString CPWL_Edit::GetTextAppearanceStream( } CFX_ByteString CPWL_Edit::GetCaretAppearanceStream( - const CFX_PointF& ptOffset) const { + const CFX_FloatPoint& ptOffset) const { if (m_pEditCaret) return m_pEditCaret->GetCaretAppearanceStream(ptOffset); return CFX_ByteString(); } -CFX_PointF CPWL_Edit::GetWordRightBottomPoint(const CPVT_WordPlace& wpWord) { +CFX_FloatPoint CPWL_Edit::GetWordRightBottomPoint( + const CPVT_WordPlace& wpWord) { CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); CPVT_WordPlace wpOld = pIterator->GetAt(); pIterator->SetAt(wpWord); - CFX_PointF pt; + CFX_FloatPoint pt; CPVT_Word word; if (pIterator->GetWord(word)) { - pt = CFX_PointF(word.ptWord.x + word.fWidth, word.ptWord.y + word.fDescent); + pt = CFX_FloatPoint(word.ptWord.x + word.fWidth, + word.ptWord.y + word.fDescent); } pIterator->SetAt(wpOld); return pt; @@ -718,10 +720,10 @@ bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { } bool CPWL_Edit::OnMouseWheel(short zDelta, - const CFX_PointF& point, + const CFX_FloatPoint& point, uint32_t nFlag) { if (HasFlag(PES_MULTILINE)) { - CFX_PointF ptScroll = GetScrollPos(); + CFX_FloatPoint ptScroll = GetScrollPos(); if (zDelta > 0) { ptScroll.y += GetFontSize(); @@ -803,7 +805,8 @@ CPVT_WordRange CPWL_Edit::CombineWordRange(const CPVT_WordRange& wr1, return wrRet; } -CPVT_WordRange CPWL_Edit::GetLatinWordsRange(const CFX_PointF& point) const { +CPVT_WordRange CPWL_Edit::GetLatinWordsRange( + const CFX_FloatPoint& point) const { return GetSameWordsRange(m_pEdit->SearchWordPlace(point), true, false); } @@ -873,7 +876,7 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place, } void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_PointF& ptOffset, + const CFX_FloatPoint& ptOffset, std::vector<CPDF_TextObject*>* ObjArray) { CFX_Edit::GeneratePageObjects( pObjectHolder, m_pEdit.get(), ptOffset, nullptr, @@ -882,7 +885,7 @@ void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, } void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_PointF& ptOffset) { + const CFX_FloatPoint& ptOffset) { std::vector<CPDF_TextObject*> ObjArray; CFX_Edit::GeneratePageObjects( pObjectHolder, m_pEdit.get(), ptOffset, nullptr, diff --git a/fpdfsdk/pdfwindow/PWL_Edit.h b/fpdfsdk/pdfwindow/PWL_Edit.h index 5143c97424..801dedd0ac 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.h +++ b/fpdfsdk/pdfwindow/PWL_Edit.h @@ -60,11 +60,11 @@ class CPWL_Edit : public CPWL_EditCtrl { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; - bool OnLButtonDblClk(const CFX_PointF& point, uint32_t nFlag) override; - bool OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; bool OnMouseWheel(short zDelta, - const CFX_PointF& point, + const CFX_FloatPoint& point, uint32_t nFlag) override; bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; @@ -90,9 +90,10 @@ class CPWL_Edit : public CPWL_EditCtrl { void SetText(const CFX_WideString& csText); void ReplaceSel(const CFX_WideString& csText); - CFX_ByteString GetTextAppearanceStream(const CFX_PointF& ptOffset) const; - CFX_ByteString GetCaretAppearanceStream(const CFX_PointF& ptOffset) const; - CFX_ByteString GetSelectAppearanceStream(const CFX_PointF& ptOffset) const; + CFX_ByteString GetTextAppearanceStream(const CFX_FloatPoint& ptOffset) const; + CFX_ByteString GetCaretAppearanceStream(const CFX_FloatPoint& ptOffset) const; + CFX_ByteString GetSelectAppearanceStream( + const CFX_FloatPoint& ptOffset) const; bool IsTextFull() const; @@ -105,10 +106,10 @@ class CPWL_Edit : public CPWL_EditCtrl { } void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_PointF& ptOffset, + const CFX_FloatPoint& ptOffset, std::vector<CPDF_TextObject*>* ObjArray); void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, - const CFX_PointF& ptOffset); + const CFX_FloatPoint& ptOffset); bool IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag); void AttachFFLData(CFFL_FormFiller* pData) { m_pFormFiller = pData; } @@ -130,11 +131,11 @@ class CPWL_Edit : public CPWL_EditCtrl { void SetParamByFlag(); FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray); - CFX_PointF GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); + CFX_FloatPoint GetWordRightBottomPoint(const CPVT_WordPlace& wpWord); CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2); - CPVT_WordRange GetLatinWordsRange(const CFX_PointF& point) const; + CPVT_WordRange GetLatinWordsRange(const CFX_FloatPoint& point) const; CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const; CPVT_WordRange GetArabicWordsRange(const CPVT_WordPlace& place) const; CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace& place, diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp index 64272e34c5..90b7a3c7c0 100644 --- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp +++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp @@ -40,8 +40,8 @@ void CPWL_EditCtrl::OnCreated() { bool CPWL_EditCtrl::IsWndHorV() { CFX_Matrix mt = GetWindowMatrix(); - CFX_PointF point1(0, 1); - CFX_PointF point2(1, 1); + CFX_FloatPoint point1(0, 1); + CFX_FloatPoint point2(1, 1); mt.TransformPoint(point1.x, point1.y); mt.TransformPoint(point2.x, point2.y); @@ -93,7 +93,8 @@ void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd, FX_FLOAT fPos = *(FX_FLOAT*)lParam; switch (wParam) { case SBT_VSCROLL: - m_pEdit->SetScrollPos(CFX_PointF(m_pEdit->GetScrollPos().x, fPos)); + m_pEdit->SetScrollPos( + CFX_FloatPoint(m_pEdit->GetScrollPos().x, fPos)); break; } } break; @@ -280,7 +281,7 @@ bool CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { return true; } -bool CPWL_EditCtrl::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_EditCtrl::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (ClientHitTest(point)) { @@ -296,7 +297,7 @@ bool CPWL_EditCtrl::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_EditCtrl::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_EditCtrl::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (m_bMouseDown) { @@ -311,7 +312,7 @@ bool CPWL_EditCtrl::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_EditCtrl::OnMouseMove(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_EditCtrl::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnMouseMove(point, nFlag); if (m_bMouseDown) @@ -325,8 +326,8 @@ CFX_FloatRect CPWL_EditCtrl::GetContentRect() const { } void CPWL_EditCtrl::SetEditCaret(bool bVisible) { - CFX_PointF ptHead; - CFX_PointF ptFoot; + CFX_FloatPoint ptHead; + CFX_FloatPoint ptFoot; if (bVisible) GetCaretInfo(ptHead, ptFoot); @@ -334,7 +335,8 @@ void CPWL_EditCtrl::SetEditCaret(bool bVisible) { IOnSetCaret(bVisible, ptHead, ptFoot, wpTemp); } -void CPWL_EditCtrl::GetCaretInfo(CFX_PointF& ptHead, CFX_PointF& ptFoot) const { +void CPWL_EditCtrl::GetCaretInfo(CFX_FloatPoint& ptHead, + CFX_FloatPoint& ptFoot) const { CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); pIterator->SetAt(m_pEdit->GetCaret()); CPVT_Word word; @@ -353,15 +355,15 @@ void CPWL_EditCtrl::GetCaretInfo(CFX_PointF& ptHead, CFX_PointF& ptFoot) const { } void CPWL_EditCtrl::GetCaretPos(int32_t& x, int32_t& y) const { - CFX_PointF ptHead; - CFX_PointF ptFoot; + CFX_FloatPoint ptHead; + CFX_FloatPoint ptFoot; GetCaretInfo(ptHead, ptFoot); PWLtoWnd(ptHead, x, y); } void CPWL_EditCtrl::SetCaret(bool bVisible, - const CFX_PointF& ptHead, - const CFX_PointF& ptFoot) { + const CFX_FloatPoint& ptHead, + const CFX_FloatPoint& ptFoot) { if (m_pEditCaret) { if (!IsFocused() || m_pEdit->IsSelected()) bVisible = false; @@ -411,11 +413,11 @@ int32_t CPWL_EditCtrl::GetTotalWords() const { return m_pEdit->GetTotalWords(); } -void CPWL_EditCtrl::SetScrollPos(const CFX_PointF& point) { +void CPWL_EditCtrl::SetScrollPos(const CFX_FloatPoint& point) { m_pEdit->SetScrollPos(point); } -CFX_PointF CPWL_EditCtrl::GetScrollPos() const { +CFX_FloatPoint CPWL_EditCtrl::GetScrollPos() const { return m_pEdit->GetScrollPos(); } @@ -542,8 +544,8 @@ void CPWL_EditCtrl::IOnSetScrollPosY(FX_FLOAT fy) { } void CPWL_EditCtrl::IOnSetCaret(bool bVisible, - const CFX_PointF& ptHead, - const CFX_PointF& ptFoot, + const CFX_FloatPoint& ptHead, + const CFX_FloatPoint& ptFoot, const CPVT_WordPlace& place) { PWL_CARET_INFO cInfo; cInfo.bVisible = bVisible; @@ -570,9 +572,9 @@ void CPWL_EditCtrl::GetTextRange(const CFX_FloatRect& rect, int32_t& nStartChar, int32_t& nEndChar) const { nStartChar = m_pEdit->WordPlaceToWordIndex( - m_pEdit->SearchWordPlace(CFX_PointF(rect.left, rect.top))); + m_pEdit->SearchWordPlace(CFX_FloatPoint(rect.left, rect.top))); nEndChar = m_pEdit->WordPlaceToWordIndex( - m_pEdit->SearchWordPlace(CFX_PointF(rect.right, rect.bottom))); + m_pEdit->SearchWordPlace(CFX_FloatPoint(rect.right, rect.bottom))); } CFX_WideString CPWL_EditCtrl::GetText(int32_t& nStartChar, diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/pdfwindow/PWL_EditCtrl.h index 8b65d4a7b5..3ff5cc66c9 100644 --- a/fpdfsdk/pdfwindow/PWL_EditCtrl.h +++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.h @@ -53,8 +53,8 @@ class CPWL_EditCtrl : public CPWL_Wnd { void Paint(); void EnableRefresh(bool bRefresh); - CFX_PointF GetScrollPos() const; - void SetScrollPos(const CFX_PointF& point); + CFX_FloatPoint GetScrollPos() const; + void SetScrollPos(const CFX_FloatPoint& point); void SetCharSet(uint8_t nCharSet) { m_nCharSet = nCharSet; } int32_t GetCharSet() const; @@ -77,9 +77,9 @@ class CPWL_EditCtrl : public CPWL_Wnd { void OnCreated() override; bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; - bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; - bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; void OnNotify(CPWL_Wnd* pWnd, uint32_t msg, intptr_t wParam = 0, @@ -98,8 +98,8 @@ class CPWL_EditCtrl : public CPWL_Wnd { FX_FLOAT fBigStep); void IOnSetScrollPosY(FX_FLOAT fy); void IOnSetCaret(bool bVisible, - const CFX_PointF& ptHead, - const CFX_PointF& ptFoot, + const CFX_FloatPoint& ptHead, + const CFX_FloatPoint& ptFoot, const CPVT_WordPlace& place); void IOnCaretChange(const CPVT_SecProps& secProps, const CPVT_WordProps& wordProps); @@ -121,10 +121,10 @@ class CPWL_EditCtrl : public CPWL_Wnd { void Delete(); void Backspace(); - void GetCaretInfo(CFX_PointF& ptHead, CFX_PointF& ptFoot) const; + void GetCaretInfo(CFX_FloatPoint& ptHead, CFX_FloatPoint& ptFoot) const; void SetCaret(bool bVisible, - const CFX_PointF& ptHead, - const CFX_PointF& ptFoot); + const CFX_FloatPoint& ptHead, + const CFX_FloatPoint& ptFoot); void SetEditCaret(bool bVisible); diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp index 3f5dfef142..12cad7b9da 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp @@ -106,7 +106,7 @@ void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom) continue; - CFX_PointF ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); + CFX_FloatPoint ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); if (m_pList->IsItemSelected(i)) { sListItems << CPWL_Utils::GetRectFillAppStream(rcItem, PWL_DEFAULT_SELBACKCOLOR) @@ -158,7 +158,7 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom) continue; - CFX_PointF ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); + CFX_FloatPoint ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); if (CFX_Edit* pEdit = m_pList->GetItemEdit(i)) { CFX_FloatRect rcContent = pEdit->GetContentRect(); if (rcContent.Width() > rcClient.Width()) @@ -249,7 +249,7 @@ bool CPWL_ListBox::OnChar(uint16_t nChar, uint32_t nFlag) { return true; } -bool CPWL_ListBox::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_ListBox::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (ClientHitTest(point)) { @@ -263,7 +263,7 @@ bool CPWL_ListBox::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_ListBox::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_ListBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (m_bMouseDown) { @@ -281,7 +281,7 @@ void CPWL_ListBox::SetHoverSel(bool bHoverSel) { m_bHoverSel = bHoverSel; } -bool CPWL_ListBox::OnMouseMove(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_ListBox::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnMouseMove(point, nFlag); if (m_bHoverSel && !IsCaptureMouse() && ClientHitTest(point)) @@ -323,7 +323,7 @@ void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, fPos = *(FX_FLOAT*)lParam; switch (wParam) { case SBT_VSCROLL: - m_pList->SetScrollPos(CFX_PointF(0, fPos)); + m_pList->SetScrollPos(CFX_FloatPoint(0, fPos)); break; } break; @@ -449,7 +449,7 @@ CFX_FloatRect CPWL_ListBox::GetListRect() const { } bool CPWL_ListBox::OnMouseWheel(short zDelta, - const CFX_PointF& point, + const CFX_FloatPoint& point, uint32_t nFlag) { if (zDelta < 0) m_pList->OnVK_DOWN(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.h b/fpdfsdk/pdfwindow/PWL_ListBox.h index f9108a17de..6db4ecb381 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.h +++ b/fpdfsdk/pdfwindow/PWL_ListBox.h @@ -35,8 +35,8 @@ class CPWL_List_Notify { void IOnInvalidateRect(CFX_FloatRect* pRect); void IOnSetCaret(bool bVisible, - const CFX_PointF& ptHead, - const CFX_PointF& ptFoot, + const CFX_FloatPoint& ptHead, + const CFX_FloatPoint& ptFoot, const CPVT_WordPlace& place); private: @@ -57,11 +57,11 @@ class CPWL_ListBox : public CPWL_Wnd { CFX_Matrix* pUser2Device) override; bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; - bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; - bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; bool OnMouseWheel(short zDelta, - const CFX_PointF& point, + const CFX_FloatPoint& point, uint32_t nFlag) override; void KillFocus() override; void OnNotify(CPWL_Wnd* pWnd, diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp index 2aa2c7e35f..c7e6bbfa99 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp @@ -137,17 +137,18 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { sAppStream << "q\n"; - CFX_PointF ptCenter = GetCenterPoint(); + CFX_FloatPoint ptCenter = GetCenterPoint(); switch (m_eScrollBarType) { case SBT_HSCROLL: switch (m_eSBButtonType) { case PSBT_MIN: { - CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); - CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y + PWL_TRIANGLE_HALFLEN); - CFX_PointF pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y - PWL_TRIANGLE_HALFLEN); + CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y); + CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y + PWL_TRIANGLE_HALFLEN); + CFX_FloatPoint pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y - PWL_TRIANGLE_HALFLEN); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -161,11 +162,12 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { } } break; case PSBT_MAX: { - CFX_PointF pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); - CFX_PointF pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y + PWL_TRIANGLE_HALFLEN); - CFX_PointF pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y - PWL_TRIANGLE_HALFLEN); + CFX_FloatPoint pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y); + CFX_FloatPoint pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y + PWL_TRIANGLE_HALFLEN); + CFX_FloatPoint pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y - PWL_TRIANGLE_HALFLEN); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -185,11 +187,12 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { case SBT_VSCROLL: switch (m_eSBButtonType) { case PSBT_MIN: { - CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN, - ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); - CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN, - ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); - CFX_PointF pt3(ptCenter.x, ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN, + ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN, + ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_FloatPoint pt3(ptCenter.x, + ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -203,11 +206,12 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { } } break; case PSBT_MAX: { - CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN, - ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); - CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN, - ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); - CFX_PointF pt3(ptCenter.x, ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN, + ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN, + ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f); + CFX_FloatPoint pt3(ptCenter.x, + ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -240,7 +244,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, if (rectWnd.IsEmpty()) return; - CFX_PointF ptCenter = GetCenterPoint(); + CFX_FloatPoint ptCenter = GetCenterPoint(); int32_t nTransparancy = GetTransparency(); switch (m_eScrollBarType) { @@ -248,11 +252,12 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); switch (m_eSBButtonType) { case PSBT_MIN: { - CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); - CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y + PWL_TRIANGLE_HALFLEN); - CFX_PointF pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y - PWL_TRIANGLE_HALFLEN); + CFX_FloatPoint pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y); + CFX_FloatPoint pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y + PWL_TRIANGLE_HALFLEN); + CFX_FloatPoint pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y - PWL_TRIANGLE_HALFLEN); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -271,11 +276,12 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } break; case PSBT_MAX: { - CFX_PointF pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y); - CFX_PointF pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y + PWL_TRIANGLE_HALFLEN); - CFX_PointF pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, - ptCenter.y - PWL_TRIANGLE_HALFLEN); + CFX_FloatPoint pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y); + CFX_FloatPoint pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y + PWL_TRIANGLE_HALFLEN); + CFX_FloatPoint pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, + ptCenter.y - PWL_TRIANGLE_HALFLEN); if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { @@ -328,13 +334,13 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, if (rectWnd.top - rectWnd.bottom > 6.0f) { FX_FLOAT fX = rectWnd.left + 1.5f; FX_FLOAT fY = rectWnd.bottom; - CFX_PointF pts[7] = {CFX_PointF(fX + 2.5f, fY + 4.0f), - CFX_PointF(fX + 2.5f, fY + 3.0f), - CFX_PointF(fX + 4.5f, fY + 5.0f), - CFX_PointF(fX + 6.5f, fY + 3.0f), - CFX_PointF(fX + 6.5f, fY + 4.0f), - CFX_PointF(fX + 4.5f, fY + 6.0f), - CFX_PointF(fX + 2.5f, fY + 4.0f)}; + CFX_FloatPoint pts[7] = {CFX_FloatPoint(fX + 2.5f, fY + 4.0f), + CFX_FloatPoint(fX + 2.5f, fY + 3.0f), + CFX_FloatPoint(fX + 4.5f, fY + 5.0f), + CFX_FloatPoint(fX + 6.5f, fY + 3.0f), + CFX_FloatPoint(fX + 6.5f, fY + 4.0f), + CFX_FloatPoint(fX + 4.5f, fY + 6.0f), + CFX_FloatPoint(fX + 2.5f, fY + 4.0f)}; if (IsEnabled()) CPWL_Utils::DrawFillArea( @@ -374,13 +380,13 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, FX_FLOAT fX = rectWnd.left + 1.5f; FX_FLOAT fY = rectWnd.bottom; - CFX_PointF pts[7] = {CFX_PointF(fX + 2.5f, fY + 5.0f), - CFX_PointF(fX + 2.5f, fY + 6.0f), - CFX_PointF(fX + 4.5f, fY + 4.0f), - CFX_PointF(fX + 6.5f, fY + 6.0f), - CFX_PointF(fX + 6.5f, fY + 5.0f), - CFX_PointF(fX + 4.5f, fY + 3.0f), - CFX_PointF(fX + 2.5f, fY + 5.0f)}; + CFX_FloatPoint pts[7] = {CFX_FloatPoint(fX + 2.5f, fY + 5.0f), + CFX_FloatPoint(fX + 2.5f, fY + 6.0f), + CFX_FloatPoint(fX + 4.5f, fY + 4.0f), + CFX_FloatPoint(fX + 6.5f, fY + 6.0f), + CFX_FloatPoint(fX + 6.5f, fY + 5.0f), + CFX_FloatPoint(fX + 4.5f, fY + 3.0f), + CFX_FloatPoint(fX + 2.5f, fY + 5.0f)}; if (IsEnabled()) CPWL_Utils::DrawFillArea( @@ -408,9 +414,10 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, if (IsEnabled()) { // draw shadow effect - CFX_PointF ptTop = CFX_PointF(rectWnd.left, rectWnd.top - 1.0f); - CFX_PointF ptBottom = - CFX_PointF(rectWnd.left, rectWnd.bottom + 1.0f); + CFX_FloatPoint ptTop = + CFX_FloatPoint(rectWnd.left, rectWnd.top - 1.0f); + CFX_FloatPoint ptBottom = + CFX_FloatPoint(rectWnd.left, rectWnd.bottom + 1.0f); ptTop.x += 1.5f; ptBottom.x += 1.5f; @@ -497,12 +504,12 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, FX_FLOAT nFrictionWidth = 5.0f; FX_FLOAT nFrictionHeight = 5.5f; - CFX_PointF ptLeft = - CFX_PointF(ptCenter.x - nFrictionWidth / 2.0f, - ptCenter.y - nFrictionHeight / 2.0f + 0.5f); - CFX_PointF ptRight = - CFX_PointF(ptCenter.x + nFrictionWidth / 2.0f, - ptCenter.y - nFrictionHeight / 2.0f + 0.5f); + CFX_FloatPoint ptLeft = + CFX_FloatPoint(ptCenter.x - nFrictionWidth / 2.0f, + ptCenter.y - nFrictionHeight / 2.0f + 0.5f); + CFX_FloatPoint ptRight = + CFX_FloatPoint(ptCenter.x + nFrictionWidth / 2.0f, + ptCenter.y - nFrictionHeight / 2.0f + 0.5f); CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, crStroke, 1.0f); @@ -529,7 +536,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } -bool CPWL_SBButton::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_SBButton::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (CPWL_Wnd* pParent = GetParentWindow()) @@ -541,7 +548,7 @@ bool CPWL_SBButton::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_SBButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_SBButton::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (CPWL_Wnd* pParent = GetParentWindow()) @@ -553,7 +560,7 @@ bool CPWL_SBButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_SBButton::OnMouseMove(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_SBButton::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnMouseMove(point, nFlag); if (CPWL_Wnd* pParent = GetParentWindow()) { @@ -676,19 +683,20 @@ void CPWL_ScrollBar::DrawThisAppearance(CFX_RenderDevice* pDevice, CPWL_Utils::DrawStrokeLine( pDevice, pUser2Device, - CFX_PointF(rectWnd.left + 2.0f, rectWnd.top - 2.0f), - CFX_PointF(rectWnd.left + 2.0f, rectWnd.bottom + 2.0f), + CFX_FloatPoint(rectWnd.left + 2.0f, rectWnd.top - 2.0f), + CFX_FloatPoint(rectWnd.left + 2.0f, rectWnd.bottom + 2.0f), ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f); CPWL_Utils::DrawStrokeLine( pDevice, pUser2Device, - CFX_PointF(rectWnd.right - 2.0f, rectWnd.top - 2.0f), - CFX_PointF(rectWnd.right - 2.0f, rectWnd.bottom + 2.0f), + CFX_FloatPoint(rectWnd.right - 2.0f, rectWnd.top - 2.0f), + CFX_FloatPoint(rectWnd.right - 2.0f, rectWnd.bottom + 2.0f), ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f); } } -bool CPWL_ScrollBar::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_ScrollBar::OnLButtonDown(const CFX_FloatPoint& point, + uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (HasFlag(PWS_AUTOTRANSPARENT)) { @@ -743,7 +751,7 @@ bool CPWL_ScrollBar::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { return true; } -bool CPWL_ScrollBar::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_ScrollBar::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (HasFlag(PWS_AUTOTRANSPARENT)) { @@ -768,41 +776,41 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, switch (msg) { case PNM_LBUTTONDOWN: if (pWnd == m_pMinButton) { - OnMinButtonLBDown(*(CFX_PointF*)lParam); + OnMinButtonLBDown(*(CFX_FloatPoint*)lParam); } if (pWnd == m_pMaxButton) { - OnMaxButtonLBDown(*(CFX_PointF*)lParam); + OnMaxButtonLBDown(*(CFX_FloatPoint*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonLBDown(*(CFX_PointF*)lParam); + OnPosButtonLBDown(*(CFX_FloatPoint*)lParam); } break; case PNM_LBUTTONUP: if (pWnd == m_pMinButton) { - OnMinButtonLBUp(*(CFX_PointF*)lParam); + OnMinButtonLBUp(*(CFX_FloatPoint*)lParam); } if (pWnd == m_pMaxButton) { - OnMaxButtonLBUp(*(CFX_PointF*)lParam); + OnMaxButtonLBUp(*(CFX_FloatPoint*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonLBUp(*(CFX_PointF*)lParam); + OnPosButtonLBUp(*(CFX_FloatPoint*)lParam); } break; case PNM_MOUSEMOVE: if (pWnd == m_pMinButton) { - OnMinButtonMouseMove(*(CFX_PointF*)lParam); + OnMinButtonMouseMove(*(CFX_FloatPoint*)lParam); } if (pWnd == m_pMaxButton) { - OnMaxButtonMouseMove(*(CFX_PointF*)lParam); + OnMaxButtonMouseMove(*(CFX_FloatPoint*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonMouseMove(*(CFX_PointF*)lParam); + OnPosButtonMouseMove(*(CFX_FloatPoint*)lParam); } break; case PNM_SETSCROLLINFO: { @@ -946,7 +954,7 @@ void CPWL_ScrollBar::MovePosButton(bool bRefresh) { } } -void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_PointF& point) { +void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_FloatPoint& point) { m_sData.SubSmall(); MovePosButton(true); NotifyScrollWindow(); @@ -957,11 +965,11 @@ void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_PointF& point) { BeginTimer(100); } -void CPWL_ScrollBar::OnMinButtonLBUp(const CFX_PointF& point) {} +void CPWL_ScrollBar::OnMinButtonLBUp(const CFX_FloatPoint& point) {} -void CPWL_ScrollBar::OnMinButtonMouseMove(const CFX_PointF& point) {} +void CPWL_ScrollBar::OnMinButtonMouseMove(const CFX_FloatPoint& point) {} -void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_PointF& point) { +void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_FloatPoint& point) { m_sData.AddSmall(); MovePosButton(true); NotifyScrollWindow(); @@ -972,11 +980,11 @@ void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_PointF& point) { BeginTimer(100); } -void CPWL_ScrollBar::OnMaxButtonLBUp(const CFX_PointF& point) {} +void CPWL_ScrollBar::OnMaxButtonLBUp(const CFX_FloatPoint& point) {} -void CPWL_ScrollBar::OnMaxButtonMouseMove(const CFX_PointF& point) {} +void CPWL_ScrollBar::OnMaxButtonMouseMove(const CFX_FloatPoint& point) {} -void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_PointF& point) { +void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_FloatPoint& point) { m_bMouseDown = true; if (m_pPosButton) { @@ -995,7 +1003,7 @@ void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_PointF& point) { } } -void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_PointF& point) { +void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_FloatPoint& point) { if (m_bMouseDown) { if (!m_bNotifyForever) NotifyScrollWindow(); @@ -1003,7 +1011,7 @@ void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_PointF& point) { m_bMouseDown = false; } -void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_PointF& point) { +void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_FloatPoint& point) { FX_FLOAT fOldScrollPos = m_sData.fScrollPos; FX_FLOAT fNewPos = 0; diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/pdfwindow/PWL_ScrollBar.h index 9546a9e577..bcfb0a6873 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.h +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.h @@ -53,9 +53,9 @@ class CPWL_SBButton : public CPWL_Wnd { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; - bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; protected: PWL_SCROLLBAR_TYPE m_eScrollBarType; @@ -127,8 +127,8 @@ class CPWL_ScrollBar : public CPWL_Wnd { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; - bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; void OnNotify(CPWL_Wnd* pWnd, uint32_t msg, intptr_t wParam = 0, @@ -152,17 +152,17 @@ class CPWL_ScrollBar : public CPWL_Wnd { private: void CreateButtons(const PWL_CREATEPARAM& cp); - void OnMinButtonLBDown(const CFX_PointF& point); - void OnMinButtonLBUp(const CFX_PointF& point); - void OnMinButtonMouseMove(const CFX_PointF& point); + void OnMinButtonLBDown(const CFX_FloatPoint& point); + void OnMinButtonLBUp(const CFX_FloatPoint& point); + void OnMinButtonMouseMove(const CFX_FloatPoint& point); - void OnMaxButtonLBDown(const CFX_PointF& point); - void OnMaxButtonLBUp(const CFX_PointF& point); - void OnMaxButtonMouseMove(const CFX_PointF& point); + void OnMaxButtonLBDown(const CFX_FloatPoint& point); + void OnMaxButtonLBUp(const CFX_FloatPoint& point); + void OnMaxButtonMouseMove(const CFX_FloatPoint& point); - void OnPosButtonLBDown(const CFX_PointF& point); - void OnPosButtonLBUp(const CFX_PointF& point); - void OnPosButtonMouseMove(const CFX_PointF& point); + void OnPosButtonLBDown(const CFX_FloatPoint& point); + void OnPosButtonLBUp(const CFX_FloatPoint& point); + void OnPosButtonMouseMove(const CFX_FloatPoint& point); FX_FLOAT TrueToFace(FX_FLOAT); FX_FLOAT FaceToTrue(FX_FLOAT); diff --git a/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp b/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp index 1c46c375a9..defb992c57 100644 --- a/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp +++ b/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp @@ -37,7 +37,7 @@ bool CPWL_CheckBox::IsChecked() const { return m_bChecked; } -bool CPWL_CheckBox::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_CheckBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { if (IsReadOnly()) return false; @@ -58,7 +58,8 @@ CFX_ByteString CPWL_RadioButton::GetClassName() const { return "CPWL_RadioButton"; } -bool CPWL_RadioButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { +bool CPWL_RadioButton::OnLButtonUp(const CFX_FloatPoint& point, + uint32_t nFlag) { if (IsReadOnly()) return false; diff --git a/fpdfsdk/pdfwindow/PWL_SpecialButton.h b/fpdfsdk/pdfwindow/PWL_SpecialButton.h index 93f611b744..0aa6c4510b 100644 --- a/fpdfsdk/pdfwindow/PWL_SpecialButton.h +++ b/fpdfsdk/pdfwindow/PWL_SpecialButton.h @@ -26,7 +26,7 @@ class CPWL_CheckBox : public CPWL_Button { // CPWL_Button CFX_ByteString GetClassName() const override; - bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; void SetCheck(bool bCheck); @@ -43,7 +43,7 @@ class CPWL_RadioButton : public CPWL_Button { // CPWL_Button CFX_ByteString GetClassName() const override; - bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; void SetCheck(bool bCheck); diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp index d4e31bcf73..f3caf12af9 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp @@ -105,10 +105,10 @@ bool CPWL_Utils::IntersectRect(const CFX_FloatRect& rect1, return left < right && bottom < top; } -CFX_PointF CPWL_Utils::OffsetPoint(const CFX_PointF& point, - FX_FLOAT x, - FX_FLOAT y) { - return CFX_PointF(point.x + x, point.y + y); +CFX_FloatPoint CPWL_Utils::OffsetPoint(const CFX_FloatPoint& point, + FX_FLOAT x, + FX_FLOAT y) { + return CFX_FloatPoint(point.x + x, point.y + y); } CPVT_WordRange CPWL_Utils::OverlapWordRange(const CPVT_WordRange& wr1, @@ -192,10 +192,10 @@ CFX_ByteString CPWL_Utils::GetAP_Circle(const CFX_FloatRect& crBBox) { FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CFX_PointF pt1(crBBox.left, crBBox.bottom + fHeight / 2); - CFX_PointF pt2(crBBox.left + fWidth / 2, crBBox.top); - CFX_PointF pt3(crBBox.right, crBBox.bottom + fHeight / 2); - CFX_PointF pt4(crBBox.left + fWidth / 2, crBBox.bottom); + CFX_FloatPoint pt1(crBBox.left, crBBox.bottom + fHeight / 2); + CFX_FloatPoint pt2(crBBox.left + fWidth / 2, crBBox.top); + CFX_FloatPoint pt3(crBBox.right, crBBox.bottom + fHeight / 2); + CFX_FloatPoint pt4(crBBox.left + fWidth / 2, crBBox.bottom); csAP << pt1.x << " " << pt1.y << " m\n"; @@ -245,10 +245,10 @@ CFX_ByteString CPWL_Utils::GetAP_Diamond(const CFX_FloatRect& crBBox) { FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CFX_PointF pt1(crBBox.left, crBBox.bottom + fHeight / 2); - CFX_PointF pt2(crBBox.left + fWidth / 2, crBBox.top); - CFX_PointF pt3(crBBox.right, crBBox.bottom + fHeight / 2); - CFX_PointF pt4(crBBox.left + fWidth / 2, crBBox.bottom); + CFX_FloatPoint pt1(crBBox.left, crBBox.bottom + fHeight / 2); + CFX_FloatPoint pt2(crBBox.left + fWidth / 2, crBBox.top); + CFX_FloatPoint pt3(crBBox.right, crBBox.bottom + fHeight / 2); + CFX_FloatPoint pt4(crBBox.left + fWidth / 2, crBBox.bottom); csAP << pt1.x << " " << pt1.y << " m\n"; csAP << pt2.x << " " << pt2.y << " l\n"; @@ -276,8 +276,8 @@ CFX_ByteString CPWL_Utils::GetAP_Star(const CFX_FloatRect& crBBox) { FX_FLOAT fRadius = (crBBox.top - crBBox.bottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f)); - CFX_PointF ptCenter = CFX_PointF((crBBox.left + crBBox.right) / 2.0f, - (crBBox.top + crBBox.bottom) / 2.0f); + CFX_FloatPoint ptCenter = CFX_FloatPoint((crBBox.left + crBBox.right) / 2.0f, + (crBBox.top + crBBox.bottom) / 2.0f); FX_FLOAT px[5], py[5]; @@ -310,9 +310,9 @@ CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CFX_FloatRect& crBBox, FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - CFX_PointF pt1(-fWidth / 2, 0); - CFX_PointF pt2(0, fHeight / 2); - CFX_PointF pt3(fWidth / 2, 0); + CFX_FloatPoint pt1(-fWidth / 2, 0); + CFX_FloatPoint pt2(0, fHeight / 2); + CFX_FloatPoint pt3(fWidth / 2, 0); FX_FLOAT px, py; @@ -365,8 +365,8 @@ CFX_FloatRect CPWL_Utils::ScaleRect(const CFX_FloatRect& rcRect, FX_FLOAT fHalfWidth = (rcRect.right - rcRect.left) / 2.0f; FX_FLOAT fHalfHeight = (rcRect.top - rcRect.bottom) / 2.0f; - CFX_PointF ptCenter = CFX_PointF((rcRect.left + rcRect.right) / 2, - (rcRect.top + rcRect.bottom) / 2); + CFX_FloatPoint ptCenter = CFX_FloatPoint((rcRect.left + rcRect.right) / 2, + (rcRect.top + rcRect.bottom) / 2); return CFX_FloatRect( ptCenter.x - fHalfWidth * fScale, ptCenter.y - fHalfHeight * fScale, @@ -411,7 +411,7 @@ CFX_FloatRect CPWL_Utils::GetCenterSquare(const CFX_FloatRect& rect) { } CFX_ByteString CPWL_Utils::GetEditAppStream(CFX_Edit* pEdit, - const CFX_PointF& ptOffset, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange, bool bContinuous, uint16_t SubWord) { @@ -420,7 +420,7 @@ CFX_ByteString CPWL_Utils::GetEditAppStream(CFX_Edit* pEdit, } CFX_ByteString CPWL_Utils::GetEditSelAppStream(CFX_Edit* pEdit, - const CFX_PointF& ptOffset, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange) { return CFX_Edit::GetSelectAppearanceStream(pEdit, ptOffset, pRange); } @@ -452,7 +452,7 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox, pEdit->SetText(sText); CFX_ByteString sEdit = - CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, 0.0f)); + CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f)); if (sEdit.GetLength() > 0) sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n"; @@ -664,7 +664,7 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, if (!rcLabel.IsEmpty()) { pEdit->SetPlateRect(rcLabel); CFX_ByteString sEdit = - CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, 0.0f)); + CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f)); if (sEdit.GetLength() > 0) { sTemp << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n"; @@ -1089,8 +1089,8 @@ CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CFX_FloatRect& rcBBox) { CPWL_Dash(3, 0, 0)) << "Q\n"; - CFX_PointF ptCenter = CFX_PointF((rcBBox.left + rcBBox.right) / 2, - (rcBBox.top + rcBBox.bottom) / 2); + CFX_FloatPoint ptCenter = CFX_FloatPoint((rcBBox.left + rcBBox.right) / 2, + (rcBBox.top + rcBBox.bottom) / 2); if (IsFloatBigger(rcBBox.right - rcBBox.left, 6) && IsFloatBigger(rcBBox.top - rcBBox.bottom, 6)) { sAppStream << "q\n" @@ -1230,7 +1230,7 @@ void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, void CPWL_Utils::DrawFillArea(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - const CFX_PointF* pPts, + const CFX_FloatPoint* pPts, int32_t nCount, const FX_COLORREF& color) { CFX_PathData path; @@ -1260,8 +1260,8 @@ void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice, void CPWL_Utils::DrawStrokeLine(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - const CFX_PointF& ptMoveTo, - const CFX_PointF& ptLineTo, + const CFX_FloatPoint& ptMoveTo, + const CFX_FloatPoint& ptLineTo, const FX_COLORREF& color, FX_FLOAT fWidth) { CFX_PathData path; @@ -1300,8 +1300,8 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, for (FX_FLOAT fy = rect.bottom + 0.5f; fy <= rect.top - 0.5f; fy += 1.0f) { int32_t nGray = nStartGray + (int32_t)(fStepGray * (fy - rect.bottom)); CPWL_Utils::DrawStrokeLine( - pDevice, pUser2Device, CFX_PointF(rect.left, fy), - CFX_PointF(rect.right, fy), + pDevice, pUser2Device, CFX_FloatPoint(rect.left, fy), + CFX_FloatPoint(rect.right, fy), ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f); } } @@ -1312,8 +1312,8 @@ void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, for (FX_FLOAT fx = rect.left + 0.5f; fx <= rect.right - 0.5f; fx += 1.0f) { int32_t nGray = nStartGray + (int32_t)(fStepGray * (fx - rect.left)); CPWL_Utils::DrawStrokeLine( - pDevice, pUser2Device, CFX_PointF(fx, rect.bottom), - CFX_PointF(fx, rect.top), + pDevice, pUser2Device, CFX_FloatPoint(fx, rect.bottom), + CFX_FloatPoint(fx, rect.top), ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f); } } @@ -2737,8 +2737,8 @@ void CPWL_Utils::GetGraphics_Star(CFX_ByteString& sPathData, (crBBox.top - crBBox.bottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f)); fLongRadius = fLongRadius * 0.7f; FX_FLOAT fShortRadius = fLongRadius * 0.55f; - CFX_PointF ptCenter = CFX_PointF((crBBox.left + crBBox.right) / 2.0f, - (crBBox.top + crBBox.bottom) / 2.0f); + CFX_FloatPoint ptCenter = CFX_FloatPoint((crBBox.left + crBBox.right) / 2.0f, + (crBBox.top + crBBox.bottom) / 2.0f); FX_FLOAT px1[5], py1[5]; FX_FLOAT px2[5], py2[5]; diff --git a/fpdfsdk/pdfwindow/PWL_Utils.h b/fpdfsdk/pdfwindow/PWL_Utils.h index f6b51d7098..f14c3c7963 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.h +++ b/fpdfsdk/pdfwindow/PWL_Utils.h @@ -74,11 +74,11 @@ T PWL_MAX(const T& i, const T& j) { #define PPBL_LABELLEFTICONRIGHT 5 #define PPBL_LABELOVERICON 6 -class CPWL_Point : public CFX_PointF { +class CPWL_Point : public CFX_FloatPoint { public: CPWL_Point() {} - CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CFX_PointF(fx, fy) {} - CPWL_Point(const CPWL_Point& point) : CFX_PointF(point.x, point.y) {} + CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CFX_FloatPoint(fx, fy) {} + CPWL_Point(const CPWL_Point& point) : CFX_FloatPoint(point.x, point.y) {} }; enum PWL_PATHDATA_TYPE { @@ -121,9 +121,9 @@ class CPWL_Utils { static CFX_FloatRect OffsetRect(const CFX_FloatRect& rect, FX_FLOAT x, FX_FLOAT y); - static CFX_PointF OffsetPoint(const CFX_PointF& point, - FX_FLOAT x, - FX_FLOAT y); + static CFX_FloatPoint OffsetPoint(const CFX_FloatPoint& point, + FX_FLOAT x, + FX_FLOAT y); static FX_COLORREF PWLColorToFXColor(const CPWL_Color& color, int32_t nTransparancy = 255); static bool IsBlackOrWhite(const CPWL_Color& color); @@ -167,13 +167,13 @@ class CPWL_Utils { const CPWL_Color& crText); static CFX_ByteString GetEditAppStream(CFX_Edit* pEdit, - const CFX_PointF& ptOffset, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange = nullptr, bool bContinuous = true, uint16_t SubWord = 0); static CFX_ByteString GetEditSelAppStream( CFX_Edit* pEdit, - const CFX_PointF& ptOffset, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange = nullptr); static CFX_ByteString GetTextAppStream(const CFX_FloatRect& rcBBox, IPVT_FontMap* pFontMap, @@ -202,8 +202,8 @@ class CPWL_Utils { FX_FLOAT fWidth); static void DrawStrokeLine(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - const CFX_PointF& ptMoveTo, - const CFX_PointF& ptLineTo, + const CFX_FloatPoint& ptMoveTo, + const CFX_FloatPoint& ptLineTo, const FX_COLORREF& color, FX_FLOAT fWidth); static void DrawBorder(CFX_RenderDevice* pDevice, @@ -217,7 +217,7 @@ class CPWL_Utils { int32_t nTransparancy); static void DrawFillArea(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - const CFX_PointF* pPts, + const CFX_FloatPoint* pPts, int32_t nCount, const FX_COLORREF& color); static void DrawShadow(CFX_RenderDevice* pDevice, diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp index cf573220b7..1170660f1c 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp @@ -426,7 +426,8 @@ PWL_IMPLEMENT_KEY_METHOD(OnChar) #undef PWL_IMPLEMENT_KEY_METHOD #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name) \ - bool CPWL_Wnd::mouse_method_name(const CFX_PointF& point, uint32_t nFlag) { \ + bool CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \ + uint32_t nFlag) { \ if (!IsValid() || !IsVisible() || !IsEnabled()) \ return false; \ if (IsWndCaptureMouse(this)) { \ @@ -461,7 +462,7 @@ PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) #undef PWL_IMPLEMENT_MOUSE_METHOD bool CPWL_Wnd::OnMouseWheel(short zDelta, - const CFX_PointF& point, + const CFX_FloatPoint& point, uint32_t nFlag) { if (!IsValid() || !IsVisible() || !IsEnabled()) return false; @@ -533,10 +534,10 @@ CFX_FloatRect CPWL_Wnd::GetClientRect() const { return rcWindow.Contains(rcClient) ? rcClient : CFX_FloatRect(); } -CFX_PointF CPWL_Wnd::GetCenterPoint() const { +CFX_FloatPoint CPWL_Wnd::GetCenterPoint() const { CFX_FloatRect rcClient = GetClientRect(); - return CFX_PointF((rcClient.left + rcClient.right) * 0.5f, - (rcClient.top + rcClient.bottom) * 0.5f); + return CFX_FloatPoint((rcClient.left + rcClient.right) * 0.5f, + (rcClient.top + rcClient.bottom) * 0.5f); } bool CPWL_Wnd::HasFlag(uint32_t dwFlags) const { @@ -672,11 +673,11 @@ void CPWL_Wnd::OnSetFocus() {} void CPWL_Wnd::OnKillFocus() {} -bool CPWL_Wnd::WndHitTest(const CFX_PointF& point) const { +bool CPWL_Wnd::WndHitTest(const CFX_FloatPoint& point) const { return IsValid() && IsVisible() && GetWindowRect().Contains(point.x, point.y); } -bool CPWL_Wnd::ClientHitTest(const CFX_PointF& point) const { +bool CPWL_Wnd::ClientHitTest(const CFX_FloatPoint& point) const { return IsValid() && IsVisible() && GetClientRect().Contains(point.x, point.y); } @@ -849,9 +850,11 @@ CFX_Matrix CPWL_Wnd::GetWindowMatrix() const { return mt; } -void CPWL_Wnd::PWLtoWnd(const CFX_PointF& point, int32_t& x, int32_t& y) const { +void CPWL_Wnd::PWLtoWnd(const CFX_FloatPoint& point, + int32_t& x, + int32_t& y) const { CFX_Matrix mt = GetWindowMatrix(); - CFX_PointF pt = point; + CFX_FloatPoint pt = point; mt.TransformPoint(pt.x, pt.y); x = (int32_t)(pt.x + 0.5); y = (int32_t)(pt.y + 0.5); @@ -865,12 +868,12 @@ FX_RECT CPWL_Wnd::PWLtoWnd(const CFX_FloatRect& rect) const { (int32_t)(rcTemp.right + 0.5), (int32_t)(rcTemp.top + 0.5)); } -CFX_PointF CPWL_Wnd::ChildToParent(const CFX_PointF& point) const { +CFX_FloatPoint CPWL_Wnd::ChildToParent(const CFX_FloatPoint& point) const { CFX_Matrix mt = GetChildMatrix(); if (mt.IsIdentity()) return point; - CFX_PointF pt = point; + CFX_FloatPoint pt = point; mt.TransformPoint(pt.x, pt.y); return pt; } @@ -885,13 +888,13 @@ CFX_FloatRect CPWL_Wnd::ChildToParent(const CFX_FloatRect& rect) const { return rc; } -CFX_PointF CPWL_Wnd::ParentToChild(const CFX_PointF& point) const { +CFX_FloatPoint CPWL_Wnd::ParentToChild(const CFX_FloatPoint& point) const { CFX_Matrix mt = GetChildMatrix(); if (mt.IsIdentity()) return point; mt.SetReverse(mt); - CFX_PointF pt = point; + CFX_FloatPoint pt = point; mt.TransformPoint(pt.x, pt.y); return pt; } diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h index 12b29aeb7e..dd4f321d8a 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/pdfwindow/PWL_Wnd.h @@ -264,17 +264,17 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual bool OnKeyDown(uint16_t nChar, uint32_t nFlag); virtual bool OnKeyUp(uint16_t nChar, uint32_t nFlag); virtual bool OnChar(uint16_t nChar, uint32_t nFlag); - virtual bool OnLButtonDblClk(const CFX_PointF& point, uint32_t nFlag); - virtual bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag); - virtual bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag); - virtual bool OnMButtonDblClk(const CFX_PointF& point, uint32_t nFlag); - virtual bool OnMButtonDown(const CFX_PointF& point, uint32_t nFlag); - virtual bool OnMButtonUp(const CFX_PointF& point, uint32_t nFlag); - virtual bool OnRButtonDown(const CFX_PointF& point, uint32_t nFlag); - virtual bool OnRButtonUp(const CFX_PointF& point, uint32_t nFlag); - virtual bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag); + virtual bool OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnMButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnMButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnMButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnRButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag); virtual bool OnMouseWheel(short zDelta, - const CFX_PointF& point, + const CFX_FloatPoint& point, uint32_t nFlag); virtual void SetFocus(); @@ -308,7 +308,7 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual CFX_FloatRect GetWindowRect() const; virtual CFX_FloatRect GetClientRect() const; - CFX_PointF GetCenterPoint() const; + CFX_FloatPoint GetCenterPoint() const; int32_t GetBorderWidth() const; bool IsVisible() const { return m_bVisible; } bool HasFlag(uint32_t dwFlags) const; @@ -320,8 +320,8 @@ class CPWL_Wnd : public CPWL_TimerHandler { const CPWL_Dash& GetBorderDash() const; void* GetAttachedData() const; - bool WndHitTest(const CFX_PointF& point) const; - bool ClientHitTest(const CFX_PointF& point) const; + bool WndHitTest(const CFX_FloatPoint& point) const; + bool ClientHitTest(const CFX_FloatPoint& point) const; bool IsCaptureMouse() const; const CPWL_Wnd* GetFocused() const; @@ -341,9 +341,9 @@ class CPWL_Wnd : public CPWL_TimerHandler { void SetChildMatrix(const CFX_Matrix& mt); CFX_Matrix GetWindowMatrix() const; - virtual CFX_PointF ChildToParent(const CFX_PointF& point) const; + virtual CFX_FloatPoint ChildToParent(const CFX_FloatPoint& point) const; virtual CFX_FloatRect ChildToParent(const CFX_FloatRect& rect) const; - virtual CFX_PointF ParentToChild(const CFX_PointF& point) const; + virtual CFX_FloatPoint ParentToChild(const CFX_FloatPoint& point) const; virtual CFX_FloatRect ParentToChild(const CFX_FloatRect& rect) const; // those methods only implemented by listctrl item @@ -389,7 +389,7 @@ class CPWL_Wnd : public CPWL_TimerHandler { void InvalidateRectMove(const CFX_FloatRect& rcOld, const CFX_FloatRect& rcNew); - void PWLtoWnd(const CFX_PointF& point, int32_t& x, int32_t& y) const; + void PWLtoWnd(const CFX_FloatPoint& point, int32_t& x, int32_t& y) const; FX_RECT PWLtoWnd(const CFX_FloatRect& rect) const; bool IsWndCaptureMouse(const CPWL_Wnd* pWnd) const; |