updated Scintilla to 2.29
[TortoiseGit.git] / ext / scintilla / src / ScintillaBase.cxx
blob8afa6e7d72365f893b4967f997b160e05973df36
1 // Scintilla source code edit control
2 /** @file ScintillaBase.cxx
3 ** An enhanced subclass of Editor with calltips, autocomplete and context menu.
4 **/
5 // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
8 #include <stdlib.h>
9 #include <string.h>
10 #include <stdio.h>
11 #include <ctype.h>
12 #include <assert.h>
14 #include <string>
15 #include <vector>
16 #include <map>
18 #include "Platform.h"
20 #include "ILexer.h"
21 #include "Scintilla.h"
23 #include "PropSetSimple.h"
24 #ifdef SCI_LEXER
25 #include "SciLexer.h"
26 #include "LexerModule.h"
27 #include "Catalogue.h"
28 #endif
29 #include "SplitVector.h"
30 #include "Partitioning.h"
31 #include "RunStyles.h"
32 #include "ContractionState.h"
33 #include "CellBuffer.h"
34 #include "CallTip.h"
35 #include "KeyMap.h"
36 #include "Indicator.h"
37 #include "XPM.h"
38 #include "LineMarker.h"
39 #include "Style.h"
40 #include "ViewStyle.h"
41 #include "AutoComplete.h"
42 #include "CharClassify.h"
43 #include "Decoration.h"
44 #include "Document.h"
45 #include "Selection.h"
46 #include "PositionCache.h"
47 #include "Editor.h"
48 #include "ScintillaBase.h"
50 #ifdef SCI_NAMESPACE
51 using namespace Scintilla;
52 #endif
54 ScintillaBase::ScintillaBase() {
55 displayPopupMenu = true;
56 listType = 0;
57 maxListWidth = 0;
60 ScintillaBase::~ScintillaBase() {
63 void ScintillaBase::Finalise() {
64 Editor::Finalise();
65 popup.Destroy();
68 void ScintillaBase::RefreshColourPalette(Palette &pal, bool want) {
69 Editor::RefreshColourPalette(pal, want);
70 ct.RefreshColourPalette(pal, want);
73 void ScintillaBase::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
74 bool isFillUp = ac.Active() && ac.IsFillUpChar(*s);
75 if (!isFillUp) {
76 Editor::AddCharUTF(s, len, treatAsDBCS);
78 if (ac.Active()) {
79 AutoCompleteCharacterAdded(s[0]);
80 // For fill ups add the character after the autocompletion has
81 // triggered so containers see the key so can display a calltip.
82 if (isFillUp) {
83 Editor::AddCharUTF(s, len, treatAsDBCS);
88 void ScintillaBase::Command(int cmdId) {
90 switch (cmdId) {
92 case idAutoComplete: // Nothing to do
94 break;
96 case idCallTip: // Nothing to do
98 break;
100 case idcmdUndo:
101 WndProc(SCI_UNDO, 0, 0);
102 break;
104 case idcmdRedo:
105 WndProc(SCI_REDO, 0, 0);
106 break;
108 case idcmdCut:
109 WndProc(SCI_CUT, 0, 0);
110 break;
112 case idcmdCopy:
113 WndProc(SCI_COPY, 0, 0);
114 break;
116 case idcmdPaste:
117 WndProc(SCI_PASTE, 0, 0);
118 break;
120 case idcmdDelete:
121 WndProc(SCI_CLEAR, 0, 0);
122 break;
124 case idcmdSelectAll:
125 WndProc(SCI_SELECTALL, 0, 0);
126 break;
130 int ScintillaBase::KeyCommand(unsigned int iMessage) {
131 // Most key commands cancel autocompletion mode
132 if (ac.Active()) {
133 switch (iMessage) {
134 // Except for these
135 case SCI_LINEDOWN:
136 AutoCompleteMove(1);
137 return 0;
138 case SCI_LINEUP:
139 AutoCompleteMove(-1);
140 return 0;
141 case SCI_PAGEDOWN:
142 AutoCompleteMove(5);
143 return 0;
144 case SCI_PAGEUP:
145 AutoCompleteMove(-5);
146 return 0;
147 case SCI_VCHOME:
148 AutoCompleteMove(-5000);
149 return 0;
150 case SCI_LINEEND:
151 AutoCompleteMove(5000);
152 return 0;
153 case SCI_DELETEBACK:
154 DelCharBack(true);
155 AutoCompleteCharacterDeleted();
156 EnsureCaretVisible();
157 return 0;
158 case SCI_DELETEBACKNOTLINE:
159 DelCharBack(false);
160 AutoCompleteCharacterDeleted();
161 EnsureCaretVisible();
162 return 0;
163 case SCI_TAB:
164 AutoCompleteCompleted();
165 return 0;
166 case SCI_NEWLINE:
167 AutoCompleteCompleted();
168 return 0;
170 default:
171 AutoCompleteCancel();
175 if (ct.inCallTipMode) {
176 if (
177 (iMessage != SCI_CHARLEFT) &&
178 (iMessage != SCI_CHARLEFTEXTEND) &&
179 (iMessage != SCI_CHARRIGHT) &&
180 (iMessage != SCI_CHARRIGHTEXTEND) &&
181 (iMessage != SCI_EDITTOGGLEOVERTYPE) &&
182 (iMessage != SCI_DELETEBACK) &&
183 (iMessage != SCI_DELETEBACKNOTLINE)
185 ct.CallTipCancel();
187 if ((iMessage == SCI_DELETEBACK) || (iMessage == SCI_DELETEBACKNOTLINE)) {
188 if (sel.MainCaret() <= ct.posStartCallTip) {
189 ct.CallTipCancel();
193 return Editor::KeyCommand(iMessage);
196 void ScintillaBase::AutoCompleteDoubleClick(void *p) {
197 ScintillaBase *sci = reinterpret_cast<ScintillaBase *>(p);
198 sci->AutoCompleteCompleted();
201 void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
202 //Platform::DebugPrintf("AutoComplete %s\n", list);
203 ct.CallTipCancel();
205 if (ac.chooseSingle && (listType == 0)) {
206 if (list && !strchr(list, ac.GetSeparator())) {
207 const char *typeSep = strchr(list, ac.GetTypesep());
208 int lenInsert = typeSep ?
209 static_cast<int>(typeSep-list) : static_cast<int>(strlen(list));
210 if (ac.ignoreCase) {
211 SetEmptySelection(sel.MainCaret() - lenEntered);
212 pdoc->DeleteChars(sel.MainCaret(), lenEntered);
213 SetEmptySelection(sel.MainCaret());
214 pdoc->InsertString(sel.MainCaret(), list, lenInsert);
215 SetEmptySelection(sel.MainCaret() + lenInsert);
216 } else {
217 SetEmptySelection(sel.MainCaret());
218 pdoc->InsertString(sel.MainCaret(), list + lenEntered, lenInsert - lenEntered);
219 SetEmptySelection(sel.MainCaret() + lenInsert - lenEntered);
221 return;
224 ac.Start(wMain, idAutoComplete, sel.MainCaret(), PointMainCaret(),
225 lenEntered, vs.lineHeight, IsUnicodeMode());
227 PRectangle rcClient = GetClientRectangle();
228 Point pt = LocationFromPosition(sel.MainCaret() - lenEntered);
229 PRectangle rcPopupBounds = wMain.GetMonitorRect(pt);
230 if (rcPopupBounds.Height() == 0)
231 rcPopupBounds = rcClient;
233 int heightLB = 100;
234 int widthLB = 100;
235 if (pt.x >= rcClient.right - widthLB) {
236 HorizontalScrollTo(xOffset + pt.x - rcClient.right + widthLB);
237 Redraw();
238 pt = PointMainCaret();
240 PRectangle rcac;
241 rcac.left = pt.x - ac.lb->CaretFromEdge();
242 if (pt.y >= rcPopupBounds.bottom - heightLB && // Wont fit below.
243 pt.y >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2) { // and there is more room above.
244 rcac.top = pt.y - heightLB;
245 if (rcac.top < rcPopupBounds.top) {
246 heightLB -= (rcPopupBounds.top - rcac.top);
247 rcac.top = rcPopupBounds.top;
249 } else {
250 rcac.top = pt.y + vs.lineHeight;
252 rcac.right = rcac.left + widthLB;
253 rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcPopupBounds.bottom);
254 ac.lb->SetPositionRelative(rcac, wMain);
255 ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font);
256 unsigned int aveCharWidth = vs.styles[STYLE_DEFAULT].aveCharWidth;
257 ac.lb->SetAverageCharWidth(aveCharWidth);
258 ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this);
260 ac.SetList(list);
262 // Fiddle the position of the list so it is right next to the target and wide enough for all its strings
263 PRectangle rcList = ac.lb->GetDesiredRect();
264 int heightAlloced = rcList.bottom - rcList.top;
265 widthLB = Platform::Maximum(widthLB, rcList.right - rcList.left);
266 if (maxListWidth != 0)
267 widthLB = Platform::Minimum(widthLB, aveCharWidth*maxListWidth);
268 // Make an allowance for large strings in list
269 rcList.left = pt.x - ac.lb->CaretFromEdge();
270 rcList.right = rcList.left + widthLB;
271 if (((pt.y + vs.lineHeight) >= (rcPopupBounds.bottom - heightAlloced)) && // Wont fit below.
272 ((pt.y + vs.lineHeight / 2) >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2)) { // and there is more room above.
273 rcList.top = pt.y - heightAlloced;
274 } else {
275 rcList.top = pt.y + vs.lineHeight;
277 rcList.bottom = rcList.top + heightAlloced;
278 ac.lb->SetPositionRelative(rcList, wMain);
279 ac.Show(true);
280 if (lenEntered != 0) {
281 AutoCompleteMoveToCurrentWord();
285 void ScintillaBase::AutoCompleteCancel() {
286 if (ac.Active()) {
287 SCNotification scn = {0};
288 scn.nmhdr.code = SCN_AUTOCCANCELLED;
289 scn.wParam = 0;
290 scn.listType = 0;
291 NotifyParent(scn);
293 ac.Cancel();
296 void ScintillaBase::AutoCompleteMove(int delta) {
297 ac.Move(delta);
300 void ScintillaBase::AutoCompleteMoveToCurrentWord() {
301 char wordCurrent[1000];
302 int i;
303 int startWord = ac.posStart - ac.startLen;
304 for (i = startWord; i < sel.MainCaret() && i - startWord < 1000; i++)
305 wordCurrent[i - startWord] = pdoc->CharAt(i);
306 wordCurrent[Platform::Minimum(i - startWord, 999)] = '\0';
307 ac.Select(wordCurrent);
310 void ScintillaBase::AutoCompleteCharacterAdded(char ch) {
311 if (ac.IsFillUpChar(ch)) {
312 AutoCompleteCompleted();
313 } else if (ac.IsStopChar(ch)) {
314 AutoCompleteCancel();
315 } else {
316 AutoCompleteMoveToCurrentWord();
320 void ScintillaBase::AutoCompleteCharacterDeleted() {
321 if (sel.MainCaret() < ac.posStart - ac.startLen) {
322 AutoCompleteCancel();
323 } else if (ac.cancelAtStartPos && (sel.MainCaret() <= ac.posStart)) {
324 AutoCompleteCancel();
325 } else {
326 AutoCompleteMoveToCurrentWord();
328 SCNotification scn = {0};
329 scn.nmhdr.code = SCN_AUTOCCHARDELETED;
330 scn.wParam = 0;
331 scn.listType = 0;
332 NotifyParent(scn);
335 void ScintillaBase::AutoCompleteCompleted() {
336 int item = ac.lb->GetSelection();
337 char selected[1000];
338 selected[0] = '\0';
339 if (item != -1) {
340 ac.lb->GetValue(item, selected, sizeof(selected));
341 } else {
342 AutoCompleteCancel();
343 return;
346 ac.Show(false);
348 SCNotification scn = {0};
349 scn.nmhdr.code = listType > 0 ? SCN_USERLISTSELECTION : SCN_AUTOCSELECTION;
350 scn.message = 0;
351 scn.wParam = listType;
352 scn.listType = listType;
353 Position firstPos = ac.posStart - ac.startLen;
354 scn.position = firstPos;
355 scn.lParam = firstPos;
356 scn.text = selected;
357 NotifyParent(scn);
359 if (!ac.Active())
360 return;
361 ac.Cancel();
363 if (listType > 0)
364 return;
366 Position endPos = sel.MainCaret();
367 if (ac.dropRestOfWord)
368 endPos = pdoc->ExtendWordSelect(endPos, 1, true);
369 if (endPos < firstPos)
370 return;
371 UndoGroup ug(pdoc);
372 if (endPos != firstPos) {
373 pdoc->DeleteChars(firstPos, endPos - firstPos);
375 SetEmptySelection(ac.posStart);
376 if (item != -1) {
377 pdoc->InsertCString(firstPos, selected);
378 SetEmptySelection(firstPos + static_cast<int>(strlen(selected)));
380 SetLastXChosen();
383 int ScintillaBase::AutoCompleteGetCurrent() {
384 if (!ac.Active())
385 return -1;
386 return ac.lb->GetSelection();
389 int ScintillaBase::AutoCompleteGetCurrentText(char *buffer) {
390 if (ac.Active()) {
391 int item = ac.lb->GetSelection();
392 char selected[1000];
393 selected[0] = '\0';
394 if (item != -1) {
395 ac.lb->GetValue(item, selected, sizeof(selected));
396 if (buffer != NULL)
397 strcpy(buffer, selected);
398 return static_cast<int>(strlen(selected));
401 if (buffer != NULL)
402 *buffer = '\0';
403 return 0;
406 void ScintillaBase::CallTipShow(Point pt, const char *defn) {
407 ac.Cancel();
408 pt.y += vs.lineHeight;
409 // If container knows about STYLE_CALLTIP then use it in place of the
410 // STYLE_DEFAULT for the face name, size and character set. Also use it
411 // for the foreground and background colour.
412 int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT;
413 if (ct.UseStyleCallTip()) {
414 ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back);
416 PRectangle rc = ct.CallTipStart(sel.MainCaret(), pt,
417 defn,
418 vs.styles[ctStyle].fontName,
419 vs.styles[ctStyle].sizeZoomed,
420 CodePage(),
421 vs.styles[ctStyle].characterSet,
422 wMain);
423 // If the call-tip window would be out of the client
424 // space, adjust so it displays above the text.
425 PRectangle rcClient = GetClientRectangle();
426 if (rc.bottom > rcClient.bottom) {
427 int offset = vs.lineHeight + rc.Height();
428 rc.top -= offset;
429 rc.bottom -= offset;
431 // Now display the window.
432 CreateCallTipWindow(rc);
433 ct.wCallTip.SetPositionRelative(rc, wMain);
434 ct.wCallTip.Show();
437 void ScintillaBase::CallTipClick() {
438 SCNotification scn = {0};
439 scn.nmhdr.code = SCN_CALLTIPCLICK;
440 scn.position = ct.clickPlace;
441 NotifyParent(scn);
444 void ScintillaBase::ContextMenu(Point pt) {
445 if (displayPopupMenu) {
446 bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
447 popup.CreatePopUp();
448 AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo());
449 AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo());
450 AddToPopUp("");
451 AddToPopUp("Cut", idcmdCut, writable && !sel.Empty());
452 AddToPopUp("Copy", idcmdCopy, !sel.Empty());
453 AddToPopUp("Paste", idcmdPaste, writable && WndProc(SCI_CANPASTE, 0, 0));
454 AddToPopUp("Delete", idcmdDelete, writable && !sel.Empty());
455 AddToPopUp("");
456 AddToPopUp("Select All", idcmdSelectAll);
457 popup.Show(pt, wMain);
461 void ScintillaBase::CancelModes() {
462 AutoCompleteCancel();
463 ct.CallTipCancel();
464 Editor::CancelModes();
467 void ScintillaBase::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) {
468 CancelModes();
469 Editor::ButtonDown(pt, curTime, shift, ctrl, alt);
472 #ifdef SCI_LEXER
474 #ifdef SCI_NAMESPACE
475 namespace Scintilla {
476 #endif
478 class LexState : public LexInterface {
479 const LexerModule *lexCurrent;
480 void SetLexerModule(const LexerModule *lex);
481 PropSetSimple props;
482 public:
483 int lexLanguage;
485 LexState(Document *pdoc_);
486 virtual ~LexState();
487 void SetLexer(uptr_t wParam);
488 void SetLexerLanguage(const char *languageName);
489 const char *DescribeWordListSets();
490 void SetWordList(int n, const char *wl);
491 int GetStyleBitsNeeded() const;
492 const char *GetName() const;
493 void *PrivateCall(int operation, void *pointer);
494 const char *PropertyNames();
495 int PropertyType(const char *name);
496 const char *DescribeProperty(const char *name);
497 void PropSet(const char *key, const char *val);
498 const char *PropGet(const char *key) const;
499 int PropGetInt(const char *key, int defaultValue=0) const;
500 int PropGetExpanded(const char *key, char *result) const;
503 #ifdef SCI_NAMESPACE
505 #endif
507 LexState::LexState(Document *pdoc_) : LexInterface(pdoc_) {
508 lexCurrent = 0;
509 performingStyle = false;
510 lexLanguage = SCLEX_CONTAINER;
513 LexState::~LexState() {
514 if (instance) {
515 instance->Release();
516 instance = 0;
520 LexState *ScintillaBase::DocumentLexState() {
521 if (!pdoc->pli) {
522 pdoc->pli = new LexState(pdoc);
524 return static_cast<LexState *>(pdoc->pli);
527 void LexState::SetLexerModule(const LexerModule *lex) {
528 if (lex != lexCurrent) {
529 if (instance) {
530 instance->Release();
531 instance = 0;
533 lexCurrent = lex;
534 if (lexCurrent)
535 instance = lexCurrent->Create();
536 pdoc->LexerChanged();
540 void LexState::SetLexer(uptr_t wParam) {
541 lexLanguage = wParam;
542 if (lexLanguage == SCLEX_CONTAINER) {
543 SetLexerModule(0);
544 } else {
545 const LexerModule *lex = Catalogue::Find(lexLanguage);
546 if (!lex)
547 lex = Catalogue::Find(SCLEX_NULL);
548 SetLexerModule(lex);
552 void LexState::SetLexerLanguage(const char *languageName) {
553 const LexerModule *lex = Catalogue::Find(languageName);
554 if (!lex)
555 lex = Catalogue::Find(SCLEX_NULL);
556 if (lex)
557 lexLanguage = lex->GetLanguage();
558 SetLexerModule(lex);
561 const char *LexState::DescribeWordListSets() {
562 if (instance) {
563 return instance->DescribeWordListSets();
564 } else {
565 return 0;
569 void LexState::SetWordList(int n, const char *wl) {
570 if (instance) {
571 int firstModification = instance->WordListSet(n, wl);
572 if (firstModification >= 0) {
573 pdoc->ModifiedAt(firstModification);
578 int LexState::GetStyleBitsNeeded() const {
579 return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5;
582 const char *LexState::GetName() const {
583 return lexCurrent ? lexCurrent->languageName : "";
586 void *LexState::PrivateCall(int operation, void *pointer) {
587 if (pdoc && instance) {
588 return instance->PrivateCall(operation, pointer);
589 } else {
590 return 0;
594 const char *LexState::PropertyNames() {
595 if (instance) {
596 return instance->PropertyNames();
597 } else {
598 return 0;
602 int LexState::PropertyType(const char *name) {
603 if (instance) {
604 return instance->PropertyType(name);
605 } else {
606 return SC_TYPE_BOOLEAN;
610 const char *LexState::DescribeProperty(const char *name) {
611 if (instance) {
612 return instance->DescribeProperty(name);
613 } else {
614 return 0;
618 void LexState::PropSet(const char *key, const char *val) {
619 props.Set(key, val);
620 if (instance) {
621 int firstModification = instance->PropertySet(key, val);
622 if (firstModification >= 0) {
623 pdoc->ModifiedAt(firstModification);
628 const char *LexState::PropGet(const char *key) const {
629 return props.Get(key);
632 int LexState::PropGetInt(const char *key, int defaultValue) const {
633 return props.GetInt(key, defaultValue);
636 int LexState::PropGetExpanded(const char *key, char *result) const {
637 return props.GetExpanded(key, result);
640 #endif
642 void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) {
643 #ifdef SCI_LEXER
644 if (DocumentLexState()->lexLanguage != SCLEX_CONTAINER) {
645 int lineEndStyled = pdoc->LineFromPosition(pdoc->GetEndStyled());
646 int endStyled = pdoc->LineStart(lineEndStyled);
647 DocumentLexState()->Colourise(endStyled, endStyleNeeded);
648 return;
650 #endif
651 Editor::NotifyStyleToNeeded(endStyleNeeded);
654 void ScintillaBase::NotifyLexerChanged(Document *, void *) {
655 #ifdef SCI_LEXER
656 int bits = DocumentLexState()->GetStyleBitsNeeded();
657 vs.EnsureStyle((1 << bits) - 1);
658 #endif
661 sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
662 switch (iMessage) {
663 case SCI_AUTOCSHOW:
664 listType = 0;
665 AutoCompleteStart(wParam, reinterpret_cast<const char *>(lParam));
666 break;
668 case SCI_AUTOCCANCEL:
669 ac.Cancel();
670 break;
672 case SCI_AUTOCACTIVE:
673 return ac.Active();
675 case SCI_AUTOCPOSSTART:
676 return ac.posStart;
678 case SCI_AUTOCCOMPLETE:
679 AutoCompleteCompleted();
680 break;
682 case SCI_AUTOCSETSEPARATOR:
683 ac.SetSeparator(static_cast<char>(wParam));
684 break;
686 case SCI_AUTOCGETSEPARATOR:
687 return ac.GetSeparator();
689 case SCI_AUTOCSTOPS:
690 ac.SetStopChars(reinterpret_cast<char *>(lParam));
691 break;
693 case SCI_AUTOCSELECT:
694 ac.Select(reinterpret_cast<char *>(lParam));
695 break;
697 case SCI_AUTOCGETCURRENT:
698 return AutoCompleteGetCurrent();
700 case SCI_AUTOCGETCURRENTTEXT:
701 return AutoCompleteGetCurrentText(reinterpret_cast<char *>(lParam));
703 case SCI_AUTOCSETCANCELATSTART:
704 ac.cancelAtStartPos = wParam != 0;
705 break;
707 case SCI_AUTOCGETCANCELATSTART:
708 return ac.cancelAtStartPos;
710 case SCI_AUTOCSETFILLUPS:
711 ac.SetFillUpChars(reinterpret_cast<char *>(lParam));
712 break;
714 case SCI_AUTOCSETCHOOSESINGLE:
715 ac.chooseSingle = wParam != 0;
716 break;
718 case SCI_AUTOCGETCHOOSESINGLE:
719 return ac.chooseSingle;
721 case SCI_AUTOCSETIGNORECASE:
722 ac.ignoreCase = wParam != 0;
723 break;
725 case SCI_AUTOCGETIGNORECASE:
726 return ac.ignoreCase;
728 case SCI_USERLISTSHOW:
729 listType = wParam;
730 AutoCompleteStart(0, reinterpret_cast<const char *>(lParam));
731 break;
733 case SCI_AUTOCSETAUTOHIDE:
734 ac.autoHide = wParam != 0;
735 break;
737 case SCI_AUTOCGETAUTOHIDE:
738 return ac.autoHide;
740 case SCI_AUTOCSETDROPRESTOFWORD:
741 ac.dropRestOfWord = wParam != 0;
742 break;
744 case SCI_AUTOCGETDROPRESTOFWORD:
745 return ac.dropRestOfWord;
747 case SCI_AUTOCSETMAXHEIGHT:
748 ac.lb->SetVisibleRows(wParam);
749 break;
751 case SCI_AUTOCGETMAXHEIGHT:
752 return ac.lb->GetVisibleRows();
754 case SCI_AUTOCSETMAXWIDTH:
755 maxListWidth = wParam;
756 break;
758 case SCI_AUTOCGETMAXWIDTH:
759 return maxListWidth;
761 case SCI_REGISTERIMAGE:
762 ac.lb->RegisterImage(wParam, reinterpret_cast<const char *>(lParam));
763 break;
765 case SCI_REGISTERRGBAIMAGE:
766 ac.lb->RegisterRGBAImage(wParam, sizeRGBAImage.x, sizeRGBAImage.y, reinterpret_cast<unsigned char *>(lParam));
767 break;
769 case SCI_CLEARREGISTEREDIMAGES:
770 ac.lb->ClearRegisteredImages();
771 break;
773 case SCI_AUTOCSETTYPESEPARATOR:
774 ac.SetTypesep(static_cast<char>(wParam));
775 break;
777 case SCI_AUTOCGETTYPESEPARATOR:
778 return ac.GetTypesep();
780 case SCI_CALLTIPSHOW:
781 CallTipShow(LocationFromPosition(wParam),
782 reinterpret_cast<const char *>(lParam));
783 break;
785 case SCI_CALLTIPCANCEL:
786 ct.CallTipCancel();
787 break;
789 case SCI_CALLTIPACTIVE:
790 return ct.inCallTipMode;
792 case SCI_CALLTIPPOSSTART:
793 return ct.posStartCallTip;
795 case SCI_CALLTIPSETHLT:
796 ct.SetHighlight(wParam, lParam);
797 break;
799 case SCI_CALLTIPSETBACK:
800 ct.colourBG = ColourDesired(wParam);
801 vs.styles[STYLE_CALLTIP].back = ct.colourBG;
802 InvalidateStyleRedraw();
803 break;
805 case SCI_CALLTIPSETFORE:
806 ct.colourUnSel = ColourDesired(wParam);
807 vs.styles[STYLE_CALLTIP].fore = ct.colourUnSel;
808 InvalidateStyleRedraw();
809 break;
811 case SCI_CALLTIPSETFOREHLT:
812 ct.colourSel = ColourDesired(wParam);
813 InvalidateStyleRedraw();
814 break;
816 case SCI_CALLTIPUSESTYLE:
817 ct.SetTabSize((int)wParam);
818 InvalidateStyleRedraw();
819 break;
821 case SCI_USEPOPUP:
822 displayPopupMenu = wParam != 0;
823 break;
825 #ifdef SCI_LEXER
826 case SCI_SETLEXER:
827 DocumentLexState()->SetLexer(wParam);
828 break;
830 case SCI_GETLEXER:
831 return DocumentLexState()->lexLanguage;
833 case SCI_COLOURISE:
834 if (DocumentLexState()->lexLanguage == SCLEX_CONTAINER) {
835 pdoc->ModifiedAt(wParam);
836 NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : lParam);
837 } else {
838 DocumentLexState()->Colourise(wParam, lParam);
840 Redraw();
841 break;
843 case SCI_SETPROPERTY:
844 DocumentLexState()->PropSet(reinterpret_cast<const char *>(wParam),
845 reinterpret_cast<const char *>(lParam));
846 break;
848 case SCI_GETPROPERTY:
849 return StringResult(lParam, DocumentLexState()->PropGet(reinterpret_cast<const char *>(wParam)));
851 case SCI_GETPROPERTYEXPANDED:
852 return DocumentLexState()->PropGetExpanded(reinterpret_cast<const char *>(wParam),
853 reinterpret_cast<char *>(lParam));
855 case SCI_GETPROPERTYINT:
856 return DocumentLexState()->PropGetInt(reinterpret_cast<const char *>(wParam), lParam);
858 case SCI_SETKEYWORDS:
859 DocumentLexState()->SetWordList(wParam, reinterpret_cast<const char *>(lParam));
860 break;
862 case SCI_SETLEXERLANGUAGE:
863 DocumentLexState()->SetLexerLanguage(reinterpret_cast<const char *>(lParam));
864 break;
866 case SCI_GETLEXERLANGUAGE:
867 return StringResult(lParam, DocumentLexState()->GetName());
869 case SCI_PRIVATELEXERCALL:
870 return reinterpret_cast<sptr_t>(
871 DocumentLexState()->PrivateCall(wParam, reinterpret_cast<void *>(lParam)));
873 case SCI_GETSTYLEBITSNEEDED:
874 return DocumentLexState()->GetStyleBitsNeeded();
876 case SCI_PROPERTYNAMES:
877 return StringResult(lParam, DocumentLexState()->PropertyNames());
879 case SCI_PROPERTYTYPE:
880 return DocumentLexState()->PropertyType(reinterpret_cast<const char *>(wParam));
882 case SCI_DESCRIBEPROPERTY:
883 return StringResult(lParam, DocumentLexState()->DescribeProperty(reinterpret_cast<const char *>(wParam)));
885 case SCI_DESCRIBEKEYWORDSETS:
886 return StringResult(lParam, DocumentLexState()->DescribeWordListSets());
888 #endif
890 default:
891 return Editor::WndProc(iMessage, wParam, lParam);
893 return 0l;