1 // Scintilla source code edit control
2 /** @file ScintillaBase.cxx
3 ** An enhanced subclass of Editor with calltips, autocomplete and context menu.
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.
22 #include "Scintilla.h"
24 #include "PropSetSimple.h"
27 #include "LexerModule.h"
28 #include "Catalogue.h"
30 #include "SplitVector.h"
31 #include "Partitioning.h"
32 #include "RunStyles.h"
33 #include "ContractionState.h"
34 #include "CellBuffer.h"
37 #include "Indicator.h"
39 #include "LineMarker.h"
41 #include "ViewStyle.h"
42 #include "AutoComplete.h"
43 #include "CharClassify.h"
44 #include "Decoration.h"
45 #include "CaseFolder.h"
47 #include "Selection.h"
48 #include "PositionCache.h"
50 #include "ScintillaBase.h"
53 using namespace Scintilla
;
56 ScintillaBase::ScintillaBase() {
57 displayPopupMenu
= true;
62 ScintillaBase::~ScintillaBase() {
65 void ScintillaBase::Finalise() {
70 void ScintillaBase::AddCharUTF(char *s
, unsigned int len
, bool treatAsDBCS
) {
71 bool isFillUp
= ac
.Active() && ac
.IsFillUpChar(*s
);
73 Editor::AddCharUTF(s
, len
, treatAsDBCS
);
76 AutoCompleteCharacterAdded(s
[0]);
77 // For fill ups add the character after the autocompletion has
78 // triggered so containers see the key so can display a calltip.
80 Editor::AddCharUTF(s
, len
, treatAsDBCS
);
85 void ScintillaBase::Command(int cmdId
) {
89 case idAutoComplete
: // Nothing to do
93 case idCallTip
: // Nothing to do
98 WndProc(SCI_UNDO
, 0, 0);
102 WndProc(SCI_REDO
, 0, 0);
106 WndProc(SCI_CUT
, 0, 0);
110 WndProc(SCI_COPY
, 0, 0);
114 WndProc(SCI_PASTE
, 0, 0);
118 WndProc(SCI_CLEAR
, 0, 0);
122 WndProc(SCI_SELECTALL
, 0, 0);
127 int ScintillaBase::KeyCommand(unsigned int iMessage
) {
128 // Most key commands cancel autocompletion mode
136 AutoCompleteMove(-1);
139 AutoCompleteMove(ac
.lb
->GetVisibleRows());
142 AutoCompleteMove(-ac
.lb
->GetVisibleRows());
145 AutoCompleteMove(-5000);
148 AutoCompleteMove(5000);
152 AutoCompleteCharacterDeleted();
153 EnsureCaretVisible();
155 case SCI_DELETEBACKNOTLINE
:
157 AutoCompleteCharacterDeleted();
158 EnsureCaretVisible();
161 AutoCompleteCompleted();
164 AutoCompleteCompleted();
168 AutoCompleteCancel();
172 if (ct
.inCallTipMode
) {
174 (iMessage
!= SCI_CHARLEFT
) &&
175 (iMessage
!= SCI_CHARLEFTEXTEND
) &&
176 (iMessage
!= SCI_CHARRIGHT
) &&
177 (iMessage
!= SCI_CHARRIGHTEXTEND
) &&
178 (iMessage
!= SCI_EDITTOGGLEOVERTYPE
) &&
179 (iMessage
!= SCI_DELETEBACK
) &&
180 (iMessage
!= SCI_DELETEBACKNOTLINE
)
184 if ((iMessage
== SCI_DELETEBACK
) || (iMessage
== SCI_DELETEBACKNOTLINE
)) {
185 if (sel
.MainCaret() <= ct
.posStartCallTip
) {
190 return Editor::KeyCommand(iMessage
);
193 void ScintillaBase::AutoCompleteDoubleClick(void *p
) {
194 ScintillaBase
*sci
= reinterpret_cast<ScintillaBase
*>(p
);
195 sci
->AutoCompleteCompleted();
198 void ScintillaBase::AutoCompleteInsert(Position startPos
, int removeLen
, const char *text
, int textLen
) {
200 pdoc
->DeleteChars(startPos
, removeLen
);
201 pdoc
->InsertString(startPos
, text
, textLen
);
202 SetEmptySelection(startPos
+ textLen
);
205 void ScintillaBase::AutoCompleteStart(int lenEntered
, const char *list
) {
206 //Platform::DebugPrintf("AutoComplete %s\n", list);
209 if (ac
.chooseSingle
&& (listType
== 0)) {
210 if (list
&& !strchr(list
, ac
.GetSeparator())) {
211 const char *typeSep
= strchr(list
, ac
.GetTypesep());
212 int lenInsert
= typeSep
?
213 static_cast<int>(typeSep
-list
) : static_cast<int>(strlen(list
));
215 // May need to convert the case before invocation, so remove lenEntered characters
216 AutoCompleteInsert(sel
.MainCaret() - lenEntered
, lenEntered
, list
, lenInsert
);
218 AutoCompleteInsert(sel
.MainCaret(), 0, list
+ lenEntered
, lenInsert
- lenEntered
);
224 ac
.Start(wMain
, idAutoComplete
, sel
.MainCaret(), PointMainCaret(),
225 lenEntered
, vs
.lineHeight
, IsUnicodeMode(), technology
);
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
= ac
.heightLBDefault
;
234 int widthLB
= ac
.widthLBDefault
;
235 if (pt
.x
>= rcClient
.right
- widthLB
) {
236 HorizontalScrollTo(xOffset
+ pt
.x
- rcClient
.right
+ widthLB
);
238 pt
= PointMainCaret();
240 if (wMargin
.GetID()) {
241 Point ptOrigin
= GetVisibleOriginInMain();
246 rcac
.left
= pt
.x
- ac
.lb
->CaretFromEdge();
247 if (pt
.y
>= rcPopupBounds
.bottom
- heightLB
&& // Wont fit below.
248 pt
.y
>= (rcPopupBounds
.bottom
+ rcPopupBounds
.top
) / 2) { // and there is more room above.
249 rcac
.top
= pt
.y
- heightLB
;
250 if (rcac
.top
< rcPopupBounds
.top
) {
251 heightLB
-= (rcPopupBounds
.top
- rcac
.top
);
252 rcac
.top
= rcPopupBounds
.top
;
255 rcac
.top
= pt
.y
+ vs
.lineHeight
;
257 rcac
.right
= rcac
.left
+ widthLB
;
258 rcac
.bottom
= Platform::Minimum(rcac
.top
+ heightLB
, rcPopupBounds
.bottom
);
259 ac
.lb
->SetPositionRelative(rcac
, wMain
);
260 ac
.lb
->SetFont(vs
.styles
[STYLE_DEFAULT
].font
);
261 unsigned int aveCharWidth
= vs
.styles
[STYLE_DEFAULT
].aveCharWidth
;
262 ac
.lb
->SetAverageCharWidth(aveCharWidth
);
263 ac
.lb
->SetDoubleClickAction(AutoCompleteDoubleClick
, this);
265 ac
.SetList(list
? list
: "");
267 // Fiddle the position of the list so it is right next to the target and wide enough for all its strings
268 PRectangle rcList
= ac
.lb
->GetDesiredRect();
269 int heightAlloced
= rcList
.bottom
- rcList
.top
;
270 widthLB
= Platform::Maximum(widthLB
, rcList
.right
- rcList
.left
);
271 if (maxListWidth
!= 0)
272 widthLB
= Platform::Minimum(widthLB
, aveCharWidth
*maxListWidth
);
273 // Make an allowance for large strings in list
274 rcList
.left
= pt
.x
- ac
.lb
->CaretFromEdge();
275 rcList
.right
= rcList
.left
+ widthLB
;
276 if (((pt
.y
+ vs
.lineHeight
) >= (rcPopupBounds
.bottom
- heightAlloced
)) && // Wont fit below.
277 ((pt
.y
+ vs
.lineHeight
/ 2) >= (rcPopupBounds
.bottom
+ rcPopupBounds
.top
) / 2)) { // and there is more room above.
278 rcList
.top
= pt
.y
- heightAlloced
;
280 rcList
.top
= pt
.y
+ vs
.lineHeight
;
282 rcList
.bottom
= rcList
.top
+ heightAlloced
;
283 ac
.lb
->SetPositionRelative(rcList
, wMain
);
285 if (lenEntered
!= 0) {
286 AutoCompleteMoveToCurrentWord();
290 void ScintillaBase::AutoCompleteCancel() {
292 SCNotification scn
= {};
293 scn
.nmhdr
.code
= SCN_AUTOCCANCELLED
;
301 void ScintillaBase::AutoCompleteMove(int delta
) {
305 void ScintillaBase::AutoCompleteMoveToCurrentWord() {
306 std::string wordCurrent
= RangeText(ac
.posStart
- ac
.startLen
, sel
.MainCaret());
307 ac
.Select(wordCurrent
.c_str());
310 void ScintillaBase::AutoCompleteCharacterAdded(char ch
) {
311 if (ac
.IsFillUpChar(ch
)) {
312 AutoCompleteCompleted();
313 } else if (ac
.IsStopChar(ch
)) {
314 AutoCompleteCancel();
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();
326 AutoCompleteMoveToCurrentWord();
328 SCNotification scn
= {};
329 scn
.nmhdr
.code
= SCN_AUTOCCHARDELETED
;
335 void ScintillaBase::AutoCompleteCompleted() {
336 int item
= ac
.GetSelection();
338 AutoCompleteCancel();
341 const std::string selected
= ac
.GetValue(item
);
345 SCNotification scn
= {};
346 scn
.nmhdr
.code
= listType
> 0 ? SCN_USERLISTSELECTION
: SCN_AUTOCSELECTION
;
348 scn
.wParam
= listType
;
349 scn
.listType
= listType
;
350 Position firstPos
= ac
.posStart
- ac
.startLen
;
351 scn
.position
= firstPos
;
352 scn
.lParam
= firstPos
;
353 scn
.text
= selected
.c_str();
363 Position endPos
= sel
.MainCaret();
364 if (ac
.dropRestOfWord
)
365 endPos
= pdoc
->ExtendWordSelect(endPos
, 1, true);
366 if (endPos
< firstPos
)
368 AutoCompleteInsert(firstPos
, endPos
- firstPos
, selected
.c_str(), static_cast<int>(selected
.length()));
372 int ScintillaBase::AutoCompleteGetCurrent() const {
375 return ac
.GetSelection();
378 int ScintillaBase::AutoCompleteGetCurrentText(char *buffer
) const {
380 int item
= ac
.GetSelection();
382 const std::string selected
= ac
.GetValue(item
);
384 memcpy(buffer
, selected
.c_str(), selected
.length()+1);
385 return static_cast<int>(selected
.length());
393 void ScintillaBase::CallTipShow(Point pt
, const char *defn
) {
395 // If container knows about STYLE_CALLTIP then use it in place of the
396 // STYLE_DEFAULT for the face name, size and character set. Also use it
397 // for the foreground and background colour.
398 int ctStyle
= ct
.UseStyleCallTip() ? STYLE_CALLTIP
: STYLE_DEFAULT
;
399 if (ct
.UseStyleCallTip()) {
400 ct
.SetForeBack(vs
.styles
[STYLE_CALLTIP
].fore
, vs
.styles
[STYLE_CALLTIP
].back
);
402 if (wMargin
.GetID()) {
403 Point ptOrigin
= GetVisibleOriginInMain();
407 PRectangle rc
= ct
.CallTipStart(sel
.MainCaret(), pt
,
410 vs
.styles
[ctStyle
].fontName
,
411 vs
.styles
[ctStyle
].sizeZoomed
,
413 vs
.styles
[ctStyle
].characterSet
,
416 // If the call-tip window would be out of the client
418 PRectangle rcClient
= GetClientRectangle();
419 int offset
= vs
.lineHeight
+ rc
.Height();
420 // adjust so it displays above the text.
421 if (rc
.bottom
> rcClient
.bottom
) {
425 // adjust so it displays below the text.
426 if (rc
.top
< rcClient
.top
) {
430 // Now display the window.
431 CreateCallTipWindow(rc
);
432 ct
.wCallTip
.SetPositionRelative(rc
, wMain
);
436 void ScintillaBase::CallTipClick() {
437 SCNotification scn
= {};
438 scn
.nmhdr
.code
= SCN_CALLTIPCLICK
;
439 scn
.position
= ct
.clickPlace
;
443 void ScintillaBase::ContextMenu(Point pt
) {
444 if (displayPopupMenu
) {
445 bool writable
= !WndProc(SCI_GETREADONLY
, 0, 0);
447 AddToPopUp("Undo", idcmdUndo
, writable
&& pdoc
->CanUndo());
448 AddToPopUp("Redo", idcmdRedo
, writable
&& pdoc
->CanRedo());
450 AddToPopUp("Cut", idcmdCut
, writable
&& !sel
.Empty());
451 AddToPopUp("Copy", idcmdCopy
, !sel
.Empty());
452 AddToPopUp("Paste", idcmdPaste
, writable
&& WndProc(SCI_CANPASTE
, 0, 0));
453 AddToPopUp("Delete", idcmdDelete
, writable
&& !sel
.Empty());
455 AddToPopUp("Select All", idcmdSelectAll
);
456 popup
.Show(pt
, wMain
);
460 void ScintillaBase::CancelModes() {
461 AutoCompleteCancel();
463 Editor::CancelModes();
466 void ScintillaBase::ButtonDownWithModifiers(Point pt
, unsigned int curTime
, int modifiers
) {
468 Editor::ButtonDownWithModifiers(pt
, curTime
, modifiers
);
471 void ScintillaBase::ButtonDown(Point pt
, unsigned int curTime
, bool shift
, bool ctrl
, bool alt
) {
472 ButtonDownWithModifiers(pt
, curTime
, ModifierFlags(shift
, ctrl
, alt
));
478 namespace Scintilla
{
481 class LexState
: public LexInterface
{
482 const LexerModule
*lexCurrent
;
483 void SetLexerModule(const LexerModule
*lex
);
485 int interfaceVersion
;
489 explicit LexState(Document
*pdoc_
);
491 void SetLexer(uptr_t wParam
);
492 void SetLexerLanguage(const char *languageName
);
493 const char *DescribeWordListSets();
494 void SetWordList(int n
, const char *wl
);
495 int GetStyleBitsNeeded() const;
496 const char *GetName() const;
497 void *PrivateCall(int operation
, void *pointer
);
498 const char *PropertyNames();
499 int PropertyType(const char *name
);
500 const char *DescribeProperty(const char *name
);
501 void PropSet(const char *key
, const char *val
);
502 const char *PropGet(const char *key
) const;
503 int PropGetInt(const char *key
, int defaultValue
=0) const;
504 int PropGetExpanded(const char *key
, char *result
) const;
506 int LineEndTypesSupported();
507 int AllocateSubStyles(int styleBase
, int numberStyles
);
508 int SubStylesStart(int styleBase
);
509 int SubStylesLength(int styleBase
);
510 int StyleFromSubStyle(int subStyle
);
511 int PrimaryStyleFromStyle(int style
);
512 void FreeSubStyles();
513 void SetIdentifiers(int style
, const char *identifiers
);
514 int DistanceToSecondaryStyles();
515 const char *GetSubStyleBases();
522 LexState::LexState(Document
*pdoc_
) : LexInterface(pdoc_
) {
524 performingStyle
= false;
525 interfaceVersion
= lvOriginal
;
526 lexLanguage
= SCLEX_CONTAINER
;
529 LexState::~LexState() {
536 LexState
*ScintillaBase::DocumentLexState() {
538 pdoc
->pli
= new LexState(pdoc
);
540 return static_cast<LexState
*>(pdoc
->pli
);
543 void LexState::SetLexerModule(const LexerModule
*lex
) {
544 if (lex
!= lexCurrent
) {
549 interfaceVersion
= lvOriginal
;
552 instance
= lexCurrent
->Create();
553 interfaceVersion
= instance
->Version();
555 pdoc
->LexerChanged();
559 void LexState::SetLexer(uptr_t wParam
) {
560 lexLanguage
= wParam
;
561 if (lexLanguage
== SCLEX_CONTAINER
) {
564 const LexerModule
*lex
= Catalogue::Find(lexLanguage
);
566 lex
= Catalogue::Find(SCLEX_NULL
);
571 void LexState::SetLexerLanguage(const char *languageName
) {
572 const LexerModule
*lex
= Catalogue::Find(languageName
);
574 lex
= Catalogue::Find(SCLEX_NULL
);
576 lexLanguage
= lex
->GetLanguage();
580 const char *LexState::DescribeWordListSets() {
582 return instance
->DescribeWordListSets();
588 void LexState::SetWordList(int n
, const char *wl
) {
590 int firstModification
= instance
->WordListSet(n
, wl
);
591 if (firstModification
>= 0) {
592 pdoc
->ModifiedAt(firstModification
);
597 int LexState::GetStyleBitsNeeded() const {
598 return lexCurrent
? lexCurrent
->GetStyleBitsNeeded() : 5;
601 const char *LexState::GetName() const {
602 return lexCurrent
? lexCurrent
->languageName
: "";
605 void *LexState::PrivateCall(int operation
, void *pointer
) {
606 if (pdoc
&& instance
) {
607 return instance
->PrivateCall(operation
, pointer
);
613 const char *LexState::PropertyNames() {
615 return instance
->PropertyNames();
621 int LexState::PropertyType(const char *name
) {
623 return instance
->PropertyType(name
);
625 return SC_TYPE_BOOLEAN
;
629 const char *LexState::DescribeProperty(const char *name
) {
631 return instance
->DescribeProperty(name
);
637 void LexState::PropSet(const char *key
, const char *val
) {
640 int firstModification
= instance
->PropertySet(key
, val
);
641 if (firstModification
>= 0) {
642 pdoc
->ModifiedAt(firstModification
);
647 const char *LexState::PropGet(const char *key
) const {
648 return props
.Get(key
);
651 int LexState::PropGetInt(const char *key
, int defaultValue
) const {
652 return props
.GetInt(key
, defaultValue
);
655 int LexState::PropGetExpanded(const char *key
, char *result
) const {
656 return props
.GetExpanded(key
, result
);
659 int LexState::LineEndTypesSupported() {
660 if (instance
&& (interfaceVersion
>= lvSubStyles
)) {
661 return static_cast<ILexerWithSubStyles
*>(instance
)->LineEndTypesSupported();
666 int LexState::AllocateSubStyles(int styleBase
, int numberStyles
) {
667 if (instance
&& (interfaceVersion
>= lvSubStyles
)) {
668 return static_cast<ILexerWithSubStyles
*>(instance
)->AllocateSubStyles(styleBase
, numberStyles
);
673 int LexState::SubStylesStart(int styleBase
) {
674 if (instance
&& (interfaceVersion
>= lvSubStyles
)) {
675 return static_cast<ILexerWithSubStyles
*>(instance
)->SubStylesStart(styleBase
);
680 int LexState::SubStylesLength(int styleBase
) {
681 if (instance
&& (interfaceVersion
>= lvSubStyles
)) {
682 return static_cast<ILexerWithSubStyles
*>(instance
)->SubStylesLength(styleBase
);
687 int LexState::StyleFromSubStyle(int subStyle
) {
688 if (instance
&& (interfaceVersion
>= lvSubStyles
)) {
689 return static_cast<ILexerWithSubStyles
*>(instance
)->StyleFromSubStyle(subStyle
);
694 int LexState::PrimaryStyleFromStyle(int style
) {
695 if (instance
&& (interfaceVersion
>= lvSubStyles
)) {
696 return static_cast<ILexerWithSubStyles
*>(instance
)->PrimaryStyleFromStyle(style
);
701 void LexState::FreeSubStyles() {
702 if (instance
&& (interfaceVersion
>= lvSubStyles
)) {
703 static_cast<ILexerWithSubStyles
*>(instance
)->FreeSubStyles();
707 void LexState::SetIdentifiers(int style
, const char *identifiers
) {
708 if (instance
&& (interfaceVersion
>= lvSubStyles
)) {
709 static_cast<ILexerWithSubStyles
*>(instance
)->SetIdentifiers(style
, identifiers
);
713 int LexState::DistanceToSecondaryStyles() {
714 if (instance
&& (interfaceVersion
>= lvSubStyles
)) {
715 return static_cast<ILexerWithSubStyles
*>(instance
)->DistanceToSecondaryStyles();
720 const char *LexState::GetSubStyleBases() {
721 if (instance
&& (interfaceVersion
>= lvSubStyles
)) {
722 return static_cast<ILexerWithSubStyles
*>(instance
)->GetSubStyleBases();
729 void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded
) {
731 if (DocumentLexState()->lexLanguage
!= SCLEX_CONTAINER
) {
732 int lineEndStyled
= pdoc
->LineFromPosition(pdoc
->GetEndStyled());
733 int endStyled
= pdoc
->LineStart(lineEndStyled
);
734 DocumentLexState()->Colourise(endStyled
, endStyleNeeded
);
738 Editor::NotifyStyleToNeeded(endStyleNeeded
);
741 void ScintillaBase::NotifyLexerChanged(Document
*, void *) {
743 int bits
= DocumentLexState()->GetStyleBitsNeeded();
744 vs
.EnsureStyle((1 << bits
) - 1);
748 sptr_t
ScintillaBase::WndProc(unsigned int iMessage
, uptr_t wParam
, sptr_t lParam
) {
752 AutoCompleteStart(wParam
, reinterpret_cast<const char *>(lParam
));
755 case SCI_AUTOCCANCEL
:
759 case SCI_AUTOCACTIVE
:
762 case SCI_AUTOCPOSSTART
:
765 case SCI_AUTOCCOMPLETE
:
766 AutoCompleteCompleted();
769 case SCI_AUTOCSETSEPARATOR
:
770 ac
.SetSeparator(static_cast<char>(wParam
));
773 case SCI_AUTOCGETSEPARATOR
:
774 return ac
.GetSeparator();
777 ac
.SetStopChars(reinterpret_cast<char *>(lParam
));
780 case SCI_AUTOCSELECT
:
781 ac
.Select(reinterpret_cast<char *>(lParam
));
784 case SCI_AUTOCGETCURRENT
:
785 return AutoCompleteGetCurrent();
787 case SCI_AUTOCGETCURRENTTEXT
:
788 return AutoCompleteGetCurrentText(reinterpret_cast<char *>(lParam
));
790 case SCI_AUTOCSETCANCELATSTART
:
791 ac
.cancelAtStartPos
= wParam
!= 0;
794 case SCI_AUTOCGETCANCELATSTART
:
795 return ac
.cancelAtStartPos
;
797 case SCI_AUTOCSETFILLUPS
:
798 ac
.SetFillUpChars(reinterpret_cast<char *>(lParam
));
801 case SCI_AUTOCSETCHOOSESINGLE
:
802 ac
.chooseSingle
= wParam
!= 0;
805 case SCI_AUTOCGETCHOOSESINGLE
:
806 return ac
.chooseSingle
;
808 case SCI_AUTOCSETIGNORECASE
:
809 ac
.ignoreCase
= wParam
!= 0;
812 case SCI_AUTOCGETIGNORECASE
:
813 return ac
.ignoreCase
;
815 case SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR
:
816 ac
.ignoreCaseBehaviour
= wParam
;
819 case SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR
:
820 return ac
.ignoreCaseBehaviour
;
822 case SCI_AUTOCSETORDER
:
823 ac
.autoSort
= wParam
;
826 case SCI_AUTOCGETORDER
:
829 case SCI_USERLISTSHOW
:
831 AutoCompleteStart(0, reinterpret_cast<const char *>(lParam
));
834 case SCI_AUTOCSETAUTOHIDE
:
835 ac
.autoHide
= wParam
!= 0;
838 case SCI_AUTOCGETAUTOHIDE
:
841 case SCI_AUTOCSETDROPRESTOFWORD
:
842 ac
.dropRestOfWord
= wParam
!= 0;
845 case SCI_AUTOCGETDROPRESTOFWORD
:
846 return ac
.dropRestOfWord
;
848 case SCI_AUTOCSETMAXHEIGHT
:
849 ac
.lb
->SetVisibleRows(wParam
);
852 case SCI_AUTOCGETMAXHEIGHT
:
853 return ac
.lb
->GetVisibleRows();
855 case SCI_AUTOCSETMAXWIDTH
:
856 maxListWidth
= wParam
;
859 case SCI_AUTOCGETMAXWIDTH
:
862 case SCI_REGISTERIMAGE
:
863 ac
.lb
->RegisterImage(wParam
, reinterpret_cast<const char *>(lParam
));
866 case SCI_REGISTERRGBAIMAGE
:
867 ac
.lb
->RegisterRGBAImage(wParam
, sizeRGBAImage
.x
, sizeRGBAImage
.y
, reinterpret_cast<unsigned char *>(lParam
));
870 case SCI_CLEARREGISTEREDIMAGES
:
871 ac
.lb
->ClearRegisteredImages();
874 case SCI_AUTOCSETTYPESEPARATOR
:
875 ac
.SetTypesep(static_cast<char>(wParam
));
878 case SCI_AUTOCGETTYPESEPARATOR
:
879 return ac
.GetTypesep();
881 case SCI_CALLTIPSHOW
:
882 CallTipShow(LocationFromPosition(wParam
),
883 reinterpret_cast<const char *>(lParam
));
886 case SCI_CALLTIPCANCEL
:
890 case SCI_CALLTIPACTIVE
:
891 return ct
.inCallTipMode
;
893 case SCI_CALLTIPPOSSTART
:
894 return ct
.posStartCallTip
;
896 case SCI_CALLTIPSETPOSSTART
:
897 ct
.posStartCallTip
= wParam
;
900 case SCI_CALLTIPSETHLT
:
901 ct
.SetHighlight(wParam
, lParam
);
904 case SCI_CALLTIPSETBACK
:
905 ct
.colourBG
= ColourDesired(wParam
);
906 vs
.styles
[STYLE_CALLTIP
].back
= ct
.colourBG
;
907 InvalidateStyleRedraw();
910 case SCI_CALLTIPSETFORE
:
911 ct
.colourUnSel
= ColourDesired(wParam
);
912 vs
.styles
[STYLE_CALLTIP
].fore
= ct
.colourUnSel
;
913 InvalidateStyleRedraw();
916 case SCI_CALLTIPSETFOREHLT
:
917 ct
.colourSel
= ColourDesired(wParam
);
918 InvalidateStyleRedraw();
921 case SCI_CALLTIPUSESTYLE
:
922 ct
.SetTabSize((int)wParam
);
923 InvalidateStyleRedraw();
926 case SCI_CALLTIPSETPOSITION
:
927 ct
.SetPosition(wParam
!= 0);
928 InvalidateStyleRedraw();
932 displayPopupMenu
= wParam
!= 0;
937 DocumentLexState()->SetLexer(wParam
);
941 return DocumentLexState()->lexLanguage
;
944 if (DocumentLexState()->lexLanguage
== SCLEX_CONTAINER
) {
945 pdoc
->ModifiedAt(wParam
);
946 NotifyStyleToNeeded((lParam
== -1) ? pdoc
->Length() : lParam
);
948 DocumentLexState()->Colourise(wParam
, lParam
);
953 case SCI_SETPROPERTY
:
954 DocumentLexState()->PropSet(reinterpret_cast<const char *>(wParam
),
955 reinterpret_cast<const char *>(lParam
));
958 case SCI_GETPROPERTY
:
959 return StringResult(lParam
, DocumentLexState()->PropGet(reinterpret_cast<const char *>(wParam
)));
961 case SCI_GETPROPERTYEXPANDED
:
962 return DocumentLexState()->PropGetExpanded(reinterpret_cast<const char *>(wParam
),
963 reinterpret_cast<char *>(lParam
));
965 case SCI_GETPROPERTYINT
:
966 return DocumentLexState()->PropGetInt(reinterpret_cast<const char *>(wParam
), lParam
);
968 case SCI_SETKEYWORDS
:
969 DocumentLexState()->SetWordList(wParam
, reinterpret_cast<const char *>(lParam
));
972 case SCI_SETLEXERLANGUAGE
:
973 DocumentLexState()->SetLexerLanguage(reinterpret_cast<const char *>(lParam
));
976 case SCI_GETLEXERLANGUAGE
:
977 return StringResult(lParam
, DocumentLexState()->GetName());
979 case SCI_PRIVATELEXERCALL
:
980 return reinterpret_cast<sptr_t
>(
981 DocumentLexState()->PrivateCall(wParam
, reinterpret_cast<void *>(lParam
)));
983 case SCI_GETSTYLEBITSNEEDED
:
984 return DocumentLexState()->GetStyleBitsNeeded();
986 case SCI_PROPERTYNAMES
:
987 return StringResult(lParam
, DocumentLexState()->PropertyNames());
989 case SCI_PROPERTYTYPE
:
990 return DocumentLexState()->PropertyType(reinterpret_cast<const char *>(wParam
));
992 case SCI_DESCRIBEPROPERTY
:
993 return StringResult(lParam
, DocumentLexState()->DescribeProperty(reinterpret_cast<const char *>(wParam
)));
995 case SCI_DESCRIBEKEYWORDSETS
:
996 return StringResult(lParam
, DocumentLexState()->DescribeWordListSets());
998 case SCI_GETLINEENDTYPESSUPPORTED
:
999 return DocumentLexState()->LineEndTypesSupported();
1001 case SCI_ALLOCATESUBSTYLES
:
1002 return DocumentLexState()->AllocateSubStyles(wParam
, lParam
);
1004 case SCI_GETSUBSTYLESSTART
:
1005 return DocumentLexState()->SubStylesStart(wParam
);
1007 case SCI_GETSUBSTYLESLENGTH
:
1008 return DocumentLexState()->SubStylesLength(wParam
);
1010 case SCI_GETSTYLEFROMSUBSTYLE
:
1011 return DocumentLexState()->StyleFromSubStyle(wParam
);
1013 case SCI_GETPRIMARYSTYLEFROMSTYLE
:
1014 return DocumentLexState()->PrimaryStyleFromStyle(wParam
);
1016 case SCI_FREESUBSTYLES
:
1017 DocumentLexState()->FreeSubStyles();
1020 case SCI_SETIDENTIFIERS
:
1021 DocumentLexState()->SetIdentifiers(wParam
, reinterpret_cast<const char *>(lParam
));
1024 case SCI_DISTANCETOSECONDARYSTYLES
:
1025 return DocumentLexState()->DistanceToSecondaryStyles();
1027 case SCI_GETSUBSTYLEBASES
:
1028 return StringResult(lParam
, DocumentLexState()->GetSubStyleBases());
1032 return Editor::WndProc(iMessage
, wParam
, lParam
);