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