From 1f9d2338feb75d62bb28e116df7243dd567fded8 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 6 Jul 2017 12:11:33 -0400 Subject: Remove in-out param from OnNotifySelChanged This CL converts OnNotifySelChanged to return instead of accepting an in-out parameter. Change-Id: I42ab220b1f3af304493496ada5624677652bf10f Reviewed-on: https://pdfium-review.googlesource.com/7336 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- fpdfsdk/pdfwindow/cpwl_combo_box.cpp | 14 +++----------- fpdfsdk/pdfwindow/cpwl_list_box.cpp | 25 ++++++++----------------- fpdfsdk/pdfwindow/cpwl_list_box.h | 2 +- 3 files changed, 12 insertions(+), 29 deletions(-) diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp index 20cbcd305c..792524b950 100644 --- a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp +++ b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp @@ -40,10 +40,7 @@ bool CPWL_CBListBox::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { if (CPWL_Wnd* pParent = GetParentWindow()) pParent->NotifyLButtonUp(this, point); - bool bExit = false; - OnNotifySelChanged(false, bExit, nFlag); - - return !bExit; + return !OnNotifySelChanged(false, nFlag); } bool CPWL_CBListBox::IsMovementKey(uint16_t nChar) const { @@ -83,10 +80,7 @@ bool CPWL_CBListBox::OnMovementKeyDown(uint16_t nChar, uint32_t nFlag) { m_pList->OnVK_RIGHT(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); break; } - - bool bExit = false; - OnNotifySelChanged(true, bExit, nFlag); - return bExit; + return OnNotifySelChanged(true, nFlag); } bool CPWL_CBListBox::IsChar(uint16_t nChar, uint32_t nFlag) const { @@ -97,9 +91,7 @@ bool CPWL_CBListBox::OnCharNotify(uint16_t nChar, uint32_t nFlag) { if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetParentWindow()) pComboBox->SetSelectText(); - bool bExit = false; - OnNotifySelChanged(true, bExit, nFlag); - return bExit; + return OnNotifySelChanged(true, nFlag); } void CPWL_CBButton::GetThisAppearanceStream(std::ostringstream* psAppStream) { diff --git a/fpdfsdk/pdfwindow/cpwl_list_box.cpp b/fpdfsdk/pdfwindow/cpwl_list_box.cpp index 8691898763..bd2bdb5d19 100644 --- a/fpdfsdk/pdfwindow/cpwl_list_box.cpp +++ b/fpdfsdk/pdfwindow/cpwl_list_box.cpp @@ -223,10 +223,7 @@ bool CPWL_ListBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) { case FWL_VKEY_Delete: break; } - - bool bExit = false; - OnNotifySelChanged(true, bExit, nFlag); - + OnNotifySelChanged(true, nFlag); return true; } @@ -236,9 +233,7 @@ bool CPWL_ListBox::OnChar(uint16_t nChar, uint32_t nFlag) { if (!m_pList->OnChar(nChar, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag))) return false; - bool bExit = false; - OnNotifySelChanged(true, bExit, nFlag); - + OnNotifySelChanged(true, nFlag); return true; } @@ -263,10 +258,7 @@ bool CPWL_ListBox::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { ReleaseCapture(); m_bMouseDown = false; } - - bool bExit = false; - OnNotifySelChanged(false, bExit, nFlag); - + OnNotifySelChanged(false, nFlag); return true; } @@ -309,13 +301,12 @@ void CPWL_ListBox::RePosChildWnd() { m_pList->SetPlateRect(GetListRect()); } -void CPWL_ListBox::OnNotifySelChanged(bool bKeyDown, - bool& bExit, - uint32_t nFlag) { +bool CPWL_ListBox::OnNotifySelChanged(bool bKeyDown, uint32_t nFlag) { if (!m_pFillerNotify) - return; + return false; bool bRC = true; + bool bExit = false; CFX_WideString swChange = GetText(); CFX_WideString strChangeEx; int nSelStart = 0; @@ -323,6 +314,7 @@ void CPWL_ListBox::OnNotifySelChanged(bool bKeyDown, m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange, strChangeEx, nSelStart, nSelEnd, bKeyDown, bRC, bExit, nFlag); + return bExit; } CFX_FloatRect CPWL_ListBox::GetFocusRect() const { @@ -425,7 +417,6 @@ bool CPWL_ListBox::OnMouseWheel(short zDelta, else m_pList->OnVK_UP(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); - bool bExit = false; - OnNotifySelChanged(false, bExit, nFlag); + OnNotifySelChanged(false, nFlag); return true; } diff --git a/fpdfsdk/pdfwindow/cpwl_list_box.h b/fpdfsdk/pdfwindow/cpwl_list_box.h index d97f5ae31a..d4581c066e 100644 --- a/fpdfsdk/pdfwindow/cpwl_list_box.h +++ b/fpdfsdk/pdfwindow/cpwl_list_box.h @@ -70,7 +70,7 @@ class CPWL_ListBox : public CPWL_Wnd { virtual CFX_WideString GetText() const; - void OnNotifySelChanged(bool bKeyDown, bool& bExit, uint32_t nFlag); + bool OnNotifySelChanged(bool bKeyDown, uint32_t nFlag); void AddString(const CFX_WideString& str); void SetTopVisibleIndex(int32_t nItemIndex); -- cgit v1.2.3