From 4cf551577856f89103e162edc761def44ffb96fc Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 2 Nov 2016 14:37:54 -0700 Subject: Remove FX_BOOL from fpdfsdk. Review-Url: https://codereview.chromium.org/2453683011 --- fpdfsdk/pdfwindow/PWL_Button.cpp | 15 ++- fpdfsdk/pdfwindow/PWL_Button.h | 6 +- fpdfsdk/pdfwindow/PWL_Caret.cpp | 18 ++-- fpdfsdk/pdfwindow/PWL_Caret.h | 10 +- fpdfsdk/pdfwindow/PWL_ComboBox.cpp | 125 +++++++++++------------ fpdfsdk/pdfwindow/PWL_ComboBox.h | 20 ++-- fpdfsdk/pdfwindow/PWL_Edit.cpp | 172 ++++++++++++++++---------------- fpdfsdk/pdfwindow/PWL_Edit.h | 50 +++++----- fpdfsdk/pdfwindow/PWL_EditCtrl.cpp | 109 ++++++++++---------- fpdfsdk/pdfwindow/PWL_EditCtrl.h | 28 +++--- fpdfsdk/pdfwindow/PWL_FontMap.cpp | 18 ++-- fpdfsdk/pdfwindow/PWL_FontMap.h | 6 +- fpdfsdk/pdfwindow/PWL_Icon.cpp | 4 +- fpdfsdk/pdfwindow/PWL_Icon.h | 2 +- fpdfsdk/pdfwindow/PWL_ListBox.cpp | 73 +++++++------- fpdfsdk/pdfwindow/PWL_ListBox.h | 30 +++--- fpdfsdk/pdfwindow/PWL_ScrollBar.cpp | 98 +++++++++--------- fpdfsdk/pdfwindow/PWL_ScrollBar.h | 26 ++--- fpdfsdk/pdfwindow/PWL_SpecialButton.cpp | 27 +++-- fpdfsdk/pdfwindow/PWL_SpecialButton.h | 8 +- fpdfsdk/pdfwindow/PWL_Utils.cpp | 111 +++++++++++---------- fpdfsdk/pdfwindow/PWL_Utils.h | 22 ++-- fpdfsdk/pdfwindow/PWL_Wnd.cpp | 98 +++++++++--------- fpdfsdk/pdfwindow/PWL_Wnd.h | 76 +++++++------- 24 files changed, 572 insertions(+), 580 deletions(-) (limited to 'fpdfsdk/pdfwindow') diff --git a/fpdfsdk/pdfwindow/PWL_Button.cpp b/fpdfsdk/pdfwindow/PWL_Button.cpp index baf9ef0f26..972e55edad 100644 --- a/fpdfsdk/pdfwindow/PWL_Button.cpp +++ b/fpdfsdk/pdfwindow/PWL_Button.cpp @@ -8,7 +8,7 @@ #include "fpdfsdk/pdfwindow/PWL_Utils.h" #include "fpdfsdk/pdfwindow/PWL_Wnd.h" -CPWL_Button::CPWL_Button() : m_bMouseDown(FALSE) {} +CPWL_Button::CPWL_Button() : m_bMouseDown(false) {} CPWL_Button::~CPWL_Button() {} @@ -20,21 +20,20 @@ void CPWL_Button::OnCreate(PWL_CREATEPARAM& cp) { cp.eCursorType = FXCT_HAND; } -FX_BOOL CPWL_Button::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_Button::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); - m_bMouseDown = TRUE; + m_bMouseDown = true; SetCapture(); - return TRUE; + return true; } -FX_BOOL CPWL_Button::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Button::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); ReleaseCapture(); - m_bMouseDown = FALSE; + m_bMouseDown = false; - return TRUE; + return true; } diff --git a/fpdfsdk/pdfwindow/PWL_Button.h b/fpdfsdk/pdfwindow/PWL_Button.h index 809b0614ca..f35e9adf36 100644 --- a/fpdfsdk/pdfwindow/PWL_Button.h +++ b/fpdfsdk/pdfwindow/PWL_Button.h @@ -17,11 +17,11 @@ class CPWL_Button : public CPWL_Wnd { // CPWL_Wnd CFX_ByteString GetClassName() const override; void OnCreate(PWL_CREATEPARAM& cp) override; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& 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: - FX_BOOL m_bMouseDown; + bool m_bMouseDown; }; #endif // FPDFSDK_PDFWINDOW_PWL_BUTTON_H_ diff --git a/fpdfsdk/pdfwindow/PWL_Caret.cpp b/fpdfsdk/pdfwindow/PWL_Caret.cpp index 0965ce10d0..8a5f539596 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.cpp +++ b/fpdfsdk/pdfwindow/PWL_Caret.cpp @@ -14,7 +14,7 @@ #define PWL_CARET_FLASHINTERVAL 500 -CPWL_Caret::CPWL_Caret() : m_bFlash(FALSE), m_fWidth(0.4f), m_nDelay(0) {} +CPWL_Caret::CPWL_Caret() : m_bFlash(false), m_fWidth(0.4f), m_nDelay(0) {} CPWL_Caret::~CPWL_Caret() {} @@ -105,7 +105,7 @@ CFX_FloatRect CPWL_Caret::GetCaretRect() const { m_ptHead.y); } -void CPWL_Caret::SetCaret(FX_BOOL bVisible, +void CPWL_Caret::SetCaret(bool bVisible, const CFX_FloatPoint& ptHead, const CFX_FloatPoint& ptFoot) { if (bVisible) { @@ -113,25 +113,25 @@ void CPWL_Caret::SetCaret(FX_BOOL bVisible, if (m_ptHead != ptHead || m_ptFoot != ptFoot) { m_ptHead = ptHead; m_ptFoot = ptFoot; - m_bFlash = TRUE; - Move(m_rcInvalid, FALSE, TRUE); + m_bFlash = true; + Move(m_rcInvalid, false, true); } } else { m_ptHead = ptHead; m_ptFoot = ptFoot; EndTimer(); BeginTimer(PWL_CARET_FLASHINTERVAL); - CPWL_Wnd::SetVisible(TRUE); - m_bFlash = TRUE; - Move(m_rcInvalid, FALSE, TRUE); + CPWL_Wnd::SetVisible(true); + m_bFlash = true; + Move(m_rcInvalid, false, true); } } else { m_ptHead = CFX_FloatPoint(); m_ptFoot = CFX_FloatPoint(); - m_bFlash = FALSE; + m_bFlash = false; if (IsVisible()) { EndTimer(); - CPWL_Wnd::SetVisible(FALSE); + CPWL_Wnd::SetVisible(false); } } } diff --git a/fpdfsdk/pdfwindow/PWL_Caret.h b/fpdfsdk/pdfwindow/PWL_Caret.h index 2f5c87639e..ccee96109e 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.h +++ b/fpdfsdk/pdfwindow/PWL_Caret.h @@ -11,9 +11,9 @@ struct PWL_CARET_INFO { public: - PWL_CARET_INFO() : bVisible(FALSE) {} + PWL_CARET_INFO() : bVisible(false) {} - FX_BOOL bVisible; + bool bVisible; CFX_FloatPoint ptHead; CFX_FloatPoint ptFoot; }; @@ -29,10 +29,10 @@ class CPWL_Caret : public CPWL_Wnd { void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; void InvalidateRect(CFX_FloatRect* pRect = nullptr) override; - void SetVisible(FX_BOOL bVisible) override {} + void SetVisible(bool bVisible) override {} void TimerProc() override; - void SetCaret(FX_BOOL bVisible, + void SetCaret(bool bVisible, const CFX_FloatPoint& ptHead, const CFX_FloatPoint& ptFoot); CFX_ByteString GetCaretAppearanceStream(const CFX_FloatPoint& ptOffset); @@ -42,7 +42,7 @@ class CPWL_Caret : public CPWL_Wnd { void GetCaretApp(CFX_ByteTextBuf& sAppStream, const CFX_FloatPoint& ptOffset); CFX_FloatRect GetCaretRect() const; - FX_BOOL m_bFlash; + bool m_bFlash; CFX_FloatPoint m_ptHead; CFX_FloatPoint m_ptFoot; FX_FLOAT m_fWidth; diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp index c5a67f385e..8e9a04b97d 100644 --- a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp @@ -18,30 +18,29 @@ #define PWLCB_DEFAULTFONTSIZE 12.0f -FX_BOOL CPWL_CBListBox::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_CBListBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (!m_bMouseDown) - return TRUE; + return true; ReleaseCapture(); - m_bMouseDown = FALSE; + m_bMouseDown = false; if (!ClientHitTest(point)) - return TRUE; + return true; if (CPWL_Wnd* pParent = GetParentWindow()) pParent->OnNotify(this, PNM_LBUTTONUP, 0, PWL_MAKEDWORD(point.x, point.y)); - FX_BOOL bExit = FALSE; - OnNotifySelChanged(FALSE, bExit, nFlag); + bool bExit = false; + OnNotifySelChanged(false, bExit, nFlag); return !bExit; } -FX_BOOL CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar, - FX_BOOL& bExit, - uint32_t nFlag) { +bool CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar, + bool& bExit, + uint32_t nFlag) { switch (nChar) { case FWL_VKEY_Up: case FWL_VKEY_Down: @@ -51,7 +50,7 @@ FX_BOOL CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar, case FWL_VKEY_Right: break; default: - return FALSE; + return false; } switch (nChar) { @@ -77,22 +76,22 @@ FX_BOOL CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar, break; } - OnNotifySelChanged(TRUE, bExit, nFlag); + OnNotifySelChanged(true, bExit, nFlag); - return TRUE; + return true; } -FX_BOOL CPWL_CBListBox::OnCharWithExit(uint16_t nChar, - FX_BOOL& bExit, - uint32_t nFlag) { +bool CPWL_CBListBox::OnCharWithExit(uint16_t nChar, + bool& bExit, + uint32_t nFlag) { if (!m_pList->OnChar(nChar, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag))) - return FALSE; + return false; if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetParentWindow()) pComboBox->SetSelectText(); - OnNotifySelChanged(TRUE, bExit, nFlag); + OnNotifySelChanged(true, bExit, nFlag); - return TRUE; + return true; } void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { @@ -163,8 +162,7 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } -FX_BOOL CPWL_CBButton::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_CBButton::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); SetCapture(); @@ -174,23 +172,22 @@ FX_BOOL CPWL_CBButton::OnLButtonDown(const CFX_FloatPoint& point, PWL_MAKEDWORD(point.x, point.y)); } - return TRUE; + return true; } -FX_BOOL CPWL_CBButton::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_CBButton::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); ReleaseCapture(); - return TRUE; + return true; } CPWL_ComboBox::CPWL_ComboBox() : m_pEdit(nullptr), m_pButton(nullptr), m_pList(nullptr), - m_bPopup(FALSE), + m_bPopup(false), m_nPopupWhere(0), m_nSelectItem(-1), m_pFillerNotify(nullptr) {} @@ -210,7 +207,7 @@ void CPWL_ComboBox::SetFocus() { } void CPWL_ComboBox::KillFocus() { - SetPopup(FALSE); + SetPopup(false); CPWL_Wnd::KillFocus(); } @@ -394,14 +391,14 @@ void CPWL_ComboBox::RePosChildWnd() { } if (m_pButton) - m_pButton->Move(rcButton, TRUE, FALSE); + m_pButton->Move(rcButton, true, false); if (m_pEdit) - m_pEdit->Move(rcEdit, TRUE, FALSE); + m_pEdit->Move(rcEdit, true, false); if (m_pList) { - m_pList->SetVisible(TRUE); - m_pList->Move(rcList, TRUE, FALSE); + m_pList->SetVisible(true); + m_pList->Move(rcList, true, false); m_pList->ScrollToListItem(m_nSelectItem); } } else { @@ -413,7 +410,7 @@ void CPWL_ComboBox::RePosChildWnd() { rcButton.left = rcClient.left; if (m_pButton) - m_pButton->Move(rcButton, TRUE, FALSE); + m_pButton->Move(rcButton, true, false); CFX_FloatRect rcEdit = rcClient; rcEdit.right = rcButton.left - 1.0f; @@ -425,10 +422,10 @@ void CPWL_ComboBox::RePosChildWnd() { rcEdit.right = rcEdit.left; if (m_pEdit) - m_pEdit->Move(rcEdit, TRUE, FALSE); + m_pEdit->Move(rcEdit, true, false); if (m_pList) - m_pList->SetVisible(FALSE); + m_pList->SetVisible(false); } } @@ -441,7 +438,7 @@ CFX_FloatRect CPWL_ComboBox::GetFocusRect() const { return CFX_FloatRect(); } -void CPWL_ComboBox::SetPopup(FX_BOOL bPopup) { +void CPWL_ComboBox::SetPopup(bool bPopup) { if (!m_pList) return; if (bPopup == m_bPopup) @@ -453,7 +450,7 @@ void CPWL_ComboBox::SetPopup(FX_BOOL bPopup) { if (bPopup) { if (m_pFillerNotify) { #ifdef PDF_ENABLE_XFA - FX_BOOL bExit = FALSE; + bool bExit = false; m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, 0); if (bExit) return; @@ -484,9 +481,9 @@ void CPWL_ComboBox::SetPopup(FX_BOOL bPopup) { } m_nPopupWhere = nWhere; - Move(rcWindow, TRUE, TRUE); + Move(rcWindow, true, true); #ifdef PDF_ENABLE_XFA - bExit = FALSE; + bExit = false; m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, 0); if (bExit) return; @@ -495,93 +492,93 @@ void CPWL_ComboBox::SetPopup(FX_BOOL bPopup) { } } else { m_bPopup = bPopup; - Move(m_rcOldWindow, TRUE, TRUE); + Move(m_rcOldWindow, true, true); } } -FX_BOOL CPWL_ComboBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) { +bool CPWL_ComboBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) { if (!m_pList) - return FALSE; + return false; if (!m_pEdit) - return FALSE; + return false; m_nSelectItem = -1; switch (nChar) { case FWL_VKEY_Up: if (m_pList->GetCurSel() > 0) { - FX_BOOL bExit = FALSE; + bool bExit = false; #ifdef PDF_ENABLE_XFA if (m_pFillerNotify) { m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, nFlag); if (bExit) - return FALSE; - bExit = FALSE; + return false; + bExit = false; m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, nFlag); if (bExit) - return FALSE; + return false; } #endif // PDF_ENABLE_XFA if (m_pList->OnKeyDownWithExit(nChar, bExit, nFlag)) { if (bExit) - return FALSE; + return false; SetSelectText(); } } - return TRUE; + return true; case FWL_VKEY_Down: if (m_pList->GetCurSel() < m_pList->GetCount() - 1) { - FX_BOOL bExit = FALSE; + bool bExit = false; #ifdef PDF_ENABLE_XFA if (m_pFillerNotify) { m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, nFlag); if (bExit) - return FALSE; - bExit = FALSE; + return false; + bExit = false; m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, nFlag); if (bExit) - return FALSE; + return false; } #endif // PDF_ENABLE_XFA if (m_pList->OnKeyDownWithExit(nChar, bExit, nFlag)) { if (bExit) - return FALSE; + return false; SetSelectText(); } } - return TRUE; + return true; } if (HasFlag(PCBS_ALLOWCUSTOMTEXT)) return m_pEdit->OnKeyDown(nChar, nFlag); - return FALSE; + return false; } -FX_BOOL CPWL_ComboBox::OnChar(uint16_t nChar, uint32_t nFlag) { +bool CPWL_ComboBox::OnChar(uint16_t nChar, uint32_t nFlag) { if (!m_pList) - return FALSE; + return false; if (!m_pEdit) - return FALSE; + return false; m_nSelectItem = -1; if (HasFlag(PCBS_ALLOWCUSTOMTEXT)) return m_pEdit->OnChar(nChar, nFlag); - FX_BOOL bExit = FALSE; + bool bExit = false; #ifdef PDF_ENABLE_XFA if (m_pFillerNotify) { m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, nFlag); if (bExit) - return FALSE; + return false; m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, nFlag); if (bExit) - return FALSE; + return false; } #endif // PDF_ENABLE_XFA - return m_pList->OnCharWithExit(nChar, bExit, nFlag) ? bExit : FALSE; + return m_pList->OnCharWithExit(nChar, bExit, nFlag) ? bExit : false; } void CPWL_ComboBox::OnNotify(CPWL_Wnd* pWnd, @@ -601,7 +598,7 @@ void CPWL_ComboBox::OnNotify(CPWL_Wnd* pWnd, SetSelectText(); SelectAll(); m_pEdit->SetFocus(); - SetPopup(FALSE); + SetPopup(false); return; } } @@ -610,7 +607,7 @@ void CPWL_ComboBox::OnNotify(CPWL_Wnd* pWnd, CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); } -FX_BOOL CPWL_ComboBox::IsPopup() const { +bool CPWL_ComboBox::IsPopup() const { return m_bPopup; } diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.h b/fpdfsdk/pdfwindow/PWL_ComboBox.h index 91b833c77f..84261199e9 100644 --- a/fpdfsdk/pdfwindow/PWL_ComboBox.h +++ b/fpdfsdk/pdfwindow/PWL_ComboBox.h @@ -23,10 +23,10 @@ class CPWL_CBListBox : public CPWL_ListBox { ~CPWL_CBListBox() override {} // CPWL_ListBox - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnKeyDownWithExit(uint16_t nChar, FX_BOOL& bExit, uint32_t nFlag); - FX_BOOL OnCharWithExit(uint16_t nChar, FX_BOOL& bExit, uint32_t nFlag); + bool OnKeyDownWithExit(uint16_t nChar, bool& bExit, uint32_t nFlag); + bool OnCharWithExit(uint16_t nChar, bool& bExit, uint32_t nFlag); }; #define PWL_COMBOBOX_BUTTON_WIDTH 13 @@ -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; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& 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 { @@ -54,8 +54,8 @@ class CPWL_ComboBox : public CPWL_Wnd { // CPWL_Wnd: CFX_ByteString GetClassName() const override; void OnCreate(PWL_CREATEPARAM& cp) override; - FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag) override; - FX_BOOL OnChar(uint16_t nChar, uint32_t nFlag) override; + bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; + bool OnChar(uint16_t nChar, uint32_t nFlag) override; void OnNotify(CPWL_Wnd* pWnd, uint32_t msg, intptr_t wParam = 0, @@ -78,7 +78,7 @@ class CPWL_ComboBox : public CPWL_Wnd { void GetEditSel(int32_t& nStartChar, int32_t& nEndChar) const; void Clear(); void SelectAll(); - FX_BOOL IsPopup() const; + bool IsPopup() const; void SetSelectText(); @@ -88,12 +88,12 @@ class CPWL_ComboBox : public CPWL_Wnd { void CreateEdit(const PWL_CREATEPARAM& cp); void CreateButton(const PWL_CREATEPARAM& cp); void CreateListBox(const PWL_CREATEPARAM& cp); - void SetPopup(FX_BOOL bPopup); + void SetPopup(bool bPopup); CPWL_CBEdit* m_pEdit; CPWL_CBButton* m_pButton; CPWL_CBListBox* m_pList; - FX_BOOL m_bPopup; + bool m_bPopup; CFX_FloatRect m_rcOldWindow; int32_t m_nPopupWhere; int32_t m_nSelectItem; diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index c8de0d2deb..153e9ab4b7 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -27,10 +27,10 @@ #include "third_party/base/stl_util.h" CPWL_Edit::CPWL_Edit() - : m_pFillerNotify(nullptr), m_bFocus(FALSE), m_pFormFiller(nullptr) {} + : m_pFillerNotify(nullptr), m_bFocus(false), m_pFormFiller(nullptr) {} CPWL_Edit::~CPWL_Edit() { - ASSERT(m_bFocus == FALSE); + ASSERT(m_bFocus == false); } CFX_ByteString CPWL_Edit::GetClassName() const { @@ -46,7 +46,7 @@ void CPWL_Edit::SetText(const CFX_WideString& csText) { if (CXML_Element* pXML = CXML_Element::Parse(sValue.c_str(), sValue.GetLength())) { int32_t nCount = pXML->CountChildren(); - FX_BOOL bFirst = TRUE; + bool bFirst = true; swText.clear(); @@ -61,7 +61,7 @@ void CPWL_Edit::SetText(const CFX_WideString& csText) { } if (bFirst) - bFirst = FALSE; + bFirst = false; else swText += FWL_VKEY_Return; swText += swSection; @@ -82,7 +82,7 @@ void CPWL_Edit::RePosChildWnd() { CFX_FloatRect rcVScroll = CFX_FloatRect(rcWindow.right, rcWindow.bottom, rcWindow.right + PWL_SCROLLBAR_WIDTH, rcWindow.top); - pVSB->Move(rcVScroll, TRUE, FALSE); + pVSB->Move(rcVScroll, true, false); } if (m_pEditCaret && !HasFlag(PES_TEXTOVERFLOW)) @@ -105,25 +105,24 @@ CFX_FloatRect CPWL_Edit::GetClientRect() const { return rcClient; } -void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, - FX_BOOL bPaint) { +void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, bool bPaint) { m_pEdit->SetAlignmentV((int32_t)nFormat, bPaint); } -FX_BOOL CPWL_Edit::CanSelectAll() const { +bool CPWL_Edit::CanSelectAll() const { return GetSelectWordRange() != m_pEdit->GetWholeWordRange(); } -FX_BOOL CPWL_Edit::CanClear() const { +bool CPWL_Edit::CanClear() const { return !IsReadOnly() && m_pEdit->IsSelected(); } -FX_BOOL CPWL_Edit::CanCopy() const { +bool CPWL_Edit::CanCopy() const { return !HasFlag(PES_PASSWORD) && !HasFlag(PES_NOREAD) && m_pEdit->IsSelected(); } -FX_BOOL CPWL_Edit::CanCut() const { +bool CPWL_Edit::CanCut() const { return CanCopy() && !IsReadOnly(); } void CPWL_Edit::CutText() { @@ -145,39 +144,39 @@ void CPWL_Edit::OnCreated() { m_rcOldWindow = GetWindowRect(); m_pEdit->SetOprNotify(this); - m_pEdit->EnableOprNotify(TRUE); + m_pEdit->EnableOprNotify(true); } void CPWL_Edit::SetParamByFlag() { if (HasFlag(PES_RIGHT)) { - m_pEdit->SetAlignmentH(2, FALSE); + m_pEdit->SetAlignmentH(2, false); } else if (HasFlag(PES_MIDDLE)) { - m_pEdit->SetAlignmentH(1, FALSE); + m_pEdit->SetAlignmentH(1, false); } else { - m_pEdit->SetAlignmentH(0, FALSE); + m_pEdit->SetAlignmentH(0, false); } if (HasFlag(PES_BOTTOM)) { - m_pEdit->SetAlignmentV(2, FALSE); + m_pEdit->SetAlignmentV(2, false); } else if (HasFlag(PES_CENTER)) { - m_pEdit->SetAlignmentV(1, FALSE); + m_pEdit->SetAlignmentV(1, false); } else { - m_pEdit->SetAlignmentV(0, FALSE); + m_pEdit->SetAlignmentV(0, false); } if (HasFlag(PES_PASSWORD)) { - m_pEdit->SetPasswordChar('*', FALSE); + m_pEdit->SetPasswordChar('*', false); } - m_pEdit->SetMultiLine(HasFlag(PES_MULTILINE), FALSE); - m_pEdit->SetAutoReturn(HasFlag(PES_AUTORETURN), FALSE); - m_pEdit->SetAutoFontSize(HasFlag(PWS_AUTOFONTSIZE), FALSE); - m_pEdit->SetAutoScroll(HasFlag(PES_AUTOSCROLL), FALSE); + m_pEdit->SetMultiLine(HasFlag(PES_MULTILINE), false); + m_pEdit->SetAutoReturn(HasFlag(PES_AUTORETURN), false); + m_pEdit->SetAutoFontSize(HasFlag(PWS_AUTOFONTSIZE), false); + m_pEdit->SetAutoScroll(HasFlag(PES_AUTOSCROLL), false); m_pEdit->EnableUndo(HasFlag(PES_UNDO)); if (HasFlag(PES_TEXTOVERFLOW)) { SetClipRect(CFX_FloatRect(0.0f, 0.0f, 0.0f, 0.0f)); - m_pEdit->SetTextOverflow(TRUE, FALSE); + m_pEdit->SetTextOverflow(true, false); } else { if (m_pEditCaret) { m_pEditCaret->SetClipRect(CPWL_Utils::InflateRect( @@ -197,8 +196,9 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (nCharArray > 0) { switch (GetBorderStyle()) { case BorderStyle::SOLID: { - sLine << "q\n" << GetBorderWidth() << " w\n" - << CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE) + sLine << "q\n" + << GetBorderWidth() << " w\n" + << CPWL_Utils::GetColorAppStream(GetBorderColor(), false) .AsStringC() << " 2 J 0 j\n"; @@ -215,8 +215,9 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { break; } case BorderStyle::DASH: { - sLine << "q\n" << GetBorderWidth() << " w\n" - << CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE) + sLine << "q\n" + << GetBorderWidth() << " w\n" + << CPWL_Utils::GetColorAppStream(GetBorderColor(), false) .AsStringC() << " 2 J 0 j\n" << "[" << GetBorderDash().nDash << " " << GetBorderDash().nGap @@ -397,66 +398,65 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, rcClip, CFX_FloatPoint(), pRange, pSysHandler, m_pFormFiller); } -FX_BOOL CPWL_Edit::OnLButtonDown(const CFX_FloatPoint& 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)) { if (m_bMouseDown) InvalidateRect(); - m_bMouseDown = TRUE; + m_bMouseDown = true; SetCapture(); m_pEdit->OnMouseDown(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); } - return TRUE; + return true; } -FX_BOOL CPWL_Edit::OnLButtonDblClk(const CFX_FloatPoint& 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)) { m_pEdit->SelectAll(); } - return TRUE; + return true; } -FX_BOOL CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { if (m_bMouseDown) - return FALSE; + return false; CPWL_Wnd::OnRButtonUp(point, nFlag); if (!HasFlag(PES_TEXTOVERFLOW) && !ClientHitTest(point)) - return TRUE; + return true; CFX_SystemHandler* pSH = GetSystemHandler(); if (!pSH) - return FALSE; + return false; SetFocus(); - return FALSE; + return false; } void CPWL_Edit::OnSetFocus() { - SetEditCaret(TRUE); + SetEditCaret(true); if (!IsReadOnly()) { if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler()) pFocusHandler->OnSetFocus(this); } - m_bFocus = TRUE; + m_bFocus = true; } void CPWL_Edit::OnKillFocus() { - ShowVScrollBar(FALSE); + ShowVScrollBar(false); m_pEdit->SelectNone(); - SetCaret(FALSE, CFX_FloatPoint(), CFX_FloatPoint()); + SetCaret(false, CFX_FloatPoint(), CFX_FloatPoint()); SetCharSet(FXFONT_ANSI_CHARSET); - m_bFocus = FALSE; + m_bFocus = false; } void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace) { @@ -520,7 +520,7 @@ CFX_FloatPoint CPWL_Edit::GetWordRightBottomPoint( return pt; } -FX_BOOL CPWL_Edit::IsTextFull() const { +bool CPWL_Edit::IsTextFull() const { return m_pEdit->IsTextFull(); } @@ -544,14 +544,14 @@ FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, void CPWL_Edit::SetCharArray(int32_t nCharArray) { if (HasFlag(PES_CHARARRAY) && nCharArray > 0) { m_pEdit->SetCharArray(nCharArray); - m_pEdit->SetTextOverflow(TRUE, TRUE); + m_pEdit->SetTextOverflow(true, true); if (HasFlag(PWS_AUTOFONTSIZE)) { if (IPVT_FontMap* pFontMap = GetFontMap()) { FX_FLOAT fFontSize = GetCharArrayAutoFontSize( pFontMap->GetPDFFont(0), GetClientRect(), nCharArray); if (fFontSize > 0.0f) { - m_pEdit->SetAutoFontSize(FALSE, TRUE); + m_pEdit->SetAutoFontSize(false, true); m_pEdit->SetFontSize(fFontSize); } } @@ -572,41 +572,41 @@ CFX_FloatRect CPWL_Edit::GetFocusRect() const { return CFX_FloatRect(); } -void CPWL_Edit::ShowVScrollBar(FX_BOOL bShow) { +void CPWL_Edit::ShowVScrollBar(bool bShow) { if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { if (bShow) { if (!pScroll->IsVisible()) { - pScroll->SetVisible(TRUE); + pScroll->SetVisible(true); CFX_FloatRect rcWindow = GetWindowRect(); m_rcOldWindow = rcWindow; rcWindow.right += PWL_SCROLLBAR_WIDTH; - Move(rcWindow, TRUE, TRUE); + Move(rcWindow, true, true); } } else { if (pScroll->IsVisible()) { - pScroll->SetVisible(FALSE); - Move(m_rcOldWindow, TRUE, TRUE); + pScroll->SetVisible(false); + Move(m_rcOldWindow, true, true); } } } } -FX_BOOL CPWL_Edit::IsVScrollBarVisible() const { +bool CPWL_Edit::IsVScrollBarVisible() const { if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { return pScroll->IsVisible(); } - return FALSE; + return false; } -FX_BOOL CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { +bool CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { if (m_bMouseDown) - return TRUE; + return true; if (nChar == FWL_VKEY_Delete) { if (m_pFillerNotify) { - FX_BOOL bRC = TRUE; - FX_BOOL bExit = FALSE; + bool bRC = true; + bool bExit = false; CFX_WideString strChange; CFX_WideString strChangeEx; @@ -617,20 +617,20 @@ FX_BOOL CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { if (nSelStart == nSelEnd) nSelEnd = nSelStart + 1; m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), strChange, - strChangeEx, nSelStart, nSelEnd, TRUE, + strChangeEx, nSelStart, nSelEnd, true, bRC, bExit, nFlag); if (!bRC) - return FALSE; + return false; if (bExit) - return FALSE; + return false; } } - FX_BOOL bRet = CPWL_EditCtrl::OnKeyDown(nChar, nFlag); + bool bRet = CPWL_EditCtrl::OnKeyDown(nChar, nFlag); // In case of implementation swallow the OnKeyDown event. if (IsProceedtoOnChar(nChar, nFlag)) - return TRUE; + return true; return bRet; } @@ -640,9 +640,9 @@ FX_BOOL CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { *If the event is swallowed, implementation may do other unexpected things, which *is not the control means to do. */ -FX_BOOL CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { - FX_BOOL bCtrl = IsCTRLpressed(nFlag); - FX_BOOL bAlt = IsALTpressed(nFlag); +bool CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { + bool bCtrl = IsCTRLpressed(nFlag); + bool bAlt = IsALTpressed(nFlag); if (bCtrl && !bAlt) { // hot keys for edit control. switch (nKeyCode) { @@ -651,7 +651,7 @@ FX_BOOL CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { case 'X': case 'A': case 'Z': - return TRUE; + return true; default: break; } @@ -662,18 +662,18 @@ FX_BOOL CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { case FWL_VKEY_Back: case FWL_VKEY_Return: case FWL_VKEY_Space: - return TRUE; + return true; default: - return FALSE; + return false; } } -FX_BOOL CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { +bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { if (m_bMouseDown) - return TRUE; + return true; - FX_BOOL bRC = TRUE; - FX_BOOL bExit = FALSE; + bool bRC = true; + bool bExit = false; if (!IsCTRLpressed(nFlag)) { if (m_pFillerNotify) { @@ -697,15 +697,15 @@ FX_BOOL CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { CFX_WideString strChangeEx; m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange, - strChangeEx, nSelStart, nSelEnd, TRUE, + strChangeEx, nSelStart, nSelEnd, true, bRC, bExit, nFlag); } } if (!bRC) - return TRUE; + return true; if (bExit) - return FALSE; + return false; if (IPVT_FontMap* pFontMap = GetFontMap()) { int32_t nOldCharSet = GetCharSet(); @@ -719,9 +719,9 @@ FX_BOOL CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { return CPWL_EditCtrl::OnChar(nChar, nFlag); } -FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_Edit::OnMouseWheel(short zDelta, + const CFX_FloatPoint& point, + uint32_t nFlag) { if (HasFlag(PES_MULTILINE)) { CFX_FloatPoint ptScroll = GetScrollPos(); @@ -732,10 +732,10 @@ FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta, } SetScrollPos(ptScroll); - return TRUE; + return true; } - return FALSE; + return false; } void CPWL_Edit::OnInsertReturn(const CPVT_WordPlace& place, @@ -807,25 +807,25 @@ CPVT_WordRange CPWL_Edit::CombineWordRange(const CPVT_WordRange& wr1, CPVT_WordRange CPWL_Edit::GetLatinWordsRange( const CFX_FloatPoint& point) const { - return GetSameWordsRange(m_pEdit->SearchWordPlace(point), TRUE, FALSE); + return GetSameWordsRange(m_pEdit->SearchWordPlace(point), true, false); } CPVT_WordRange CPWL_Edit::GetLatinWordsRange( const CPVT_WordPlace& place) const { - return GetSameWordsRange(place, TRUE, FALSE); + return GetSameWordsRange(place, true, false); } CPVT_WordRange CPWL_Edit::GetArabicWordsRange( const CPVT_WordPlace& place) const { - return GetSameWordsRange(place, FALSE, TRUE); + return GetSameWordsRange(place, false, true); } #define PWL_ISARABICWORD(word) \ ((word >= 0x0600 && word <= 0x06FF) || (word >= 0xFB50 && word <= 0xFEFC)) CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place, - FX_BOOL bLatin, - FX_BOOL bArabic) const { + bool bLatin, + bool bArabic) const { CPVT_WordRange range; CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); diff --git a/fpdfsdk/pdfwindow/PWL_Edit.h b/fpdfsdk/pdfwindow/PWL_Edit.h index ec0fd60ed8..3832236bda 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.h +++ b/fpdfsdk/pdfwindow/PWL_Edit.h @@ -30,16 +30,16 @@ class IPWL_Filler_Notify { const CFX_WideString& strChangeEx, int nSelStart, int nSelEnd, - FX_BOOL bKeyDown, - FX_BOOL& bRC, - FX_BOOL& bExit, + bool bKeyDown, + bool& bRC, + bool& bExit, uint32_t nFlag) = 0; #ifdef PDF_ENABLE_XFA virtual void OnPopupPreOpen(void* pPrivateData, - FX_BOOL& bExit, + bool& bExit, uint32_t nFlag) = 0; virtual void OnPopupPostOpen(void* pPrivateData, - FX_BOOL& bExit, + bool& bExit, uint32_t nFlag) = 0; #endif // PDF_ENABLE_XFA }; @@ -58,30 +58,30 @@ class CPWL_Edit : public CPWL_EditCtrl { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag) override; - FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag) override; - FX_BOOL OnChar(uint16_t nChar, 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_FloatPoint& point, + uint32_t nFlag) override; + bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; + bool OnChar(uint16_t nChar, uint32_t nFlag) override; CFX_FloatRect GetFocusRect() const override; void OnSetFocus() override; void OnKillFocus() override; void SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat = PEAV_TOP, - FX_BOOL bPaint = TRUE); // 0:top 1:bottom 2:center + bool bPaint = true); // 0:top 1:bottom 2:center void SetCharArray(int32_t nCharArray); void SetLimitChar(int32_t nLimitChar); void SetCharSpace(FX_FLOAT fCharSpace); - FX_BOOL CanSelectAll() const; - FX_BOOL CanClear() const; - FX_BOOL CanCopy() const; - FX_BOOL CanCut() const; + bool CanSelectAll() const; + bool CanClear() const; + bool CanCopy() const; + bool CanCut() const; void CutText(); @@ -93,7 +93,7 @@ class CPWL_Edit : public CPWL_EditCtrl { CFX_ByteString GetSelectAppearanceStream( const CFX_FloatPoint& ptOffset) const; - FX_BOOL IsTextFull() const; + bool IsTextFull() const; static FX_FLOAT GetCharArrayAutoFontSize(CPDF_Font* pFont, const CFX_FloatRect& rcPlate, @@ -109,7 +109,7 @@ class CPWL_Edit : public CPWL_EditCtrl { void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, const CFX_FloatPoint& ptOffset); - FX_BOOL IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag); + bool IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag); void AttachFFLData(CFFL_FormFiller* pData) { m_pFormFiller = pData; } void OnInsertWord(const CPVT_WordPlace& place, @@ -124,8 +124,8 @@ class CPWL_Edit : public CPWL_EditCtrl { private: CPVT_WordRange GetSelectWordRange() const; - virtual void ShowVScrollBar(FX_BOOL bShow); - FX_BOOL IsVScrollBarVisible() const; + virtual void ShowVScrollBar(bool bShow); + bool IsVScrollBarVisible() const; void SetParamByFlag(); FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray); @@ -137,10 +137,10 @@ class CPWL_Edit : public CPWL_EditCtrl { CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const; CPVT_WordRange GetArabicWordsRange(const CPVT_WordPlace& place) const; CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace& place, - FX_BOOL bLatin, - FX_BOOL bArabic) const; + bool bLatin, + bool bArabic) const; IPWL_Filler_Notify* m_pFillerNotify; - FX_BOOL m_bFocus; + bool m_bFocus; CFX_FloatRect m_rcOldWindow; CFFL_FormFiller* m_pFormFiller; // Not owned. }; diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp index 893ca932a2..94592159d4 100644 --- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp +++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp @@ -20,7 +20,7 @@ CPWL_EditCtrl::CPWL_EditCtrl() : m_pEdit(new CFX_Edit), m_pEditCaret(nullptr), - m_bMouseDown(FALSE), + m_bMouseDown(false), m_nCharSet(FXFONT_DEFAULT_CHARSET), m_nCodePage(0) {} @@ -38,7 +38,7 @@ void CPWL_EditCtrl::OnCreated() { m_pEdit->Initialize(); } -FX_BOOL CPWL_EditCtrl::IsWndHorV() { +bool CPWL_EditCtrl::IsWndHorV() { CFX_Matrix mt = GetWindowMatrix(); CFX_FloatPoint point1(0, 1); CFX_FloatPoint point2(1, 1); @@ -136,16 +136,16 @@ FX_FLOAT CPWL_EditCtrl::GetFontSize() const { return m_pEdit->GetFontSize(); } -FX_BOOL CPWL_EditCtrl::OnKeyDown(uint16_t nChar, uint32_t nFlag) { +bool CPWL_EditCtrl::OnKeyDown(uint16_t nChar, uint32_t nFlag) { if (m_bMouseDown) - return TRUE; + return true; - FX_BOOL bRet = CPWL_Wnd::OnKeyDown(nChar, nFlag); + bool bRet = CPWL_Wnd::OnKeyDown(nChar, nFlag); // FILTER switch (nChar) { default: - return FALSE; + return false; case FWL_VKEY_Delete: case FWL_VKEY_Up: case FWL_VKEY_Down: @@ -173,35 +173,35 @@ FX_BOOL CPWL_EditCtrl::OnKeyDown(uint16_t nChar, uint32_t nFlag) { switch (nChar) { case FWL_VKEY_Delete: Delete(); - return TRUE; + return true; case FWL_VKEY_Insert: if (IsSHIFTpressed(nFlag)) PasteText(); - return TRUE; + return true; case FWL_VKEY_Up: - m_pEdit->OnVK_UP(IsSHIFTpressed(nFlag), FALSE); - return TRUE; + m_pEdit->OnVK_UP(IsSHIFTpressed(nFlag), false); + return true; case FWL_VKEY_Down: - m_pEdit->OnVK_DOWN(IsSHIFTpressed(nFlag), FALSE); - return TRUE; + m_pEdit->OnVK_DOWN(IsSHIFTpressed(nFlag), false); + return true; case FWL_VKEY_Left: - m_pEdit->OnVK_LEFT(IsSHIFTpressed(nFlag), FALSE); - return TRUE; + m_pEdit->OnVK_LEFT(IsSHIFTpressed(nFlag), false); + return true; case FWL_VKEY_Right: - m_pEdit->OnVK_RIGHT(IsSHIFTpressed(nFlag), FALSE); - return TRUE; + m_pEdit->OnVK_RIGHT(IsSHIFTpressed(nFlag), false); + return true; case FWL_VKEY_Home: m_pEdit->OnVK_HOME(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); - return TRUE; + return true; case FWL_VKEY_End: m_pEdit->OnVK_END(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); - return TRUE; + return true; case FWL_VKEY_Unknown: if (!IsSHIFTpressed(nFlag)) Clear(); else CutText(); - return TRUE; + return true; default: break; } @@ -209,9 +209,9 @@ FX_BOOL CPWL_EditCtrl::OnKeyDown(uint16_t nChar, uint32_t nFlag) { return bRet; } -FX_BOOL CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { +bool CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { if (m_bMouseDown) - return TRUE; + return true; CPWL_Wnd::OnChar(nChar, nFlag); @@ -219,14 +219,14 @@ FX_BOOL CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { switch (nChar) { case 0x0A: case 0x1B: - return FALSE; + return false; default: break; } - FX_BOOL bCtrl = IsCTRLpressed(nFlag); - FX_BOOL bAlt = IsALTpressed(nFlag); - FX_BOOL bShift = IsSHIFTpressed(nFlag); + bool bCtrl = IsCTRLpressed(nFlag); + bool bAlt = IsALTpressed(nFlag); + bool bShift = IsSHIFTpressed(nFlag); uint16_t word = nChar; @@ -234,30 +234,30 @@ FX_BOOL CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { switch (nChar) { case 'C' - 'A' + 1: CopyText(); - return TRUE; + return true; case 'V' - 'A' + 1: PasteText(); - return TRUE; + return true; case 'X' - 'A' + 1: CutText(); - return TRUE; + return true; case 'A' - 'A' + 1: SelectAll(); - return TRUE; + return true; case 'Z' - 'A' + 1: if (bShift) Redo(); else Undo(); - return TRUE; + return true; default: if (nChar < 32) - return FALSE; + return false; } } if (IsReadOnly()) - return TRUE; + return true; if (m_pEdit->IsSelected() && word == FWL_VKEY_Back) word = FWL_VKEY_Unknown; @@ -278,28 +278,26 @@ FX_BOOL CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { break; } - return TRUE; + return true; } -FX_BOOL CPWL_EditCtrl::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_EditCtrl::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (ClientHitTest(point)) { if (m_bMouseDown) InvalidateRect(); - m_bMouseDown = TRUE; + m_bMouseDown = true; SetCapture(); m_pEdit->OnMouseDown(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); } - return TRUE; + return true; } -FX_BOOL CPWL_EditCtrl::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_EditCtrl::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (m_bMouseDown) { @@ -308,27 +306,26 @@ FX_BOOL CPWL_EditCtrl::OnLButtonUp(const CFX_FloatPoint& point, SetFocus(); ReleaseCapture(); - m_bMouseDown = FALSE; + m_bMouseDown = false; } - return TRUE; + return true; } -FX_BOOL CPWL_EditCtrl::OnMouseMove(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_EditCtrl::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnMouseMove(point, nFlag); if (m_bMouseDown) - m_pEdit->OnMouseMove(point, FALSE, FALSE); + m_pEdit->OnMouseMove(point, false, false); - return TRUE; + return true; } CFX_FloatRect CPWL_EditCtrl::GetContentRect() const { return m_pEdit->GetContentRect(); } -void CPWL_EditCtrl::SetEditCaret(FX_BOOL bVisible) { +void CPWL_EditCtrl::SetEditCaret(bool bVisible) { CFX_FloatPoint ptHead; CFX_FloatPoint ptFoot; if (bVisible) @@ -364,12 +361,12 @@ void CPWL_EditCtrl::GetCaretPos(int32_t& x, int32_t& y) const { PWLtoWnd(ptHead, x, y); } -void CPWL_EditCtrl::SetCaret(FX_BOOL bVisible, +void CPWL_EditCtrl::SetCaret(bool bVisible, const CFX_FloatPoint& ptHead, const CFX_FloatPoint& ptFoot) { if (m_pEditCaret) { if (!IsFocused() || m_pEdit->IsSelected()) - bVisible = FALSE; + bVisible = false; m_pEditCaret->SetCaret(bVisible, ptHead, ptFoot); } @@ -400,7 +397,7 @@ void CPWL_EditCtrl::Paint() { m_pEdit->Paint(); } -void CPWL_EditCtrl::EnableRefresh(FX_BOOL bRefresh) { +void CPWL_EditCtrl::EnableRefresh(bool bRefresh) { m_pEdit->EnableRefresh(bRefresh); } @@ -473,7 +470,7 @@ void CPWL_EditCtrl::PasteText() {} void CPWL_EditCtrl::CutText() {} -void CPWL_EditCtrl::ShowVScrollBar(FX_BOOL bShow) {} +void CPWL_EditCtrl::ShowVScrollBar(bool bShow) {} void CPWL_EditCtrl::InsertText(const CFX_WideString& wsText) { if (!IsReadOnly()) @@ -500,11 +497,11 @@ void CPWL_EditCtrl::Backspace() { m_pEdit->Backspace(); } -FX_BOOL CPWL_EditCtrl::CanUndo() const { +bool CPWL_EditCtrl::CanUndo() const { return !IsReadOnly() && m_pEdit->CanUndo(); } -FX_BOOL CPWL_EditCtrl::CanRedo() const { +bool CPWL_EditCtrl::CanRedo() const { return !IsReadOnly() && m_pEdit->CanRedo(); } @@ -536,9 +533,9 @@ void CPWL_EditCtrl::IOnSetScrollInfoY(FX_FLOAT fPlateMin, if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) || IsFloatEqual(Info.fPlateWidth, Info.fContentMax - Info.fContentMin)) { - ShowVScrollBar(FALSE); + ShowVScrollBar(false); } else { - ShowVScrollBar(TRUE); + ShowVScrollBar(true); } } @@ -546,7 +543,7 @@ void CPWL_EditCtrl::IOnSetScrollPosY(FX_FLOAT fy) { OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&fy); } -void CPWL_EditCtrl::IOnSetCaret(FX_BOOL bVisible, +void CPWL_EditCtrl::IOnSetCaret(bool bVisible, const CFX_FloatPoint& ptHead, const CFX_FloatPoint& ptFoot, const CPVT_WordPlace& place) { @@ -590,6 +587,6 @@ CFX_WideString CPWL_EditCtrl::GetText(int32_t& nStartChar, void CPWL_EditCtrl::SetReadyToInput() { if (m_bMouseDown) { ReleaseCapture(); - m_bMouseDown = FALSE; + m_bMouseDown = false; } } diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/pdfwindow/PWL_EditCtrl.h index 161bc57bb0..344d25b72b 100644 --- a/fpdfsdk/pdfwindow/PWL_EditCtrl.h +++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.h @@ -50,7 +50,7 @@ class CPWL_EditCtrl : public CPWL_Wnd { void Paint(); - void EnableRefresh(FX_BOOL bRefresh); + void EnableRefresh(bool bRefresh); CFX_FloatPoint GetScrollPos() const; void SetScrollPos(const CFX_FloatPoint& point); @@ -63,8 +63,8 @@ class CPWL_EditCtrl : public CPWL_Wnd { CPDF_Font* GetCaretFont() const; FX_FLOAT GetCaretFontSize() const; - FX_BOOL CanUndo() const; - FX_BOOL CanRedo() const; + bool CanUndo() const; + bool CanRedo() const; void Redo(); void Undo(); @@ -73,11 +73,11 @@ class CPWL_EditCtrl : public CPWL_Wnd { // CPWL_Wnd void OnCreate(PWL_CREATEPARAM& cp) override; void OnCreated() override; - FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag) override; - FX_BOOL OnChar(uint16_t nChar, uint32_t nFlag) override; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnMouseMove(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; + 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, @@ -95,7 +95,7 @@ class CPWL_EditCtrl : public CPWL_Wnd { FX_FLOAT fSmallStep, FX_FLOAT fBigStep); void IOnSetScrollPosY(FX_FLOAT fy); - void IOnSetCaret(FX_BOOL bVisible, + void IOnSetCaret(bool bVisible, const CFX_FloatPoint& ptHead, const CFX_FloatPoint& ptFoot, const CPVT_WordPlace& place); @@ -110,25 +110,25 @@ class CPWL_EditCtrl : public CPWL_Wnd { void CopyText(); void PasteText(); void CutText(); - void ShowVScrollBar(FX_BOOL bShow); + void ShowVScrollBar(bool bShow); void InsertWord(uint16_t word, int32_t nCharset); void InsertReturn(); - FX_BOOL IsWndHorV(); + bool IsWndHorV(); void Delete(); void Backspace(); void GetCaretInfo(CFX_FloatPoint& ptHead, CFX_FloatPoint& ptFoot) const; - void SetCaret(FX_BOOL bVisible, + void SetCaret(bool bVisible, const CFX_FloatPoint& ptHead, const CFX_FloatPoint& ptFoot); - void SetEditCaret(FX_BOOL bVisible); + void SetEditCaret(bool bVisible); std::unique_ptr m_pEdit; CPWL_Caret* m_pEditCaret; - FX_BOOL m_bMouseDown; + bool m_bMouseDown; private: void CreateEditCaret(const PWL_CREATEPARAM& cp); diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp index b2a1f2580d..15fbbeebf6 100644 --- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp @@ -76,14 +76,14 @@ CFX_ByteString CPWL_FontMap::GetPDFFontAlias(int32_t nFontIndex) { return ""; } -FX_BOOL CPWL_FontMap::KnowWord(int32_t nFontIndex, uint16_t word) { +bool CPWL_FontMap::KnowWord(int32_t nFontIndex, uint16_t word) { if (nFontIndex >= 0 && nFontIndex < m_aData.GetSize()) { if (m_aData.GetAt(nFontIndex)) { return CharCodeFromUnicode(nFontIndex, word) >= 0; } } - return FALSE; + return false; } int32_t CPWL_FontMap::GetWordFontIndex(uint16_t word, @@ -104,13 +104,13 @@ int32_t CPWL_FontMap::GetWordFontIndex(uint16_t word, } int32_t nNewFontIndex = - GetFontIndex(GetNativeFontName(nCharset), nCharset, TRUE); + GetFontIndex(GetNativeFontName(nCharset), nCharset, true); if (nNewFontIndex >= 0) { if (KnowWord(nNewFontIndex, word)) return nNewFontIndex; } nNewFontIndex = - GetFontIndex("Arial Unicode MS", FXFONT_DEFAULT_CHARSET, FALSE); + GetFontIndex("Arial Unicode MS", FXFONT_DEFAULT_CHARSET, false); if (nNewFontIndex >= 0) { if (KnowWord(nNewFontIndex, word)) return nNewFontIndex; @@ -170,16 +170,16 @@ void CPWL_FontMap::Empty() { } void CPWL_FontMap::Initialize() { - GetFontIndex(kDefaultFontName, FXFONT_ANSI_CHARSET, FALSE); + GetFontIndex(kDefaultFontName, FXFONT_ANSI_CHARSET, false); } -FX_BOOL CPWL_FontMap::IsStandardFont(const CFX_ByteString& sFontName) { +bool CPWL_FontMap::IsStandardFont(const CFX_ByteString& sFontName) { for (size_t i = 0; i < FX_ArraySize(g_sDEStandardFontName); ++i) { if (sFontName == g_sDEStandardFontName[i]) - return TRUE; + return true; } - return FALSE; + return false; } int32_t CPWL_FontMap::FindFont(const CFX_ByteString& sFontName, @@ -198,7 +198,7 @@ int32_t CPWL_FontMap::FindFont(const CFX_ByteString& sFontName, int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName, int32_t nCharset, - FX_BOOL bFind) { + bool bFind) { int32_t nFontIndex = FindFont(EncodeFontAlias(sFontName, nCharset), nCharset); if (nFontIndex >= 0) return nFontIndex; diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.h b/fpdfsdk/pdfwindow/PWL_FontMap.h index efbc2001b3..fbf5ee0986 100644 --- a/fpdfsdk/pdfwindow/PWL_FontMap.h +++ b/fpdfsdk/pdfwindow/PWL_FontMap.h @@ -56,12 +56,12 @@ class CPWL_FontMap : public IPVT_FontMap { int32_t nCharset); virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias); - FX_BOOL KnowWord(int32_t nFontIndex, uint16_t word); + bool KnowWord(int32_t nFontIndex, uint16_t word); void Empty(); int32_t GetFontIndex(const CFX_ByteString& sFontName, int32_t nCharset, - FX_BOOL bFind); + bool bFind); int32_t AddFontData(CPDF_Font* pFont, const CFX_ByteString& sFontAlias, int32_t nCharset = FXFONT_DEFAULT_CHARSET); @@ -81,7 +81,7 @@ class CPWL_FontMap : public IPVT_FontMap { CPDF_Font* AddFontToDocument(CPDF_Document* pDoc, CFX_ByteString& sFontName, uint8_t nCharset); - FX_BOOL IsStandardFont(const CFX_ByteString& sFontName); + bool IsStandardFont(const CFX_ByteString& sFontName); CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName); CPDF_Font* AddSystemFont(CPDF_Document* pDoc, CFX_ByteString& sFontName, diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp index 19adf91cfe..877921d6e8 100644 --- a/fpdfsdk/pdfwindow/PWL_Icon.cpp +++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp @@ -123,11 +123,11 @@ int32_t CPWL_Icon::GetScaleMethod() { return 0; } -FX_BOOL CPWL_Icon::IsProportionalScale() { +bool CPWL_Icon::IsProportionalScale() { if (m_pIconFit) return m_pIconFit->IsProportionalScale(); - return FALSE; + return false; } void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { diff --git a/fpdfsdk/pdfwindow/PWL_Icon.h b/fpdfsdk/pdfwindow/PWL_Icon.h index b3b59ca1ba..4b62db4c99 100644 --- a/fpdfsdk/pdfwindow/PWL_Icon.h +++ b/fpdfsdk/pdfwindow/PWL_Icon.h @@ -45,7 +45,7 @@ class CPWL_Icon : public CPWL_Image { void GetImageOffset(FX_FLOAT& x, FX_FLOAT& y) override; int32_t GetScaleMethod(); - FX_BOOL IsProportionalScale(); + bool IsProportionalScale(); void GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom); void SetIconFit(CPDF_IconFit* pIconFit) { m_pIconFit = pIconFit; } diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp index 8739c3b515..12cad7b9da 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp @@ -42,12 +42,12 @@ void CPWL_List_Notify::IOnSetScrollInfoY(FX_FLOAT fPlateMin, if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) || IsFloatEqual(Info.fPlateWidth, Info.fContentMax - Info.fContentMin)) { if (pScroll->IsVisible()) { - pScroll->SetVisible(FALSE); + pScroll->SetVisible(false); m_pList->RePosChildWnd(); } } else { if (!pScroll->IsVisible()) { - pScroll->SetVisible(TRUE); + pScroll->SetVisible(true); m_pList->RePosChildWnd(); } } @@ -64,8 +64,8 @@ void CPWL_List_Notify::IOnInvalidateRect(CFX_FloatRect* pRect) { CPWL_ListBox::CPWL_ListBox() : m_pList(new CFX_ListCtrl), - m_bMouseDown(FALSE), - m_bHoverSel(FALSE), + m_bMouseDown(false), + m_bHoverSel(false), m_pFillerNotify(nullptr) {} CPWL_ListBox::~CPWL_ListBox() { @@ -193,12 +193,12 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, } } -FX_BOOL CPWL_ListBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) { +bool CPWL_ListBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) { CPWL_Wnd::OnKeyDown(nChar, nFlag); switch (nChar) { default: - return FALSE; + return false; case FWL_VKEY_Up: case FWL_VKEY_Down: case FWL_VKEY_Home: @@ -231,58 +231,57 @@ FX_BOOL CPWL_ListBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) { break; } - FX_BOOL bExit = FALSE; - OnNotifySelChanged(TRUE, bExit, nFlag); + bool bExit = false; + OnNotifySelChanged(true, bExit, nFlag); - return TRUE; + return true; } -FX_BOOL CPWL_ListBox::OnChar(uint16_t nChar, uint32_t nFlag) { +bool CPWL_ListBox::OnChar(uint16_t nChar, uint32_t nFlag) { CPWL_Wnd::OnChar(nChar, nFlag); if (!m_pList->OnChar(nChar, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag))) - return FALSE; + return false; - FX_BOOL bExit = FALSE; - OnNotifySelChanged(TRUE, bExit, nFlag); + bool bExit = false; + OnNotifySelChanged(true, bExit, nFlag); - return TRUE; + return true; } -FX_BOOL CPWL_ListBox::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_ListBox::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (ClientHitTest(point)) { - m_bMouseDown = TRUE; + m_bMouseDown = true; SetFocus(); SetCapture(); m_pList->OnMouseDown(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); } - return TRUE; + return true; } -FX_BOOL CPWL_ListBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_ListBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (m_bMouseDown) { ReleaseCapture(); - m_bMouseDown = FALSE; + m_bMouseDown = false; } - FX_BOOL bExit = FALSE; - OnNotifySelChanged(FALSE, bExit, nFlag); + bool bExit = false; + OnNotifySelChanged(false, bExit, nFlag); - return TRUE; + return true; } -void CPWL_ListBox::SetHoverSel(FX_BOOL bHoverSel) { +void CPWL_ListBox::SetHoverSel(bool bHoverSel) { m_bHoverSel = bHoverSel; } -FX_BOOL CPWL_ListBox::OnMouseMove(const CFX_FloatPoint& 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)) @@ -290,7 +289,7 @@ FX_BOOL CPWL_ListBox::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { if (m_bMouseDown) m_pList->OnMouseMove(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); - return TRUE; + return true; } void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, @@ -341,13 +340,13 @@ void CPWL_ListBox::RePosChildWnd() { m_pList->SetPlateRect(GetListRect()); } -void CPWL_ListBox::OnNotifySelChanged(FX_BOOL bKeyDown, - FX_BOOL& bExit, +void CPWL_ListBox::OnNotifySelChanged(bool bKeyDown, + bool& bExit, uint32_t nFlag) { if (!m_pFillerNotify) return; - FX_BOOL bRC = TRUE; + bool bRC = true; CFX_WideString swChange = GetText(); CFX_WideString strChangeEx; int nSelStart = 0; @@ -407,7 +406,7 @@ void CPWL_ListBox::Reset() { m_pList->Cancel(); } -FX_BOOL CPWL_ListBox::IsMultipleSel() const { +bool CPWL_ListBox::IsMultipleSel() const { return m_pList->IsMultipleSel(); } @@ -419,7 +418,7 @@ int32_t CPWL_ListBox::GetCurSel() const { return m_pList->GetSelect(); } -FX_BOOL CPWL_ListBox::IsItemSelected(int32_t nItemIndex) const { +bool CPWL_ListBox::IsItemSelected(int32_t nItemIndex) const { return m_pList->IsItemSelected(nItemIndex); } @@ -449,15 +448,15 @@ CFX_FloatRect CPWL_ListBox::GetListRect() const { GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); } -FX_BOOL CPWL_ListBox::OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_ListBox::OnMouseWheel(short zDelta, + const CFX_FloatPoint& point, + uint32_t nFlag) { if (zDelta < 0) m_pList->OnVK_DOWN(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); else m_pList->OnVK_UP(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); - FX_BOOL bExit = FALSE; - OnNotifySelChanged(FALSE, bExit, nFlag); - return TRUE; + bool bExit = false; + OnNotifySelChanged(false, bExit, nFlag); + return true; } diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.h b/fpdfsdk/pdfwindow/PWL_ListBox.h index da7ae3d802..290b8762ef 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.h +++ b/fpdfsdk/pdfwindow/PWL_ListBox.h @@ -32,7 +32,7 @@ class CPWL_List_Notify { void IOnSetScrollPosY(FX_FLOAT fy); void IOnInvalidateRect(CFX_FloatRect* pRect); - void IOnSetCaret(FX_BOOL bVisible, + void IOnSetCaret(bool bVisible, const CFX_FloatPoint& ptHead, const CFX_FloatPoint& ptFoot, const CPVT_WordPlace& place); @@ -53,14 +53,14 @@ class CPWL_ListBox : public CPWL_Wnd { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag) override; - FX_BOOL OnChar(uint16_t nChar, uint32_t nFlag) override; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnMouseWheel(short zDelta, - 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; + 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_FloatPoint& point, + uint32_t nFlag) override; void KillFocus() override; void OnNotify(CPWL_Wnd* pWnd, uint32_t msg, @@ -73,7 +73,7 @@ class CPWL_ListBox : public CPWL_Wnd { virtual CFX_WideString GetText() const; - void OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL& bExit, uint32_t nFlag); + void OnNotifySelChanged(bool bKeyDown, bool& bExit, uint32_t nFlag); void AddString(const CFX_WideString& str); void SetTopVisibleIndex(int32_t nItemIndex); @@ -82,13 +82,13 @@ class CPWL_ListBox : public CPWL_Wnd { void Reset(); void Select(int32_t nItemIndex); void SetCaret(int32_t nItemIndex); - void SetHoverSel(FX_BOOL bHoverSel); + void SetHoverSel(bool bHoverSel); int32_t GetCount() const; - FX_BOOL IsMultipleSel() const; + bool IsMultipleSel() const; int32_t GetCaretIndex() const; int32_t GetCurSel() const; - FX_BOOL IsItemSelected(int32_t nItemIndex) const; + bool IsItemSelected(int32_t nItemIndex) const; int32_t GetTopVisibleIndex() const; int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const; CFX_FloatRect GetContentRect() const; @@ -104,8 +104,8 @@ class CPWL_ListBox : public CPWL_Wnd { protected: std::unique_ptr m_pList; std::unique_ptr m_pListNotify; - FX_BOOL m_bMouseDown; - FX_BOOL m_bHoverSel; + bool m_bMouseDown; + bool m_bHoverSel; IPWL_Filler_Notify* m_pFillerNotify; private: diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp index 684f6c337c..8a09ac6636 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp @@ -34,7 +34,7 @@ void PWL_FLOATRANGE::Set(FX_FLOAT min, FX_FLOAT max) { } } -FX_BOOL PWL_FLOATRANGE::In(FX_FLOAT x) const { +bool PWL_FLOATRANGE::In(FX_FLOAT x) const { return (IsFloatBigger(x, fMin) || IsFloatEqual(x, fMin)) && (IsFloatSmaller(x, fMax) || IsFloatEqual(x, fMax)); } @@ -76,12 +76,12 @@ void PWL_SCROLL_PRIVATEDATA::SetBigStep(FX_FLOAT step) { fBigStep = step; } -FX_BOOL PWL_SCROLL_PRIVATEDATA::SetPos(FX_FLOAT pos) { +bool PWL_SCROLL_PRIVATEDATA::SetPos(FX_FLOAT pos) { if (ScrollRange.In(pos)) { fScrollPos = pos; - return TRUE; + return true; } - return FALSE; + return false; } void PWL_SCROLL_PRIVATEDATA::AddSmall() { @@ -109,7 +109,7 @@ CPWL_SBButton::CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType, m_eScrollBarType = eScrollBarType; m_eSBButtonType = eButtonType; - m_bMouseDown = FALSE; + m_bMouseDown = false; } CPWL_SBButton::~CPWL_SBButton() {} @@ -323,7 +323,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, rcDraw = CPWL_Utils::DeflateRect(rectWnd, 1.0f); if (IsEnabled()) - CPWL_Utils::DrawShadow(pDevice, pUser2Device, TRUE, FALSE, rcDraw, + CPWL_Utils::DrawShadow(pDevice, pUser2Device, true, false, rcDraw, nTransparancy, 80, 220); else CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw, @@ -368,7 +368,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, // draw background rcDraw = CPWL_Utils::DeflateRect(rectWnd, 1.0f); if (IsEnabled()) - CPWL_Utils::DrawShadow(pDevice, pUser2Device, TRUE, FALSE, rcDraw, + CPWL_Utils::DrawShadow(pDevice, pUser2Device, true, false, rcDraw, nTransparancy, 80, 220); else CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw, @@ -536,41 +536,38 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } -FX_BOOL CPWL_SBButton::OnLButtonDown(const CFX_FloatPoint& 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()) pParent->OnNotify(this, PNM_LBUTTONDOWN, 0, (intptr_t)&point); - m_bMouseDown = TRUE; + m_bMouseDown = true; SetCapture(); - return TRUE; + return true; } -FX_BOOL CPWL_SBButton::OnLButtonUp(const CFX_FloatPoint& 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()) pParent->OnNotify(this, PNM_LBUTTONUP, 0, (intptr_t)&point); - m_bMouseDown = FALSE; + m_bMouseDown = false; ReleaseCapture(); - return TRUE; + return true; } -FX_BOOL CPWL_SBButton::OnMouseMove(const CFX_FloatPoint& 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()) { pParent->OnNotify(this, PNM_MOUSEMOVE, 0, (intptr_t)&point); } - return TRUE; + return true; } CPWL_ScrollBar::CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType) @@ -578,9 +575,9 @@ CPWL_ScrollBar::CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType) m_pMinButton(nullptr), m_pMaxButton(nullptr), m_pPosButton(nullptr), - m_bMouseDown(FALSE), - m_bMinOrMax(FALSE), - m_bNotifyForever(TRUE) {} + m_bMouseDown(false), + m_bMinOrMax(false), + m_bNotifyForever(true) {} CPWL_ScrollBar::~CPWL_ScrollBar() {} @@ -619,7 +616,7 @@ void CPWL_ScrollBar::RePosChildWnd() { rcMaxButton = CFX_FloatRect(rcClient.right - fBWidth, rcClient.bottom, rcClient.right, rcClient.top); } else { - SetVisible(FALSE); + SetVisible(false); } } break; @@ -645,17 +642,17 @@ void CPWL_ScrollBar::RePosChildWnd() { CFX_FloatRect(rcClient.left, rcClient.bottom, rcClient.right, rcClient.bottom + fBWidth); } else { - SetVisible(FALSE); + SetVisible(false); } } break; } if (m_pMinButton) - m_pMinButton->Move(rcMinButton, TRUE, FALSE); + m_pMinButton->Move(rcMinButton, true, false); if (m_pMaxButton) - m_pMaxButton->Move(rcMaxButton, TRUE, FALSE); - MovePosButton(FALSE); + m_pMaxButton->Move(rcMaxButton, true, false); + MovePosButton(false); } void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { @@ -666,7 +663,7 @@ void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { sButton << "q\n"; sButton << "0 w\n" - << CPWL_Utils::GetColorAppStream(GetBackgroundColor(), TRUE) + << CPWL_Utils::GetColorAppStream(GetBackgroundColor(), true) .AsStringC(); sButton << rectWnd.left << " " << rectWnd.bottom << " " << rectWnd.right - rectWnd.left << " " @@ -698,8 +695,8 @@ void CPWL_ScrollBar::DrawThisAppearance(CFX_RenderDevice* pDevice, } } -FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_ScrollBar::OnLButtonDown(const CFX_FloatPoint& point, + uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (HasFlag(PWS_AUTOTRANSPARENT)) { @@ -740,22 +737,21 @@ FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CFX_FloatPoint& point, if (rcMinArea.Contains(point.x, point.y)) { m_sData.SubBig(); - MovePosButton(TRUE); + MovePosButton(true); NotifyScrollWindow(); } if (rcMaxArea.Contains(point.x, point.y)) { m_sData.AddBig(); - MovePosButton(TRUE); + MovePosButton(true); NotifyScrollWindow(); } } - return TRUE; + return true; } -FX_BOOL CPWL_ScrollBar::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_ScrollBar::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (HasFlag(PWS_AUTOTRANSPARENT)) { @@ -766,9 +762,9 @@ FX_BOOL CPWL_ScrollBar::OnLButtonUp(const CFX_FloatPoint& point, } EndTimer(); - m_bMouseDown = FALSE; + m_bMouseDown = false; - return TRUE; + return true; } void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, @@ -864,7 +860,7 @@ void CPWL_ScrollBar::CreateButtons(const PWL_CREATEPARAM& cp) { if (!m_pPosButton) { m_pPosButton = new CPWL_SBButton(m_sbType, PSBT_POS); - m_pPosButton->SetVisible(FALSE); + m_pPosButton->SetVisible(false); m_pPosButton->Create(scp); } } @@ -884,10 +880,10 @@ void CPWL_ScrollBar::SetScrollRange(FX_FLOAT fMin, m_sData.SetClientWidth(fClientWidth); if (IsFloatSmaller(m_sData.ScrollRange.GetWidth(), 0.0f)) { - m_pPosButton->SetVisible(FALSE); + m_pPosButton->SetVisible(false); } else { - m_pPosButton->SetVisible(TRUE); - MovePosButton(TRUE); + m_pPosButton->SetVisible(true); + MovePosButton(true); } } } @@ -898,7 +894,7 @@ void CPWL_ScrollBar::SetScrollPos(FX_FLOAT fPos) { m_sData.SetPos(fPos); if (!IsFloatEqual(m_sData.fScrollPos, fOldPos)) - MovePosButton(TRUE); + MovePosButton(true); } void CPWL_ScrollBar::SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep) { @@ -906,7 +902,7 @@ void CPWL_ScrollBar::SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep) { m_sData.SetSmallStep(fSmallStep); } -void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) { +void CPWL_ScrollBar::MovePosButton(bool bRefresh) { ASSERT(m_pMinButton); ASSERT(m_pMaxButton); @@ -954,16 +950,16 @@ void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) { break; } - m_pPosButton->Move(rcPosButton, TRUE, bRefresh); + m_pPosButton->Move(rcPosButton, true, bRefresh); } } void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_FloatPoint& point) { m_sData.SubSmall(); - MovePosButton(TRUE); + MovePosButton(true); NotifyScrollWindow(); - m_bMinOrMax = TRUE; + m_bMinOrMax = true; EndTimer(); BeginTimer(100); @@ -975,10 +971,10 @@ void CPWL_ScrollBar::OnMinButtonMouseMove(const CFX_FloatPoint& point) {} void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_FloatPoint& point) { m_sData.AddSmall(); - MovePosButton(TRUE); + MovePosButton(true); NotifyScrollWindow(); - m_bMinOrMax = FALSE; + m_bMinOrMax = false; EndTimer(); BeginTimer(100); @@ -989,7 +985,7 @@ void CPWL_ScrollBar::OnMaxButtonLBUp(const CFX_FloatPoint& point) {} void CPWL_ScrollBar::OnMaxButtonMouseMove(const CFX_FloatPoint& point) {} void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_FloatPoint& point) { - m_bMouseDown = TRUE; + m_bMouseDown = true; if (m_pPosButton) { CFX_FloatRect rcPosButton = m_pPosButton->GetWindowRect(); @@ -1012,7 +1008,7 @@ void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_FloatPoint& point) { if (!m_bNotifyForever) NotifyScrollWindow(); } - m_bMouseDown = FALSE; + m_bMouseDown = false; } void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_FloatPoint& point) { @@ -1064,7 +1060,7 @@ void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_FloatPoint& point) { } if (!IsFloatEqual(fOldScrollPos, m_sData.fScrollPos)) { - MovePosButton(TRUE); + MovePosButton(true); if (m_bNotifyForever) NotifyScrollWindow(); @@ -1188,7 +1184,7 @@ void CPWL_ScrollBar::TimerProc() { m_sData.AddSmall(); if (sTemp != m_sData) { - MovePosButton(TRUE); + MovePosButton(true); NotifyScrollWindow(); } } diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/pdfwindow/PWL_ScrollBar.h index ae71472696..19e5151c97 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.h +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.h @@ -53,15 +53,15 @@ class CPWL_SBButton : public CPWL_Wnd { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnMouseMove(const CFX_FloatPoint& 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; PWL_SBBUTTON_TYPE m_eSBButtonType; - FX_BOOL m_bMouseDown; + bool m_bMouseDown; }; struct PWL_FLOATRANGE { @@ -76,7 +76,7 @@ struct PWL_FLOATRANGE { void Default(); void Set(FX_FLOAT min, FX_FLOAT max); - FX_BOOL In(FX_FLOAT x) const; + bool In(FX_FLOAT x) const; FX_FLOAT GetWidth() const; FX_FLOAT fMin; @@ -101,7 +101,7 @@ struct PWL_SCROLL_PRIVATEDATA { void SetClientWidth(FX_FLOAT width); void SetSmallStep(FX_FLOAT step); void SetBigStep(FX_FLOAT step); - FX_BOOL SetPos(FX_FLOAT pos); + bool SetPos(FX_FLOAT pos); void AddSmall(); void SubSmall(); @@ -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; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& 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, @@ -139,12 +139,12 @@ class CPWL_ScrollBar : public CPWL_Wnd { FX_FLOAT GetScrollBarWidth() const; PWL_SCROLLBAR_TYPE GetScrollBarType() const { return m_sbType; } - void SetNotifyForever(FX_BOOL bForever) { m_bNotifyForever = bForever; } + void SetNotifyForever(bool bForever) { m_bNotifyForever = bForever; } protected: void SetScrollRange(FX_FLOAT fMin, FX_FLOAT fMax, FX_FLOAT fClientWidth); void SetScrollPos(FX_FLOAT fPos); - void MovePosButton(FX_BOOL bRefresh); + void MovePosButton(bool bRefresh); void SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep); void NotifyScrollWindow(); CFX_FloatRect GetScrollArea() const; @@ -173,9 +173,9 @@ class CPWL_ScrollBar : public CPWL_Wnd { CPWL_SBButton* m_pMaxButton; CPWL_SBButton* m_pPosButton; PWL_SCROLL_PRIVATEDATA m_sData; - FX_BOOL m_bMouseDown; - FX_BOOL m_bMinOrMax; - FX_BOOL m_bNotifyForever; + bool m_bMouseDown; + bool m_bMinOrMax; + bool m_bNotifyForever; FX_FLOAT m_nOldPos; FX_FLOAT m_fOldPosButton; }; diff --git a/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp b/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp index b0b944e5aa..defb992c57 100644 --- a/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp +++ b/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp @@ -37,18 +37,17 @@ bool CPWL_CheckBox::IsChecked() const { return m_bChecked; } -FX_BOOL CPWL_CheckBox::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_CheckBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { if (IsReadOnly()) - return FALSE; + return false; SetCheck(!IsChecked()); - return TRUE; + return true; } -FX_BOOL CPWL_CheckBox::OnChar(uint16_t nChar, uint32_t nFlag) { +bool CPWL_CheckBox::OnChar(uint16_t nChar, uint32_t nFlag) { SetCheck(!IsChecked()); - return TRUE; + return true; } CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(false) {} @@ -59,13 +58,13 @@ CFX_ByteString CPWL_RadioButton::GetClassName() const { return "CPWL_RadioButton"; } -FX_BOOL CPWL_RadioButton::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_RadioButton::OnLButtonUp(const CFX_FloatPoint& point, + uint32_t nFlag) { if (IsReadOnly()) - return FALSE; + return false; - SetCheck(TRUE); - return TRUE; + SetCheck(true); + return true; } void CPWL_RadioButton::SetCheck(bool bCheck) { @@ -76,7 +75,7 @@ bool CPWL_RadioButton::IsChecked() const { return m_bChecked; } -FX_BOOL CPWL_RadioButton::OnChar(uint16_t nChar, uint32_t nFlag) { - SetCheck(TRUE); - return TRUE; +bool CPWL_RadioButton::OnChar(uint16_t nChar, uint32_t nFlag) { + SetCheck(true); + return true; } diff --git a/fpdfsdk/pdfwindow/PWL_SpecialButton.h b/fpdfsdk/pdfwindow/PWL_SpecialButton.h index eaaba26c68..0aa6c4510b 100644 --- a/fpdfsdk/pdfwindow/PWL_SpecialButton.h +++ b/fpdfsdk/pdfwindow/PWL_SpecialButton.h @@ -26,8 +26,8 @@ class CPWL_CheckBox : public CPWL_Button { // CPWL_Button CFX_ByteString GetClassName() const override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnChar(uint16_t nChar, 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); bool IsChecked() const; @@ -43,8 +43,8 @@ class CPWL_RadioButton : public CPWL_Button { // CPWL_Button CFX_ByteString GetClassName() const override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnChar(uint16_t nChar, 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); bool IsChecked() const; diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp index cf6c3d6f1f..eb6b3cc221 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp @@ -88,14 +88,14 @@ CFX_FloatRect CPWL_Utils::OffsetRect(const CFX_FloatRect& rect, rect.top + y); } -FX_BOOL CPWL_Utils::ContainsRect(const CFX_FloatRect& rcParent, - const CFX_FloatRect& rcChild) { +bool CPWL_Utils::ContainsRect(const CFX_FloatRect& rcParent, + const CFX_FloatRect& rcChild) { return rcChild.left >= rcParent.left && rcChild.bottom >= rcParent.bottom && rcChild.right <= rcParent.right && rcChild.top <= rcParent.top; } -FX_BOOL CPWL_Utils::IntersectRect(const CFX_FloatRect& rect1, - const CFX_FloatRect& rect2) { +bool CPWL_Utils::IntersectRect(const CFX_FloatRect& rect1, + const CFX_FloatRect& rect2) { FX_FLOAT left = rect1.left > rect2.left ? rect1.left : rect2.left; FX_FLOAT right = rect1.right < rect2.right ? rect1.right : rect2.right; FX_FLOAT bottom = rect1.bottom > rect2.bottom ? rect1.bottom : rect2.bottom; @@ -375,7 +375,7 @@ CFX_FloatRect CPWL_Utils::ScaleRect(const CFX_FloatRect& rcRect, CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CFX_FloatRect& rect, const CPWL_Color& color) { CFX_ByteTextBuf sAppStream; - CFX_ByteString sColor = GetColorAppStream(color, TRUE); + CFX_ByteString sColor = GetColorAppStream(color, true); if (sColor.GetLength() > 0) { sAppStream << "q\n" << sColor; sAppStream << rect.left << " " << rect.bottom << " " @@ -389,7 +389,7 @@ CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CFX_FloatRect& rect, CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CFX_FloatRect& rect, const CPWL_Color& color) { CFX_ByteTextBuf sAppStream; - CFX_ByteString sColor = GetColorAppStream(color, TRUE); + CFX_ByteString sColor = GetColorAppStream(color, true); if (sColor.GetLength() > 0) { sAppStream << "q\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << "f\nQ\n"; } @@ -412,7 +412,7 @@ CFX_FloatRect CPWL_Utils::GetCenterSquare(const CFX_FloatRect& rect) { CFX_ByteString CPWL_Utils::GetEditAppStream(CFX_Edit* pEdit, const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange, - FX_BOOL bContinuous, + bool bContinuous, uint16_t SubWord) { return CFX_Edit::GetEditAppearanceStream(pEdit, ptOffset, pRange, bContinuous, SubWord); @@ -430,20 +430,20 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox, int32_t nAlignmentH, int32_t nAlignmentV, FX_FLOAT fFontSize, - FX_BOOL bMultiLine, - FX_BOOL bAutoReturn, + bool bMultiLine, + bool bAutoReturn, const CPWL_Color& crText) { CFX_ByteTextBuf sRet; std::unique_ptr pEdit(new CFX_Edit); pEdit->SetFontMap(pFontMap); pEdit->SetPlateRect(rcBBox); - pEdit->SetAlignmentH(nAlignmentH, TRUE); - pEdit->SetAlignmentV(nAlignmentV, TRUE); - pEdit->SetMultiLine(bMultiLine, TRUE); - pEdit->SetAutoReturn(bAutoReturn, TRUE); + pEdit->SetAlignmentH(nAlignmentH, true); + pEdit->SetAlignmentV(nAlignmentV, true); + pEdit->SetMultiLine(bMultiLine, true); + pEdit->SetAutoReturn(bAutoReturn, true); if (IsFloatZero(fFontSize)) - pEdit->SetAutoFontSize(TRUE, TRUE); + pEdit->SetAutoFontSize(true, true); else pEdit->SetFontSize(fFontSize); @@ -470,12 +470,12 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, std::unique_ptr pEdit(new CFX_Edit); pEdit->SetFontMap(pFontMap); - pEdit->SetAlignmentH(1, TRUE); - pEdit->SetAlignmentV(1, TRUE); - pEdit->SetMultiLine(FALSE, TRUE); - pEdit->SetAutoReturn(FALSE, TRUE); + pEdit->SetAlignmentH(1, true); + pEdit->SetAlignmentV(1, true); + pEdit->SetMultiLine(false, true); + pEdit->SetAutoReturn(false, true); if (IsFloatZero(fFontSize)) - pEdit->SetAutoFontSize(TRUE, TRUE); + pEdit->SetAutoFontSize(true, true); else pEdit->SetFontSize(fFontSize); @@ -654,7 +654,7 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, CFX_ByteTextBuf sAppStream, sTemp; if (!rcIcon.IsEmpty()) { - Icon.Move(rcIcon, FALSE, FALSE); + Icon.Move(rcIcon, false, false); sTemp << Icon.GetImageAppStream(); } @@ -681,7 +681,7 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, } CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color& color, - const FX_BOOL& bFillOrStroke) { + const bool& bFillOrStroke) { CFX_ByteTextBuf sColorStream; switch (color.nColorType) { @@ -727,7 +727,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, switch (nStyle) { default: case BorderStyle::SOLID: - sColor = CPWL_Utils::GetColorAppStream(color, TRUE); + sColor = CPWL_Utils::GetColorAppStream(color, true); if (sColor.GetLength() > 0) { sAppStream << sColor; sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " @@ -739,7 +739,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, } break; case BorderStyle::DASH: - sColor = CPWL_Utils::GetColorAppStream(color, FALSE); + sColor = CPWL_Utils::GetColorAppStream(color, false); if (sColor.GetLength() > 0) { sAppStream << sColor; sAppStream << fWidth << " w" @@ -759,7 +759,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, break; case BorderStyle::BEVELED: case BorderStyle::INSET: - sColor = CPWL_Utils::GetColorAppStream(crLeftTop, TRUE); + sColor = CPWL_Utils::GetColorAppStream(crLeftTop, true); if (sColor.GetLength() > 0) { sAppStream << sColor; sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth @@ -776,7 +776,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, << fBottom + fHalfWidth * 2 << " l f\n"; } - sColor = CPWL_Utils::GetColorAppStream(crRightBottom, TRUE); + sColor = CPWL_Utils::GetColorAppStream(crRightBottom, true); if (sColor.GetLength() > 0) { sAppStream << sColor; sAppStream << fRight - fHalfWidth << " " << fTop - fHalfWidth @@ -793,7 +793,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, << " l f\n"; } - sColor = CPWL_Utils::GetColorAppStream(color, TRUE); + sColor = CPWL_Utils::GetColorAppStream(color, true); if (sColor.GetLength() > 0) { sAppStream << sColor; sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " @@ -804,7 +804,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, } break; case BorderStyle::UNDERLINE: - sColor = CPWL_Utils::GetColorAppStream(color, FALSE); + sColor = CPWL_Utils::GetColorAppStream(color, false); if (sColor.GetLength() > 0) { sAppStream << sColor; sAppStream << fWidth << " w\n"; @@ -838,7 +838,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( default: case BorderStyle::SOLID: case BorderStyle::UNDERLINE: { - sColor = CPWL_Utils::GetColorAppStream(color, FALSE); + sColor = CPWL_Utils::GetColorAppStream(color, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fWidth << " w\n" << sColor << CPWL_Utils::GetAP_Circle( @@ -847,7 +847,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( } } break; case BorderStyle::DASH: { - sColor = CPWL_Utils::GetColorAppStream(color, FALSE); + sColor = CPWL_Utils::GetColorAppStream(color, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fWidth << " w\n" << "[" << dash.nDash << " " << dash.nGap << "] " @@ -860,13 +860,13 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( case BorderStyle::BEVELED: { FX_FLOAT fHalfWidth = fWidth / 2.0f; - sColor = CPWL_Utils::GetColorAppStream(color, FALSE); + sColor = CPWL_Utils::GetColorAppStream(color, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << " S\nQ\n"; } - sColor = CPWL_Utils::GetColorAppStream(crLeftTop, FALSE); + sColor = CPWL_Utils::GetColorAppStream(crLeftTop, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_HalfCircle( @@ -875,7 +875,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( << " S\nQ\n"; } - sColor = CPWL_Utils::GetColorAppStream(crRightBottom, FALSE); + sColor = CPWL_Utils::GetColorAppStream(crRightBottom, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_HalfCircle( @@ -887,13 +887,13 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( case BorderStyle::INSET: { FX_FLOAT fHalfWidth = fWidth / 2.0f; - sColor = CPWL_Utils::GetColorAppStream(color, FALSE); + sColor = CPWL_Utils::GetColorAppStream(color, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << " S\nQ\n"; } - sColor = CPWL_Utils::GetColorAppStream(crLeftTop, FALSE); + sColor = CPWL_Utils::GetColorAppStream(crLeftTop, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_HalfCircle( @@ -902,7 +902,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( << " S\nQ\n"; } - sColor = CPWL_Utils::GetColorAppStream(crRightBottom, FALSE); + sColor = CPWL_Utils::GetColorAppStream(crRightBottom, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_HalfCircle( @@ -973,7 +973,8 @@ CPWL_Color CPWL_Utils::DevideColor(const CPWL_Color& sColor, CFX_ByteString CPWL_Utils::GetAppStream_Check(const CFX_FloatRect& rcBBox, const CPWL_Color& crText) { CFX_ByteTextBuf sAP; - sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) + sAP << "q\n" + << CPWL_Utils::GetColorAppStream(crText, true) << CPWL_Utils::GetAP_Check(rcBBox) << "f\nQ\n"; return sAP.MakeString(); } @@ -981,7 +982,8 @@ CFX_ByteString CPWL_Utils::GetAppStream_Check(const CFX_FloatRect& rcBBox, CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CFX_FloatRect& rcBBox, const CPWL_Color& crText) { CFX_ByteTextBuf sAP; - sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) + sAP << "q\n" + << CPWL_Utils::GetColorAppStream(crText, true) << CPWL_Utils::GetAP_Circle(rcBBox) << "f\nQ\n"; return sAP.MakeString(); } @@ -989,7 +991,8 @@ CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CFX_FloatRect& rcBBox, CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CFX_FloatRect& rcBBox, const CPWL_Color& crText) { CFX_ByteTextBuf sAP; - sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, FALSE) + sAP << "q\n" + << CPWL_Utils::GetColorAppStream(crText, false) << CPWL_Utils::GetAP_Cross(rcBBox) << "S\nQ\n"; return sAP.MakeString(); } @@ -997,7 +1000,8 @@ CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CFX_FloatRect& rcBBox, CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CFX_FloatRect& rcBBox, const CPWL_Color& crText) { CFX_ByteTextBuf sAP; - sAP << "q\n1 w\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) + sAP << "q\n1 w\n" + << CPWL_Utils::GetColorAppStream(crText, true) << CPWL_Utils::GetAP_Diamond(rcBBox) << "f\nQ\n"; return sAP.MakeString(); } @@ -1005,7 +1009,8 @@ CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CFX_FloatRect& rcBBox, CFX_ByteString CPWL_Utils::GetAppStream_Square(const CFX_FloatRect& rcBBox, const CPWL_Color& crText) { CFX_ByteTextBuf sAP; - sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) + sAP << "q\n" + << CPWL_Utils::GetColorAppStream(crText, true) << CPWL_Utils::GetAP_Square(rcBBox) << "f\nQ\n"; return sAP.MakeString(); } @@ -1013,7 +1018,8 @@ CFX_ByteString CPWL_Utils::GetAppStream_Square(const CFX_FloatRect& rcBBox, CFX_ByteString CPWL_Utils::GetAppStream_Star(const CFX_FloatRect& rcBBox, const CPWL_Color& crText) { CFX_ByteTextBuf sAP; - sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) + sAP << "q\n" + << CPWL_Utils::GetColorAppStream(crText, true) << CPWL_Utils::GetAP_Star(rcBBox) << "f\nQ\n"; return sAP.MakeString(); } @@ -1064,10 +1070,11 @@ CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CFX_FloatRect& rcBBox) { CFX_ByteTextBuf sAppStream; if (!rcBBox.IsEmpty()) { - sAppStream << "q\n" << CPWL_Utils::GetColorAppStream( - CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f, - 220.0f / 255.0f, 220.0f / 255.0f), - TRUE); + sAppStream << "q\n" + << CPWL_Utils::GetColorAppStream( + CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f, + 220.0f / 255.0f, 220.0f / 255.0f), + true); sAppStream << rcBBox.left << " " << rcBBox.bottom << " " << rcBBox.right - rcBBox.left << " " << rcBBox.top - rcBBox.bottom << " re f\n"; @@ -1278,8 +1285,8 @@ void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - FX_BOOL bVertical, - FX_BOOL bHorizontal, + bool bVertical, + bool bHorizontal, CFX_FloatRect rect, int32_t nTransparancy, int32_t nStartGray, @@ -1442,10 +1449,10 @@ void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, } } -FX_BOOL CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color) { +bool CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color) { switch (color.nColorType) { case COLORTYPE_TRANSPARENT: - return FALSE; + return false; case COLORTYPE_GRAY: return color.fColor1 < 0.5f; case COLORTYPE_RGB: @@ -1455,7 +1462,7 @@ FX_BOOL CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color) { 2.0f; } - return TRUE; + return true; } CPWL_Color CPWL_Utils::GetReverseColor(const CPWL_Color& color) { @@ -1485,8 +1492,8 @@ CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType, const CFX_FloatRect& rect, const CPWL_Color& crFill, const CPWL_Color& crStroke) { - CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, FALSE); - sAppStream += CPWL_Utils::GetColorAppStream(crFill, TRUE); + CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, false); + sAppStream += CPWL_Utils::GetColorAppStream(crFill, true); CFX_ByteString sPath; CFX_PathData path; diff --git a/fpdfsdk/pdfwindow/PWL_Utils.h b/fpdfsdk/pdfwindow/PWL_Utils.h index bdcba968a6..f14c3c7963 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.h +++ b/fpdfsdk/pdfwindow/PWL_Utils.h @@ -104,10 +104,10 @@ class CPWL_Utils { public: static CFX_FloatRect InflateRect(const CFX_FloatRect& rcRect, FX_FLOAT fSize); static CFX_FloatRect DeflateRect(const CFX_FloatRect& rcRect, FX_FLOAT fSize); - static FX_BOOL IntersectRect(const CFX_FloatRect& rect1, - const CFX_FloatRect& rect2); - static FX_BOOL ContainsRect(const CFX_FloatRect& rcParent, - const CFX_FloatRect& rcChild); + static bool IntersectRect(const CFX_FloatRect& rect1, + const CFX_FloatRect& rect2); + static bool ContainsRect(const CFX_FloatRect& rcParent, + const CFX_FloatRect& rcChild); static CFX_FloatRect ScaleRect(const CFX_FloatRect& rcRect, FX_FLOAT fScale); static CPVT_WordRange OverlapWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2); @@ -126,11 +126,11 @@ class CPWL_Utils { FX_FLOAT y); static FX_COLORREF PWLColorToFXColor(const CPWL_Color& color, int32_t nTransparancy = 255); - static FX_BOOL IsBlackOrWhite(const CPWL_Color& color); + static bool IsBlackOrWhite(const CPWL_Color& color); static CPWL_Color GetReverseColor(const CPWL_Color& color); static CFX_ByteString GetColorAppStream(const CPWL_Color& color, - const FX_BOOL& bFillOrStroke = TRUE); + const bool& bFillOrStroke = true); static CFX_ByteString GetBorderAppStream(const CFX_FloatRect& rect, FX_FLOAT fWidth, const CPWL_Color& color, @@ -169,7 +169,7 @@ class CPWL_Utils { static CFX_ByteString GetEditAppStream(CFX_Edit* pEdit, const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange = nullptr, - FX_BOOL bContinuous = TRUE, + bool bContinuous = true, uint16_t SubWord = 0); static CFX_ByteString GetEditSelAppStream( CFX_Edit* pEdit, @@ -181,8 +181,8 @@ class CPWL_Utils { int32_t nAlignmentH, int32_t nAlignmentV, FX_FLOAT fFontSize, - FX_BOOL bMultiLine, - FX_BOOL bAutoReturn, + bool bMultiLine, + bool bAutoReturn, const CPWL_Color& crText); static CFX_ByteString GetDropButtonAppStream(const CFX_FloatRect& rcBBox); @@ -222,8 +222,8 @@ class CPWL_Utils { const FX_COLORREF& color); static void DrawShadow(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - FX_BOOL bVertical, - FX_BOOL bHorizontal, + bool bVertical, + bool bHorizontal, CFX_FloatRect rect, int32_t nTransparancy, int32_t nStartGray, diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp index 729b27ca5d..78a4363aa5 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp @@ -117,38 +117,38 @@ class CPWL_MsgControl { m_pMainKeyboardWnd = nullptr; } - FX_BOOL IsWndCreated(const CPWL_Wnd* pWnd) const { + bool IsWndCreated(const CPWL_Wnd* pWnd) const { return m_pCreatedWnd == pWnd; } - FX_BOOL IsMainCaptureMouse(const CPWL_Wnd* pWnd) const { + bool IsMainCaptureMouse(const CPWL_Wnd* pWnd) const { return pWnd == m_pMainMouseWnd; } - FX_BOOL IsWndCaptureMouse(const CPWL_Wnd* pWnd) const { + bool IsWndCaptureMouse(const CPWL_Wnd* pWnd) const { if (pWnd) { for (int32_t i = 0, sz = m_aMousePath.GetSize(); i < sz; i++) { if (m_aMousePath.GetAt(i) == pWnd) - return TRUE; + return true; } } - return FALSE; + return false; } - FX_BOOL IsMainCaptureKeyboard(const CPWL_Wnd* pWnd) const { + bool IsMainCaptureKeyboard(const CPWL_Wnd* pWnd) const { return pWnd == m_pMainKeyboardWnd; } - FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const { + bool IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const { if (pWnd) { for (int32_t i = 0, sz = m_aKeyboardPath.GetSize(); i < sz; i++) { if (m_aKeyboardPath.GetAt(i) == pWnd) - return TRUE; + return true; } } - return FALSE; + return false; } void SetFocus(CPWL_Wnd* pWnd) { @@ -207,13 +207,13 @@ CPWL_Wnd::CPWL_Wnd() : m_pVScrollBar(nullptr), m_rcWindow(), m_rcClip(), - m_bCreated(FALSE), - m_bVisible(FALSE), - m_bNotifying(FALSE), - m_bEnabled(TRUE) {} + m_bCreated(false), + m_bVisible(false), + m_bNotifying(false), + m_bEnabled(true) {} CPWL_Wnd::~CPWL_Wnd() { - ASSERT(m_bCreated == FALSE); + ASSERT(m_bCreated == false); } CFX_ByteString CPWL_Wnd::GetClassName() const { @@ -248,7 +248,7 @@ void CPWL_Wnd::Create(const PWL_CREATEPARAM& cp) { OnCreated(); RePosChildWnd(); - m_bCreated = TRUE; + m_bCreated = true; } } @@ -284,7 +284,7 @@ void CPWL_Wnd::Destroy() { if (m_sPrivateParam.pParentWnd) m_sPrivateParam.pParentWnd->OnNotify(this, PNM_REMOVECHILD); - m_bCreated = FALSE; + m_bCreated = false; } DestroyMsgControl(); @@ -294,9 +294,7 @@ void CPWL_Wnd::Destroy() { m_pVScrollBar = nullptr; } -void CPWL_Wnd::Move(const CFX_FloatRect& rcNew, - FX_BOOL bReset, - FX_BOOL bRefresh) { +void CPWL_Wnd::Move(const CFX_FloatRect& rcNew, bool bReset, bool bRefresh) { if (IsValid()) { CFX_FloatRect rcOld = GetWindowRect(); @@ -429,7 +427,7 @@ void CPWL_Wnd::InvalidateRect(CFX_FloatRect* pRect) { } #define PWL_IMPLEMENT_KEY_METHOD(key_method_name) \ - FX_BOOL CPWL_Wnd::key_method_name(uint16_t nChar, uint32_t nFlag) { \ + bool CPWL_Wnd::key_method_name(uint16_t nChar, uint32_t nFlag) { \ if (IsValid() && IsVisible() && IsEnabled()) { \ if (IsWndCaptureKeyboard(this)) { \ for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ @@ -441,12 +439,12 @@ void CPWL_Wnd::InvalidateRect(CFX_FloatRect* pRect) { } \ } \ } \ - return FALSE; \ + return false; \ } #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name) \ - FX_BOOL CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \ - uint32_t nFlag) { \ + bool CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \ + uint32_t nFlag) { \ if (IsValid() && IsVisible() && IsEnabled()) { \ if (IsWndCaptureMouse(this)) { \ for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ @@ -471,7 +469,7 @@ void CPWL_Wnd::InvalidateRect(CFX_FloatRect* pRect) { SetCursor(); \ } \ } \ - return FALSE; \ + return false; \ } PWL_IMPLEMENT_KEY_METHOD(OnKeyDown) @@ -488,9 +486,9 @@ PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDown) PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp) PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) -FX_BOOL CPWL_Wnd::OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_Wnd::OnMouseWheel(short zDelta, + const CFX_FloatPoint& point, + uint32_t nFlag) { if (IsValid() && IsVisible() && IsEnabled()) { SetCursor(); if (IsWndCaptureKeyboard(this)) { @@ -504,7 +502,7 @@ FX_BOOL CPWL_Wnd::OnMouseWheel(short zDelta, } } } - return FALSE; + return false; } void CPWL_Wnd::AddChild(CPWL_Wnd* pWnd) { @@ -538,7 +536,7 @@ void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd, } } -FX_BOOL CPWL_Wnd::IsValid() const { +bool CPWL_Wnd::IsValid() const { return m_bCreated; } @@ -571,7 +569,7 @@ CFX_FloatPoint CPWL_Wnd::GetCenterPoint() const { (rcClient.top + rcClient.bottom) * 0.5f); } -FX_BOOL CPWL_Wnd::HasFlag(uint32_t dwFlags) const { +bool CPWL_Wnd::HasFlag(uint32_t dwFlags) const { return (m_sPrivateParam.dwFlags & dwFlags) != 0; } @@ -704,11 +702,11 @@ void CPWL_Wnd::OnSetFocus() {} void CPWL_Wnd::OnKillFocus() {} -FX_BOOL CPWL_Wnd::WndHitTest(const CFX_FloatPoint& point) const { +bool CPWL_Wnd::WndHitTest(const CFX_FloatPoint& point) const { return IsValid() && IsVisible() && GetWindowRect().Contains(point.x, point.y); } -FX_BOOL CPWL_Wnd::ClientHitTest(const CFX_FloatPoint& point) const { +bool CPWL_Wnd::ClientHitTest(const CFX_FloatPoint& point) const { return IsValid() && IsVisible() && GetClientRect().Contains(point.x, point.y); } @@ -719,7 +717,7 @@ const CPWL_Wnd* CPWL_Wnd::GetRootWnd() const { return this; } -void CPWL_Wnd::SetVisible(FX_BOOL bVisible) { +void CPWL_Wnd::SetVisible(bool bVisible) { if (IsValid()) { for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { @@ -744,7 +742,7 @@ const CFX_FloatRect& CPWL_Wnd::GetClipRect() const { return m_rcClip; } -FX_BOOL CPWL_Wnd::IsReadOnly() const { +bool CPWL_Wnd::IsReadOnly() const { return HasFlag(PWS_READONLY); } @@ -759,7 +757,7 @@ void CPWL_Wnd::RePosChildWnd() { rcContent.right - 1.0f, rcContent.top); if (pVSB) - pVSB->Move(rcVScroll, TRUE, FALSE); + pVSB->Move(rcVScroll, true, false); } void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM& cp) {} @@ -788,29 +786,29 @@ CPWL_MsgControl* CPWL_Wnd::GetMsgControl() const { return m_sPrivateParam.pMsgControl; } -FX_BOOL CPWL_Wnd::IsCaptureMouse() const { +bool CPWL_Wnd::IsCaptureMouse() const { return IsWndCaptureMouse(this); } -FX_BOOL CPWL_Wnd::IsWndCaptureMouse(const CPWL_Wnd* pWnd) const { +bool CPWL_Wnd::IsWndCaptureMouse(const CPWL_Wnd* pWnd) const { if (CPWL_MsgControl* pCtrl = GetMsgControl()) return pCtrl->IsWndCaptureMouse(pWnd); - return FALSE; + return false; } -FX_BOOL CPWL_Wnd::IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const { +bool CPWL_Wnd::IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const { if (CPWL_MsgControl* pCtrl = GetMsgControl()) return pCtrl->IsWndCaptureKeyboard(pWnd); - return FALSE; + return false; } -FX_BOOL CPWL_Wnd::IsFocused() const { +bool CPWL_Wnd::IsFocused() const { if (CPWL_MsgControl* pCtrl = GetMsgControl()) return pCtrl->IsMainCaptureKeyboard(this); - return FALSE; + return false; } CFX_FloatRect CPWL_Wnd::GetFocusRect() const { @@ -991,7 +989,7 @@ const CPWL_Wnd* CPWL_Wnd::GetFocused() const { return nullptr; } -void CPWL_Wnd::EnableWindow(FX_BOOL bEnable) { +void CPWL_Wnd::EnableWindow(bool bEnable) { if (m_bEnabled != bEnable) { for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { @@ -1008,7 +1006,7 @@ void CPWL_Wnd::EnableWindow(FX_BOOL bEnable) { } } -FX_BOOL CPWL_Wnd::IsEnabled() { +bool CPWL_Wnd::IsEnabled() { return m_bEnabled; } @@ -1016,26 +1014,26 @@ void CPWL_Wnd::OnEnabled() {} void CPWL_Wnd::OnDisabled() {} -FX_BOOL CPWL_Wnd::IsCTRLpressed(uint32_t nFlag) const { +bool CPWL_Wnd::IsCTRLpressed(uint32_t nFlag) const { if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { return pSystemHandler->IsCTRLKeyDown(nFlag); } - return FALSE; + return false; } -FX_BOOL CPWL_Wnd::IsSHIFTpressed(uint32_t nFlag) const { +bool CPWL_Wnd::IsSHIFTpressed(uint32_t nFlag) const { if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { return pSystemHandler->IsSHIFTKeyDown(nFlag); } - return FALSE; + return false; } -FX_BOOL CPWL_Wnd::IsALTpressed(uint32_t nFlag) const { +bool CPWL_Wnd::IsALTpressed(uint32_t nFlag) const { if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { return pSystemHandler->IsALTKeyDown(nFlag); } - return FALSE; + return false; } diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h index 8fd538f7c4..bba14f26bf 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/pdfwindow/PWL_Wnd.h @@ -255,26 +255,26 @@ class CPWL_Wnd : public CPWL_TimerHandler { void InvalidateFocusHandler(IPWL_FocusHandler* handler); void InvalidateProvider(IPWL_Provider* provider); void Destroy(); - void Move(const CFX_FloatRect& rcNew, FX_BOOL bReset, FX_BOOL bRefresh); + void Move(const CFX_FloatRect& rcNew, bool bReset, bool bRefresh); virtual void InvalidateRect(CFX_FloatRect* pRect = nullptr); void DrawAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device); - virtual FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag); - virtual FX_BOOL OnKeyUp(uint16_t nChar, uint32_t nFlag); - virtual FX_BOOL OnChar(uint16_t nChar, uint32_t nFlag); - virtual FX_BOOL OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnMButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnMButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnMButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnRButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag); + 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_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_FloatPoint& point, + uint32_t nFlag); virtual void SetFocus(); virtual void KillFocus(); @@ -287,7 +287,7 @@ class CPWL_Wnd : public CPWL_TimerHandler { intptr_t lParam = 0); virtual void SetTextColor(const CPWL_Color& color); virtual void SetTextStrokeColor(const CPWL_Color& color); - virtual void SetVisible(FX_BOOL bVisible); + virtual void SetVisible(bool bVisible); virtual CFX_FloatRect GetFocusRect() const; virtual CPWL_Color GetBackgroundColor() const; @@ -309,8 +309,8 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual CFX_FloatRect GetClientRect() const; CFX_FloatPoint GetCenterPoint() const; int32_t GetBorderWidth() const; - FX_BOOL IsVisible() const { return m_bVisible; } - FX_BOOL HasFlag(uint32_t dwFlags) const; + bool IsVisible() const { return m_bVisible; } + bool HasFlag(uint32_t dwFlags) const; void AddFlag(uint32_t dwFlags); void RemoveFlag(uint32_t dwFlags); const CFX_FloatRect& GetClipRect() const; @@ -319,13 +319,13 @@ class CPWL_Wnd : public CPWL_TimerHandler { const CPWL_Dash& GetBorderDash() const; void* GetAttachedData() const; - FX_BOOL WndHitTest(const CFX_FloatPoint& point) const; - FX_BOOL ClientHitTest(const CFX_FloatPoint& point) const; - FX_BOOL IsCaptureMouse() const; + bool WndHitTest(const CFX_FloatPoint& point) const; + bool ClientHitTest(const CFX_FloatPoint& point) const; + bool IsCaptureMouse() const; const CPWL_Wnd* GetFocused() const; - FX_BOOL IsFocused() const; - FX_BOOL IsReadOnly() const; + bool IsFocused() const; + bool IsReadOnly() const; CPWL_ScrollBar* GetVScrollBar() const; IPVT_FontMap* GetFontMap() const; @@ -350,8 +350,8 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual FX_FLOAT GetItemLeftMargin(); virtual FX_FLOAT GetItemRightMargin(); - void EnableWindow(FX_BOOL bEnable); - FX_BOOL IsEnabled(); + void EnableWindow(bool bEnable); + bool IsEnabled(); virtual void SetCursor(); protected: @@ -379,11 +379,11 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual void OnEnabled(); virtual void OnDisabled(); - void SetNotifyFlag(FX_BOOL bNotifying = TRUE) { m_bNotifying = bNotifying; } + void SetNotifyFlag(bool bNotifying = true) { m_bNotifying = bNotifying; } - FX_BOOL IsValid() const; + bool IsValid() const; const PWL_CREATEPARAM& GetCreationParam() const; - FX_BOOL IsNotifying() const { return m_bNotifying; } + bool IsNotifying() const { return m_bNotifying; } void InvalidateRectMove(const CFX_FloatRect& rcOld, const CFX_FloatRect& rcNew); @@ -391,13 +391,13 @@ class CPWL_Wnd : public CPWL_TimerHandler { void PWLtoWnd(const CFX_FloatPoint& point, int32_t& x, int32_t& y) const; FX_RECT PWLtoWnd(const CFX_FloatRect& rect) const; - FX_BOOL IsWndCaptureMouse(const CPWL_Wnd* pWnd) const; - FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const; + bool IsWndCaptureMouse(const CPWL_Wnd* pWnd) const; + bool IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const; const CPWL_Wnd* GetRootWnd() const; - FX_BOOL IsCTRLpressed(uint32_t nFlag) const; - FX_BOOL IsSHIFTpressed(uint32_t nFlag) const; - FX_BOOL IsALTpressed(uint32_t nFlag) const; + bool IsCTRLpressed(uint32_t nFlag) const; + bool IsSHIFTpressed(uint32_t nFlag) const; + bool IsALTpressed(uint32_t nFlag) const; private: void AddChild(CPWL_Wnd* pWnd); @@ -423,10 +423,10 @@ class CPWL_Wnd : public CPWL_TimerHandler { CFX_FloatRect m_rcWindow; CFX_FloatRect m_rcClip; - FX_BOOL m_bCreated; - FX_BOOL m_bVisible; - FX_BOOL m_bNotifying; - FX_BOOL m_bEnabled; + bool m_bCreated; + bool m_bVisible; + bool m_bNotifying; + bool m_bEnabled; }; #endif // FPDFSDK_PDFWINDOW_PWL_WND_H_ -- cgit v1.2.3