Chromium Code Reviews| 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/fee/fde_txtedtengine.h" | 7 #include "xfa/fee/fde_txtedtengine.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "xfa/fde/tto/fde_textout.h" | 11 #include "xfa/fde/tto/fde_textout.h" |
| 12 #include "xfa/fee/fde_txtedtbuf.h" | |
| 13 #include "xfa/fee/fde_txtedtparag.h" | 12 #include "xfa/fee/fde_txtedtparag.h" |
| 14 #include "xfa/fee/ifde_txtedtbuf.h" | |
| 15 #include "xfa/fee/ifde_txtedtengine.h" | 13 #include "xfa/fee/ifde_txtedtengine.h" |
| 16 #include "xfa/fee/ifde_txtedtpage.h" | 14 #include "xfa/fee/ifde_txtedtpage.h" |
| 15 #include "xfa/fwl/basewidget/fwl_editimp.h" | |
| 17 | 16 |
| 18 #define FDE_PAGEWIDTH_MAX 0xFFFF | 17 #define FDE_PAGEWIDTH_MAX 0xFFFF |
| 19 #define FDE_TXTPLATESIZE (1024 * 12) | 18 #define FDE_TXTPLATESIZE (1024 * 12) |
| 20 #define FDE_UNICODE_PARAGRAPH_SPERATOR (0x2029) | 19 #define FDE_UNICODE_PARAGRAPH_SPERATOR (0x2029) |
| 21 #define FDE_TXTEDT_DORECORD_INS 0 | 20 #define FDE_TXTEDT_DORECORD_INS 0 |
| 22 #define FDE_TXTEDT_DORECORD_DEL 1 | 21 #define FDE_TXTEDT_DORECORD_DEL 1 |
| 23 | 22 |
| 24 IFDE_TxtEdtEngine* IFDE_TxtEdtEngine::Create() { | |
| 25 return new CFDE_TxtEdtEngine(); | |
| 26 } | |
| 27 CFDE_TxtEdtEngine::CFDE_TxtEdtEngine() | 23 CFDE_TxtEdtEngine::CFDE_TxtEdtEngine() |
| 28 : m_pTextBreak(nullptr), | 24 : m_pTextBreak(nullptr), |
| 29 m_nPageLineCount(20), | 25 m_nPageLineCount(20), |
| 30 m_nLineCount(0), | 26 m_nLineCount(0), |
| 31 m_nAnchorPos(-1), | 27 m_nAnchorPos(-1), |
| 32 m_nLayoutPos(0), | 28 m_nLayoutPos(0), |
| 33 m_fCaretPosReserve(0.0), | 29 m_fCaretPosReserve(0.0), |
| 34 m_nCaret(0), | 30 m_nCaret(0), |
| 35 m_bBefore(TRUE), | 31 m_bBefore(TRUE), |
| 36 m_nCaretPage(0), | 32 m_nCaretPage(0), |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 64 } | 60 } |
| 65 void CFDE_TxtEdtEngine::SetEditParams(const FDE_TXTEDTPARAMS& params) { | 61 void CFDE_TxtEdtEngine::SetEditParams(const FDE_TXTEDTPARAMS& params) { |
| 66 if (!m_pTextBreak) | 62 if (!m_pTextBreak) |
| 67 m_pTextBreak = new CFX_TxtBreak(FX_TXTBREAKPOLICY_None); | 63 m_pTextBreak = new CFX_TxtBreak(FX_TXTBREAKPOLICY_None); |
| 68 | 64 |
| 69 FXSYS_memcpy(&m_Param, ¶ms, sizeof(FDE_TXTEDTPARAMS)); | 65 FXSYS_memcpy(&m_Param, ¶ms, sizeof(FDE_TXTEDTPARAMS)); |
| 70 m_wLineEnd = params.wLineBreakChar; | 66 m_wLineEnd = params.wLineBreakChar; |
| 71 m_bAutoLineEnd = (m_Param.nLineEnd == FDE_TXTEDIT_LINEEND_Auto); | 67 m_bAutoLineEnd = (m_Param.nLineEnd == FDE_TXTEDIT_LINEEND_Auto); |
| 72 UpdateTxtBreak(); | 68 UpdateTxtBreak(); |
| 73 } | 69 } |
| 74 const FDE_TXTEDTPARAMS* CFDE_TxtEdtEngine::GetEditParams() const { | 70 FDE_TXTEDTPARAMS* CFDE_TxtEdtEngine::GetEditParams() { |
| 75 return &m_Param; | 71 return &m_Param; |
| 76 } | 72 } |
| 77 int32_t CFDE_TxtEdtEngine::CountPages() const { | 73 int32_t CFDE_TxtEdtEngine::CountPages() const { |
| 78 if (m_nLineCount == 0) { | 74 if (m_nLineCount == 0) { |
| 79 return 0; | 75 return 0; |
| 80 } | 76 } |
| 81 return ((m_nLineCount - 1) / m_nPageLineCount) + 1; | 77 return ((m_nLineCount - 1) / m_nPageLineCount) + 1; |
| 82 } | 78 } |
| 83 IFDE_TxtEdtPage* CFDE_TxtEdtEngine::GetPage(int32_t nIndex) { | 79 IFDE_TxtEdtPage* CFDE_TxtEdtEngine::GetPage(int32_t nIndex) { |
| 84 if (m_PagePtrArray.GetSize() <= nIndex) { | 80 if (m_PagePtrArray.GetSize() <= nIndex) { |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 CFX_WideString wsTemp; | 318 CFX_WideString wsTemp; |
| 323 FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength); | 319 FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength); |
| 324 FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(FX_WCHAR)); | 320 FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(FX_WCHAR)); |
| 325 ReplaceParagEnd(lpBuffer, nLength, FALSE); | 321 ReplaceParagEnd(lpBuffer, nLength, FALSE); |
| 326 wsTemp.ReleaseBuffer(nLength); | 322 wsTemp.ReleaseBuffer(nLength); |
| 327 FX_BOOL bPart = FALSE; | 323 FX_BOOL bPart = FALSE; |
| 328 if (m_nLimit > 0) { | 324 if (m_nLimit > 0) { |
| 329 int32_t nTotalLength = GetTextBufLength(); | 325 int32_t nTotalLength = GetTextBufLength(); |
| 330 int32_t nCount = m_SelRangePtrArr.GetSize(); | 326 int32_t nCount = m_SelRangePtrArr.GetSize(); |
| 331 for (int32_t i = 0; i < nCount; i++) { | 327 for (int32_t i = 0; i < nCount; i++) { |
| 332 FDE_LPTXTEDTSELRANGE lpSelRange = m_SelRangePtrArr.GetAt(i); | 328 FDE_TXTEDTSELRANGE* lpSelRange = m_SelRangePtrArr.GetAt(i); |
| 333 nTotalLength -= lpSelRange->nCount; | 329 nTotalLength -= lpSelRange->nCount; |
| 334 } | 330 } |
| 335 int32_t nExpectLength = nTotalLength + nLength; | 331 int32_t nExpectLength = nTotalLength + nLength; |
| 336 if (nTotalLength == m_nLimit) { | 332 if (nTotalLength == m_nLimit) { |
| 337 return FDE_TXTEDT_MODIFY_RET_F_Full; | 333 return FDE_TXTEDT_MODIFY_RET_F_Full; |
| 338 } | 334 } |
| 339 if (nExpectLength > m_nLimit) { | 335 if (nExpectLength > m_nLimit) { |
| 340 nLength -= (nExpectLength - m_nLimit); | 336 nLength -= (nExpectLength - m_nLimit); |
| 341 bPart = TRUE; | 337 bPart = TRUE; |
| 342 } | 338 } |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 return FDE_TXTEDT_MODIFY_RET_S_Normal; | 527 return FDE_TXTEDT_MODIFY_RET_S_Normal; |
| 532 } | 528 } |
| 533 void CFDE_TxtEdtEngine::SetLimit(int32_t nLimit) { | 529 void CFDE_TxtEdtEngine::SetLimit(int32_t nLimit) { |
| 534 m_nLimit = nLimit; | 530 m_nLimit = nLimit; |
| 535 } | 531 } |
| 536 void CFDE_TxtEdtEngine::SetAliasChar(FX_WCHAR wcAlias) { | 532 void CFDE_TxtEdtEngine::SetAliasChar(FX_WCHAR wcAlias) { |
| 537 m_wcAliasChar = wcAlias; | 533 m_wcAliasChar = wcAlias; |
| 538 } | 534 } |
| 539 | 535 |
| 540 void CFDE_TxtEdtEngine::RemoveSelRange(int32_t nStart, int32_t nCount) { | 536 void CFDE_TxtEdtEngine::RemoveSelRange(int32_t nStart, int32_t nCount) { |
| 541 FDE_LPTXTEDTSELRANGE lpTemp = NULL; | 537 FDE_TXTEDTSELRANGE* lpTemp = nullptr; |
| 542 int32_t nRangeCount = m_SelRangePtrArr.GetSize(); | 538 int32_t nRangeCount = m_SelRangePtrArr.GetSize(); |
| 543 int32_t i = 0; | 539 int32_t i = 0; |
| 544 for (i = 0; i < nRangeCount; i++) { | 540 for (i = 0; i < nRangeCount; i++) { |
| 545 lpTemp = m_SelRangePtrArr[i]; | 541 lpTemp = m_SelRangePtrArr[i]; |
| 546 if (lpTemp->nStart == nStart && lpTemp->nCount == nCount) { | 542 if (lpTemp->nStart == nStart && lpTemp->nCount == nCount) { |
| 547 delete lpTemp; | 543 delete lpTemp; |
| 548 m_SelRangePtrArr.RemoveAt(i); | 544 m_SelRangePtrArr.RemoveAt(i); |
| 549 return; | 545 return; |
| 550 } | 546 } |
| 551 } | 547 } |
| 552 } | 548 } |
| 553 | 549 |
| 554 void CFDE_TxtEdtEngine::AddSelRange(int32_t nStart, int32_t nCount) { | 550 void CFDE_TxtEdtEngine::AddSelRange(int32_t nStart, int32_t nCount) { |
| 555 if (nCount == -1) { | 551 if (nCount == -1) { |
| 556 nCount = GetTextLength() - nStart; | 552 nCount = GetTextLength() - nStart; |
| 557 } | 553 } |
| 558 int32_t nSize = m_SelRangePtrArr.GetSize(); | 554 int32_t nSize = m_SelRangePtrArr.GetSize(); |
| 559 if (nSize <= 0) { | 555 if (nSize <= 0) { |
| 560 FDE_LPTXTEDTSELRANGE lpSelRange = new FDE_TXTEDTSELRANGE; | 556 FDE_TXTEDTSELRANGE* lpSelRange = new FDE_TXTEDTSELRANGE; |
| 561 lpSelRange->nStart = nStart; | 557 lpSelRange->nStart = nStart; |
| 562 lpSelRange->nCount = nCount; | 558 lpSelRange->nCount = nCount; |
| 563 m_SelRangePtrArr.Add(lpSelRange); | 559 m_SelRangePtrArr.Add(lpSelRange); |
| 564 m_Param.pEventSink->On_SelChanged(this); | 560 m_Param.pEventSink->On_SelChanged(this); |
| 565 return; | 561 return; |
| 566 } | 562 } |
| 567 FDE_LPTXTEDTSELRANGE lpTemp = NULL; | 563 FDE_TXTEDTSELRANGE* lpTemp = nullptr; |
| 568 lpTemp = m_SelRangePtrArr[nSize - 1]; | 564 lpTemp = m_SelRangePtrArr[nSize - 1]; |
| 569 if (nStart >= lpTemp->nStart + lpTemp->nCount) { | 565 if (nStart >= lpTemp->nStart + lpTemp->nCount) { |
| 570 FDE_LPTXTEDTSELRANGE lpSelRange = new FDE_TXTEDTSELRANGE; | 566 FDE_TXTEDTSELRANGE* lpSelRange = new FDE_TXTEDTSELRANGE; |
| 571 lpSelRange->nStart = nStart; | 567 lpSelRange->nStart = nStart; |
| 572 lpSelRange->nCount = nCount; | 568 lpSelRange->nCount = nCount; |
| 573 m_SelRangePtrArr.Add(lpSelRange); | 569 m_SelRangePtrArr.Add(lpSelRange); |
| 574 m_Param.pEventSink->On_SelChanged(this); | 570 m_Param.pEventSink->On_SelChanged(this); |
| 575 return; | 571 return; |
| 576 } | 572 } |
| 577 int32_t nEnd = nStart + nCount - 1; | 573 int32_t nEnd = nStart + nCount - 1; |
| 578 FX_BOOL bBegin = FALSE; | 574 FX_BOOL bBegin = FALSE; |
| 579 int32_t nRangeBgn = 0; | 575 int32_t nRangeBgn = 0; |
| 580 int32_t nRangeCnt = 0; | 576 int32_t nRangeCnt = 0; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 595 nRangeBgn = i; | 591 nRangeBgn = i; |
| 596 if (nEnd < nTempBgn) { | 592 if (nEnd < nTempBgn) { |
| 597 break; | 593 break; |
| 598 } | 594 } |
| 599 nRangeCnt = 1; | 595 nRangeCnt = 1; |
| 600 bBegin = TRUE; | 596 bBegin = TRUE; |
| 601 } | 597 } |
| 602 } | 598 } |
| 603 } | 599 } |
| 604 if (nRangeCnt == 0) { | 600 if (nRangeCnt == 0) { |
| 605 FDE_LPTXTEDTSELRANGE lpSelRange = new FDE_TXTEDTSELRANGE; | 601 FDE_TXTEDTSELRANGE* lpSelRange = new FDE_TXTEDTSELRANGE; |
| 606 lpSelRange->nStart = nStart; | 602 lpSelRange->nStart = nStart; |
| 607 lpSelRange->nCount = nCount; | 603 lpSelRange->nCount = nCount; |
| 608 m_SelRangePtrArr.InsertAt(nRangeBgn, lpSelRange); | 604 m_SelRangePtrArr.InsertAt(nRangeBgn, lpSelRange); |
| 609 } else { | 605 } else { |
| 610 lpTemp = m_SelRangePtrArr[nRangeBgn]; | 606 lpTemp = m_SelRangePtrArr[nRangeBgn]; |
| 611 lpTemp->nStart = nStart; | 607 lpTemp->nStart = nStart; |
| 612 lpTemp->nCount = nCount; | 608 lpTemp->nCount = nCount; |
| 613 nRangeCnt--; | 609 nRangeCnt--; |
| 614 nRangeBgn++; | 610 nRangeBgn++; |
| 615 while (nRangeCnt--) { | 611 while (nRangeCnt--) { |
| 616 delete m_SelRangePtrArr[nRangeBgn]; | 612 delete m_SelRangePtrArr[nRangeBgn]; |
| 617 m_SelRangePtrArr.RemoveAt(nRangeBgn); | 613 m_SelRangePtrArr.RemoveAt(nRangeBgn); |
| 618 } | 614 } |
| 619 } | 615 } |
| 620 m_Param.pEventSink->On_SelChanged(this); | 616 m_Param.pEventSink->On_SelChanged(this); |
| 621 } | 617 } |
| 622 | 618 |
| 623 int32_t CFDE_TxtEdtEngine::CountSelRanges() { | 619 int32_t CFDE_TxtEdtEngine::CountSelRanges() { |
| 624 return m_SelRangePtrArr.GetSize(); | 620 return m_SelRangePtrArr.GetSize(); |
| 625 } | 621 } |
| 626 int32_t CFDE_TxtEdtEngine::GetSelRange(int32_t nIndex, int32_t& nStart) { | 622 int32_t CFDE_TxtEdtEngine::GetSelRange(int32_t nIndex, int32_t& nStart) { |
| 627 nStart = m_SelRangePtrArr[nIndex]->nStart; | 623 nStart = m_SelRangePtrArr[nIndex]->nStart; |
| 628 return m_SelRangePtrArr[nIndex]->nCount; | 624 return m_SelRangePtrArr[nIndex]->nCount; |
| 629 } | 625 } |
| 630 void CFDE_TxtEdtEngine::ClearSelection() { | 626 void CFDE_TxtEdtEngine::ClearSelection() { |
| 631 int32_t nCount = m_SelRangePtrArr.GetSize(); | 627 int32_t nCount = m_SelRangePtrArr.GetSize(); |
| 632 FDE_LPTXTEDTSELRANGE lpRange = NULL; | 628 FDE_TXTEDTSELRANGE* lpRange = nullptr; |
| 633 int32_t i = 0; | 629 int32_t i = 0; |
| 634 for (i = 0; i < nCount; i++) { | 630 for (i = 0; i < nCount; i++) { |
| 635 lpRange = m_SelRangePtrArr[i]; | 631 lpRange = m_SelRangePtrArr[i]; |
| 636 if (lpRange != NULL) { | 632 if (lpRange) { |
| 637 delete lpRange; | 633 delete lpRange; |
| 638 lpRange = NULL; | 634 lpRange = nullptr; |
| 639 } | 635 } |
| 640 } | 636 } |
| 641 m_SelRangePtrArr.RemoveAll(); | 637 m_SelRangePtrArr.RemoveAll(); |
| 642 if (nCount && m_Param.pEventSink) { | 638 if (nCount && m_Param.pEventSink) { |
| 643 m_Param.pEventSink->On_SelChanged(this); | 639 m_Param.pEventSink->On_SelChanged(this); |
| 644 } | 640 } |
| 645 } | 641 } |
| 646 FX_BOOL CFDE_TxtEdtEngine::Redo(const CFX_ByteStringC& bsRedo) { | 642 FX_BOOL CFDE_TxtEdtEngine::Redo(const CFX_ByteStringC& bsRedo) { |
| 647 if (IsLocked()) { | 643 if (IsLocked()) { |
| 648 return FALSE; | 644 return FALSE; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 682 m_nLineCount = 0; | 678 m_nLineCount = 0; |
| 683 return 0; | 679 return 0; |
| 684 } | 680 } |
| 685 int32_t CFDE_TxtEdtEngine::DoLayout(IFX_Pause* pPause) { | 681 int32_t CFDE_TxtEdtEngine::DoLayout(IFX_Pause* pPause) { |
| 686 int32_t nCount = m_ParagPtrArray.GetSize(); | 682 int32_t nCount = m_ParagPtrArray.GetSize(); |
| 687 CFDE_TxtEdtParag* pParag = NULL; | 683 CFDE_TxtEdtParag* pParag = NULL; |
| 688 int32_t nLineCount = 0; | 684 int32_t nLineCount = 0; |
| 689 for (; m_nLayoutPos < nCount; m_nLayoutPos++) { | 685 for (; m_nLayoutPos < nCount; m_nLayoutPos++) { |
| 690 pParag = m_ParagPtrArray[m_nLayoutPos]; | 686 pParag = m_ParagPtrArray[m_nLayoutPos]; |
| 691 pParag->CalcLines(); | 687 pParag->CalcLines(); |
| 692 nLineCount += pParag->m_nLineCount; | 688 nLineCount += pParag->GetLineCount(); |
| 693 if ((pPause != NULL) && (nLineCount > m_nPageLineCount) && | 689 if ((pPause != NULL) && (nLineCount > m_nPageLineCount) && |
| 694 pPause->NeedToPauseNow()) { | 690 pPause->NeedToPauseNow()) { |
| 695 m_nLineCount += nLineCount; | 691 m_nLineCount += nLineCount; |
| 696 return (++m_nLayoutPos * 100) / nCount; | 692 return (++m_nLayoutPos * 100) / nCount; |
| 697 } | 693 } |
| 698 } | 694 } |
| 699 m_nLineCount += nLineCount; | 695 m_nLineCount += nLineCount; |
| 700 return 100; | 696 return 100; |
| 701 } | 697 } |
| 702 void CFDE_TxtEdtEngine::EndLayout() { | 698 void CFDE_TxtEdtEngine::EndLayout() { |
| 703 UpdatePages(); | 699 UpdatePages(); |
| 704 int32_t nLength = GetTextLength(); | 700 int32_t nLength = GetTextLength(); |
| 705 if (m_nCaret > nLength) { | 701 if (m_nCaret > nLength) { |
| 706 m_nCaret = nLength; | 702 m_nCaret = nLength; |
| 707 } | 703 } |
| 708 int32_t nIndex = m_nCaret; | 704 int32_t nIndex = m_nCaret; |
| 709 if (!m_bBefore) { | 705 if (!m_bBefore) { |
| 710 nIndex--; | 706 nIndex--; |
| 711 } | 707 } |
| 712 m_rtCaret.Set(0, 0, 1, m_Param.fFontSize); | 708 m_rtCaret.Set(0, 0, 1, m_Param.fFontSize); |
| 713 Unlock(); | 709 Unlock(); |
| 714 } | 710 } |
| 715 FX_BOOL CFDE_TxtEdtEngine::Optimize(IFX_Pause* pPause) { | 711 FX_BOOL CFDE_TxtEdtEngine::Optimize(IFX_Pause* pPause) { |
| 716 return m_pTxtBuf->Optimize(pPause); | 712 return m_pTxtBuf->Optimize(pPause); |
| 717 } | 713 } |
| 718 IFDE_TxtEdtBuf* CFDE_TxtEdtEngine::GetTextBuf() const { | 714 CFDE_TxtEdtBuf* CFDE_TxtEdtEngine::GetTextBuf() const { |
| 719 return (IFDE_TxtEdtBuf*)m_pTxtBuf; | 715 return m_pTxtBuf; |
| 720 } | 716 } |
| 721 int32_t CFDE_TxtEdtEngine::GetTextBufLength() const { | 717 int32_t CFDE_TxtEdtEngine::GetTextBufLength() const { |
| 722 return m_pTxtBuf->GetTextLength() - 1; | 718 return m_pTxtBuf->GetTextLength() - 1; |
| 723 } | 719 } |
| 724 CFX_TxtBreak* CFDE_TxtEdtEngine::GetTextBreak() const { | 720 CFX_TxtBreak* CFDE_TxtEdtEngine::GetTextBreak() const { |
| 725 return m_pTextBreak; | 721 return m_pTextBreak; |
| 726 } | 722 } |
| 727 int32_t CFDE_TxtEdtEngine::GetLineCount() const { | 723 int32_t CFDE_TxtEdtEngine::GetLineCount() const { |
| 728 return m_nLineCount; | 724 return m_nLineCount; |
| 729 } | 725 } |
| 730 int32_t CFDE_TxtEdtEngine::GetPageLineCount() const { | 726 int32_t CFDE_TxtEdtEngine::GetPageLineCount() const { |
| 731 return m_nPageLineCount; | 727 return m_nPageLineCount; |
| 732 } | 728 } |
| 733 int32_t CFDE_TxtEdtEngine::CountParags() const { | 729 int32_t CFDE_TxtEdtEngine::CountParags() const { |
| 734 return m_ParagPtrArray.GetSize(); | 730 return m_ParagPtrArray.GetSize(); |
| 735 } | 731 } |
| 736 IFDE_TxtEdtParag* CFDE_TxtEdtEngine::GetParag(int32_t nParagIndex) const { | 732 CFDE_TxtEdtParag* CFDE_TxtEdtEngine::GetParag(int32_t nParagIndex) const { |
| 737 return m_ParagPtrArray[nParagIndex]; | 733 return m_ParagPtrArray[nParagIndex]; |
| 738 } | 734 } |
| 739 IFX_CharIter* CFDE_TxtEdtEngine::CreateCharIter() { | 735 IFX_CharIter* CFDE_TxtEdtEngine::CreateCharIter() { |
| 740 if (!m_pTxtBuf) { | 736 if (!m_pTxtBuf) { |
| 741 return NULL; | 737 return NULL; |
| 742 } | 738 } |
| 743 return new CFDE_TxtEdtBufIter((CFDE_TxtEdtBuf*)m_pTxtBuf); | 739 return new CFDE_TxtEdtBufIter((CFDE_TxtEdtBuf*)m_pTxtBuf); |
| 744 } | 740 } |
| 745 int32_t CFDE_TxtEdtEngine::Line2Parag(int32_t nStartParag, | 741 int32_t CFDE_TxtEdtEngine::Line2Parag(int32_t nStartParag, |
| 746 int32_t nStartLineofParag, | 742 int32_t nStartLineofParag, |
| 747 int32_t nLineIndex, | 743 int32_t nLineIndex, |
| 748 int32_t& nStartLine) const { | 744 int32_t& nStartLine) const { |
| 749 int32_t nLineTotal = nStartLineofParag; | 745 int32_t nLineTotal = nStartLineofParag; |
| 750 int32_t nCount = m_ParagPtrArray.GetSize(); | 746 int32_t nCount = m_ParagPtrArray.GetSize(); |
| 751 CFDE_TxtEdtParag* pParag = NULL; | 747 CFDE_TxtEdtParag* pParag = NULL; |
| 752 int32_t i = nStartParag; | 748 int32_t i = nStartParag; |
| 753 for (; i < nCount; i++) { | 749 for (; i < nCount; i++) { |
| 754 pParag = m_ParagPtrArray[i]; | 750 pParag = m_ParagPtrArray[i]; |
| 755 nLineTotal += pParag->m_nLineCount; | 751 nLineTotal += pParag->GetLineCount(); |
| 756 if (nLineTotal > nLineIndex) { | 752 if (nLineTotal > nLineIndex) { |
| 757 break; | 753 break; |
| 758 } | 754 } |
| 759 } | 755 } |
| 760 nStartLine = nLineTotal - pParag->m_nLineCount; | 756 nStartLine = nLineTotal - pParag->GetLineCount(); |
| 761 return i; | 757 return i; |
| 762 } | 758 } |
| 763 void CFDE_TxtEdtEngine::GetPreDeleteText(CFX_WideString& wsText, | 759 void CFDE_TxtEdtEngine::GetPreDeleteText(CFX_WideString& wsText, |
| 764 int32_t nIndex, | 760 int32_t nIndex, |
| 765 int32_t nLength) { | 761 int32_t nLength) { |
| 766 GetText(wsText, 0, GetTextBufLength()); | 762 GetText(wsText, 0, GetTextBufLength()); |
| 767 wsText.Delete(nIndex, nLength); | 763 wsText.Delete(nIndex, nLength); |
| 768 } | 764 } |
| 769 void CFDE_TxtEdtEngine::GetPreInsertText(CFX_WideString& wsText, | 765 void CFDE_TxtEdtEngine::GetPreInsertText(CFX_WideString& wsText, |
| 770 int32_t nIndex, | 766 int32_t nIndex, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 811 } | 807 } |
| 812 void CFDE_TxtEdtEngine::Inner_Insert(int32_t nStart, | 808 void CFDE_TxtEdtEngine::Inner_Insert(int32_t nStart, |
| 813 const FX_WCHAR* lpText, | 809 const FX_WCHAR* lpText, |
| 814 int32_t nLength) { | 810 int32_t nLength) { |
| 815 ASSERT(nLength > 0); | 811 ASSERT(nLength > 0); |
| 816 FDE_TXTEDTPARAGPOS ParagPos; | 812 FDE_TXTEDTPARAGPOS ParagPos; |
| 817 TextPos2ParagPos(nStart, ParagPos); | 813 TextPos2ParagPos(nStart, ParagPos); |
| 818 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); | 814 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); |
| 819 int32_t nParagCount = m_ParagPtrArray.GetSize(); | 815 int32_t nParagCount = m_ParagPtrArray.GetSize(); |
| 820 int32_t i = 0; | 816 int32_t i = 0; |
| 821 for (i = ParagPos.nParagIndex + 1; i < nParagCount; i++) { | 817 for (i = ParagPos.nParagIndex + 1; i < nParagCount; i++) |
| 822 m_ParagPtrArray[i]->m_nCharStart += nLength; | 818 m_ParagPtrArray[i]->SetStartIndex(m_ParagPtrArray[i]->GetStartIndex() + |
| 823 } | 819 nLength); |
| 820 | |
| 824 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; | 821 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; |
| 825 int32_t nReserveLineCount = pParag->m_nLineCount; | 822 int32_t nReserveLineCount = pParag->GetLineCount(); |
| 826 int32_t nReserveCharStart = pParag->m_nCharStart; | 823 int32_t nReserveCharStart = pParag->GetStartIndex(); |
| 827 int32_t nLeavePart = ParagPos.nCharIndex; | 824 int32_t nLeavePart = ParagPos.nCharIndex; |
| 828 int32_t nCutPart = pParag->m_nCharCount - ParagPos.nCharIndex; | 825 int32_t nCutPart = pParag->GetTextLength() - ParagPos.nCharIndex; |
| 829 int32_t nTextStart = 0; | 826 int32_t nTextStart = 0; |
| 830 FX_WCHAR wCurChar = L' '; | 827 FX_WCHAR wCurChar = L' '; |
| 831 const FX_WCHAR* lpPos = lpText; | 828 const FX_WCHAR* lpPos = lpText; |
| 832 FX_BOOL bFirst = TRUE; | 829 FX_BOOL bFirst = TRUE; |
| 833 int32_t nParagIndex = ParagPos.nParagIndex; | 830 int32_t nParagIndex = ParagPos.nParagIndex; |
| 834 for (i = 0; i < nLength; i++, lpPos++) { | 831 for (i = 0; i < nLength; i++, lpPos++) { |
| 835 wCurChar = *lpPos; | 832 wCurChar = *lpPos; |
| 836 if (wCurChar == m_wLineEnd) { | 833 if (wCurChar == m_wLineEnd) { |
| 837 if (bFirst) { | 834 if (bFirst) { |
| 838 pParag->m_nCharCount = nLeavePart + (i - nTextStart + 1); | 835 pParag->SetTextLength(nLeavePart + (i - nTextStart + 1)); |
| 839 pParag->m_nLineCount = -1; | 836 pParag->SetLineCount(-1); |
| 840 nReserveCharStart += pParag->m_nCharCount; | 837 nReserveCharStart += pParag->GetTextLength(); |
| 841 bFirst = FALSE; | 838 bFirst = FALSE; |
| 842 } else { | 839 } else { |
| 843 pParag = new CFDE_TxtEdtParag(this); | 840 pParag = new CFDE_TxtEdtParag(this); |
| 844 pParag->m_nLineCount = -1; | 841 pParag->SetLineCount(-1); |
| 845 pParag->m_nCharCount = i - nTextStart + 1; | 842 pParag->SetTextLength(i - nTextStart + 1); |
| 846 pParag->m_nCharStart = nReserveCharStart; | 843 pParag->SetStartIndex(nReserveCharStart); |
| 847 m_ParagPtrArray.InsertAt(++nParagIndex, pParag); | 844 m_ParagPtrArray.InsertAt(++nParagIndex, pParag); |
| 848 nReserveCharStart += pParag->m_nCharCount; | 845 nReserveCharStart += pParag->GetTextLength(); |
| 849 } | 846 } |
| 850 nTextStart = i + 1; | 847 nTextStart = i + 1; |
| 851 } | 848 } |
| 852 } | 849 } |
| 853 if (bFirst) { | 850 if (bFirst) { |
| 854 pParag->m_nCharCount += nLength; | 851 pParag->SetTextLength(pParag->GetTextLength() + nLength); |
| 855 pParag->m_nLineCount = -1; | 852 pParag->SetLineCount(-1); |
| 856 bFirst = FALSE; | 853 bFirst = FALSE; |
| 857 } else { | 854 } else { |
| 858 pParag = new CFDE_TxtEdtParag(this); | 855 pParag = new CFDE_TxtEdtParag(this); |
| 859 pParag->m_nLineCount = -1; | 856 pParag->SetLineCount(-1); |
| 860 pParag->m_nCharCount = nLength - nTextStart + nCutPart; | 857 pParag->SetTextLength(nLength - nTextStart + nCutPart); |
| 861 pParag->m_nCharStart = nReserveCharStart; | 858 pParag->SetStartIndex(nReserveCharStart); |
| 862 m_ParagPtrArray.InsertAt(++nParagIndex, pParag); | 859 m_ParagPtrArray.InsertAt(++nParagIndex, pParag); |
| 863 } | 860 } |
| 864 m_pTxtBuf->Insert(nStart, lpText, nLength); | 861 m_pTxtBuf->Insert(nStart, lpText, nLength); |
| 865 int32_t nTotalLineCount = 0; | 862 int32_t nTotalLineCount = 0; |
| 866 for (i = ParagPos.nParagIndex; i <= nParagIndex; i++) { | 863 for (i = ParagPos.nParagIndex; i <= nParagIndex; i++) { |
| 867 pParag = m_ParagPtrArray[i]; | 864 pParag = m_ParagPtrArray[i]; |
| 868 pParag->CalcLines(); | 865 pParag->CalcLines(); |
| 869 nTotalLineCount += pParag->m_nLineCount; | 866 nTotalLineCount += pParag->GetLineCount(); |
| 870 } | 867 } |
| 871 m_nLineCount += nTotalLineCount - nReserveLineCount; | 868 m_nLineCount += nTotalLineCount - nReserveLineCount; |
| 872 m_Param.pEventSink->On_PageLoad(this, m_nCaretPage, 0); | 869 m_Param.pEventSink->On_PageLoad(this, m_nCaretPage, 0); |
| 873 UpdatePages(); | 870 UpdatePages(); |
| 874 } | 871 } |
| 875 | 872 |
| 876 void CFDE_TxtEdtEngine::Inner_DeleteRange(int32_t nStart, int32_t nCount) { | 873 void CFDE_TxtEdtEngine::Inner_DeleteRange(int32_t nStart, int32_t nCount) { |
| 877 if (nCount == -1) { | 874 if (nCount == -1) { |
| 878 nCount = m_pTxtBuf->GetTextLength() - nStart; | 875 nCount = m_pTxtBuf->GetTextLength() - nStart; |
| 879 } | 876 } |
| 880 int32_t nEnd = nStart + nCount - 1; | 877 int32_t nEnd = nStart + nCount - 1; |
| 881 ASSERT(nStart >= 0 && nEnd < m_pTxtBuf->GetTextLength()); | 878 ASSERT(nStart >= 0 && nEnd < m_pTxtBuf->GetTextLength()); |
| 882 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); | 879 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); |
| 883 FDE_TXTEDTPARAGPOS ParagPosBgn, ParagPosEnd; | 880 FDE_TXTEDTPARAGPOS ParagPosBgn, ParagPosEnd; |
| 884 TextPos2ParagPos(nStart, ParagPosBgn); | 881 TextPos2ParagPos(nStart, ParagPosBgn); |
| 885 TextPos2ParagPos(nEnd, ParagPosEnd); | 882 TextPos2ParagPos(nEnd, ParagPosEnd); |
| 886 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPosEnd.nParagIndex]; | 883 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPosEnd.nParagIndex]; |
| 887 FX_BOOL bLastParag = FALSE; | 884 FX_BOOL bLastParag = FALSE; |
| 888 if (ParagPosEnd.nCharIndex == pParag->m_nCharCount - 1) { | 885 if (ParagPosEnd.nCharIndex == pParag->GetTextLength() - 1) { |
| 889 if (ParagPosEnd.nParagIndex < m_ParagPtrArray.GetSize() - 1) { | 886 if (ParagPosEnd.nParagIndex < m_ParagPtrArray.GetSize() - 1) { |
| 890 ParagPosEnd.nParagIndex++; | 887 ParagPosEnd.nParagIndex++; |
| 891 } else { | 888 } else { |
| 892 bLastParag = TRUE; | 889 bLastParag = TRUE; |
| 893 } | 890 } |
| 894 } | 891 } |
| 895 int32_t nTotalLineCount = 0; | 892 int32_t nTotalLineCount = 0; |
| 896 int32_t nTotalCharCount = 0; | 893 int32_t nTotalCharCount = 0; |
| 897 int32_t i = 0; | 894 int32_t i = 0; |
| 898 for (i = ParagPosBgn.nParagIndex; i <= ParagPosEnd.nParagIndex; i++) { | 895 for (i = ParagPosBgn.nParagIndex; i <= ParagPosEnd.nParagIndex; i++) { |
| 899 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[i]; | 896 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[i]; |
| 900 pParag->CalcLines(); | 897 pParag->CalcLines(); |
| 901 nTotalLineCount += pParag->m_nLineCount; | 898 nTotalLineCount += pParag->GetLineCount(); |
| 902 nTotalCharCount += pParag->m_nCharCount; | 899 nTotalCharCount += pParag->GetTextLength(); |
| 903 } | 900 } |
| 904 m_pTxtBuf->Delete(nStart, nCount); | 901 m_pTxtBuf->Delete(nStart, nCount); |
| 905 int32_t nNextParagIndex = (ParagPosBgn.nCharIndex == 0 && bLastParag) | 902 int32_t nNextParagIndex = (ParagPosBgn.nCharIndex == 0 && bLastParag) |
| 906 ? ParagPosBgn.nParagIndex | 903 ? ParagPosBgn.nParagIndex |
| 907 : (ParagPosBgn.nParagIndex + 1); | 904 : (ParagPosBgn.nParagIndex + 1); |
| 908 for (i = nNextParagIndex; i <= ParagPosEnd.nParagIndex; i++) { | 905 for (i = nNextParagIndex; i <= ParagPosEnd.nParagIndex; i++) { |
| 909 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[nNextParagIndex]; | 906 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[nNextParagIndex]; |
| 910 delete pParag; | 907 delete pParag; |
| 911 m_ParagPtrArray.RemoveAt(nNextParagIndex); | 908 m_ParagPtrArray.RemoveAt(nNextParagIndex); |
| 912 } | 909 } |
| 913 if (!(bLastParag && ParagPosBgn.nCharIndex == 0)) { | 910 if (!(bLastParag && ParagPosBgn.nCharIndex == 0)) { |
| 914 pParag = m_ParagPtrArray[ParagPosBgn.nParagIndex]; | 911 pParag = m_ParagPtrArray[ParagPosBgn.nParagIndex]; |
| 915 pParag->m_nCharCount = nTotalCharCount - nCount; | 912 pParag->SetTextLength(nTotalCharCount - nCount); |
| 916 pParag->CalcLines(); | 913 pParag->CalcLines(); |
| 917 nTotalLineCount -= pParag->m_nLineCount; | 914 nTotalLineCount -= pParag->GetTextLength(); |
| 918 } | 915 } |
| 919 int32_t nParagCount = m_ParagPtrArray.GetSize(); | 916 int32_t nParagCount = m_ParagPtrArray.GetSize(); |
| 920 for (i = nNextParagIndex; i < nParagCount; i++) { | 917 for (i = nNextParagIndex; i < nParagCount; i++) { |
| 921 m_ParagPtrArray[i]->m_nCharStart -= nCount; | 918 m_ParagPtrArray[i]->SetStartIndex(m_ParagPtrArray[i]->GetStartIndex() - |
|
Tom Sepez
2016/04/29 15:36:23
Feels like we should have incrementStatIndex and d
dsinclair
2016/05/02 13:36:50
Done.
| |
| 919 nCount); | |
| 922 } | 920 } |
| 923 m_nLineCount -= nTotalLineCount; | 921 m_nLineCount -= nTotalLineCount; |
| 924 UpdatePages(); | 922 UpdatePages(); |
| 925 int32_t nPageCount = CountPages(); | 923 int32_t nPageCount = CountPages(); |
| 926 if (m_nCaretPage >= nPageCount) { | 924 if (m_nCaretPage >= nPageCount) { |
| 927 m_nCaretPage = nPageCount - 1; | 925 m_nCaretPage = nPageCount - 1; |
| 928 } | 926 } |
| 929 m_Param.pEventSink->On_PageLoad(this, m_nCaretPage, 0); | 927 m_Param.pEventSink->On_PageLoad(this, m_nCaretPage, 0); |
| 930 } | 928 } |
| 931 void CFDE_TxtEdtEngine::DeleteRange_DoRecord(int32_t nStart, | 929 void CFDE_TxtEdtEngine::DeleteRange_DoRecord(int32_t nStart, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 964 FX_WCHAR wChar = L' '; | 962 FX_WCHAR wChar = L' '; |
| 965 int32_t nParagStart = 0; | 963 int32_t nParagStart = 0; |
| 966 int32_t nIndex = 0; | 964 int32_t nIndex = 0; |
| 967 IFX_CharIter* pIter = new CFDE_TxtEdtBufIter((CFDE_TxtEdtBuf*)m_pTxtBuf); | 965 IFX_CharIter* pIter = new CFDE_TxtEdtBufIter((CFDE_TxtEdtBuf*)m_pTxtBuf); |
| 968 pIter->SetAt(0); | 966 pIter->SetAt(0); |
| 969 do { | 967 do { |
| 970 wChar = pIter->GetChar(); | 968 wChar = pIter->GetChar(); |
| 971 nIndex = pIter->GetAt(); | 969 nIndex = pIter->GetAt(); |
| 972 if (wChar == m_wLineEnd) { | 970 if (wChar == m_wLineEnd) { |
| 973 CFDE_TxtEdtParag* pParag = new CFDE_TxtEdtParag(this); | 971 CFDE_TxtEdtParag* pParag = new CFDE_TxtEdtParag(this); |
| 974 pParag->m_nCharStart = nParagStart; | 972 pParag->SetStartIndex(nParagStart); |
| 975 pParag->m_nCharCount = nIndex - nParagStart + 1; | 973 pParag->SetTextLength(nIndex - nParagStart + 1); |
| 976 pParag->m_nLineCount = -1; | 974 pParag->SetLineCount(-1); |
| 977 m_ParagPtrArray.Add(pParag); | 975 m_ParagPtrArray.Add(pParag); |
| 978 nParagStart = nIndex + 1; | 976 nParagStart = nIndex + 1; |
| 979 } | 977 } |
| 980 } while (pIter->Next()); | 978 } while (pIter->Next()); |
| 981 pIter->Release(); | 979 pIter->Release(); |
| 982 } | 980 } |
| 983 void CFDE_TxtEdtEngine::RemoveAllParags() { | 981 void CFDE_TxtEdtEngine::RemoveAllParags() { |
| 984 int32_t nCount = m_ParagPtrArray.GetSize(); | 982 int32_t nCount = m_ParagPtrArray.GetSize(); |
| 985 int32_t i = 0; | 983 int32_t i = 0; |
| 986 for (i = 0; i < nCount; i++) { | 984 for (i = 0; i < nCount; i++) { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1005 void CFDE_TxtEdtEngine::UpdateParags() { | 1003 void CFDE_TxtEdtEngine::UpdateParags() { |
| 1006 int32_t nCount = m_ParagPtrArray.GetSize(); | 1004 int32_t nCount = m_ParagPtrArray.GetSize(); |
| 1007 if (nCount == 0) { | 1005 if (nCount == 0) { |
| 1008 return; | 1006 return; |
| 1009 } | 1007 } |
| 1010 CFDE_TxtEdtParag* pParag = NULL; | 1008 CFDE_TxtEdtParag* pParag = NULL; |
| 1011 int32_t nLineCount = 0; | 1009 int32_t nLineCount = 0; |
| 1012 int32_t i = 0; | 1010 int32_t i = 0; |
| 1013 for (i = 0; i < nCount; i++) { | 1011 for (i = 0; i < nCount; i++) { |
| 1014 pParag = m_ParagPtrArray[i]; | 1012 pParag = m_ParagPtrArray[i]; |
| 1015 if (pParag->m_nLineCount == -1) { | 1013 if (pParag->GetLineCount() == -1) |
| 1016 pParag->CalcLines(); | 1014 pParag->CalcLines(); |
| 1017 } | 1015 |
| 1018 nLineCount += pParag->m_nLineCount; | 1016 nLineCount += pParag->GetLineCount(); |
| 1019 } | 1017 } |
| 1020 m_nLineCount = nLineCount; | 1018 m_nLineCount = nLineCount; |
| 1021 } | 1019 } |
| 1022 void CFDE_TxtEdtEngine::UpdatePages() { | 1020 void CFDE_TxtEdtEngine::UpdatePages() { |
| 1023 if (m_nLineCount == 0) { | 1021 if (m_nLineCount == 0) |
| 1024 return; | 1022 return; |
| 1025 } | 1023 |
| 1026 int32_t nPageCount = (m_nLineCount - 1) / (m_nPageLineCount) + 1; | 1024 int32_t nPageCount = (m_nLineCount - 1) / (m_nPageLineCount) + 1; |
| 1027 int32_t nSize = m_PagePtrArray.GetSize(); | 1025 int32_t nSize = m_PagePtrArray.GetSize(); |
| 1028 if (nSize == nPageCount) { | 1026 if (nSize == nPageCount) |
| 1029 return; | 1027 return; |
| 1030 } | 1028 |
| 1031 if (nSize > nPageCount) { | 1029 if (nSize > nPageCount) { |
| 1032 IFDE_TxtEdtPage* pPage = NULL; | 1030 IFDE_TxtEdtPage* pPage = NULL; |
| 1033 int32_t i = 0; | 1031 int32_t i = 0; |
| 1034 for (i = nSize - 1; i >= nPageCount; i--) { | 1032 for (i = nSize - 1; i >= nPageCount; i--) { |
| 1035 pPage = m_PagePtrArray[i]; | 1033 pPage = m_PagePtrArray[i]; |
| 1036 if (pPage) { | 1034 if (pPage) { |
| 1037 pPage->Release(); | 1035 pPage->Release(); |
| 1038 } | 1036 } |
| 1039 m_PagePtrArray.RemoveAt(i); | 1037 m_PagePtrArray.RemoveAt(i); |
| 1040 } | 1038 } |
| 1041 m_Param.pEventSink->On_PageCountChanged(this); | |
| 1042 return; | 1039 return; |
| 1043 } | 1040 } |
| 1044 if (nSize < nPageCount) { | 1041 if (nSize < nPageCount) { |
| 1045 IFDE_TxtEdtPage* pPage = NULL; | 1042 IFDE_TxtEdtPage* pPage = NULL; |
| 1046 int32_t i = 0; | 1043 int32_t i = 0; |
| 1047 for (i = nSize; i < nPageCount; i++) { | 1044 for (i = nSize; i < nPageCount; i++) { |
| 1048 pPage = IFDE_TxtEdtPage::Create(this, i); | 1045 pPage = IFDE_TxtEdtPage::Create(this, i); |
| 1049 m_PagePtrArray.Add(pPage); | 1046 m_PagePtrArray.Add(pPage); |
| 1050 } | 1047 } |
| 1051 m_Param.pEventSink->On_PageCountChanged(this); | |
| 1052 return; | 1048 return; |
| 1053 } | 1049 } |
| 1054 } | 1050 } |
| 1055 void CFDE_TxtEdtEngine::UpdateTxtBreak() { | 1051 void CFDE_TxtEdtEngine::UpdateTxtBreak() { |
| 1056 uint32_t dwStyle = m_pTextBreak->GetLayoutStyles(); | 1052 uint32_t dwStyle = m_pTextBreak->GetLayoutStyles(); |
| 1057 if (m_Param.dwMode & FDE_TEXTEDITMODE_MultiLines) { | 1053 if (m_Param.dwMode & FDE_TEXTEDITMODE_MultiLines) { |
| 1058 dwStyle &= ~FX_TXTLAYOUTSTYLE_SingleLine; | 1054 dwStyle &= ~FX_TXTLAYOUTSTYLE_SingleLine; |
| 1059 } else { | 1055 } else { |
| 1060 dwStyle |= FX_TXTLAYOUTSTYLE_SingleLine; | 1056 dwStyle |= FX_TXTLAYOUTSTYLE_SingleLine; |
| 1061 } | 1057 } |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1247 return m_nCaretPage; | 1243 return m_nCaretPage; |
| 1248 } | 1244 } |
| 1249 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); | 1245 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); |
| 1250 } | 1246 } |
| 1251 CFDE_TxtEdtParag* pParag = NULL; | 1247 CFDE_TxtEdtParag* pParag = NULL; |
| 1252 int32_t nLineCount = 0; | 1248 int32_t nLineCount = 0; |
| 1253 int32_t nParagCount = m_ParagPtrArray.GetSize(); | 1249 int32_t nParagCount = m_ParagPtrArray.GetSize(); |
| 1254 int32_t i = 0; | 1250 int32_t i = 0; |
| 1255 for (i = 0; i < nParagCount; i++) { | 1251 for (i = 0; i < nParagCount; i++) { |
| 1256 pParag = m_ParagPtrArray[i]; | 1252 pParag = m_ParagPtrArray[i]; |
| 1257 if (pParag->m_nCharStart <= nIndex && | 1253 if (pParag->GetStartIndex() <= nIndex && |
| 1258 nIndex < (pParag->m_nCharStart + pParag->m_nCharCount)) { | 1254 nIndex < (pParag->GetStartIndex() + pParag->GetTextLength())) { |
| 1259 break; | 1255 break; |
| 1260 } | 1256 } |
| 1261 nLineCount += pParag->m_nLineCount; | 1257 nLineCount += pParag->GetLineCount(); |
| 1262 } | 1258 } |
| 1263 pParag->LoadParag(); | 1259 pParag->LoadParag(); |
| 1264 int32_t nLineStart = -1; | 1260 int32_t nLineStart = -1; |
| 1265 int32_t nLineCharCount = -1; | 1261 int32_t nLineCharCount = -1; |
| 1266 for (i = 0; i < pParag->m_nLineCount; i++) { | 1262 for (i = 0; i < pParag->GetLineCount(); i++) { |
| 1267 pParag->GetLineRange(i, nLineStart, nLineCharCount); | 1263 pParag->GetLineRange(i, nLineStart, nLineCharCount); |
| 1268 if (nLineStart <= nIndex && nIndex < (nLineStart + nLineCharCount)) { | 1264 if (nLineStart <= nIndex && nIndex < (nLineStart + nLineCharCount)) { |
| 1269 break; | 1265 break; |
| 1270 } | 1266 } |
| 1271 } | 1267 } |
| 1272 ASSERT(i < pParag->m_nLineCount); | 1268 ASSERT(i < pParag->GetLineCount()); |
| 1273 nLineCount += (i + 1); | 1269 nLineCount += (i + 1); |
| 1274 m_nCaretPage = (nLineCount - 1) / m_nPageLineCount + 1 - 1; | 1270 m_nCaretPage = (nLineCount - 1) / m_nPageLineCount + 1 - 1; |
| 1275 m_Param.pEventSink->On_PageChange(this, m_nCaretPage); | |
| 1276 pParag->UnloadParag(); | 1271 pParag->UnloadParag(); |
| 1277 return m_nCaretPage; | 1272 return m_nCaretPage; |
| 1278 } | 1273 } |
| 1279 void CFDE_TxtEdtEngine::TextPos2ParagPos(int32_t nIndex, | 1274 void CFDE_TxtEdtEngine::TextPos2ParagPos(int32_t nIndex, |
| 1280 FDE_TXTEDTPARAGPOS& ParagPos) const { | 1275 FDE_TXTEDTPARAGPOS& ParagPos) const { |
| 1281 ASSERT(nIndex >= 0 && nIndex < m_pTxtBuf->GetTextLength()); | 1276 ASSERT(nIndex >= 0 && nIndex < m_pTxtBuf->GetTextLength()); |
| 1282 int32_t nCount = m_ParagPtrArray.GetSize(); | 1277 int32_t nCount = m_ParagPtrArray.GetSize(); |
| 1283 int32_t nBgn = 0; | 1278 int32_t nBgn = 0; |
| 1284 int32_t nMid = 0; | 1279 int32_t nMid = 0; |
| 1285 int32_t nEnd = nCount - 1; | 1280 int32_t nEnd = nCount - 1; |
| 1286 while (nEnd > nBgn) { | 1281 while (nEnd > nBgn) { |
| 1287 nMid = (nBgn + nEnd) / 2; | 1282 nMid = (nBgn + nEnd) / 2; |
| 1288 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[nMid]; | 1283 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[nMid]; |
| 1289 if (nIndex < pParag->m_nCharStart) { | 1284 if (nIndex < pParag->GetStartIndex()) { |
| 1290 nEnd = nMid - 1; | 1285 nEnd = nMid - 1; |
| 1291 } else if (nIndex >= (pParag->m_nCharStart + pParag->m_nCharCount)) { | 1286 } else if (nIndex >= (pParag->GetStartIndex() + pParag->GetTextLength())) { |
| 1292 nBgn = nMid + 1; | 1287 nBgn = nMid + 1; |
| 1293 } else { | 1288 } else { |
| 1294 break; | 1289 break; |
| 1295 } | 1290 } |
| 1296 } | 1291 } |
| 1297 if (nBgn == nEnd) { | 1292 if (nBgn == nEnd) { |
| 1298 nMid = nBgn; | 1293 nMid = nBgn; |
| 1299 } | 1294 } |
| 1300 ASSERT(nIndex >= m_ParagPtrArray[nMid]->m_nCharStart && | 1295 ASSERT(nIndex >= m_ParagPtrArray[nMid]->GetStartIndex() && |
| 1301 (nIndex < m_ParagPtrArray[nMid]->m_nCharStart + | 1296 (nIndex < m_ParagPtrArray[nMid]->GetStartIndex() + |
| 1302 m_ParagPtrArray[nMid]->m_nCharCount)); | 1297 m_ParagPtrArray[nMid]->GetTextLength())); |
| 1303 ParagPos.nParagIndex = nMid; | 1298 ParagPos.nParagIndex = nMid; |
| 1304 ParagPos.nCharIndex = nIndex - m_ParagPtrArray[nMid]->m_nCharStart; | 1299 ParagPos.nCharIndex = nIndex - m_ParagPtrArray[nMid]->GetStartIndex(); |
| 1305 } | 1300 } |
| 1306 int32_t CFDE_TxtEdtEngine::MoveForward(FX_BOOL& bBefore) { | 1301 int32_t CFDE_TxtEdtEngine::MoveForward(FX_BOOL& bBefore) { |
| 1307 if (m_nCaret == m_pTxtBuf->GetTextLength() - 1) { | 1302 if (m_nCaret == m_pTxtBuf->GetTextLength() - 1) { |
| 1308 return -1; | 1303 return -1; |
| 1309 } | 1304 } |
| 1310 int32_t nCaret = m_nCaret; | 1305 int32_t nCaret = m_nCaret; |
| 1311 if ((nCaret + 1 < m_pTxtBuf->GetTextLength()) && | 1306 if ((nCaret + 1 < m_pTxtBuf->GetTextLength()) && |
| 1312 (m_pTxtBuf->GetCharByIndex(nCaret) == L'\r') && | 1307 (m_pTxtBuf->GetCharByIndex(nCaret) == L'\r') && |
| 1313 (m_pTxtBuf->GetCharByIndex(nCaret + 1) == L'\n')) { | 1308 (m_pTxtBuf->GetCharByIndex(nCaret + 1) == L'\n')) { |
| 1314 nCaret++; | 1309 nCaret++; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1346 } else { | 1341 } else { |
| 1347 if (m_nCaretPage == 0) { | 1342 if (m_nCaretPage == 0) { |
| 1348 return FALSE; | 1343 return FALSE; |
| 1349 } | 1344 } |
| 1350 } | 1345 } |
| 1351 if (bLineReserve) { | 1346 if (bLineReserve) { |
| 1352 m_nCaretPage++; | 1347 m_nCaretPage++; |
| 1353 } else { | 1348 } else { |
| 1354 m_nCaretPage--; | 1349 m_nCaretPage--; |
| 1355 } | 1350 } |
| 1356 m_Param.pEventSink->On_PageChange(this, m_nCaretPage); | |
| 1357 ptCaret.x -= rtContent.left; | 1351 ptCaret.x -= rtContent.left; |
| 1358 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); | 1352 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); |
| 1359 ptCaret.x += pCurPage->GetContentsBox().right(); | 1353 ptCaret.x += pCurPage->GetContentsBox().right(); |
| 1360 } | 1354 } |
| 1361 } else { | 1355 } else { |
| 1362 ptCaret.x = m_fCaretPosReserve; | 1356 ptCaret.x = m_fCaretPosReserve; |
| 1363 ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 - m_Param.fLineSpace; | 1357 ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 - m_Param.fLineSpace; |
| 1364 if (ptCaret.y < rtContent.top) { | 1358 if (ptCaret.y < rtContent.top) { |
| 1365 if (m_nCaretPage == 0) { | 1359 if (m_nCaretPage == 0) { |
| 1366 return FALSE; | 1360 return FALSE; |
| 1367 } | 1361 } |
| 1368 ptCaret.y -= rtContent.top; | 1362 ptCaret.y -= rtContent.top; |
| 1369 m_nCaretPage--; | 1363 m_nCaretPage--; |
| 1370 m_Param.pEventSink->On_PageChange(this, m_nCaretPage); | |
| 1371 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); | 1364 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); |
| 1372 ptCaret.y += pCurPage->GetContentsBox().bottom(); | 1365 ptCaret.y += pCurPage->GetContentsBox().bottom(); |
| 1373 } | 1366 } |
| 1374 } | 1367 } |
| 1375 return TRUE; | 1368 return TRUE; |
| 1376 } | 1369 } |
| 1377 FX_BOOL CFDE_TxtEdtEngine::MoveDown(CFX_PointF& ptCaret) { | 1370 FX_BOOL CFDE_TxtEdtEngine::MoveDown(CFX_PointF& ptCaret) { |
| 1378 IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage); | 1371 IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage); |
| 1379 const CFX_RectF& rtContent = pPage->GetContentsBox(); | 1372 const CFX_RectF& rtContent = pPage->GetContentsBox(); |
| 1380 if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) { | 1373 if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) { |
| 1381 ptCaret.x = m_rtCaret.left + m_rtCaret.width / 2 + m_Param.fLineSpace; | 1374 ptCaret.x = m_rtCaret.left + m_rtCaret.width / 2 + m_Param.fLineSpace; |
| 1382 ptCaret.y = m_fCaretPosReserve; | 1375 ptCaret.y = m_fCaretPosReserve; |
| 1383 if (ptCaret.x >= rtContent.right()) { | 1376 if (ptCaret.x >= rtContent.right()) { |
| 1384 FX_BOOL bLineReserve = | 1377 FX_BOOL bLineReserve = |
| 1385 m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve; | 1378 m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve; |
| 1386 if (bLineReserve) { | 1379 if (bLineReserve) { |
| 1387 if (m_nCaretPage == 0) { | 1380 if (m_nCaretPage == 0) { |
| 1388 return FALSE; | 1381 return FALSE; |
| 1389 } | 1382 } |
| 1390 } else { | 1383 } else { |
| 1391 if (m_nCaretPage == CountPages() - 1) { | 1384 if (m_nCaretPage == CountPages() - 1) { |
| 1392 return FALSE; | 1385 return FALSE; |
| 1393 } | 1386 } |
| 1394 } | 1387 } |
| 1395 if (bLineReserve) { | 1388 if (bLineReserve) { |
| 1396 m_nCaretPage--; | 1389 m_nCaretPage--; |
| 1397 } else { | 1390 } else { |
| 1398 m_nCaretPage++; | 1391 m_nCaretPage++; |
| 1399 } | 1392 } |
| 1400 m_Param.pEventSink->On_PageChange(this, m_nCaretPage); | |
| 1401 ptCaret.x -= rtContent.right(); | 1393 ptCaret.x -= rtContent.right(); |
| 1402 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); | 1394 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); |
| 1403 ptCaret.x += pCurPage->GetContentsBox().left; | 1395 ptCaret.x += pCurPage->GetContentsBox().left; |
| 1404 } | 1396 } |
| 1405 } else { | 1397 } else { |
| 1406 ptCaret.x = m_fCaretPosReserve; | 1398 ptCaret.x = m_fCaretPosReserve; |
| 1407 ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 + m_Param.fLineSpace; | 1399 ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 + m_Param.fLineSpace; |
| 1408 if (ptCaret.y >= rtContent.bottom()) { | 1400 if (ptCaret.y >= rtContent.bottom()) { |
| 1409 if (m_nCaretPage == CountPages() - 1) { | 1401 if (m_nCaretPage == CountPages() - 1) { |
| 1410 return FALSE; | 1402 return FALSE; |
| 1411 } | 1403 } |
| 1412 ptCaret.y -= rtContent.bottom(); | 1404 ptCaret.y -= rtContent.bottom(); |
| 1413 m_nCaretPage++; | 1405 m_nCaretPage++; |
| 1414 m_Param.pEventSink->On_PageChange(this, m_nCaretPage); | |
| 1415 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); | 1406 IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); |
| 1416 ptCaret.y += pCurPage->GetContentsBox().top; | 1407 ptCaret.y += pCurPage->GetContentsBox().top; |
| 1417 } | 1408 } |
| 1418 } | 1409 } |
| 1419 return TRUE; | 1410 return TRUE; |
| 1420 } | 1411 } |
| 1421 FX_BOOL CFDE_TxtEdtEngine::MoveLineStart() { | 1412 FX_BOOL CFDE_TxtEdtEngine::MoveLineStart() { |
| 1422 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; | 1413 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; |
| 1423 FDE_TXTEDTPARAGPOS ParagPos; | 1414 FDE_TXTEDTPARAGPOS ParagPos; |
| 1424 TextPos2ParagPos(nIndex, ParagPos); | 1415 TextPos2ParagPos(nIndex, ParagPos); |
| 1425 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; | 1416 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; |
| 1426 pParag->LoadParag(); | 1417 pParag->LoadParag(); |
| 1427 int32_t nLineCount = pParag->m_nLineCount; | 1418 int32_t nLineCount = pParag->GetLineCount(); |
| 1428 int32_t i = 0; | 1419 int32_t i = 0; |
| 1429 int32_t nStart = 0; | 1420 int32_t nStart = 0; |
| 1430 int32_t nCount = 0; | 1421 int32_t nCount = 0; |
| 1431 for (; i < nLineCount; i++) { | 1422 for (; i < nLineCount; i++) { |
| 1432 pParag->GetLineRange(i, nStart, nCount); | 1423 pParag->GetLineRange(i, nStart, nCount); |
| 1433 if (nIndex >= nStart && nIndex < nStart + nCount) { | 1424 if (nIndex >= nStart && nIndex < nStart + nCount) { |
| 1434 break; | 1425 break; |
| 1435 } | 1426 } |
| 1436 } | 1427 } |
| 1437 UpdateCaretRect(nStart, TRUE); | 1428 UpdateCaretRect(nStart, TRUE); |
| 1438 pParag->UnloadParag(); | 1429 pParag->UnloadParag(); |
| 1439 return TRUE; | 1430 return TRUE; |
| 1440 } | 1431 } |
| 1441 FX_BOOL CFDE_TxtEdtEngine::MoveLineEnd() { | 1432 FX_BOOL CFDE_TxtEdtEngine::MoveLineEnd() { |
| 1442 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; | 1433 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; |
| 1443 FDE_TXTEDTPARAGPOS ParagPos; | 1434 FDE_TXTEDTPARAGPOS ParagPos; |
| 1444 TextPos2ParagPos(nIndex, ParagPos); | 1435 TextPos2ParagPos(nIndex, ParagPos); |
| 1445 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; | 1436 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; |
| 1446 pParag->LoadParag(); | 1437 pParag->LoadParag(); |
| 1447 int32_t nLineCount = pParag->m_nLineCount; | 1438 int32_t nLineCount = pParag->GetLineCount(); |
| 1448 int32_t i = 0; | 1439 int32_t i = 0; |
| 1449 int32_t nStart = 0; | 1440 int32_t nStart = 0; |
| 1450 int32_t nCount = 0; | 1441 int32_t nCount = 0; |
| 1451 for (; i < nLineCount; i++) { | 1442 for (; i < nLineCount; i++) { |
| 1452 pParag->GetLineRange(i, nStart, nCount); | 1443 pParag->GetLineRange(i, nStart, nCount); |
| 1453 if (nIndex >= nStart && nIndex < nStart + nCount) { | 1444 if (nIndex >= nStart && nIndex < nStart + nCount) { |
| 1454 break; | 1445 break; |
| 1455 } | 1446 } |
| 1456 } | 1447 } |
| 1457 nIndex = nStart + nCount - 1; | 1448 nIndex = nStart + nCount - 1; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1472 } | 1463 } |
| 1473 UpdateCaretRect(nIndex, bBefore); | 1464 UpdateCaretRect(nIndex, bBefore); |
| 1474 pParag->UnloadParag(); | 1465 pParag->UnloadParag(); |
| 1475 return TRUE; | 1466 return TRUE; |
| 1476 } | 1467 } |
| 1477 FX_BOOL CFDE_TxtEdtEngine::MoveParagStart() { | 1468 FX_BOOL CFDE_TxtEdtEngine::MoveParagStart() { |
| 1478 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; | 1469 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; |
| 1479 FDE_TXTEDTPARAGPOS ParagPos; | 1470 FDE_TXTEDTPARAGPOS ParagPos; |
| 1480 TextPos2ParagPos(nIndex, ParagPos); | 1471 TextPos2ParagPos(nIndex, ParagPos); |
| 1481 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; | 1472 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; |
| 1482 UpdateCaretRect(pParag->m_nCharStart, TRUE); | 1473 UpdateCaretRect(pParag->GetStartIndex(), TRUE); |
| 1483 return TRUE; | 1474 return TRUE; |
| 1484 } | 1475 } |
| 1485 FX_BOOL CFDE_TxtEdtEngine::MoveParagEnd() { | 1476 FX_BOOL CFDE_TxtEdtEngine::MoveParagEnd() { |
| 1486 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; | 1477 int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; |
| 1487 FDE_TXTEDTPARAGPOS ParagPos; | 1478 FDE_TXTEDTPARAGPOS ParagPos; |
| 1488 TextPos2ParagPos(nIndex, ParagPos); | 1479 TextPos2ParagPos(nIndex, ParagPos); |
| 1489 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; | 1480 CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; |
| 1490 nIndex = pParag->m_nCharStart + pParag->m_nCharCount - 1; | 1481 nIndex = pParag->GetStartIndex() + pParag->GetTextLength() - 1; |
| 1491 FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nIndex); | 1482 FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nIndex); |
| 1492 if (wChar == L'\n' && nIndex > 0) { | 1483 if (wChar == L'\n' && nIndex > 0) { |
| 1493 nIndex--; | 1484 nIndex--; |
| 1494 wChar = m_pTxtBuf->GetCharByIndex(nIndex); | 1485 wChar = m_pTxtBuf->GetCharByIndex(nIndex); |
| 1495 if (wChar != L'\r') { | 1486 if (wChar != L'\r') { |
| 1496 nIndex++; | 1487 nIndex++; |
| 1497 } | 1488 } |
| 1498 } | 1489 } |
| 1499 UpdateCaretRect(nIndex, TRUE); | 1490 UpdateCaretRect(nIndex, TRUE); |
| 1500 return TRUE; | 1491 return TRUE; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1603 FX_BOOL CFDE_TxtEdtEngine::IsSelect() { | 1594 FX_BOOL CFDE_TxtEdtEngine::IsSelect() { |
| 1604 return m_SelRangePtrArr.GetSize() > 0; | 1595 return m_SelRangePtrArr.GetSize() > 0; |
| 1605 } | 1596 } |
| 1606 void CFDE_TxtEdtEngine::DeleteSelect() { | 1597 void CFDE_TxtEdtEngine::DeleteSelect() { |
| 1607 int32_t nCountRange = CountSelRanges(); | 1598 int32_t nCountRange = CountSelRanges(); |
| 1608 if (nCountRange > 0) { | 1599 if (nCountRange > 0) { |
| 1609 int32_t nSelStart; | 1600 int32_t nSelStart; |
| 1610 int32_t nSelCount; | 1601 int32_t nSelCount; |
| 1611 while (nCountRange > 0) { | 1602 while (nCountRange > 0) { |
| 1612 nSelCount = GetSelRange(--nCountRange, nSelStart); | 1603 nSelCount = GetSelRange(--nCountRange, nSelStart); |
| 1613 FDE_LPTXTEDTSELRANGE lpTemp = m_SelRangePtrArr[nCountRange]; | 1604 FDE_TXTEDTSELRANGE* lpTemp = m_SelRangePtrArr[nCountRange]; |
| 1614 delete lpTemp; | 1605 delete lpTemp; |
| 1615 m_SelRangePtrArr.RemoveAt(nCountRange); | 1606 m_SelRangePtrArr.RemoveAt(nCountRange); |
| 1616 DeleteRange_DoRecord(nSelStart, nSelCount, TRUE); | 1607 DeleteRange_DoRecord(nSelStart, nSelCount, TRUE); |
| 1617 } | 1608 } |
| 1618 ClearSelection(); | 1609 ClearSelection(); |
| 1619 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); | 1610 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); |
| 1620 m_Param.pEventSink->On_SelChanged(this); | 1611 m_Param.pEventSink->On_SelChanged(this); |
| 1621 SetCaretPos(nSelStart, TRUE); | 1612 SetCaretPos(nSelStart, TRUE); |
| 1622 return; | 1613 return; |
| 1623 } | 1614 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1776 int32_t nEngine = 0; | 1767 int32_t nEngine = 0; |
| 1777 ArchiveLoader >> nEngine; | 1768 ArchiveLoader >> nEngine; |
| 1778 m_pEngine = (CFDE_TxtEdtEngine*)(uintptr_t)nEngine; | 1769 m_pEngine = (CFDE_TxtEdtEngine*)(uintptr_t)nEngine; |
| 1779 int32_t iSel = 0; | 1770 int32_t iSel = 0; |
| 1780 ArchiveLoader >> iSel; | 1771 ArchiveLoader >> iSel; |
| 1781 m_bSel = !!iSel; | 1772 m_bSel = !!iSel; |
| 1782 ArchiveLoader >> m_nIndex; | 1773 ArchiveLoader >> m_nIndex; |
| 1783 ArchiveLoader >> m_nCaret; | 1774 ArchiveLoader >> m_nCaret; |
| 1784 ArchiveLoader >> m_wsRange; | 1775 ArchiveLoader >> m_wsRange; |
| 1785 } | 1776 } |
| OLD | NEW |