diff options
Diffstat (limited to 'fpdfsdk/src/pdfwindow')
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Button.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Caret.cpp | 10 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp | 9 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Edit.cpp | 49 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp | 7 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_FontMap.cpp | 18 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Icon.cpp | 22 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_IconList.cpp | 9 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Label.cpp | 3 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_ListBox.cpp | 11 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp | 3 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Note.cpp | 40 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp | 7 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Signature.cpp | 32 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp | 7 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Utils.cpp | 102 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Wnd.cpp | 35 |
17 files changed, 103 insertions, 266 deletions
diff --git a/fpdfsdk/src/pdfwindow/PWL_Button.cpp b/fpdfsdk/src/pdfwindow/PWL_Button.cpp index e9c2647aa2..5c78383380 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Button.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Button.cpp @@ -4,18 +4,13 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" #include "fpdfsdk/include/pdfwindow/PWL_Button.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" -/* ------------------------------- CPWL_Button - * ---------------------------------- */ - CPWL_Button::CPWL_Button() : m_bMouseDown(FALSE) {} CPWL_Button::~CPWL_Button() { - // PWL_TRACE("~CPWL_Button\n"); } CFX_ByteString CPWL_Button::GetClassName() const { diff --git a/fpdfsdk/src/pdfwindow/PWL_Caret.cpp b/fpdfsdk/src/pdfwindow/PWL_Caret.cpp index d129c2c7d3..75c951068a 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Caret.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Caret.cpp @@ -4,17 +4,12 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" #include "fpdfsdk/include/pdfwindow/PWL_Caret.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" #define PWL_CARET_FLASHINTERVAL 500 -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - CPWL_Caret::CPWL_Caret() : m_bFlash(FALSE), m_ptHead(0, 0), @@ -125,7 +120,6 @@ void CPWL_Caret::SetCaret(FX_BOOL bVisible, m_ptFoot = ptFoot; m_bFlash = TRUE; - // Move(GetCaretRect(),FALSE,TRUE); Move(m_rcInvalid, FALSE, TRUE); } } else { @@ -138,7 +132,6 @@ void CPWL_Caret::SetCaret(FX_BOOL bVisible, CPWL_Wnd::SetVisible(TRUE); m_bFlash = TRUE; - // Move(GetCaretRect(),FALSE,TRUE); Move(m_rcInvalid, FALSE, TRUE); } } else { @@ -160,6 +153,7 @@ void CPWL_Caret::InvalidateRect(CPDF_Rect* pRect) { rcRefresh.bottom -= 1; CPWL_Wnd::InvalidateRect(&rcRefresh); - } else + } else { CPWL_Wnd::InvalidateRect(pRect); + } } diff --git a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp index 71994ea27d..f5f3a7873c 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp @@ -4,13 +4,14 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" #include "fpdfsdk/include/pdfwindow/PWL_ComboBox.h" + #include "fpdfsdk/include/pdfwindow/PWL_Edit.h" #include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h" #include "fpdfsdk/include/pdfwindow/PWL_ListBox.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" +#include "public/fpdf_fwlevent.h" #define PWLCB_DEFAULTFONTSIZE 12.0f @@ -19,8 +20,6 @@ #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) -/* ---------------------------- CPWL_CBListBox ---------------------------- */ - FX_BOOL CPWL_CBListBox::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); @@ -108,8 +107,6 @@ FX_BOOL CPWL_CBListBox::OnCharWithExit(FX_WORD nChar, return TRUE; } -/* ---------------------------- CPWL_CBButton ---------------------------- */ - void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { CPWL_Wnd::GetThisAppearanceStream(sAppStream); @@ -199,8 +196,6 @@ FX_BOOL CPWL_CBButton::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { return TRUE; } -/* ---------------------------- CPWL_ComboBox ---------------------------- */ - CPWL_ComboBox::CPWL_ComboBox() : m_pEdit(NULL), m_pButton(NULL), diff --git a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp index 6d32b7270f..8ddb7dfb6e 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp @@ -4,18 +4,17 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "fpdfsdk/include/pdfwindow/PWL_Edit.h" + #include "core/include/fxcrt/fx_safe_types.h" #include "core/include/fxcrt/fx_xml.h" -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" #include "fpdfsdk/include/pdfwindow/PWL_Caret.h" -#include "fpdfsdk/include/pdfwindow/PWL_Edit.h" #include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h" #include "fpdfsdk/include/pdfwindow/PWL_FontMap.h" #include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" - -/* ---------------------------- CPWL_Edit ------------------------------ */ +#include "public/fpdf_fwlevent.h" CPWL_Edit::CPWL_Edit() : m_pFillerNotify(NULL), m_pSpellCheck(NULL), m_bFocus(FALSE) { @@ -101,12 +100,12 @@ CPDF_Rect CPWL_Edit::GetClientRect() const { } void CPWL_Edit::SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat, - FX_BOOL bPaint /* = TRUE*/) { + FX_BOOL bPaint) { m_pEdit->SetAlignmentH((int32_t)nFormat, bPaint); } void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, - FX_BOOL bPaint /* = TRUE*/) { + FX_BOOL bPaint) { m_pEdit->SetAlignmentV((int32_t)nFormat, bPaint); } @@ -1126,43 +1125,39 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place, if (bLatin) { while (pIterator->NextWord()) { - if (pIterator->GetWord(wordinfo) && - FX_EDIT_ISLATINWORD(wordinfo.Word)) { - wpEnd = pIterator->GetAt(); - continue; - } else + if (!pIterator->GetWord(wordinfo) || + !FX_EDIT_ISLATINWORD(wordinfo.Word)) { break; - }; + } + + wpEnd = pIterator->GetAt(); + } } else if (bArabic) { while (pIterator->NextWord()) { - if (pIterator->GetWord(wordinfo) && PWL_ISARABICWORD(wordinfo.Word)) { - wpEnd = pIterator->GetAt(); - continue; - } else + if (!pIterator->GetWord(wordinfo) || !PWL_ISARABICWORD(wordinfo.Word)) break; - }; + + wpEnd = pIterator->GetAt(); + } } pIterator->SetAt(place); if (bLatin) { do { - if (pIterator->GetWord(wordinfo) && - FX_EDIT_ISLATINWORD(wordinfo.Word)) { - continue; - } else { - wpStart = pIterator->GetAt(); + if (!pIterator->GetWord(wordinfo) || + !FX_EDIT_ISLATINWORD(wordinfo.Word)) { break; } + + wpStart = pIterator->GetAt(); } while (pIterator->PrevWord()); } else if (bArabic) { do { - if (pIterator->GetWord(wordinfo) && PWL_ISARABICWORD(wordinfo.Word)) { - continue; - } else { - wpStart = pIterator->GetAt(); + if (!pIterator->GetWord(wordinfo) || !PWL_ISARABICWORD(wordinfo.Word)) break; - } + + wpStart = pIterator->GetAt(); } while (pIterator->PrevWord()); } diff --git a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp index 8d54ae0a13..e54810e0ce 100644 --- a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp @@ -4,21 +4,20 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" -#include "fpdfsdk/include/pdfwindow/PWL_Caret.h" #include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h" + +#include "fpdfsdk/include/pdfwindow/PWL_Caret.h" #include "fpdfsdk/include/pdfwindow/PWL_FontMap.h" #include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" +#include "public/fpdf_fwlevent.h" #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) -/* ---------------------------- CPWL_EditCtrl ------------------------------ */ - CPWL_EditCtrl::CPWL_EditCtrl() : m_pEdit(NULL), m_pEditCaret(NULL), diff --git a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp index fadea905d4..e418e8b380 100644 --- a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp @@ -4,14 +4,13 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" #include "fpdfsdk/include/pdfwindow/PWL_FontMap.h" + +#include "core/include/fpdfapi/fpdf_module.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" #define DEFAULT_FONT_NAME "Helvetica" -/* ------------------------------ CPWL_FontMap ------------------------------ */ - CPWL_FontMap::CPWL_FontMap(IFX_SystemHandler* pSystemHandler) : m_pPDFDoc(NULL), m_pSystemHandler(pSystemHandler) { ASSERT(m_pSystemHandler); @@ -239,13 +238,6 @@ int32_t CPWL_FontMap::GetPWLFontIndex(FX_WORD word, int32_t nCharset) { if (!pNewFont) return -1; - /* - if (CPDF_Font* pFont = GetPDFFont(nFind)) - { - PWLFont.AddWordToFontDict(pFontDict, word); - } - */ - CFX_ByteString sAlias = EncodeFontAlias("Arial_Chrome", nCharset); AddedFont(pNewFont, sAlias); @@ -313,9 +305,9 @@ CPDF_Font* CPWL_FontMap::AddStandardFont(CPDF_Document* pDoc, CPDF_Font* pFont = NULL; - if (sFontName == "ZapfDingbats") + if (sFontName == "ZapfDingbats") { pFont = pDoc->AddStandardFont(sFontName, NULL); - else { + } else { CPDF_FontEncoding fe(PDFFONT_ENCODING_WINANSI); pFont = pDoc->AddStandardFont(sFontName, &fe); } @@ -499,8 +491,6 @@ int32_t CPWL_FontMap::CharSetFromUnicode(FX_WORD word, int32_t nOldCharset) { return ANSI_CHARSET; } -/* ------------------------ CPWL_DocFontMap ------------------------ */ - 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 db5355c59e..6afd76c5c6 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp @@ -4,14 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" #include "fpdfsdk/include/pdfwindow/PWL_Icon.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" -/* ------------------------------- CPWL_Image ---------------------------------- - */ - CPWL_Image::CPWL_Image() : m_pPDFStream(NULL) {} CPWL_Image::~CPWL_Image() {} @@ -83,15 +79,15 @@ CFX_Matrix CPWL_Image::GetImageMatrix() { } CFX_ByteString CPWL_Image::GetImageAlias() { - if (m_sImageAlias.IsEmpty()) { - if (m_pPDFStream) { - if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) { - return pDict->GetString("Name"); - } - } - } else + if (!m_sImageAlias.IsEmpty()) return m_sImageAlias; + if (m_pPDFStream) { + if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) { + return pDict->GetString("Name"); + } + } + return CFX_ByteString(); } @@ -109,9 +105,6 @@ void CPWL_Image::GetImageOffset(FX_FLOAT& x, FX_FLOAT& y) { y = 0.0f; } -/* ------------------------------- CPWL_Icon ---------------------------------- - */ - CPWL_Icon::CPWL_Icon() : m_pIconFit(NULL) {} CPWL_Icon::~CPWL_Icon() {} @@ -132,7 +125,6 @@ FX_BOOL CPWL_Icon::IsProportionalScale() { void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { if (m_pIconFit) { - // m_pIconFit->GetIconPosition(fLeft,fBottom); fLeft = 0.0f; fBottom = 0.0f; CPDF_Array* pA = diff --git a/fpdfsdk/src/pdfwindow/PWL_IconList.cpp b/fpdfsdk/src/pdfwindow/PWL_IconList.cpp index 6a627d7e92..c6849d0683 100644 --- a/fpdfsdk/src/pdfwindow/PWL_IconList.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_IconList.cpp @@ -4,21 +4,20 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" #include "fpdfsdk/include/pdfwindow/PWL_IconList.h" + #include "fpdfsdk/include/pdfwindow/PWL_Label.h" #include "fpdfsdk/include/pdfwindow/PWL_ListCtrl.h" #include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" +#include "public/fpdf_fwlevent.h" #define PWL_IconList_ITEM_ICON_LEFTMARGIN 10.0f #define PWL_IconList_ITEM_WIDTH 20.0f #define PWL_IconList_ITEM_HEIGHT 20.0f #define PWL_IconList_ITEM_SPACE 4.0f -/* ------------------ CPWL_IconList_Item ------------------- */ - CPWL_IconList_Item::CPWL_IconList_Item() : m_nIconIndex(-1), m_pData(NULL), m_bSelected(FALSE), m_pText(NULL) {} @@ -128,8 +127,6 @@ void CPWL_IconList_Item::OnDisabled() { InvalidateRect(); } -/* ----------------- CPWL_IconList_Content ----------------- */ - CPWL_IconList_Content::CPWL_IconList_Content(int32_t nListCount) : m_nSelectIndex(-1), m_pNotify(NULL), @@ -348,8 +345,6 @@ void CPWL_IconList_Content::SetIconFillColor(const CPWL_Color& color) { } } -/* -------------------- CPWL_IconList --------------------- */ - CPWL_IconList::CPWL_IconList(int32_t nListCount) : m_pListContent(NULL), m_nListCount(nListCount) {} diff --git a/fpdfsdk/src/pdfwindow/PWL_Label.cpp b/fpdfsdk/src/pdfwindow/PWL_Label.cpp index 8ff7235701..4f8a0dd8ed 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Label.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Label.cpp @@ -4,13 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" #include "fpdfsdk/include/pdfwindow/PWL_Label.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" -/* ---------------------------- CPWL_Label ------------------------------ */ - CPWL_Label::CPWL_Label() : m_pEdit(NULL) { m_pEdit = IFX_Edit::NewEdit(); ASSERT(m_pEdit); diff --git a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp index 685da4fd34..e3e83f9c7a 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp @@ -4,21 +4,20 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" +#include "fpdfsdk/include/pdfwindow/PWL_ListBox.h" + #include "fpdfsdk/include/pdfwindow/PWL_Edit.h" #include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h" -#include "fpdfsdk/include/pdfwindow/PWL_ListBox.h" #include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" +#include "public/fpdf_fwlevent.h" #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) -/* ------------------------ CPWL_List_Notify ----------------------- */ - CPWL_List_Notify::CPWL_List_Notify(CPWL_ListBox* pList) : m_pList(pList) { ASSERT(m_pList); } @@ -65,8 +64,6 @@ void CPWL_List_Notify::IOnInvalidateRect(CPDF_Rect* pRect) { m_pList->InvalidateRect(pRect); } -/* --------------------------- CPWL_ListBox ---------------------------- */ - CPWL_ListBox::CPWL_ListBox() : m_pList(NULL), m_pListNotify(NULL), @@ -180,8 +177,6 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, } if (m_pList->IsItemSelected(i)) { - // CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcItem, - // ArgbEncode(255,0,51,113)); IFX_SystemHandler* pSysHandler = GetSystemHandler(); if (pSysHandler && pSysHandler->IsSelectionImplemented()) { IFX_Edit::DrawEdit( diff --git a/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp b/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp index f7c1ef12fd..6d9627b08a 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp @@ -4,12 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" #include "fpdfsdk/include/pdfwindow/PWL_ListCtrl.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" -/* ---------------------------- CPWL_ListCtrl ---------------------------- */ - CPWL_ListCtrl::CPWL_ListCtrl() : m_rcContent(0, 0, 0, 0), m_ptScroll(0, 0), diff --git a/fpdfsdk/src/pdfwindow/PWL_Note.cpp b/fpdfsdk/src/pdfwindow/PWL_Note.cpp index 4ac237df7f..760967b6a2 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Note.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Note.cpp @@ -4,16 +4,14 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" +#include "fpdfsdk/include/pdfwindow/PWL_Note.h" + #include "fpdfsdk/include/pdfwindow/PWL_Button.h" #include "fpdfsdk/include/pdfwindow/PWL_Caret.h" #include "fpdfsdk/include/pdfwindow/PWL_Edit.h" -#include "fpdfsdk/include/pdfwindow/PWL_Edit.h" #include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h" #include "fpdfsdk/include/pdfwindow/PWL_Label.h" #include "fpdfsdk/include/pdfwindow/PWL_ListCtrl.h" -#include "fpdfsdk/include/pdfwindow/PWL_Note.h" -#include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h" #include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" @@ -31,9 +29,6 @@ #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) -/* ------------------------------- CPWL_Note_Options - * ------------------------------- */ - CPWL_Note_Options::CPWL_Note_Options() : m_pText(NULL) {} CPWL_Note_Options::~CPWL_Note_Options() {} @@ -106,9 +101,6 @@ CPDF_Rect CPWL_Note_Options::GetContentRect() const { return rcText; } -/* ------------------------------- CPWL_Note_Edit ------------------------------ - */ - CPWL_Note_Edit::CPWL_Note_Edit() : m_bEnableNotify(TRUE), m_fOldItemHeight(0.0f), @@ -234,9 +226,6 @@ FX_FLOAT CPWL_Note_Edit::GetItemRightMargin() { return POPUP_ITEM_TEXT_INDENT; } -/* -------------------------------- CPWL_Note_LBBox - * --------------------------------*/ - CPWL_Note_LBBox::CPWL_Note_LBBox() {} CPWL_Note_LBBox::~CPWL_Note_LBBox() {} @@ -264,9 +253,6 @@ void CPWL_Note_LBBox::DrawThisAppearance(CFX_RenderDevice* pDevice, FXFILL_ALTERNATE); } -/* -------------------------------- CPWL_Note_RBBox - * --------------------------------*/ - CPWL_Note_RBBox::CPWL_Note_RBBox() {} CPWL_Note_RBBox::~CPWL_Note_RBBox() {} @@ -294,9 +280,6 @@ void CPWL_Note_RBBox::DrawThisAppearance(CFX_RenderDevice* pDevice, FXFILL_ALTERNATE); } -/* --------------------------------- CPWL_Note_Icon - * ---------------------------------- */ - CPWL_Note_Icon::CPWL_Note_Icon() : m_nType(0) {} CPWL_Note_Icon::~CPWL_Note_Icon() {} @@ -312,9 +295,6 @@ void CPWL_Note_Icon::DrawThisAppearance(CFX_RenderDevice* pDevice, GetTransparency()); } -/* --------------------------------- CPWL_Note_CloseBox - * ---------------------------------- */ - CPWL_Note_CloseBox::CPWL_Note_CloseBox() : m_bMouseDown(FALSE) {} CPWL_Note_CloseBox::~CPWL_Note_CloseBox() {} @@ -370,9 +350,6 @@ FX_BOOL CPWL_Note_CloseBox::OnLButtonUp(const CPDF_Point& point, return CPWL_Button::OnLButtonUp(point, nFlag); } -/* ------------------------------ CPWL_Note_Contents - * ------------------------------- */ - CPWL_Note_Contents::CPWL_Note_Contents() : m_pEdit(NULL) {} CPWL_Note_Contents::~CPWL_Note_Contents() {} @@ -439,12 +416,13 @@ int32_t CPWL_Note_Contents::CountSubItems() const { IPWL_NoteItem* CPWL_Note_Contents::GetSubItems(int32_t index) const { int32_t nIndex = index + 1; - if (nIndex > 0 && nIndex < m_aChildren.GetSize()) + if (nIndex > 0 && nIndex < m_aChildren.GetSize()) { if (CPWL_Wnd* pChild = m_aChildren.GetAt(nIndex)) { ASSERT(pChild->GetClassName() == "CPWL_NoteItem"); CPWL_NoteItem* pItem = (CPWL_NoteItem*)pChild; return pItem; } + } return NULL; } @@ -601,9 +579,6 @@ void CPWL_Note_Contents::EnableRead(FX_BOOL bEnabled) { } } -/* ---------------------------------- CPWL_NoteItem - * ---------------------------------- */ - CPWL_NoteItem::CPWL_NoteItem() : m_pSubject(NULL), m_pDateTime(NULL), @@ -645,7 +620,6 @@ void CPWL_NoteItem::CreateChildWnd(const PWL_CREATEPARAM& cp) { m_pContents = new CPWL_Note_Contents; PWL_CREATEPARAM ccp = cp; ccp.pParentWnd = this; - // ccp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR; ccp.sBackgroundColor = CPWL_Color(COLORTYPE_RGB, 240 / 255.0f, 240 / 255.0f, 240 / 255.0f); ccp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BACKGROUND; @@ -1044,9 +1018,6 @@ void CPWL_NoteItem::EnableRead(FX_BOOL bEnabled) { m_pContents->EnableRead(bEnabled); } -/* ---------------------------------- CPWL_Note - * ---------------------------------- */ - CPWL_Note::CPWL_Note(IPopup_Note* pPopupNote, IPWL_NoteNotify* pNoteNotify, IPWL_NoteHandler* pNoteHandler) @@ -1380,8 +1351,7 @@ void CPWL_Note::OnNotify(CPWL_Wnd* pWnd, 0) { FX_BOOL bScrollChanged = FALSE; - if (lParam < 3) //·ÀÖ¹ËÀÑ»· mantis:15759 - { + if (lParam < 3) { bScrollChanged = ResetScrollBar(); if (bScrollChanged) { lParam++; diff --git a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp index b6a1bb3e6e..c48052da9a 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp @@ -4,7 +4,6 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" #include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" @@ -610,8 +609,9 @@ void CPWL_ScrollBar::RePosChildWnd() { rcClient.left + fBWidth, rcClient.top); rcMaxButton = CPDF_Rect(rcClient.right - fBWidth, rcClient.bottom, rcClient.right, rcClient.top); - } else + } else { SetVisible(FALSE); + } } break; case SBT_VSCROLL: @@ -633,8 +633,9 @@ void CPWL_ScrollBar::RePosChildWnd() { rcClient.right, rcClient.top); rcMaxButton = CPDF_Rect(rcClient.left, rcClient.bottom, rcClient.right, rcClient.bottom + fBWidth); - } else + } else { SetVisible(FALSE); + } } break; } diff --git a/fpdfsdk/src/pdfwindow/PWL_Signature.cpp b/fpdfsdk/src/pdfwindow/PWL_Signature.cpp index dead655da0..f7c73d0a7d 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Signature.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Signature.cpp @@ -4,16 +4,12 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" #include "fpdfsdk/include/pdfwindow/PWL_Icon.h" #include "fpdfsdk/include/pdfwindow/PWL_Label.h" #include "fpdfsdk/include/pdfwindow/PWL_Signature.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" -/* --------------------------------- CPWL_Signature_Image - * --------------------------------- */ - CPWL_Signature_Image::CPWL_Signature_Image() : m_pImage(NULL) {} CPWL_Signature_Image::~CPWL_Signature_Image() {} @@ -58,9 +54,6 @@ void CPWL_Signature_Image::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) { fVScale = rcClient.Height() / fImageH; } -/* --------------------------------- CPWL_Signature - * --------------------------------- */ - CPWL_Signature::CPWL_Signature() : m_pText(NULL), m_pDescription(NULL), @@ -169,34 +162,13 @@ void CPWL_Signature::DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) { CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); - if (m_bFlagExist) + if (m_bFlagExist) { CPWL_Utils::DrawIconAppStream( pDevice, pUser2Device, PWL_ICONTYPE_FOXIT, CPWL_Utils::GetCenterSquare(GetClientRect()), CPWL_Color(COLORTYPE_RGB, 0.91f, 0.855f, 0.92f), CPWL_Color(COLORTYPE_TRANSPARENT), 255); - - /* - CPDF_Rect rcClient = GetClientRect(); - - CFX_PathData path; - - path.SetPointCount(2); - path.SetPoint(0, rcClient.left, (rcClient.top + rcClient.bottom) * 0.5f, - FXPT_MOVETO); - path.SetPoint(1, rcClient.right, (rcClient.top + rcClient.bottom) * 0.5f, - FXPT_LINETO); - - CFX_GraphStateData gsd; - gsd.SetDashCount(2); - gsd.m_DashArray[0] = 6.0f; - gsd.m_DashArray[1] = 6.0f; - gsd.m_DashPhase = 0; - - gsd.m_LineWidth = 10.0f; - pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255,255,0,0), - FXFILL_ALTERNATE); - */ + } } void CPWL_Signature::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { diff --git a/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp b/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp index e22076edd2..52f25fcd84 100644 --- a/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp @@ -4,14 +4,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" #include "fpdfsdk/include/pdfwindow/PWL_Button.h" #include "fpdfsdk/include/pdfwindow/PWL_SpecialButton.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" -/* --------------------------- CPWL_PushButton ---------------------------- */ - CPWL_PushButton::CPWL_PushButton() {} CPWL_PushButton::~CPWL_PushButton() {} @@ -24,8 +21,6 @@ CPDF_Rect CPWL_PushButton::GetFocusRect() const { return CPWL_Utils::DeflateRect(GetWindowRect(), (FX_FLOAT)GetBorderWidth()); } -/* --------------------------- CPWL_CheckBox ---------------------------- */ - CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(FALSE) {} CPWL_CheckBox::~CPWL_CheckBox() {} @@ -55,8 +50,6 @@ FX_BOOL CPWL_CheckBox::OnChar(FX_WORD nChar, FX_DWORD nFlag) { return TRUE; } -/* --------------------------- CPWL_RadioButton ---------------------------- */ - CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(FALSE) {} CPWL_RadioButton::~CPWL_RadioButton() {} diff --git a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp index 71a9d474b7..2c9ec99dc8 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp @@ -4,7 +4,6 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" #include "fpdfsdk/include/pdfwindow/PWL_Icon.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" @@ -14,8 +13,6 @@ #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) -/* ---------------------------- CPWL_Utils ------------------------------ */ - CFX_ByteString CPWL_Utils::GetAppStreamFromArray(const CPWL_PathData* pPathData, int32_t nCount) { CFX_ByteTextBuf csAP; @@ -136,71 +133,49 @@ CPVT_WordRange CPWL_Utils::OverlapWordRange(const CPVT_WordRange& wr1, } CFX_ByteString CPWL_Utils::GetAP_Check(const CPDF_Rect& crBBox) { - CFX_ByteTextBuf csAP; - - FX_FLOAT fWidth = crBBox.right - crBBox.left; - FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - - const int32_t num = 8; - - CPWL_Point pts[num * 3] = {// 1 - CPWL_Point(0.28f, 0.52f), CPWL_Point(0.27f, 0.48f), - CPWL_Point(0.29f, 0.40f), - - // 2 - CPWL_Point(0.30f, 0.33f), CPWL_Point(0.31f, 0.29f), - CPWL_Point(0.31f, 0.28f), - - // 3 - CPWL_Point(0.39f, 0.28f), CPWL_Point(0.49f, 0.29f), - CPWL_Point(0.77f, 0.67f), - - // 4 - CPWL_Point(0.76f, 0.68f), CPWL_Point(0.78f, 0.69f), - CPWL_Point(0.76f, 0.75f), - - // 5 - CPWL_Point(0.76f, 0.75f), CPWL_Point(0.73f, 0.80f), - CPWL_Point(0.68f, 0.75f), - - // 6 - CPWL_Point(0.68f, 0.74f), CPWL_Point(0.68f, 0.74f), - CPWL_Point(0.44f, 0.47f), - - // 7 - CPWL_Point(0.43f, 0.47f), CPWL_Point(0.40f, 0.47f), - CPWL_Point(0.41f, 0.58f), - - // 8 - CPWL_Point(0.40f, 0.60f), CPWL_Point(0.28f, 0.66f), - CPWL_Point(0.30f, 0.56f)}; - - for (int32_t j = 0; j < num * 3; j++) { - pts[j].x *= fWidth; - pts[j].x += crBBox.left; - - pts[j].y *= fHeight; - pts[j].y += crBBox.bottom; + const FX_FLOAT fWidth = crBBox.right - crBBox.left; + const FX_FLOAT fHeight = crBBox.top - crBBox.bottom; + + CPWL_Point pts[8][3] = {{CPWL_Point(0.28f, 0.52f), CPWL_Point(0.27f, 0.48f), + CPWL_Point(0.29f, 0.40f)}, + {CPWL_Point(0.30f, 0.33f), CPWL_Point(0.31f, 0.29f), + CPWL_Point(0.31f, 0.28f)}, + {CPWL_Point(0.39f, 0.28f), CPWL_Point(0.49f, 0.29f), + CPWL_Point(0.77f, 0.67f)}, + {CPWL_Point(0.76f, 0.68f), CPWL_Point(0.78f, 0.69f), + CPWL_Point(0.76f, 0.75f)}, + {CPWL_Point(0.76f, 0.75f), CPWL_Point(0.73f, 0.80f), + CPWL_Point(0.68f, 0.75f)}, + {CPWL_Point(0.68f, 0.74f), CPWL_Point(0.68f, 0.74f), + CPWL_Point(0.44f, 0.47f)}, + {CPWL_Point(0.43f, 0.47f), CPWL_Point(0.40f, 0.47f), + CPWL_Point(0.41f, 0.58f)}, + {CPWL_Point(0.40f, 0.60f), CPWL_Point(0.28f, 0.66f), + CPWL_Point(0.30f, 0.56f)}}; + + for (size_t i = 0; i < FX_ArraySize(pts); ++i) { + for (size_t j = 0; j < FX_ArraySize(pts[0]); ++j) { + pts[i][j].x = pts[i][j].x * fWidth + crBBox.left; + pts[i][j].y *= pts[i][j].y * fHeight + crBBox.bottom; + } } - csAP << pts[0].x << " " << pts[0].y << " m\n"; + CFX_ByteTextBuf csAP; + csAP << pts[0][0].x << " " << pts[0][0].y << " m\n"; - for (int32_t i = 0; i < num; i++) { - int32_t nCur = i * 3; - int32_t n1 = i * 3 + 1; - int32_t n2 = i * 3 + 2; - int32_t nNext = (i < num - 1 ? (i + 1) * 3 : 0); + for (size_t i = 0; i < FX_ArraySize(pts); ++i) { + size_t nNext = i < FX_ArraySize(pts) - 1 ? i + 1 : 0; - FX_FLOAT px1 = pts[n1].x - pts[nCur].x; - FX_FLOAT py1 = pts[n1].y - pts[nCur].y; - FX_FLOAT px2 = pts[n2].x - pts[nNext].x; - FX_FLOAT py2 = pts[n2].y - pts[nNext].y; + FX_FLOAT px1 = pts[i][1].x - pts[i][0].x; + FX_FLOAT py1 = pts[i][1].y - pts[i][0].y; + FX_FLOAT px2 = pts[i][2].x - pts[nNext][0].x; + FX_FLOAT py2 = pts[i][2].y - pts[nNext][0].y; - csAP << pts[nCur].x + px1 * PWL_BEZIER << " " - << pts[nCur].y + py1 * PWL_BEZIER << " " - << pts[nNext].x + px2 * PWL_BEZIER << " " - << pts[nNext].y + py2 * PWL_BEZIER << " " << pts[nNext].x << " " - << pts[nNext].y << " c\n"; + csAP << pts[i][0].x + px1 * PWL_BEZIER << " " + << pts[i][0].y + py1 * PWL_BEZIER << " " + << pts[nNext][0].x + px2 * PWL_BEZIER << " " + << pts[nNext][0].y + py2 * PWL_BEZIER << " " << pts[nNext][0].x << " " + << pts[nNext][0].y << " c\n"; } return csAP.GetByteString(); @@ -2338,7 +2313,6 @@ void CPWL_Utils::GetGraphics_Cross(CFX_ByteString& sPathData, const PWL_PATH_TYPE type) { FX_FLOAT fWidth = crBBox.right - crBBox.left; FX_FLOAT fHeight = crBBox.top - crBBox.bottom; - // FX_FLOAT fcatercorner = (FX_FLOAT)sqrt(fWidth*fWidth + fHeight*fHeight); CPWL_Point center_point(crBBox.left + fWidth / 2, crBBox.bottom + fHeight / 2); diff --git a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp index baa24cb8bf..9c4e21713b 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp @@ -6,13 +6,10 @@ #include <map> -#include "fpdfsdk/include/pdfwindow/PDFWindow.h" #include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" -/* -------------------------- CPWL_Timer -------------------------- */ - static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap() { // Leak the object at shutdown. static auto timeMap = new std::map<int32_t, CPWL_Timer*>; @@ -58,8 +55,6 @@ void CPWL_Timer::TimerProc(int32_t idEvent) { pTimer->m_pAttached->TimerProc(); } -/* -------------------------- CPWL_TimerHandler -------------------------- */ - CPWL_TimerHandler::CPWL_TimerHandler() : m_pTimer(NULL) {} CPWL_TimerHandler::~CPWL_TimerHandler() { @@ -81,20 +76,16 @@ void CPWL_TimerHandler::EndTimer() { void CPWL_TimerHandler::TimerProc() {} -/* --------------------------- CPWL_MsgControl ---------------------------- */ - class CPWL_MsgControl { friend class CPWL_Wnd; public: - CPWL_MsgControl(CPWL_Wnd* pWnd) { - // PWL_TRACE("new CPWL_MsgControl\n"); + explicit CPWL_MsgControl(CPWL_Wnd* pWnd) { m_pCreatedWnd = pWnd; Default(); } ~CPWL_MsgControl() { - // PWL_TRACE("~CPWL_MsgControl\n"); Default(); } @@ -114,10 +105,12 @@ class CPWL_MsgControl { } FX_BOOL IsWndCaptureMouse(const CPWL_Wnd* pWnd) const { - if (pWnd) - for (int32_t i = 0, sz = m_aMousePath.GetSize(); i < sz; i++) + if (pWnd) { + for (int32_t i = 0, sz = m_aMousePath.GetSize(); i < sz; i++) { if (m_aMousePath.GetAt(i) == pWnd) return TRUE; + } + } return FALSE; } @@ -127,10 +120,12 @@ class CPWL_MsgControl { } FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const { - if (pWnd) - for (int32_t i = 0, sz = m_aKeyboardPath.GetSize(); i < sz; i++) + if (pWnd) { + for (int32_t i = 0, sz = m_aKeyboardPath.GetSize(); i < sz; i++) { if (m_aKeyboardPath.GetAt(i) == pWnd) return TRUE; + } + } return FALSE; } @@ -187,8 +182,6 @@ class CPWL_MsgControl { CPWL_Wnd* m_pMainKeyboardWnd; }; -/* --------------------------- CPWL_Wnd ---------------------------- */ - CPWL_Wnd::CPWL_Wnd() : m_pVScrollBar(NULL), m_rcWindow(), @@ -620,14 +613,6 @@ int32_t CPWL_Wnd::GetBorderWidth() const { } int32_t CPWL_Wnd::GetInnerBorderWidth() const { - /* - switch (GetBorderStyle()) - { - case PBS_BEVELED: - case PBS_INSET: - return GetBorderWidth() / 2; - } - */ return 0; } @@ -902,8 +887,6 @@ CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(int32_t nBorderStyle) const { return color; } -/* ----------------------------------------------------------------- */ - int32_t CPWL_Wnd::GetTransparency() { return m_sPrivateParam.nTransparency; } |