| 37 skipped lines |
| 38 | U | 38 | U | ScintillaBase::ScintillaBase() { |
|
| 39 | U | 39 | U | displayPopupMenu = true; |
|
|
| | | 41 | A | maxListWidth = 0; |
|
| 42 | U | 43 | U | lexLanguage = SCLEX_CONTAINER; |
|
| | | 44 | A | performingStyle = false; |
|
| 44 | U | 46 | U | for (int wl = 0;wl < numWordLists;wl++) |
|
| 45 | U | 47 | U | keyWordLists[wl] = new WordList; |
|
| 168 skipped lines |
|
|
|
| | | 219 | C | ac.Start(wMain, idAutoComplete, currentPos, LocationFromPosition(currentPos), |
| 217 | C | ac.Start(wMain, idAutoComplete, currentPos, lenEntered, vs.lineHeight, IsUnicodeMode()); | | 220 | C | lenEntered, vs.lineHeight, IsUnicodeMode()); |
|
| 219 | U | 222 | U | PRectangle rcClient = GetClientRectangle(); |
|
| 220 | U | 223 | U | Point pt = LocationFromPosition(currentPos - lenEntered); |
|
| 21 skipped lines |
| 242 | U | 245 | U | rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcClient.bottom); |
|
| 243 | U | 246 | U | ac.lb->SetPositionRelative(rcac, wMain); |
|
| 244 | U | 247 | U | ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font); |
|
| 245 | C | ac.lb->SetAverageCharWidth(vs.styles[STYLE_DEFAULT].aveCharWidth); | | 248 | C | unsigned int aveCharWidth = vs.styles[STYLE_DEFAULT].aveCharWidth; |
| | | 249 | C | ac.lb->SetAverageCharWidth(aveCharWidth); |
| 246 | U | 250 | U | ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this); |
|
|
| 248 | U | 252 | U | ac.SetList(list); |
|
| 2 skipped lines |
| 251 | U | 255 | U | PRectangle rcList = ac.lb->GetDesiredRect(); |
|
| 252 | U | 256 | U | int heightAlloced = rcList.bottom - rcList.top; |
|
| 253 | U | 257 | U | widthLB = Platform::Maximum(widthLB, rcList.right - rcList.left); |
|
| | | 258 | A | if (maxListWidth != 0) |
| | | 259 | A | widthLB = Platform::Minimum(widthLB, aveCharWidth*maxListWidth); |
| 254 | U | 260 | U | // Make an allowance for large strings in list |
|
| 255 | U | 261 | U | rcList.left = pt.x - ac.lb->CaretFromEdge(); |
|
| 256 | U | 262 | U | rcList.right = rcList.left + widthLB; |
|
| 5 skipped lines |
|
| 263 | U | 269 | U | rcList.bottom = rcList.top + heightAlloced; |
|
| 264 | U | 270 | U | ac.lb->SetPositionRelative(rcList, wMain); |
|
| 265 | C | ac.Show(); | | 271 | C | ac.Show(true); |
| 266 | U | 272 | U | if (lenEntered != 0) { |
|
| 267 | U | 273 | U | AutoCompleteMoveToCurrentWord(); |
|
|
| 43 skipped lines |
| 312 | U | 318 | U | selected[0] = '\0'; |
|
| 313 | U | 319 | U | if (item != -1) { |
|
| 314 | U | 320 | U | ac.lb->GetValue(item, selected, sizeof(selected)); |
|
| | | 321 | A | } else { |
| | | 322 | A | ac.Cancel(); |
| | | 323 | A | return; |
|
| | | 325 | C | |
| 316 | C | ac.Cancel(); | | 326 | C | ac.Show(false); |
| | | 327 | C | |
| | | 328 | C | listSelected = selected; |
| | | 329 | C | SCNotification scn = {0}; |
| | | 330 | C | scn.nmhdr.code = listType > 0 ? SCN_USERLISTSELECTION : SCN_AUTOCSELECTION; |
| | | 331 | C | scn.message = 0; |
| | | 332 | C | scn.wParam = listType; |
| | | 333 | C | scn.listType = listType; |
| | | 334 | C | Position firstPos = ac.posStart - ac.startLen; |
| | | 335 | C | scn.lParam = firstPos; |
| | | 336 | C | scn.text = listSelected.c_str(); |
| | | 337 | C | NotifyParent(scn); |
| | | 338 | C | |
| 317 | C | if (item == -1) | | 339 | C | if (!ac.Active()) |
|
| | | 341 | A | ac.Cancel(); |
|
| 320 | C | if (listType > 0) { | | 343 | C | if (listType > 0) |
| 321 | C | userListSelected = selected; | | |
| 322 | C | SCNotification scn; | | |
| 323 | C | scn.nmhdr.code = SCN_USERLISTSELECTION; | | |
| 324 | C | scn.message = 0; | | |
| 325 | C | scn.wParam = listType; | | |
| 326 | C | scn.listType = listType; | | |
| 327 | C | scn.lParam = 0; | | |
| 328 | C | scn.text = userListSelected.c_str(); | | |
| 329 | C | NotifyParent(scn); | | |
|
| 331 | R | } | | |
|
| 333 | R | Position firstPos = ac.posStart - ac.startLen; | | |
| 334 | U | 346 | U | Position endPos = currentPos; |
|
| 335 | U | 347 | U | if (ac.dropRestOfWord) |
|
| 336 | U | 348 | U | endPos = pdoc->ExtendWordSelect(endPos, 1, true); |
|
| 41 skipped lines |
|
|
| 380 | U | 392 | U | void ScintillaBase::CallTipClick() { |
|
| 381 | C | SCNotification scn; | | 393 | C | SCNotification scn = {0}; |
| 382 | U | 394 | U | scn.nmhdr.code = SCN_CALLTIPCLICK; |
|
| 383 | U | 395 | U | scn.position = ct.clickPlace; |
|
| 384 | U | 396 | U | NotifyParent(scn); |
|
| 45 skipped lines |
|
|
| 432 | U | 444 | U | void ScintillaBase::Colourise(int start, int end) { |
|
| 433 | C | int lengthDoc = pdoc->Length(); | | 445 | C | if (!performingStyle) { |
| 434 | C | if (end == -1) | | 446 | C | // Protect against reentrance, which may occur, for example, when |
| 435 | C | end = lengthDoc; | | 447 | C | // fold points are discovered while performing styling and the folding |
| | | 448 | C | // code looks for child lines which may trigger styling. |
| 436 | C | int len = end - start; | | 449 | C | performingStyle = true; |
|
| 438 | C | PLATFORM_ASSERT(len >= 0); | | 451 | C | int lengthDoc = pdoc->Length(); |
| | | 452 | C | if (end == -1) |
| 439 | C | PLATFORM_ASSERT(start + len <= lengthDoc); | | 453 | C | end = lengthDoc; |
| | | 454 | C | int len = end - start; |
|
| 441 | C | //WindowAccessor styler(wMain.GetID(), props); | | 456 | C | PLATFORM_ASSERT(len >= 0); |
| 442 | C | DocumentAccessor styler(pdoc, props, wMain.GetID()); | | 457 | C | PLATFORM_ASSERT(start + len <= lengthDoc); |
|
| 444 | C | int styleStart = 0; | | 459 | C | //WindowAccessor styler(wMain.GetID(), props); |
| 445 | C | if (start > 0) | | |
| 446 | C | styleStart = styler.StyleAt(start - 1); | | 460 | C | DocumentAccessor styler(pdoc, props, wMain.GetID()); |
| 447 | C | styler.SetCodePage(pdoc->dbcsCodePage); | | |
|
| | | 462 | C | int styleStart = 0; |
| | | 463 | C | if (start > 0) |
| | | 464 | C | styleStart = styler.StyleAt(start - 1); |
| | | 465 | C | styler.SetCodePage(pdoc->dbcsCodePage); |
| | | 466 | C | |
| 449 | C | if (lexCurrent && (len > 0)) { // Should always succeed as null lexer should always be available | | 467 | C | if (lexCurrent && (len > 0)) { // Should always succeed as null lexer should always be available |
| 450 | C | lexCurrent->Lex(start, len, styleStart, keyWordLists, styler); | | |
| 451 | C | styler.Flush(); | | |
| 452 | C | if (styler.GetPropertyInt("fold")) { | | |
| 453 | C | lexCurrent->Fold(start, len, styleStart, keyWordLists, styler); | | 468 | C | lexCurrent->Lex(start, len, styleStart, keyWordLists, styler); |
|
| | | 470 | A | if (styler.GetPropertyInt("fold")) { |
| | | 471 | A | lexCurrent->Fold(start, len, styleStart, keyWordLists, styler); |
| | | 472 | A | styler.Flush(); |
| | | 473 | A | } |
|
| | | 475 | A | |
| | | 476 | A | performingStyle = false; |
|
|
|
| 94 skipped lines |
| 553 | U | 574 | U | case SCI_AUTOCGETDROPRESTOFWORD: |
|
| 554 | U | 575 | U | return ac.dropRestOfWord; |
|
|
| | | 577 | A | case SCI_AUTOCSETMAXHEIGHT: |
| | | 578 | A | ac.lb->SetVisibleRows(wParam); |
| | | 579 | A | break; |
| | | 580 | A | |
| | | 581 | A | case SCI_AUTOCGETMAXHEIGHT: |
| 4 skipped lines |
| | | 586 | A | break; |
| | | 587 | A | |
| | | 588 | A | case SCI_AUTOCGETMAXWIDTH: |
| | | 589 | A | return maxListWidth; |
| | | 590 | A | |
| 556 | U | 591 | U | case SCI_REGISTERIMAGE: |
|
| 557 | U | 592 | U | ac.lb->RegisterImage(wParam, reinterpret_cast<const char *>(lParam)); |
|
|
| 57 skipped lines |
| 616 | U | 651 | U | return lexLanguage; |
|
|
| 618 | U | 653 | U | case SCI_COLOURISE: |
|
| | | 654 | C | if (lexLanguage == SCLEX_CONTAINER) { |
| | | 655 | C | pdoc->ModifiedAt(wParam); |
| | | 656 | C | NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : lParam); |
| | | 657 | C | } else { |
| 619 | C | Colourise(wParam, lParam); | | 658 | C | Colourise(wParam, lParam); |
| | | 659 | C | } |
|
|
|
| 2 skipped lines |
| 625 | U | 665 | U | reinterpret_cast<const char *>(lParam)); |
|
|
|
| | | 668 | A | case SCI_GETPROPERTY: { |
| | | 669 | A | SString val = props.Get(reinterpret_cast<const char *>(wParam)); |
| | | 670 | A | const int n = val.length(); |
| | | 671 | A | if (lParam != 0) { |
| | | 672 | A | char *ptr = reinterpret_cast<char *>(lParam); |
| 15 skipped lines |
| | | 688 | A | } |
| | | 689 | A | |
| | | 690 | A | case SCI_GETPROPERTYINT: |
| | | 691 | A | return props.GetInt(reinterpret_cast<const char *>(wParam), lParam); |
| | | 692 | A | |
| 628 | U | 693 | U | case SCI_SETKEYWORDS: |
|
| 629 | U | 694 | U | if (wParam < numWordLists) { |
|
| 630 | U | 695 | U | keyWordLists[wParam]->Clear(); |
|
| 5 skipped lines |
| 636 | U | 701 | U | SetLexerLanguage(reinterpret_cast<const char *>(lParam)); |
|
|
|
| | | 704 | A | case SCI_GETSTYLEBITSNEEDED: |
| | | 705 | A | return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5; |
|
|
|
| 5 skipped lines |