diff options
Diffstat (limited to 'fpdfsdk/src/pdfwindow')
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Caret.cpp | 14 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Edit.cpp | 56 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp | 78 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_FontMap.cpp | 28 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Icon.cpp | 22 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_IconList.cpp | 66 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Label.cpp | 8 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_ListBox.cpp | 77 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp | 20 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Note.cpp | 231 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp | 298 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Utils.cpp | 38 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Wnd.cpp | 157 |
15 files changed, 471 insertions, 630 deletions
diff --git a/fpdfsdk/src/pdfwindow/PWL_Caret.cpp b/fpdfsdk/src/pdfwindow/PWL_Caret.cpp index cdc7d57a9b..e050f3400e 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Caret.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Caret.cpp @@ -131,7 +131,7 @@ CPDF_Rect CPWL_Caret::GetCaretRect() const { return CPDF_Rect(m_ptFoot.x, m_ptFoot.y, - m_ptHead.x + this->m_fWidth, + m_ptHead.x + m_fWidth, m_ptHead.y); } @@ -144,8 +144,8 @@ void CPWL_Caret::SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPD if (m_ptHead.x != ptHead.x || m_ptHead.y != ptHead.y || m_ptFoot.x != ptFoot.x || m_ptFoot.y != ptFoot.y) { - this->m_ptHead = ptHead; - this->m_ptFoot = ptFoot; + m_ptHead = ptHead; + m_ptFoot = ptFoot; m_bFlash = TRUE; //Move(GetCaretRect(),FALSE,TRUE); @@ -154,8 +154,8 @@ void CPWL_Caret::SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPD } else { - this->m_ptHead = ptHead; - this->m_ptFoot = ptFoot; + m_ptHead = ptHead; + m_ptFoot = ptFoot; EndTimer(); BeginTimer(PWL_CARET_FLASHINTERVAL); @@ -169,8 +169,8 @@ void CPWL_Caret::SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPD } else { - this->m_ptHead = CPDF_Point(0,0); - this->m_ptFoot = CPDF_Point(0,0); + m_ptHead = CPDF_Point(0, 0); + m_ptFoot = CPDF_Point(0, 0); m_bFlash = FALSE; if (IsVisible()) diff --git a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp index f3dce6ad72..f9ca5a5837 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp @@ -31,7 +31,7 @@ FX_BOOL CPWL_CBListBox::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) ReleaseCapture(); m_bMouseDown = FALSE; - if (this->ClientHitTest(point)) + if (ClientHitTest(point)) { if (CPWL_Wnd * pParent = GetParentWindow()) { @@ -121,7 +121,7 @@ void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) { CFX_ByteTextBuf sButton; - CPDF_Point ptCenter = this->GetCenterPoint(); + CPDF_Point ptCenter = GetCenterPoint(); CPDF_Point pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN,ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); CPDF_Point pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN,ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); @@ -151,7 +151,7 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p if (IsVisible() && !rectWnd.IsEmpty()) { - CPDF_Point ptCenter = this->GetCenterPoint(); + CPDF_Point ptCenter = GetCenterPoint(); CPDF_Point pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN,ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); CPDF_Point pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN,ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); diff --git a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp index 62f09eff2b..856adcf686 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp @@ -83,18 +83,14 @@ void CPWL_Edit::SetText(const FX_WCHAR* csText) void CPWL_Edit::RePosChildWnd() { - if (CPWL_ScrollBar * pVSB = this->GetVScrollBar()) - { - //if (pVSB->IsVisible()) - { - CPDF_Rect rcWindow = m_rcOldWindow; - CPDF_Rect rcVScroll = CPDF_Rect(rcWindow.right, - rcWindow.bottom, - rcWindow.right + PWL_SCROLLBAR_WIDTH, - rcWindow.top); - pVSB->Move(rcVScroll, TRUE, FALSE); - } - } + if (CPWL_ScrollBar * pVSB = GetVScrollBar()) { + CPDF_Rect rcWindow = m_rcOldWindow; + CPDF_Rect rcVScroll = CPDF_Rect(rcWindow.right, + rcWindow.bottom, + rcWindow.right + PWL_SCROLLBAR_WIDTH, + rcWindow.top); + pVSB->Move(rcVScroll, TRUE, FALSE); + } if (m_pEditCaret && !HasFlag(PES_TEXTOVERFLOW)) m_pEditCaret->SetClipRect(CPWL_Utils::InflateRect(GetClientRect(),1.0f)); //+1 for caret beside border @@ -106,7 +102,7 @@ CPDF_Rect CPWL_Edit::GetClientRect() const { CPDF_Rect rcClient = CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT)(GetBorderWidth()+GetInnerBorderWidth())); - if (CPWL_ScrollBar * pVSB = this->GetVScrollBar()) + if (CPWL_ScrollBar * pVSB = GetVScrollBar()) { if (pVSB->IsVisible()) { @@ -391,7 +387,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) if (sText.GetLength() > 0) { - CPDF_Rect rcClient = this->GetClientRect(); + CPDF_Rect rcClient = GetClientRect(); sAppStream << "q\n/Tx BMC\n"; if (!HasFlag(PES_TEXTOVERFLOW)) @@ -479,14 +475,14 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser } IFX_SystemHandler* pSysHandler = GetSystemHandler(); IFX_Edit::DrawEdit(pDevice,pUser2Device,m_pEdit, - CPWL_Utils::PWLColorToFXColor(GetTextColor(),this->GetTransparency()), - CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(),this->GetTransparency()), + CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), + CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), rcClip,CPDF_Point(0.0f,0.0f),pRange, pSysHandler, m_pFormFiller); if (HasFlag(PES_SPELLCHECK)) { CPWL_Utils::DrawEditSpellCheck(pDevice,pUser2Device,m_pEdit,rcClip, - CPDF_Point(0.0f,0.0f),pRange, this->GetCreationParam().pSpellCheck); + CPDF_Point(0.0f,0.0f),pRange, GetCreationParam().pSpellCheck); } } @@ -497,7 +493,7 @@ FX_BOOL CPWL_Edit::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { if (m_bMouseDown) - this->InvalidateRect(); + InvalidateRect(); m_bMouseDown = TRUE; SetCapture(); @@ -540,7 +536,7 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) IFX_SystemHandler* pSH = GetSystemHandler(); if (!pSH) return FALSE; - this->SetFocus(); + SetFocus(); CPVT_WordRange wrLatin = GetLatinWordsRange(point); CFX_WideString swLatin = m_pEdit->GetRangeText(wrLatin); @@ -579,7 +575,7 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) } } - IPWL_Provider* pProvider = this->GetProvider(); + IPWL_Provider* pProvider = GetProvider(); if (HasFlag(PES_UNDO)) { @@ -604,7 +600,7 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) pSH->AppendMenuItem(hPopup, WM_PWLEDIT_DELETE, pProvider ? pProvider->LoadPopupMenuString(5) : L"&Delete"); - CFX_WideString swText = pSH->GetClipboardText(this->GetAttachedHWnd()); + CFX_WideString swText = pSH->GetClipboardText(GetAttachedHWnd()); if (swText.IsEmpty()) pSH->EnableMenuItem(hPopup, WM_PWLEDIT_PASTE, FALSE); @@ -662,19 +658,19 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) Redo(); break; case WM_PWLEDIT_CUT: - this->CutText(); + CutText(); break; case WM_PWLEDIT_COPY: - this->CopyText(); + CopyText(); break; case WM_PWLEDIT_PASTE: - this->PasteText(); + PasteText(); break; case WM_PWLEDIT_DELETE: - this->Clear(); + Clear(); break; case WM_PWLEDIT_SELECTALL: - this->SelectAll(); + SelectAll(); break; case WM_PWLEDIT_SUGGEST + 0: SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos)); @@ -847,7 +843,7 @@ void CPWL_Edit::SetCharArray(int32_t nCharArray) if (HasFlag(PWS_AUTOFONTSIZE)) { - if (IFX_Edit_FontMap* pFontMap = this->GetFontMap()) + if (IFX_Edit_FontMap* pFontMap = GetFontMap()) { FX_FLOAT fFontSize = GetCharArrayAutoFontSize(pFontMap->GetPDFFont(0), GetClientRect(), nCharArray); if (fFontSize > 0.0f) @@ -1077,13 +1073,13 @@ FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD if (zDelta > 0) { - ptScroll.y += this->GetFontSize(); + ptScroll.y += GetFontSize(); } else { - ptScroll.y -= this->GetFontSize(); + ptScroll.y -= GetFontSize(); } - this->SetScrollPos(ptScroll); + SetScrollPos(ptScroll); return TRUE; } diff --git a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp index 57b0c01782..f562076f1d 100644 --- a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/pdfwindow/PDFWindow.h" @@ -43,9 +43,9 @@ void CPWL_EditCtrl::OnCreate(PWL_CREATEPARAM & cp) void CPWL_EditCtrl::OnCreated() { - SetFontSize(this->GetCreationParam().fFontSize); + SetFontSize(GetCreationParam().fFontSize); - m_pEdit->SetFontMap(this->GetFontMap()); + m_pEdit->SetFontMap(GetFontMap()); m_pEdit->SetNotify(this); m_pEdit->Initialize(); } @@ -64,7 +64,7 @@ FX_BOOL CPWL_EditCtrl::IsWndHorV() void CPWL_EditCtrl::SetCursor() { - if (IsValid()) + if (IsValid()) { if (IFX_SystemHandler* pSH = GetSystemHandler()) { @@ -98,7 +98,7 @@ void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp break; } break; - case PNM_SETSCROLLPOS: + case PNM_SETSCROLLPOS: switch (wParam) { case SBT_VSCROLL: @@ -124,9 +124,9 @@ void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp { if (PWL_CARET_INFO * pCaretInfo = (PWL_CARET_INFO *)wParam) { - this->SetCaret(pCaretInfo->bVisible, + SetCaret(pCaretInfo->bVisible, pCaretInfo->ptHead, - pCaretInfo->ptFoot); + pCaretInfo->ptFoot); } } break; @@ -143,7 +143,7 @@ void CPWL_EditCtrl::CreateEditCaret(const PWL_CREATEPARAM & cp) { if (!m_pEditCaret) { - m_pEditCaret = new CPWL_Caret; + m_pEditCaret = new CPWL_Caret; m_pEditCaret->SetInvalidRect(GetClientRect()); PWL_CREATEPARAM ecp = cp; @@ -207,7 +207,7 @@ FX_BOOL CPWL_EditCtrl::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) switch (nChar) { - case FWL_VKEY_Delete: + case FWL_VKEY_Delete: Delete(); return TRUE; case FWL_VKEY_Insert: @@ -241,7 +241,7 @@ FX_BOOL CPWL_EditCtrl::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) default: break; } - + return bRet; } @@ -256,7 +256,7 @@ FX_BOOL CPWL_EditCtrl::OnChar(FX_WORD nChar, FX_DWORD nFlag) { case 0x0A: case 0x1B: - return FALSE; + return FALSE; default: break; } @@ -272,16 +272,16 @@ FX_BOOL CPWL_EditCtrl::OnChar(FX_WORD nChar, FX_DWORD nFlag) switch (nChar) { case 'C' - 'A' + 1: - this->CopyText(); + CopyText(); return TRUE; case 'V' - 'A' + 1: - this->PasteText(); + PasteText(); return TRUE; case 'X' - 'A' + 1: - this->CutText(); + CutText(); return TRUE; case 'A' - 'A' + 1: - this->SelectAll(); + SelectAll(); return TRUE; case 'Z' - 'A' + 1: if (bShift) @@ -307,7 +307,7 @@ FX_BOOL CPWL_EditCtrl::OnChar(FX_WORD nChar, FX_DWORD nFlag) case FWL_VKEY_Back: Backspace(); break; - case FWL_VKEY_Return: + case FWL_VKEY_Return: InsertReturn(); break; case FWL_VKEY_Unknown: @@ -315,7 +315,7 @@ FX_BOOL CPWL_EditCtrl::OnChar(FX_WORD nChar, FX_DWORD nFlag) default: if (IsINSERTpressed(nFlag)) Delete(); - InsertWord(word, this->GetCharSet()); + InsertWord(word, GetCharSet()); break; } @@ -327,11 +327,11 @@ FX_BOOL CPWL_EditCtrl::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) CPWL_Wnd::OnLButtonDown(point,nFlag); if (ClientHitTest(point)) - { + { if (m_bMouseDown) - this->InvalidateRect(); + InvalidateRect(); - m_bMouseDown = TRUE; + m_bMouseDown = TRUE; SetCapture(); m_pEdit->OnMouseDown(point,IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag)); @@ -347,8 +347,8 @@ FX_BOOL CPWL_EditCtrl::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) if (m_bMouseDown) { //can receive keybord message - if (ClientHitTest(point) && !this->IsFocused()) - SetFocus(); + if (ClientHitTest(point) && !IsFocused()) + SetFocus(); ReleaseCapture(); m_bMouseDown = FALSE; @@ -382,7 +382,7 @@ void CPWL_EditCtrl::SetEditCaret(FX_BOOL bVisible) } CPVT_WordPlace wpTemp = m_pEdit->GetCaretWordPlace(); - this->IOnSetCaret(bVisible,ptHead,ptFoot,wpTemp); + IOnSetCaret(bVisible,ptHead,ptFoot,wpTemp); } void CPWL_EditCtrl::GetCaretInfo(CPDF_Point & ptHead, CPDF_Point & ptFoot) const @@ -400,7 +400,7 @@ void CPWL_EditCtrl::GetCaretInfo(CPDF_Point & ptHead, CPDF_Point & ptFoot) const ptFoot.y = word.ptWord.y + word.fDescent; } else if (pIterator->GetLine(line)) - { + { ptHead.x = line.ptLine.x; ptHead.y = line.ptLine.y + line.fLineAscent; ptFoot.x = line.ptLine.x; @@ -524,7 +524,7 @@ CPDF_Font * CPWL_EditCtrl::GetCaretFont() const else if (HasFlag(PES_RICH)) { if (pIterator->GetSection(section)) - { + { nFontIndex = section.WordProps.nFontIndex; } } @@ -552,7 +552,7 @@ FX_FLOAT CPWL_EditCtrl::GetCaretFontSize() const else if (HasFlag(PES_RICH)) { if (pIterator->GetSection(section)) - { + { fFontSize = section.WordProps.fFontSize; } } @@ -634,8 +634,8 @@ void CPWL_EditCtrl::Undo() m_pEdit->Undo(); } -void CPWL_EditCtrl::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, - FX_FLOAT fContentMin, FX_FLOAT fContentMax, +void CPWL_EditCtrl::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, + FX_FLOAT fContentMin, FX_FLOAT fContentMax, FX_FLOAT fSmallStep, FX_FLOAT fBigStep) { PWL_SCROLL_INFO Info; @@ -646,25 +646,22 @@ void CPWL_EditCtrl::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, Info.fSmallStep = fSmallStep; Info.fBigStep = fBigStep; - this->OnNotify(this,PNM_SETSCROLLINFO,SBT_VSCROLL,(intptr_t)&Info); - -// PWL_TRACE("set scroll info:%f\n",fContentMax - fContentMin); + OnNotify(this,PNM_SETSCROLLINFO,SBT_VSCROLL,(intptr_t)&Info); if (IsFloatBigger(Info.fPlateWidth,Info.fContentMax-Info.fContentMin) || IsFloatEqual(Info.fPlateWidth,Info.fContentMax-Info.fContentMin)) { - this->ShowVScrollBar(FALSE); + ShowVScrollBar(FALSE); } else { - this->ShowVScrollBar(TRUE); + ShowVScrollBar(TRUE); } } void CPWL_EditCtrl::IOnSetScrollPosY(FX_FLOAT fy) { -// PWL_TRACE("set scroll position:%f\n",fy); - this->OnNotify(this,PNM_SETSCROLLPOS,SBT_VSCROLL,(intptr_t)&fy); + OnNotify(this, PNM_SETSCROLLPOS,SBT_VSCROLL, (intptr_t)&fy); } void CPWL_EditCtrl::IOnSetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPDF_Point & ptFoot, const CPVT_WordPlace& place) @@ -674,7 +671,7 @@ void CPWL_EditCtrl::IOnSetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, con cInfo.ptHead = ptHead; cInfo.ptFoot = ptFoot; - this->OnNotify(this,PNM_SETCARETINFO,(intptr_t)&cInfo,(intptr_t)NULL); + OnNotify(this, PNM_SETCARETINFO, (intptr_t)&cInfo, (intptr_t)NULL); } void CPWL_EditCtrl::IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps) @@ -683,7 +680,7 @@ void CPWL_EditCtrl::IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_Wo void CPWL_EditCtrl::IOnContentChange(const CPDF_Rect& rcContent) { - if (this->IsValid()) + if (IsValid()) { if (m_pEditNotify) { @@ -694,15 +691,12 @@ void CPWL_EditCtrl::IOnContentChange(const CPDF_Rect& rcContent) void CPWL_EditCtrl::IOnInvalidateRect(CPDF_Rect * pRect) { - this->InvalidateRect(pRect); + InvalidateRect(pRect); } int32_t CPWL_EditCtrl::GetCharSet() const { - if (m_nCharSet < 0) - return DEFAULT_CHARSET; - else - return m_nCharSet; + return m_nCharSet < 0 ? DEFAULT_CHARSET : m_nCharSet; } void CPWL_EditCtrl::GetTextRange(const CPDF_Rect& rect, int32_t & nStartChar, int32_t & nEndChar) const diff --git a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp index bd01eab3da..943e4979b2 100644 --- a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/pdfwindow/PDFWindow.h" @@ -12,7 +12,7 @@ /* ------------------------------ CPWL_FontMap ------------------------------ */ -CPWL_FontMap::CPWL_FontMap(IFX_SystemHandler* pSystemHandler) : +CPWL_FontMap::CPWL_FontMap(IFX_SystemHandler* pSystemHandler) : m_pPDFDoc(NULL), m_pSystemHandler(pSystemHandler) { @@ -80,7 +80,7 @@ FX_BOOL CPWL_FontMap::KnowWord(int32_t nFontIndex, FX_WORD word) if (nFontIndex >=0 && nFontIndex < m_aData.GetSize()) { if (m_aData.GetAt(nFontIndex)) - { + { return CharCodeFromUnicode(nFontIndex, word) >= 0; } } @@ -99,8 +99,8 @@ int32_t CPWL_FontMap::GetWordFontIndex(FX_WORD word, int32_t nCharset, int32_t n { if (const CPWL_FontMap_Data* pData = GetFontMapData(0)) { - if (nCharset == DEFAULT_CHARSET || - pData->nCharset == SYMBOL_CHARSET || + if (nCharset == DEFAULT_CHARSET || + pData->nCharset == SYMBOL_CHARSET || nCharset == pData->nCharset) { if (KnowWord(0, word)) @@ -113,14 +113,14 @@ int32_t CPWL_FontMap::GetWordFontIndex(FX_WORD word, int32_t nCharset, int32_t n int32_t nNewFontIndex = -1; - nNewFontIndex = this->GetFontIndex(GetNativeFontName(nCharset), nCharset, TRUE); + nNewFontIndex = GetFontIndex(GetNativeFontName(nCharset), nCharset, TRUE); if (nNewFontIndex >= 0) { if (KnowWord(nNewFontIndex, word)) return nNewFontIndex; } - nNewFontIndex = this->GetFontIndex("Arial Unicode MS", DEFAULT_CHARSET, FALSE); + nNewFontIndex = GetFontIndex("Arial Unicode MS", DEFAULT_CHARSET, FALSE); if (nNewFontIndex >= 0) { if (KnowWord(nNewFontIndex, word)) @@ -203,10 +203,8 @@ void CPWL_FontMap::Initial(const FX_CHAR* fontname) sFontName = DEFAULT_FONT_NAME; GetFontIndex(sFontName, ANSI_CHARSET, FALSE); - - //GetFontIndex(this->GetNativeFontName(nCharset), nCharset); } - + /* List of currently supported standard fonts: @@ -277,7 +275,7 @@ int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName, int32_t nCha */ { sAlias = EncodeFontAlias(sTemp, nCharset); - } + } } AddedFont(pFont, sAlias); @@ -406,7 +404,7 @@ CPDF_Font* CPWL_FontMap::AddSystemFont(CPDF_Document* pDoc, CFX_ByteString& sFon if (m_pSystemHandler) return m_pSystemHandler->AddNativeTrueTypeFontToPDF(pDoc, sFontName, nCharset); - + return NULL; } @@ -534,9 +532,9 @@ int32_t CPWL_FontMap::CharSetFromUnicode(FX_WORD word, int32_t nOldCharset) if (nOldCharset != DEFAULT_CHARSET) return nOldCharset; //find new charset - if ((word >= 0x4E00 && word <= 0x9FA5) || + if ((word >= 0x4E00 && word <= 0x9FA5) || (word >= 0xE7C7 && word <= 0xE7F3) || - (word >= 0x3000 && word <= 0x303F) || //£©"¡¶" "¡·" "¡£" "¡¢" + (word >= 0x3000 && word <= 0x303F) || (word >= 0x2000 && word <= 0x206F)) { return GB2312_CHARSET; @@ -585,7 +583,7 @@ int32_t CPWL_FontMap::CharSetFromUnicode(FX_WORD word, int32_t nOldCharset) /* ------------------------ CPWL_DocFontMap ------------------------ */ -CPWL_DocFontMap::CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler, CPDF_Document* pAttachedDoc) +CPWL_DocFontMap::CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler, CPDF_Document* pAttachedDoc) : CPWL_FontMap(pSystemHandler), m_pAttachedDoc(pAttachedDoc) { diff --git a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp index f85156da0c..f266da001c 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp @@ -23,7 +23,7 @@ CFX_ByteString CPWL_Image::GetImageAppStream() { CFX_ByteTextBuf sAppStream; - CFX_ByteString sAlias = this->GetImageAlias(); + CFX_ByteString sAlias = GetImageAlias(); CPDF_Rect rcPlate = GetClientRect(); CPDF_Matrix mt; mt.SetReverse(GetImageMatrix()); @@ -58,7 +58,7 @@ void CPWL_Image::SetPDFStream(CPDF_Stream * pStream) CPDF_Stream * CPWL_Image::GetPDFStream() { - return this->m_pPDFStream; + return m_pPDFStream; } void CPWL_Image::GetImageSize(FX_FLOAT & fWidth,FX_FLOAT & fHeight) @@ -193,23 +193,13 @@ void CPWL_Icon::GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale) FX_FLOAT fImageWidth,fImageHeight; FX_FLOAT fPlateWidth,fPlateHeight; - CPDF_Rect rcPlate = this->GetClientRect(); + CPDF_Rect rcPlate = GetClientRect(); fPlateWidth = rcPlate.right - rcPlate.left; fPlateHeight = rcPlate.top - rcPlate.bottom; GetImageSize(fImageWidth,fImageHeight); - int32_t nScaleMethod = this->GetScaleMethod(); - - /* - enum ScaleMethod - { - Always = 0, //A, Always scale - Bigger, //B, Scale only when the icon is bigger than the annotation rectangle - Smaller, //S, Scale only when the icon is smaller then the annotation rectangle - Never //N, Never scale - }; - */ + int32_t nScaleMethod = GetScaleMethod(); switch (nScaleMethod) { @@ -248,7 +238,7 @@ void CPWL_Icon::GetImageOffset(FX_FLOAT & x,FX_FLOAT & y) { FX_FLOAT fLeft,fBottom; - this->GetIconPosition(fLeft,fBottom); + GetIconPosition(fLeft, fBottom); x = 0.0f; y = 0.0f; @@ -262,7 +252,7 @@ void CPWL_Icon::GetImageOffset(FX_FLOAT & x,FX_FLOAT & y) FX_FLOAT fImageFactHeight = fImageHeight * fVScale; FX_FLOAT fPlateWidth,fPlateHeight; - CPDF_Rect rcPlate = this->GetClientRect(); + CPDF_Rect rcPlate = GetClientRect(); fPlateWidth = rcPlate.right - rcPlate.left; fPlateHeight = rcPlate.top - rcPlate.bottom; diff --git a/fpdfsdk/src/pdfwindow/PWL_IconList.cpp b/fpdfsdk/src/pdfwindow/PWL_IconList.cpp index cbb94d23d7..157eba633d 100644 --- a/fpdfsdk/src/pdfwindow/PWL_IconList.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_IconList.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/pdfwindow/PDFWindow.h" @@ -19,8 +19,8 @@ /* ------------------ CPWL_IconList_Item ------------------- */ -CPWL_IconList_Item::CPWL_IconList_Item() : - m_nIconIndex(-1), +CPWL_IconList_Item::CPWL_IconList_Item() : + m_nIconIndex(-1), m_pData(NULL), m_bSelected(FALSE), m_pText(NULL) @@ -47,15 +47,15 @@ void CPWL_IconList_Item::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matr if (m_bSelected) { - if (this->IsEnabled()) + if (IsEnabled()) { - CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient, - CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_SELBACKCOLOR,this->GetTransparency())); + CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient, + CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_SELBACKCOLOR, GetTransparency())); } else { - CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient, - CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_LIGHTGRAYCOLOR,this->GetTransparency())); + CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient, + CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_LIGHTGRAYCOLOR, GetTransparency())); } } @@ -63,8 +63,8 @@ void CPWL_IconList_Item::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matr rcIcon.left += PWL_IconList_ITEM_ICON_LEFTMARGIN; rcIcon.right = rcIcon.left + PWL_IconList_ITEM_WIDTH; - CPWL_Utils::DrawIconAppStream(pDevice, pUser2Device, m_nIconIndex, rcIcon, - m_crIcon, m_pText->GetTextColor(), this->GetTransparency()); + CPWL_Utils::DrawIconAppStream(pDevice, pUser2Device, m_nIconIndex, rcIcon, + m_crIcon, m_pText->GetTextColor(), GetTransparency()); } void CPWL_IconList_Item::SetSelect(FX_BOOL bSelected) @@ -136,19 +136,19 @@ void CPWL_IconList_Item::OnEnabled() else m_pText->SetTextColor(PWL_DEFAULT_BLACKCOLOR); - this->InvalidateRect(); + InvalidateRect(); } void CPWL_IconList_Item::OnDisabled() { m_pText->SetTextColor(PWL_DEFAULT_HEAVYGRAYCOLOR); - this->InvalidateRect(); + InvalidateRect(); } /* ----------------- CPWL_IconList_Content ----------------- */ -CPWL_IconList_Content::CPWL_IconList_Content(int32_t nListCount) : +CPWL_IconList_Content::CPWL_IconList_Content(int32_t nListCount) : m_nSelectIndex(-1), m_pNotify(NULL), m_bEnableNotify(TRUE), @@ -173,13 +173,13 @@ void CPWL_IconList_Content::CreateChildWnd(const PWL_CREATEPARAM & cp) pNewItem->Create(icp); } - this->SetItemSpace(PWL_IconList_ITEM_SPACE); - this->ResetContent(0); + SetItemSpace(PWL_IconList_ITEM_SPACE); + ResetContent(0); - if (CPWL_Wnd * pParent = this->GetParentWindow()) + if (CPWL_Wnd * pParent = GetParentWindow()) { - CPDF_Rect rcScroll = this->GetScrollArea(); - this->GetScrollPos(); + CPDF_Rect rcScroll = GetScrollArea(); + GetScrollPos(); PWL_SCROLL_INFO sInfo; sInfo.fContentMin = rcScroll.bottom; @@ -289,13 +289,13 @@ void CPWL_IconList_Content::ScrollToItem(int32_t nItemIndex) } else if (rcWnd.bottom < rcClient.bottom) { - ptScroll.y = rcOrigin.bottom + rcClient.Height(); + ptScroll.y = rcOrigin.bottom + rcClient.Height(); } - this->SetScrollPos(ptScroll); - this->ResetFace(); - this->InvalidateRect(); - if (CPWL_Wnd* pParent = this->GetParentWindow()) + SetScrollPos(ptScroll); + ResetFace(); + InvalidateRect(); + if (CPWL_Wnd* pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptScroll.y); } @@ -343,7 +343,7 @@ void CPWL_IconList_Content::SelectItem(int32_t nItemIndex, FX_BOOL bSelect) if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) { pItem->SetSelect(bSelect); - pItem->InvalidateRect(); + pItem->InvalidateRect(); } } @@ -408,7 +408,7 @@ void CPWL_IconList_Content::SetIconFillColor(const CPWL_Color& color) /* -------------------- CPWL_IconList --------------------- */ -CPWL_IconList::CPWL_IconList(int32_t nListCount) : +CPWL_IconList::CPWL_IconList(int32_t nListCount) : m_pListContent(NULL), m_nListCount(nListCount) { @@ -438,7 +438,7 @@ void CPWL_IconList::CreateChildWnd(const PWL_CREATEPARAM & cp) void CPWL_IconList::OnCreated() { - if (CPWL_ScrollBar* pScrollBar = this->GetVScrollBar()) + if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) { pScrollBar->RemoveFlag(PWS_AUTOTRANSPARENT); pScrollBar->SetTransparency(255); @@ -451,20 +451,20 @@ void CPWL_IconList::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); if (wParam == SBT_VSCROLL) - { + { switch (msg) { case PNM_SETSCROLLINFO: if (PWL_SCROLL_INFO* pInfo = (PWL_SCROLL_INFO*)lParam) { - if (CPWL_ScrollBar* pScrollBar = this->GetVScrollBar()) + if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) { if (pInfo->fContentMax - pInfo->fContentMin > pInfo->fPlateWidth) { if (!pScrollBar->IsVisible()) { pScrollBar->SetVisible(TRUE); - RePosChildWnd(); + RePosChildWnd(); } else { @@ -481,7 +481,7 @@ void CPWL_IconList::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp if (m_pListContent) m_pListContent->SetScrollPos(CPDF_Point(0.0f,0.0f)); } - + pScrollBar->OnNotify(pWnd,PNM_SETSCROLLINFO,wParam,lParam); } } @@ -495,7 +495,7 @@ void CPWL_IconList::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp } return; case PNM_SETSCROLLPOS: - if (CPWL_ScrollBar* pScrollBar = this->GetVScrollBar()) + if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) pScrollBar->OnNotify(pWnd,PNM_SETSCROLLPOS,wParam,lParam); return; } @@ -579,8 +579,8 @@ FX_BOOL CPWL_IconList::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_D m_pListContent->SetScrollPos(ptNew); m_pListContent->ResetFace(); m_pListContent->InvalidateRect(NULL); - - if (CPWL_ScrollBar* pScrollBar = this->GetVScrollBar()) + + if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptNew.y); return TRUE; diff --git a/fpdfsdk/src/pdfwindow/PWL_Label.cpp b/fpdfsdk/src/pdfwindow/PWL_Label.cpp index 9875002437..35af3ee91b 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Label.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Label.cpp @@ -31,9 +31,9 @@ CFX_ByteString CPWL_Label::GetClassName() const void CPWL_Label::OnCreated() { SetParamByFlag(); - SetFontSize(this->GetCreationParam().fFontSize); + SetFontSize(GetCreationParam().fFontSize); - m_pEdit->SetFontMap(this->GetFontMap()); + m_pEdit->SetFontMap(GetFontMap()); m_pEdit->Initialize(); if (HasFlag(PES_TEXTOVERFLOW)) @@ -127,8 +127,8 @@ void CPWL_Label::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse } IFX_SystemHandler* pSysHandler = GetSystemHandler(); IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pEdit, - CPWL_Utils::PWLColorToFXColor(GetTextColor(), this->GetTransparency()), - CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), this->GetTransparency()), + CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), + CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), rcClip, CPDF_Point(0.0f,0.0f), pRange,pSysHandler, NULL); } diff --git a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp index ecf9e1231f..0328ee55d6 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/pdfwindow/PDFWindow.h" @@ -28,8 +28,8 @@ CPWL_List_Notify::~CPWL_List_Notify() { } -void CPWL_List_Notify::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, - FX_FLOAT fContentMin, FX_FLOAT fContentMax, +void CPWL_List_Notify::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, + FX_FLOAT fContentMin, FX_FLOAT fContentMax, FX_FLOAT fSmallStep, FX_FLOAT fBigStep) { PWL_SCROLL_INFO Info; @@ -51,17 +51,17 @@ void CPWL_List_Notify::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, { pScroll->SetVisible(FALSE); m_pList->RePosChildWnd(); - } + } } else { if (!pScroll->IsVisible()) { - pScroll->SetVisible(TRUE); + pScroll->SetVisible(TRUE); m_pList->RePosChildWnd(); } } - } + } } void CPWL_List_Notify::IOnSetScrollPosY(FX_FLOAT fy) @@ -91,7 +91,7 @@ CPWL_ListBox::CPWL_ListBox() : CPWL_ListBox::~CPWL_ListBox() { IFX_List::DelList(m_pList); - + if (m_pListNotify) { delete m_pListNotify; @@ -100,7 +100,7 @@ CPWL_ListBox::~CPWL_ListBox() } CFX_ByteString CPWL_ListBox::GetClassName() const -{ +{ return "CPWL_ListBox"; } @@ -112,10 +112,10 @@ void CPWL_ListBox::OnCreated() m_pList->SetFontMap(GetFontMap()); m_pList->SetNotify(m_pListNotify = new CPWL_List_Notify(this)); - - SetHoverSel(HasFlag(PLBS_HOVERSEL)); + + SetHoverSel(HasFlag(PLBS_HOVERSEL)); m_pList->SetMultipleSel(HasFlag(PLBS_MULTIPLESEL)); - m_pList->SetFontSize(this->GetCreationParam().fFontSize); + m_pList->SetFontSize(GetCreationParam().fFontSize); m_bHoverSel = HasFlag(PLBS_HOVERSEL); } @@ -144,7 +144,7 @@ void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) CPDF_Rect rcItem = m_pList->GetItemRect(i); if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom) continue; - + CPDF_Point ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); if (m_pList->IsItemSelected(i)) { @@ -168,8 +168,8 @@ void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) if (sListItems.GetLength() > 0) { - CFX_ByteTextBuf sClip; - CPDF_Rect rcClient = this->GetClientRect(); + CFX_ByteTextBuf sClip; + CPDF_Rect rcClient = GetClientRect(); sClip << "q\n"; sClip << rcClient.left << " " << rcClient.bottom << " " @@ -195,7 +195,7 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pU { CPDF_Rect rcItem = m_pList->GetItemRect(i); if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom) continue; - + CPDF_Point ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); if (IFX_Edit* pEdit = m_pList->GetItemEdit(i)) { @@ -226,7 +226,7 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pU else { IFX_SystemHandler* pSysHandler = GetSystemHandler(); - IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), + IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), CPWL_Utils::PWLColorToFXColor(GetTextColor()), CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), rcList, ptOffset, NULL,pSysHandler, NULL); @@ -252,7 +252,7 @@ FX_BOOL CPWL_ListBox::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) case FWL_VKEY_Left: case FWL_VKEY_End: case FWL_VKEY_Right: - break; + break; } switch (nChar) @@ -351,7 +351,7 @@ FX_BOOL CPWL_ListBox::OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag) { if (m_pList) m_pList->OnMouseMove(point,IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag)); - } + } return TRUE; } @@ -360,8 +360,8 @@ void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intpt { CPWL_Wnd::OnNotify(pWnd,msg,wParam,lParam); - FX_FLOAT fPos; - + FX_FLOAT fPos; + switch (msg) { case PNM_SETSCROLLINFO: @@ -375,7 +375,7 @@ void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intpt break; } break; - case PNM_SETSCROLLPOS: + case PNM_SETSCROLLPOS: switch (wParam) { case SBT_VSCROLL: @@ -401,29 +401,7 @@ void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intpt void CPWL_ListBox::KillFocus() { - CPWL_Wnd::KillFocus(); - - /* - if (this->IsMultipleSel()) - { - for(int32_t i=0;i<this->GetCount();i++) - { - if (this->IsListItemSelected(i)) - { - if (!IsListItemVisible(i)) - this->ScrollToListItem(i); - break; - } - } - } - else - { - if (!IsListItemVisible(this->GetCurSel())) - this->ScrollToListItem(this->GetCurSel()); - } - - SetListItemCaret(m_nCaretIndex,FALSE); - */ + CPWL_Wnd::KillFocus(); } void CPWL_ListBox::RePosChildWnd() @@ -437,7 +415,7 @@ void CPWL_ListBox::RePosChildWnd() void CPWL_ListBox::OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL & bExit, FX_DWORD nFlag) { if (m_pFillerNotify) - { + { FX_BOOL bRC = TRUE; CFX_WideString swChange = GetText(); CFX_WideString strChangeEx; @@ -458,23 +436,18 @@ CPDF_Rect CPWL_ListBox::GetFocusRect() const rcCaret.Intersect(GetClientRect()); return rcCaret; } - + return CPWL_Wnd::GetFocusRect(); } void CPWL_ListBox::AddString(const FX_WCHAR* string) { if (m_pList) - { + { m_pList->AddString(string); } } -void CPWL_ListBox::SetText(const FX_WCHAR* csText,FX_BOOL bRefresh) -{ - //return CPDF_List::SetText(csText,bRefresh); -} - CFX_WideString CPWL_ListBox::GetText() const { if (m_pList) diff --git a/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp b/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp index 17d842165d..3077e6293f 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/pdfwindow/PDFWindow.h" @@ -10,9 +10,9 @@ /* ---------------------------- CPWL_ListCtrl ---------------------------- */ -CPWL_ListCtrl::CPWL_ListCtrl() : +CPWL_ListCtrl::CPWL_ListCtrl() : m_rcContent(0,0,0,0), - m_ptScroll(0,0), + m_ptScroll(0,0), m_fItemSpace(0.0f), m_fTopSpace(0.0f), m_fBottomSpace(0.0f) @@ -37,7 +37,7 @@ void CPWL_ListCtrl::SetScrollPos(const CPDF_Point& point) m_ptScroll.y = m_rcContent.top; if (m_ptScroll.y < m_rcContent.bottom) - m_ptScroll.y = m_rcContent.bottom; + m_ptScroll.y = m_rcContent.bottom; } CPDF_Point CPWL_ListCtrl::GetScrollPos() const @@ -67,7 +67,7 @@ FX_FLOAT CPWL_ListCtrl::GetContentsHeight(FX_FLOAT fLimitWidth) { FX_FLOAT fRet = m_fTopSpace; - FX_FLOAT fBorderWidth = (FX_FLOAT)this->GetBorderWidth(); + FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); if (fLimitWidth > fBorderWidth* 2) { @@ -111,8 +111,8 @@ void CPWL_ListCtrl::ResetAll(FX_BOOL bMove, int32_t nStart) FX_FLOAT fRight = pChild->GetItemRightMargin(); pChild->SetChildMatrix( - CPDF_Matrix(1,0,0,1, - rcClient.left - m_ptScroll.x, + CPDF_Matrix(1,0,0,1, + rcClient.left - m_ptScroll.x, rcClient.top - m_ptScroll.y) ); @@ -192,7 +192,7 @@ void CPWL_ListCtrl::DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* } } } - + pDevice->RestoreState(); } @@ -211,7 +211,7 @@ CPDF_Point CPWL_ListCtrl::InToOut(const CPDF_Point& point) const { CPDF_Rect rcClient = GetClientRect(); - return CPDF_Point(point.x + rcClient.left - m_ptScroll.x, + return CPDF_Point(point.x + rcClient.left - m_ptScroll.x, point.y + rcClient.top - m_ptScroll.y); } @@ -219,7 +219,7 @@ CPDF_Point CPWL_ListCtrl::OutToIn(const CPDF_Point& point) const { CPDF_Rect rcClient = GetClientRect(); - return CPDF_Point(point.x - rcClient.left + m_ptScroll.x, + return CPDF_Point(point.x - rcClient.left + m_ptScroll.x, point.y - rcClient.top + m_ptScroll.y); } diff --git a/fpdfsdk/src/pdfwindow/PWL_Note.cpp b/fpdfsdk/src/pdfwindow/PWL_Note.cpp index 13e15a0518..7ed1115a82 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Note.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Note.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/pdfwindow/PDFWindow.h" @@ -51,7 +51,7 @@ void CPWL_Note_Options::SetTextColor(const CPWL_Color & color) void CPWL_Note_Options::RePosChildWnd() { - if (this->IsValid()) + if (IsValid()) { ASSERT(m_pText != NULL); @@ -106,8 +106,8 @@ void CPWL_Note_Options::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matri path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); - pDevice->DrawPath(&path, pUser2Device, NULL, - CPWL_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), + pDevice->DrawPath(&path, pUser2Device, NULL, + CPWL_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), 0, FXFILL_ALTERNATE); } @@ -136,35 +136,35 @@ CPWL_Note_Edit::~CPWL_Note_Edit() void CPWL_Note_Edit::RePosChildWnd() { - m_bEnableNotify = FALSE; + m_bEnableNotify = FALSE; CPWL_Edit::RePosChildWnd(); m_bEnableNotify = TRUE; - m_fOldItemHeight = this->GetContentRect().Height(); + m_fOldItemHeight = GetContentRect().Height(); } void CPWL_Note_Edit::SetText(const FX_WCHAR* csText) { m_bEnableNotify = FALSE; CPWL_Edit::SetText(csText); - m_bEnableNotify = TRUE; - m_fOldItemHeight = this->GetContentRect().Height(); + m_bEnableNotify = TRUE; + m_fOldItemHeight = GetContentRect().Height(); } void CPWL_Note_Edit::OnSetFocus() { - m_bEnableNotify = FALSE; + m_bEnableNotify = FALSE; CPWL_Edit::OnSetFocus(); - m_bEnableNotify = TRUE; + m_bEnableNotify = TRUE; - this->EnableSpellCheck(TRUE); + EnableSpellCheck(TRUE); } void CPWL_Note_Edit::OnKillFocus() { - this->EnableSpellCheck(FALSE); + EnableSpellCheck(FALSE); - if (CPWL_Wnd* pParent = this->GetParentWindow()) + if (CPWL_Wnd* pParent = GetParentWindow()) { if (CPWL_Wnd* pGrand = pParent->GetParentWindow()) { @@ -187,14 +187,14 @@ void CPWL_Note_Edit::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int { switch (msg) { - case PNM_SETSCROLLINFO: + case PNM_SETSCROLLINFO: if (PWL_SCROLL_INFO* pInfo = (PWL_SCROLL_INFO*)lParam) - { - if (!IsFloatEqual(pInfo->fContentMax, m_fOldMax) || + { + if (!IsFloatEqual(pInfo->fContentMax, m_fOldMax) || !IsFloatEqual(pInfo->fContentMin, m_fOldMin)) { - m_bSizeChanged = TRUE; - if (CPWL_Wnd * pParent = this->GetParentWindow()) + m_bSizeChanged = TRUE; + if (CPWL_Wnd * pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); } @@ -205,7 +205,7 @@ void CPWL_Note_Edit::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int } } } - } + } } CPWL_Edit::OnNotify(pWnd, msg, wParam, lParam); @@ -219,10 +219,10 @@ void CPWL_Note_Edit::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int { PWL_CARET_INFO newInfo = *pInfo; newInfo.bVisible = TRUE; - newInfo.ptHead = this->ChildToParent(pInfo->ptHead); - newInfo.ptFoot = this->ChildToParent(pInfo->ptFoot); + newInfo.ptHead = ChildToParent(pInfo->ptHead); + newInfo.ptFoot = ChildToParent(pInfo->ptFoot); - if (CPWL_Wnd * pParent = this->GetParentWindow()) + if (CPWL_Wnd * pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_SETCARETINFO, (intptr_t)&newInfo, 0); } @@ -239,22 +239,18 @@ FX_FLOAT CPWL_Note_Edit::GetItemHeight(FX_FLOAT fLimitWidth) if (!m_bSizeChanged) return m_fOldItemHeight; - m_bSizeChanged = FALSE; + m_bSizeChanged = FALSE; - this->EnableNotify(FALSE); - this->EnableRefresh(FALSE); + EnableNotify(FALSE); + EnableRefresh(FALSE); m_pEdit->EnableNotify(FALSE); - //CPDF_Rect rcOld = this->GetWindowRect(); - - this->Move(CPDF_Rect(0,0,fLimitWidth,0), TRUE, FALSE); - FX_FLOAT fRet = this->GetContentRect().Height(); - - //this->Move(rcOld, TRUE, FALSE); + Move(CPDF_Rect(0,0,fLimitWidth,0), TRUE, FALSE); + FX_FLOAT fRet = GetContentRect().Height(); m_pEdit->EnableNotify(TRUE); - this->EnableNotify(TRUE); - this->EnableRefresh(TRUE); + EnableNotify(TRUE); + EnableRefresh(TRUE); return fRet; } @@ -284,7 +280,7 @@ CPWL_Note_LBBox::~CPWL_Note_LBBox() void CPWL_Note_LBBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device) { - CPDF_Rect rcClient = this->GetClientRect(); + CPDF_Rect rcClient = GetClientRect(); CFX_GraphStateData gsd; gsd.m_LineWidth = 1.0f; @@ -296,9 +292,9 @@ void CPWL_Note_LBBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pathCross.SetPoint(1, rcClient.right, rcClient.bottom, FXPT_LINETO); pathCross.SetPoint(2, rcClient.left, rcClient.bottom + rcClient.Height() * 0.5f, FXPT_MOVETO); pathCross.SetPoint(3, rcClient.left + rcClient.Width() * 0.5f, rcClient.bottom, FXPT_LINETO); - - pDevice->DrawPath(&pathCross, pUser2Device, &gsd, - 0, CPWL_Utils::PWLColorToFXColor(GetTextColor(),this->GetTransparency()), FXFILL_ALTERNATE); + + pDevice->DrawPath(&pathCross, pUser2Device, &gsd, + 0, CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), FXFILL_ALTERNATE); } /* -------------------------------- CPWL_Note_RBBox --------------------------------*/ @@ -313,7 +309,7 @@ CPWL_Note_RBBox::~CPWL_Note_RBBox() void CPWL_Note_RBBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device) { - CPDF_Rect rcClient = this->GetClientRect(); + CPDF_Rect rcClient = GetClientRect(); CFX_GraphStateData gsd; gsd.m_LineWidth = 1.0f; @@ -325,9 +321,9 @@ void CPWL_Note_RBBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pathCross.SetPoint(1, rcClient.left, rcClient.bottom, FXPT_LINETO); pathCross.SetPoint(2, rcClient.right, rcClient.bottom + rcClient.Height() * 0.5f, FXPT_MOVETO); pathCross.SetPoint(3, rcClient.left + rcClient.Width() * 0.5f, rcClient.bottom, FXPT_LINETO); - - pDevice->DrawPath(&pathCross, pUser2Device, &gsd, - 0, CPWL_Utils::PWLColorToFXColor(GetTextColor(),this->GetTransparency()), FXFILL_ALTERNATE); + + pDevice->DrawPath(&pathCross, pUser2Device, &gsd, + 0, CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), FXFILL_ALTERNATE); } /* --------------------------------- CPWL_Note_Icon ---------------------------------- */ @@ -347,8 +343,8 @@ void CPWL_Note_Icon::SetIconType(int32_t nType) void CPWL_Note_Icon::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device) { - CPWL_Utils::DrawIconAppStream(pDevice, pUser2Device, m_nType, GetClientRect(), - this->GetBackgroundColor(), PWL_DEFAULT_BLACKCOLOR, this->GetTransparency()); + CPWL_Utils::DrawIconAppStream(pDevice, pUser2Device, m_nType, GetClientRect(), + GetBackgroundColor(), PWL_DEFAULT_BLACKCOLOR, GetTransparency()); } /* --------------------------------- CPWL_Note_CloseBox ---------------------------------- */ @@ -365,7 +361,7 @@ void CPWL_Note_CloseBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matr { CPWL_Button::DrawThisAppearance(pDevice, pUser2Device); - CPDF_Rect rcClient = this->GetClientRect(); + CPDF_Rect rcClient = GetClientRect(); rcClient = CPWL_Utils::DeflateRect(rcClient, 2.0f); CFX_GraphStateData gsd; @@ -386,9 +382,9 @@ void CPWL_Note_CloseBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matr pathCross.SetPoint(1, rcClient.right, rcClient.top, FXPT_LINETO); pathCross.SetPoint(2, rcClient.left, rcClient.top, FXPT_MOVETO); pathCross.SetPoint(3, rcClient.right, rcClient.bottom, FXPT_LINETO); - - pDevice->DrawPath(&pathCross, pUser2Device, &gsd, - 0, CPWL_Utils::PWLColorToFXColor(GetTextColor(),this->GetTransparency()), FXFILL_ALTERNATE); + + pDevice->DrawPath(&pathCross, pUser2Device, &gsd, + 0, CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), FXFILL_ALTERNATE); } FX_BOOL CPWL_Note_CloseBox::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) @@ -460,23 +456,23 @@ CFX_WideString CPWL_Note_Contents::GetText() const CPWL_NoteItem* CPWL_Note_Contents::CreateSubItem() { CPWL_NoteItem* pNoteItem = new CPWL_NoteItem; - PWL_CREATEPARAM icp = this->GetCreationParam(); + PWL_CREATEPARAM icp = GetCreationParam(); icp.pParentWnd = this; icp.dwFlags = PWS_CHILD | PWS_VISIBLE | PWS_BACKGROUND; pNoteItem->Create(icp); pNoteItem->OnCreateNoteItem(); - + pNoteItem->ResetSubjectName(m_aChildren.GetSize() - 1); FX_SYSTEMTIME st; - if (IFX_SystemHandler* pSH = this->GetSystemHandler()) + if (IFX_SystemHandler* pSH = GetSystemHandler()) st = pSH->GetLocalTime(); pNoteItem->SetDateTime(st); pNoteItem->SetContents(L""); - this->OnNotify(pNoteItem, PNM_NOTEEDITCHANGED, 0, 0); + OnNotify(pNoteItem, PNM_NOTEEDITCHANGED, 0, 0); return pNoteItem; } @@ -502,7 +498,7 @@ IPWL_NoteItem* CPWL_Note_Contents::GetSubItems(int32_t index) const void CPWL_Note_Contents::DeleteSubItem(IPWL_NoteItem* pNoteItem) { - int32_t nIndex = this->GetItemIndex((CPWL_NoteItem*)pNoteItem); + int32_t nIndex = GetItemIndex((CPWL_NoteItem*)pNoteItem); if (nIndex > 0) { @@ -523,13 +519,13 @@ void CPWL_Note_Contents::DeleteSubItem(IPWL_NoteItem* pNoteItem) } } - this->OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); + OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); } } IPWL_NoteItem* CPWL_Note_Contents::GetHitNoteItem(const CPDF_Point& point) { - CPDF_Point pt = this->ParentToChild(point); + CPDF_Point pt = ParentToChild(point); for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) { @@ -552,11 +548,11 @@ void CPWL_Note_Contents::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, { case PNM_NOTEEDITCHANGED: { - int32_t nIndex = this->GetItemIndex(pWnd); + int32_t nIndex = GetItemIndex(pWnd); if (nIndex < 0) nIndex = 0; - m_pEdit->EnableNotify(FALSE); - this->ResetContent(nIndex); + m_pEdit->EnableNotify(FALSE); + ResetContent(nIndex); m_pEdit->EnableNotify(TRUE); for (int32_t i=nIndex+1, sz=m_aChildren.GetSize(); i<sz; i++) @@ -565,26 +561,26 @@ void CPWL_Note_Contents::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, pChild->OnNotify(this, PNM_NOTERESET, 0, 0); } - if (CPWL_Wnd * pParent = this->GetParentWindow()) + if (CPWL_Wnd * pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); } } return; case PNM_SCROLLWINDOW: - this->SetScrollPos(CPDF_Point(0.0f, *(FX_FLOAT*)lParam)); - this->ResetFace(); + SetScrollPos(CPDF_Point(0.0f, *(FX_FLOAT*)lParam)); + ResetFace(); InvalidateRect(NULL); - return; + return; case PNM_SETCARETINFO: if (PWL_CARET_INFO * pInfo = (PWL_CARET_INFO*)wParam) { PWL_CARET_INFO newInfo = *pInfo; newInfo.bVisible = TRUE; - newInfo.ptHead = this->ChildToParent(pInfo->ptHead); - newInfo.ptFoot = this->ChildToParent(pInfo->ptFoot); + newInfo.ptHead = ChildToParent(pInfo->ptHead); + newInfo.ptFoot = ChildToParent(pInfo->ptFoot); - if (CPWL_Wnd * pParent = this->GetParentWindow()) + if (CPWL_Wnd * pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_SETCARETINFO, (intptr_t)&newInfo, 0); } @@ -592,18 +588,18 @@ void CPWL_Note_Contents::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, return; case PNM_NOTERESET: { - m_pEdit->EnableNotify(FALSE); - this->ResetContent(0); + m_pEdit->EnableNotify(FALSE); + ResetContent(0); m_pEdit->EnableNotify(TRUE); for (int32_t i=1, sz=m_aChildren.GetSize(); i<sz; i++) { if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) pChild->OnNotify(this, PNM_NOTERESET, 0, 0); - } + } - m_pEdit->EnableNotify(FALSE); - this->ResetContent(0); + m_pEdit->EnableNotify(FALSE); + ResetContent(0); m_pEdit->EnableNotify(TRUE); } return; @@ -705,7 +701,7 @@ void CPWL_NoteItem::CreateChildWnd(const PWL_CREATEPARAM & cp) { CPWL_Color sTextColor; - if (CPWL_Utils::IsBlackOrWhite(this->GetBackgroundColor())) + if (CPWL_Utils::IsBlackOrWhite(GetBackgroundColor())) sTextColor = PWL_DEFAULT_WHITECOLOR; else sTextColor = PWL_DEFAULT_BLACKCOLOR; @@ -738,7 +734,7 @@ void CPWL_NoteItem::CreateChildWnd(const PWL_CREATEPARAM & cp) void CPWL_NoteItem::RePosChildWnd() { - if (this->IsValid()) + if (IsValid()) { ASSERT(m_pSubject != NULL); ASSERT(m_pDateTime != NULL); @@ -784,7 +780,7 @@ void CPWL_NoteItem::SetPrivateData(void* pData) void CPWL_NoteItem::SetBkColor(const CPWL_Color& color) { CPWL_Color sBK = color; - this->SetBackgroundColor(sBK); + SetBackgroundColor(sBK); CPWL_Color sTextColor; @@ -793,13 +789,13 @@ void CPWL_NoteItem::SetBkColor(const CPWL_Color& color) else sTextColor = PWL_DEFAULT_BLACKCOLOR; - this->SetTextColor(sTextColor); + SetTextColor(sTextColor); if (m_pSubject) m_pSubject->SetTextColor(sTextColor); if (m_pDateTime) m_pDateTime->SetTextColor(sTextColor); - this->InvalidateRect(NULL); + InvalidateRect(nullptr); if (IPWL_NoteNotify* pNotify = GetNoteNotify()) { @@ -823,7 +819,7 @@ void CPWL_NoteItem::SetSubjectName(const CFX_WideString& sName) void CPWL_NoteItem::SetAuthorName(const CFX_WideString& sName) { m_sAuthor = sName; - ResetSubjectName(-1); + ResetSubjectName(-1); if (IPWL_NoteNotify* pNotify = GetNoteNotify()) { @@ -835,7 +831,7 @@ void CPWL_NoteItem::ResetSubjectName(int32_t nItemIndex) { if (nItemIndex < 0) { - if (CPWL_Wnd* pParent = this->GetParentWindow()) + if (CPWL_Wnd* pParent = GetParentWindow()) { ASSERT(pParent->GetClassName() == "CPWL_Note_Contents"); @@ -855,8 +851,8 @@ void CPWL_NoteItem::ResetSubjectName(int32_t nItemIndex) sSubject += L" - "; sSubject += m_sAuthor; } - this->SetSubjectName(sSubject); - this->RePosChildWnd(); + SetSubjectName(sSubject); + RePosChildWnd(); } void CPWL_NoteItem::SetDateTime(FX_SYSTEMTIME time) @@ -870,7 +866,7 @@ void CPWL_NoteItem::SetDateTime(FX_SYSTEMTIME time) m_pDateTime->SetText(swTime.c_str()); } - this->RePosChildWnd(); + RePosChildWnd(); if (IPWL_NoteNotify* pNotify = GetNoteNotify()) { @@ -893,7 +889,7 @@ void CPWL_NoteItem::SetContents(const CFX_WideString& sContents) CPWL_NoteItem* CPWL_NoteItem::GetParentNoteItem() const { - if (CPWL_Wnd* pParent = this->GetParentWindow()) + if (CPWL_Wnd* pParent = GetParentWindow()) { if (CPWL_Wnd* pGrand = pParent->GetParentWindow()) { @@ -924,12 +920,12 @@ void* CPWL_NoteItem::GetPrivateData() const CFX_WideString CPWL_NoteItem::GetAuthorName() const { - return m_sAuthor; + return m_sAuthor; } CPWL_Color CPWL_NoteItem::GetBkColor() const { - return this->GetBackgroundColor(); + return GetBackgroundColor(); } CFX_WideString CPWL_NoteItem::GetContents() const @@ -984,7 +980,7 @@ IPWL_NoteItem* CPWL_NoteItem::GetSubItems(int32_t index) const void CPWL_NoteItem::DeleteSubItem(IPWL_NoteItem* pNoteItem) { - this->KillFocus(); + KillFocus(); if (IPWL_NoteNotify* pNotify = GetNoteNotify()) { @@ -997,9 +993,9 @@ void CPWL_NoteItem::DeleteSubItem(IPWL_NoteItem* pNoteItem) IPWL_NoteItem* CPWL_NoteItem::GetHitNoteItem(const CPDF_Point& point) { - CPDF_Point pt = this->ParentToChild(point); + CPDF_Point pt = ParentToChild(point); - if (this->WndHitTest(pt)) + if (WndHitTest(pt)) { if (m_pContents) { @@ -1015,17 +1011,17 @@ IPWL_NoteItem* CPWL_NoteItem::GetHitNoteItem(const CPDF_Point& point) IPWL_NoteItem* CPWL_NoteItem::GetFocusedNoteItem() const { - if (const CPWL_Wnd* pWnd = this->GetFocused()) + if (const CPWL_Wnd* pWnd = GetFocused()) { if (pWnd->GetClassName() == "CPWL_Edit") { if (CPWL_Wnd* pParent = pWnd->GetParentWindow()) { ASSERT(pParent->GetClassName() == "CPWL_Note_Contents"); - + if (CPWL_Wnd* pGrand = pParent->GetParentWindow()) { - ASSERT(pGrand->GetClassName() == "CPWL_NoteItem"); + ASSERT(pGrand->GetClassName() == "CPWL_NoteItem"); return (CPWL_NoteItem*)pGrand; } } @@ -1049,7 +1045,7 @@ FX_FLOAT CPWL_NoteItem::GetItemHeight(FX_FLOAT fLimitWidth) ASSERT(m_pContents != NULL); FX_FLOAT fRet = m_pDateTime->GetContentRect().Height(); - FX_FLOAT fBorderWidth = (FX_FLOAT)this->GetBorderWidth(); + FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); if (fLimitWidth > fBorderWidth * 2) fRet += m_pContents->GetContentsHeight(fLimitWidth - fBorderWidth * 2); fRet += POPUP_ITEM_HEAD_BOTTOM + POPUP_ITEM_BOTTOMWIDTH + fBorderWidth * 2; @@ -1099,23 +1095,23 @@ void CPWL_NoteItem::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp { switch (msg) { - case PNM_NOTEEDITCHANGED: + case PNM_NOTEEDITCHANGED: m_bSizeChanged = TRUE; - if (CPWL_Wnd* pParent = this->GetParentWindow()) + if (CPWL_Wnd* pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); } - return; + return; case PNM_SETCARETINFO: if (PWL_CARET_INFO * pInfo = (PWL_CARET_INFO*)wParam) { PWL_CARET_INFO newInfo = *pInfo; newInfo.bVisible = TRUE; - newInfo.ptHead = this->ChildToParent(pInfo->ptHead); - newInfo.ptFoot = this->ChildToParent(pInfo->ptFoot); + newInfo.ptHead = ChildToParent(pInfo->ptHead); + newInfo.ptFoot = ChildToParent(pInfo->ptFoot); - if (CPWL_Wnd * pParent = this->GetParentWindow()) + if (CPWL_Wnd * pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_SETCARETINFO, (intptr_t)&newInfo, 0); } @@ -1124,7 +1120,7 @@ void CPWL_NoteItem::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp case PNM_NOTERESET: m_bSizeChanged = TRUE; m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0); - + return; } @@ -1145,7 +1141,7 @@ void CPWL_NoteItem::PopupNoteItemMenu(const CPDF_Point& point) const CPWL_Note* CPWL_NoteItem::GetNote() const { - if (const CPWL_Wnd* pRoot = this->GetRootWnd()) + if (const CPWL_Wnd* pRoot = GetRootWnd()) { ASSERT(pRoot->GetClassName() == "CPWL_NoteItem"); CPWL_NoteItem* pNoteItem = (CPWL_NoteItem*)pRoot; @@ -1200,7 +1196,7 @@ void CPWL_NoteItem::EnableRead(FX_BOOL bEnabled) /* ---------------------------------- CPWL_Note ---------------------------------- */ -CPWL_Note::CPWL_Note(IPopup_Note* pPopupNote, IPWL_NoteNotify* pNoteNotify, IPWL_NoteHandler* pNoteHandler) : +CPWL_Note::CPWL_Note(IPopup_Note* pPopupNote, IPWL_NoteNotify* pNoteNotify, IPWL_NoteHandler* pNoteHandler) : m_pAuthor(NULL), m_pIcon(NULL), m_pCloseBox(NULL), @@ -1236,9 +1232,8 @@ void CPWL_Note::RePosChildWnd() m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0); ResetScrollBar(); m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0); - this->OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); - //ͬ²½ - if (const CPWL_Wnd* pWnd = this->GetFocused()) + OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); + if (const CPWL_Wnd* pWnd = GetFocused()) { if (pWnd->GetClassName() == "CPWL_Edit") { @@ -1246,8 +1241,6 @@ void CPWL_Note::RePosChildWnd() pEdit->SetCaret(pEdit->GetCaret()); } } - //CPDF_Point ptNew = m_pContents->GetScrollPos(); - //m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptNew.y); } FX_BOOL CPWL_Note::ResetScrollBar() @@ -1264,7 +1257,7 @@ FX_BOOL CPWL_Note::ResetScrollBar() m_pContentsBar->InvalidateRect(NULL); bScrollChanged = TRUE; } - } + } } else { @@ -1279,7 +1272,7 @@ FX_BOOL CPWL_Note::ResetScrollBar() if (bScrollChanged) { - CPDF_Rect rcNote = this->GetClientRect(); + CPDF_Rect rcNote = GetClientRect(); CPDF_Rect rcContents = m_pContents->GetWindowRect(); rcContents.right = rcNote.right - 3.0f; if (m_pContentsBar->IsVisible()) @@ -1297,7 +1290,7 @@ FX_BOOL CPWL_Note::ScrollBarShouldVisible() CPDF_Rect rcContentsFact = m_pContents->GetScrollArea(); CPDF_Rect rcContentsClient = m_pContents->GetClientRect(); - return rcContentsFact.Height() > rcContentsClient.Height(); + return rcContentsFact.Height() > rcContentsClient.Height(); } void CPWL_Note::SetOptionsText(const CFX_WideString& sText) @@ -1314,7 +1307,7 @@ void CPWL_Note::RePosNoteChildren() m_bResizing = TRUE; - if (this->IsValid()) + if (IsValid()) { ASSERT(m_pSubject != NULL); ASSERT(m_pDateTime != NULL); @@ -1361,7 +1354,7 @@ void CPWL_Note::RePosNoteChildren() rcSubject.right = PWL_MIN(rcSubject.left + m_pSubject->GetContentRect().Width() + 1.0f, rcDate.left - 1.0f); rcSubject.bottom = rcSubject.top - m_pSubject->GetContentRect().Height(); rcSubject.Normalize(); - m_pSubject->Move(rcSubject, TRUE, FALSE); + m_pSubject->Move(rcSubject, TRUE, FALSE); m_pSubject->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcSubject)); CPDF_Rect rcOptions = rcClient; @@ -1411,7 +1404,7 @@ void CPWL_Note::RePosNoteChildren() rcContentsBar.left = rcContentsBar.right - PWL_SCROLLBAR_WIDTH; rcContentsBar.Normalize(); m_pContentsBar->Move(rcContentsBar, TRUE, FALSE); - + m_rcCaption = rcClient; m_rcCaption.bottom = rcContents.top; } @@ -1419,7 +1412,7 @@ void CPWL_Note::RePosNoteChildren() m_bResizing = FALSE; } -//0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close / 5-options +//0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close / 5-options int32_t CPWL_Note::NoteHitTest(const CPDF_Point& point) const { ASSERT(m_pSubject != NULL); @@ -1458,7 +1451,7 @@ void CPWL_Note::CreateChildWnd(const PWL_CREATEPARAM & cp) CPWL_Color sTextColor; - if (CPWL_Utils::IsBlackOrWhite(this->GetBackgroundColor())) + if (CPWL_Utils::IsBlackOrWhite(GetBackgroundColor())) sTextColor = PWL_DEFAULT_WHITECOLOR; else sTextColor = PWL_DEFAULT_BLACKCOLOR; @@ -1468,7 +1461,7 @@ void CPWL_Note::CreateChildWnd(const PWL_CREATEPARAM & cp) acp.pParentWnd = this; acp.dwFlags = PWS_VISIBLE | PWS_CHILD | PES_LEFT | PES_TOP; acp.sTextColor = sTextColor; - m_pAuthor->Create(acp); + m_pAuthor->Create(acp); m_pCloseBox = new CPWL_Note_CloseBox; PWL_CREATEPARAM ccp = cp; @@ -1570,7 +1563,7 @@ FX_BOOL CPWL_Note::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD if (ptNew.y != ptScroll.y) { m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0); - m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, (intptr_t)&ptNew.y); + m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, (intptr_t)&ptNew.y); m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptNew.y); return TRUE; @@ -1587,7 +1580,7 @@ void CPWL_Note::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t case PNM_NOTEEDITCHANGED: { CPDF_Rect rcScroll = m_pContents->GetScrollArea(); - + PWL_SCROLL_INFO sInfo; sInfo.fContentMin = rcScroll.bottom; @@ -1607,10 +1600,10 @@ void CPWL_Note::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t { lParam++; m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0); - this->OnNotify(this, PNM_NOTEEDITCHANGED, 0, lParam); + OnNotify(this, PNM_NOTEEDITCHANGED, 0, lParam); } } - + if (!bScrollChanged) { if (m_pContentsBar->IsVisible()) @@ -1669,7 +1662,7 @@ void CPWL_Note::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t return; } - + if (pInfo->ptFoot.y < rcClient.bottom) { CPDF_Point pt = m_pContents->OutToIn(pInfo->ptFoot); @@ -1715,13 +1708,13 @@ FX_BOOL CPWL_Note::OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) { if (m_pOptions->WndHitTest(m_pOptions->ParentToChild(point))) { - if (IPWL_NoteNotify* pNotify = this->GetNoteNotify()) + if (IPWL_NoteNotify* pNotify = GetNoteNotify()) { int32_t x, y; PWLtoWnd(point, x, y); if (IFX_SystemHandler* pSH = GetSystemHandler()) pSH->ClientToScreen(GetAttachedHWnd(), x, y); - this->KillFocus(); + KillFocus(); pNotify->OnPopupMenu(x, y); return TRUE; diff --git a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp index ad293bc578..6d61705222 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/pdfwindow/PDFWindow.h" @@ -49,7 +49,7 @@ void PWL_FLOATRANGE::Set(FX_FLOAT min,FX_FLOAT max) FX_BOOL PWL_FLOATRANGE::In(FX_FLOAT x) const { - return (IsFloatBigger(x,fMin) || IsFloatEqual(x, fMin)) && + return (IsFloatBigger(x,fMin) || IsFloatEqual(x, fMin)) && (IsFloatSmaller(x, fMax) || IsFloatEqual(x, fMax)); } @@ -81,7 +81,7 @@ void PWL_SCROLL_PRIVATEDATA::SetScrollRange(FX_FLOAT min,FX_FLOAT max) if (IsFloatSmaller(fScrollPos, ScrollRange.fMin)) fScrollPos = ScrollRange.fMin; if (IsFloatBigger(fScrollPos, ScrollRange.fMax)) - fScrollPos = ScrollRange.fMax; + fScrollPos = ScrollRange.fMax; } void PWL_SCROLL_PRIVATEDATA::SetClientWidth(FX_FLOAT width) @@ -124,7 +124,7 @@ void PWL_SCROLL_PRIVATEDATA::SubSmall() void PWL_SCROLL_PRIVATEDATA::AddBig() { if (!SetPos(fScrollPos + fBigStep)) - SetPos(ScrollRange.fMax); + SetPos(ScrollRange.fMax); } void PWL_SCROLL_PRIVATEDATA::SubBig() @@ -172,12 +172,12 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) sAppStream << "q\n"; - CPDF_Point ptCenter = this->GetCenterPoint(); + CPDF_Point ptCenter = GetCenterPoint(); - switch (this->m_eScrollBarType) + switch (m_eScrollBarType) { case SBT_HSCROLL: - switch (this->m_eSBButtonType) + switch (m_eSBButtonType) { case PSBT_MIN: { @@ -194,7 +194,7 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) sButton << pt3.x << " " << pt3.y << " l\n"; sButton << pt1.x << " " << pt1.y << " l f\n"; - sAppStream << sButton; + sAppStream << sButton; } } break; @@ -213,7 +213,7 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) sButton << pt3.x << " " << pt3.y << " l\n"; sButton << pt1.x << " " << pt1.y << " l f\n"; - sAppStream << sButton; + sAppStream << sButton; } } break; @@ -222,7 +222,7 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) } break; case SBT_VSCROLL: - switch(this->m_eSBButtonType) + switch (m_eSBButtonType) { case PSBT_MIN: { @@ -239,7 +239,7 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) sButton << pt3.x << " " << pt3.y << " l\n"; sButton << pt1.x << " " << pt1.y << " l f\n"; - sAppStream << sButton; + sAppStream << sButton; } } break; @@ -258,7 +258,7 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) sButton << pt3.x << " " << pt3.y << " l\n"; sButton << pt1.x << " " << pt1.y << " l f\n"; - sAppStream << sButton; + sAppStream << sButton; } } break; @@ -280,14 +280,14 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p CPDF_Rect rectWnd = GetWindowRect(); if (rectWnd.IsEmpty()) return; - CPDF_Point ptCenter = this->GetCenterPoint(); - int32_t nTransparancy = this->GetTransparency(); + CPDF_Point ptCenter = GetCenterPoint(); + int32_t nTransparancy = GetTransparency(); - switch (this->m_eScrollBarType) + switch (m_eScrollBarType) { case SBT_HSCROLL: CPWL_Wnd::DrawThisAppearance(pDevice,pUser2Device); - switch (this->m_eSBButtonType) + switch (m_eSBButtonType) { case PSBT_MIN: { @@ -306,8 +306,8 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); - pDevice->DrawPath(&path, pUser2Device, NULL, - CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,nTransparancy), + pDevice->DrawPath(&path, pUser2Device, NULL, + CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,nTransparancy), 0, FXFILL_ALTERNATE); } } @@ -329,9 +329,9 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); - pDevice->DrawPath(&path, pUser2Device, NULL, - CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,nTransparancy), - 0, FXFILL_ALTERNATE); + pDevice->DrawPath(&path, pUser2Device, NULL, + CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,nTransparancy), + 0, FXFILL_ALTERNATE); } } break; @@ -340,25 +340,25 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p } break; case SBT_VSCROLL: - switch(this->m_eSBButtonType) + switch (m_eSBButtonType) { case PSBT_MIN: { //draw border CPDF_Rect rcDraw = rectWnd; - CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, + CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, ArgbEncode(nTransparancy,100,100,100),0.0f); //draw inner border rcDraw = CPWL_Utils::DeflateRect(rectWnd,0.5f); - CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, + CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, ArgbEncode(nTransparancy,255,255,255),1.0f); //draw background rcDraw = CPWL_Utils::DeflateRect(rectWnd,1.0f); - if (this->IsEnabled()) + if (IsEnabled()) CPWL_Utils::DrawShadow(pDevice, pUser2Device, TRUE, FALSE, rcDraw, nTransparancy, 80, 220); else CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw, ArgbEncode(255,255,255,255)); @@ -377,12 +377,12 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p CPDF_Point(fX+6.5f, fY+4.0f), CPDF_Point(fX+4.5f, fY+6.0f), CPDF_Point(fX+2.5f, fY+4.0f)}; - - if (this->IsEnabled()) + + if (IsEnabled()) CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7, ArgbEncode(nTransparancy,255,255,255)); else - CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7, + CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7, CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_HEAVYGRAYCOLOR,255)); } } @@ -391,17 +391,17 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p { //draw border CPDF_Rect rcDraw = rectWnd; - CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, + CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, ArgbEncode(nTransparancy,100,100,100),0.0f); - + //draw inner border rcDraw = CPWL_Utils::DeflateRect(rectWnd,0.5f); - CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, + CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, ArgbEncode(nTransparancy,255,255,255),1.0f); //draw background rcDraw = CPWL_Utils::DeflateRect(rectWnd,1.0f); - if (this->IsEnabled()) + if (IsEnabled()) CPWL_Utils::DrawShadow(pDevice, pUser2Device, TRUE, FALSE, rcDraw, nTransparancy, 80, 220); else CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw, ArgbEncode(255,255,255,255)); @@ -421,12 +421,12 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p CPDF_Point(fX+6.5f, fY+5.0f), CPDF_Point(fX+4.5f, fY+3.0f), CPDF_Point(fX+2.5f, fY+5.0f)}; - - if (this->IsEnabled()) + + if (IsEnabled()) CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7, ArgbEncode(nTransparancy,255,255,255)); else - CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7, + CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7, CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_HEAVYGRAYCOLOR,255)); } } @@ -437,79 +437,79 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p //draw border CPDF_Rect rcDraw = rectWnd; - CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, + CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, ArgbEncode(nTransparancy,100,100,100),0.0f); - + //draw inner border rcDraw = CPWL_Utils::DeflateRect(rectWnd,0.5f); - CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, + CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, ArgbEncode(nTransparancy,255,255,255),1.0f); - if (this->IsEnabled()) + if (IsEnabled()) { - //draw shadow effect - + //draw shadow effect + CPDF_Point ptTop = CPDF_Point(rectWnd.left,rectWnd.top-1.0f); CPDF_Point ptBottom = CPDF_Point(rectWnd.left,rectWnd.bottom+1.0f); ptTop.x += 1.5f; ptBottom.x += 1.5f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,210,210,210),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,220,220,220),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,240,240,240),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,240,240,240),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,210,210,210),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,180,180,180),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,150,150,150),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,150,150,150),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,180,180,180),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,210,210,210),1.0f); } else @@ -522,7 +522,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p if (rectWnd.Height() > 8.0f) { FX_COLORREF crStroke = ArgbEncode(nTransparancy,120,120,120); - if (!this->IsEnabled()) + if (!IsEnabled()) crStroke = CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_HEAVYGRAYCOLOR,255); FX_FLOAT nFrictionWidth = 5.0f; @@ -531,26 +531,26 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p CPDF_Point ptLeft = CPDF_Point(ptCenter.x - nFrictionWidth / 2.0f, ptCenter.y - nFrictionHeight / 2.0f + 0.5f); CPDF_Point ptRight = CPDF_Point(ptCenter.x + nFrictionWidth / 2.0f, ptCenter.y - nFrictionHeight / 2.0f + 0.5f); - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, crStroke,1.0f); ptLeft.y += 2.0f; ptRight.y += 2.0f; - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, crStroke,1.0f); ptLeft.y += 2.0f; ptRight.y += 2.0f; - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, crStroke,1.0f); /* ptLeft.y += 1.5f; ptRight.y += 1.5f; - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, ArgbEncode(nTransparancy,150,150,150),1.0f); */ } @@ -596,7 +596,7 @@ FX_BOOL CPWL_SBButton::OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag) CPWL_Wnd::OnMouseMove(point,nFlag); if (CPWL_Wnd * pParent = GetParentWindow()) - { + { pParent->OnNotify(this,PNM_MOUSEMOVE,0,(intptr_t)&point); /* @@ -640,29 +640,8 @@ void CPWL_ScrollBar::OnCreate(PWL_CREATEPARAM & cp) void CPWL_ScrollBar::RePosChildWnd() { - CPDF_Rect rcClient = this->GetClientRect(); - -/* - switch(m_sbType) - { - case SBT_HSCROLL: - if (rcClient.right - rcClient.left < PWL_SCROLLBAR_WIDTH || - rcClient.top - rcClient.bottom < PWL_SCROLLBAR_WIDTH) - { - SetVisible(FALSE); - } - break; - case SBT_VSCROLL: - if (rcClient.right - rcClient.left < PWL_SCROLLBAR_WIDTH || - rcClient.top - rcClient.bottom < PWL_SCROLLBAR_WIDTH) - { - SetVisible(FALSE); - } - break; - } -*/ + CPDF_Rect rcClient = GetClientRect(); CPDF_Rect rcMinButton,rcMaxButton; - FX_FLOAT fBWidth = 0; switch (m_sbType) @@ -711,18 +690,13 @@ void CPWL_ScrollBar::RePosChildWnd() else SetVisible(FALSE); } break; - } - -// if (IsVisible()) - { - if (m_pMinButton) - m_pMinButton->Move(rcMinButton,TRUE,FALSE); - - if (m_pMaxButton) - m_pMaxButton->Move(rcMaxButton,TRUE,FALSE); - - MovePosButton(FALSE); } + + if (m_pMinButton) + m_pMinButton->Move(rcMinButton, TRUE, FALSE); + if (m_pMaxButton) + m_pMaxButton->Move(rcMaxButton, TRUE, FALSE); + MovePosButton(FALSE); } void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) @@ -731,33 +705,32 @@ void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) if (IsVisible() && !rectWnd.IsEmpty()) { - CFX_ByteTextBuf sButton; + CFX_ByteTextBuf sButton; sButton << "q\n"; sButton << "0 w\n" << CPWL_Utils::GetColorAppStream(GetBackgroundColor(),TRUE); sButton << rectWnd.left << " " << rectWnd.bottom << " " - << rectWnd.right - rectWnd.left << " " << rectWnd.top - rectWnd.bottom << " re b Q\n"; + << rectWnd.right - rectWnd.left << " " << rectWnd.top - rectWnd.bottom << " re b Q\n"; - sAppStream << sButton; + sAppStream << sButton; } } void CPWL_ScrollBar::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device) { -// CPWL_Wnd::DrawThisAppearance(pDevice,pUser2Device); CPDF_Rect rectWnd = GetWindowRect(); if (IsVisible() && !rectWnd.IsEmpty()) { - CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rectWnd, this->GetBackgroundColor(), GetTransparency()); + CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rectWnd, GetBackgroundColor(), GetTransparency()); - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, - CPDF_Point(rectWnd.left+2.0f,rectWnd.top-2.0f), CPDF_Point(rectWnd.left+2.0f,rectWnd.bottom+2.0f), - ArgbEncode(this->GetTransparency(),100,100,100),1.0f); + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, + CPDF_Point(rectWnd.left+2.0f,rectWnd.top-2.0f), CPDF_Point(rectWnd.left+2.0f,rectWnd.bottom+2.0f), + ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f); - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, - CPDF_Point(rectWnd.right-2.0f,rectWnd.top-2.0f), CPDF_Point(rectWnd.right-2.0f,rectWnd.bottom+2.0f), - ArgbEncode(this->GetTransparency(),100,100,100),1.0f); + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, + CPDF_Point(rectWnd.right-2.0f,rectWnd.top-2.0f), CPDF_Point(rectWnd.right-2.0f,rectWnd.bottom+2.0f), + ArgbEncode(GetTransparency(), 100, 100, 100),1.0f); } } @@ -765,8 +738,6 @@ FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) { CPWL_Wnd::OnLButtonDown(point,nFlag); - //SetFocus(); - if (HasFlag(PWS_AUTOTRANSPARENT)) { if (GetTransparency() != 255) @@ -780,7 +751,7 @@ FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) if (m_pPosButton && m_pPosButton->IsVisible()) { - CPDF_Rect rcClient = this->GetClientRect(); + CPDF_Rect rcClient = GetClientRect(); CPDF_Rect rcPosButton = m_pPosButton->GetWindowRect(); switch (m_sbType) @@ -846,7 +817,7 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int switch (msg) { - case PNM_LBUTTONDOWN: + case PNM_LBUTTONDOWN: if (pWnd == m_pMinButton) { OnMinButtonLBDown(*(CPDF_Point*)lParam); @@ -859,23 +830,23 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int if (pWnd == m_pPosButton) { - OnPosButtonLBDown(*(CPDF_Point*)lParam); + OnPosButtonLBDown(*(CPDF_Point*)lParam); } break; case PNM_LBUTTONUP: if (pWnd == m_pMinButton) { - OnMinButtonLBUp(*(CPDF_Point*)lParam); + OnMinButtonLBUp(*(CPDF_Point*)lParam); } if (pWnd == m_pMaxButton) { - OnMaxButtonLBUp(*(CPDF_Point*)lParam); + OnMaxButtonLBUp(*(CPDF_Point*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonLBUp(*(CPDF_Point*)lParam); + OnPosButtonLBUp(*(CPDF_Point*)lParam); } break; case PNM_MOUSEMOVE: @@ -886,12 +857,12 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int if (pWnd == m_pMaxButton) { - OnMaxButtonMouseMove(*(CPDF_Point*)lParam); + OnMaxButtonMouseMove(*(CPDF_Point*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonMouseMove(*(CPDF_Point*)lParam); + OnPosButtonMouseMove(*(CPDF_Point*)lParam); } break; case PNM_SETSCROLLINFO: @@ -903,8 +874,8 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int m_OriginInfo = *pInfo; FX_FLOAT fMax = pInfo->fContentMax - pInfo->fContentMin - pInfo->fPlateWidth; fMax = fMax > 0.0f ? fMax : 0.0f; - this->SetScrollRange(0,fMax, pInfo->fPlateWidth); - this->SetScrollStep(pInfo->fBigStep,pInfo->fSmallStep); + SetScrollRange(0, fMax, pInfo->fPlateWidth); + SetScrollStep(pInfo->fBigStep, pInfo->fSmallStep); } } } @@ -912,7 +883,7 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int case PNM_SETSCROLLPOS: { FX_FLOAT fPos = *(FX_FLOAT*)lParam; - switch (this->m_sbType) + switch (m_sbType) { case SBT_HSCROLL: fPos = fPos - m_OriginInfo.fContentMin; @@ -921,7 +892,7 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int fPos = m_OriginInfo.fContentMax - fPos; break; } - this->SetScrollPos(fPos); + SetScrollPos(fPos); } break; } @@ -933,10 +904,10 @@ void CPWL_ScrollBar::CreateButtons(const PWL_CREATEPARAM & cp) scp.pParentWnd = this; scp.dwBorderWidth = 2; scp.nBorderStyle = PBS_BEVELED; - + scp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BORDER | PWS_BACKGROUND | PWS_NOREFRESHCLIP; - if (!m_pMinButton) + if (!m_pMinButton) { m_pMinButton = new CPWL_SBButton(m_sbType,PSBT_MIN); m_pMinButton->Create(scp); @@ -976,7 +947,7 @@ void CPWL_ScrollBar::SetScrollRange(FX_FLOAT fMin,FX_FLOAT fMax,FX_FLOAT fClient } else { - m_pPosButton->SetVisible(TRUE); + m_pPosButton->SetVisible(TRUE); MovePosButton(TRUE); } } @@ -1011,9 +982,9 @@ void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) CPDF_Rect rcClient; - CPDF_Rect rcPosArea,rcPosButton; + CPDF_Rect rcPosArea,rcPosButton; - rcClient = this->GetClientRect(); + rcClient = GetClientRect(); rcPosArea = GetScrollArea(); FX_FLOAT fLeft,fRight,fTop,fBottom; @@ -1037,7 +1008,7 @@ void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) rcPosArea.bottom, fRight , rcPosArea.top); - + break; case SBT_VSCROLL: fBottom = TrueToFace(m_sData.fScrollPos + m_sData.fClientWidth); @@ -1045,7 +1016,7 @@ void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) if (IsFloatSmaller(fTop - fBottom, PWL_SCROLLBAR_POSBUTTON_MINWIDTH)) fBottom = fTop - PWL_SCROLLBAR_POSBUTTON_MINWIDTH; - + if (IsFloatSmaller(fBottom, rcPosArea.bottom)) { fBottom = rcPosArea.bottom; @@ -1053,10 +1024,10 @@ void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) } rcPosButton = CPDF_Rect(rcPosArea.left, - fBottom, + fBottom, rcPosArea.right, fTop); - + break; } @@ -1081,7 +1052,7 @@ void CPWL_ScrollBar::OnMinButtonLBUp(const CPDF_Point & point) } void CPWL_ScrollBar::OnMinButtonMouseMove(const CPDF_Point & point) -{ +{ } void CPWL_ScrollBar::OnMaxButtonLBDown(const CPDF_Point & point) @@ -1091,7 +1062,7 @@ void CPWL_ScrollBar::OnMaxButtonLBDown(const CPDF_Point & point) NotifyScrollWindow(); m_bMinOrMax = FALSE; - + EndTimer(); BeginTimer(100); } @@ -1101,7 +1072,7 @@ void CPWL_ScrollBar::OnMaxButtonLBUp(const CPDF_Point & point) } void CPWL_ScrollBar::OnMaxButtonMouseMove(const CPDF_Point & point) -{ +{ } void CPWL_ScrollBar::OnPosButtonLBDown(const CPDF_Point & point) @@ -1171,10 +1142,10 @@ void CPWL_ScrollBar::OnPosButtonMouseMove(const CPDF_Point & point) } m_sData.SetPos(fNewPos); - + break; case SBT_VSCROLL: - + if (IsFloatSmaller(fNewPos, m_sData.ScrollRange.fMin)) { fNewPos = m_sData.ScrollRange.fMin; @@ -1183,15 +1154,15 @@ void CPWL_ScrollBar::OnPosButtonMouseMove(const CPDF_Point & point) if (IsFloatBigger(fNewPos, m_sData.ScrollRange.fMax)) { fNewPos = m_sData.ScrollRange.fMax; - } + } m_sData.SetPos(fNewPos); - + break; - } - + } + if (!IsFloatEqual(fOldScrollPos, m_sData.fScrollPos)) - { + { MovePosButton(TRUE); if (m_bNotifyForever) @@ -1202,10 +1173,10 @@ void CPWL_ScrollBar::OnPosButtonMouseMove(const CPDF_Point & point) void CPWL_ScrollBar::NotifyScrollWindow() { - if (CPWL_Wnd * pParent = this->GetParentWindow()) + if (CPWL_Wnd * pParent = GetParentWindow()) { FX_FLOAT fPos; - switch (this->m_sbType) + switch (m_sbType) { case SBT_HSCROLL: fPos = m_OriginInfo.fContentMin + m_sData.fScrollPos; @@ -1213,7 +1184,7 @@ void CPWL_ScrollBar::NotifyScrollWindow() case SBT_VSCROLL: fPos = m_OriginInfo.fContentMax - m_sData.fScrollPos; break; - } + } pParent->OnNotify(this,PNM_SCROLLWINDOW,(intptr_t)m_sbType,(intptr_t)&fPos); } } @@ -1260,7 +1231,7 @@ CPDF_Rect CPWL_ScrollBar::GetScrollArea() const } break; } - + rcArea.Normalize(); return rcArea; @@ -1268,7 +1239,7 @@ CPDF_Rect CPWL_ScrollBar::GetScrollArea() const FX_FLOAT CPWL_ScrollBar::TrueToFace(FX_FLOAT fTrue) { - CPDF_Rect rcPosArea; + CPDF_Rect rcPosArea; rcPosArea = GetScrollArea(); FX_FLOAT fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth; @@ -1284,14 +1255,14 @@ FX_FLOAT CPWL_ScrollBar::TrueToFace(FX_FLOAT fTrue) case SBT_VSCROLL: fFace = rcPosArea.top - fTrue * (rcPosArea.top - rcPosArea.bottom) / fFactWidth; break; - } + } return fFace; } FX_FLOAT CPWL_ScrollBar::FaceToTrue(FX_FLOAT fFace) { - CPDF_Rect rcPosArea; + CPDF_Rect rcPosArea; rcPosArea = GetScrollArea(); FX_FLOAT fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth; @@ -1307,7 +1278,7 @@ FX_FLOAT CPWL_ScrollBar::FaceToTrue(FX_FLOAT fFace) case SBT_VSCROLL: fTrue = (rcPosArea.top - fFace) * fFactWidth / (rcPosArea.top - rcPosArea.bottom); break; - } + } return fTrue; } @@ -1321,7 +1292,7 @@ void CPWL_ScrollBar::TimerProc() { PWL_SCROLL_PRIVATEDATA sTemp = m_sData; - if (m_bMinOrMax)m_sData.SubSmall(); + if (m_bMinOrMax)m_sData.SubSmall(); else m_sData.AddSmall(); if (FXSYS_memcmp(&m_sData, &sTemp, sizeof(PWL_SCROLL_PRIVATEDATA)) != 0) @@ -1330,24 +1301,3 @@ void CPWL_ScrollBar::TimerProc() NotifyScrollWindow(); } } - -/* -void CPWL_ScrollBar::OnSetFocus() -{ - if (GetTransparency() != 255) - { - SetTransparency(255); - InvalidateRect(); - } -} - -void CPWL_ScrollBar::OnKillFocus() -{ - if (GetTransparency() != PWL_SCROLLBAR_TRANSPARANCY) - { - SetTransparency(PWL_SCROLLBAR_TRANSPARANCY); - InvalidateRect(); - } -} -*/ - diff --git a/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp b/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp index 609beeb2a7..6eade26b50 100644 --- a/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp @@ -27,7 +27,7 @@ CFX_ByteString CPWL_PushButton::GetClassName() const CPDF_Rect CPWL_PushButton::GetFocusRect() const { - return CPWL_Utils::DeflateRect(this->GetWindowRect(),(FX_FLOAT)GetBorderWidth()); + return CPWL_Utils::DeflateRect(GetWindowRect(), (FX_FLOAT)GetBorderWidth()); } /* --------------------------- CPWL_CheckBox ---------------------------- */ diff --git a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp index 884807364e..b22846931f 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp @@ -2773,20 +2773,6 @@ void CPWL_Utils::GetGraphics_Foxit(CFX_ByteString& sPathData, CFX_PathData& path CPWL_PathData(CPWL_Point(crInBox.right, crInBox.bottom), PWLPT_LINETO), CPWL_PathData(CPWL_Point(crInBox.right, crInBox.top), PWLPT_LINETO), CPWL_PathData(CPWL_Point(crInBox.left + fWidth*0.90f, crInBox.top), PWLPT_LINETO), - - /* - CPWL_PathData(CPWL_Point(crBBox.left, crBBox.top), PWLPT_MOVETO), - CPWL_PathData(CPWL_Point(crBBox.right, crBBox.top), PWLPT_LINETO), - CPWL_PathData(CPWL_Point(crBBox.right, crBBox.bottom), PWLPT_LINETO), - CPWL_PathData(CPWL_Point(crBBox.left, crBBox.bottom), PWLPT_LINETO), - CPWL_PathData(CPWL_Point(crBBox.left, crBBox.top), PWLPT_LINETO), - - CPWL_PathData(CPWL_Point(crBBox.left+fOutWidth*0.04f, crBBox.top-fOutHeight*0.04f), PWLPT_MOVETO), - CPWL_PathData(CPWL_Point(crBBox.right-fOutWidth*0.04f, crBBox.top-fOutHeight*0.04f), PWLPT_LINETO), - CPWL_PathData(CPWL_Point(crBBox.right-fOutWidth*0.04f, crBBox.bottom+fOutHeight*0.04f), PWLPT_LINETO), - CPWL_PathData(CPWL_Point(crBBox.left+fOutWidth*0.04f, crBBox.bottom+fOutHeight*0.04f), PWLPT_LINETO), - CPWL_PathData(CPWL_Point(crBBox.left+fOutWidth*0.04f, crBBox.top-fOutHeight*0.04f), PWLPT_LINETO), - */ }; if(type == PWLPT_STREAM) @@ -2795,47 +2781,47 @@ void CPWL_Utils::GetGraphics_Foxit(CFX_ByteString& sPathData, CFX_PathData& path GetPathDataFromArray(path, PathArray, 23); } -void CPWL_Color::ConvertColorType(int32_t nColorType) +void CPWL_Color::ConvertColorType(int32_t other_nColorType) { - switch (this->nColorType) + switch (other_nColorType) { case COLORTYPE_TRANSPARENT: break; case COLORTYPE_GRAY: - switch (nColorType) + switch (other_nColorType) { case COLORTYPE_RGB: - CPWL_Utils::ConvertGRAY2RGB(this->fColor1, this->fColor1, this->fColor2, this->fColor3); + CPWL_Utils::ConvertGRAY2RGB(fColor1, fColor1, fColor2, fColor3); break; case COLORTYPE_CMYK: - CPWL_Utils::ConvertGRAY2CMYK(this->fColor1, this->fColor1, this->fColor2, this->fColor3, this->fColor4); + CPWL_Utils::ConvertGRAY2CMYK(fColor1, fColor1, fColor2, fColor3, fColor4); break; } break; case COLORTYPE_RGB: - switch (nColorType) + switch (other_nColorType) { case COLORTYPE_GRAY: - CPWL_Utils::ConvertRGB2GRAY(this->fColor1, this->fColor2, this->fColor3, this->fColor1); + CPWL_Utils::ConvertRGB2GRAY(fColor1, fColor2, fColor3, fColor1); break; case COLORTYPE_CMYK: - CPWL_Utils::ConvertRGB2CMYK(this->fColor1, this->fColor2, this->fColor3, this->fColor1, this->fColor2, this->fColor3, this->fColor4); + CPWL_Utils::ConvertRGB2CMYK(fColor1, fColor2, fColor3, fColor1, fColor2, fColor3, fColor4); break; } break; case COLORTYPE_CMYK: - switch (nColorType) + switch (other_nColorType) { case COLORTYPE_GRAY: - CPWL_Utils::ConvertCMYK2GRAY(this->fColor1, this->fColor2, this->fColor3, this->fColor4, this->fColor1); + CPWL_Utils::ConvertCMYK2GRAY(fColor1, fColor2, fColor3, fColor4, fColor1); break; case COLORTYPE_RGB: - CPWL_Utils::ConvertCMYK2RGB(this->fColor1, this->fColor2, this->fColor3, this->fColor4, this->fColor1, this->fColor2, this->fColor3); + CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4, fColor1, fColor2, fColor3); break; } break; } - this->nColorType = nColorType; + nColorType = other_nColorType; } diff --git a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp index c621508885..8ee9967763 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/pdfwindow/PDFWindow.h" @@ -18,7 +18,7 @@ static CFX_MapPtrTemplate<int32_t, CPWL_Timer*>& GetPWLTimeMap() return *timeMap; } -CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler) : +CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler) : m_nTimerID(0), m_pAttached(pAttached), m_pSystemHandler(pSystemHandler) @@ -33,7 +33,7 @@ CPWL_Timer::~CPWL_Timer() } int32_t CPWL_Timer::SetPWLTimer(int32_t nElapse) -{ +{ if (m_nTimerID != 0) KillPWLTimer(); m_nTimerID = m_pSystemHandler->SetTimer(nElapse, TimerProc); GetPWLTimeMap().SetAt(m_nTimerID, this); @@ -56,8 +56,8 @@ void CPWL_Timer::TimerProc(int32_t idEvent) if (GetPWLTimeMap().Lookup(idEvent, pTimer)) { if (pTimer) - { - if (pTimer->m_pAttached) + { + if (pTimer->m_pAttached) pTimer->m_pAttached->TimerProc(); } } @@ -153,7 +153,7 @@ public: for( int32_t i=0,sz=m_aKeyboardPath.GetSize(); i<sz; i++) if (m_aKeyboardPath.GetAt(i) == pWnd) return TRUE; - + return FALSE; } @@ -223,7 +223,7 @@ CPWL_Wnd::CPWL_Wnd() : m_pVScrollBar(NULL), m_rcWindow(), m_rcClip(), - m_bCreated(FALSE), + m_bCreated(FALSE), m_bVisible(FALSE), m_bNotifying(FALSE), m_bEnabled(TRUE) @@ -261,9 +261,9 @@ void CPWL_Wnd::Create(const PWL_CREATEPARAM & cp) ccp.dwFlags &= 0xFFFF0000L; //remove sub styles ccp.mtChild = CPDF_Matrix(1,0,0,1,0,0); - + CreateScrollBar(ccp); - CreateChildWnd(ccp); + CreateChildWnd(ccp); m_bVisible = HasFlag(PWS_VISIBLE); @@ -312,7 +312,7 @@ void CPWL_Wnd::Destroy() DestroyMsgControl(); FXSYS_memset(&m_sPrivateParam, 0, sizeof(PWL_CREATEPARAM)); - m_aChildren.RemoveAll(); + m_aChildren.RemoveAll(); m_pVScrollBar = NULL; } @@ -320,23 +320,22 @@ void CPWL_Wnd::Move(const CPDF_Rect & rcNew, FX_BOOL bReset,FX_BOOL bRefresh) { if (IsValid()) { - CPDF_Rect rcOld = this->GetWindowRect(); + CPDF_Rect rcOld = GetWindowRect(); m_rcWindow = rcNew; m_rcWindow.Normalize(); - //m_rcClip = CPWL_Utils::InflateRect(m_rcWindow,1.0f); //for special caret if (rcOld.left != rcNew.left || rcOld.right != rcNew.right || rcOld.top != rcNew.top || rcOld.bottom != rcNew.bottom) { if (bReset) { - RePosChildWnd(); - } + RePosChildWnd(); + } } if (bRefresh) - { + { InvalidateRectMove(rcOld,rcNew); } @@ -350,32 +349,6 @@ void CPWL_Wnd::InvalidateRectMove(const CPDF_Rect & rcOld, const CPDF_Rect & rc rcUnion.Union(rcNew); InvalidateRect(&rcUnion); - - /* - CPDF_Rect SubArray[4]; - - rcOld.Substract4(rcNew,SubArray); - for (int32_t i=0;i<4;i++) - { - if (SubArray[i].left == 0 && - SubArray[i].right == 0 && - SubArray[i].top == 0 && - SubArray[i].bottom == 0)continue; - - InvalidateRect(&CPWL_Utils::InflateRect(SubArray[i],2)); - } - - rcNew.Substract4(rcOld,SubArray); - for (int32_t j=0;j<4;j++) - { - if (SubArray[j].left == 0 && - SubArray[j].right == 0 && - SubArray[j].top == 0 && - SubArray[j].bottom == 0)continue; - - InvalidateRect(&CPWL_Utils::InflateRect(SubArray[j],2)); - } - */ } void CPWL_Wnd::GetAppearanceStream(CFX_ByteString & sAppStream) @@ -400,25 +373,26 @@ void CPWL_Wnd::GetAppearanceStream(CFX_ByteTextBuf & sAppStream) //if don't set,Get default apperance stream void CPWL_Wnd::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) { - CPDF_Rect rectWnd = GetWindowRect(); - if (!rectWnd.IsEmpty()) - { - CFX_ByteTextBuf sThis; + CPDF_Rect rectWnd = GetWindowRect(); + if (!rectWnd.IsEmpty()) { + CFX_ByteTextBuf sThis; - if (HasFlag(PWS_BACKGROUND)) - sThis << CPWL_Utils::GetRectFillAppStream(rectWnd,this->GetBackgroundColor()); + if (HasFlag(PWS_BACKGROUND)) + sThis << CPWL_Utils::GetRectFillAppStream(rectWnd, GetBackgroundColor()); - if (HasFlag(PWS_BORDER)) - sThis << CPWL_Utils::GetBorderAppStream(rectWnd, - (FX_FLOAT)GetBorderWidth(), - GetBorderColor(), - this->GetBorderLeftTopColor(this->GetBorderStyle()), - this->GetBorderRightBottomColor(this->GetBorderStyle()), - this->GetBorderStyle(), - this->GetBorderDash()); - - sAppStream << sThis; - } + if (HasFlag(PWS_BORDER)) { + sThis << CPWL_Utils::GetBorderAppStream( + rectWnd, + (FX_FLOAT)GetBorderWidth(), + GetBorderColor(), + GetBorderLeftTopColor(GetBorderStyle()), + GetBorderRightBottomColor(GetBorderStyle()), + GetBorderStyle(), + GetBorderDash()); + } + + sAppStream << sThis; + } } void CPWL_Wnd::GetChildAppearanceStream(CFX_ByteTextBuf & sAppStream) @@ -445,11 +419,11 @@ void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2 { CPDF_Rect rectWnd = GetWindowRect(); if (!rectWnd.IsEmpty()) - { + { if (HasFlag(PWS_BACKGROUND)) { CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rectWnd,(FX_FLOAT)(GetBorderWidth()+GetInnerBorderWidth())); - CPWL_Utils::DrawFillRect(pDevice,pUser2Device,rcClient,this->GetBackgroundColor(),GetTransparency()); + CPWL_Utils::DrawFillRect(pDevice,pUser2Device,rcClient, GetBackgroundColor(), GetTransparency()); } if (HasFlag(PWS_BORDER)) @@ -458,11 +432,11 @@ void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2 rectWnd, (FX_FLOAT)GetBorderWidth(), GetBorderColor(), - this->GetBorderLeftTopColor(this->GetBorderStyle()), - this->GetBorderRightBottomColor(this->GetBorderStyle()), - this->GetBorderStyle(), - this->GetBorderDash(), - GetTransparency()); + GetBorderLeftTopColor(GetBorderStyle()), + GetBorderRightBottomColor(GetBorderStyle()), + GetBorderStyle(), + GetBorderDash(), + GetTransparency()); } } @@ -494,7 +468,7 @@ void CPWL_Wnd::InvalidateRect(CPDF_Rect* pRect) if (!HasFlag(PWS_NOREFRESHCLIP)) { - CPDF_Rect rcClip = GetClipRect(); + CPDF_Rect rcClip = GetClipRect(); if (!rcClip.IsEmpty()) { rcRefresh.Intersect(rcClip); @@ -570,7 +544,7 @@ FX_BOOL CPWL_Wnd::mouse_method_name(const CPDF_Point & point, FX_DWORD nFlag)\ }\ }\ }\ - if (this->WndHitTest(point))\ + if (WndHitTest(point))\ SetCursor();\ }\ }\ @@ -639,10 +613,10 @@ void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t switch (msg) { case PNM_ADDCHILD: - this->AddChild(pWnd); + AddChild(pWnd); break; case PNM_REMOVECHILD: - this->RemoveChild(pWnd); + RemoveChild(pWnd); break; default: break; @@ -679,7 +653,7 @@ CPDF_Rect CPWL_Wnd::GetClientRect() const CPDF_Rect rcWindow = GetWindowRect(); CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow,(FX_FLOAT)(GetBorderWidth()+GetInnerBorderWidth())); - if (CPWL_ScrollBar * pVSB = this->GetVScrollBar()) + if (CPWL_ScrollBar * pVSB = GetVScrollBar()) rcClient.right -= pVSB->GetScrollBarWidth(); rcClient.Normalize(); @@ -842,7 +816,7 @@ void CPWL_Wnd::CreateVScrollBar(const PWL_CREATEPARAM & cp) //flags scp.dwFlags = PWS_CHILD| PWS_BACKGROUND | PWS_AUTOTRANSPARENT | PWS_NOREFRESHCLIP; - + scp.pParentWnd = this; scp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR; scp.eCursorType = FXCT_ARROW; @@ -929,9 +903,9 @@ void CPWL_Wnd::SetVisible(FX_BOOL bVisible) if (bVisible != m_bVisible) { m_bVisible = bVisible; - RePosChildWnd(); + RePosChildWnd(); InvalidateRect(); - } + } } } @@ -955,7 +929,7 @@ void CPWL_Wnd::RePosChildWnd() { CPDF_Rect rcContent = CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT)(GetBorderWidth()+GetInnerBorderWidth())); - CPWL_ScrollBar * pVSB = this->GetVScrollBar(); + CPWL_ScrollBar * pVSB = GetVScrollBar(); CPDF_Rect rcVScroll = CPDF_Rect(rcContent.right - PWL_SCROLLBAR_WIDTH, rcContent.bottom, @@ -971,11 +945,11 @@ void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM & cp) void CPWL_Wnd::SetCursor() { - if (IsValid()) + if (IsValid()) { if (IFX_SystemHandler* pSH = GetSystemHandler()) { - int32_t nCursorType = this->GetCreationParam().eCursorType; + int32_t nCursorType = GetCreationParam().eCursorType; pSH->SetCursor(nCursorType); } } @@ -1030,17 +1004,17 @@ FX_BOOL CPWL_Wnd::IsFocused() const CPDF_Rect CPWL_Wnd::GetFocusRect() const { - return CPWL_Utils::InflateRect(this->GetWindowRect(),1); + return CPWL_Utils::InflateRect(GetWindowRect(),1); } FX_FLOAT CPWL_Wnd::GetFontSize() const { - return this->m_sPrivateParam.fFontSize; + return m_sPrivateParam.fFontSize; } void CPWL_Wnd::SetFontSize(FX_FLOAT fFontSize) { - this->m_sPrivateParam.fFontSize = fFontSize; + m_sPrivateParam.fFontSize = fFontSize; } IFX_SystemHandler* CPWL_Wnd::GetSystemHandler() const @@ -1131,7 +1105,7 @@ void CPWL_Wnd::SetTransparency(int32_t nTransparency) CPDF_Matrix CPWL_Wnd::GetWindowMatrix() const { - CPDF_Matrix mt = this->GetChildToRoot(); + CPDF_Matrix mt = GetChildToRoot(); if (IPWL_Provider* pProvider = GetProvider()) { @@ -1139,19 +1113,6 @@ CPDF_Matrix CPWL_Wnd::GetWindowMatrix() const return mt; } -/* - if (CReader_App* pApp = CPWL_Module::GetReaderApp()) - if (CReader_Document* pDocument = pApp->GetCurrentDocument()) - if (CReader_DocView* pDocView = pDocument->GetCurrentDocView()) - { - CPDF_Matrix mtPageView; - pDocView->GetCurrentMatrix(mtPageView); - mt.Concat(mtPageView); - return mt; - } - -*/ - return mt; } @@ -1168,7 +1129,7 @@ FX_RECT CPWL_Wnd::PWLtoWnd(const CPDF_Rect & rect) const { CPDF_Rect rcTemp = rect; CPDF_Matrix mt = GetWindowMatrix(); - mt.TransformRect(rcTemp); + mt.TransformRect(rcTemp); return FX_RECT((int32_t)(rcTemp.left+0.5), (int32_t)(rcTemp.bottom+0.5), (int32_t)(rcTemp.right+0.5), (int32_t)(rcTemp.top+0.5)); } @@ -1234,7 +1195,7 @@ CPDF_Rect CPWL_Wnd::ParentToChild(const CPDF_Rect& rect) const CPDF_Matrix CPWL_Wnd::GetChildToRoot() const { CPDF_Matrix mt(1,0,0,1,0,0); - + if (HasFlag(PWS_CHILD)) { const CPWL_Wnd* pParent = this; @@ -1283,12 +1244,12 @@ void CPWL_Wnd::EnableWindow(FX_BOOL bEnable) } } - this->m_bEnabled = bEnable; + m_bEnabled = bEnable; if (bEnable) - this->OnEnabled(); + OnEnabled(); else - this->OnDisabled(); + OnDisabled(); } } |