]> git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/src/ScintillaBase.cxx
Really fix resizing of wxGird column/rows after a hidden one.
[wxWidgets.git] / src / stc / scintilla / src / ScintillaBase.cxx
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.
7
8 #include <stdlib.h>
9 #include <string.h>
10 #include <stdio.h>
11 #include <ctype.h>
12 #include <assert.h>
13
14 #include <string>
15 #include <vector>
16 #include <map>
17
18 #include "Platform.h"
19
20 #include "ILexer.h"
21 #include "Scintilla.h"
22
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"
49
50 #ifdef SCI_NAMESPACE
51 using namespace Scintilla;
52 #endif
53
54 ScintillaBase::ScintillaBase() {
55 displayPopupMenu = true;
56 listType = 0;
57 maxListWidth = 0;
58 }
59
60 ScintillaBase::~ScintillaBase() {
61 }
62
63 void ScintillaBase::Finalise() {
64 Editor::Finalise();
65 popup.Destroy();
66 }
67
68 void ScintillaBase::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
69 bool isFillUp = ac.Active() && ac.IsFillUpChar(*s);
70 if (!isFillUp) {
71 Editor::AddCharUTF(s, len, treatAsDBCS);
72 }
73 if (ac.Active()) {
74 AutoCompleteCharacterAdded(s[0]);
75 // For fill ups add the character after the autocompletion has
76 // triggered so containers see the key so can display a calltip.
77 if (isFillUp) {
78 Editor::AddCharUTF(s, len, treatAsDBCS);
79 }
80 }
81 }
82
83 void ScintillaBase::Command(int cmdId) {
84
85 switch (cmdId) {
86
87 case idAutoComplete: // Nothing to do
88
89 break;
90
91 case idCallTip: // Nothing to do
92
93 break;
94
95 case idcmdUndo:
96 WndProc(SCI_UNDO, 0, 0);
97 break;
98
99 case idcmdRedo:
100 WndProc(SCI_REDO, 0, 0);
101 break;
102
103 case idcmdCut:
104 WndProc(SCI_CUT, 0, 0);
105 break;
106
107 case idcmdCopy:
108 WndProc(SCI_COPY, 0, 0);
109 break;
110
111 case idcmdPaste:
112 WndProc(SCI_PASTE, 0, 0);
113 break;
114
115 case idcmdDelete:
116 WndProc(SCI_CLEAR, 0, 0);
117 break;
118
119 case idcmdSelectAll:
120 WndProc(SCI_SELECTALL, 0, 0);
121 break;
122 }
123 }
124
125 int ScintillaBase::KeyCommand(unsigned int iMessage) {
126 // Most key commands cancel autocompletion mode
127 if (ac.Active()) {
128 switch (iMessage) {
129 // Except for these
130 case SCI_LINEDOWN:
131 AutoCompleteMove(1);
132 return 0;
133 case SCI_LINEUP:
134 AutoCompleteMove(-1);
135 return 0;
136 case SCI_PAGEDOWN:
137 AutoCompleteMove(ac.lb->GetVisibleRows());
138 return 0;
139 case SCI_PAGEUP:
140 AutoCompleteMove(-ac.lb->GetVisibleRows());
141 return 0;
142 case SCI_VCHOME:
143 AutoCompleteMove(-5000);
144 return 0;
145 case SCI_LINEEND:
146 AutoCompleteMove(5000);
147 return 0;
148 case SCI_DELETEBACK:
149 DelCharBack(true);
150 AutoCompleteCharacterDeleted();
151 EnsureCaretVisible();
152 return 0;
153 case SCI_DELETEBACKNOTLINE:
154 DelCharBack(false);
155 AutoCompleteCharacterDeleted();
156 EnsureCaretVisible();
157 return 0;
158 case SCI_TAB:
159 AutoCompleteCompleted();
160 return 0;
161 case SCI_NEWLINE:
162 AutoCompleteCompleted();
163 return 0;
164
165 default:
166 AutoCompleteCancel();
167 }
168 }
169
170 if (ct.inCallTipMode) {
171 if (
172 (iMessage != SCI_CHARLEFT) &&
173 (iMessage != SCI_CHARLEFTEXTEND) &&
174 (iMessage != SCI_CHARRIGHT) &&
175 (iMessage != SCI_CHARRIGHTEXTEND) &&
176 (iMessage != SCI_EDITTOGGLEOVERTYPE) &&
177 (iMessage != SCI_DELETEBACK) &&
178 (iMessage != SCI_DELETEBACKNOTLINE)
179 ) {
180 ct.CallTipCancel();
181 }
182 if ((iMessage == SCI_DELETEBACK) || (iMessage == SCI_DELETEBACKNOTLINE)) {
183 if (sel.MainCaret() <= ct.posStartCallTip) {
184 ct.CallTipCancel();
185 }
186 }
187 }
188 return Editor::KeyCommand(iMessage);
189 }
190
191 void ScintillaBase::AutoCompleteDoubleClick(void *p) {
192 ScintillaBase *sci = reinterpret_cast<ScintillaBase *>(p);
193 sci->AutoCompleteCompleted();
194 }
195
196 void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
197 //Platform::DebugPrintf("AutoComplete %s\n", list);
198 ct.CallTipCancel();
199
200 if (ac.chooseSingle && (listType == 0)) {
201 if (list && !strchr(list, ac.GetSeparator())) {
202 const char *typeSep = strchr(list, ac.GetTypesep());
203 int lenInsert = typeSep ?
204 static_cast<int>(typeSep-list) : static_cast<int>(strlen(list));
205 if (ac.ignoreCase) {
206 SetEmptySelection(sel.MainCaret() - lenEntered);
207 pdoc->DeleteChars(sel.MainCaret(), lenEntered);
208 SetEmptySelection(sel.MainCaret());
209 pdoc->InsertString(sel.MainCaret(), list, lenInsert);
210 SetEmptySelection(sel.MainCaret() + lenInsert);
211 } else {
212 SetEmptySelection(sel.MainCaret());
213 pdoc->InsertString(sel.MainCaret(), list + lenEntered, lenInsert - lenEntered);
214 SetEmptySelection(sel.MainCaret() + lenInsert - lenEntered);
215 }
216 ac.Cancel();
217 return;
218 }
219 }
220 ac.Start(wMain, idAutoComplete, sel.MainCaret(), PointMainCaret(),
221 lenEntered, vs.lineHeight, IsUnicodeMode(), technology);
222
223 PRectangle rcClient = GetClientRectangle();
224 Point pt = LocationFromPosition(sel.MainCaret() - lenEntered);
225 PRectangle rcPopupBounds = wMain.GetMonitorRect(pt);
226 if (rcPopupBounds.Height() == 0)
227 rcPopupBounds = rcClient;
228
229 int heightLB = 100;
230 int widthLB = 100;
231 if (pt.x >= rcClient.right - widthLB) {
232 HorizontalScrollTo(xOffset + pt.x - rcClient.right + widthLB);
233 Redraw();
234 pt = PointMainCaret();
235 }
236 PRectangle rcac;
237 rcac.left = pt.x - ac.lb->CaretFromEdge();
238 if (pt.y >= rcPopupBounds.bottom - heightLB && // Wont fit below.
239 pt.y >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2) { // and there is more room above.
240 rcac.top = pt.y - heightLB;
241 if (rcac.top < rcPopupBounds.top) {
242 heightLB -= (rcPopupBounds.top - rcac.top);
243 rcac.top = rcPopupBounds.top;
244 }
245 } else {
246 rcac.top = pt.y + vs.lineHeight;
247 }
248 rcac.right = rcac.left + widthLB;
249 rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcPopupBounds.bottom);
250 ac.lb->SetPositionRelative(rcac, wMain);
251 ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font);
252 unsigned int aveCharWidth = vs.styles[STYLE_DEFAULT].aveCharWidth;
253 ac.lb->SetAverageCharWidth(aveCharWidth);
254 ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this);
255
256 ac.SetList(list);
257
258 // Fiddle the position of the list so it is right next to the target and wide enough for all its strings
259 PRectangle rcList = ac.lb->GetDesiredRect();
260 int heightAlloced = rcList.bottom - rcList.top;
261 widthLB = Platform::Maximum(widthLB, rcList.right - rcList.left);
262 if (maxListWidth != 0)
263 widthLB = Platform::Minimum(widthLB, aveCharWidth*maxListWidth);
264 // Make an allowance for large strings in list
265 rcList.left = pt.x - ac.lb->CaretFromEdge();
266 rcList.right = rcList.left + widthLB;
267 if (((pt.y + vs.lineHeight) >= (rcPopupBounds.bottom - heightAlloced)) && // Wont fit below.
268 ((pt.y + vs.lineHeight / 2) >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2)) { // and there is more room above.
269 rcList.top = pt.y - heightAlloced;
270 } else {
271 rcList.top = pt.y + vs.lineHeight;
272 }
273 rcList.bottom = rcList.top + heightAlloced;
274 ac.lb->SetPositionRelative(rcList, wMain);
275 ac.Show(true);
276 if (lenEntered != 0) {
277 AutoCompleteMoveToCurrentWord();
278 }
279 }
280
281 void ScintillaBase::AutoCompleteCancel() {
282 if (ac.Active()) {
283 SCNotification scn = {0};
284 scn.nmhdr.code = SCN_AUTOCCANCELLED;
285 scn.wParam = 0;
286 scn.listType = 0;
287 NotifyParent(scn);
288 }
289 ac.Cancel();
290 }
291
292 void ScintillaBase::AutoCompleteMove(int delta) {
293 ac.Move(delta);
294 }
295
296 void ScintillaBase::AutoCompleteMoveToCurrentWord() {
297 std::string wordCurrent = RangeText(ac.posStart - ac.startLen, sel.MainCaret());
298 ac.Select(wordCurrent.c_str());
299 }
300
301 void ScintillaBase::AutoCompleteCharacterAdded(char ch) {
302 if (ac.IsFillUpChar(ch)) {
303 AutoCompleteCompleted();
304 } else if (ac.IsStopChar(ch)) {
305 AutoCompleteCancel();
306 } else {
307 AutoCompleteMoveToCurrentWord();
308 }
309 }
310
311 void ScintillaBase::AutoCompleteCharacterDeleted() {
312 if (sel.MainCaret() < ac.posStart - ac.startLen) {
313 AutoCompleteCancel();
314 } else if (ac.cancelAtStartPos && (sel.MainCaret() <= ac.posStart)) {
315 AutoCompleteCancel();
316 } else {
317 AutoCompleteMoveToCurrentWord();
318 }
319 SCNotification scn = {0};
320 scn.nmhdr.code = SCN_AUTOCCHARDELETED;
321 scn.wParam = 0;
322 scn.listType = 0;
323 NotifyParent(scn);
324 }
325
326 void ScintillaBase::AutoCompleteCompleted() {
327 int item = ac.GetSelection();
328 if (item == -1) {
329 AutoCompleteCancel();
330 return;
331 }
332 const std::string selected = ac.GetValue(item);
333
334 ac.Show(false);
335
336 SCNotification scn = {0};
337 scn.nmhdr.code = listType > 0 ? SCN_USERLISTSELECTION : SCN_AUTOCSELECTION;
338 scn.message = 0;
339 scn.wParam = listType;
340 scn.listType = listType;
341 Position firstPos = ac.posStart - ac.startLen;
342 scn.position = firstPos;
343 scn.lParam = firstPos;
344 scn.text = selected.c_str();
345 NotifyParent(scn);
346
347 if (!ac.Active())
348 return;
349 ac.Cancel();
350
351 if (listType > 0)
352 return;
353
354 Position endPos = sel.MainCaret();
355 if (ac.dropRestOfWord)
356 endPos = pdoc->ExtendWordSelect(endPos, 1, true);
357 if (endPos < firstPos)
358 return;
359 UndoGroup ug(pdoc);
360 if (endPos != firstPos) {
361 pdoc->DeleteChars(firstPos, endPos - firstPos);
362 }
363 SetEmptySelection(ac.posStart);
364 if (item != -1) {
365 pdoc->InsertCString(firstPos, selected.c_str());
366 SetEmptySelection(firstPos + static_cast<int>(selected.length()));
367 }
368 SetLastXChosen();
369 }
370
371 int ScintillaBase::AutoCompleteGetCurrent() {
372 if (!ac.Active())
373 return -1;
374 return ac.GetSelection();
375 }
376
377 int ScintillaBase::AutoCompleteGetCurrentText(char *buffer) {
378 if (ac.Active()) {
379 int item = ac.GetSelection();
380 if (item != -1) {
381 const std::string selected = ac.GetValue(item);
382 if (buffer != NULL)
383 strcpy(buffer, selected.c_str());
384 return static_cast<int>(selected.length());
385 }
386 }
387 if (buffer != NULL)
388 *buffer = '\0';
389 return 0;
390 }
391
392 void ScintillaBase::CallTipShow(Point pt, const char *defn) {
393 ac.Cancel();
394 // If container knows about STYLE_CALLTIP then use it in place of the
395 // STYLE_DEFAULT for the face name, size and character set. Also use it
396 // for the foreground and background colour.
397 int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT;
398 if (ct.UseStyleCallTip()) {
399 ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back);
400 }
401 PRectangle rc = ct.CallTipStart(sel.MainCaret(), pt,
402 vs.lineHeight,
403 defn,
404 vs.styles[ctStyle].fontName,
405 vs.styles[ctStyle].sizeZoomed,
406 CodePage(),
407 vs.styles[ctStyle].characterSet,
408 vs.technology,
409 wMain);
410 // If the call-tip window would be out of the client
411 // space
412 PRectangle rcClient = GetClientRectangle();
413 int offset = vs.lineHeight + rc.Height();
414 // adjust so it displays below the text.
415 if (rc.top < rcClient.top) {
416 rc.top += offset;
417 rc.bottom += offset;
418 }
419 // adjust so it displays above the text.
420 if (rc.bottom > rcClient.bottom) {
421 rc.top -= offset;
422 rc.bottom -= offset;
423 }
424 // Now display the window.
425 CreateCallTipWindow(rc);
426 ct.wCallTip.SetPositionRelative(rc, wMain);
427 ct.wCallTip.Show();
428 }
429
430 void ScintillaBase::CallTipClick() {
431 SCNotification scn = {0};
432 scn.nmhdr.code = SCN_CALLTIPCLICK;
433 scn.position = ct.clickPlace;
434 NotifyParent(scn);
435 }
436
437 void ScintillaBase::ContextMenu(Point pt) {
438 if (displayPopupMenu) {
439 bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
440 popup.CreatePopUp();
441 AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo());
442 AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo());
443 AddToPopUp("");
444 AddToPopUp("Cut", idcmdCut, writable && !sel.Empty());
445 AddToPopUp("Copy", idcmdCopy, !sel.Empty());
446 AddToPopUp("Paste", idcmdPaste, writable && WndProc(SCI_CANPASTE, 0, 0));
447 AddToPopUp("Delete", idcmdDelete, writable && !sel.Empty());
448 AddToPopUp("");
449 AddToPopUp("Select All", idcmdSelectAll);
450 popup.Show(pt, wMain);
451 }
452 }
453
454 void ScintillaBase::CancelModes() {
455 AutoCompleteCancel();
456 ct.CallTipCancel();
457 Editor::CancelModes();
458 }
459
460 void ScintillaBase::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) {
461 CancelModes();
462 Editor::ButtonDown(pt, curTime, shift, ctrl, alt);
463 }
464
465 #ifdef SCI_LEXER
466
467 #ifdef SCI_NAMESPACE
468 namespace Scintilla {
469 #endif
470
471 class LexState : public LexInterface {
472 const LexerModule *lexCurrent;
473 void SetLexerModule(const LexerModule *lex);
474 PropSetSimple props;
475 public:
476 int lexLanguage;
477
478 LexState(Document *pdoc_);
479 virtual ~LexState();
480 void SetLexer(uptr_t wParam);
481 void SetLexerLanguage(const char *languageName);
482 const char *DescribeWordListSets();
483 void SetWordList(int n, const char *wl);
484 int GetStyleBitsNeeded() const;
485 const char *GetName() const;
486 void *PrivateCall(int operation, void *pointer);
487 const char *PropertyNames();
488 int PropertyType(const char *name);
489 const char *DescribeProperty(const char *name);
490 void PropSet(const char *key, const char *val);
491 const char *PropGet(const char *key) const;
492 int PropGetInt(const char *key, int defaultValue=0) const;
493 int PropGetExpanded(const char *key, char *result) const;
494 };
495
496 #ifdef SCI_NAMESPACE
497 }
498 #endif
499
500 LexState::LexState(Document *pdoc_) : LexInterface(pdoc_) {
501 lexCurrent = 0;
502 performingStyle = false;
503 lexLanguage = SCLEX_CONTAINER;
504 }
505
506 LexState::~LexState() {
507 if (instance) {
508 instance->Release();
509 instance = 0;
510 }
511 }
512
513 LexState *ScintillaBase::DocumentLexState() {
514 if (!pdoc->pli) {
515 pdoc->pli = new LexState(pdoc);
516 }
517 return static_cast<LexState *>(pdoc->pli);
518 }
519
520 void LexState::SetLexerModule(const LexerModule *lex) {
521 if (lex != lexCurrent) {
522 if (instance) {
523 instance->Release();
524 instance = 0;
525 }
526 lexCurrent = lex;
527 if (lexCurrent)
528 instance = lexCurrent->Create();
529 pdoc->LexerChanged();
530 }
531 }
532
533 void LexState::SetLexer(uptr_t wParam) {
534 lexLanguage = wParam;
535 if (lexLanguage == SCLEX_CONTAINER) {
536 SetLexerModule(0);
537 } else {
538 const LexerModule *lex = Catalogue::Find(lexLanguage);
539 if (!lex)
540 lex = Catalogue::Find(SCLEX_NULL);
541 SetLexerModule(lex);
542 }
543 }
544
545 void LexState::SetLexerLanguage(const char *languageName) {
546 const LexerModule *lex = Catalogue::Find(languageName);
547 if (!lex)
548 lex = Catalogue::Find(SCLEX_NULL);
549 if (lex)
550 lexLanguage = lex->GetLanguage();
551 SetLexerModule(lex);
552 }
553
554 const char *LexState::DescribeWordListSets() {
555 if (instance) {
556 return instance->DescribeWordListSets();
557 } else {
558 return 0;
559 }
560 }
561
562 void LexState::SetWordList(int n, const char *wl) {
563 if (instance) {
564 int firstModification = instance->WordListSet(n, wl);
565 if (firstModification >= 0) {
566 pdoc->ModifiedAt(firstModification);
567 }
568 }
569 }
570
571 int LexState::GetStyleBitsNeeded() const {
572 return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5;
573 }
574
575 const char *LexState::GetName() const {
576 return lexCurrent ? lexCurrent->languageName : "";
577 }
578
579 void *LexState::PrivateCall(int operation, void *pointer) {
580 if (pdoc && instance) {
581 return instance->PrivateCall(operation, pointer);
582 } else {
583 return 0;
584 }
585 }
586
587 const char *LexState::PropertyNames() {
588 if (instance) {
589 return instance->PropertyNames();
590 } else {
591 return 0;
592 }
593 }
594
595 int LexState::PropertyType(const char *name) {
596 if (instance) {
597 return instance->PropertyType(name);
598 } else {
599 return SC_TYPE_BOOLEAN;
600 }
601 }
602
603 const char *LexState::DescribeProperty(const char *name) {
604 if (instance) {
605 return instance->DescribeProperty(name);
606 } else {
607 return 0;
608 }
609 }
610
611 void LexState::PropSet(const char *key, const char *val) {
612 props.Set(key, val);
613 if (instance) {
614 int firstModification = instance->PropertySet(key, val);
615 if (firstModification >= 0) {
616 pdoc->ModifiedAt(firstModification);
617 }
618 }
619 }
620
621 const char *LexState::PropGet(const char *key) const {
622 return props.Get(key);
623 }
624
625 int LexState::PropGetInt(const char *key, int defaultValue) const {
626 return props.GetInt(key, defaultValue);
627 }
628
629 int LexState::PropGetExpanded(const char *key, char *result) const {
630 return props.GetExpanded(key, result);
631 }
632
633 #endif
634
635 void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) {
636 #ifdef SCI_LEXER
637 if (DocumentLexState()->lexLanguage != SCLEX_CONTAINER) {
638 int lineEndStyled = pdoc->LineFromPosition(pdoc->GetEndStyled());
639 int endStyled = pdoc->LineStart(lineEndStyled);
640 DocumentLexState()->Colourise(endStyled, endStyleNeeded);
641 return;
642 }
643 #endif
644 Editor::NotifyStyleToNeeded(endStyleNeeded);
645 }
646
647 void ScintillaBase::NotifyLexerChanged(Document *, void *) {
648 #ifdef SCI_LEXER
649 int bits = DocumentLexState()->GetStyleBitsNeeded();
650 vs.EnsureStyle((1 << bits) - 1);
651 #endif
652 }
653
654 sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
655 switch (iMessage) {
656 case SCI_AUTOCSHOW:
657 listType = 0;
658 AutoCompleteStart(wParam, reinterpret_cast<const char *>(lParam));
659 break;
660
661 case SCI_AUTOCCANCEL:
662 ac.Cancel();
663 break;
664
665 case SCI_AUTOCACTIVE:
666 return ac.Active();
667
668 case SCI_AUTOCPOSSTART:
669 return ac.posStart;
670
671 case SCI_AUTOCCOMPLETE:
672 AutoCompleteCompleted();
673 break;
674
675 case SCI_AUTOCSETSEPARATOR:
676 ac.SetSeparator(static_cast<char>(wParam));
677 break;
678
679 case SCI_AUTOCGETSEPARATOR:
680 return ac.GetSeparator();
681
682 case SCI_AUTOCSTOPS:
683 ac.SetStopChars(reinterpret_cast<char *>(lParam));
684 break;
685
686 case SCI_AUTOCSELECT:
687 ac.Select(reinterpret_cast<char *>(lParam));
688 break;
689
690 case SCI_AUTOCGETCURRENT:
691 return AutoCompleteGetCurrent();
692
693 case SCI_AUTOCGETCURRENTTEXT:
694 return AutoCompleteGetCurrentText(reinterpret_cast<char *>(lParam));
695
696 case SCI_AUTOCSETCANCELATSTART:
697 ac.cancelAtStartPos = wParam != 0;
698 break;
699
700 case SCI_AUTOCGETCANCELATSTART:
701 return ac.cancelAtStartPos;
702
703 case SCI_AUTOCSETFILLUPS:
704 ac.SetFillUpChars(reinterpret_cast<char *>(lParam));
705 break;
706
707 case SCI_AUTOCSETCHOOSESINGLE:
708 ac.chooseSingle = wParam != 0;
709 break;
710
711 case SCI_AUTOCGETCHOOSESINGLE:
712 return ac.chooseSingle;
713
714 case SCI_AUTOCSETIGNORECASE:
715 ac.ignoreCase = wParam != 0;
716 break;
717
718 case SCI_AUTOCGETIGNORECASE:
719 return ac.ignoreCase;
720
721 case SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR:
722 ac.ignoreCaseBehaviour = wParam;
723 break;
724
725 case SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR:
726 return ac.ignoreCaseBehaviour;
727
728 case SCI_USERLISTSHOW:
729 listType = wParam;
730 AutoCompleteStart(0, reinterpret_cast<const char *>(lParam));
731 break;
732
733 case SCI_AUTOCSETAUTOHIDE:
734 ac.autoHide = wParam != 0;
735 break;
736
737 case SCI_AUTOCGETAUTOHIDE:
738 return ac.autoHide;
739
740 case SCI_AUTOCSETDROPRESTOFWORD:
741 ac.dropRestOfWord = wParam != 0;
742 break;
743
744 case SCI_AUTOCGETDROPRESTOFWORD:
745 return ac.dropRestOfWord;
746
747 case SCI_AUTOCSETMAXHEIGHT:
748 ac.lb->SetVisibleRows(wParam);
749 break;
750
751 case SCI_AUTOCGETMAXHEIGHT:
752 return ac.lb->GetVisibleRows();
753
754 case SCI_AUTOCSETMAXWIDTH:
755 maxListWidth = wParam;
756 break;
757
758 case SCI_AUTOCGETMAXWIDTH:
759 return maxListWidth;
760
761 case SCI_REGISTERIMAGE:
762 ac.lb->RegisterImage(wParam, reinterpret_cast<const char *>(lParam));
763 break;
764
765 case SCI_REGISTERRGBAIMAGE:
766 ac.lb->RegisterRGBAImage(wParam, sizeRGBAImage.x, sizeRGBAImage.y, reinterpret_cast<unsigned char *>(lParam));
767 break;
768
769 case SCI_CLEARREGISTEREDIMAGES:
770 ac.lb->ClearRegisteredImages();
771 break;
772
773 case SCI_AUTOCSETTYPESEPARATOR:
774 ac.SetTypesep(static_cast<char>(wParam));
775 break;
776
777 case SCI_AUTOCGETTYPESEPARATOR:
778 return ac.GetTypesep();
779
780 case SCI_CALLTIPSHOW:
781 CallTipShow(LocationFromPosition(wParam),
782 reinterpret_cast<const char *>(lParam));
783 break;
784
785 case SCI_CALLTIPCANCEL:
786 ct.CallTipCancel();
787 break;
788
789 case SCI_CALLTIPACTIVE:
790 return ct.inCallTipMode;
791
792 case SCI_CALLTIPPOSSTART:
793 return ct.posStartCallTip;
794
795 case SCI_CALLTIPSETHLT:
796 ct.SetHighlight(wParam, lParam);
797 break;
798
799 case SCI_CALLTIPSETBACK:
800 ct.colourBG = ColourDesired(wParam);
801 vs.styles[STYLE_CALLTIP].back = ct.colourBG;
802 InvalidateStyleRedraw();
803 break;
804
805 case SCI_CALLTIPSETFORE:
806 ct.colourUnSel = ColourDesired(wParam);
807 vs.styles[STYLE_CALLTIP].fore = ct.colourUnSel;
808 InvalidateStyleRedraw();
809 break;
810
811 case SCI_CALLTIPSETFOREHLT:
812 ct.colourSel = ColourDesired(wParam);
813 InvalidateStyleRedraw();
814 break;
815
816 case SCI_CALLTIPUSESTYLE:
817 ct.SetTabSize((int)wParam);
818 InvalidateStyleRedraw();
819 break;
820
821 case SCI_CALLTIPSETPOSITION:
822 ct.SetPosition(wParam != 0);
823 InvalidateStyleRedraw();
824 break;
825
826 case SCI_USEPOPUP:
827 displayPopupMenu = wParam != 0;
828 break;
829
830 #ifdef SCI_LEXER
831 case SCI_SETLEXER:
832 DocumentLexState()->SetLexer(wParam);
833 break;
834
835 case SCI_GETLEXER:
836 return DocumentLexState()->lexLanguage;
837
838 case SCI_COLOURISE:
839 if (DocumentLexState()->lexLanguage == SCLEX_CONTAINER) {
840 pdoc->ModifiedAt(wParam);
841 NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : lParam);
842 } else {
843 DocumentLexState()->Colourise(wParam, lParam);
844 }
845 Redraw();
846 break;
847
848 case SCI_SETPROPERTY:
849 DocumentLexState()->PropSet(reinterpret_cast<const char *>(wParam),
850 reinterpret_cast<const char *>(lParam));
851 break;
852
853 case SCI_GETPROPERTY:
854 return StringResult(lParam, DocumentLexState()->PropGet(reinterpret_cast<const char *>(wParam)));
855
856 case SCI_GETPROPERTYEXPANDED:
857 return DocumentLexState()->PropGetExpanded(reinterpret_cast<const char *>(wParam),
858 reinterpret_cast<char *>(lParam));
859
860 case SCI_GETPROPERTYINT:
861 return DocumentLexState()->PropGetInt(reinterpret_cast<const char *>(wParam), lParam);
862
863 case SCI_SETKEYWORDS:
864 DocumentLexState()->SetWordList(wParam, reinterpret_cast<const char *>(lParam));
865 break;
866
867 case SCI_SETLEXERLANGUAGE:
868 DocumentLexState()->SetLexerLanguage(reinterpret_cast<const char *>(lParam));
869 break;
870
871 case SCI_GETLEXERLANGUAGE:
872 return StringResult(lParam, DocumentLexState()->GetName());
873
874 case SCI_PRIVATELEXERCALL:
875 return reinterpret_cast<sptr_t>(
876 DocumentLexState()->PrivateCall(wParam, reinterpret_cast<void *>(lParam)));
877
878 case SCI_GETSTYLEBITSNEEDED:
879 return DocumentLexState()->GetStyleBitsNeeded();
880
881 case SCI_PROPERTYNAMES:
882 return StringResult(lParam, DocumentLexState()->PropertyNames());
883
884 case SCI_PROPERTYTYPE:
885 return DocumentLexState()->PropertyType(reinterpret_cast<const char *>(wParam));
886
887 case SCI_DESCRIBEPROPERTY:
888 return StringResult(lParam, DocumentLexState()->DescribeProperty(reinterpret_cast<const char *>(wParam)));
889
890 case SCI_DESCRIBEKEYWORDSETS:
891 return StringResult(lParam, DocumentLexState()->DescribeWordListSets());
892
893 #endif
894
895 default:
896 return Editor::WndProc(iMessage, wParam, lParam);
897 }
898 return 0l;
899 }