scintilla: Update scintilla with changeset 3662:1d1c06df8a2f using gtk+3
[anjuta-extras.git] / plugins / scintilla / scintilla / ScintillaBase.cxx
blob3de4a4583d94637ef1c1b24ee14a96a152ae9c83
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>
17 #include "Platform.h"
19 #include "ILexer.h"
20 #include "Scintilla.h"
22 #include "PropSetSimple.h"
23 #ifdef SCI_LEXER
24 #include "SciLexer.h"
25 #include "LexerModule.h"
26 #include "Catalogue.h"
27 #endif
28 #include "SplitVector.h"
29 #include "Partitioning.h"
30 #include "RunStyles.h"
31 #include "ContractionState.h"
32 #include "CellBuffer.h"
33 #include "CallTip.h"
34 #include "KeyMap.h"
35 #include "Indicator.h"
36 #include "XPM.h"
37 #include "LineMarker.h"
38 #include "Style.h"
39 #include "ViewStyle.h"
40 #include "AutoComplete.h"
41 #include "CharClassify.h"
42 #include "Decoration.h"
43 #include "Document.h"
44 #include "Selection.h"
45 #include "PositionCache.h"
46 #include "Editor.h"
47 #include "ScintillaBase.h"
49 #ifdef SCI_NAMESPACE
50 using namespace Scintilla;
51 #endif
53 ScintillaBase::ScintillaBase() {
54 displayPopupMenu = true;
55 listType = 0;
56 maxListWidth = 0;
59 ScintillaBase::~ScintillaBase() {
62 void ScintillaBase::Finalise() {
63 Editor::Finalise();
64 popup.Destroy();
67 void ScintillaBase::RefreshColourPalette(Palette &pal, bool want) {
68 Editor::RefreshColourPalette(pal, want);
69 ct.RefreshColourPalette(pal, want);
72 void ScintillaBase::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
73 bool isFillUp = ac.Active() && ac.IsFillUpChar(*s);
74 if (!isFillUp) {
75 Editor::AddCharUTF(s, len, treatAsDBCS);
77 if (ac.Active()) {
78 AutoCompleteCharacterAdded(s[0]);
79 // For fill ups add the character after the autocompletion has
80 // triggered so containers see the key so can display a calltip.
81 if (isFillUp) {
82 Editor::AddCharUTF(s, len, treatAsDBCS);
87 void ScintillaBase::Command(int cmdId) {
89 switch (cmdId) {
91 case idAutoComplete: // Nothing to do
93 break;
95 case idCallTip: // Nothing to do
97 break;
99 case idcmdUndo:
100 WndProc(SCI_UNDO, 0, 0);
101 break;
103 case idcmdRedo:
104 WndProc(SCI_REDO, 0, 0);
105 break;
107 case idcmdCut:
108 WndProc(SCI_CUT, 0, 0);
109 break;
111 case idcmdCopy:
112 WndProc(SCI_COPY, 0, 0);
113 break;
115 case idcmdPaste:
116 WndProc(SCI_PASTE, 0, 0);
117 break;
119 case idcmdDelete:
120 WndProc(SCI_CLEAR, 0, 0);
121 break;
123 case idcmdSelectAll:
124 WndProc(SCI_SELECTALL, 0, 0);
125 break;
129 int ScintillaBase::KeyCommand(unsigned int iMessage) {
130 // Most key commands cancel autocompletion mode
131 if (ac.Active()) {
132 switch (iMessage) {
133 // Except for these
134 case SCI_LINEDOWN:
135 AutoCompleteMove(1);
136 return 0;
137 case SCI_LINEUP:
138 AutoCompleteMove(-1);
139 return 0;
140 case SCI_PAGEDOWN:
141 AutoCompleteMove(5);
142 return 0;
143 case SCI_PAGEUP:
144 AutoCompleteMove(-5);
145 return 0;
146 case SCI_VCHOME:
147 AutoCompleteMove(-5000);
148 return 0;
149 case SCI_LINEEND:
150 AutoCompleteMove(5000);
151 return 0;
152 case SCI_DELETEBACK:
153 DelCharBack(true);
154 AutoCompleteCharacterDeleted();
155 EnsureCaretVisible();
156 return 0;
157 case SCI_DELETEBACKNOTLINE:
158 DelCharBack(false);
159 AutoCompleteCharacterDeleted();
160 EnsureCaretVisible();
161 return 0;
162 case SCI_TAB:
163 AutoCompleteCompleted();
164 return 0;
165 case SCI_NEWLINE:
166 AutoCompleteCompleted();
167 return 0;
169 default:
170 AutoCompleteCancel();
174 if (ct.inCallTipMode) {
175 if (
176 (iMessage != SCI_CHARLEFT) &&
177 (iMessage != SCI_CHARLEFTEXTEND) &&
178 (iMessage != SCI_CHARRIGHT) &&
179 (iMessage != SCI_CHARRIGHTEXTEND) &&
180 (iMessage != SCI_EDITTOGGLEOVERTYPE) &&
181 (iMessage != SCI_DELETEBACK) &&
182 (iMessage != SCI_DELETEBACKNOTLINE)
184 ct.CallTipCancel();
186 if ((iMessage == SCI_DELETEBACK) || (iMessage == SCI_DELETEBACKNOTLINE)) {
187 if (sel.MainCaret() <= ct.posStartCallTip) {
188 ct.CallTipCancel();
192 return Editor::KeyCommand(iMessage);
195 void ScintillaBase::AutoCompleteDoubleClick(void *p) {
196 ScintillaBase *sci = reinterpret_cast<ScintillaBase *>(p);
197 sci->AutoCompleteCompleted();
200 void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
201 //Platform::DebugPrintf("AutoComplete %s\n", list);
202 ct.CallTipCancel();
204 if (ac.chooseSingle && (listType == 0)) {
205 if (list && !strchr(list, ac.GetSeparator())) {
206 const char *typeSep = strchr(list, ac.GetTypesep());
207 size_t lenInsert = (typeSep) ? (typeSep-list) : strlen(list);
208 if (ac.ignoreCase) {
209 SetEmptySelection(sel.MainCaret() - lenEntered);
210 pdoc->DeleteChars(sel.MainCaret(), lenEntered);
211 SetEmptySelection(sel.MainCaret());
212 pdoc->InsertString(sel.MainCaret(), list, lenInsert);
213 SetEmptySelection(sel.MainCaret() + lenInsert);
214 } else {
215 SetEmptySelection(sel.MainCaret());
216 pdoc->InsertString(sel.MainCaret(), list + lenEntered, lenInsert - lenEntered);
217 SetEmptySelection(sel.MainCaret() + lenInsert - lenEntered);
219 return;
222 ac.Start(wMain, idAutoComplete, sel.MainCaret(), PointMainCaret(),
223 lenEntered, vs.lineHeight, IsUnicodeMode());
225 PRectangle rcClient = GetClientRectangle();
226 Point pt = LocationFromPosition(sel.MainCaret() - lenEntered);
227 PRectangle rcPopupBounds = wMain.GetMonitorRect(pt);
228 if (rcPopupBounds.Height() == 0)
229 rcPopupBounds = rcClient;
231 int heightLB = 100;
232 int widthLB = 100;
233 if (pt.x >= rcClient.right - widthLB) {
234 HorizontalScrollTo(xOffset + pt.x - rcClient.right + widthLB);
235 Redraw();
236 pt = PointMainCaret();
238 PRectangle rcac;
239 rcac.left = pt.x - ac.lb->CaretFromEdge();
240 if (pt.y >= rcPopupBounds.bottom - heightLB && // Wont fit below.
241 pt.y >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2) { // and there is more room above.
242 rcac.top = pt.y - heightLB;
243 if (rcac.top < rcPopupBounds.top) {
244 heightLB -= (rcPopupBounds.top - rcac.top);
245 rcac.top = rcPopupBounds.top;
247 } else {
248 rcac.top = pt.y + vs.lineHeight;
250 rcac.right = rcac.left + widthLB;
251 rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcPopupBounds.bottom);
252 ac.lb->SetPositionRelative(rcac, wMain);
253 ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font);
254 unsigned int aveCharWidth = vs.styles[STYLE_DEFAULT].aveCharWidth;
255 ac.lb->SetAverageCharWidth(aveCharWidth);
256 ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this);
258 ac.SetList(list);
260 // Fiddle the position of the list so it is right next to the target and wide enough for all its strings
261 PRectangle rcList = ac.lb->GetDesiredRect();
262 int heightAlloced = rcList.bottom - rcList.top;
263 widthLB = Platform::Maximum(widthLB, rcList.right - rcList.left);
264 if (maxListWidth != 0)
265 widthLB = Platform::Minimum(widthLB, aveCharWidth*maxListWidth);
266 // Make an allowance for large strings in list
267 rcList.left = pt.x - ac.lb->CaretFromEdge();
268 rcList.right = rcList.left + widthLB;
269 if (((pt.y + vs.lineHeight) >= (rcPopupBounds.bottom - heightAlloced)) && // Wont fit below.
270 ((pt.y + vs.lineHeight / 2) >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2)) { // and there is more room above.
271 rcList.top = pt.y - heightAlloced;
272 } else {
273 rcList.top = pt.y + vs.lineHeight;
275 rcList.bottom = rcList.top + heightAlloced;
276 ac.lb->SetPositionRelative(rcList, wMain);
277 ac.Show(true);
278 if (lenEntered != 0) {
279 AutoCompleteMoveToCurrentWord();
283 void ScintillaBase::AutoCompleteCancel() {
284 if (ac.Active()) {
285 SCNotification scn = {0};
286 scn.nmhdr.code = SCN_AUTOCCANCELLED;
287 scn.wParam = 0;
288 scn.listType = 0;
289 NotifyParent(scn);
291 ac.Cancel();
294 void ScintillaBase::AutoCompleteMove(int delta) {
295 ac.Move(delta);
298 void ScintillaBase::AutoCompleteMoveToCurrentWord() {
299 char wordCurrent[1000];
300 int i;
301 int startWord = ac.posStart - ac.startLen;
302 for (i = startWord; i < sel.MainCaret() && i - startWord < 1000; i++)
303 wordCurrent[i - startWord] = pdoc->CharAt(i);
304 wordCurrent[Platform::Minimum(i - startWord, 999)] = '\0';
305 ac.Select(wordCurrent);
308 void ScintillaBase::AutoCompleteCharacterAdded(char ch) {
309 if (ac.IsFillUpChar(ch)) {
310 AutoCompleteCompleted();
311 } else if (ac.IsStopChar(ch)) {
312 AutoCompleteCancel();
313 } else {
314 AutoCompleteMoveToCurrentWord();
318 void ScintillaBase::AutoCompleteCharacterDeleted() {
319 if (sel.MainCaret() < ac.posStart - ac.startLen) {
320 AutoCompleteCancel();
321 } else if (ac.cancelAtStartPos && (sel.MainCaret() <= ac.posStart)) {
322 AutoCompleteCancel();
323 } else {
324 AutoCompleteMoveToCurrentWord();
326 SCNotification scn = {0};
327 scn.nmhdr.code = SCN_AUTOCCHARDELETED;
328 scn.wParam = 0;
329 scn.listType = 0;
330 NotifyParent(scn);
333 void ScintillaBase::AutoCompleteCompleted() {
334 int item = ac.lb->GetSelection();
335 char selected[1000];
336 selected[0] = '\0';
337 if (item != -1) {
338 ac.lb->GetValue(item, selected, sizeof(selected));
339 } else {
340 AutoCompleteCancel();
341 return;
344 ac.Show(false);
346 SCNotification scn = {0};
347 scn.nmhdr.code = listType > 0 ? SCN_USERLISTSELECTION : SCN_AUTOCSELECTION;
348 scn.message = 0;
349 scn.wParam = listType;
350 scn.listType = listType;
351 Position firstPos = ac.posStart - ac.startLen;
352 scn.position = firstPos;
353 scn.lParam = firstPos;
354 scn.text = selected;
355 NotifyParent(scn);
357 if (!ac.Active())
358 return;
359 ac.Cancel();
361 if (listType > 0)
362 return;
364 Position endPos = sel.MainCaret();
365 if (ac.dropRestOfWord)
366 endPos = pdoc->ExtendWordSelect(endPos, 1, true);
367 if (endPos < firstPos)
368 return;
369 UndoGroup ug(pdoc);
370 if (endPos != firstPos) {
371 pdoc->DeleteChars(firstPos, endPos - firstPos);
373 SetEmptySelection(ac.posStart);
374 if (item != -1) {
375 pdoc->InsertCString(firstPos, selected);
376 SetEmptySelection(firstPos + static_cast<int>(strlen(selected)));
378 SetLastXChosen();
381 int ScintillaBase::AutoCompleteGetCurrent() {
382 if (!ac.Active())
383 return -1;
384 return ac.lb->GetSelection();
387 int ScintillaBase::AutoCompleteGetCurrentText(char *buffer) {
388 if (ac.Active()) {
389 int item = ac.lb->GetSelection();
390 char selected[1000];
391 selected[0] = '\0';
392 if (item != -1) {
393 ac.lb->GetValue(item, selected, sizeof(selected));
394 if (buffer != NULL)
395 strcpy(buffer, selected);
396 return strlen(selected);
399 if (buffer != NULL)
400 *buffer = '\0';
401 return 0;
404 void ScintillaBase::CallTipShow(Point pt, const char *defn) {
405 ac.Cancel();
406 pt.y += vs.lineHeight;
407 // If container knows about STYLE_CALLTIP then use it in place of the
408 // STYLE_DEFAULT for the face name, size and character set. Also use it
409 // for the foreground and background colour.
410 int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT;
411 if (ct.UseStyleCallTip()) {
412 ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back);
414 PRectangle rc = ct.CallTipStart(sel.MainCaret(), pt,
415 defn,
416 vs.styles[ctStyle].fontName,
417 vs.styles[ctStyle].sizeZoomed,
418 CodePage(),
419 vs.styles[ctStyle].characterSet,
420 wMain);
421 // If the call-tip window would be out of the client
422 // space, adjust so it displays above the text.
423 PRectangle rcClient = GetClientRectangle();
424 if (rc.bottom > rcClient.bottom) {
425 int offset = vs.lineHeight + rc.Height();
426 rc.top -= offset;
427 rc.bottom -= offset;
429 // Now display the window.
430 CreateCallTipWindow(rc);
431 ct.wCallTip.SetPositionRelative(rc, wMain);
432 ct.wCallTip.Show();
435 void ScintillaBase::CallTipClick() {
436 SCNotification scn = {0};
437 scn.nmhdr.code = SCN_CALLTIPCLICK;
438 scn.position = ct.clickPlace;
439 NotifyParent(scn);
442 void ScintillaBase::ContextMenu(Point pt) {
443 if (displayPopupMenu) {
444 bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
445 popup.CreatePopUp();
446 AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo());
447 AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo());
448 AddToPopUp("");
449 AddToPopUp("Cut", idcmdCut, writable && !sel.Empty());
450 AddToPopUp("Copy", idcmdCopy, !sel.Empty());
451 AddToPopUp("Paste", idcmdPaste, writable && WndProc(SCI_CANPASTE, 0, 0));
452 AddToPopUp("Delete", idcmdDelete, writable && !sel.Empty());
453 AddToPopUp("");
454 AddToPopUp("Select All", idcmdSelectAll);
455 popup.Show(pt, wMain);
459 void ScintillaBase::CancelModes() {
460 AutoCompleteCancel();
461 ct.CallTipCancel();
462 Editor::CancelModes();
465 void ScintillaBase::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) {
466 CancelModes();
467 Editor::ButtonDown(pt, curTime, shift, ctrl, alt);
470 #ifdef SCI_LEXER
472 #ifdef SCI_NAMESPACE
473 namespace Scintilla {
474 #endif
476 class LexState : public LexInterface {
477 const LexerModule *lexCurrent;
478 void SetLexerModule(const LexerModule *lex);
479 PropSetSimple props;
480 public:
481 int lexLanguage;
483 LexState(Document *pdoc_);
484 virtual ~LexState();
485 void SetLexer(uptr_t wParam);
486 void SetLexerLanguage(const char *languageName);
487 const char *DescribeWordListSets();
488 void SetWordList(int n, const char *wl);
489 int GetStyleBitsNeeded() const;
490 const char *GetName() const;
491 void *PrivateCall(int operation, void *pointer);
492 const char *PropertyNames();
493 int PropertyType(const char *name);
494 const char *DescribeProperty(const char *name);
495 void PropSet(const char *key, const char *val);
496 const char *PropGet(const char *key) const;
497 int PropGetInt(const char *key, int defaultValue=0) const;
498 int PropGetExpanded(const char *key, char *result) const;
501 #ifdef SCI_NAMESPACE
503 #endif
505 LexState::LexState(Document *pdoc_) : LexInterface(pdoc_) {
506 lexCurrent = 0;
507 performingStyle = false;
508 lexLanguage = SCLEX_CONTAINER;
511 LexState::~LexState() {
512 if (instance) {
513 instance->Release();
514 instance = 0;
518 LexState *ScintillaBase::DocumentLexState() {
519 if (!pdoc->pli) {
520 pdoc->pli = new LexState(pdoc);
522 return static_cast<LexState *>(pdoc->pli);
525 void LexState::SetLexerModule(const LexerModule *lex) {
526 if (lex != lexCurrent) {
527 if (instance) {
528 instance->Release();
529 instance = 0;
531 lexCurrent = lex;
532 if (lexCurrent)
533 instance = lexCurrent->Create();
534 pdoc->LexerChanged();
538 void LexState::SetLexer(uptr_t wParam) {
539 lexLanguage = wParam;
540 if (lexLanguage == SCLEX_CONTAINER) {
541 SetLexerModule(0);
542 } else {
543 const LexerModule *lex = Catalogue::Find(lexLanguage);
544 if (!lex)
545 lex = Catalogue::Find(SCLEX_NULL);
546 SetLexerModule(lex);
550 void LexState::SetLexerLanguage(const char *languageName) {
551 const LexerModule *lex = Catalogue::Find(languageName);
552 if (!lex)
553 lex = Catalogue::Find(SCLEX_NULL);
554 if (lex)
555 lexLanguage = lex->GetLanguage();
556 SetLexerModule(lex);
559 const char *LexState::DescribeWordListSets() {
560 if (instance) {
561 return instance->DescribeWordListSets();
562 } else {
563 return 0;
567 void LexState::SetWordList(int n, const char *wl) {
568 if (instance) {
569 int firstModification = instance->WordListSet(n, wl);
570 if (firstModification >= 0) {
571 pdoc->ModifiedAt(firstModification);
576 int LexState::GetStyleBitsNeeded() const {
577 return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5;
580 const char *LexState::GetName() const {
581 return lexCurrent ? lexCurrent->languageName : "";
584 void *LexState::PrivateCall(int operation, void *pointer) {
585 if (pdoc && instance) {
586 return instance->PrivateCall(operation, pointer);
587 } else {
588 return 0;
592 const char *LexState::PropertyNames() {
593 if (instance) {
594 return instance->PropertyNames();
595 } else {
596 return 0;
600 int LexState::PropertyType(const char *name) {
601 if (instance) {
602 return instance->PropertyType(name);
603 } else {
604 return SC_TYPE_BOOLEAN;
608 const char *LexState::DescribeProperty(const char *name) {
609 if (instance) {
610 return instance->DescribeProperty(name);
611 } else {
612 return 0;
616 void LexState::PropSet(const char *key, const char *val) {
617 props.Set(key, val);
618 if (instance) {
619 int firstModification = instance->PropertySet(key, val);
620 if (firstModification >= 0) {
621 pdoc->ModifiedAt(firstModification);
626 const char *LexState::PropGet(const char *key) const {
627 return props.Get(key);
630 int LexState::PropGetInt(const char *key, int defaultValue) const {
631 return props.GetInt(key, defaultValue);
634 int LexState::PropGetExpanded(const char *key, char *result) const {
635 return props.GetExpanded(key, result);
638 #endif
640 void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) {
641 #ifdef SCI_LEXER
642 if (DocumentLexState()->lexLanguage != SCLEX_CONTAINER) {
643 int lineEndStyled = pdoc->LineFromPosition(pdoc->GetEndStyled());
644 int endStyled = pdoc->LineStart(lineEndStyled);
645 DocumentLexState()->Colourise(endStyled, endStyleNeeded);
646 return;
648 #endif
649 Editor::NotifyStyleToNeeded(endStyleNeeded);
652 void ScintillaBase::NotifyLexerChanged(Document *, void *) {
653 #ifdef SCI_LEXER
654 int bits = DocumentLexState()->GetStyleBitsNeeded();
655 vs.EnsureStyle((1 << bits) - 1);
656 #endif
659 sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
660 switch (iMessage) {
661 case SCI_AUTOCSHOW:
662 listType = 0;
663 AutoCompleteStart(wParam, reinterpret_cast<const char *>(lParam));
664 break;
666 case SCI_AUTOCCANCEL:
667 ac.Cancel();
668 break;
670 case SCI_AUTOCACTIVE:
671 return ac.Active();
673 case SCI_AUTOCPOSSTART:
674 return ac.posStart;
676 case SCI_AUTOCCOMPLETE:
677 AutoCompleteCompleted();
678 break;
680 case SCI_AUTOCSETSEPARATOR:
681 ac.SetSeparator(static_cast<char>(wParam));
682 break;
684 case SCI_AUTOCGETSEPARATOR:
685 return ac.GetSeparator();
687 case SCI_AUTOCSTOPS:
688 ac.SetStopChars(reinterpret_cast<char *>(lParam));
689 break;
691 case SCI_AUTOCSELECT:
692 ac.Select(reinterpret_cast<char *>(lParam));
693 break;
695 case SCI_AUTOCGETCURRENT:
696 return AutoCompleteGetCurrent();
698 case SCI_AUTOCGETCURRENTTEXT:
699 return AutoCompleteGetCurrentText(reinterpret_cast<char *>(lParam));
701 case SCI_AUTOCSETCANCELATSTART:
702 ac.cancelAtStartPos = wParam != 0;
703 break;
705 case SCI_AUTOCGETCANCELATSTART:
706 return ac.cancelAtStartPos;
708 case SCI_AUTOCSETFILLUPS:
709 ac.SetFillUpChars(reinterpret_cast<char *>(lParam));
710 break;
712 case SCI_AUTOCSETCHOOSESINGLE:
713 ac.chooseSingle = wParam != 0;
714 break;
716 case SCI_AUTOCGETCHOOSESINGLE:
717 return ac.chooseSingle;
719 case SCI_AUTOCSETIGNORECASE:
720 ac.ignoreCase = wParam != 0;
721 break;
723 case SCI_AUTOCGETIGNORECASE:
724 return ac.ignoreCase;
726 case SCI_USERLISTSHOW:
727 listType = wParam;
728 AutoCompleteStart(0, reinterpret_cast<const char *>(lParam));
729 break;
731 case SCI_AUTOCSETAUTOHIDE:
732 ac.autoHide = wParam != 0;
733 break;
735 case SCI_AUTOCGETAUTOHIDE:
736 return ac.autoHide;
738 case SCI_AUTOCSETDROPRESTOFWORD:
739 ac.dropRestOfWord = wParam != 0;
740 break;
742 case SCI_AUTOCGETDROPRESTOFWORD:
743 return ac.dropRestOfWord;
745 case SCI_AUTOCSETMAXHEIGHT:
746 ac.lb->SetVisibleRows(wParam);
747 break;
749 case SCI_AUTOCGETMAXHEIGHT:
750 return ac.lb->GetVisibleRows();
752 case SCI_AUTOCSETMAXWIDTH:
753 maxListWidth = wParam;
754 break;
756 case SCI_AUTOCGETMAXWIDTH:
757 return maxListWidth;
759 case SCI_REGISTERIMAGE:
760 ac.lb->RegisterImage(wParam, reinterpret_cast<const char *>(lParam));
761 break;
763 case SCI_CLEARREGISTEREDIMAGES:
764 ac.lb->ClearRegisteredImages();
765 break;
767 case SCI_AUTOCSETTYPESEPARATOR:
768 ac.SetTypesep(static_cast<char>(wParam));
769 break;
771 case SCI_AUTOCGETTYPESEPARATOR:
772 return ac.GetTypesep();
774 case SCI_CALLTIPSHOW:
775 CallTipShow(LocationFromPosition(wParam),
776 reinterpret_cast<const char *>(lParam));
777 break;
779 case SCI_CALLTIPCANCEL:
780 ct.CallTipCancel();
781 break;
783 case SCI_CALLTIPACTIVE:
784 return ct.inCallTipMode;
786 case SCI_CALLTIPPOSSTART:
787 return ct.posStartCallTip;
789 case SCI_CALLTIPSETHLT:
790 ct.SetHighlight(wParam, lParam);
791 break;
793 case SCI_CALLTIPSETBACK:
794 ct.colourBG = ColourDesired(wParam);
795 vs.styles[STYLE_CALLTIP].back = ct.colourBG;
796 InvalidateStyleRedraw();
797 break;
799 case SCI_CALLTIPSETFORE:
800 ct.colourUnSel = ColourDesired(wParam);
801 vs.styles[STYLE_CALLTIP].fore = ct.colourUnSel;
802 InvalidateStyleRedraw();
803 break;
805 case SCI_CALLTIPSETFOREHLT:
806 ct.colourSel = ColourDesired(wParam);
807 InvalidateStyleRedraw();
808 break;
810 case SCI_CALLTIPUSESTYLE:
811 ct.SetTabSize((int)wParam);
812 InvalidateStyleRedraw();
813 break;
815 case SCI_USEPOPUP:
816 displayPopupMenu = wParam != 0;
817 break;
819 #ifdef SCI_LEXER
820 case SCI_SETLEXER:
821 DocumentLexState()->SetLexer(wParam);
822 break;
824 case SCI_GETLEXER:
825 return DocumentLexState()->lexLanguage;
827 case SCI_COLOURISE:
828 if (DocumentLexState()->lexLanguage == SCLEX_CONTAINER) {
829 pdoc->ModifiedAt(wParam);
830 NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : lParam);
831 } else {
832 DocumentLexState()->Colourise(wParam, lParam);
834 Redraw();
835 break;
837 case SCI_SETPROPERTY:
838 DocumentLexState()->PropSet(reinterpret_cast<const char *>(wParam),
839 reinterpret_cast<const char *>(lParam));
840 break;
842 case SCI_GETPROPERTY:
843 return StringResult(lParam, DocumentLexState()->PropGet(reinterpret_cast<const char *>(wParam)));
845 case SCI_GETPROPERTYEXPANDED:
846 return DocumentLexState()->PropGetExpanded(reinterpret_cast<const char *>(wParam),
847 reinterpret_cast<char *>(lParam));
849 case SCI_GETPROPERTYINT:
850 return DocumentLexState()->PropGetInt(reinterpret_cast<const char *>(wParam), lParam);
852 case SCI_SETKEYWORDS:
853 DocumentLexState()->SetWordList(wParam, reinterpret_cast<const char *>(lParam));
854 break;
856 case SCI_SETLEXERLANGUAGE:
857 DocumentLexState()->SetLexerLanguage(reinterpret_cast<const char *>(lParam));
858 break;
860 case SCI_GETLEXERLANGUAGE:
861 return StringResult(lParam, DocumentLexState()->GetName());
863 case SCI_PRIVATELEXERCALL:
864 return reinterpret_cast<sptr_t>(
865 DocumentLexState()->PrivateCall(wParam, reinterpret_cast<void *>(lParam)));
867 case SCI_GETSTYLEBITSNEEDED:
868 return DocumentLexState()->GetStyleBitsNeeded();
870 case SCI_PROPERTYNAMES:
871 return StringResult(lParam, DocumentLexState()->PropertyNames());
873 case SCI_PROPERTYTYPE:
874 return DocumentLexState()->PropertyType(reinterpret_cast<const char *>(wParam));
876 case SCI_DESCRIBEPROPERTY:
877 return StringResult(lParam, DocumentLexState()->DescribeProperty(reinterpret_cast<const char *>(wParam)));
879 case SCI_DESCRIBEKEYWORDSETS:
880 return StringResult(lParam, DocumentLexState()->DescribeWordListSets());
882 #endif
884 default:
885 return Editor::WndProc(iMessage, wParam, lParam);
887 return 0l;