| 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 "../../include/fxedit/fxet_stub.h" | 7 #include "../../include/fxedit/fxet_stub.h" |
| 8 #include "../../include/fxedit/fxet_edit.h" | 8 #include "../../include/fxedit/fxet_edit.h" |
| 9 | 9 |
| 10 #define FX_EDIT_UNDO_MAXITEM 10000 | 10 #define FX_EDIT_UNDO_MAXITEM 10000 |
| 11 | 11 |
| 12 /* ---------------------------- CFX_Edit_Iterator ---------------------------- *
/ | 12 /* ---------------------------- CFX_Edit_Iterator ---------------------------- *
/ |
| 13 | 13 |
| 14 CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator
* pVTIterator) : | 14 CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator
* pVTIterator) : |
| 15 m_pEdit(pEdit), | 15 m_pEdit(pEdit), |
| 16 m_pVTIterator(pVTIterator) | 16 m_pVTIterator(pVTIterator) |
| 17 { | 17 { |
| 18 } | 18 } |
| 19 | 19 |
| 20 CFX_Edit_Iterator::~CFX_Edit_Iterator() | 20 CFX_Edit_Iterator::~CFX_Edit_Iterator() |
| 21 { | 21 { |
| 22 } | 22 } |
| 23 | 23 |
| 24 FX_BOOL»CFX_Edit_Iterator::NextWord() | 24 bool» CFX_Edit_Iterator::NextWord() |
| 25 { | 25 { |
| 26 ASSERT(m_pVTIterator != NULL); | 26 ASSERT(m_pVTIterator != NULL); |
| 27 | 27 |
| 28 return m_pVTIterator->NextWord(); | 28 return m_pVTIterator->NextWord(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 FX_BOOL CFX_Edit_Iterator::NextLine() | 31 bool CFX_Edit_Iterator::NextLine() |
| 32 { | 32 { |
| 33 ASSERT(m_pVTIterator != NULL); | 33 ASSERT(m_pVTIterator != NULL); |
| 34 | 34 |
| 35 return m_pVTIterator->NextLine(); | 35 return m_pVTIterator->NextLine(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 FX_BOOL CFX_Edit_Iterator::NextSection() | 38 bool CFX_Edit_Iterator::NextSection() |
| 39 { | 39 { |
| 40 ASSERT(m_pVTIterator != NULL); | 40 ASSERT(m_pVTIterator != NULL); |
| 41 | 41 |
| 42 return m_pVTIterator->NextSection(); | 42 return m_pVTIterator->NextSection(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 FX_BOOL»CFX_Edit_Iterator::PrevWord() | 45 bool» CFX_Edit_Iterator::PrevWord() |
| 46 { | 46 { |
| 47 ASSERT(m_pVTIterator != NULL); | 47 ASSERT(m_pVTIterator != NULL); |
| 48 | 48 |
| 49 return m_pVTIterator->PrevWord(); | 49 return m_pVTIterator->PrevWord(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 FX_BOOL»CFX_Edit_Iterator::PrevLine() | 52 bool» CFX_Edit_Iterator::PrevLine() |
| 53 { | 53 { |
| 54 ASSERT(m_pVTIterator != NULL); | 54 ASSERT(m_pVTIterator != NULL); |
| 55 | 55 |
| 56 return m_pVTIterator->PrevLine(); | 56 return m_pVTIterator->PrevLine(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 FX_BOOL»CFX_Edit_Iterator::PrevSection() | 59 bool» CFX_Edit_Iterator::PrevSection() |
| 60 { | 60 { |
| 61 ASSERT(m_pVTIterator != NULL); | 61 ASSERT(m_pVTIterator != NULL); |
| 62 | 62 |
| 63 return m_pVTIterator->PrevSection(); | 63 return m_pVTIterator->PrevSection(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 FX_BOOL CFX_Edit_Iterator::GetWord(CPVT_Word & word) const | 66 bool CFX_Edit_Iterator::GetWord(CPVT_Word & word) const |
| 67 { | 67 { |
| 68 ASSERT(m_pEdit != NULL); | 68 ASSERT(m_pEdit != NULL); |
| 69 ASSERT(m_pVTIterator != NULL); | 69 ASSERT(m_pVTIterator != NULL); |
| 70 | 70 |
| 71 if (m_pVTIterator->GetWord(word)) | 71 if (m_pVTIterator->GetWord(word)) |
| 72 { | 72 { |
| 73 word.ptWord = m_pEdit->VTToEdit(word.ptWord); | 73 word.ptWord = m_pEdit->VTToEdit(word.ptWord); |
| 74 » » return TRUE; | 74 » » return true; |
| 75 } | 75 } |
| 76 | 76 |
| 77 » return FALSE; | 77 » return false; |
| 78 } | 78 } |
| 79 | 79 |
| 80 FX_BOOL CFX_Edit_Iterator::GetLine(CPVT_Line & line) const | 80 bool CFX_Edit_Iterator::GetLine(CPVT_Line & line) const |
| 81 { | 81 { |
| 82 ASSERT(m_pEdit != NULL); | 82 ASSERT(m_pEdit != NULL); |
| 83 ASSERT(m_pVTIterator != NULL); | 83 ASSERT(m_pVTIterator != NULL); |
| 84 | 84 |
| 85 if (m_pVTIterator->GetLine(line)) | 85 if (m_pVTIterator->GetLine(line)) |
| 86 { | 86 { |
| 87 line.ptLine = m_pEdit->VTToEdit(line.ptLine); | 87 line.ptLine = m_pEdit->VTToEdit(line.ptLine); |
| 88 » » return TRUE; | 88 » » return true; |
| 89 } | 89 } |
| 90 | 90 |
| 91 » return FALSE; | 91 » return false; |
| 92 } | 92 } |
| 93 | 93 |
| 94 FX_BOOL CFX_Edit_Iterator::GetSection(CPVT_Section & section) const | 94 bool CFX_Edit_Iterator::GetSection(CPVT_Section & section) const |
| 95 { | 95 { |
| 96 ASSERT(m_pEdit != NULL); | 96 ASSERT(m_pEdit != NULL); |
| 97 ASSERT(m_pVTIterator != NULL); | 97 ASSERT(m_pVTIterator != NULL); |
| 98 | 98 |
| 99 if (m_pVTIterator->GetSection(section)) | 99 if (m_pVTIterator->GetSection(section)) |
| 100 { | 100 { |
| 101 section.rcSection = m_pEdit->VTToEdit(section.rcSection); | 101 section.rcSection = m_pEdit->VTToEdit(section.rcSection); |
| 102 » » return TRUE; | 102 » » return true; |
| 103 } | 103 } |
| 104 | 104 |
| 105 » return FALSE; | 105 » return false; |
| 106 } | 106 } |
| 107 | 107 |
| 108 void CFX_Edit_Iterator::SetAt(int32_t nWordIndex) | 108 void CFX_Edit_Iterator::SetAt(int32_t nWordIndex) |
| 109 { | 109 { |
| 110 ASSERT(m_pVTIterator != NULL); | 110 ASSERT(m_pVTIterator != NULL); |
| 111 | 111 |
| 112 m_pVTIterator->SetAt(nWordIndex); | 112 m_pVTIterator->SetAt(nWordIndex); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void CFX_Edit_Iterator::SetAt(const CPVT_WordPlace & place) | 115 void CFX_Edit_Iterator::SetAt(const CPVT_WordPlace & place) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 int32_t CFX_Edit_Provider::GetWordFontIndex(FX_WORD word, int32_t charset, int32
_t nFontIndex) | 184 int32_t CFX_Edit_Provider::GetWordFontIndex(FX_WORD word, int32_t charset, int32
_t nFontIndex) |
| 185 { | 185 { |
| 186 return m_pFontMap->GetWordFontIndex(word,charset,nFontIndex); | 186 return m_pFontMap->GetWordFontIndex(word,charset,nFontIndex); |
| 187 } | 187 } |
| 188 | 188 |
| 189 int32_t CFX_Edit_Provider::GetDefaultFontIndex() | 189 int32_t CFX_Edit_Provider::GetDefaultFontIndex() |
| 190 { | 190 { |
| 191 return 0; | 191 return 0; |
| 192 } | 192 } |
| 193 | 193 |
| 194 FX_BOOL»CFX_Edit_Provider::IsLatinWord(FX_WORD word) | 194 bool» CFX_Edit_Provider::IsLatinWord(FX_WORD word) |
| 195 { | 195 { |
| 196 return FX_EDIT_ISLATINWORD(word); | 196 return FX_EDIT_ISLATINWORD(word); |
| 197 } | 197 } |
| 198 | 198 |
| 199 /* --------------------------------- CFX_Edit_Refresh --------------------------
------- */ | 199 /* --------------------------------- CFX_Edit_Refresh --------------------------
------- */ |
| 200 | 200 |
| 201 CFX_Edit_Refresh::CFX_Edit_Refresh() | 201 CFX_Edit_Refresh::CFX_Edit_Refresh() |
| 202 { | 202 { |
| 203 } | 203 } |
| 204 | 204 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 227 | 227 |
| 228 { | 228 { |
| 229 for (int32_t i = 0, sz = m_NewLineRects.GetSize(); i < sz; i++) | 229 for (int32_t i = 0, sz = m_NewLineRects.GetSize(); i < sz; i++) |
| 230 if (CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(
i)) | 230 if (CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(
i)) |
| 231 m_RefreshRects.Add(pNewRect->m_rcLine); | 231 m_RefreshRects.Add(pNewRect->m_rcLine); |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 | 234 |
| 235 void CFX_Edit_Refresh::Analyse(int32_t nAlignment) | 235 void CFX_Edit_Refresh::Analyse(int32_t nAlignment) |
| 236 { | 236 { |
| 237 » FX_BOOL bLineTopChanged = FALSE; | 237 » bool bLineTopChanged = false; |
| 238 CPDF_Rect rcResult; | 238 CPDF_Rect rcResult; |
| 239 FX_FLOAT fWidthDiff; | 239 FX_FLOAT fWidthDiff; |
| 240 | 240 |
| 241 int32_t szMax = FX_EDIT_MAX(m_OldLineRects.GetSize(),m_NewLineRects.GetS
ize()); | 241 int32_t szMax = FX_EDIT_MAX(m_OldLineRects.GetSize(),m_NewLineRects.GetS
ize()); |
| 242 int32_t i = 0; | 242 int32_t i = 0; |
| 243 | 243 |
| 244 while (i < szMax) | 244 while (i < szMax) |
| 245 { | 245 { |
| 246 CFX_Edit_LineRect * pOldRect = m_OldLineRects.GetAt(i); | 246 CFX_Edit_LineRect * pOldRect = m_OldLineRects.GetAt(i); |
| 247 CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(i); | 247 CFX_Edit_LineRect * pNewRect = m_NewLineRects.GetAt(i); |
| 248 | 248 |
| 249 if (pOldRect) | 249 if (pOldRect) |
| 250 { | 250 { |
| 251 if (pNewRect) | 251 if (pNewRect) |
| 252 { | 252 { |
| 253 if (bLineTopChanged) | 253 if (bLineTopChanged) |
| 254 { | 254 { |
| 255 rcResult = pOldRect->m_rcLine; | 255 rcResult = pOldRect->m_rcLine; |
| 256 rcResult.Union(pNewRect->m_rcLine); | 256 rcResult.Union(pNewRect->m_rcLine); |
| 257 m_RefreshRects.Add(rcResult); | 257 m_RefreshRects.Add(rcResult); |
| 258 } | 258 } |
| 259 else | 259 else |
| 260 { | 260 { |
| 261 if (*pNewRect != *pOldRect) | 261 if (*pNewRect != *pOldRect) |
| 262 { | 262 { |
| 263 if (!pNewRect->IsSameTop(*pOldRe
ct) || !pNewRect->IsSameHeight(*pOldRect)) | 263 if (!pNewRect->IsSameTop(*pOldRe
ct) || !pNewRect->IsSameHeight(*pOldRect)) |
| 264 { | 264 { |
| 265 » » » » » » » bLineTopChanged = TRUE; | 265 » » » » » » » bLineTopChanged = true; |
| 266 continue; | 266 continue; |
| 267 } | 267 } |
| 268 | 268 |
| 269 if (nAlignment == 0) | 269 if (nAlignment == 0) |
| 270 { | 270 { |
| 271 if (pNewRect->m_wrLine.B
eginPos != pOldRect->m_wrLine.BeginPos) | 271 if (pNewRect->m_wrLine.B
eginPos != pOldRect->m_wrLine.BeginPos) |
| 272 { | 272 { |
| 273 rcResult = pOldR
ect->m_rcLine; | 273 rcResult = pOldR
ect->m_rcLine; |
| 274 rcResult.Union(p
NewRect->m_rcLine); | 274 rcResult.Union(p
NewRect->m_rcLine); |
| 275 m_RefreshRects.A
dd(rcResult); | 275 m_RefreshRects.A
dd(rcResult); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 | 341 |
| 342 void CFX_Edit_Refresh::EndRefresh() | 342 void CFX_Edit_Refresh::EndRefresh() |
| 343 { | 343 { |
| 344 m_RefreshRects.Empty(); | 344 m_RefreshRects.Empty(); |
| 345 } | 345 } |
| 346 | 346 |
| 347 /* ------------------------------------- CFX_Edit_Undo -------------------------
------------ */ | 347 /* ------------------------------------- CFX_Edit_Undo -------------------------
------------ */ |
| 348 | 348 |
| 349 CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize) : m_nCurUndoPos(0), | 349 CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize) : m_nCurUndoPos(0), |
| 350 m_nBufSize(nBufsize), | 350 m_nBufSize(nBufsize), |
| 351 » m_bModified(FALSE), | 351 » m_bModified(false), |
| 352 » m_bVirgin(TRUE), | 352 » m_bVirgin(true), |
| 353 » m_bWorking(FALSE) | 353 » m_bWorking(false) |
| 354 { | 354 { |
| 355 } | 355 } |
| 356 | 356 |
| 357 CFX_Edit_Undo::~CFX_Edit_Undo() | 357 CFX_Edit_Undo::~CFX_Edit_Undo() |
| 358 { | 358 { |
| 359 Reset(); | 359 Reset(); |
| 360 } | 360 } |
| 361 | 361 |
| 362 FX_BOOL CFX_Edit_Undo::CanUndo() const | 362 bool CFX_Edit_Undo::CanUndo() const |
| 363 { | 363 { |
| 364 return m_nCurUndoPos > 0; | 364 return m_nCurUndoPos > 0; |
| 365 } | 365 } |
| 366 | 366 |
| 367 void CFX_Edit_Undo::Undo() | 367 void CFX_Edit_Undo::Undo() |
| 368 { | 368 { |
| 369 » m_bWorking = TRUE; | 369 » m_bWorking = true; |
| 370 | 370 |
| 371 if (m_nCurUndoPos > 0) | 371 if (m_nCurUndoPos > 0) |
| 372 { | 372 { |
| 373 IFX_Edit_UndoItem * pItem = m_UndoItemStack.GetAt(m_nCurUndoPos-
1); | 373 IFX_Edit_UndoItem * pItem = m_UndoItemStack.GetAt(m_nCurUndoPos-
1); |
| 374 ASSERT(pItem != NULL); | 374 ASSERT(pItem != NULL); |
| 375 | 375 |
| 376 pItem->Undo(); | 376 pItem->Undo(); |
| 377 | 377 |
| 378 m_nCurUndoPos--; | 378 m_nCurUndoPos--; |
| 379 m_bModified = (m_nCurUndoPos != 0); | 379 m_bModified = (m_nCurUndoPos != 0); |
| 380 } | 380 } |
| 381 | 381 |
| 382 » m_bWorking = FALSE; | 382 » m_bWorking = false; |
| 383 } | 383 } |
| 384 | 384 |
| 385 FX_BOOL»CFX_Edit_Undo::CanRedo() const | 385 bool» CFX_Edit_Undo::CanRedo() const |
| 386 { | 386 { |
| 387 return m_nCurUndoPos < m_UndoItemStack.GetSize(); | 387 return m_nCurUndoPos < m_UndoItemStack.GetSize(); |
| 388 } | 388 } |
| 389 | 389 |
| 390 void CFX_Edit_Undo::Redo() | 390 void CFX_Edit_Undo::Redo() |
| 391 { | 391 { |
| 392 » m_bWorking = TRUE; | 392 » m_bWorking = true; |
| 393 | 393 |
| 394 int32_t nStackSize = m_UndoItemStack.GetSize(); | 394 int32_t nStackSize = m_UndoItemStack.GetSize(); |
| 395 | 395 |
| 396 if (m_nCurUndoPos < nStackSize) | 396 if (m_nCurUndoPos < nStackSize) |
| 397 { | 397 { |
| 398 IFX_Edit_UndoItem * pItem = m_UndoItemStack.GetAt(m_nCurUndoPos)
; | 398 IFX_Edit_UndoItem * pItem = m_UndoItemStack.GetAt(m_nCurUndoPos)
; |
| 399 ASSERT(pItem != NULL); | 399 ASSERT(pItem != NULL); |
| 400 | 400 |
| 401 pItem->Redo(); | 401 pItem->Redo(); |
| 402 | 402 |
| 403 m_nCurUndoPos++; | 403 m_nCurUndoPos++; |
| 404 m_bModified = (m_nCurUndoPos != 0); | 404 m_bModified = (m_nCurUndoPos != 0); |
| 405 } | 405 } |
| 406 | 406 |
| 407 » m_bWorking = FALSE; | 407 » m_bWorking = false; |
| 408 } | 408 } |
| 409 | 409 |
| 410 FX_BOOL»CFX_Edit_Undo::IsWorking() const | 410 bool» CFX_Edit_Undo::IsWorking() const |
| 411 { | 411 { |
| 412 return m_bWorking; | 412 return m_bWorking; |
| 413 } | 413 } |
| 414 | 414 |
| 415 void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) | 415 void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) |
| 416 { | 416 { |
| 417 ASSERT(!m_bWorking); | 417 ASSERT(!m_bWorking); |
| 418 ASSERT(pItem != NULL); | 418 ASSERT(pItem != NULL); |
| 419 ASSERT(m_nBufSize > 1); | 419 ASSERT(m_nBufSize > 1); |
| 420 | 420 |
| 421 if (m_nCurUndoPos < m_UndoItemStack.GetSize()) | 421 if (m_nCurUndoPos < m_UndoItemStack.GetSize()) |
| 422 RemoveTails(); | 422 RemoveTails(); |
| 423 | 423 |
| 424 if (m_UndoItemStack.GetSize() >= m_nBufSize) | 424 if (m_UndoItemStack.GetSize() >= m_nBufSize) |
| 425 { | 425 { |
| 426 RemoveHeads(); | 426 RemoveHeads(); |
| 427 » » m_bVirgin = FALSE; | 427 » » m_bVirgin = false; |
| 428 } | 428 } |
| 429 | 429 |
| 430 m_UndoItemStack.Add(pItem); | 430 m_UndoItemStack.Add(pItem); |
| 431 m_nCurUndoPos = m_UndoItemStack.GetSize(); | 431 m_nCurUndoPos = m_UndoItemStack.GetSize(); |
| 432 | 432 |
| 433 m_bModified = (m_nCurUndoPos != 0); | 433 m_bModified = (m_nCurUndoPos != 0); |
| 434 } | 434 } |
| 435 | 435 |
| 436 FX_BOOL»CFX_Edit_Undo::IsModified() const | 436 bool» CFX_Edit_Undo::IsModified() const |
| 437 { | 437 { |
| 438 if (m_bVirgin) | 438 if (m_bVirgin) |
| 439 return m_bModified; | 439 return m_bModified; |
| 440 else | 440 else |
| 441 » » return TRUE; | 441 » » return true; |
| 442 } | 442 } |
| 443 | 443 |
| 444 IFX_Edit_UndoItem* CFX_Edit_Undo::GetItem(int32_t nIndex) | 444 IFX_Edit_UndoItem* CFX_Edit_Undo::GetItem(int32_t nIndex) |
| 445 { | 445 { |
| 446 if (nIndex>=0 && nIndex < m_UndoItemStack.GetSize()) | 446 if (nIndex>=0 && nIndex < m_UndoItemStack.GetSize()) |
| 447 return m_UndoItemStack.GetAt(nIndex); | 447 return m_UndoItemStack.GetAt(nIndex); |
| 448 | 448 |
| 449 return NULL; | 449 return NULL; |
| 450 } | 450 } |
| 451 | 451 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 delete m_Items[i]; | 489 delete m_Items[i]; |
| 490 } | 490 } |
| 491 | 491 |
| 492 m_Items.RemoveAll(); | 492 m_Items.RemoveAll(); |
| 493 } | 493 } |
| 494 | 494 |
| 495 void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem) | 495 void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem) |
| 496 { | 496 { |
| 497 ASSERT(pUndoItem != NULL); | 497 ASSERT(pUndoItem != NULL); |
| 498 | 498 |
| 499 » pUndoItem->SetFirst(FALSE); | 499 » pUndoItem->SetFirst(false); |
| 500 » pUndoItem->SetLast(FALSE); | 500 » pUndoItem->SetLast(false); |
| 501 | 501 |
| 502 m_Items.Add(pUndoItem); | 502 m_Items.Add(pUndoItem); |
| 503 | 503 |
| 504 if (m_sTitle.IsEmpty()) | 504 if (m_sTitle.IsEmpty()) |
| 505 m_sTitle = pUndoItem->GetUndoTitle(); | 505 m_sTitle = pUndoItem->GetUndoTitle(); |
| 506 } | 506 } |
| 507 | 507 |
| 508 void CFX_Edit_GroupUndoItem::UpdateItems() | 508 void CFX_Edit_GroupUndoItem::UpdateItems() |
| 509 { | 509 { |
| 510 if (m_Items.GetSize() > 0) | 510 if (m_Items.GetSize() > 0) |
| 511 { | 511 { |
| 512 CFX_Edit_UndoItem* pFirstItem = m_Items[0]; | 512 CFX_Edit_UndoItem* pFirstItem = m_Items[0]; |
| 513 ASSERT(pFirstItem != NULL); | 513 ASSERT(pFirstItem != NULL); |
| 514 » » pFirstItem->SetFirst(TRUE); | 514 » » pFirstItem->SetFirst(true); |
| 515 | 515 |
| 516 CFX_Edit_UndoItem* pLastItem = m_Items[m_Items.GetSize() - 1]; | 516 CFX_Edit_UndoItem* pLastItem = m_Items[m_Items.GetSize() - 1]; |
| 517 ASSERT(pLastItem != NULL); | 517 ASSERT(pLastItem != NULL); |
| 518 » » pLastItem->SetLast(TRUE); | 518 » » pLastItem->SetLast(true); |
| 519 } | 519 } |
| 520 } | 520 } |
| 521 | 521 |
| 522 void CFX_Edit_GroupUndoItem::Undo() | 522 void CFX_Edit_GroupUndoItem::Undo() |
| 523 { | 523 { |
| 524 for (int i=m_Items.GetSize()-1; i>=0; i--) | 524 for (int i=m_Items.GetSize()-1; i>=0; i--) |
| 525 { | 525 { |
| 526 CFX_Edit_UndoItem* pUndoItem = m_Items[i]; | 526 CFX_Edit_UndoItem* pUndoItem = m_Items[i]; |
| 527 ASSERT(pUndoItem != NULL); | 527 ASSERT(pUndoItem != NULL); |
| 528 | 528 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 559 CFXEU_InsertWord::~CFXEU_InsertWord() | 559 CFXEU_InsertWord::~CFXEU_InsertWord() |
| 560 { | 560 { |
| 561 } | 561 } |
| 562 | 562 |
| 563 void CFXEU_InsertWord::Redo() | 563 void CFXEU_InsertWord::Redo() |
| 564 { | 564 { |
| 565 if (m_pEdit) | 565 if (m_pEdit) |
| 566 { | 566 { |
| 567 m_pEdit->SelectNone(); | 567 m_pEdit->SelectNone(); |
| 568 m_pEdit->SetCaret(m_wpOld); | 568 m_pEdit->SetCaret(m_wpOld); |
| 569 » » m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE,TRUE); | 569 » » m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,false,true); |
| 570 } | 570 } |
| 571 } | 571 } |
| 572 | 572 |
| 573 void CFXEU_InsertWord::Undo() | 573 void CFXEU_InsertWord::Undo() |
| 574 { | 574 { |
| 575 if (m_pEdit) | 575 if (m_pEdit) |
| 576 { | 576 { |
| 577 m_pEdit->SelectNone(); | 577 m_pEdit->SelectNone(); |
| 578 m_pEdit->SetCaret(m_wpNew); | 578 m_pEdit->SetCaret(m_wpNew); |
| 579 » » m_pEdit->Backspace(FALSE,TRUE); | 579 » » m_pEdit->Backspace(false,true); |
| 580 } | 580 } |
| 581 } | 581 } |
| 582 | 582 |
| 583 /* -------------------------------------------------------------------------- */ | 583 /* -------------------------------------------------------------------------- */ |
| 584 | 584 |
| 585 CFXEU_InsertReturn::CFXEU_InsertReturn(CFX_Edit * pEdit, const CPVT_WordPlace &
wpOldPlace, const CPVT_WordPlace & wpNewPlace, | 585 CFXEU_InsertReturn::CFXEU_InsertReturn(CFX_Edit * pEdit, const CPVT_WordPlace &
wpOldPlace, const CPVT_WordPlace & wpNewPlace, |
| 586 const CPVT_SecProps * pSecProps, const CPVT_WordProps *
pWordProps) : | 586 const CPVT_SecProps * pSecProps, const CPVT_WordProps *
pWordProps) : |
| 587 m_pEdit(pEdit), | 587 m_pEdit(pEdit), |
| 588 m_wpOld(wpOldPlace), | 588 m_wpOld(wpOldPlace), |
| 589 m_wpNew(wpNewPlace), | 589 m_wpNew(wpNewPlace), |
| 590 m_SecProps(), | 590 m_SecProps(), |
| 591 m_WordProps() | 591 m_WordProps() |
| 592 { | 592 { |
| 593 if (pSecProps) | 593 if (pSecProps) |
| 594 m_SecProps = *pSecProps; | 594 m_SecProps = *pSecProps; |
| 595 if (pWordProps) | 595 if (pWordProps) |
| 596 m_WordProps = *pWordProps; | 596 m_WordProps = *pWordProps; |
| 597 } | 597 } |
| 598 | 598 |
| 599 CFXEU_InsertReturn::~CFXEU_InsertReturn() | 599 CFXEU_InsertReturn::~CFXEU_InsertReturn() |
| 600 { | 600 { |
| 601 } | 601 } |
| 602 | 602 |
| 603 void CFXEU_InsertReturn::Redo() | 603 void CFXEU_InsertReturn::Redo() |
| 604 { | 604 { |
| 605 if (m_pEdit) | 605 if (m_pEdit) |
| 606 { | 606 { |
| 607 m_pEdit->SelectNone(); | 607 m_pEdit->SelectNone(); |
| 608 m_pEdit->SetCaret(m_wpOld); | 608 m_pEdit->SetCaret(m_wpOld); |
| 609 » » m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,TRUE); | 609 » » m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,false,true); |
| 610 } | 610 } |
| 611 } | 611 } |
| 612 | 612 |
| 613 void CFXEU_InsertReturn::Undo() | 613 void CFXEU_InsertReturn::Undo() |
| 614 { | 614 { |
| 615 if (m_pEdit) | 615 if (m_pEdit) |
| 616 { | 616 { |
| 617 m_pEdit->SelectNone(); | 617 m_pEdit->SelectNone(); |
| 618 m_pEdit->SetCaret(m_wpNew); | 618 m_pEdit->SetCaret(m_wpNew); |
| 619 » » m_pEdit->Backspace(FALSE,TRUE); | 619 » » m_pEdit->Backspace(false,true); |
| 620 } | 620 } |
| 621 } | 621 } |
| 622 | 622 |
| 623 /* -------------------------------------------------------------------------- */ | 623 /* -------------------------------------------------------------------------- */ |
| 624 //CFXEU_Backspace | 624 //CFXEU_Backspace |
| 625 | 625 |
| 626 CFXEU_Backspace::CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP
lace, const CPVT_WordPlace & wpNewPlace, | 626 CFXEU_Backspace::CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP
lace, const CPVT_WordPlace & wpNewPlace, |
| 627 FX_WORD word, int32_t
charset, | 627 FX_WORD word, int32_t
charset, |
| 628 const CPVT_SecProps &
SecProps, const CPVT_WordProps & WordProps) : | 628 const CPVT_SecProps &
SecProps, const CPVT_WordProps & WordProps) : |
| 629 m_pEdit(pEdit), | 629 m_pEdit(pEdit), |
| 630 m_wpOld(wpOldPlace), | 630 m_wpOld(wpOldPlace), |
| 631 m_wpNew(wpNewPlace), | 631 m_wpNew(wpNewPlace), |
| 632 m_Word(word), | 632 m_Word(word), |
| 633 m_nCharset(charset), | 633 m_nCharset(charset), |
| 634 m_SecProps(SecProps), | 634 m_SecProps(SecProps), |
| 635 m_WordProps(WordProps) | 635 m_WordProps(WordProps) |
| 636 { | 636 { |
| 637 } | 637 } |
| 638 | 638 |
| 639 CFXEU_Backspace::~CFXEU_Backspace() | 639 CFXEU_Backspace::~CFXEU_Backspace() |
| 640 { | 640 { |
| 641 } | 641 } |
| 642 | 642 |
| 643 void CFXEU_Backspace::Redo() | 643 void CFXEU_Backspace::Redo() |
| 644 { | 644 { |
| 645 if (m_pEdit) | 645 if (m_pEdit) |
| 646 { | 646 { |
| 647 m_pEdit->SelectNone(); | 647 m_pEdit->SelectNone(); |
| 648 m_pEdit->SetCaret(m_wpOld); | 648 m_pEdit->SetCaret(m_wpOld); |
| 649 » » m_pEdit->Backspace(FALSE,TRUE); | 649 » » m_pEdit->Backspace(false,true); |
| 650 } | 650 } |
| 651 } | 651 } |
| 652 | 652 |
| 653 void CFXEU_Backspace::Undo() | 653 void CFXEU_Backspace::Undo() |
| 654 { | 654 { |
| 655 if (m_pEdit) | 655 if (m_pEdit) |
| 656 { | 656 { |
| 657 m_pEdit->SelectNone(); | 657 m_pEdit->SelectNone(); |
| 658 m_pEdit->SetCaret(m_wpNew); | 658 m_pEdit->SetCaret(m_wpNew); |
| 659 if (m_wpNew.SecCmp(m_wpOld) != 0) | 659 if (m_wpNew.SecCmp(m_wpOld) != 0) |
| 660 { | 660 { |
| 661 » » » m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,TRU
E); | 661 » » » m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,false,tru
e); |
| 662 } | 662 } |
| 663 else | 663 else |
| 664 { | 664 { |
| 665 » » » m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE
,TRUE); | 665 » » » m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,false
,true); |
| 666 } | 666 } |
| 667 } | 667 } |
| 668 } | 668 } |
| 669 | 669 |
| 670 /* -------------------------------------------------------------------------- */ | 670 /* -------------------------------------------------------------------------- */ |
| 671 //CFXEU_Delete | 671 //CFXEU_Delete |
| 672 | 672 |
| 673 CFXEU_Delete::CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace,
const CPVT_WordPlace & wpNewPlace, | 673 CFXEU_Delete::CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace,
const CPVT_WordPlace & wpNewPlace, |
| 674 FX_WORD word, int32_t
charset, | 674 FX_WORD word, int32_t
charset, |
| 675 » » » » » » » const CPVT_SecProps &
SecProps, const CPVT_WordProps & WordProps, FX_BOOL bSecEnd) : | 675 » » » » » » » const CPVT_SecProps &
SecProps, const CPVT_WordProps & WordProps, bool bSecEnd) : |
| 676 m_pEdit(pEdit), | 676 m_pEdit(pEdit), |
| 677 m_wpOld(wpOldPlace), | 677 m_wpOld(wpOldPlace), |
| 678 m_wpNew(wpNewPlace), | 678 m_wpNew(wpNewPlace), |
| 679 m_Word(word), | 679 m_Word(word), |
| 680 m_nCharset(charset), | 680 m_nCharset(charset), |
| 681 m_SecProps(SecProps), | 681 m_SecProps(SecProps), |
| 682 m_WordProps(WordProps), | 682 m_WordProps(WordProps), |
| 683 m_bSecEnd(bSecEnd) | 683 m_bSecEnd(bSecEnd) |
| 684 { | 684 { |
| 685 } | 685 } |
| 686 | 686 |
| 687 CFXEU_Delete::~CFXEU_Delete() | 687 CFXEU_Delete::~CFXEU_Delete() |
| 688 { | 688 { |
| 689 } | 689 } |
| 690 | 690 |
| 691 void CFXEU_Delete::Redo() | 691 void CFXEU_Delete::Redo() |
| 692 { | 692 { |
| 693 if (m_pEdit) | 693 if (m_pEdit) |
| 694 { | 694 { |
| 695 m_pEdit->SelectNone(); | 695 m_pEdit->SelectNone(); |
| 696 m_pEdit->SetCaret(m_wpOld); | 696 m_pEdit->SetCaret(m_wpOld); |
| 697 » » m_pEdit->Delete(FALSE,TRUE); | 697 » » m_pEdit->Delete(false,true); |
| 698 } | 698 } |
| 699 } | 699 } |
| 700 | 700 |
| 701 void CFXEU_Delete::Undo() | 701 void CFXEU_Delete::Undo() |
| 702 { | 702 { |
| 703 if (m_pEdit) | 703 if (m_pEdit) |
| 704 { | 704 { |
| 705 m_pEdit->SelectNone(); | 705 m_pEdit->SelectNone(); |
| 706 m_pEdit->SetCaret(m_wpNew); | 706 m_pEdit->SetCaret(m_wpNew); |
| 707 if (m_bSecEnd) | 707 if (m_bSecEnd) |
| 708 { | 708 { |
| 709 » » » m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,TRU
E); | 709 » » » m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,false,tru
e); |
| 710 } | 710 } |
| 711 else | 711 else |
| 712 { | 712 { |
| 713 » » » m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE
,TRUE); | 713 » » » m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,false
,true); |
| 714 } | 714 } |
| 715 } | 715 } |
| 716 } | 716 } |
| 717 | 717 |
| 718 /* -------------------------------------------------------------------------- */ | 718 /* -------------------------------------------------------------------------- */ |
| 719 //CFXEU_Clear | 719 //CFXEU_Clear |
| 720 | 720 |
| 721 CFXEU_Clear::CFXEU_Clear(CFX_Edit * pEdit, const CPVT_WordRange & wrSel, const
CFX_WideString & swText) : | 721 CFXEU_Clear::CFXEU_Clear(CFX_Edit * pEdit, const CPVT_WordRange & wrSel, const
CFX_WideString & swText) : |
| 722 m_pEdit(pEdit), | 722 m_pEdit(pEdit), |
| 723 m_wrSel(wrSel), | 723 m_wrSel(wrSel), |
| 724 m_swText(swText) | 724 m_swText(swText) |
| 725 { | 725 { |
| 726 } | 726 } |
| 727 | 727 |
| 728 CFXEU_Clear::~CFXEU_Clear() | 728 CFXEU_Clear::~CFXEU_Clear() |
| 729 { | 729 { |
| 730 } | 730 } |
| 731 | 731 |
| 732 void CFXEU_Clear::Redo() | 732 void CFXEU_Clear::Redo() |
| 733 { | 733 { |
| 734 if (m_pEdit) | 734 if (m_pEdit) |
| 735 { | 735 { |
| 736 m_pEdit->SelectNone(); | 736 m_pEdit->SelectNone(); |
| 737 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); | 737 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); |
| 738 » » m_pEdit->Clear(FALSE,TRUE); | 738 » » m_pEdit->Clear(false,true); |
| 739 } | 739 } |
| 740 } | 740 } |
| 741 | 741 |
| 742 void CFXEU_Clear::Undo() | 742 void CFXEU_Clear::Undo() |
| 743 { | 743 { |
| 744 if (m_pEdit) | 744 if (m_pEdit) |
| 745 { | 745 { |
| 746 m_pEdit->SelectNone(); | 746 m_pEdit->SelectNone(); |
| 747 m_pEdit->SetCaret(m_wrSel.BeginPos); | 747 m_pEdit->SetCaret(m_wrSel.BeginPos); |
| 748 » » m_pEdit->InsertText(m_swText.c_str(), DEFAULT_CHARSET, NULL, NUL
L, FALSE, TRUE); | 748 » » m_pEdit->InsertText(m_swText.c_str(), DEFAULT_CHARSET, NULL, NUL
L, false, true); |
| 749 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); | 749 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); |
| 750 } | 750 } |
| 751 } | 751 } |
| 752 | 752 |
| 753 /* -------------------------------------------------------------------------- */ | 753 /* -------------------------------------------------------------------------- */ |
| 754 //CFXEU_ClearRich | 754 //CFXEU_ClearRich |
| 755 | 755 |
| 756 CFXEU_ClearRich::CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP
lace, const CPVT_WordPlace & wpNewPlace, | 756 CFXEU_ClearRich::CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP
lace, const CPVT_WordPlace & wpNewPlace, |
| 757 const CPVT_WordRange
& wrSel, FX_WORD word, int32_t charset, | 757 const CPVT_WordRange
& wrSel, FX_WORD word, int32_t charset, |
| 758 const CPVT_SecProps &
SecProps, const CPVT_WordProps & WordProps) : | 758 const CPVT_SecProps &
SecProps, const CPVT_WordProps & WordProps) : |
| (...skipping 11 matching lines...) Expand all Loading... |
| 770 CFXEU_ClearRich::~CFXEU_ClearRich() | 770 CFXEU_ClearRich::~CFXEU_ClearRich() |
| 771 { | 771 { |
| 772 } | 772 } |
| 773 | 773 |
| 774 void CFXEU_ClearRich::Redo() | 774 void CFXEU_ClearRich::Redo() |
| 775 { | 775 { |
| 776 if (m_pEdit && IsLast()) | 776 if (m_pEdit && IsLast()) |
| 777 { | 777 { |
| 778 m_pEdit->SelectNone(); | 778 m_pEdit->SelectNone(); |
| 779 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); | 779 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); |
| 780 » » m_pEdit->Clear(FALSE,TRUE); | 780 » » m_pEdit->Clear(false,true); |
| 781 } | 781 } |
| 782 } | 782 } |
| 783 | 783 |
| 784 void CFXEU_ClearRich::Undo() | 784 void CFXEU_ClearRich::Undo() |
| 785 { | 785 { |
| 786 if (m_pEdit) | 786 if (m_pEdit) |
| 787 { | 787 { |
| 788 m_pEdit->SelectNone(); | 788 m_pEdit->SelectNone(); |
| 789 m_pEdit->SetCaret(m_wpOld); | 789 m_pEdit->SetCaret(m_wpOld); |
| 790 if (m_wpNew.SecCmp(m_wpOld) != 0) | 790 if (m_wpNew.SecCmp(m_wpOld) != 0) |
| 791 { | 791 { |
| 792 » » » m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,FALSE,FAL
SE); | 792 » » » m_pEdit->InsertReturn(&m_SecProps,&m_WordProps,false,fal
se); |
| 793 } | 793 } |
| 794 else | 794 else |
| 795 { | 795 { |
| 796 » » » m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE
,FALSE); | 796 » » » m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,false
,false); |
| 797 } | 797 } |
| 798 | 798 |
| 799 if (IsFirst()) | 799 if (IsFirst()) |
| 800 { | 800 { |
| 801 m_pEdit->PaintInsertText(m_wrSel.BeginPos,m_wrSel.EndPos
); | 801 m_pEdit->PaintInsertText(m_wrSel.BeginPos,m_wrSel.EndPos
); |
| 802 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); | 802 m_pEdit->SetSel(m_wrSel.BeginPos,m_wrSel.EndPos); |
| 803 } | 803 } |
| 804 } | 804 } |
| 805 } | 805 } |
| 806 /* -------------------------------------------------------------------------- */ | 806 /* -------------------------------------------------------------------------- */ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 826 CFXEU_InsertText::~CFXEU_InsertText() | 826 CFXEU_InsertText::~CFXEU_InsertText() |
| 827 { | 827 { |
| 828 } | 828 } |
| 829 | 829 |
| 830 void CFXEU_InsertText::Redo() | 830 void CFXEU_InsertText::Redo() |
| 831 { | 831 { |
| 832 if (m_pEdit && IsLast()) | 832 if (m_pEdit && IsLast()) |
| 833 { | 833 { |
| 834 m_pEdit->SelectNone(); | 834 m_pEdit->SelectNone(); |
| 835 m_pEdit->SetCaret(m_wpOld); | 835 m_pEdit->SetCaret(m_wpOld); |
| 836 » » m_pEdit->InsertText(m_swText.c_str(), m_nCharset, &m_SecProps, &
m_WordProps, FALSE, TRUE); | 836 » » m_pEdit->InsertText(m_swText.c_str(), m_nCharset, &m_SecProps, &
m_WordProps, false, true); |
| 837 } | 837 } |
| 838 } | 838 } |
| 839 | 839 |
| 840 void CFXEU_InsertText::Undo() | 840 void CFXEU_InsertText::Undo() |
| 841 { | 841 { |
| 842 if (m_pEdit) | 842 if (m_pEdit) |
| 843 { | 843 { |
| 844 m_pEdit->SelectNone(); | 844 m_pEdit->SelectNone(); |
| 845 m_pEdit->SetSel(m_wpOld,m_wpNew); | 845 m_pEdit->SetSel(m_wpOld,m_wpNew); |
| 846 » » m_pEdit->Clear(FALSE,TRUE); | 846 » » m_pEdit->Clear(false,true); |
| 847 } | 847 } |
| 848 } | 848 } |
| 849 | 849 |
| 850 /* -------------------------------------------------------------------------- */ | 850 /* -------------------------------------------------------------------------- */ |
| 851 | 851 |
| 852 CFXEU_SetSecProps::CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & pl
ace, EDIT_PROPS_E ep, | 852 CFXEU_SetSecProps::CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & pl
ace, EDIT_PROPS_E ep, |
| 853 const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwor
dprops, | 853 const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwor
dprops, |
| 854 const CPVT_SecProps & newsecprops, const CPVT_WordProps & newwor
dprops, const CPVT_WordRange & range) | 854 const CPVT_SecProps & newsecprops, const CPVT_WordProps & newwor
dprops, const CPVT_WordRange & range) |
| 855 : m_pEdit(pEdit), | 855 : m_pEdit(pEdit), |
| 856 m_wpPlace(place), | 856 m_wpPlace(place), |
| 857 m_wrPlace(range), | 857 m_wrPlace(range), |
| 858 m_eProps(ep), | 858 m_eProps(ep), |
| 859 m_OldSecProps(oldsecprops), | 859 m_OldSecProps(oldsecprops), |
| 860 m_NewSecProps(newsecprops), | 860 m_NewSecProps(newsecprops), |
| 861 m_OldWordProps(oldwordprops), | 861 m_OldWordProps(oldwordprops), |
| 862 m_NewWordProps(newwordprops) | 862 m_NewWordProps(newwordprops) |
| 863 { | 863 { |
| 864 } | 864 } |
| 865 | 865 |
| 866 CFXEU_SetSecProps::~CFXEU_SetSecProps() | 866 CFXEU_SetSecProps::~CFXEU_SetSecProps() |
| 867 { | 867 { |
| 868 } | 868 } |
| 869 | 869 |
| 870 void CFXEU_SetSecProps::Redo() | 870 void CFXEU_SetSecProps::Redo() |
| 871 { | 871 { |
| 872 if (m_pEdit) | 872 if (m_pEdit) |
| 873 { | 873 { |
| 874 » » m_pEdit->SetSecProps(m_eProps,m_wpPlace,&m_NewSecProps,&m_NewWor
dProps,m_wrPlace,FALSE); | 874 » » m_pEdit->SetSecProps(m_eProps,m_wpPlace,&m_NewSecProps,&m_NewWor
dProps,m_wrPlace,false); |
| 875 if (IsLast()) | 875 if (IsLast()) |
| 876 { | 876 { |
| 877 m_pEdit->SelectNone(); | 877 m_pEdit->SelectNone(); |
| 878 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); | 878 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); |
| 879 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); | 879 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); |
| 880 } | 880 } |
| 881 } | 881 } |
| 882 } | 882 } |
| 883 | 883 |
| 884 void CFXEU_SetSecProps::Undo() | 884 void CFXEU_SetSecProps::Undo() |
| 885 { | 885 { |
| 886 if (m_pEdit) | 886 if (m_pEdit) |
| 887 { | 887 { |
| 888 » » m_pEdit->SetSecProps(m_eProps,m_wpPlace,&m_OldSecProps,&m_OldWor
dProps,m_wrPlace,FALSE); | 888 » » m_pEdit->SetSecProps(m_eProps,m_wpPlace,&m_OldSecProps,&m_OldWor
dProps,m_wrPlace,false); |
| 889 if (IsFirst()) | 889 if (IsFirst()) |
| 890 { | 890 { |
| 891 m_pEdit->SelectNone(); | 891 m_pEdit->SelectNone(); |
| 892 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); | 892 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); |
| 893 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); | 893 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); |
| 894 } | 894 } |
| 895 } | 895 } |
| 896 } | 896 } |
| 897 | 897 |
| 898 /* -------------------------------------------------------------------------- */ | 898 /* -------------------------------------------------------------------------- */ |
| (...skipping 10 matching lines...) Expand all Loading... |
| 909 } | 909 } |
| 910 | 910 |
| 911 CFXEU_SetWordProps::~CFXEU_SetWordProps() | 911 CFXEU_SetWordProps::~CFXEU_SetWordProps() |
| 912 { | 912 { |
| 913 } | 913 } |
| 914 | 914 |
| 915 void CFXEU_SetWordProps::Redo() | 915 void CFXEU_SetWordProps::Redo() |
| 916 { | 916 { |
| 917 if (m_pEdit) | 917 if (m_pEdit) |
| 918 { | 918 { |
| 919 » » m_pEdit->SetWordProps(m_eProps,m_wpPlace,&m_NewWordProps,m_wrPla
ce,FALSE); | 919 » » m_pEdit->SetWordProps(m_eProps,m_wpPlace,&m_NewWordProps,m_wrPla
ce,false); |
| 920 if (IsLast()) | 920 if (IsLast()) |
| 921 { | 921 { |
| 922 m_pEdit->SelectNone(); | 922 m_pEdit->SelectNone(); |
| 923 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); | 923 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); |
| 924 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); | 924 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); |
| 925 } | 925 } |
| 926 } | 926 } |
| 927 } | 927 } |
| 928 | 928 |
| 929 void CFXEU_SetWordProps::Undo() | 929 void CFXEU_SetWordProps::Undo() |
| 930 { | 930 { |
| 931 if (m_pEdit) | 931 if (m_pEdit) |
| 932 { | 932 { |
| 933 » » m_pEdit->SetWordProps(m_eProps,m_wpPlace,&m_OldWordProps,m_wrPla
ce,FALSE); | 933 » » m_pEdit->SetWordProps(m_eProps,m_wpPlace,&m_OldWordProps,m_wrPla
ce,false); |
| 934 if (IsFirst()) | 934 if (IsFirst()) |
| 935 { | 935 { |
| 936 m_pEdit->SelectNone(); | 936 m_pEdit->SelectNone(); |
| 937 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); | 937 m_pEdit->PaintSetProps(m_eProps,m_wrPlace); |
| 938 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); | 938 m_pEdit->SetSel(m_wrPlace.BeginPos,m_wrPlace.EndPos); |
| 939 } | 939 } |
| 940 } | 940 } |
| 941 } | 941 } |
| 942 | 942 |
| 943 /* ------------------------------------- CFX_Edit ------------------------------
------- */ | 943 /* ------------------------------------- CFX_Edit ------------------------------
------- */ |
| 944 | 944 |
| 945 CFX_Edit::CFX_Edit(IPDF_VariableText * pVT) : | 945 CFX_Edit::CFX_Edit(IPDF_VariableText * pVT) : |
| 946 m_pVT(pVT), | 946 m_pVT(pVT), |
| 947 m_pNotify(NULL), | 947 m_pNotify(NULL), |
| 948 m_pOprNotify(NULL), | 948 m_pOprNotify(NULL), |
| 949 m_pVTProvide(NULL), | 949 m_pVTProvide(NULL), |
| 950 m_wpCaret(-1,-1,-1), | 950 m_wpCaret(-1,-1,-1), |
| 951 m_wpOldCaret(-1,-1,-1), | 951 m_wpOldCaret(-1,-1,-1), |
| 952 m_SelState(), | 952 m_SelState(), |
| 953 m_ptScrollPos(0,0), | 953 m_ptScrollPos(0,0), |
| 954 m_ptRefreshScrollPos(0,0), | 954 m_ptRefreshScrollPos(0,0), |
| 955 » m_bEnableScroll(FALSE), | 955 » m_bEnableScroll(false), |
| 956 m_pIterator(NULL), | 956 m_pIterator(NULL), |
| 957 m_ptCaret(0.0f,0.0f), | 957 m_ptCaret(0.0f,0.0f), |
| 958 m_Undo(FX_EDIT_UNDO_MAXITEM), | 958 m_Undo(FX_EDIT_UNDO_MAXITEM), |
| 959 m_nAlignment(0), | 959 m_nAlignment(0), |
| 960 » m_bNotifyFlag(FALSE), | 960 » m_bNotifyFlag(false), |
| 961 » m_bEnableOverflow(FALSE), | 961 » m_bEnableOverflow(false), |
| 962 » m_bEnableRefresh(TRUE), | 962 » m_bEnableRefresh(true), |
| 963 m_rcOldContent(0.0f,0.0f,0.0f,0.0f), | 963 m_rcOldContent(0.0f,0.0f,0.0f,0.0f), |
| 964 » m_bEnableUndo(TRUE), | 964 » m_bEnableUndo(true), |
| 965 » m_bNotify(TRUE), | 965 » m_bNotify(true), |
| 966 » m_bOprNotify(FALSE), | 966 » m_bOprNotify(false), |
| 967 m_pGroupUndoItem(NULL) | 967 m_pGroupUndoItem(NULL) |
| 968 { | 968 { |
| 969 ASSERT(pVT != NULL); | 969 ASSERT(pVT != NULL); |
| 970 } | 970 } |
| 971 | 971 |
| 972 CFX_Edit::~CFX_Edit() | 972 CFX_Edit::~CFX_Edit() |
| 973 { | 973 { |
| 974 delete m_pVTProvide; | 974 delete m_pVTProvide; |
| 975 m_pVTProvide = NULL; | 975 m_pVTProvide = NULL; |
| 976 delete m_pIterator; | 976 delete m_pIterator; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 } | 1022 } |
| 1023 | 1023 |
| 1024 IFX_Edit_FontMap* CFX_Edit::GetFontMap() | 1024 IFX_Edit_FontMap* CFX_Edit::GetFontMap() |
| 1025 { | 1025 { |
| 1026 if (m_pVTProvide) | 1026 if (m_pVTProvide) |
| 1027 return m_pVTProvide->GetFontMap(); | 1027 return m_pVTProvide->GetFontMap(); |
| 1028 | 1028 |
| 1029 return NULL; | 1029 return NULL; |
| 1030 } | 1030 } |
| 1031 | 1031 |
| 1032 void CFX_Edit::SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint/* = TRUE*/) | 1032 void CFX_Edit::SetPlateRect(const CPDF_Rect & rect, bool bPaint/* = true*/) |
| 1033 { | 1033 { |
| 1034 m_pVT->SetPlateRect(rect); | 1034 m_pVT->SetPlateRect(rect); |
| 1035 m_ptScrollPos = CPDF_Point(rect.left,rect.top); | 1035 m_ptScrollPos = CPDF_Point(rect.left,rect.top); |
| 1036 if (bPaint) Paint(); | 1036 if (bPaint) Paint(); |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 void CFX_Edit::SetAlignmentH(int32_t nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/) | 1039 void CFX_Edit::SetAlignmentH(int32_t nFormat/* =0 */, bool bPaint/* = true*/) |
| 1040 { | 1040 { |
| 1041 m_pVT->SetAlignment(nFormat); | 1041 m_pVT->SetAlignment(nFormat); |
| 1042 if (bPaint) Paint(); | 1042 if (bPaint) Paint(); |
| 1043 } | 1043 } |
| 1044 | 1044 |
| 1045 void CFX_Edit::SetAlignmentV(int32_t nFormat/* =0 */, FX_BOOL bPaint/* = TRUE*/) | 1045 void CFX_Edit::SetAlignmentV(int32_t nFormat/* =0 */, bool bPaint/* = true*/) |
| 1046 { | 1046 { |
| 1047 m_nAlignment = nFormat; | 1047 m_nAlignment = nFormat; |
| 1048 if (bPaint) Paint(); | 1048 if (bPaint) Paint(); |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 void CFX_Edit::SetPasswordChar(FX_WORD wSubWord/* ='*' */, FX_BOOL bPaint/* = TR
UE*/) | 1051 void CFX_Edit::SetPasswordChar(FX_WORD wSubWord/* ='*' */, bool bPaint/* = true*
/) |
| 1052 { | 1052 { |
| 1053 m_pVT->SetPasswordChar(wSubWord); | 1053 m_pVT->SetPasswordChar(wSubWord); |
| 1054 if (bPaint) Paint(); | 1054 if (bPaint) Paint(); |
| 1055 } | 1055 } |
| 1056 | 1056 |
| 1057 void CFX_Edit::SetLimitChar(int32_t nLimitChar/* =0 */, FX_BOOL bPaint/* = TRUE*
/) | 1057 void CFX_Edit::SetLimitChar(int32_t nLimitChar/* =0 */, bool bPaint/* = true*/) |
| 1058 { | 1058 { |
| 1059 m_pVT->SetLimitChar(nLimitChar); | 1059 m_pVT->SetLimitChar(nLimitChar); |
| 1060 if (bPaint) Paint(); | 1060 if (bPaint) Paint(); |
| 1061 } | 1061 } |
| 1062 | 1062 |
| 1063 void CFX_Edit::SetCharArray(int32_t nCharArray/* =0 */, FX_BOOL bPaint/* = TRUE*
/) | 1063 void CFX_Edit::SetCharArray(int32_t nCharArray/* =0 */, bool bPaint/* = true*/) |
| 1064 { | 1064 { |
| 1065 m_pVT->SetCharArray(nCharArray); | 1065 m_pVT->SetCharArray(nCharArray); |
| 1066 if (bPaint) Paint(); | 1066 if (bPaint) Paint(); |
| 1067 } | 1067 } |
| 1068 | 1068 |
| 1069 void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace/* =0.0f */, FX_BOOL bPaint/* = T
RUE*/) | 1069 void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace/* =0.0f */, bool bPaint/* = true
*/) |
| 1070 { | 1070 { |
| 1071 m_pVT->SetCharSpace(fCharSpace); | 1071 m_pVT->SetCharSpace(fCharSpace); |
| 1072 if (bPaint) Paint(); | 1072 if (bPaint) Paint(); |
| 1073 } | 1073 } |
| 1074 | 1074 |
| 1075 void CFX_Edit::SetHorzScale(int32_t nHorzScale/* =100 */, FX_BOOL bPaint/* = TRU
E*/) | 1075 void CFX_Edit::SetHorzScale(int32_t nHorzScale/* =100 */, bool bPaint/* = true*/
) |
| 1076 { | 1076 { |
| 1077 m_pVT->SetHorzScale(nHorzScale); | 1077 m_pVT->SetHorzScale(nHorzScale); |
| 1078 if (bPaint) Paint(); | 1078 if (bPaint) Paint(); |
| 1079 } | 1079 } |
| 1080 | 1080 |
| 1081 void CFX_Edit::SetMultiLine(FX_BOOL bMultiLine/* =TRUE */, FX_BOOL bPaint/* = TR
UE*/) | 1081 void CFX_Edit::SetMultiLine(bool bMultiLine/* =true */, bool bPaint/* = true*/) |
| 1082 { | 1082 { |
| 1083 m_pVT->SetMultiLine(bMultiLine); | 1083 m_pVT->SetMultiLine(bMultiLine); |
| 1084 if (bPaint) Paint(); | 1084 if (bPaint) Paint(); |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 void CFX_Edit::SetAutoReturn(FX_BOOL bAuto/* =TRUE */, FX_BOOL bPaint/* = TRUE*/
) | 1087 void CFX_Edit::SetAutoReturn(bool bAuto/* =true */, bool bPaint/* = true*/) |
| 1088 { | 1088 { |
| 1089 m_pVT->SetAutoReturn(bAuto); | 1089 m_pVT->SetAutoReturn(bAuto); |
| 1090 if (bPaint) Paint(); | 1090 if (bPaint) Paint(); |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 void CFX_Edit::SetLineLeading(FX_FLOAT fLineLeading/* =TRUE */, FX_BOOL bPaint/*
= TRUE*/) | 1093 void CFX_Edit::SetLineLeading(FX_FLOAT fLineLeading/* =true */, bool bPaint/* =
true*/) |
| 1094 { | 1094 { |
| 1095 m_pVT->SetLineLeading(fLineLeading); | 1095 m_pVT->SetLineLeading(fLineLeading); |
| 1096 if (bPaint) Paint(); | 1096 if (bPaint) Paint(); |
| 1097 } | 1097 } |
| 1098 | 1098 |
| 1099 void CFX_Edit::SetAutoFontSize(FX_BOOL bAuto/* =TRUE */, FX_BOOL bPaint/* = TRUE
*/) | 1099 void CFX_Edit::SetAutoFontSize(bool bAuto/* =true */, bool bPaint/* = true*/) |
| 1100 { | 1100 { |
| 1101 m_pVT->SetAutoFontSize(bAuto); | 1101 m_pVT->SetAutoFontSize(bAuto); |
| 1102 if (bPaint) Paint(); | 1102 if (bPaint) Paint(); |
| 1103 } | 1103 } |
| 1104 | 1104 |
| 1105 void CFX_Edit::SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint/* = TRUE*/) | 1105 void CFX_Edit::SetFontSize(FX_FLOAT fFontSize, bool bPaint/* = true*/) |
| 1106 { | 1106 { |
| 1107 m_pVT->SetFontSize(fFontSize); | 1107 m_pVT->SetFontSize(fFontSize); |
| 1108 if (bPaint) Paint(); | 1108 if (bPaint) Paint(); |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 void CFX_Edit::SetAutoScroll(FX_BOOL bAuto/* =TRUE */, FX_BOOL bPaint/* = TRUE*/
) | 1111 void CFX_Edit::SetAutoScroll(bool bAuto/* =true */, bool bPaint/* = true*/) |
| 1112 { | 1112 { |
| 1113 m_bEnableScroll = bAuto; | 1113 m_bEnableScroll = bAuto; |
| 1114 if (bPaint) Paint(); | 1114 if (bPaint) Paint(); |
| 1115 } | 1115 } |
| 1116 | 1116 |
| 1117 void CFX_Edit::SetTextOverflow(FX_BOOL bAllowed /*= FALSE*/, FX_BOOL bPaint/* =
TRUE*/) | 1117 void CFX_Edit::SetTextOverflow(bool bAllowed /*= false*/, bool bPaint/* = true*/
) |
| 1118 { | 1118 { |
| 1119 m_bEnableOverflow = bAllowed; | 1119 m_bEnableOverflow = bAllowed; |
| 1120 if (bPaint) Paint(); | 1120 if (bPaint) Paint(); |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 void CFX_Edit::SetSel(int32_t nStartChar,int32_t nEndChar) | 1123 void CFX_Edit::SetSel(int32_t nStartChar,int32_t nEndChar) |
| 1124 { | 1124 { |
| 1125 if (m_pVT->IsValid()) | 1125 if (m_pVT->IsValid()) |
| 1126 { | 1126 { |
| 1127 if (nStartChar == 0 && nEndChar < 0) | 1127 if (nStartChar == 0 && nEndChar < 0) |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 } | 1213 } |
| 1214 | 1214 |
| 1215 CFX_WideString CFX_Edit::GetText() const | 1215 CFX_WideString CFX_Edit::GetText() const |
| 1216 { | 1216 { |
| 1217 CFX_WideString swRet; | 1217 CFX_WideString swRet; |
| 1218 | 1218 |
| 1219 if (m_pVT->IsValid()) | 1219 if (m_pVT->IsValid()) |
| 1220 { | 1220 { |
| 1221 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 1221 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) |
| 1222 { | 1222 { |
| 1223 » » » FX_BOOL bRich = m_pVT->IsRichText(); | 1223 » » » bool bRich = m_pVT->IsRichText(); |
| 1224 | 1224 |
| 1225 pIterator->SetAt(0); | 1225 pIterator->SetAt(0); |
| 1226 | 1226 |
| 1227 CPVT_Word wordinfo; | 1227 CPVT_Word wordinfo; |
| 1228 CPVT_WordPlace oldplace = pIterator->GetAt(); | 1228 CPVT_WordPlace oldplace = pIterator->GetAt(); |
| 1229 while (pIterator->NextWord()) | 1229 while (pIterator->NextWord()) |
| 1230 { | 1230 { |
| 1231 CPVT_WordPlace place = pIterator->GetAt(); | 1231 CPVT_WordPlace place = pIterator->GetAt(); |
| 1232 | 1232 |
| 1233 if (pIterator->GetWord(wordinfo)) | 1233 if (pIterator->GetWord(wordinfo)) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1255 | 1255 |
| 1256 return swRet; | 1256 return swRet; |
| 1257 } | 1257 } |
| 1258 | 1258 |
| 1259 CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange & range) const | 1259 CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange & range) const |
| 1260 { | 1260 { |
| 1261 CFX_WideString swRet; | 1261 CFX_WideString swRet; |
| 1262 | 1262 |
| 1263 if (m_pVT->IsValid()) | 1263 if (m_pVT->IsValid()) |
| 1264 { | 1264 { |
| 1265 » » FX_BOOL bRich = m_pVT->IsRichText(); | 1265 » » bool bRich = m_pVT->IsRichText(); |
| 1266 | 1266 |
| 1267 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 1267 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) |
| 1268 { | 1268 { |
| 1269 CPVT_WordRange wrTemp = range; | 1269 CPVT_WordRange wrTemp = range; |
| 1270 m_pVT->UpdateWordPlace(wrTemp.BeginPos); | 1270 m_pVT->UpdateWordPlace(wrTemp.BeginPos); |
| 1271 m_pVT->UpdateWordPlace(wrTemp.EndPos); | 1271 m_pVT->UpdateWordPlace(wrTemp.EndPos); |
| 1272 pIterator->SetAt(wrTemp.BeginPos); | 1272 pIterator->SetAt(wrTemp.BeginPos); |
| 1273 | 1273 |
| 1274 CPVT_Word wordinfo; | 1274 CPVT_Word wordinfo; |
| 1275 CPVT_WordPlace oldplace = wrTemp.BeginPos; | 1275 CPVT_WordPlace oldplace = wrTemp.BeginPos; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 wrRet.EndPos = wr2.EndPos; | 1351 wrRet.EndPos = wr2.EndPos; |
| 1352 } | 1352 } |
| 1353 else | 1353 else |
| 1354 { | 1354 { |
| 1355 wrRet.EndPos = wr1.EndPos; | 1355 wrRet.EndPos = wr1.EndPos; |
| 1356 } | 1356 } |
| 1357 | 1357 |
| 1358 return wrRet; | 1358 return wrRet; |
| 1359 } | 1359 } |
| 1360 | 1360 |
| 1361 FX_BOOL»CFX_Edit::IsRichText() const | 1361 bool» CFX_Edit::IsRichText() const |
| 1362 { | 1362 { |
| 1363 return m_pVT->IsRichText(); | 1363 return m_pVT->IsRichText(); |
| 1364 } | 1364 } |
| 1365 | 1365 |
| 1366 void CFX_Edit::SetRichText(FX_BOOL bRichText/* =TRUE */, FX_BOOL bPaint/* = TRUE
*/) | 1366 void CFX_Edit::SetRichText(bool bRichText/* =true */, bool bPaint/* = true*/) |
| 1367 { | 1367 { |
| 1368 m_pVT->SetRichText(bRichText); | 1368 m_pVT->SetRichText(bRichText); |
| 1369 if (bPaint) Paint(); | 1369 if (bPaint) Paint(); |
| 1370 } | 1370 } |
| 1371 | 1371 |
| 1372 FX_BOOL CFX_Edit::SetRichFontIndex(int32_t nFontIndex) | 1372 bool CFX_Edit::SetRichFontIndex(int32_t nFontIndex) |
| 1373 { | 1373 { |
| 1374 CPVT_WordProps WordProps; | 1374 CPVT_WordProps WordProps; |
| 1375 WordProps.nFontIndex = nFontIndex; | 1375 WordProps.nFontIndex = nFontIndex; |
| 1376 return SetRichTextProps(EP_FONTINDEX,NULL,&WordProps); | 1376 return SetRichTextProps(EP_FONTINDEX,NULL,&WordProps); |
| 1377 } | 1377 } |
| 1378 | 1378 |
| 1379 FX_BOOL CFX_Edit::SetRichFontSize(FX_FLOAT fFontSize) | 1379 bool CFX_Edit::SetRichFontSize(FX_FLOAT fFontSize) |
| 1380 { | 1380 { |
| 1381 CPVT_WordProps WordProps; | 1381 CPVT_WordProps WordProps; |
| 1382 WordProps.fFontSize = fFontSize; | 1382 WordProps.fFontSize = fFontSize; |
| 1383 return SetRichTextProps(EP_FONTSIZE,NULL,&WordProps); | 1383 return SetRichTextProps(EP_FONTSIZE,NULL,&WordProps); |
| 1384 } | 1384 } |
| 1385 | 1385 |
| 1386 FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) | 1386 bool CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) |
| 1387 { | 1387 { |
| 1388 CPVT_WordProps WordProps; | 1388 CPVT_WordProps WordProps; |
| 1389 WordProps.dwWordColor = dwColor; | 1389 WordProps.dwWordColor = dwColor; |
| 1390 return SetRichTextProps(EP_WORDCOLOR,NULL,&WordProps); | 1390 return SetRichTextProps(EP_WORDCOLOR,NULL,&WordProps); |
| 1391 } | 1391 } |
| 1392 | 1392 |
| 1393 FX_BOOL CFX_Edit::SetRichTextScript(int32_t nScriptType) | 1393 bool CFX_Edit::SetRichTextScript(int32_t nScriptType) |
| 1394 { | 1394 { |
| 1395 CPVT_WordProps WordProps; | 1395 CPVT_WordProps WordProps; |
| 1396 WordProps.nScriptType = nScriptType; | 1396 WordProps.nScriptType = nScriptType; |
| 1397 return SetRichTextProps(EP_SCRIPTTYPE,NULL,&WordProps); | 1397 return SetRichTextProps(EP_SCRIPTTYPE,NULL,&WordProps); |
| 1398 } | 1398 } |
| 1399 | 1399 |
| 1400 FX_BOOL CFX_Edit::SetRichTextBold(FX_BOOL bBold) | 1400 bool CFX_Edit::SetRichTextBold(bool bBold) |
| 1401 { | 1401 { |
| 1402 CPVT_WordProps WordProps; | 1402 CPVT_WordProps WordProps; |
| 1403 if (bBold) | 1403 if (bBold) |
| 1404 WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; | 1404 WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; |
| 1405 return SetRichTextProps(EP_BOLD,NULL,&WordProps); | 1405 return SetRichTextProps(EP_BOLD,NULL,&WordProps); |
| 1406 } | 1406 } |
| 1407 | 1407 |
| 1408 FX_BOOL CFX_Edit::SetRichTextItalic(FX_BOOL bItalic) | 1408 bool CFX_Edit::SetRichTextItalic(bool bItalic) |
| 1409 { | 1409 { |
| 1410 CPVT_WordProps WordProps; | 1410 CPVT_WordProps WordProps; |
| 1411 if (bItalic) | 1411 if (bItalic) |
| 1412 WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; | 1412 WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; |
| 1413 return SetRichTextProps(EP_ITALIC,NULL,&WordProps); | 1413 return SetRichTextProps(EP_ITALIC,NULL,&WordProps); |
| 1414 } | 1414 } |
| 1415 | 1415 |
| 1416 FX_BOOL CFX_Edit::SetRichTextUnderline(FX_BOOL bUnderline) | 1416 bool CFX_Edit::SetRichTextUnderline(bool bUnderline) |
| 1417 { | 1417 { |
| 1418 CPVT_WordProps WordProps; | 1418 CPVT_WordProps WordProps; |
| 1419 if (bUnderline) | 1419 if (bUnderline) |
| 1420 WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; | 1420 WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; |
| 1421 return SetRichTextProps(EP_UNDERLINE,NULL,&WordProps); | 1421 return SetRichTextProps(EP_UNDERLINE,NULL,&WordProps); |
| 1422 } | 1422 } |
| 1423 | 1423 |
| 1424 FX_BOOL CFX_Edit::SetRichTextCrossout(FX_BOOL bCrossout) | 1424 bool CFX_Edit::SetRichTextCrossout(bool bCrossout) |
| 1425 { | 1425 { |
| 1426 CPVT_WordProps WordProps; | 1426 CPVT_WordProps WordProps; |
| 1427 if (bCrossout) | 1427 if (bCrossout) |
| 1428 WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; | 1428 WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; |
| 1429 return SetRichTextProps(EP_CROSSOUT,NULL,&WordProps); | 1429 return SetRichTextProps(EP_CROSSOUT,NULL,&WordProps); |
| 1430 } | 1430 } |
| 1431 | 1431 |
| 1432 FX_BOOL CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace) | 1432 bool CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace) |
| 1433 { | 1433 { |
| 1434 CPVT_WordProps WordProps; | 1434 CPVT_WordProps WordProps; |
| 1435 WordProps.fCharSpace = fCharSpace; | 1435 WordProps.fCharSpace = fCharSpace; |
| 1436 return SetRichTextProps(EP_CHARSPACE,NULL,&WordProps); | 1436 return SetRichTextProps(EP_CHARSPACE,NULL,&WordProps); |
| 1437 } | 1437 } |
| 1438 | 1438 |
| 1439 FX_BOOL CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale /*= 100*/) | 1439 bool CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale /*= 100*/) |
| 1440 { | 1440 { |
| 1441 CPVT_WordProps WordProps; | 1441 CPVT_WordProps WordProps; |
| 1442 WordProps.nHorzScale = nHorzScale; | 1442 WordProps.nHorzScale = nHorzScale; |
| 1443 return SetRichTextProps(EP_HORZSCALE,NULL,&WordProps); | 1443 return SetRichTextProps(EP_HORZSCALE,NULL,&WordProps); |
| 1444 } | 1444 } |
| 1445 | 1445 |
| 1446 FX_BOOL CFX_Edit::SetRichTextLineLeading(FX_FLOAT fLineLeading) | 1446 bool CFX_Edit::SetRichTextLineLeading(FX_FLOAT fLineLeading) |
| 1447 { | 1447 { |
| 1448 CPVT_SecProps SecProps; | 1448 CPVT_SecProps SecProps; |
| 1449 SecProps.fLineLeading = fLineLeading; | 1449 SecProps.fLineLeading = fLineLeading; |
| 1450 return SetRichTextProps(EP_LINELEADING,&SecProps,NULL); | 1450 return SetRichTextProps(EP_LINELEADING,&SecProps,NULL); |
| 1451 } | 1451 } |
| 1452 | 1452 |
| 1453 FX_BOOL CFX_Edit::SetRichTextLineIndent(FX_FLOAT fLineIndent) | 1453 bool CFX_Edit::SetRichTextLineIndent(FX_FLOAT fLineIndent) |
| 1454 { | 1454 { |
| 1455 CPVT_SecProps SecProps; | 1455 CPVT_SecProps SecProps; |
| 1456 SecProps.fLineIndent = fLineIndent; | 1456 SecProps.fLineIndent = fLineIndent; |
| 1457 return SetRichTextProps(EP_LINEINDENT,&SecProps,NULL); | 1457 return SetRichTextProps(EP_LINEINDENT,&SecProps,NULL); |
| 1458 } | 1458 } |
| 1459 | 1459 |
| 1460 FX_BOOL»CFX_Edit::SetRichTextAlignment(int32_t nAlignment) | 1460 bool» CFX_Edit::SetRichTextAlignment(int32_t nAlignment) |
| 1461 { | 1461 { |
| 1462 CPVT_SecProps SecProps; | 1462 CPVT_SecProps SecProps; |
| 1463 SecProps.nAlignment = nAlignment; | 1463 SecProps.nAlignment = nAlignment; |
| 1464 return SetRichTextProps(EP_ALIGNMENT,&SecProps,NULL); | 1464 return SetRichTextProps(EP_ALIGNMENT,&SecProps,NULL); |
| 1465 } | 1465 } |
| 1466 | 1466 |
| 1467 FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pS
ecProps, const CPVT_WordProps * pWordProps) | 1467 bool CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pSecP
rops, const CPVT_WordProps * pWordProps) |
| 1468 { | 1468 { |
| 1469 » FX_BOOL bSet = FALSE; | 1469 » bool bSet = false; |
| 1470 » FX_BOOL bSet1,bSet2; | 1470 » bool bSet1,bSet2; |
| 1471 if (m_pVT->IsValid() && m_pVT->IsRichText()) | 1471 if (m_pVT->IsValid() && m_pVT->IsRichText()) |
| 1472 { | 1472 { |
| 1473 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 1473 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) |
| 1474 { | 1474 { |
| 1475 CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); | 1475 CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); |
| 1476 | 1476 |
| 1477 m_pVT->UpdateWordPlace(wrTemp.BeginPos); | 1477 m_pVT->UpdateWordPlace(wrTemp.BeginPos); |
| 1478 m_pVT->UpdateWordPlace(wrTemp.EndPos); | 1478 m_pVT->UpdateWordPlace(wrTemp.EndPos); |
| 1479 pIterator->SetAt(wrTemp.BeginPos); | 1479 pIterator->SetAt(wrTemp.BeginPos); |
| 1480 | 1480 |
| 1481 BeginGroupUndo(L"");; | 1481 BeginGroupUndo(L"");; |
| 1482 | 1482 |
| 1483 » » » bSet = SetSecProps(eProps,wrTemp.BeginPos,pSecProps,pWor
dProps,wrTemp,TRUE); | 1483 » » » bSet = SetSecProps(eProps,wrTemp.BeginPos,pSecProps,pWor
dProps,wrTemp,true); |
| 1484 | 1484 |
| 1485 while (pIterator->NextWord()) | 1485 while (pIterator->NextWord()) |
| 1486 { | 1486 { |
| 1487 CPVT_WordPlace place = pIterator->GetAt(); | 1487 CPVT_WordPlace place = pIterator->GetAt(); |
| 1488 if (place.WordCmp(wrTemp.EndPos) > 0) break; | 1488 if (place.WordCmp(wrTemp.EndPos) > 0) break; |
| 1489 » » » » bSet1 = SetSecProps(eProps,place,pSecProps,pWord
Props,wrTemp,TRUE); | 1489 » » » » bSet1 = SetSecProps(eProps,place,pSecProps,pWord
Props,wrTemp,true); |
| 1490 » » » » bSet2 = SetWordProps(eProps,place,pWordProps,wrT
emp,TRUE); | 1490 » » » » bSet2 = SetWordProps(eProps,place,pWordProps,wrT
emp,true); |
| 1491 | 1491 |
| 1492 if (!bSet) | 1492 if (!bSet) |
| 1493 bSet = (bSet1 || bSet2); | 1493 bSet = (bSet1 || bSet2); |
| 1494 } | 1494 } |
| 1495 | 1495 |
| 1496 EndGroupUndo(); | 1496 EndGroupUndo(); |
| 1497 | 1497 |
| 1498 if (bSet) | 1498 if (bSet) |
| 1499 { | 1499 { |
| 1500 PaintSetProps(eProps,wrTemp); | 1500 PaintSetProps(eProps,wrTemp); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1536 CPVT_WordRange wrRefresh(m_pVT->GetSectionBeginPlace(wr.BeginPos
), | 1536 CPVT_WordRange wrRefresh(m_pVT->GetSectionBeginPlace(wr.BeginPos
), |
| 1537 m_pVT->GetSectionEndPlace(wr.EndPos)); | 1537 m_pVT->GetSectionEndPlace(wr.EndPos)); |
| 1538 Refresh(RP_ANALYSE,&wrRefresh); | 1538 Refresh(RP_ANALYSE,&wrRefresh); |
| 1539 | 1539 |
| 1540 SetCaretOrigin(); | 1540 SetCaretOrigin(); |
| 1541 SetCaretInfo(); | 1541 SetCaretInfo(); |
| 1542 break; | 1542 break; |
| 1543 } | 1543 } |
| 1544 } | 1544 } |
| 1545 | 1545 |
| 1546 FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, | 1546 bool CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, |
| 1547 const CPVT_SecProps *
pSecProps, const CPVT_WordProps * pWordProps, | 1547 const CPVT_SecProps *
pSecProps, const CPVT_WordProps * pWordProps, |
| 1548 » » » » » » » const CPVT_WordRange
& wr, FX_BOOL bAddUndo) | 1548 » » » » » » » const CPVT_WordRange
& wr, bool bAddUndo) |
| 1549 { | 1549 { |
| 1550 if (m_pVT->IsValid() && m_pVT->IsRichText()) | 1550 if (m_pVT->IsValid() && m_pVT->IsRichText()) |
| 1551 { | 1551 { |
| 1552 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 1552 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) |
| 1553 { | 1553 { |
| 1554 » » » FX_BOOL bSet = FALSE; | 1554 » » » bool bSet = false; |
| 1555 CPVT_Section secinfo; | 1555 CPVT_Section secinfo; |
| 1556 CPVT_Section OldSecinfo; | 1556 CPVT_Section OldSecinfo; |
| 1557 | 1557 |
| 1558 CPVT_WordPlace oldplace = pIterator->GetAt(); | 1558 CPVT_WordPlace oldplace = pIterator->GetAt(); |
| 1559 | 1559 |
| 1560 if (eProps == EP_LINELEADING || eProps == EP_LINEINDENT
|| eProps == EP_ALIGNMENT) | 1560 if (eProps == EP_LINELEADING || eProps == EP_LINEINDENT
|| eProps == EP_ALIGNMENT) |
| 1561 { | 1561 { |
| 1562 if (pSecProps) | 1562 if (pSecProps) |
| 1563 { | 1563 { |
| 1564 pIterator->SetAt(place); | 1564 pIterator->SetAt(place); |
| 1565 if (pIterator->GetSection(secinfo)) | 1565 if (pIterator->GetSection(secinfo)) |
| 1566 { | 1566 { |
| 1567 if (bAddUndo) OldSecinfo = secin
fo; | 1567 if (bAddUndo) OldSecinfo = secin
fo; |
| 1568 | 1568 |
| 1569 switch(eProps) | 1569 switch(eProps) |
| 1570 { | 1570 { |
| 1571 case EP_LINELEADING: | 1571 case EP_LINELEADING: |
| 1572 if (!FX_EDIT_IsFloatEqua
l(secinfo.SecProps.fLineLeading,pSecProps->fLineLeading)) | 1572 if (!FX_EDIT_IsFloatEqua
l(secinfo.SecProps.fLineLeading,pSecProps->fLineLeading)) |
| 1573 { | 1573 { |
| 1574 secinfo.SecProps
.fLineLeading = pSecProps->fLineLeading; | 1574 secinfo.SecProps
.fLineLeading = pSecProps->fLineLeading; |
| 1575 » » » » » » » » bSet = TRUE; | 1575 » » » » » » » » bSet = true; |
| 1576 } | 1576 } |
| 1577 break; | 1577 break; |
| 1578 case EP_LINEINDENT: | 1578 case EP_LINEINDENT: |
| 1579 if (!FX_EDIT_IsFloatEqua
l(secinfo.SecProps.fLineIndent,pSecProps->fLineIndent)) | 1579 if (!FX_EDIT_IsFloatEqua
l(secinfo.SecProps.fLineIndent,pSecProps->fLineIndent)) |
| 1580 { | 1580 { |
| 1581 secinfo.SecProps
.fLineIndent = pSecProps->fLineIndent; | 1581 secinfo.SecProps
.fLineIndent = pSecProps->fLineIndent; |
| 1582 » » » » » » » » bSet = TRUE; | 1582 » » » » » » » » bSet = true; |
| 1583 } | 1583 } |
| 1584 break; | 1584 break; |
| 1585 case EP_ALIGNMENT: | 1585 case EP_ALIGNMENT: |
| 1586 if (secinfo.SecProps.nAl
ignment != pSecProps->nAlignment) | 1586 if (secinfo.SecProps.nAl
ignment != pSecProps->nAlignment) |
| 1587 { | 1587 { |
| 1588 secinfo.SecProps
.nAlignment = pSecProps->nAlignment; | 1588 secinfo.SecProps
.nAlignment = pSecProps->nAlignment; |
| 1589 » » » » » » » » bSet = TRUE; | 1589 » » » » » » » » bSet = true; |
| 1590 } | 1590 } |
| 1591 break; | 1591 break; |
| 1592 default: | 1592 default: |
| 1593 break; | 1593 break; |
| 1594 } | 1594 } |
| 1595 } | 1595 } |
| 1596 } | 1596 } |
| 1597 } | 1597 } |
| 1598 else | 1598 else |
| 1599 { | 1599 { |
| 1600 if (pWordProps && place == m_pVT->GetSectionBegi
nPlace(place)) | 1600 if (pWordProps && place == m_pVT->GetSectionBegi
nPlace(place)) |
| 1601 { | 1601 { |
| 1602 pIterator->SetAt(place); | 1602 pIterator->SetAt(place); |
| 1603 if (pIterator->GetSection(secinfo)) | 1603 if (pIterator->GetSection(secinfo)) |
| 1604 { | 1604 { |
| 1605 if (bAddUndo) OldSecinfo = secin
fo; | 1605 if (bAddUndo) OldSecinfo = secin
fo; |
| 1606 | 1606 |
| 1607 switch(eProps) | 1607 switch(eProps) |
| 1608 { | 1608 { |
| 1609 case EP_FONTINDEX: | 1609 case EP_FONTINDEX: |
| 1610 if (secinfo.WordProps.nF
ontIndex != pWordProps->nFontIndex) | 1610 if (secinfo.WordProps.nF
ontIndex != pWordProps->nFontIndex) |
| 1611 { | 1611 { |
| 1612 secinfo.WordProp
s.nFontIndex = pWordProps->nFontIndex; | 1612 secinfo.WordProp
s.nFontIndex = pWordProps->nFontIndex; |
| 1613 » » » » » » » » bSet = TRUE; | 1613 » » » » » » » » bSet = true; |
| 1614 } | 1614 } |
| 1615 break; | 1615 break; |
| 1616 case EP_FONTSIZE: | 1616 case EP_FONTSIZE: |
| 1617 if (!FX_EDIT_IsFloatEqua
l(secinfo.WordProps.fFontSize,pWordProps->fFontSize)) | 1617 if (!FX_EDIT_IsFloatEqua
l(secinfo.WordProps.fFontSize,pWordProps->fFontSize)) |
| 1618 { | 1618 { |
| 1619 secinfo.WordProp
s.fFontSize = pWordProps->fFontSize; | 1619 secinfo.WordProp
s.fFontSize = pWordProps->fFontSize; |
| 1620 » » » » » » » » bSet = TRUE; | 1620 » » » » » » » » bSet = true; |
| 1621 } | 1621 } |
| 1622 break; | 1622 break; |
| 1623 case EP_WORDCOLOR: | 1623 case EP_WORDCOLOR: |
| 1624 if (secinfo.WordProps.dw
WordColor != pWordProps->dwWordColor) | 1624 if (secinfo.WordProps.dw
WordColor != pWordProps->dwWordColor) |
| 1625 { | 1625 { |
| 1626 secinfo.WordProp
s.dwWordColor = pWordProps->dwWordColor; | 1626 secinfo.WordProp
s.dwWordColor = pWordProps->dwWordColor; |
| 1627 » » » » » » » » bSet = TRUE; | 1627 » » » » » » » » bSet = true; |
| 1628 } | 1628 } |
| 1629 break; | 1629 break; |
| 1630 case EP_SCRIPTTYPE: | 1630 case EP_SCRIPTTYPE: |
| 1631 if (secinfo.WordProps.nS
criptType != pWordProps->nScriptType) | 1631 if (secinfo.WordProps.nS
criptType != pWordProps->nScriptType) |
| 1632 { | 1632 { |
| 1633 secinfo.WordProp
s.nScriptType = pWordProps->nScriptType; | 1633 secinfo.WordProp
s.nScriptType = pWordProps->nScriptType; |
| 1634 » » » » » » » » bSet = TRUE; | 1634 » » » » » » » » bSet = true; |
| 1635 } | 1635 } |
| 1636 break; | 1636 break; |
| 1637 case EP_CHARSPACE: | 1637 case EP_CHARSPACE: |
| 1638 if (!FX_EDIT_IsFloatEqua
l(secinfo.WordProps.fCharSpace,pWordProps->fCharSpace)) | 1638 if (!FX_EDIT_IsFloatEqua
l(secinfo.WordProps.fCharSpace,pWordProps->fCharSpace)) |
| 1639 { | 1639 { |
| 1640 secinfo.WordProp
s.fCharSpace = pWordProps->fCharSpace; | 1640 secinfo.WordProp
s.fCharSpace = pWordProps->fCharSpace; |
| 1641 » » » » » » » » bSet = TRUE; | 1641 » » » » » » » » bSet = true; |
| 1642 } | 1642 } |
| 1643 break; | 1643 break; |
| 1644 case EP_HORZSCALE: | 1644 case EP_HORZSCALE: |
| 1645 if (secinfo.WordProps.nH
orzScale != pWordProps->nHorzScale) | 1645 if (secinfo.WordProps.nH
orzScale != pWordProps->nHorzScale) |
| 1646 { | 1646 { |
| 1647 secinfo.WordProp
s.nHorzScale = pWordProps->nHorzScale; | 1647 secinfo.WordProp
s.nHorzScale = pWordProps->nHorzScale; |
| 1648 » » » » » » » » bSet = TRUE; | 1648 » » » » » » » » bSet = true; |
| 1649 } | 1649 } |
| 1650 break; | 1650 break; |
| 1651 case EP_UNDERLINE: | 1651 case EP_UNDERLINE: |
| 1652 if (pWordProps->nWordSty
le & PVTWORD_STYLE_UNDERLINE) | 1652 if (pWordProps->nWordSty
le & PVTWORD_STYLE_UNDERLINE) |
| 1653 { | 1653 { |
| 1654 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) == 0) | 1654 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) == 0) |
| 1655 { | 1655 { |
| 1656 secinfo.
WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; | 1656 secinfo.
WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; |
| 1657 » » » » » » » » » bSet = T
RUE; | 1657 » » » » » » » » » bSet = t
rue; |
| 1658 } | 1658 } |
| 1659 } | 1659 } |
| 1660 else | 1660 else |
| 1661 { | 1661 { |
| 1662 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) != 0) | 1662 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) != 0) |
| 1663 { | 1663 { |
| 1664 secinfo.
WordProps.nWordStyle &= ~PVTWORD_STYLE_UNDERLINE; | 1664 secinfo.
WordProps.nWordStyle &= ~PVTWORD_STYLE_UNDERLINE; |
| 1665 » » » » » » » » » bSet = T
RUE; | 1665 » » » » » » » » » bSet = t
rue; |
| 1666 } | 1666 } |
| 1667 } | 1667 } |
| 1668 break; | 1668 break; |
| 1669 case EP_CROSSOUT: | 1669 case EP_CROSSOUT: |
| 1670 if (pWordProps->nWordSty
le & PVTWORD_STYLE_CROSSOUT) | 1670 if (pWordProps->nWordSty
le & PVTWORD_STYLE_CROSSOUT) |
| 1671 { | 1671 { |
| 1672 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) == 0) | 1672 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) == 0) |
| 1673 { | 1673 { |
| 1674 secinfo.
WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; | 1674 secinfo.
WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; |
| 1675 » » » » » » » » » bSet = T
RUE; | 1675 » » » » » » » » » bSet = t
rue; |
| 1676 } | 1676 } |
| 1677 } | 1677 } |
| 1678 else | 1678 else |
| 1679 { | 1679 { |
| 1680 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) != 0) | 1680 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) != 0) |
| 1681 { | 1681 { |
| 1682 secinfo.
WordProps.nWordStyle &= ~PVTWORD_STYLE_CROSSOUT; | 1682 secinfo.
WordProps.nWordStyle &= ~PVTWORD_STYLE_CROSSOUT; |
| 1683 » » » » » » » » » bSet = T
RUE; | 1683 » » » » » » » » » bSet = t
rue; |
| 1684 } | 1684 } |
| 1685 } | 1685 } |
| 1686 break; | 1686 break; |
| 1687 case EP_BOLD: | 1687 case EP_BOLD: |
| 1688 if (pWordProps->nWordSty
le & PVTWORD_STYLE_BOLD) | 1688 if (pWordProps->nWordSty
le & PVTWORD_STYLE_BOLD) |
| 1689 { | 1689 { |
| 1690 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_BOLD) == 0) | 1690 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_BOLD) == 0) |
| 1691 { | 1691 { |
| 1692 secinfo.
WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; | 1692 secinfo.
WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; |
| 1693 » » » » » » » » » bSet = T
RUE; | 1693 » » » » » » » » » bSet = t
rue; |
| 1694 } | 1694 } |
| 1695 } | 1695 } |
| 1696 else | 1696 else |
| 1697 { | 1697 { |
| 1698 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_BOLD) != 0) | 1698 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_BOLD) != 0) |
| 1699 { | 1699 { |
| 1700 secinfo.
WordProps.nWordStyle &= ~PVTWORD_STYLE_BOLD; | 1700 secinfo.
WordProps.nWordStyle &= ~PVTWORD_STYLE_BOLD; |
| 1701 » » » » » » » » » bSet = T
RUE; | 1701 » » » » » » » » » bSet = t
rue; |
| 1702 } | 1702 } |
| 1703 } | 1703 } |
| 1704 break; | 1704 break; |
| 1705 case EP_ITALIC: | 1705 case EP_ITALIC: |
| 1706 if (pWordProps->nWordSty
le & PVTWORD_STYLE_ITALIC) | 1706 if (pWordProps->nWordSty
le & PVTWORD_STYLE_ITALIC) |
| 1707 { | 1707 { |
| 1708 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_ITALIC) == 0) | 1708 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_ITALIC) == 0) |
| 1709 { | 1709 { |
| 1710 secinfo.
WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; | 1710 secinfo.
WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; |
| 1711 » » » » » » » » » bSet = T
RUE; | 1711 » » » » » » » » » bSet = t
rue; |
| 1712 } | 1712 } |
| 1713 } | 1713 } |
| 1714 else | 1714 else |
| 1715 { | 1715 { |
| 1716 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_ITALIC) != 0) | 1716 if ((secinfo.Wor
dProps.nWordStyle & PVTWORD_STYLE_ITALIC) != 0) |
| 1717 { | 1717 { |
| 1718 secinfo.
WordProps.nWordStyle &= ~PVTWORD_STYLE_ITALIC; | 1718 secinfo.
WordProps.nWordStyle &= ~PVTWORD_STYLE_ITALIC; |
| 1719 » » » » » » » » » bSet = T
RUE; | 1719 » » » » » » » » » bSet = t
rue; |
| 1720 } | 1720 } |
| 1721 } | 1721 } |
| 1722 break; | 1722 break; |
| 1723 default: | 1723 default: |
| 1724 break; | 1724 break; |
| 1725 } | 1725 } |
| 1726 } | 1726 } |
| 1727 } | 1727 } |
| 1728 } | 1728 } |
| 1729 | 1729 |
| 1730 if (bSet) | 1730 if (bSet) |
| 1731 { | 1731 { |
| 1732 pIterator->SetSection(secinfo); | 1732 pIterator->SetSection(secinfo); |
| 1733 | 1733 |
| 1734 if (bAddUndo && m_bEnableUndo) | 1734 if (bAddUndo && m_bEnableUndo) |
| 1735 { | 1735 { |
| 1736 AddEditUndoItem(new CFXEU_SetSecProps | 1736 AddEditUndoItem(new CFXEU_SetSecProps |
| 1737 (this,place,eProps,OldSecinfo.Se
cProps,OldSecinfo.WordProps,secinfo.SecProps,secinfo.WordProps,wr)); | 1737 (this,place,eProps,OldSecinfo.Se
cProps,OldSecinfo.WordProps,secinfo.SecProps,secinfo.WordProps,wr)); |
| 1738 } | 1738 } |
| 1739 } | 1739 } |
| 1740 | 1740 |
| 1741 pIterator->SetAt(oldplace); | 1741 pIterator->SetAt(oldplace); |
| 1742 | 1742 |
| 1743 return bSet; | 1743 return bSet; |
| 1744 } | 1744 } |
| 1745 } | 1745 } |
| 1746 | 1746 |
| 1747 » return FALSE; | 1747 » return false; |
| 1748 } | 1748 } |
| 1749 | 1749 |
| 1750 FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place
, | 1750 bool CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, |
| 1751 » » » » » » » » const CPVT_WordP
rops * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo) | 1751 » » » » » » » » const CPVT_WordP
rops * pWordProps, const CPVT_WordRange & wr, bool bAddUndo) |
| 1752 { | 1752 { |
| 1753 if (m_pVT->IsValid() && m_pVT->IsRichText()) | 1753 if (m_pVT->IsValid() && m_pVT->IsRichText()) |
| 1754 { | 1754 { |
| 1755 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 1755 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) |
| 1756 { | 1756 { |
| 1757 » » » FX_BOOL bSet = FALSE; | 1757 » » » bool bSet = false; |
| 1758 CPVT_Word wordinfo; | 1758 CPVT_Word wordinfo; |
| 1759 CPVT_Word OldWordinfo; | 1759 CPVT_Word OldWordinfo; |
| 1760 | 1760 |
| 1761 CPVT_WordPlace oldplace = pIterator->GetAt(); | 1761 CPVT_WordPlace oldplace = pIterator->GetAt(); |
| 1762 | 1762 |
| 1763 if (pWordProps) | 1763 if (pWordProps) |
| 1764 { | 1764 { |
| 1765 pIterator->SetAt(place); | 1765 pIterator->SetAt(place); |
| 1766 if (pIterator->GetWord(wordinfo)) | 1766 if (pIterator->GetWord(wordinfo)) |
| 1767 { | 1767 { |
| 1768 if (bAddUndo) OldWordinfo = wordinfo; | 1768 if (bAddUndo) OldWordinfo = wordinfo; |
| 1769 | 1769 |
| 1770 switch(eProps) | 1770 switch(eProps) |
| 1771 { | 1771 { |
| 1772 case EP_FONTINDEX: | 1772 case EP_FONTINDEX: |
| 1773 if (wordinfo.WordProps.nFontInde
x != pWordProps->nFontIndex) | 1773 if (wordinfo.WordProps.nFontInde
x != pWordProps->nFontIndex) |
| 1774 { | 1774 { |
| 1775 if (IFX_Edit_FontMap* pF
ontMap = GetFontMap()) | 1775 if (IFX_Edit_FontMap* pF
ontMap = GetFontMap()) |
| 1776 { | 1776 { |
| 1777 wordinfo.WordPro
ps.nFontIndex = pFontMap->GetWordFontIndex(wordinfo.Word,wordinfo.nCharset,pWord
Props->nFontIndex); | 1777 wordinfo.WordPro
ps.nFontIndex = pFontMap->GetWordFontIndex(wordinfo.Word,wordinfo.nCharset,pWord
Props->nFontIndex); |
| 1778 } | 1778 } |
| 1779 » » » » » » » bSet = TRUE; | 1779 » » » » » » » bSet = true; |
| 1780 } | 1780 } |
| 1781 break; | 1781 break; |
| 1782 case EP_FONTSIZE: | 1782 case EP_FONTSIZE: |
| 1783 if (!FX_EDIT_IsFloatEqual(wordin
fo.WordProps.fFontSize,pWordProps->fFontSize)) | 1783 if (!FX_EDIT_IsFloatEqual(wordin
fo.WordProps.fFontSize,pWordProps->fFontSize)) |
| 1784 { | 1784 { |
| 1785 wordinfo.WordProps.fFont
Size = pWordProps->fFontSize; | 1785 wordinfo.WordProps.fFont
Size = pWordProps->fFontSize; |
| 1786 » » » » » » » bSet = TRUE; | 1786 » » » » » » » bSet = true; |
| 1787 } | 1787 } |
| 1788 break; | 1788 break; |
| 1789 case EP_WORDCOLOR: | 1789 case EP_WORDCOLOR: |
| 1790 if (wordinfo.WordProps.dwWordCol
or != pWordProps->dwWordColor) | 1790 if (wordinfo.WordProps.dwWordCol
or != pWordProps->dwWordColor) |
| 1791 { | 1791 { |
| 1792 wordinfo.WordProps.dwWor
dColor = pWordProps->dwWordColor; | 1792 wordinfo.WordProps.dwWor
dColor = pWordProps->dwWordColor; |
| 1793 » » » » » » » bSet = TRUE; | 1793 » » » » » » » bSet = true; |
| 1794 } | 1794 } |
| 1795 break; | 1795 break; |
| 1796 case EP_SCRIPTTYPE: | 1796 case EP_SCRIPTTYPE: |
| 1797 if (wordinfo.WordProps.nScriptTy
pe != pWordProps->nScriptType) | 1797 if (wordinfo.WordProps.nScriptTy
pe != pWordProps->nScriptType) |
| 1798 { | 1798 { |
| 1799 wordinfo.WordProps.nScri
ptType = pWordProps->nScriptType; | 1799 wordinfo.WordProps.nScri
ptType = pWordProps->nScriptType; |
| 1800 » » » » » » » bSet = TRUE; | 1800 » » » » » » » bSet = true; |
| 1801 } | 1801 } |
| 1802 break; | 1802 break; |
| 1803 case EP_CHARSPACE: | 1803 case EP_CHARSPACE: |
| 1804 if (!FX_EDIT_IsFloatEqual(wordin
fo.WordProps.fCharSpace,pWordProps->fCharSpace)) | 1804 if (!FX_EDIT_IsFloatEqual(wordin
fo.WordProps.fCharSpace,pWordProps->fCharSpace)) |
| 1805 { | 1805 { |
| 1806 wordinfo.WordProps.fChar
Space = pWordProps->fCharSpace; | 1806 wordinfo.WordProps.fChar
Space = pWordProps->fCharSpace; |
| 1807 » » » » » » » bSet = TRUE; | 1807 » » » » » » » bSet = true; |
| 1808 } | 1808 } |
| 1809 break; | 1809 break; |
| 1810 case EP_HORZSCALE: | 1810 case EP_HORZSCALE: |
| 1811 if (wordinfo.WordProps.nHorzScal
e != pWordProps->nHorzScale) | 1811 if (wordinfo.WordProps.nHorzScal
e != pWordProps->nHorzScale) |
| 1812 { | 1812 { |
| 1813 wordinfo.WordProps.nHorz
Scale = pWordProps->nHorzScale; | 1813 wordinfo.WordProps.nHorz
Scale = pWordProps->nHorzScale; |
| 1814 » » » » » » » bSet = TRUE; | 1814 » » » » » » » bSet = true; |
| 1815 } | 1815 } |
| 1816 break; | 1816 break; |
| 1817 case EP_UNDERLINE: | 1817 case EP_UNDERLINE: |
| 1818 if (pWordProps->nWordStyle & PVT
WORD_STYLE_UNDERLINE) | 1818 if (pWordProps->nWordStyle & PVT
WORD_STYLE_UNDERLINE) |
| 1819 { | 1819 { |
| 1820 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_UNDERLINE) == 0) | 1820 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_UNDERLINE) == 0) |
| 1821 { | 1821 { |
| 1822 wordinfo.WordPro
ps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; | 1822 wordinfo.WordPro
ps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; |
| 1823 » » » » » » » » bSet = TRUE; | 1823 » » » » » » » » bSet = true; |
| 1824 } | 1824 } |
| 1825 } | 1825 } |
| 1826 else | 1826 else |
| 1827 { | 1827 { |
| 1828 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_UNDERLINE) != 0) | 1828 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_UNDERLINE) != 0) |
| 1829 { | 1829 { |
| 1830 wordinfo.WordPro
ps.nWordStyle &= ~PVTWORD_STYLE_UNDERLINE; | 1830 wordinfo.WordPro
ps.nWordStyle &= ~PVTWORD_STYLE_UNDERLINE; |
| 1831 » » » » » » » » bSet = TRUE; | 1831 » » » » » » » » bSet = true; |
| 1832 } | 1832 } |
| 1833 } | 1833 } |
| 1834 break; | 1834 break; |
| 1835 case EP_CROSSOUT: | 1835 case EP_CROSSOUT: |
| 1836 if (pWordProps->nWordStyle & PVT
WORD_STYLE_CROSSOUT) | 1836 if (pWordProps->nWordStyle & PVT
WORD_STYLE_CROSSOUT) |
| 1837 { | 1837 { |
| 1838 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_CROSSOUT) == 0) | 1838 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_CROSSOUT) == 0) |
| 1839 { | 1839 { |
| 1840 wordinfo.WordPro
ps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; | 1840 wordinfo.WordPro
ps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; |
| 1841 » » » » » » » » bSet = TRUE; | 1841 » » » » » » » » bSet = true; |
| 1842 } | 1842 } |
| 1843 } | 1843 } |
| 1844 else | 1844 else |
| 1845 { | 1845 { |
| 1846 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_CROSSOUT) != 0) | 1846 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_CROSSOUT) != 0) |
| 1847 { | 1847 { |
| 1848 wordinfo.WordPro
ps.nWordStyle &= ~PVTWORD_STYLE_CROSSOUT; | 1848 wordinfo.WordPro
ps.nWordStyle &= ~PVTWORD_STYLE_CROSSOUT; |
| 1849 » » » » » » » » bSet = TRUE; | 1849 » » » » » » » » bSet = true; |
| 1850 } | 1850 } |
| 1851 } | 1851 } |
| 1852 break; | 1852 break; |
| 1853 case EP_BOLD: | 1853 case EP_BOLD: |
| 1854 if (pWordProps->nWordStyle & PVT
WORD_STYLE_BOLD) | 1854 if (pWordProps->nWordStyle & PVT
WORD_STYLE_BOLD) |
| 1855 { | 1855 { |
| 1856 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_BOLD) == 0) | 1856 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_BOLD) == 0) |
| 1857 { | 1857 { |
| 1858 wordinfo.WordPro
ps.nWordStyle |= PVTWORD_STYLE_BOLD; | 1858 wordinfo.WordPro
ps.nWordStyle |= PVTWORD_STYLE_BOLD; |
| 1859 » » » » » » » » bSet = TRUE; | 1859 » » » » » » » » bSet = true; |
| 1860 } | 1860 } |
| 1861 } | 1861 } |
| 1862 else | 1862 else |
| 1863 { | 1863 { |
| 1864 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_BOLD) != 0) | 1864 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_BOLD) != 0) |
| 1865 { | 1865 { |
| 1866 wordinfo.WordPro
ps.nWordStyle &= ~PVTWORD_STYLE_BOLD; | 1866 wordinfo.WordPro
ps.nWordStyle &= ~PVTWORD_STYLE_BOLD; |
| 1867 » » » » » » » » bSet = TRUE; | 1867 » » » » » » » » bSet = true; |
| 1868 } | 1868 } |
| 1869 } | 1869 } |
| 1870 break; | 1870 break; |
| 1871 case EP_ITALIC: | 1871 case EP_ITALIC: |
| 1872 if (pWordProps->nWordStyle & PVT
WORD_STYLE_ITALIC) | 1872 if (pWordProps->nWordStyle & PVT
WORD_STYLE_ITALIC) |
| 1873 { | 1873 { |
| 1874 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_ITALIC) == 0) | 1874 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_ITALIC) == 0) |
| 1875 { | 1875 { |
| 1876 wordinfo.WordPro
ps.nWordStyle |= PVTWORD_STYLE_ITALIC; | 1876 wordinfo.WordPro
ps.nWordStyle |= PVTWORD_STYLE_ITALIC; |
| 1877 » » » » » » » » bSet = TRUE; | 1877 » » » » » » » » bSet = true; |
| 1878 } | 1878 } |
| 1879 } | 1879 } |
| 1880 else | 1880 else |
| 1881 { | 1881 { |
| 1882 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_ITALIC) != 0) | 1882 if ((wordinfo.WordProps.
nWordStyle & PVTWORD_STYLE_ITALIC) != 0) |
| 1883 { | 1883 { |
| 1884 wordinfo.WordPro
ps.nWordStyle &= ~PVTWORD_STYLE_ITALIC; | 1884 wordinfo.WordPro
ps.nWordStyle &= ~PVTWORD_STYLE_ITALIC; |
| 1885 » » » » » » » » bSet = TRUE; | 1885 » » » » » » » » bSet = true; |
| 1886 } | 1886 } |
| 1887 } | 1887 } |
| 1888 break; | 1888 break; |
| 1889 default: | 1889 default: |
| 1890 break; | 1890 break; |
| 1891 } | 1891 } |
| 1892 } | 1892 } |
| 1893 } | 1893 } |
| 1894 | 1894 |
| 1895 if (bSet) | 1895 if (bSet) |
| 1896 { | 1896 { |
| 1897 pIterator->SetWord(wordinfo); | 1897 pIterator->SetWord(wordinfo); |
| 1898 | 1898 |
| 1899 if (bAddUndo && m_bEnableUndo) | 1899 if (bAddUndo && m_bEnableUndo) |
| 1900 { | 1900 { |
| 1901 AddEditUndoItem(new CFXEU_SetWordProps | 1901 AddEditUndoItem(new CFXEU_SetWordProps |
| 1902 (this,place,eProps,OldWordinfo.W
ordProps,wordinfo.WordProps,wr)); | 1902 (this,place,eProps,OldWordinfo.W
ordProps,wordinfo.WordProps,wr)); |
| 1903 } | 1903 } |
| 1904 } | 1904 } |
| 1905 | 1905 |
| 1906 pIterator->SetAt(oldplace); | 1906 pIterator->SetAt(oldplace); |
| 1907 return bSet; | 1907 return bSet; |
| 1908 } | 1908 } |
| 1909 } | 1909 } |
| 1910 | 1910 |
| 1911 » return FALSE; | 1911 » return false; |
| 1912 } | 1912 } |
| 1913 | 1913 |
| 1914 void CFX_Edit::SetText(const FX_WCHAR* text,int32_t charset /*= DEFAULT_CHARSET*
/, | 1914 void CFX_Edit::SetText(const FX_WCHAR* text,int32_t charset /*= DEFAULT_CHARSET*
/, |
| 1915 const CPVT_SecProps * pSecProps
/*= NULL*/,const CPVT_WordProps * pWordProps /*= NULL*/) | 1915 const CPVT_SecProps * pSecProps
/*= NULL*/,const CPVT_WordProps * pWordProps /*= NULL*/) |
| 1916 { | 1916 { |
| 1917 » SetText(text,charset,pSecProps,pWordProps,TRUE,TRUE); | 1917 » SetText(text,charset,pSecProps,pWordProps,true,true); |
| 1918 } | 1918 } |
| 1919 | 1919 |
| 1920 FX_BOOL CFX_Edit::InsertWord(FX_WORD word, int32_t charset /*= DEFAULT_CHARSET*/
, const CPVT_WordProps * pWordProps /*= NULL*/) | 1920 bool CFX_Edit::InsertWord(FX_WORD word, int32_t charset /*= DEFAULT_CHARSET*/, c
onst CPVT_WordProps * pWordProps /*= NULL*/) |
| 1921 { | 1921 { |
| 1922 » return InsertWord(word,charset,pWordProps,TRUE,TRUE); | 1922 » return InsertWord(word,charset,pWordProps,true,true); |
| 1923 } | 1923 } |
| 1924 | 1924 |
| 1925 FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps /*= NULL*/,const
CPVT_WordProps * pWordProps /*= NULL*/) | 1925 bool CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps /*= NULL*/,const CPV
T_WordProps * pWordProps /*= NULL*/) |
| 1926 { | 1926 { |
| 1927 » return InsertReturn(pSecProps,pWordProps,TRUE,TRUE); | 1927 » return InsertReturn(pSecProps,pWordProps,true,true); |
| 1928 } | 1928 } |
| 1929 | 1929 |
| 1930 FX_BOOL CFX_Edit::Backspace() | 1930 bool CFX_Edit::Backspace() |
| 1931 { | 1931 { |
| 1932 » return Backspace(TRUE,TRUE); | 1932 » return Backspace(true,true); |
| 1933 } | 1933 } |
| 1934 | 1934 |
| 1935 FX_BOOL CFX_Edit::Delete() | 1935 bool CFX_Edit::Delete() |
| 1936 { | 1936 { |
| 1937 » return Delete(TRUE,TRUE); | 1937 » return Delete(true,true); |
| 1938 } | 1938 } |
| 1939 | 1939 |
| 1940 FX_BOOL CFX_Edit::Clear() | 1940 bool CFX_Edit::Clear() |
| 1941 { | 1941 { |
| 1942 » return Clear(TRUE,TRUE); | 1942 » return Clear(true,true); |
| 1943 } | 1943 } |
| 1944 | 1944 |
| 1945 FX_BOOL CFX_Edit::InsertText(const FX_WCHAR* text, int32_t charset /*= DEFAULT_C
HARSET*/, | 1945 bool CFX_Edit::InsertText(const FX_WCHAR* text, int32_t charset /*= DEFAULT_CHAR
SET*/, |
| 1946 const CPVT_SecPr
ops * pSecProps /*= NULL*/,const CPVT_WordProps * pWordProps /*= NULL*/) | 1946 const CPVT_SecPr
ops * pSecProps /*= NULL*/,const CPVT_WordProps * pWordProps /*= NULL*/) |
| 1947 { | 1947 { |
| 1948 » return InsertText(text,charset,pSecProps,pWordProps,TRUE,TRUE); | 1948 » return InsertText(text,charset,pSecProps,pWordProps,true,true); |
| 1949 } | 1949 } |
| 1950 | 1950 |
| 1951 FX_FLOAT CFX_Edit::GetFontSize() const | 1951 FX_FLOAT CFX_Edit::GetFontSize() const |
| 1952 { | 1952 { |
| 1953 return m_pVT->GetFontSize(); | 1953 return m_pVT->GetFontSize(); |
| 1954 } | 1954 } |
| 1955 | 1955 |
| 1956 FX_WORD CFX_Edit::GetPasswordChar() const | 1956 FX_WORD CFX_Edit::GetPasswordChar() const |
| 1957 { | 1957 { |
| 1958 return m_pVT->GetPasswordChar(); | 1958 return m_pVT->GetPasswordChar(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2059 void CFX_Edit::SetContentChanged() | 2059 void CFX_Edit::SetContentChanged() |
| 2060 { | 2060 { |
| 2061 if (m_bNotify && m_pNotify) | 2061 if (m_bNotify && m_pNotify) |
| 2062 { | 2062 { |
| 2063 CPDF_Rect rcContent = m_pVT->GetContentRect(); | 2063 CPDF_Rect rcContent = m_pVT->GetContentRect(); |
| 2064 if (rcContent.Width() != m_rcOldContent.Width() || | 2064 if (rcContent.Width() != m_rcOldContent.Width() || |
| 2065 rcContent.Height() != m_rcOldContent.Height()) | 2065 rcContent.Height() != m_rcOldContent.Height()) |
| 2066 { | 2066 { |
| 2067 if (!m_bNotifyFlag) | 2067 if (!m_bNotifyFlag) |
| 2068 { | 2068 { |
| 2069 » » » » m_bNotifyFlag = TRUE; | 2069 » » » » m_bNotifyFlag = true; |
| 2070 m_pNotify->IOnContentChange(rcContent); | 2070 m_pNotify->IOnContentChange(rcContent); |
| 2071 » » » » m_bNotifyFlag = FALSE; | 2071 » » » » m_bNotifyFlag = false; |
| 2072 } | 2072 } |
| 2073 m_rcOldContent = rcContent; | 2073 m_rcOldContent = rcContent; |
| 2074 } | 2074 } |
| 2075 } | 2075 } |
| 2076 } | 2076 } |
| 2077 | 2077 |
| 2078 void CFX_Edit::SelectAll() | 2078 void CFX_Edit::SelectAll() |
| 2079 { | 2079 { |
| 2080 if (m_pVT->IsValid()) | 2080 if (m_pVT->IsValid()) |
| 2081 { | 2081 { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2095 { | 2095 { |
| 2096 if (m_SelState.IsExist()) | 2096 if (m_SelState.IsExist()) |
| 2097 { | 2097 { |
| 2098 CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); | 2098 CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); |
| 2099 m_SelState.Default(); | 2099 m_SelState.Default(); |
| 2100 Refresh(RP_OPTIONAL,&wrTemp); | 2100 Refresh(RP_OPTIONAL,&wrTemp); |
| 2101 } | 2101 } |
| 2102 } | 2102 } |
| 2103 } | 2103 } |
| 2104 | 2104 |
| 2105 FX_BOOL»CFX_Edit::IsSelected() const | 2105 bool» CFX_Edit::IsSelected() const |
| 2106 { | 2106 { |
| 2107 return m_SelState.IsExist(); | 2107 return m_SelState.IsExist(); |
| 2108 } | 2108 } |
| 2109 | 2109 |
| 2110 CPDF_Point CFX_Edit::VTToEdit(const CPDF_Point & point) const | 2110 CPDF_Point CFX_Edit::VTToEdit(const CPDF_Point & point) const |
| 2111 { | 2111 { |
| 2112 CPDF_Rect rcContent = m_pVT->GetContentRect(); | 2112 CPDF_Rect rcContent = m_pVT->GetContentRect(); |
| 2113 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); | 2113 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); |
| 2114 | 2114 |
| 2115 FX_FLOAT fPadding = 0.0f; | 2115 FX_FLOAT fPadding = 0.0f; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2173 | 2173 |
| 2174 void CFX_Edit::SetScrollInfo() | 2174 void CFX_Edit::SetScrollInfo() |
| 2175 { | 2175 { |
| 2176 if (m_bNotify && m_pNotify) | 2176 if (m_bNotify && m_pNotify) |
| 2177 { | 2177 { |
| 2178 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); | 2178 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); |
| 2179 CPDF_Rect rcContent = m_pVT->GetContentRect(); | 2179 CPDF_Rect rcContent = m_pVT->GetContentRect(); |
| 2180 | 2180 |
| 2181 if (!m_bNotifyFlag) | 2181 if (!m_bNotifyFlag) |
| 2182 { | 2182 { |
| 2183 » » » m_bNotifyFlag = TRUE; | 2183 » » » m_bNotifyFlag = true; |
| 2184 m_pNotify->IOnSetScrollInfoX(rcPlate.left, rcPlate.right
, | 2184 m_pNotify->IOnSetScrollInfoX(rcPlate.left, rcPlate.right
, |
| 2185 rcContent.left,
rcContent.right, rcPlate.Width() / 3, rcPlate.Width()); | 2185 rcContent.left,
rcContent.right, rcPlate.Width() / 3, rcPlate.Width()); |
| 2186 | 2186 |
| 2187 m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top
, | 2187 m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top
, |
| 2188 rcContent.bottom, rcContent.top, rcPlate
.Height() / 3, rcPlate.Height()); | 2188 rcContent.bottom, rcContent.top, rcPlate
.Height() / 3, rcPlate.Height()); |
| 2189 » » » m_bNotifyFlag = FALSE; | 2189 » » » m_bNotifyFlag = false; |
| 2190 } | 2190 } |
| 2191 } | 2191 } |
| 2192 } | 2192 } |
| 2193 | 2193 |
| 2194 void CFX_Edit::SetScrollPosX(FX_FLOAT fx) | 2194 void CFX_Edit::SetScrollPosX(FX_FLOAT fx) |
| 2195 { | 2195 { |
| 2196 if (!m_bEnableScroll) return; | 2196 if (!m_bEnableScroll) return; |
| 2197 | 2197 |
| 2198 if (m_pVT->IsValid()) | 2198 if (m_pVT->IsValid()) |
| 2199 { | 2199 { |
| 2200 if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.x,fx)) | 2200 if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.x,fx)) |
| 2201 { | 2201 { |
| 2202 m_ptScrollPos.x = fx; | 2202 m_ptScrollPos.x = fx; |
| 2203 Refresh(RP_NOANALYSE); | 2203 Refresh(RP_NOANALYSE); |
| 2204 | 2204 |
| 2205 if (m_bNotify && m_pNotify) | 2205 if (m_bNotify && m_pNotify) |
| 2206 { | 2206 { |
| 2207 if (!m_bNotifyFlag) | 2207 if (!m_bNotifyFlag) |
| 2208 { | 2208 { |
| 2209 » » » » » m_bNotifyFlag = TRUE; | 2209 » » » » » m_bNotifyFlag = true; |
| 2210 m_pNotify->IOnSetScrollPosX(fx); | 2210 m_pNotify->IOnSetScrollPosX(fx); |
| 2211 » » » » » m_bNotifyFlag = FALSE; | 2211 » » » » » m_bNotifyFlag = false; |
| 2212 } | 2212 } |
| 2213 } | 2213 } |
| 2214 } | 2214 } |
| 2215 } | 2215 } |
| 2216 } | 2216 } |
| 2217 | 2217 |
| 2218 void CFX_Edit::SetScrollPosY(FX_FLOAT fy) | 2218 void CFX_Edit::SetScrollPosY(FX_FLOAT fy) |
| 2219 { | 2219 { |
| 2220 if (!m_bEnableScroll) return; | 2220 if (!m_bEnableScroll) return; |
| 2221 | 2221 |
| 2222 if (m_pVT->IsValid()) | 2222 if (m_pVT->IsValid()) |
| 2223 { | 2223 { |
| 2224 if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y,fy)) | 2224 if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y,fy)) |
| 2225 { | 2225 { |
| 2226 m_ptScrollPos.y = fy; | 2226 m_ptScrollPos.y = fy; |
| 2227 Refresh(RP_NOANALYSE); | 2227 Refresh(RP_NOANALYSE); |
| 2228 | 2228 |
| 2229 if (m_bNotify && m_pNotify) | 2229 if (m_bNotify && m_pNotify) |
| 2230 { | 2230 { |
| 2231 if (!m_bNotifyFlag) | 2231 if (!m_bNotifyFlag) |
| 2232 { | 2232 { |
| 2233 » » » » » m_bNotifyFlag = TRUE; | 2233 » » » » » m_bNotifyFlag = true; |
| 2234 m_pNotify->IOnSetScrollPosY(fy); | 2234 m_pNotify->IOnSetScrollPosY(fy); |
| 2235 » » » » » m_bNotifyFlag = FALSE; | 2235 » » » » » m_bNotifyFlag = false; |
| 2236 } | 2236 } |
| 2237 } | 2237 } |
| 2238 } | 2238 } |
| 2239 } | 2239 } |
| 2240 } | 2240 } |
| 2241 | 2241 |
| 2242 void CFX_Edit::SetScrollPos(const CPDF_Point & point) | 2242 void CFX_Edit::SetScrollPos(const CPDF_Point & point) |
| 2243 { | 2243 { |
| 2244 SetScrollPosX(point.x); | 2244 SetScrollPosX(point.x); |
| 2245 SetScrollPosY(point.y); | 2245 SetScrollPosY(point.y); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2393 // if (pRange1) RefreshPushRandomRects(*pRange1); | 2393 // if (pRange1) RefreshPushRandomRects(*pRange1); |
| 2394 // if (pRange2) RefreshPushRandomRects(*pRange2); | 2394 // if (pRange2) RefreshPushRandomRects(*pRange2); |
| 2395 // break; | 2395 // break; |
| 2396 // } | 2396 // } |
| 2397 // } | 2397 // } |
| 2398 | 2398 |
| 2399 if (m_bNotify && m_pNotify) | 2399 if (m_bNotify && m_pNotify) |
| 2400 { | 2400 { |
| 2401 if (!m_bNotifyFlag) | 2401 if (!m_bNotifyFlag) |
| 2402 { | 2402 { |
| 2403 » » » » m_bNotifyFlag = TRUE; | 2403 » » » » m_bNotifyFlag = true; |
| 2404 if (const CFX_Edit_RectArray * pRects = m_Refres
h.GetRefreshRects()) | 2404 if (const CFX_Edit_RectArray * pRects = m_Refres
h.GetRefreshRects()) |
| 2405 { | 2405 { |
| 2406 for (int32_t i = 0, sz = pRects->GetSize
(); i < sz; i++) | 2406 for (int32_t i = 0, sz = pRects->GetSize
(); i < sz; i++) |
| 2407 m_pNotify->IOnInvalidateRect(pRe
cts->GetAt(i)); | 2407 m_pNotify->IOnInvalidateRect(pRe
cts->GetAt(i)); |
| 2408 } | 2408 } |
| 2409 » » » » m_bNotifyFlag = FALSE; | 2409 » » » » m_bNotifyFlag = false; |
| 2410 } | 2410 } |
| 2411 } | 2411 } |
| 2412 | 2412 |
| 2413 m_Refresh.EndRefresh(); | 2413 m_Refresh.EndRefresh(); |
| 2414 } | 2414 } |
| 2415 } | 2415 } |
| 2416 | 2416 |
| 2417 void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange & wr) | 2417 void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange & wr) |
| 2418 { | 2418 { |
| 2419 if (m_pVT->IsValid()) | 2419 if (m_pVT->IsValid()) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2519 { | 2519 { |
| 2520 CPDF_Rect rcWord(wordinfo.ptWord.x, | 2520 CPDF_Rect rcWord(wordinfo.ptWord.x, |
| 2521 lineinfo
.ptLine.y + lineinfo.fLineDescent, | 2521 lineinfo
.ptLine.y + lineinfo.fLineDescent, |
| 2522 wordinfo
.ptWord.x + wordinfo.fWidth, | 2522 wordinfo
.ptWord.x + wordinfo.fWidth, |
| 2523 lineinfo
.ptLine.y + lineinfo.fLineAscent); | 2523 lineinfo
.ptLine.y + lineinfo.fLineAscent); |
| 2524 | 2524 |
| 2525 if (m_bNotify && m_pNotify) | 2525 if (m_bNotify && m_pNotify) |
| 2526 { | 2526 { |
| 2527 if (!m_bNotifyFlag) | 2527 if (!m_bNotifyFlag) |
| 2528 { | 2528 { |
| 2529 » » » » » » m_bNotifyFlag = TRUE; | 2529 » » » » » » m_bNotifyFlag = true; |
| 2530 CPDF_Rect rcRefresh = VTToEdit(r
cWord); | 2530 CPDF_Rect rcRefresh = VTToEdit(r
cWord); |
| 2531 m_pNotify->IOnInvalidateRect(&rc
Refresh); | 2531 m_pNotify->IOnInvalidateRect(&rc
Refresh); |
| 2532 » » » » » » m_bNotifyFlag = FALSE; | 2532 » » » » » » m_bNotifyFlag = false; |
| 2533 } | 2533 } |
| 2534 } | 2534 } |
| 2535 } | 2535 } |
| 2536 else | 2536 else |
| 2537 { | 2537 { |
| 2538 CPDF_Rect rcLine(lineinfo.ptLine.x, | 2538 CPDF_Rect rcLine(lineinfo.ptLine.x, |
| 2539 lineinfo
.ptLine.y + lineinfo.fLineDescent, | 2539 lineinfo
.ptLine.y + lineinfo.fLineDescent, |
| 2540 lineinfo
.ptLine.x + lineinfo.fLineWidth, | 2540 lineinfo
.ptLine.x + lineinfo.fLineWidth, |
| 2541 lineinfo
.ptLine.y + lineinfo.fLineAscent); | 2541 lineinfo
.ptLine.y + lineinfo.fLineAscent); |
| 2542 | 2542 |
| 2543 if (m_bNotify && m_pNotify) | 2543 if (m_bNotify && m_pNotify) |
| 2544 { | 2544 { |
| 2545 if (!m_bNotifyFlag) | 2545 if (!m_bNotifyFlag) |
| 2546 { | 2546 { |
| 2547 » » » » » » m_bNotifyFlag = TRUE; | 2547 » » » » » » m_bNotifyFlag = true; |
| 2548 CPDF_Rect rcRefresh = VTToEdit(r
cLine); | 2548 CPDF_Rect rcRefresh = VTToEdit(r
cLine); |
| 2549 m_pNotify->IOnInvalidateRect(&rc
Refresh); | 2549 m_pNotify->IOnInvalidateRect(&rc
Refresh); |
| 2550 » » » » » » m_bNotifyFlag = FALSE; | 2550 » » » » » » m_bNotifyFlag = false; |
| 2551 } | 2551 } |
| 2552 } | 2552 } |
| 2553 | 2553 |
| 2554 pIterator->NextLine(); | 2554 pIterator->NextLine(); |
| 2555 } | 2555 } |
| 2556 } | 2556 } |
| 2557 } | 2557 } |
| 2558 } | 2558 } |
| 2559 | 2559 |
| 2560 void CFX_Edit::SetCaret(const CPVT_WordPlace & place) | 2560 void CFX_Edit::SetCaret(const CPVT_WordPlace & place) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2585 } | 2585 } |
| 2586 else if (pIterator->GetLine(line)) | 2586 else if (pIterator->GetLine(line)) |
| 2587 { | 2587 { |
| 2588 ptHead.x = line.ptLine.x; | 2588 ptHead.x = line.ptLine.x; |
| 2589 ptHead.y = line.ptLine.y + line.fLineAsc
ent; | 2589 ptHead.y = line.ptLine.y + line.fLineAsc
ent; |
| 2590 ptFoot.x = line.ptLine.x; | 2590 ptFoot.x = line.ptLine.x; |
| 2591 ptFoot.y = line.ptLine.y + line.fLineDes
cent; | 2591 ptFoot.y = line.ptLine.y + line.fLineDes
cent; |
| 2592 } | 2592 } |
| 2593 } | 2593 } |
| 2594 | 2594 |
| 2595 » » » m_bNotifyFlag = TRUE; | 2595 » » » m_bNotifyFlag = true; |
| 2596 m_pNotify->IOnSetCaret(!m_SelState.IsExist(),VTToEdit(pt
Head),VTToEdit(ptFoot), m_wpCaret); | 2596 m_pNotify->IOnSetCaret(!m_SelState.IsExist(),VTToEdit(pt
Head),VTToEdit(ptFoot), m_wpCaret); |
| 2597 » » » m_bNotifyFlag = FALSE; | 2597 » » » m_bNotifyFlag = false; |
| 2598 } | 2598 } |
| 2599 } | 2599 } |
| 2600 | 2600 |
| 2601 SetCaretChange(); | 2601 SetCaretChange(); |
| 2602 } | 2602 } |
| 2603 | 2603 |
| 2604 void CFX_Edit::SetCaretChange() | 2604 void CFX_Edit::SetCaretChange() |
| 2605 { | 2605 { |
| 2606 if (m_wpCaret == m_wpOldCaret) return; | 2606 if (m_wpCaret == m_wpOldCaret) return; |
| 2607 | 2607 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2623 } | 2623 } |
| 2624 | 2624 |
| 2625 if (pIterator->GetWord(word)) | 2625 if (pIterator->GetWord(word)) |
| 2626 { | 2626 { |
| 2627 WordProps = word.WordProps; | 2627 WordProps = word.WordProps; |
| 2628 } | 2628 } |
| 2629 } | 2629 } |
| 2630 | 2630 |
| 2631 if (!m_bNotifyFlag) | 2631 if (!m_bNotifyFlag) |
| 2632 { | 2632 { |
| 2633 » » » m_bNotifyFlag = TRUE; | 2633 » » » m_bNotifyFlag = true; |
| 2634 m_pNotify->IOnCaretChange(SecProps,WordProps); | 2634 m_pNotify->IOnCaretChange(SecProps,WordProps); |
| 2635 » » » m_bNotifyFlag = FALSE; | 2635 » » » m_bNotifyFlag = false; |
| 2636 } | 2636 } |
| 2637 } | 2637 } |
| 2638 } | 2638 } |
| 2639 | 2639 |
| 2640 void CFX_Edit::SetCaret(int32_t nPos) | 2640 void CFX_Edit::SetCaret(int32_t nPos) |
| 2641 { | 2641 { |
| 2642 if (m_pVT->IsValid()) | 2642 if (m_pVT->IsValid()) |
| 2643 { | 2643 { |
| 2644 SelectNone(); | 2644 SelectNone(); |
| 2645 SetCaret(m_pVT->WordIndexToWordPlace(nPos)); | 2645 SetCaret(m_pVT->WordIndexToWordPlace(nPos)); |
| 2646 m_SelState.Set(m_wpCaret,m_wpCaret); | 2646 m_SelState.Set(m_wpCaret,m_wpCaret); |
| 2647 | 2647 |
| 2648 ScrollToCaret(); | 2648 ScrollToCaret(); |
| 2649 SetCaretOrigin(); | 2649 SetCaretOrigin(); |
| 2650 SetCaretInfo(); | 2650 SetCaretInfo(); |
| 2651 } | 2651 } |
| 2652 } | 2652 } |
| 2653 | 2653 |
| 2654 void CFX_Edit::OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl
) | 2654 void CFX_Edit::OnMouseDown(const CPDF_Point & point,bool bShift,bool bCtrl) |
| 2655 { | 2655 { |
| 2656 if (m_pVT->IsValid()) | 2656 if (m_pVT->IsValid()) |
| 2657 { | 2657 { |
| 2658 SelectNone(); | 2658 SelectNone(); |
| 2659 SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); | 2659 SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); |
| 2660 m_SelState.Set(m_wpCaret,m_wpCaret); | 2660 m_SelState.Set(m_wpCaret,m_wpCaret); |
| 2661 | 2661 |
| 2662 ScrollToCaret(); | 2662 ScrollToCaret(); |
| 2663 SetCaretOrigin(); | 2663 SetCaretOrigin(); |
| 2664 SetCaretInfo(); | 2664 SetCaretInfo(); |
| 2665 } | 2665 } |
| 2666 } | 2666 } |
| 2667 | 2667 |
| 2668 void CFX_Edit::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl
) | 2668 void CFX_Edit::OnMouseMove(const CPDF_Point & point,bool bShift,bool bCtrl) |
| 2669 { | 2669 { |
| 2670 if (m_pVT->IsValid()) | 2670 if (m_pVT->IsValid()) |
| 2671 { | 2671 { |
| 2672 SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); | 2672 SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); |
| 2673 | 2673 |
| 2674 if (m_wpCaret != m_wpOldCaret) | 2674 if (m_wpCaret != m_wpOldCaret) |
| 2675 { | 2675 { |
| 2676 m_SelState.SetEndPos(m_wpCaret); | 2676 m_SelState.SetEndPos(m_wpCaret); |
| 2677 | 2677 |
| 2678 ScrollToCaret(); | 2678 ScrollToCaret(); |
| 2679 CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); | 2679 CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); |
| 2680 Refresh(RP_OPTIONAL,&wr); | 2680 Refresh(RP_OPTIONAL,&wr); |
| 2681 SetCaretOrigin(); | 2681 SetCaretOrigin(); |
| 2682 SetCaretInfo(); | 2682 SetCaretInfo(); |
| 2683 } | 2683 } |
| 2684 } | 2684 } |
| 2685 } | 2685 } |
| 2686 | 2686 |
| 2687 void CFX_Edit::OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) | 2687 void CFX_Edit::OnVK_UP(bool bShift,bool bCtrl) |
| 2688 { | 2688 { |
| 2689 if (m_pVT->IsValid()) | 2689 if (m_pVT->IsValid()) |
| 2690 { | 2690 { |
| 2691 SetCaret(m_pVT->GetUpWordPlace(m_wpCaret,m_ptCaret)); | 2691 SetCaret(m_pVT->GetUpWordPlace(m_wpCaret,m_ptCaret)); |
| 2692 | 2692 |
| 2693 if (bShift) | 2693 if (bShift) |
| 2694 { | 2694 { |
| 2695 if (m_SelState.IsExist()) | 2695 if (m_SelState.IsExist()) |
| 2696 m_SelState.SetEndPos(m_wpCaret); | 2696 m_SelState.SetEndPos(m_wpCaret); |
| 2697 else | 2697 else |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2708 else | 2708 else |
| 2709 { | 2709 { |
| 2710 SelectNone(); | 2710 SelectNone(); |
| 2711 | 2711 |
| 2712 ScrollToCaret(); | 2712 ScrollToCaret(); |
| 2713 SetCaretInfo(); | 2713 SetCaretInfo(); |
| 2714 } | 2714 } |
| 2715 } | 2715 } |
| 2716 } | 2716 } |
| 2717 | 2717 |
| 2718 void CFX_Edit::OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) | 2718 void CFX_Edit::OnVK_DOWN(bool bShift,bool bCtrl) |
| 2719 { | 2719 { |
| 2720 if (m_pVT->IsValid()) | 2720 if (m_pVT->IsValid()) |
| 2721 { | 2721 { |
| 2722 SetCaret(m_pVT->GetDownWordPlace(m_wpCaret,m_ptCaret)); | 2722 SetCaret(m_pVT->GetDownWordPlace(m_wpCaret,m_ptCaret)); |
| 2723 | 2723 |
| 2724 if (bShift) | 2724 if (bShift) |
| 2725 { | 2725 { |
| 2726 if (m_SelState.IsExist()) | 2726 if (m_SelState.IsExist()) |
| 2727 m_SelState.SetEndPos(m_wpCaret); | 2727 m_SelState.SetEndPos(m_wpCaret); |
| 2728 else | 2728 else |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2739 else | 2739 else |
| 2740 { | 2740 { |
| 2741 SelectNone(); | 2741 SelectNone(); |
| 2742 | 2742 |
| 2743 ScrollToCaret(); | 2743 ScrollToCaret(); |
| 2744 SetCaretInfo(); | 2744 SetCaretInfo(); |
| 2745 } | 2745 } |
| 2746 } | 2746 } |
| 2747 } | 2747 } |
| 2748 | 2748 |
| 2749 void CFX_Edit::OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) | 2749 void CFX_Edit::OnVK_LEFT(bool bShift,bool bCtrl) |
| 2750 { | 2750 { |
| 2751 if (m_pVT->IsValid()) | 2751 if (m_pVT->IsValid()) |
| 2752 { | 2752 { |
| 2753 if (bShift) | 2753 if (bShift) |
| 2754 { | 2754 { |
| 2755 if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) && | 2755 if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) && |
| 2756 m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCar
et)) | 2756 m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCar
et)) |
| 2757 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); | 2757 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); |
| 2758 | 2758 |
| 2759 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); | 2759 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2793 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); | 2793 SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); |
| 2794 | 2794 |
| 2795 ScrollToCaret(); | 2795 ScrollToCaret(); |
| 2796 SetCaretOrigin(); | 2796 SetCaretOrigin(); |
| 2797 SetCaretInfo(); | 2797 SetCaretInfo(); |
| 2798 } | 2798 } |
| 2799 } | 2799 } |
| 2800 } | 2800 } |
| 2801 } | 2801 } |
| 2802 | 2802 |
| 2803 void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) | 2803 void CFX_Edit::OnVK_RIGHT(bool bShift,bool bCtrl) |
| 2804 { | 2804 { |
| 2805 if (m_pVT->IsValid()) | 2805 if (m_pVT->IsValid()) |
| 2806 { | 2806 { |
| 2807 if (bShift) | 2807 if (bShift) |
| 2808 { | 2808 { |
| 2809 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); | 2809 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); |
| 2810 | 2810 |
| 2811 if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) && | 2811 if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) && |
| 2812 m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret
)) | 2812 m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret
)) |
| 2813 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); | 2813 SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2847 SetCaret(m_pVT->GetNextWordPlace(m_wpCar
et)); | 2847 SetCaret(m_pVT->GetNextWordPlace(m_wpCar
et)); |
| 2848 | 2848 |
| 2849 ScrollToCaret(); | 2849 ScrollToCaret(); |
| 2850 SetCaretOrigin(); | 2850 SetCaretOrigin(); |
| 2851 SetCaretInfo(); | 2851 SetCaretInfo(); |
| 2852 } | 2852 } |
| 2853 } | 2853 } |
| 2854 } | 2854 } |
| 2855 } | 2855 } |
| 2856 | 2856 |
| 2857 void CFX_Edit::OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) | 2857 void CFX_Edit::OnVK_HOME(bool bShift,bool bCtrl) |
| 2858 { | 2858 { |
| 2859 if (m_pVT->IsValid()) | 2859 if (m_pVT->IsValid()) |
| 2860 { | 2860 { |
| 2861 if (bShift) | 2861 if (bShift) |
| 2862 { | 2862 { |
| 2863 if (bCtrl) | 2863 if (bCtrl) |
| 2864 SetCaret(m_pVT->GetBeginWordPlace()); | 2864 SetCaret(m_pVT->GetBeginWordPlace()); |
| 2865 else | 2865 else |
| 2866 SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); | 2866 SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); |
| 2867 | 2867 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2896 SetCaret(m_pVT->GetLineBeginPlace(m_wpCa
ret)); | 2896 SetCaret(m_pVT->GetLineBeginPlace(m_wpCa
ret)); |
| 2897 | 2897 |
| 2898 ScrollToCaret(); | 2898 ScrollToCaret(); |
| 2899 SetCaretOrigin(); | 2899 SetCaretOrigin(); |
| 2900 SetCaretInfo(); | 2900 SetCaretInfo(); |
| 2901 } | 2901 } |
| 2902 } | 2902 } |
| 2903 } | 2903 } |
| 2904 } | 2904 } |
| 2905 | 2905 |
| 2906 void CFX_Edit::OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) | 2906 void CFX_Edit::OnVK_END(bool bShift,bool bCtrl) |
| 2907 { | 2907 { |
| 2908 if (m_pVT->IsValid()) | 2908 if (m_pVT->IsValid()) |
| 2909 { | 2909 { |
| 2910 if (bShift) | 2910 if (bShift) |
| 2911 { | 2911 { |
| 2912 if (bCtrl) | 2912 if (bCtrl) |
| 2913 SetCaret(m_pVT->GetEndWordPlace()); | 2913 SetCaret(m_pVT->GetEndWordPlace()); |
| 2914 else | 2914 else |
| 2915 SetCaret(m_pVT->GetLineEndPlace(m_wpCaret)); | 2915 SetCaret(m_pVT->GetLineEndPlace(m_wpCaret)); |
| 2916 | 2916 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2946 | 2946 |
| 2947 ScrollToCaret(); | 2947 ScrollToCaret(); |
| 2948 SetCaretOrigin(); | 2948 SetCaretOrigin(); |
| 2949 SetCaretInfo(); | 2949 SetCaretInfo(); |
| 2950 } | 2950 } |
| 2951 } | 2951 } |
| 2952 } | 2952 } |
| 2953 } | 2953 } |
| 2954 | 2954 |
| 2955 void CFX_Edit::SetText(const FX_WCHAR* text,int32_t charset, | 2955 void CFX_Edit::SetText(const FX_WCHAR* text,int32_t charset, |
| 2956 » » » » » » const CPVT_SecProps * pSecProps,
const CPVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) | 2956 » » » » » » const CPVT_SecProps * pSecProps,
const CPVT_WordProps * pWordProps, bool bAddUndo, bool bPaint) |
| 2957 { | 2957 { |
| 2958 Empty(); | 2958 Empty(); |
| 2959 DoInsertText(CPVT_WordPlace(0,0,-1), text, charset, pSecProps, pWordProp
s); | 2959 DoInsertText(CPVT_WordPlace(0,0,-1), text, charset, pSecProps, pWordProp
s); |
| 2960 if (bPaint) Paint(); | 2960 if (bPaint) Paint(); |
| 2961 if (m_bOprNotify && m_pOprNotify) | 2961 if (m_bOprNotify && m_pOprNotify) |
| 2962 m_pOprNotify->OnSetText(m_wpCaret, m_wpOldCaret); | 2962 m_pOprNotify->OnSetText(m_wpCaret, m_wpOldCaret); |
| 2963 //if (bAddUndo) | 2963 //if (bAddUndo) |
| 2964 } | 2964 } |
| 2965 | 2965 |
| 2966 FX_BOOL CFX_Edit::InsertWord(FX_WORD word, int32_t charset, const CPVT_WordProps
* pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) | 2966 bool CFX_Edit::InsertWord(FX_WORD word, int32_t charset, const CPVT_WordProps *
pWordProps, bool bAddUndo, bool bPaint) |
| 2967 { | 2967 { |
| 2968 » if (IsTextOverflow()) return FALSE; | 2968 » if (IsTextOverflow()) return false; |
| 2969 | 2969 |
| 2970 if (m_pVT->IsValid()) | 2970 if (m_pVT->IsValid()) |
| 2971 { | 2971 { |
| 2972 m_pVT->UpdateWordPlace(m_wpCaret); | 2972 m_pVT->UpdateWordPlace(m_wpCaret); |
| 2973 | 2973 |
| 2974 SetCaret(m_pVT->InsertWord(m_wpCaret,word,GetCharSetFromUnicode(
word, charset),pWordProps)); | 2974 SetCaret(m_pVT->InsertWord(m_wpCaret,word,GetCharSetFromUnicode(
word, charset),pWordProps)); |
| 2975 m_SelState.Set(m_wpCaret,m_wpCaret); | 2975 m_SelState.Set(m_wpCaret,m_wpCaret); |
| 2976 | 2976 |
| 2977 if (m_wpCaret != m_wpOldCaret) | 2977 if (m_wpCaret != m_wpOldCaret) |
| 2978 { | 2978 { |
| 2979 if (bAddUndo && m_bEnableUndo) | 2979 if (bAddUndo && m_bEnableUndo) |
| 2980 { | 2980 { |
| 2981 AddEditUndoItem(new CFXEU_InsertWord(this,m_wpOl
dCaret,m_wpCaret,word,charset,pWordProps)); | 2981 AddEditUndoItem(new CFXEU_InsertWord(this,m_wpOl
dCaret,m_wpCaret,word,charset,pWordProps)); |
| 2982 } | 2982 } |
| 2983 | 2983 |
| 2984 if (bPaint) | 2984 if (bPaint) |
| 2985 PaintInsertText(m_wpOldCaret, m_wpCaret); | 2985 PaintInsertText(m_wpOldCaret, m_wpCaret); |
| 2986 | 2986 |
| 2987 if (m_bOprNotify && m_pOprNotify) | 2987 if (m_bOprNotify && m_pOprNotify) |
| 2988 m_pOprNotify->OnInsertWord(m_wpCaret, m_wpOldCar
et); | 2988 m_pOprNotify->OnInsertWord(m_wpCaret, m_wpOldCar
et); |
| 2989 | 2989 |
| 2990 » » » return TRUE; | 2990 » » » return true; |
| 2991 } | 2991 } |
| 2992 } | 2992 } |
| 2993 | 2993 |
| 2994 » return FALSE; | 2994 » return false; |
| 2995 } | 2995 } |
| 2996 | 2996 |
| 2997 FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordPr
ops * pWordProps, | 2997 bool CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordProps
* pWordProps, |
| 2998 » » » » » » » FX_BOOL bAddUndo, FX_
BOOL bPaint) | 2998 » » » » » » » bool bAddUndo, bool b
Paint) |
| 2999 { | 2999 { |
| 3000 » if (IsTextOverflow()) return FALSE; | 3000 » if (IsTextOverflow()) return false; |
| 3001 | 3001 |
| 3002 if (m_pVT->IsValid()) | 3002 if (m_pVT->IsValid()) |
| 3003 { | 3003 { |
| 3004 m_pVT->UpdateWordPlace(m_wpCaret); | 3004 m_pVT->UpdateWordPlace(m_wpCaret); |
| 3005 SetCaret(m_pVT->InsertSection(m_wpCaret,pSecProps,pWordProps)); | 3005 SetCaret(m_pVT->InsertSection(m_wpCaret,pSecProps,pWordProps)); |
| 3006 m_SelState.Set(m_wpCaret,m_wpCaret); | 3006 m_SelState.Set(m_wpCaret,m_wpCaret); |
| 3007 | 3007 |
| 3008 if (m_wpCaret != m_wpOldCaret) | 3008 if (m_wpCaret != m_wpOldCaret) |
| 3009 { | 3009 { |
| 3010 if (bAddUndo && m_bEnableUndo) | 3010 if (bAddUndo && m_bEnableUndo) |
| 3011 { | 3011 { |
| 3012 AddEditUndoItem(new CFXEU_InsertReturn(this,m_wp
OldCaret,m_wpCaret,pSecProps,pWordProps)); | 3012 AddEditUndoItem(new CFXEU_InsertReturn(this,m_wp
OldCaret,m_wpCaret,pSecProps,pWordProps)); |
| 3013 } | 3013 } |
| 3014 | 3014 |
| 3015 if (bPaint) | 3015 if (bPaint) |
| 3016 { | 3016 { |
| 3017 RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpC
aret)); | 3017 RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpC
aret)); |
| 3018 ScrollToCaret(); | 3018 ScrollToCaret(); |
| 3019 CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRa
nge().EndPos); | 3019 CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRa
nge().EndPos); |
| 3020 Refresh(RP_ANALYSE, &wr); | 3020 Refresh(RP_ANALYSE, &wr); |
| 3021 SetCaretOrigin(); | 3021 SetCaretOrigin(); |
| 3022 SetCaretInfo(); | 3022 SetCaretInfo(); |
| 3023 } | 3023 } |
| 3024 | 3024 |
| 3025 if (m_bOprNotify && m_pOprNotify) | 3025 if (m_bOprNotify && m_pOprNotify) |
| 3026 m_pOprNotify->OnInsertReturn(m_wpCaret, m_wpOldC
aret); | 3026 m_pOprNotify->OnInsertReturn(m_wpCaret, m_wpOldC
aret); |
| 3027 | 3027 |
| 3028 » » » return TRUE; | 3028 » » » return true; |
| 3029 } | 3029 } |
| 3030 } | 3030 } |
| 3031 | 3031 |
| 3032 » return FALSE; | 3032 » return false; |
| 3033 } | 3033 } |
| 3034 | 3034 |
| 3035 FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) | 3035 bool CFX_Edit::Backspace(bool bAddUndo, bool bPaint) |
| 3036 { | 3036 { |
| 3037 if (m_pVT->IsValid()) | 3037 if (m_pVT->IsValid()) |
| 3038 { | 3038 { |
| 3039 » » if (m_wpCaret == m_pVT->GetBeginWordPlace()) return FALSE; | 3039 » » if (m_wpCaret == m_pVT->GetBeginWordPlace()) return false; |
| 3040 | 3040 |
| 3041 CPVT_Section section; | 3041 CPVT_Section section; |
| 3042 CPVT_Word word; | 3042 CPVT_Word word; |
| 3043 | 3043 |
| 3044 if (bAddUndo) | 3044 if (bAddUndo) |
| 3045 { | 3045 { |
| 3046 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetI
terator()) | 3046 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetI
terator()) |
| 3047 { | 3047 { |
| 3048 pIterator->SetAt(m_wpCaret); | 3048 pIterator->SetAt(m_wpCaret); |
| 3049 pIterator->GetSection(section); | 3049 pIterator->GetSection(section); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3082 | 3082 |
| 3083 Refresh(RP_ANALYSE, &wr); | 3083 Refresh(RP_ANALYSE, &wr); |
| 3084 | 3084 |
| 3085 SetCaretOrigin(); | 3085 SetCaretOrigin(); |
| 3086 SetCaretInfo(); | 3086 SetCaretInfo(); |
| 3087 } | 3087 } |
| 3088 | 3088 |
| 3089 if (m_bOprNotify && m_pOprNotify) | 3089 if (m_bOprNotify && m_pOprNotify) |
| 3090 m_pOprNotify->OnBackSpace(m_wpCaret, m_wpOldCare
t); | 3090 m_pOprNotify->OnBackSpace(m_wpCaret, m_wpOldCare
t); |
| 3091 | 3091 |
| 3092 » » » return TRUE; | 3092 » » » return true; |
| 3093 } | 3093 } |
| 3094 } | 3094 } |
| 3095 | 3095 |
| 3096 » return FALSE; | 3096 » return false; |
| 3097 } | 3097 } |
| 3098 | 3098 |
| 3099 FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) | 3099 bool CFX_Edit::Delete(bool bAddUndo, bool bPaint) |
| 3100 { | 3100 { |
| 3101 if (m_pVT->IsValid()) | 3101 if (m_pVT->IsValid()) |
| 3102 { | 3102 { |
| 3103 » » if (m_wpCaret == m_pVT->GetEndWordPlace()) return FALSE; | 3103 » » if (m_wpCaret == m_pVT->GetEndWordPlace()) return false; |
| 3104 | 3104 |
| 3105 CPVT_Section section; | 3105 CPVT_Section section; |
| 3106 CPVT_Word word; | 3106 CPVT_Word word; |
| 3107 | 3107 |
| 3108 if (bAddUndo) | 3108 if (bAddUndo) |
| 3109 { | 3109 { |
| 3110 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetI
terator()) | 3110 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetI
terator()) |
| 3111 { | 3111 { |
| 3112 pIterator->SetAt(m_pVT->GetNextWordPlace(m_wpCar
et)); | 3112 pIterator->SetAt(m_pVT->GetNextWordPlace(m_wpCar
et)); |
| 3113 pIterator->GetSection(section); | 3113 pIterator->GetSection(section); |
| 3114 pIterator->GetWord(word); | 3114 pIterator->GetWord(word); |
| 3115 } | 3115 } |
| 3116 } | 3116 } |
| 3117 | 3117 |
| 3118 m_pVT->UpdateWordPlace(m_wpCaret); | 3118 m_pVT->UpdateWordPlace(m_wpCaret); |
| 3119 » » FX_BOOL bSecEnd = (m_wpCaret == m_pVT->GetSectionEndPlace(m_wpCa
ret)); | 3119 » » bool bSecEnd = (m_wpCaret == m_pVT->GetSectionEndPlace(m_wpCaret
)); |
| 3120 | 3120 |
| 3121 SetCaret(m_pVT->DeleteWord(m_wpCaret)); | 3121 SetCaret(m_pVT->DeleteWord(m_wpCaret)); |
| 3122 m_SelState.Set(m_wpCaret,m_wpCaret); | 3122 m_SelState.Set(m_wpCaret,m_wpCaret); |
| 3123 | 3123 |
| 3124 if (bAddUndo && m_bEnableUndo) | 3124 if (bAddUndo && m_bEnableUndo) |
| 3125 { | 3125 { |
| 3126 if (bSecEnd) | 3126 if (bSecEnd) |
| 3127 AddEditUndoItem(new CFXEU_Delete(this,m_wpOldCar
et,m_wpCaret,word.Word,word.nCharset, | 3127 AddEditUndoItem(new CFXEU_Delete(this,m_wpOldCar
et,m_wpCaret,word.Word,word.nCharset, |
| 3128 section.SecProps,section.WordProps,bSecE
nd)); | 3128 section.SecProps,section.WordProps,bSecE
nd)); |
| 3129 else | 3129 else |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3146 | 3146 |
| 3147 Refresh(RP_ANALYSE, &wr); | 3147 Refresh(RP_ANALYSE, &wr); |
| 3148 | 3148 |
| 3149 SetCaretOrigin(); | 3149 SetCaretOrigin(); |
| 3150 SetCaretInfo(); | 3150 SetCaretInfo(); |
| 3151 } | 3151 } |
| 3152 | 3152 |
| 3153 if (m_bOprNotify && m_pOprNotify) | 3153 if (m_bOprNotify && m_pOprNotify) |
| 3154 m_pOprNotify->OnDelete(m_wpCaret, m_wpOldCaret); | 3154 m_pOprNotify->OnDelete(m_wpCaret, m_wpOldCaret); |
| 3155 | 3155 |
| 3156 » » return TRUE; | 3156 » » return true; |
| 3157 } | 3157 } |
| 3158 | 3158 |
| 3159 » return FALSE; | 3159 » return false; |
| 3160 } | 3160 } |
| 3161 | 3161 |
| 3162 FX_BOOL»CFX_Edit::Empty() | 3162 bool» CFX_Edit::Empty() |
| 3163 { | 3163 { |
| 3164 if (m_pVT->IsValid()) | 3164 if (m_pVT->IsValid()) |
| 3165 { | 3165 { |
| 3166 m_pVT->DeleteWords(GetWholeWordRange()); | 3166 m_pVT->DeleteWords(GetWholeWordRange()); |
| 3167 SetCaret(m_pVT->GetBeginWordPlace()); | 3167 SetCaret(m_pVT->GetBeginWordPlace()); |
| 3168 | 3168 |
| 3169 » » return TRUE; | 3169 » » return true; |
| 3170 } | 3170 } |
| 3171 | 3171 |
| 3172 » return FALSE; | 3172 » return false; |
| 3173 } | 3173 } |
| 3174 | 3174 |
| 3175 FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) | 3175 bool CFX_Edit::Clear(bool bAddUndo, bool bPaint) |
| 3176 { | 3176 { |
| 3177 if (m_pVT->IsValid()) | 3177 if (m_pVT->IsValid()) |
| 3178 { | 3178 { |
| 3179 if (m_SelState.IsExist()) | 3179 if (m_SelState.IsExist()) |
| 3180 { | 3180 { |
| 3181 CPVT_WordRange range = m_SelState.ConvertToWordRange(); | 3181 CPVT_WordRange range = m_SelState.ConvertToWordRange(); |
| 3182 | 3182 |
| 3183 if (bAddUndo && m_bEnableUndo) | 3183 if (bAddUndo && m_bEnableUndo) |
| 3184 { | 3184 { |
| 3185 if (m_pVT->IsRichText()) | 3185 if (m_pVT->IsRichText()) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3204 if (pIterator->G
etSection(secinfo)) | 3204 if (pIterator->G
etSection(secinfo)) |
| 3205 { | 3205 { |
| 3206 AddEditU
ndoItem(new CFXEU_ClearRich(this,oldplace,place,range,wordinfo.Word, | 3206 AddEditU
ndoItem(new CFXEU_ClearRich(this,oldplace,place,range,wordinfo.Word, |
| 3207
wordinfo.nCharset,secinfo.SecProps,secinfo.WordProps)); | 3207
wordinfo.nCharset,secinfo.SecProps,secinfo.WordProps)); |
| 3208 } | 3208 } |
| 3209 } | 3209 } |
| 3210 else | 3210 else |
| 3211 { | 3211 { |
| 3212 if (pIterator->G
etWord(wordinfo)) | 3212 if (pIterator->G
etWord(wordinfo)) |
| 3213 { | 3213 { |
| 3214 » » » » » » » » » oldplace
= m_pVT->AjustLineHeader(oldplace,TRUE); | 3214 » » » » » » » » » oldplace
= m_pVT->AjustLineHeader(oldplace,true); |
| 3215 » » » » » » » » » place =
m_pVT->AjustLineHeader(place,TRUE); | 3215 » » » » » » » » » place =
m_pVT->AjustLineHeader(place,true); |
| 3216 | 3216 |
| 3217 AddEditU
ndoItem(new CFXEU_ClearRich(this,oldplace,place,range,wordinfo.Word, | 3217 AddEditU
ndoItem(new CFXEU_ClearRich(this,oldplace,place,range,wordinfo.Word, |
| 3218
wordinfo.nCharset,secinfo.SecProps,wordinfo.WordProps)); | 3218
wordinfo.nCharset,secinfo.SecProps,wordinfo.WordProps)); |
| 3219 } | 3219 } |
| 3220 } | 3220 } |
| 3221 }while (pIterator->PrevWord()); | 3221 }while (pIterator->PrevWord()); |
| 3222 } | 3222 } |
| 3223 EndGroupUndo(); | 3223 EndGroupUndo(); |
| 3224 } | 3224 } |
| 3225 else | 3225 else |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3240 CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRa
nge().EndPos); | 3240 CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRa
nge().EndPos); |
| 3241 Refresh(RP_ANALYSE, &wr); | 3241 Refresh(RP_ANALYSE, &wr); |
| 3242 | 3242 |
| 3243 SetCaretOrigin(); | 3243 SetCaretOrigin(); |
| 3244 SetCaretInfo(); | 3244 SetCaretInfo(); |
| 3245 } | 3245 } |
| 3246 | 3246 |
| 3247 if (m_bOprNotify && m_pOprNotify) | 3247 if (m_bOprNotify && m_pOprNotify) |
| 3248 m_pOprNotify->OnClear(m_wpCaret, m_wpOldCaret); | 3248 m_pOprNotify->OnClear(m_wpCaret, m_wpOldCaret); |
| 3249 | 3249 |
| 3250 » » » return TRUE; | 3250 » » » return true; |
| 3251 } | 3251 } |
| 3252 } | 3252 } |
| 3253 | 3253 |
| 3254 » return FALSE; | 3254 » return false; |
| 3255 } | 3255 } |
| 3256 | 3256 |
| 3257 FX_BOOL CFX_Edit::InsertText(const FX_WCHAR* text, int32_t charset, | 3257 bool CFX_Edit::InsertText(const FX_WCHAR* text, int32_t charset, |
| 3258 » » » » » const CPVT_SecProps * pSecProps, const C
PVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) | 3258 » » » » » const CPVT_SecProps * pSecProps, const C
PVT_WordProps * pWordProps, bool bAddUndo, bool bPaint) |
| 3259 { | 3259 { |
| 3260 » if (IsTextOverflow()) return FALSE; | 3260 » if (IsTextOverflow()) return false; |
| 3261 | 3261 |
| 3262 m_pVT->UpdateWordPlace(m_wpCaret); | 3262 m_pVT->UpdateWordPlace(m_wpCaret); |
| 3263 SetCaret(DoInsertText(m_wpCaret, text, charset, pSecProps, pWordProps)); | 3263 SetCaret(DoInsertText(m_wpCaret, text, charset, pSecProps, pWordProps)); |
| 3264 m_SelState.Set(m_wpCaret,m_wpCaret); | 3264 m_SelState.Set(m_wpCaret,m_wpCaret); |
| 3265 | 3265 |
| 3266 if (m_wpCaret != m_wpOldCaret) | 3266 if (m_wpCaret != m_wpOldCaret) |
| 3267 { | 3267 { |
| 3268 if (bAddUndo && m_bEnableUndo) | 3268 if (bAddUndo && m_bEnableUndo) |
| 3269 { | 3269 { |
| 3270 AddEditUndoItem(new CFXEU_InsertText(this,m_wpOldCaret,m
_wpCaret,text,charset,pSecProps,pWordProps)); | 3270 AddEditUndoItem(new CFXEU_InsertText(this,m_wpOldCaret,m
_wpCaret,text,charset,pSecProps,pWordProps)); |
| 3271 } | 3271 } |
| 3272 | 3272 |
| 3273 if (bPaint) | 3273 if (bPaint) |
| 3274 PaintInsertText(m_wpOldCaret, m_wpCaret); | 3274 PaintInsertText(m_wpOldCaret, m_wpCaret); |
| 3275 | 3275 |
| 3276 if (m_bOprNotify && m_pOprNotify) | 3276 if (m_bOprNotify && m_pOprNotify) |
| 3277 m_pOprNotify->OnInsertText(m_wpCaret, m_wpOldCaret); | 3277 m_pOprNotify->OnInsertText(m_wpCaret, m_wpOldCaret); |
| 3278 | 3278 |
| 3279 » » return TRUE; | 3279 » » return true; |
| 3280 } | 3280 } |
| 3281 » return FALSE; | 3281 » return false; |
| 3282 } | 3282 } |
| 3283 | 3283 |
| 3284 void CFX_Edit::PaintInsertText(const CPVT_WordPlace & wpOld, const CPVT_WordPlac
e & wpNew) | 3284 void CFX_Edit::PaintInsertText(const CPVT_WordPlace & wpOld, const CPVT_WordPlac
e & wpNew) |
| 3285 { | 3285 { |
| 3286 if (m_pVT->IsValid()) | 3286 if (m_pVT->IsValid()) |
| 3287 { | 3287 { |
| 3288 RearrangePart(CPVT_WordRange(wpOld,wpNew)); | 3288 RearrangePart(CPVT_WordRange(wpOld,wpNew)); |
| 3289 ScrollToCaret(); | 3289 ScrollToCaret(); |
| 3290 | 3290 |
| 3291 CPVT_WordRange wr; | 3291 CPVT_WordRange wr; |
| 3292 if (m_wpCaret.LineCmp(wpOld) !=0) | 3292 if (m_wpCaret.LineCmp(wpOld) !=0) |
| 3293 wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(wpOld),m_pV
T->GetSectionEndPlace(wpNew)); | 3293 wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(wpOld),m_pV
T->GetSectionEndPlace(wpNew)); |
| 3294 else | 3294 else |
| 3295 wr = CPVT_WordRange(wpOld,m_pVT->GetSectionEndPlace(wpNe
w)); | 3295 wr = CPVT_WordRange(wpOld,m_pVT->GetSectionEndPlace(wpNe
w)); |
| 3296 Refresh(RP_ANALYSE, &wr); | 3296 Refresh(RP_ANALYSE, &wr); |
| 3297 SetCaretOrigin(); | 3297 SetCaretOrigin(); |
| 3298 SetCaretInfo(); | 3298 SetCaretInfo(); |
| 3299 } | 3299 } |
| 3300 } | 3300 } |
| 3301 | 3301 |
| 3302 FX_BOOL CFX_Edit::Redo() | 3302 bool CFX_Edit::Redo() |
| 3303 { | 3303 { |
| 3304 if (m_bEnableUndo) | 3304 if (m_bEnableUndo) |
| 3305 { | 3305 { |
| 3306 if (m_Undo.CanRedo()) | 3306 if (m_Undo.CanRedo()) |
| 3307 { | 3307 { |
| 3308 m_Undo.Redo(); | 3308 m_Undo.Redo(); |
| 3309 » » » return TRUE; | 3309 » » » return true; |
| 3310 } | 3310 } |
| 3311 } | 3311 } |
| 3312 | 3312 |
| 3313 » return FALSE; | 3313 » return false; |
| 3314 } | 3314 } |
| 3315 | 3315 |
| 3316 FX_BOOL CFX_Edit::Undo() | 3316 bool CFX_Edit::Undo() |
| 3317 { | 3317 { |
| 3318 if (m_bEnableUndo) | 3318 if (m_bEnableUndo) |
| 3319 { | 3319 { |
| 3320 if (m_Undo.CanUndo()) | 3320 if (m_Undo.CanUndo()) |
| 3321 { | 3321 { |
| 3322 m_Undo.Undo(); | 3322 m_Undo.Undo(); |
| 3323 » » » return TRUE; | 3323 » » » return true; |
| 3324 } | 3324 } |
| 3325 } | 3325 } |
| 3326 | 3326 |
| 3327 » return FALSE; | 3327 » return false; |
| 3328 } | 3328 } |
| 3329 | 3329 |
| 3330 void CFX_Edit::SetCaretOrigin() | 3330 void CFX_Edit::SetCaretOrigin() |
| 3331 { | 3331 { |
| 3332 if (m_pVT->IsValid()) | 3332 if (m_pVT->IsValid()) |
| 3333 { | 3333 { |
| 3334 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) | 3334 if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator(
)) |
| 3335 { | 3335 { |
| 3336 pIterator->SetAt(m_wpCaret); | 3336 pIterator->SetAt(m_wpCaret); |
| 3337 CPVT_Word word; | 3337 CPVT_Word word; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3359 } | 3359 } |
| 3360 | 3360 |
| 3361 CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(int32_t index) const | 3361 CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(int32_t index) const |
| 3362 { | 3362 { |
| 3363 if (m_pVT->IsValid()) | 3363 if (m_pVT->IsValid()) |
| 3364 return m_pVT->WordIndexToWordPlace(index); | 3364 return m_pVT->WordIndexToWordPlace(index); |
| 3365 | 3365 |
| 3366 return CPVT_WordPlace(); | 3366 return CPVT_WordPlace(); |
| 3367 } | 3367 } |
| 3368 | 3368 |
| 3369 FX_BOOL»CFX_Edit::IsTextFull() const | 3369 bool» CFX_Edit::IsTextFull() const |
| 3370 { | 3370 { |
| 3371 int32_t nTotalWords = m_pVT->GetTotalWords(); | 3371 int32_t nTotalWords = m_pVT->GetTotalWords(); |
| 3372 int32_t nLimitChar = m_pVT->GetLimitChar(); | 3372 int32_t nLimitChar = m_pVT->GetLimitChar(); |
| 3373 int32_t nCharArray = m_pVT->GetCharArray(); | 3373 int32_t nCharArray = m_pVT->GetCharArray(); |
| 3374 | 3374 |
| 3375 return IsTextOverflow() || (nLimitChar>0 && nTotalWords >= nLimitChar) | 3375 return IsTextOverflow() || (nLimitChar>0 && nTotalWords >= nLimitChar) |
| 3376 || (nCharArray>0 && nTotalWords >= nCharArray); | 3376 || (nCharArray>0 && nTotalWords >= nCharArray); |
| 3377 } | 3377 } |
| 3378 | 3378 |
| 3379 FX_BOOL»CFX_Edit::IsTextOverflow() const | 3379 bool» CFX_Edit::IsTextOverflow() const |
| 3380 { | 3380 { |
| 3381 if (!m_bEnableScroll && !m_bEnableOverflow) | 3381 if (!m_bEnableScroll && !m_bEnableOverflow) |
| 3382 { | 3382 { |
| 3383 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); | 3383 CPDF_Rect rcPlate = m_pVT->GetPlateRect(); |
| 3384 CPDF_Rect rcContent = m_pVT->GetContentRect(); | 3384 CPDF_Rect rcContent = m_pVT->GetContentRect(); |
| 3385 | 3385 |
| 3386 if (m_pVT->IsMultiLine() && GetTotalLines() > 1) | 3386 if (m_pVT->IsMultiLine() && GetTotalLines() > 1) |
| 3387 { | 3387 { |
| 3388 » » » if (FX_EDIT_IsFloatBigger(rcContent.Height(),rcPlate.Hei
ght())) return TRUE; | 3388 » » » if (FX_EDIT_IsFloatBigger(rcContent.Height(),rcPlate.Hei
ght())) return true; |
| 3389 } | 3389 } |
| 3390 | 3390 |
| 3391 » » if (FX_EDIT_IsFloatBigger(rcContent.Width(),rcPlate.Width())) re
turn TRUE; | 3391 » » if (FX_EDIT_IsFloatBigger(rcContent.Width(),rcPlate.Width())) re
turn true; |
| 3392 } | 3392 } |
| 3393 | 3393 |
| 3394 » return FALSE; | 3394 » return false; |
| 3395 } | 3395 } |
| 3396 | 3396 |
| 3397 CPVT_WordPlace CFX_Edit::GetLineBeginPlace(const CPVT_WordPlace & place) const | 3397 CPVT_WordPlace CFX_Edit::GetLineBeginPlace(const CPVT_WordPlace & place) const |
| 3398 { | 3398 { |
| 3399 return m_pVT->GetLineBeginPlace(place); | 3399 return m_pVT->GetLineBeginPlace(place); |
| 3400 } | 3400 } |
| 3401 | 3401 |
| 3402 CPVT_WordPlace CFX_Edit::GetLineEndPlace(const CPVT_WordPlace & place) const | 3402 CPVT_WordPlace CFX_Edit::GetLineEndPlace(const CPVT_WordPlace & place) const |
| 3403 { | 3403 { |
| 3404 return m_pVT->GetLineEndPlace(place); | 3404 return m_pVT->GetLineEndPlace(place); |
| 3405 } | 3405 } |
| 3406 | 3406 |
| 3407 CPVT_WordPlace CFX_Edit::GetSectionBeginPlace(const CPVT_WordPlace & place) cons
t | 3407 CPVT_WordPlace CFX_Edit::GetSectionBeginPlace(const CPVT_WordPlace & place) cons
t |
| 3408 { | 3408 { |
| 3409 return m_pVT->GetSectionBeginPlace(place); | 3409 return m_pVT->GetSectionBeginPlace(place); |
| 3410 } | 3410 } |
| 3411 | 3411 |
| 3412 CPVT_WordPlace CFX_Edit::GetSectionEndPlace(const CPVT_WordPlace & place) const | 3412 CPVT_WordPlace CFX_Edit::GetSectionEndPlace(const CPVT_WordPlace & place) const |
| 3413 { | 3413 { |
| 3414 return m_pVT->GetSectionEndPlace(place); | 3414 return m_pVT->GetSectionEndPlace(place); |
| 3415 } | 3415 } |
| 3416 | 3416 |
| 3417 FX_BOOL»CFX_Edit::CanUndo() const | 3417 bool» CFX_Edit::CanUndo() const |
| 3418 { | 3418 { |
| 3419 if (m_bEnableUndo) | 3419 if (m_bEnableUndo) |
| 3420 { | 3420 { |
| 3421 return m_Undo.CanUndo(); | 3421 return m_Undo.CanUndo(); |
| 3422 } | 3422 } |
| 3423 | 3423 |
| 3424 » return FALSE; | 3424 » return false; |
| 3425 } | 3425 } |
| 3426 | 3426 |
| 3427 FX_BOOL»CFX_Edit::CanRedo() const | 3427 bool» CFX_Edit::CanRedo() const |
| 3428 { | 3428 { |
| 3429 if (m_bEnableUndo) | 3429 if (m_bEnableUndo) |
| 3430 { | 3430 { |
| 3431 return m_Undo.CanRedo(); | 3431 return m_Undo.CanRedo(); |
| 3432 } | 3432 } |
| 3433 | 3433 |
| 3434 » return FALSE; | 3434 » return false; |
| 3435 } | 3435 } |
| 3436 | 3436 |
| 3437 FX_BOOL»CFX_Edit::IsModified() const | 3437 bool» CFX_Edit::IsModified() const |
| 3438 { | 3438 { |
| 3439 if (m_bEnableUndo) | 3439 if (m_bEnableUndo) |
| 3440 { | 3440 { |
| 3441 return m_Undo.IsModified(); | 3441 return m_Undo.IsModified(); |
| 3442 } | 3442 } |
| 3443 | 3443 |
| 3444 » return FALSE; | 3444 » return false; |
| 3445 } | 3445 } |
| 3446 | 3446 |
| 3447 void CFX_Edit::EnableRefresh(FX_BOOL bRefresh) | 3447 void CFX_Edit::EnableRefresh(bool bRefresh) |
| 3448 { | 3448 { |
| 3449 m_bEnableRefresh = bRefresh; | 3449 m_bEnableRefresh = bRefresh; |
| 3450 } | 3450 } |
| 3451 | 3451 |
| 3452 void CFX_Edit::EnableUndo(FX_BOOL bUndo) | 3452 void CFX_Edit::EnableUndo(bool bUndo) |
| 3453 { | 3453 { |
| 3454 m_bEnableUndo = bUndo; | 3454 m_bEnableUndo = bUndo; |
| 3455 } | 3455 } |
| 3456 | 3456 |
| 3457 void CFX_Edit::EnableNotify(FX_BOOL bNotify) | 3457 void CFX_Edit::EnableNotify(bool bNotify) |
| 3458 { | 3458 { |
| 3459 m_bNotify = bNotify; | 3459 m_bNotify = bNotify; |
| 3460 } | 3460 } |
| 3461 | 3461 |
| 3462 void CFX_Edit::EnableOprNotify(FX_BOOL bNotify) | 3462 void CFX_Edit::EnableOprNotify(bool bNotify) |
| 3463 { | 3463 { |
| 3464 m_bOprNotify = bNotify; | 3464 m_bOprNotify = bNotify; |
| 3465 } | 3465 } |
| 3466 | 3466 |
| 3467 FX_FLOAT CFX_Edit::GetLineTop(const CPVT_WordPlace& place) const | 3467 FX_FLOAT CFX_Edit::GetLineTop(const CPVT_WordPlace& place) const |
| 3468 { | 3468 { |
| 3469 if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) | 3469 if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) |
| 3470 { | 3470 { |
| 3471 CPVT_WordPlace wpOld = pIterator->GetAt(); | 3471 CPVT_WordPlace wpOld = pIterator->GetAt(); |
| 3472 | 3472 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3573 } | 3573 } |
| 3574 } | 3574 } |
| 3575 | 3575 |
| 3576 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) | 3576 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) |
| 3577 { | 3577 { |
| 3578 m_Undo.AddItem(pUndoItem); | 3578 m_Undo.AddItem(pUndoItem); |
| 3579 if (m_bOprNotify && m_pOprNotify) | 3579 if (m_bOprNotify && m_pOprNotify) |
| 3580 m_pOprNotify->OnAddUndo(pUndoItem); | 3580 m_pOprNotify->OnAddUndo(pUndoItem); |
| 3581 } | 3581 } |
| 3582 | 3582 |
| OLD | NEW |