From 4d02e904b01502cea5b76f316e07b0f6db5c5dbc Mon Sep 17 00:00:00 2001 From: Diana Gage Date: Thu, 20 Jul 2017 17:20:31 -0700 Subject: Change "Sel" abbreviation to "Selection". This CL changes SetSel() and GetSel() to SetSelection() and GetSelection() in CFX_Edit and CPWL_EditCtrl, and SetEditSel() and GetEditSel() to SetEditSelection() and GetEditSelection() in CPWL_ComboBox. Change-Id: Idd984932bda139a04e99193e519756980b7d4397 Reviewed-on: https://pdfium-review.googlesource.com/8610 Reviewed-by: Lei Zhang Commit-Queue: Lei Zhang --- fpdfsdk/pdfwindow/cpwl_combo_box.cpp | 9 ++++--- fpdfsdk/pdfwindow/cpwl_combo_box.h | 4 +-- fpdfsdk/pdfwindow/cpwl_combo_box_embeddertest.cpp | 32 +++++++++++------------ fpdfsdk/pdfwindow/cpwl_edit.cpp | 6 ++--- fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp | 8 +++--- fpdfsdk/pdfwindow/cpwl_edit_ctrl.h | 4 +-- fpdfsdk/pdfwindow/cpwl_edit_embeddertest.cpp | 18 ++++++------- 7 files changed, 41 insertions(+), 40 deletions(-) (limited to 'fpdfsdk/pdfwindow') diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp index d86c9db8a9..e5076332f6 100644 --- a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp +++ b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp @@ -213,17 +213,18 @@ void CPWL_ComboBox::SetSelect(int32_t nItemIndex) { m_nSelectItem = nItemIndex; } -void CPWL_ComboBox::SetEditSel(int32_t nStartChar, int32_t nEndChar) { +void CPWL_ComboBox::SetEditSelection(int32_t nStartChar, int32_t nEndChar) { if (m_pEdit) - m_pEdit->SetSel(nStartChar, nEndChar); + m_pEdit->SetSelection(nStartChar, nEndChar); } -void CPWL_ComboBox::GetEditSel(int32_t& nStartChar, int32_t& nEndChar) const { +void CPWL_ComboBox::GetEditSelection(int32_t& nStartChar, + int32_t& nEndChar) const { nStartChar = -1; nEndChar = -1; if (m_pEdit) - m_pEdit->GetSel(nStartChar, nEndChar); + m_pEdit->GetSelection(nStartChar, nEndChar); } void CPWL_ComboBox::Clear() { diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.h b/fpdfsdk/pdfwindow/cpwl_combo_box.h index 7dc348a711..a38ffa785f 100644 --- a/fpdfsdk/pdfwindow/cpwl_combo_box.h +++ b/fpdfsdk/pdfwindow/cpwl_combo_box.h @@ -72,8 +72,8 @@ class CPWL_ComboBox : public CPWL_Wnd { int32_t GetSelect() const; void SetSelect(int32_t nItemIndex); - void SetEditSel(int32_t nStartChar, int32_t nEndChar); - void GetEditSel(int32_t& nStartChar, int32_t& nEndChar) const; + void SetEditSelection(int32_t nStartChar, int32_t nEndChar); + void GetEditSelection(int32_t& nStartChar, int32_t& nEndChar) const; void Clear(); void SelectAll(); bool IsPopup() const; diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box_embeddertest.cpp b/fpdfsdk/pdfwindow/cpwl_combo_box_embeddertest.cpp index 35c7b2264b..9ca994f2e1 100644 --- a/fpdfsdk/pdfwindow/cpwl_combo_box_embeddertest.cpp +++ b/fpdfsdk/pdfwindow/cpwl_combo_box_embeddertest.cpp @@ -114,25 +114,25 @@ TEST_F(CPWLComboBoxEditEmbeddertest, GetSelectedTextFragmentsNormal) { FormFillerAndWindowSetup(GetCPDFSDKAnnotNormal()); EXPECT_STREQ(L"Banana", GetCPWLComboBox()->GetText().c_str()); - GetCPWLComboBox()->SetEditSel(0, 0); + GetCPWLComboBox()->SetEditSelection(0, 0); EXPECT_TRUE(GetCPWLComboBox()->GetSelectedText().IsEmpty()); - GetCPWLComboBox()->SetEditSel(0, 1); + GetCPWLComboBox()->SetEditSelection(0, 1); EXPECT_STREQ(L"B", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(0, -1); + GetCPWLComboBox()->SetEditSelection(0, -1); EXPECT_STREQ(L"Banana", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(-8, -1); + GetCPWLComboBox()->SetEditSelection(-8, -1); EXPECT_TRUE(GetCPWLComboBox()->GetSelectedText().IsEmpty()); - GetCPWLComboBox()->SetEditSel(4, 1); + GetCPWLComboBox()->SetEditSelection(4, 1); EXPECT_STREQ(L"ana", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(1, 4); + GetCPWLComboBox()->SetEditSelection(1, 4); EXPECT_STREQ(L"ana", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(5, 6); + GetCPWLComboBox()->SetEditSelection(5, 6); EXPECT_STREQ(L"a", GetCPWLComboBox()->GetSelectedText().c_str()); } @@ -149,7 +149,7 @@ TEST_F(CPWLComboBoxEditEmbeddertest, GetSelectedTextEmptyAndBasicEditable) { // Select another option and then select last char of that option. GetCPWLComboBox()->SetSelect(1); EXPECT_STREQ(L"Bar", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(2, 3); + GetCPWLComboBox()->SetEditSelection(2, 3); EXPECT_STREQ(L"r", GetCPWLComboBox()->GetSelectedText().c_str()); // Type into editable combobox text field and select new text. @@ -161,7 +161,7 @@ TEST_F(CPWLComboBoxEditEmbeddertest, GetSelectedTextEmptyAndBasicEditable) { GetCFFLFormFiller()->OnChar(GetCPDFSDKAnnotUserEditable(), 'c', 0)); EXPECT_TRUE(GetCPWLComboBox()->GetSelectedText().IsEmpty()); - GetCPWLComboBox()->SetEditSel(0, 5); + GetCPWLComboBox()->SetEditSelection(0, 5); EXPECT_STREQ(L"Baabc", GetCPWLComboBox()->GetSelectedText().c_str()); } @@ -172,25 +172,25 @@ TEST_F(CPWLComboBoxEditEmbeddertest, GetSelectedTextFragmentsEditable) { GetCFFLFormFiller()->OnChar(GetCPDFSDKAnnotUserEditable(), i + 'A', 0)); } - GetCPWLComboBox()->SetEditSel(0, 0); + GetCPWLComboBox()->SetEditSelection(0, 0); EXPECT_TRUE(GetCPWLComboBox()->GetSelectedText().IsEmpty()); - GetCPWLComboBox()->SetEditSel(0, 1); + GetCPWLComboBox()->SetEditSelection(0, 1); EXPECT_STREQ(L"A", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(0, -1); + GetCPWLComboBox()->SetEditSelection(0, -1); EXPECT_STREQ(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqr", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(-8, -1); + GetCPWLComboBox()->SetEditSelection(-8, -1); EXPECT_TRUE(GetCPWLComboBox()->GetSelectedText().IsEmpty()); - GetCPWLComboBox()->SetEditSel(23, 12); + GetCPWLComboBox()->SetEditSelection(23, 12); EXPECT_STREQ(L"MNOPQRSTUVW", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(12, 23); + GetCPWLComboBox()->SetEditSelection(12, 23); EXPECT_STREQ(L"MNOPQRSTUVW", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(49, 50); + GetCPWLComboBox()->SetEditSelection(49, 50); EXPECT_STREQ(L"r", GetCPWLComboBox()->GetSelectedText().c_str()); } diff --git a/fpdfsdk/pdfwindow/cpwl_edit.cpp b/fpdfsdk/pdfwindow/cpwl_edit.cpp index 046fb5789f..ac1cfa94ba 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit.cpp +++ b/fpdfsdk/pdfwindow/cpwl_edit.cpp @@ -361,7 +361,7 @@ CPVT_WordRange CPWL_Edit::GetSelectWordRange() const { int32_t nStart = -1; int32_t nEnd = -1; - m_pEdit->GetSel(nStart, nEnd); + m_pEdit->GetSelection(nStart, nEnd); CPVT_WordPlace wpStart = m_pEdit->WordIndexToWordPlace(nStart); CPVT_WordPlace wpEnd = m_pEdit->WordIndexToWordPlace(nEnd); @@ -455,7 +455,7 @@ bool CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { int nSelStart = 0; int nSelEnd = 0; - GetSel(nSelStart, nSelEnd); + GetSelection(nSelStart, nSelEnd); if (nSelStart == nSelEnd) nSelEnd = nSelStart + 1; @@ -527,7 +527,7 @@ bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { int nSelStart = 0; int nSelEnd = 0; - GetSel(nSelStart, nSelEnd); + GetSelection(nSelStart, nSelEnd); switch (nChar) { case FWL_VKEY_Back: diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp index 63d03929e2..357b552330 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp +++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp @@ -334,12 +334,12 @@ CFX_WideString CPWL_EditCtrl::GetText() const { return m_pEdit->GetText(); } -void CPWL_EditCtrl::SetSel(int32_t nStartChar, int32_t nEndChar) { - m_pEdit->SetSel(nStartChar, nEndChar); +void CPWL_EditCtrl::SetSelection(int32_t nStartChar, int32_t nEndChar) { + m_pEdit->SetSelection(nStartChar, nEndChar); } -void CPWL_EditCtrl::GetSel(int32_t& nStartChar, int32_t& nEndChar) const { - m_pEdit->GetSel(nStartChar, nEndChar); +void CPWL_EditCtrl::GetSelection(int32_t& nStartChar, int32_t& nEndChar) const { + m_pEdit->GetSelection(nStartChar, nEndChar); } void CPWL_EditCtrl::Clear() { diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h index 454e579622..04ec6e8a25 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h +++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h @@ -26,8 +26,8 @@ class CPWL_EditCtrl : public CPWL_Wnd { ~CPWL_EditCtrl() override; CFX_WideString GetText() const; - void SetSel(int32_t nStartChar, int32_t nEndChar); - void GetSel(int32_t& nStartChar, int32_t& nEndChar) const; + void SetSelection(int32_t nStartChar, int32_t nEndChar); + void GetSelection(int32_t& nStartChar, int32_t& nEndChar) const; void Clear(); void SelectAll(); diff --git a/fpdfsdk/pdfwindow/cpwl_edit_embeddertest.cpp b/fpdfsdk/pdfwindow/cpwl_edit_embeddertest.cpp index e206cd16e3..9b15ad887d 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit_embeddertest.cpp +++ b/fpdfsdk/pdfwindow/cpwl_edit_embeddertest.cpp @@ -85,13 +85,13 @@ TEST_F(CPWLEditEmbeddertest, GetSelectedTextEmptyAndBasic) { // selection is identified as empty. // // Select from character index [0, 3) within form text field. - GetCPWLEdit()->SetSel(0, 3); + GetCPWLEdit()->SetSelection(0, 3); EXPECT_TRUE(GetCPWLEdit()->GetSelectedText().IsEmpty()); EXPECT_TRUE(GetCFFLFormFiller()->OnChar(GetCPDFSDKAnnot(), 'a', 0)); EXPECT_TRUE(GetCFFLFormFiller()->OnChar(GetCPDFSDKAnnot(), 'b', 0)); EXPECT_TRUE(GetCFFLFormFiller()->OnChar(GetCPDFSDKAnnot(), 'c', 0)); - GetCPWLEdit()->SetSel(0, 2); + GetCPWLEdit()->SetSelection(0, 2); EXPECT_STREQ(L"ab", GetCPWLEdit()->GetSelectedText().c_str()); } @@ -101,25 +101,25 @@ TEST_F(CPWLEditEmbeddertest, GetSelectedTextFragments) { EXPECT_TRUE(GetCFFLFormFiller()->OnChar(GetCPDFSDKAnnot(), i + 'A', 0)); } - GetCPWLEdit()->SetSel(0, 0); + GetCPWLEdit()->SetSelection(0, 0); EXPECT_TRUE(GetCPWLEdit()->GetSelectedText().IsEmpty()); - GetCPWLEdit()->SetSel(0, 1); + GetCPWLEdit()->SetSelection(0, 1); EXPECT_STREQ(L"A", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->SetSel(0, -1); + GetCPWLEdit()->SetSelection(0, -1); EXPECT_STREQ(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqr", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->SetSel(-8, -1); + GetCPWLEdit()->SetSelection(-8, -1); EXPECT_TRUE(GetCPWLEdit()->GetSelectedText().IsEmpty()); - GetCPWLEdit()->SetSel(23, 12); + GetCPWLEdit()->SetSelection(23, 12); EXPECT_STREQ(L"MNOPQRSTUVW", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->SetSel(12, 23); + GetCPWLEdit()->SetSelection(12, 23); EXPECT_STREQ(L"MNOPQRSTUVW", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->SetSel(49, 50); + GetCPWLEdit()->SetSelection(49, 50); EXPECT_STREQ(L"r", GetCPWLEdit()->GetSelectedText().c_str()); } -- cgit v1.2.3