| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fwl/core/ifwl_edit.h" | 7 #include "xfa/fwl/core/ifwl_edit.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "third_party/base/ptr_util.h" | 14 #include "third_party/base/ptr_util.h" |
| 15 #include "third_party/base/stl_util.h" | 15 #include "third_party/base/stl_util.h" |
| 16 #include "xfa/fde/cfde_txtedtengine.h" | 16 #include "xfa/fde/cfde_txtedtengine.h" |
| 17 #include "xfa/fde/fde_gedevice.h" | 17 #include "xfa/fde/fde_gedevice.h" |
| 18 #include "xfa/fde/fde_render.h" | 18 #include "xfa/fde/fde_render.h" |
| 19 #include "xfa/fde/ifde_txtedtpage.h" | 19 #include "xfa/fde/ifde_txtedtpage.h" |
| 20 #include "xfa/fgas/font/cfgas_gefont.h" | 20 #include "xfa/fgas/font/cfgas_gefont.h" |
| 21 #include "xfa/fwl/core/cfwl_app.h" |
| 21 #include "xfa/fwl/core/cfwl_evtcheckword.h" | 22 #include "xfa/fwl/core/cfwl_evtcheckword.h" |
| 22 #include "xfa/fwl/core/cfwl_evttextchanged.h" | 23 #include "xfa/fwl/core/cfwl_evttextchanged.h" |
| 23 #include "xfa/fwl/core/cfwl_evttextfull.h" | 24 #include "xfa/fwl/core/cfwl_evttextfull.h" |
| 24 #include "xfa/fwl/core/cfwl_evtvalidate.h" | 25 #include "xfa/fwl/core/cfwl_evtvalidate.h" |
| 25 #include "xfa/fwl/core/cfwl_msgkey.h" | 26 #include "xfa/fwl/core/cfwl_msgkey.h" |
| 26 #include "xfa/fwl/core/cfwl_msgmouse.h" | 27 #include "xfa/fwl/core/cfwl_msgmouse.h" |
| 27 #include "xfa/fwl/core/cfwl_themebackground.h" | 28 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 28 #include "xfa/fwl/core/cfwl_themepart.h" | 29 #include "xfa/fwl/core/cfwl_themepart.h" |
| 29 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 30 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
| 30 #include "xfa/fwl/core/ifwl_app.h" | |
| 31 #include "xfa/fwl/core/ifwl_caret.h" | 31 #include "xfa/fwl/core/ifwl_caret.h" |
| 32 #include "xfa/fwl/core/ifwl_themeprovider.h" | 32 #include "xfa/fwl/core/ifwl_themeprovider.h" |
| 33 #include "xfa/fxfa/xfa_ffdoc.h" | 33 #include "xfa/fxfa/xfa_ffdoc.h" |
| 34 #include "xfa/fxfa/xfa_ffwidget.h" | 34 #include "xfa/fxfa/xfa_ffwidget.h" |
| 35 #include "xfa/fxgraphics/cfx_path.h" | 35 #include "xfa/fxgraphics/cfx_path.h" |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 const int kEditMargin = 3; | 39 const int kEditMargin = 3; |
| 40 | 40 |
| 41 bool FX_EDIT_ISLATINWORD(FX_WCHAR c) { | 41 bool FX_EDIT_ISLATINWORD(FX_WCHAR c) { |
| 42 return c == 0x2D || (c <= 0x005A && c >= 0x0041) || | 42 return c == 0x2D || (c <= 0x005A && c >= 0x0041) || |
| 43 (c <= 0x007A && c >= 0x0061) || (c <= 0x02AF && c >= 0x00C0) || | 43 (c <= 0x007A && c >= 0x0061) || (c <= 0x02AF && c >= 0x00C0) || |
| 44 c == 0x0027; | 44 c == 0x0027; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void AddSquigglyPath(CFX_Path* pPathData, | 47 void AddSquigglyPath(CFX_Path* pPathData, |
| 48 FX_FLOAT fStartX, | 48 FX_FLOAT fStartX, |
| 49 FX_FLOAT fEndX, | 49 FX_FLOAT fEndX, |
| 50 FX_FLOAT fY, | 50 FX_FLOAT fY, |
| 51 FX_FLOAT fStep) { | 51 FX_FLOAT fStep) { |
| 52 pPathData->MoveTo(fStartX, fY); | 52 pPathData->MoveTo(fStartX, fY); |
| 53 int i = 1; | 53 int i = 1; |
| 54 for (FX_FLOAT fx = fStartX + fStep; fx < fEndX; fx += fStep, ++i) | 54 for (FX_FLOAT fx = fStartX + fStep; fx < fEndX; fx += fStep, ++i) |
| 55 pPathData->LineTo(fx, fY + (i & 1) * fStep); | 55 pPathData->LineTo(fx, fY + (i & 1) * fStep); |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace | 58 } // namespace |
| 59 | 59 |
| 60 IFWL_Edit::IFWL_Edit(const IFWL_App* app, | 60 IFWL_Edit::IFWL_Edit(const CFWL_App* app, |
| 61 std::unique_ptr<CFWL_WidgetProperties> properties, | 61 std::unique_ptr<CFWL_WidgetProperties> properties, |
| 62 IFWL_Widget* pOuter) | 62 IFWL_Widget* pOuter) |
| 63 : IFWL_Widget(app, std::move(properties), pOuter), | 63 : IFWL_Widget(app, std::move(properties), pOuter), |
| 64 m_fVAlignOffset(0.0f), | 64 m_fVAlignOffset(0.0f), |
| 65 m_fScrollOffsetX(0.0f), | 65 m_fScrollOffsetX(0.0f), |
| 66 m_fScrollOffsetY(0.0f), | 66 m_fScrollOffsetY(0.0f), |
| 67 m_bLButtonDown(false), | 67 m_bLButtonDown(false), |
| 68 m_nSelStart(0), | 68 m_nSelStart(0), |
| 69 m_nLimit(-1), | 69 m_nLimit(-1), |
| 70 m_fFontSize(0), | 70 m_fFontSize(0), |
| (...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1652 UpdateOffset(pScrollBar, fPos - iCurPos); | 1652 UpdateOffset(pScrollBar, fPos - iCurPos); |
| 1653 UpdateCaret(); | 1653 UpdateCaret(); |
| 1654 | 1654 |
| 1655 CFX_RectF rect; | 1655 CFX_RectF rect; |
| 1656 GetWidgetRect(rect); | 1656 GetWidgetRect(rect); |
| 1657 CFX_RectF rtInvalidate; | 1657 CFX_RectF rtInvalidate; |
| 1658 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); | 1658 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); |
| 1659 Repaint(&rtInvalidate); | 1659 Repaint(&rtInvalidate); |
| 1660 return true; | 1660 return true; |
| 1661 } | 1661 } |
| OLD | NEW |