2009-04-24 23:35:41 +00:00
|
|
|
// Scintilla source code edit control
|
|
|
|
/** @file ScintillaBase.cxx
|
|
|
|
** An enhanced subclass of Editor with calltips, autocomplete and context menu.
|
|
|
|
**/
|
|
|
|
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
|
|
|
// The License.txt file describes the conditions under which this software may be distributed.
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <ctype.h>
|
2010-08-21 23:59:56 +00:00
|
|
|
#include <assert.h>
|
2009-04-24 23:35:41 +00:00
|
|
|
|
2010-07-12 22:19:51 +00:00
|
|
|
#include <string>
|
2009-08-23 02:24:48 +00:00
|
|
|
#include <vector>
|
2013-08-28 00:44:27 +00:00
|
|
|
#include <map>
|
|
|
|
#include <algorithm>
|
2009-08-23 02:24:48 +00:00
|
|
|
|
2009-04-24 23:35:41 +00:00
|
|
|
#include "Platform.h"
|
|
|
|
|
2010-08-21 23:59:56 +00:00
|
|
|
#include "ILexer.h"
|
2009-04-24 23:35:41 +00:00
|
|
|
#include "Scintilla.h"
|
2010-08-21 23:59:56 +00:00
|
|
|
|
2009-08-23 02:24:48 +00:00
|
|
|
#include "PropSetSimple.h"
|
2009-04-24 23:35:41 +00:00
|
|
|
#ifdef SCI_LEXER
|
|
|
|
#include "SciLexer.h"
|
2010-08-21 23:59:56 +00:00
|
|
|
#include "LexerModule.h"
|
|
|
|
#include "Catalogue.h"
|
2009-04-24 23:35:41 +00:00
|
|
|
#endif
|
|
|
|
#include "SplitVector.h"
|
|
|
|
#include "Partitioning.h"
|
|
|
|
#include "RunStyles.h"
|
|
|
|
#include "ContractionState.h"
|
|
|
|
#include "CellBuffer.h"
|
|
|
|
#include "CallTip.h"
|
|
|
|
#include "KeyMap.h"
|
|
|
|
#include "Indicator.h"
|
|
|
|
#include "XPM.h"
|
|
|
|
#include "LineMarker.h"
|
|
|
|
#include "Style.h"
|
|
|
|
#include "ViewStyle.h"
|
|
|
|
#include "AutoComplete.h"
|
|
|
|
#include "CharClassify.h"
|
|
|
|
#include "Decoration.h"
|
2013-08-28 00:44:27 +00:00
|
|
|
#include "CaseFolder.h"
|
2009-04-24 23:35:41 +00:00
|
|
|
#include "Document.h"
|
2009-08-23 02:24:48 +00:00
|
|
|
#include "Selection.h"
|
2009-04-24 23:35:41 +00:00
|
|
|
#include "PositionCache.h"
|
|
|
|
#include "Editor.h"
|
|
|
|
#include "ScintillaBase.h"
|
|
|
|
|
|
|
|
#ifdef SCI_NAMESPACE
|
|
|
|
using namespace Scintilla;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ScintillaBase::ScintillaBase() {
|
|
|
|
displayPopupMenu = true;
|
|
|
|
listType = 0;
|
|
|
|
maxListWidth = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScintillaBase::~ScintillaBase() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScintillaBase::Finalise() {
|
|
|
|
Editor::Finalise();
|
|
|
|
popup.Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScintillaBase::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
|
|
|
|
bool isFillUp = ac.Active() && ac.IsFillUpChar(*s);
|
|
|
|
if (!isFillUp) {
|
|
|
|
Editor::AddCharUTF(s, len, treatAsDBCS);
|
|
|
|
}
|
|
|
|
if (ac.Active()) {
|
|
|
|
AutoCompleteCharacterAdded(s[0]);
|
|
|
|
// For fill ups add the character after the autocompletion has
|
|
|
|
// triggered so containers see the key so can display a calltip.
|
|
|
|
if (isFillUp) {
|
|
|
|
Editor::AddCharUTF(s, len, treatAsDBCS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScintillaBase::Command(int cmdId) {
|
|
|
|
|
|
|
|
switch (cmdId) {
|
|
|
|
|
|
|
|
case idAutoComplete: // Nothing to do
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case idCallTip: // Nothing to do
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case idcmdUndo:
|
|
|
|
WndProc(SCI_UNDO, 0, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case idcmdRedo:
|
|
|
|
WndProc(SCI_REDO, 0, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case idcmdCut:
|
|
|
|
WndProc(SCI_CUT, 0, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case idcmdCopy:
|
|
|
|
WndProc(SCI_COPY, 0, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case idcmdPaste:
|
|
|
|
WndProc(SCI_PASTE, 0, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case idcmdDelete:
|
|
|
|
WndProc(SCI_CLEAR, 0, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case idcmdSelectAll:
|
|
|
|
WndProc(SCI_SELECTALL, 0, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int ScintillaBase::KeyCommand(unsigned int iMessage) {
|
|
|
|
// Most key commands cancel autocompletion mode
|
|
|
|
if (ac.Active()) {
|
|
|
|
switch (iMessage) {
|
|
|
|
// Except for these
|
|
|
|
case SCI_LINEDOWN:
|
|
|
|
AutoCompleteMove(1);
|
|
|
|
return 0;
|
|
|
|
case SCI_LINEUP:
|
2011-07-17 22:30:49 +00:00
|
|
|
AutoCompleteMove(-1);
|
2009-04-24 23:35:41 +00:00
|
|
|
return 0;
|
|
|
|
case SCI_PAGEDOWN:
|
2013-08-28 00:44:27 +00:00
|
|
|
AutoCompleteMove(ac.lb->GetVisibleRows());
|
2009-04-24 23:35:41 +00:00
|
|
|
return 0;
|
|
|
|
case SCI_PAGEUP:
|
2013-08-28 00:44:27 +00:00
|
|
|
AutoCompleteMove(-ac.lb->GetVisibleRows());
|
2009-04-24 23:35:41 +00:00
|
|
|
return 0;
|
|
|
|
case SCI_VCHOME:
|
2011-07-17 22:30:49 +00:00
|
|
|
AutoCompleteMove(-5000);
|
2009-04-24 23:35:41 +00:00
|
|
|
return 0;
|
|
|
|
case SCI_LINEEND:
|
|
|
|
AutoCompleteMove(5000);
|
|
|
|
return 0;
|
|
|
|
case SCI_DELETEBACK:
|
|
|
|
DelCharBack(true);
|
|
|
|
AutoCompleteCharacterDeleted();
|
|
|
|
EnsureCaretVisible();
|
|
|
|
return 0;
|
|
|
|
case SCI_DELETEBACKNOTLINE:
|
|
|
|
DelCharBack(false);
|
|
|
|
AutoCompleteCharacterDeleted();
|
|
|
|
EnsureCaretVisible();
|
|
|
|
return 0;
|
|
|
|
case SCI_TAB:
|
|
|
|
AutoCompleteCompleted();
|
|
|
|
return 0;
|
|
|
|
case SCI_NEWLINE:
|
|
|
|
AutoCompleteCompleted();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
default:
|
2009-04-25 23:38:15 +00:00
|
|
|
AutoCompleteCancel();
|
2009-04-24 23:35:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ct.inCallTipMode) {
|
|
|
|
if (
|
|
|
|
(iMessage != SCI_CHARLEFT) &&
|
|
|
|
(iMessage != SCI_CHARLEFTEXTEND) &&
|
|
|
|
(iMessage != SCI_CHARRIGHT) &&
|
|
|
|
(iMessage != SCI_CHARRIGHTEXTEND) &&
|
|
|
|
(iMessage != SCI_EDITTOGGLEOVERTYPE) &&
|
|
|
|
(iMessage != SCI_DELETEBACK) &&
|
|
|
|
(iMessage != SCI_DELETEBACKNOTLINE)
|
|
|
|
) {
|
|
|
|
ct.CallTipCancel();
|
|
|
|
}
|
|
|
|
if ((iMessage == SCI_DELETEBACK) || (iMessage == SCI_DELETEBACKNOTLINE)) {
|
2009-08-23 02:24:48 +00:00
|
|
|
if (sel.MainCaret() <= ct.posStartCallTip) {
|
2009-04-24 23:35:41 +00:00
|
|
|
ct.CallTipCancel();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Editor::KeyCommand(iMessage);
|
|
|
|
}
|
|
|
|
|
2010-07-12 22:19:51 +00:00
|
|
|
void ScintillaBase::AutoCompleteDoubleClick(void *p) {
|
|
|
|
ScintillaBase *sci = reinterpret_cast<ScintillaBase *>(p);
|
2009-04-24 23:35:41 +00:00
|
|
|
sci->AutoCompleteCompleted();
|
|
|
|
}
|
|
|
|
|
2013-08-28 00:44:27 +00:00
|
|
|
void ScintillaBase::AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen) {
|
|
|
|
UndoGroup ug(pdoc);
|
|
|
|
pdoc->DeleteChars(startPos, removeLen);
|
|
|
|
pdoc->InsertString(startPos, text, textLen);
|
|
|
|
SetEmptySelection(startPos + textLen);
|
|
|
|
}
|
|
|
|
|
2009-04-24 23:35:41 +00:00
|
|
|
void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
|
|
|
//Platform::DebugPrintf("AutoComplete %s\n", list);
|
|
|
|
ct.CallTipCancel();
|
|
|
|
|
|
|
|
if (ac.chooseSingle && (listType == 0)) {
|
|
|
|
if (list && !strchr(list, ac.GetSeparator())) {
|
|
|
|
const char *typeSep = strchr(list, ac.GetTypesep());
|
2013-08-28 00:44:27 +00:00
|
|
|
int lenInsert = typeSep ?
|
|
|
|
static_cast<int>(typeSep-list) : static_cast<int>(strlen(list));
|
2009-04-24 23:35:41 +00:00
|
|
|
if (ac.ignoreCase) {
|
2013-08-28 00:44:27 +00:00
|
|
|
// May need to convert the case before invocation, so remove lenEntered characters
|
|
|
|
AutoCompleteInsert(sel.MainCaret() - lenEntered, lenEntered, list, lenInsert);
|
2009-04-24 23:35:41 +00:00
|
|
|
} else {
|
2013-08-28 00:44:27 +00:00
|
|
|
AutoCompleteInsert(sel.MainCaret(), 0, list + lenEntered, lenInsert - lenEntered);
|
2009-04-24 23:35:41 +00:00
|
|
|
}
|
2013-08-28 00:44:27 +00:00
|
|
|
ac.Cancel();
|
2009-04-24 23:35:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2009-08-23 02:24:48 +00:00
|
|
|
ac.Start(wMain, idAutoComplete, sel.MainCaret(), PointMainCaret(),
|
2013-08-28 00:44:27 +00:00
|
|
|
lenEntered, vs.lineHeight, IsUnicodeMode(), technology);
|
2009-04-24 23:35:41 +00:00
|
|
|
|
|
|
|
PRectangle rcClient = GetClientRectangle();
|
2009-08-23 02:24:48 +00:00
|
|
|
Point pt = LocationFromPosition(sel.MainCaret() - lenEntered);
|
2009-04-24 23:35:41 +00:00
|
|
|
PRectangle rcPopupBounds = wMain.GetMonitorRect(pt);
|
|
|
|
if (rcPopupBounds.Height() == 0)
|
|
|
|
rcPopupBounds = rcClient;
|
|
|
|
|
2013-08-28 00:44:27 +00:00
|
|
|
int heightLB = ac.heightLBDefault;
|
|
|
|
int widthLB = ac.widthLBDefault;
|
2009-04-24 23:35:41 +00:00
|
|
|
if (pt.x >= rcClient.right - widthLB) {
|
|
|
|
HorizontalScrollTo(xOffset + pt.x - rcClient.right + widthLB);
|
|
|
|
Redraw();
|
2009-08-23 02:24:48 +00:00
|
|
|
pt = PointMainCaret();
|
2009-04-24 23:35:41 +00:00
|
|
|
}
|
2013-08-28 00:44:27 +00:00
|
|
|
if (wMargin.GetID()) {
|
|
|
|
Point ptOrigin = GetVisibleOriginInMain();
|
|
|
|
pt.x += ptOrigin.x;
|
|
|
|
pt.y += ptOrigin.y;
|
|
|
|
}
|
2009-04-24 23:35:41 +00:00
|
|
|
PRectangle rcac;
|
|
|
|
rcac.left = pt.x - ac.lb->CaretFromEdge();
|
|
|
|
if (pt.y >= rcPopupBounds.bottom - heightLB && // Wont fit below.
|
|
|
|
pt.y >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2) { // and there is more room above.
|
|
|
|
rcac.top = pt.y - heightLB;
|
|
|
|
if (rcac.top < rcPopupBounds.top) {
|
|
|
|
heightLB -= (rcPopupBounds.top - rcac.top);
|
|
|
|
rcac.top = rcPopupBounds.top;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
rcac.top = pt.y + vs.lineHeight;
|
|
|
|
}
|
|
|
|
rcac.right = rcac.left + widthLB;
|
|
|
|
rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcPopupBounds.bottom);
|
|
|
|
ac.lb->SetPositionRelative(rcac, wMain);
|
|
|
|
ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font);
|
|
|
|
unsigned int aveCharWidth = vs.styles[STYLE_DEFAULT].aveCharWidth;
|
|
|
|
ac.lb->SetAverageCharWidth(aveCharWidth);
|
|
|
|
ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this);
|
|
|
|
|
|
|
|
ac.SetList(list);
|
|
|
|
|
|
|
|
// Fiddle the position of the list so it is right next to the target and wide enough for all its strings
|
|
|
|
PRectangle rcList = ac.lb->GetDesiredRect();
|
|
|
|
int heightAlloced = rcList.bottom - rcList.top;
|
|
|
|
widthLB = Platform::Maximum(widthLB, rcList.right - rcList.left);
|
|
|
|
if (maxListWidth != 0)
|
|
|
|
widthLB = Platform::Minimum(widthLB, aveCharWidth*maxListWidth);
|
|
|
|
// Make an allowance for large strings in list
|
|
|
|
rcList.left = pt.x - ac.lb->CaretFromEdge();
|
|
|
|
rcList.right = rcList.left + widthLB;
|
|
|
|
if (((pt.y + vs.lineHeight) >= (rcPopupBounds.bottom - heightAlloced)) && // Wont fit below.
|
|
|
|
((pt.y + vs.lineHeight / 2) >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2)) { // and there is more room above.
|
|
|
|
rcList.top = pt.y - heightAlloced;
|
|
|
|
} else {
|
|
|
|
rcList.top = pt.y + vs.lineHeight;
|
|
|
|
}
|
|
|
|
rcList.bottom = rcList.top + heightAlloced;
|
|
|
|
ac.lb->SetPositionRelative(rcList, wMain);
|
|
|
|
ac.Show(true);
|
|
|
|
if (lenEntered != 0) {
|
|
|
|
AutoCompleteMoveToCurrentWord();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScintillaBase::AutoCompleteCancel() {
|
2009-04-25 23:38:15 +00:00
|
|
|
if (ac.Active()) {
|
|
|
|
SCNotification scn = {0};
|
|
|
|
scn.nmhdr.code = SCN_AUTOCCANCELLED;
|
|
|
|
scn.wParam = 0;
|
|
|
|
scn.listType = 0;
|
|
|
|
NotifyParent(scn);
|
|
|
|
}
|
2009-04-24 23:35:41 +00:00
|
|
|
ac.Cancel();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScintillaBase::AutoCompleteMove(int delta) {
|
|
|
|
ac.Move(delta);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScintillaBase::AutoCompleteMoveToCurrentWord() {
|
2013-08-28 00:44:27 +00:00
|
|
|
std::string wordCurrent = RangeText(ac.posStart - ac.startLen, sel.MainCaret());
|
|
|
|
ac.Select(wordCurrent.c_str());
|
2009-04-24 23:35:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScintillaBase::AutoCompleteCharacterAdded(char ch) {
|
|
|
|
if (ac.IsFillUpChar(ch)) {
|
|
|
|
AutoCompleteCompleted();
|
|
|
|
} else if (ac.IsStopChar(ch)) {
|
2009-04-25 23:38:15 +00:00
|
|
|
AutoCompleteCancel();
|
2009-04-24 23:35:41 +00:00
|
|
|
} else {
|
|
|
|
AutoCompleteMoveToCurrentWord();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScintillaBase::AutoCompleteCharacterDeleted() {
|
2009-08-23 02:24:48 +00:00
|
|
|
if (sel.MainCaret() < ac.posStart - ac.startLen) {
|
2009-04-25 23:38:15 +00:00
|
|
|
AutoCompleteCancel();
|
2009-08-23 02:24:48 +00:00
|
|
|
} else if (ac.cancelAtStartPos && (sel.MainCaret() <= ac.posStart)) {
|
2009-04-25 23:38:15 +00:00
|
|
|
AutoCompleteCancel();
|
2009-04-24 23:35:41 +00:00
|
|
|
} else {
|
|
|
|
AutoCompleteMoveToCurrentWord();
|
|
|
|
}
|
2009-06-24 19:09:31 +00:00
|
|
|
SCNotification scn = {0};
|
|
|
|
scn.nmhdr.code = SCN_AUTOCCHARDELETED;
|
|
|
|
scn.wParam = 0;
|
|
|
|
scn.listType = 0;
|
|
|
|
NotifyParent(scn);
|
2009-04-24 23:35:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScintillaBase::AutoCompleteCompleted() {
|
2013-08-28 00:44:27 +00:00
|
|
|
int item = ac.GetSelection();
|
|
|
|
if (item == -1) {
|
2009-04-25 23:38:15 +00:00
|
|
|
AutoCompleteCancel();
|
2009-04-24 23:35:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-08-28 00:44:27 +00:00
|
|
|
const std::string selected = ac.GetValue(item);
|
2009-04-24 23:35:41 +00:00
|
|
|
|
|
|
|
ac.Show(false);
|
|
|
|
|
|
|
|
SCNotification scn = {0};
|
|
|
|
scn.nmhdr.code = listType > 0 ? SCN_USERLISTSELECTION : SCN_AUTOCSELECTION;
|
|
|
|
scn.message = 0;
|
|
|
|
scn.wParam = listType;
|
|
|
|
scn.listType = listType;
|
|
|
|
Position firstPos = ac.posStart - ac.startLen;
|
2011-07-17 22:30:49 +00:00
|
|
|
scn.position = firstPos;
|
2009-04-24 23:35:41 +00:00
|
|
|
scn.lParam = firstPos;
|
2013-08-28 00:44:27 +00:00
|
|
|
scn.text = selected.c_str();
|
2009-04-24 23:35:41 +00:00
|
|
|
NotifyParent(scn);
|
|
|
|
|
|
|
|
if (!ac.Active())
|
|
|
|
return;
|
|
|
|
ac.Cancel();
|
|
|
|
|
|
|
|
if (listType > 0)
|
|
|
|
return;
|
|
|
|
|
2009-08-23 02:24:48 +00:00
|
|
|
Position endPos = sel.MainCaret();
|
2009-04-24 23:35:41 +00:00
|
|
|
if (ac.dropRestOfWord)
|
|
|
|
endPos = pdoc->ExtendWordSelect(endPos, 1, true);
|
|
|
|
if (endPos < firstPos)
|
|
|
|
return;
|
2013-08-28 00:44:27 +00:00
|
|
|
AutoCompleteInsert(firstPos, endPos - firstPos, selected.c_str(), static_cast<int>(selected.length()));
|
2011-03-22 00:16:49 +00:00
|
|
|
SetLastXChosen();
|
2009-04-24 23:35:41 +00:00
|
|
|
}
|
|
|
|
|
2013-08-28 00:44:27 +00:00
|
|
|
int ScintillaBase::AutoCompleteGetCurrent() const {
|
2009-06-24 19:09:31 +00:00
|
|
|
if (!ac.Active())
|
|
|
|
return -1;
|
2013-08-28 00:44:27 +00:00
|
|
|
return ac.GetSelection();
|
2009-04-24 23:35:41 +00:00
|
|
|
}
|
|
|
|
|
2013-08-28 00:44:27 +00:00
|
|
|
int ScintillaBase::AutoCompleteGetCurrentText(char *buffer) const {
|
2010-07-12 22:19:51 +00:00
|
|
|
if (ac.Active()) {
|
2013-08-28 00:44:27 +00:00
|
|
|
int item = ac.GetSelection();
|
2010-07-12 22:19:51 +00:00
|
|
|
if (item != -1) {
|
2013-08-28 00:44:27 +00:00
|
|
|
const std::string selected = ac.GetValue(item);
|
2010-07-12 22:19:51 +00:00
|
|
|
if (buffer != NULL)
|
2013-08-28 00:44:27 +00:00
|
|
|
strcpy(buffer, selected.c_str());
|
|
|
|
return static_cast<int>(selected.length());
|
2010-07-12 22:19:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (buffer != NULL)
|
|
|
|
*buffer = '\0';
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-04-24 23:35:41 +00:00
|
|
|
void ScintillaBase::CallTipShow(Point pt, const char *defn) {
|
2009-04-25 23:38:15 +00:00
|
|
|
ac.Cancel();
|
2009-04-24 23:35:41 +00:00
|
|
|
// If container knows about STYLE_CALLTIP then use it in place of the
|
|
|
|
// STYLE_DEFAULT for the face name, size and character set. Also use it
|
|
|
|
// for the foreground and background colour.
|
|
|
|
int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT;
|
|
|
|
if (ct.UseStyleCallTip()) {
|
|
|
|
ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back);
|
|
|
|
}
|
2013-08-28 00:44:27 +00:00
|
|
|
if (wMargin.GetID()) {
|
|
|
|
Point ptOrigin = GetVisibleOriginInMain();
|
|
|
|
pt.x += ptOrigin.x;
|
|
|
|
pt.y += ptOrigin.y;
|
|
|
|
}
|
2009-08-23 02:24:48 +00:00
|
|
|
PRectangle rc = ct.CallTipStart(sel.MainCaret(), pt,
|
2013-08-28 00:44:27 +00:00
|
|
|
vs.lineHeight,
|
2009-04-24 23:35:41 +00:00
|
|
|
defn,
|
|
|
|
vs.styles[ctStyle].fontName,
|
|
|
|
vs.styles[ctStyle].sizeZoomed,
|
|
|
|
CodePage(),
|
|
|
|
vs.styles[ctStyle].characterSet,
|
2013-08-28 00:44:27 +00:00
|
|
|
vs.technology,
|
2009-04-24 23:35:41 +00:00
|
|
|
wMain);
|
|
|
|
// If the call-tip window would be out of the client
|
2013-08-28 00:44:27 +00:00
|
|
|
// space
|
2009-04-24 23:35:41 +00:00
|
|
|
PRectangle rcClient = GetClientRectangle();
|
2013-08-28 00:44:27 +00:00
|
|
|
int offset = vs.lineHeight + rc.Height();
|
|
|
|
// adjust so it displays below the text.
|
|
|
|
if (rc.top < rcClient.top) {
|
|
|
|
rc.top += offset;
|
|
|
|
rc.bottom += offset;
|
|
|
|
}
|
|
|
|
// adjust so it displays above the text.
|
2009-04-24 23:35:41 +00:00
|
|
|
if (rc.bottom > rcClient.bottom) {
|
|
|
|
rc.top -= offset;
|
|
|
|
rc.bottom -= offset;
|
|
|
|
}
|
|
|
|
// Now display the window.
|
|
|
|
CreateCallTipWindow(rc);
|
|
|
|
ct.wCallTip.SetPositionRelative(rc, wMain);
|
|
|
|
ct.wCallTip.Show();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScintillaBase::CallTipClick() {
|
|
|
|
SCNotification scn = {0};
|
|
|
|
scn.nmhdr.code = SCN_CALLTIPCLICK;
|
|
|
|
scn.position = ct.clickPlace;
|
|
|
|
NotifyParent(scn);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScintillaBase::ContextMenu(Point pt) {
|
|
|
|
if (displayPopupMenu) {
|
|
|
|
bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
|
|
|
|
popup.CreatePopUp();
|
|
|
|
AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo());
|
|
|
|
AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo());
|
|
|
|
AddToPopUp("");
|
2009-08-23 02:24:48 +00:00
|
|
|
AddToPopUp("Cut", idcmdCut, writable && !sel.Empty());
|
|
|
|
AddToPopUp("Copy", idcmdCopy, !sel.Empty());
|
2009-04-24 23:35:41 +00:00
|
|
|
AddToPopUp("Paste", idcmdPaste, writable && WndProc(SCI_CANPASTE, 0, 0));
|
2009-08-23 02:24:48 +00:00
|
|
|
AddToPopUp("Delete", idcmdDelete, writable && !sel.Empty());
|
2009-04-24 23:35:41 +00:00
|
|
|
AddToPopUp("");
|
|
|
|
AddToPopUp("Select All", idcmdSelectAll);
|
|
|
|
popup.Show(pt, wMain);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScintillaBase::CancelModes() {
|
|
|
|
AutoCompleteCancel();
|
|
|
|
ct.CallTipCancel();
|
|
|
|
Editor::CancelModes();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScintillaBase::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) {
|
|
|
|
CancelModes();
|
|
|
|
Editor::ButtonDown(pt, curTime, shift, ctrl, alt);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef SCI_LEXER
|
2010-08-21 23:59:56 +00:00
|
|
|
|
|
|
|
#ifdef SCI_NAMESPACE
|
|
|
|
namespace Scintilla {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class LexState : public LexInterface {
|
|
|
|
const LexerModule *lexCurrent;
|
|
|
|
void SetLexerModule(const LexerModule *lex);
|
|
|
|
PropSetSimple props;
|
2013-08-28 00:44:27 +00:00
|
|
|
int interfaceVersion;
|
2010-08-21 23:59:56 +00:00
|
|
|
public:
|
|
|
|
int lexLanguage;
|
|
|
|
|
|
|
|
LexState(Document *pdoc_);
|
|
|
|
virtual ~LexState();
|
|
|
|
void SetLexer(uptr_t wParam);
|
|
|
|
void SetLexerLanguage(const char *languageName);
|
|
|
|
const char *DescribeWordListSets();
|
|
|
|
void SetWordList(int n, const char *wl);
|
|
|
|
int GetStyleBitsNeeded() const;
|
|
|
|
const char *GetName() const;
|
|
|
|
void *PrivateCall(int operation, void *pointer);
|
|
|
|
const char *PropertyNames();
|
|
|
|
int PropertyType(const char *name);
|
|
|
|
const char *DescribeProperty(const char *name);
|
|
|
|
void PropSet(const char *key, const char *val);
|
|
|
|
const char *PropGet(const char *key) const;
|
|
|
|
int PropGetInt(const char *key, int defaultValue=0) const;
|
|
|
|
int PropGetExpanded(const char *key, char *result) const;
|
2013-08-28 00:44:27 +00:00
|
|
|
|
|
|
|
int LineEndTypesSupported();
|
|
|
|
int AllocateSubStyles(int styleBase, int numberStyles);
|
|
|
|
int SubStylesStart(int styleBase);
|
|
|
|
int SubStylesLength(int styleBase);
|
|
|
|
void FreeSubStyles();
|
|
|
|
void SetIdentifiers(int style, const char *identifiers);
|
|
|
|
int DistanceToSecondaryStyles();
|
|
|
|
const char *GetSubStyleBases();
|
2010-08-21 23:59:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef SCI_NAMESPACE
|
2009-04-24 23:35:41 +00:00
|
|
|
}
|
2010-08-21 23:59:56 +00:00
|
|
|
#endif
|
2009-04-24 23:35:41 +00:00
|
|
|
|
2010-08-21 23:59:56 +00:00
|
|
|
LexState::LexState(Document *pdoc_) : LexInterface(pdoc_) {
|
|
|
|
lexCurrent = 0;
|
|
|
|
performingStyle = false;
|
2013-08-28 00:44:27 +00:00
|
|
|
interfaceVersion = lvOriginal;
|
2009-04-24 23:35:41 +00:00
|
|
|
lexLanguage = SCLEX_CONTAINER;
|
|
|
|
}
|
|
|
|
|
2010-08-21 23:59:56 +00:00
|
|
|
LexState::~LexState() {
|
|
|
|
if (instance) {
|
|
|
|
instance->Release();
|
|
|
|
instance = 0;
|
|
|
|
}
|
|
|
|
}
|
2009-04-24 23:35:41 +00:00
|
|
|
|
2010-08-21 23:59:56 +00:00
|
|
|
LexState *ScintillaBase::DocumentLexState() {
|
|
|
|
if (!pdoc->pli) {
|
|
|
|
pdoc->pli = new LexState(pdoc);
|
|
|
|
}
|
|
|
|
return static_cast<LexState *>(pdoc->pli);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LexState::SetLexerModule(const LexerModule *lex) {
|
|
|
|
if (lex != lexCurrent) {
|
|
|
|
if (instance) {
|
|
|
|
instance->Release();
|
|
|
|
instance = 0;
|
|
|
|
}
|
2013-08-28 00:44:27 +00:00
|
|
|
interfaceVersion = lvOriginal;
|
2010-08-21 23:59:56 +00:00
|
|
|
lexCurrent = lex;
|
2013-08-28 00:44:27 +00:00
|
|
|
if (lexCurrent) {
|
2010-08-21 23:59:56 +00:00
|
|
|
instance = lexCurrent->Create();
|
2013-08-28 00:44:27 +00:00
|
|
|
interfaceVersion = instance->Version();
|
|
|
|
}
|
2010-08-21 23:59:56 +00:00
|
|
|
pdoc->LexerChanged();
|
|
|
|
}
|
|
|
|
}
|
2009-04-24 23:35:41 +00:00
|
|
|
|
2010-08-21 23:59:56 +00:00
|
|
|
void LexState::SetLexer(uptr_t wParam) {
|
|
|
|
lexLanguage = wParam;
|
|
|
|
if (lexLanguage == SCLEX_CONTAINER) {
|
|
|
|
SetLexerModule(0);
|
|
|
|
} else {
|
|
|
|
const LexerModule *lex = Catalogue::Find(lexLanguage);
|
|
|
|
if (!lex)
|
|
|
|
lex = Catalogue::Find(SCLEX_NULL);
|
|
|
|
SetLexerModule(lex);
|
|
|
|
}
|
|
|
|
}
|
2009-04-24 23:35:41 +00:00
|
|
|
|
2010-08-21 23:59:56 +00:00
|
|
|
void LexState::SetLexerLanguage(const char *languageName) {
|
|
|
|
const LexerModule *lex = Catalogue::Find(languageName);
|
|
|
|
if (!lex)
|
|
|
|
lex = Catalogue::Find(SCLEX_NULL);
|
|
|
|
if (lex)
|
|
|
|
lexLanguage = lex->GetLanguage();
|
|
|
|
SetLexerModule(lex);
|
|
|
|
}
|
2009-04-24 23:35:41 +00:00
|
|
|
|
2010-08-21 23:59:56 +00:00
|
|
|
const char *LexState::DescribeWordListSets() {
|
|
|
|
if (instance) {
|
|
|
|
return instance->DescribeWordListSets();
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2009-04-24 23:35:41 +00:00
|
|
|
|
2010-08-21 23:59:56 +00:00
|
|
|
void LexState::SetWordList(int n, const char *wl) {
|
|
|
|
if (instance) {
|
|
|
|
int firstModification = instance->WordListSet(n, wl);
|
|
|
|
if (firstModification >= 0) {
|
|
|
|
pdoc->ModifiedAt(firstModification);
|
2009-04-24 23:35:41 +00:00
|
|
|
}
|
2010-08-21 23:59:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int LexState::GetStyleBitsNeeded() const {
|
|
|
|
return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5;
|
|
|
|
}
|
2009-04-24 23:35:41 +00:00
|
|
|
|
2010-08-21 23:59:56 +00:00
|
|
|
const char *LexState::GetName() const {
|
|
|
|
return lexCurrent ? lexCurrent->languageName : "";
|
|
|
|
}
|
|
|
|
|
|
|
|
void *LexState::PrivateCall(int operation, void *pointer) {
|
|
|
|
if (pdoc && instance) {
|
|
|
|
return instance->PrivateCall(operation, pointer);
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *LexState::PropertyNames() {
|
|
|
|
if (instance) {
|
|
|
|
return instance->PropertyNames();
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int LexState::PropertyType(const char *name) {
|
|
|
|
if (instance) {
|
|
|
|
return instance->PropertyType(name);
|
|
|
|
} else {
|
|
|
|
return SC_TYPE_BOOLEAN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *LexState::DescribeProperty(const char *name) {
|
|
|
|
if (instance) {
|
|
|
|
return instance->DescribeProperty(name);
|
|
|
|
} else {
|
|
|
|
return 0;
|
2009-04-24 23:35:41 +00:00
|
|
|
}
|
|
|
|
}
|
2010-08-21 23:59:56 +00:00
|
|
|
|
|
|
|
void LexState::PropSet(const char *key, const char *val) {
|
|
|
|
props.Set(key, val);
|
|
|
|
if (instance) {
|
|
|
|
int firstModification = instance->PropertySet(key, val);
|
|
|
|
if (firstModification >= 0) {
|
|
|
|
pdoc->ModifiedAt(firstModification);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *LexState::PropGet(const char *key) const {
|
|
|
|
return props.Get(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
int LexState::PropGetInt(const char *key, int defaultValue) const {
|
|
|
|
return props.GetInt(key, defaultValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
int LexState::PropGetExpanded(const char *key, char *result) const {
|
|
|
|
return props.GetExpanded(key, result);
|
|
|
|
}
|
|
|
|
|
2013-08-28 00:44:27 +00:00
|
|
|
int LexState::LineEndTypesSupported() {
|
|
|
|
if (instance && (interfaceVersion >= lvSubStyles)) {
|
|
|
|
return static_cast<ILexerWithSubStyles *>(instance)->LineEndTypesSupported();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int LexState::AllocateSubStyles(int styleBase, int numberStyles) {
|
|
|
|
if (instance && (interfaceVersion >= lvSubStyles)) {
|
|
|
|
return static_cast<ILexerWithSubStyles *>(instance)->AllocateSubStyles(styleBase, numberStyles);
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int LexState::SubStylesStart(int styleBase) {
|
|
|
|
if (instance && (interfaceVersion >= lvSubStyles)) {
|
|
|
|
return static_cast<ILexerWithSubStyles *>(instance)->SubStylesStart(styleBase);
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int LexState::SubStylesLength(int styleBase) {
|
|
|
|
if (instance && (interfaceVersion >= lvSubStyles)) {
|
|
|
|
return static_cast<ILexerWithSubStyles *>(instance)->SubStylesLength(styleBase);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LexState::FreeSubStyles() {
|
|
|
|
if (instance && (interfaceVersion >= lvSubStyles)) {
|
|
|
|
static_cast<ILexerWithSubStyles *>(instance)->FreeSubStyles();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void LexState::SetIdentifiers(int style, const char *identifiers) {
|
|
|
|
if (instance && (interfaceVersion >= lvSubStyles)) {
|
|
|
|
static_cast<ILexerWithSubStyles *>(instance)->SetIdentifiers(style, identifiers);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int LexState::DistanceToSecondaryStyles() {
|
|
|
|
if (instance && (interfaceVersion >= lvSubStyles)) {
|
|
|
|
return static_cast<ILexerWithSubStyles *>(instance)->DistanceToSecondaryStyles();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *LexState::GetSubStyleBases() {
|
|
|
|
if (instance && (interfaceVersion >= lvSubStyles)) {
|
|
|
|
return static_cast<ILexerWithSubStyles *>(instance)->GetSubStyleBases();
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2009-04-24 23:35:41 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) {
|
|
|
|
#ifdef SCI_LEXER
|
2010-08-21 23:59:56 +00:00
|
|
|
if (DocumentLexState()->lexLanguage != SCLEX_CONTAINER) {
|
|
|
|
int lineEndStyled = pdoc->LineFromPosition(pdoc->GetEndStyled());
|
|
|
|
int endStyled = pdoc->LineStart(lineEndStyled);
|
|
|
|
DocumentLexState()->Colourise(endStyled, endStyleNeeded);
|
2009-04-24 23:35:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
Editor::NotifyStyleToNeeded(endStyleNeeded);
|
|
|
|
}
|
|
|
|
|
2010-08-21 23:59:56 +00:00
|
|
|
void ScintillaBase::NotifyLexerChanged(Document *, void *) {
|
|
|
|
#ifdef SCI_LEXER
|
|
|
|
int bits = DocumentLexState()->GetStyleBitsNeeded();
|
|
|
|
vs.EnsureStyle((1 << bits) - 1);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-04-24 23:35:41 +00:00
|
|
|
sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
|
|
|
switch (iMessage) {
|
|
|
|
case SCI_AUTOCSHOW:
|
|
|
|
listType = 0;
|
|
|
|
AutoCompleteStart(wParam, reinterpret_cast<const char *>(lParam));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCCANCEL:
|
2009-04-25 23:38:15 +00:00
|
|
|
ac.Cancel();
|
2009-04-24 23:35:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCACTIVE:
|
|
|
|
return ac.Active();
|
|
|
|
|
|
|
|
case SCI_AUTOCPOSSTART:
|
|
|
|
return ac.posStart;
|
|
|
|
|
|
|
|
case SCI_AUTOCCOMPLETE:
|
|
|
|
AutoCompleteCompleted();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCSETSEPARATOR:
|
|
|
|
ac.SetSeparator(static_cast<char>(wParam));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCGETSEPARATOR:
|
|
|
|
return ac.GetSeparator();
|
|
|
|
|
|
|
|
case SCI_AUTOCSTOPS:
|
|
|
|
ac.SetStopChars(reinterpret_cast<char *>(lParam));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCSELECT:
|
|
|
|
ac.Select(reinterpret_cast<char *>(lParam));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCGETCURRENT:
|
|
|
|
return AutoCompleteGetCurrent();
|
|
|
|
|
2010-07-12 22:19:51 +00:00
|
|
|
case SCI_AUTOCGETCURRENTTEXT:
|
|
|
|
return AutoCompleteGetCurrentText(reinterpret_cast<char *>(lParam));
|
|
|
|
|
2009-04-24 23:35:41 +00:00
|
|
|
case SCI_AUTOCSETCANCELATSTART:
|
|
|
|
ac.cancelAtStartPos = wParam != 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCGETCANCELATSTART:
|
|
|
|
return ac.cancelAtStartPos;
|
|
|
|
|
|
|
|
case SCI_AUTOCSETFILLUPS:
|
|
|
|
ac.SetFillUpChars(reinterpret_cast<char *>(lParam));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCSETCHOOSESINGLE:
|
|
|
|
ac.chooseSingle = wParam != 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCGETCHOOSESINGLE:
|
|
|
|
return ac.chooseSingle;
|
|
|
|
|
|
|
|
case SCI_AUTOCSETIGNORECASE:
|
|
|
|
ac.ignoreCase = wParam != 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCGETIGNORECASE:
|
|
|
|
return ac.ignoreCase;
|
|
|
|
|
2013-08-28 00:44:27 +00:00
|
|
|
case SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR:
|
|
|
|
ac.ignoreCaseBehaviour = wParam;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR:
|
|
|
|
return ac.ignoreCaseBehaviour;
|
|
|
|
|
|
|
|
case SCI_AUTOCSETORDER:
|
|
|
|
ac.autoSort = wParam;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCGETORDER:
|
|
|
|
return ac.autoSort;
|
|
|
|
|
2009-04-24 23:35:41 +00:00
|
|
|
case SCI_USERLISTSHOW:
|
|
|
|
listType = wParam;
|
|
|
|
AutoCompleteStart(0, reinterpret_cast<const char *>(lParam));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCSETAUTOHIDE:
|
|
|
|
ac.autoHide = wParam != 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCGETAUTOHIDE:
|
|
|
|
return ac.autoHide;
|
|
|
|
|
|
|
|
case SCI_AUTOCSETDROPRESTOFWORD:
|
|
|
|
ac.dropRestOfWord = wParam != 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCGETDROPRESTOFWORD:
|
|
|
|
return ac.dropRestOfWord;
|
|
|
|
|
|
|
|
case SCI_AUTOCSETMAXHEIGHT:
|
|
|
|
ac.lb->SetVisibleRows(wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCGETMAXHEIGHT:
|
|
|
|
return ac.lb->GetVisibleRows();
|
|
|
|
|
|
|
|
case SCI_AUTOCSETMAXWIDTH:
|
|
|
|
maxListWidth = wParam;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCGETMAXWIDTH:
|
|
|
|
return maxListWidth;
|
|
|
|
|
|
|
|
case SCI_REGISTERIMAGE:
|
|
|
|
ac.lb->RegisterImage(wParam, reinterpret_cast<const char *>(lParam));
|
|
|
|
break;
|
|
|
|
|
2013-08-28 00:44:27 +00:00
|
|
|
case SCI_REGISTERRGBAIMAGE:
|
|
|
|
ac.lb->RegisterRGBAImage(wParam, sizeRGBAImage.x, sizeRGBAImage.y, reinterpret_cast<unsigned char *>(lParam));
|
|
|
|
break;
|
|
|
|
|
2009-04-24 23:35:41 +00:00
|
|
|
case SCI_CLEARREGISTEREDIMAGES:
|
|
|
|
ac.lb->ClearRegisteredImages();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCSETTYPESEPARATOR:
|
|
|
|
ac.SetTypesep(static_cast<char>(wParam));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_AUTOCGETTYPESEPARATOR:
|
|
|
|
return ac.GetTypesep();
|
|
|
|
|
|
|
|
case SCI_CALLTIPSHOW:
|
|
|
|
CallTipShow(LocationFromPosition(wParam),
|
|
|
|
reinterpret_cast<const char *>(lParam));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_CALLTIPCANCEL:
|
|
|
|
ct.CallTipCancel();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_CALLTIPACTIVE:
|
|
|
|
return ct.inCallTipMode;
|
|
|
|
|
|
|
|
case SCI_CALLTIPPOSSTART:
|
|
|
|
return ct.posStartCallTip;
|
|
|
|
|
|
|
|
case SCI_CALLTIPSETHLT:
|
|
|
|
ct.SetHighlight(wParam, lParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_CALLTIPSETBACK:
|
|
|
|
ct.colourBG = ColourDesired(wParam);
|
|
|
|
vs.styles[STYLE_CALLTIP].back = ct.colourBG;
|
|
|
|
InvalidateStyleRedraw();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_CALLTIPSETFORE:
|
|
|
|
ct.colourUnSel = ColourDesired(wParam);
|
|
|
|
vs.styles[STYLE_CALLTIP].fore = ct.colourUnSel;
|
|
|
|
InvalidateStyleRedraw();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_CALLTIPSETFOREHLT:
|
|
|
|
ct.colourSel = ColourDesired(wParam);
|
|
|
|
InvalidateStyleRedraw();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_CALLTIPUSESTYLE:
|
|
|
|
ct.SetTabSize((int)wParam);
|
|
|
|
InvalidateStyleRedraw();
|
|
|
|
break;
|
|
|
|
|
2013-08-28 00:44:27 +00:00
|
|
|
case SCI_CALLTIPSETPOSITION:
|
|
|
|
ct.SetPosition(wParam != 0);
|
|
|
|
InvalidateStyleRedraw();
|
|
|
|
break;
|
|
|
|
|
2009-04-24 23:35:41 +00:00
|
|
|
case SCI_USEPOPUP:
|
|
|
|
displayPopupMenu = wParam != 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
#ifdef SCI_LEXER
|
|
|
|
case SCI_SETLEXER:
|
2010-08-21 23:59:56 +00:00
|
|
|
DocumentLexState()->SetLexer(wParam);
|
2009-04-24 23:35:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_GETLEXER:
|
2010-08-21 23:59:56 +00:00
|
|
|
return DocumentLexState()->lexLanguage;
|
2009-04-24 23:35:41 +00:00
|
|
|
|
|
|
|
case SCI_COLOURISE:
|
2010-08-21 23:59:56 +00:00
|
|
|
if (DocumentLexState()->lexLanguage == SCLEX_CONTAINER) {
|
2009-04-24 23:35:41 +00:00
|
|
|
pdoc->ModifiedAt(wParam);
|
|
|
|
NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : lParam);
|
|
|
|
} else {
|
2010-08-21 23:59:56 +00:00
|
|
|
DocumentLexState()->Colourise(wParam, lParam);
|
2009-04-24 23:35:41 +00:00
|
|
|
}
|
|
|
|
Redraw();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_SETPROPERTY:
|
2010-08-21 23:59:56 +00:00
|
|
|
DocumentLexState()->PropSet(reinterpret_cast<const char *>(wParam),
|
2009-04-24 23:35:41 +00:00
|
|
|
reinterpret_cast<const char *>(lParam));
|
|
|
|
break;
|
|
|
|
|
2010-07-12 22:19:51 +00:00
|
|
|
case SCI_GETPROPERTY:
|
2010-08-21 23:59:56 +00:00
|
|
|
return StringResult(lParam, DocumentLexState()->PropGet(reinterpret_cast<const char *>(wParam)));
|
|
|
|
|
|
|
|
case SCI_GETPROPERTYEXPANDED:
|
|
|
|
return DocumentLexState()->PropGetExpanded(reinterpret_cast<const char *>(wParam),
|
|
|
|
reinterpret_cast<char *>(lParam));
|
2009-04-24 23:35:41 +00:00
|
|
|
|
|
|
|
case SCI_GETPROPERTYINT:
|
2010-08-21 23:59:56 +00:00
|
|
|
return DocumentLexState()->PropGetInt(reinterpret_cast<const char *>(wParam), lParam);
|
2009-04-24 23:35:41 +00:00
|
|
|
|
|
|
|
case SCI_SETKEYWORDS:
|
2010-08-21 23:59:56 +00:00
|
|
|
DocumentLexState()->SetWordList(wParam, reinterpret_cast<const char *>(lParam));
|
2009-04-24 23:35:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_SETLEXERLANGUAGE:
|
2010-08-21 23:59:56 +00:00
|
|
|
DocumentLexState()->SetLexerLanguage(reinterpret_cast<const char *>(lParam));
|
2009-04-24 23:35:41 +00:00
|
|
|
break;
|
|
|
|
|
2010-07-12 22:19:51 +00:00
|
|
|
case SCI_GETLEXERLANGUAGE:
|
2010-08-21 23:59:56 +00:00
|
|
|
return StringResult(lParam, DocumentLexState()->GetName());
|
|
|
|
|
|
|
|
case SCI_PRIVATELEXERCALL:
|
|
|
|
return reinterpret_cast<sptr_t>(
|
|
|
|
DocumentLexState()->PrivateCall(wParam, reinterpret_cast<void *>(lParam)));
|
2010-07-12 22:19:51 +00:00
|
|
|
|
2009-04-24 23:35:41 +00:00
|
|
|
case SCI_GETSTYLEBITSNEEDED:
|
2010-08-21 23:59:56 +00:00
|
|
|
return DocumentLexState()->GetStyleBitsNeeded();
|
|
|
|
|
|
|
|
case SCI_PROPERTYNAMES:
|
|
|
|
return StringResult(lParam, DocumentLexState()->PropertyNames());
|
|
|
|
|
|
|
|
case SCI_PROPERTYTYPE:
|
|
|
|
return DocumentLexState()->PropertyType(reinterpret_cast<const char *>(wParam));
|
|
|
|
|
|
|
|
case SCI_DESCRIBEPROPERTY:
|
|
|
|
return StringResult(lParam, DocumentLexState()->DescribeProperty(reinterpret_cast<const char *>(wParam)));
|
|
|
|
|
|
|
|
case SCI_DESCRIBEKEYWORDSETS:
|
|
|
|
return StringResult(lParam, DocumentLexState()->DescribeWordListSets());
|
2010-07-12 22:19:51 +00:00
|
|
|
|
2013-08-28 00:44:27 +00:00
|
|
|
case SCI_GETLINEENDTYPESSUPPORTED:
|
|
|
|
return DocumentLexState()->LineEndTypesSupported();
|
|
|
|
|
|
|
|
case SCI_ALLOCATESUBSTYLES:
|
|
|
|
return DocumentLexState()->AllocateSubStyles(wParam, lParam);
|
|
|
|
|
|
|
|
case SCI_GETSUBSTYLESSTART:
|
|
|
|
return DocumentLexState()->SubStylesStart(wParam);
|
|
|
|
|
|
|
|
case SCI_GETSUBSTYLESLENGTH:
|
|
|
|
return DocumentLexState()->SubStylesLength(wParam);
|
|
|
|
|
|
|
|
case SCI_FREESUBSTYLES:
|
|
|
|
DocumentLexState()->FreeSubStyles();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_SETIDENTIFIERS:
|
|
|
|
DocumentLexState()->SetIdentifiers(wParam, reinterpret_cast<const char *>(lParam));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCI_DISTANCETOSECONDARYSTYLES:
|
|
|
|
return DocumentLexState()->DistanceToSecondaryStyles();
|
|
|
|
|
|
|
|
case SCI_GETSUBSTYLEBASES:
|
|
|
|
return StringResult(lParam, DocumentLexState()->GetSubStyleBases());
|
2009-04-24 23:35:41 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
default:
|
|
|
|
return Editor::WndProc(iMessage, wParam, lParam);
|
|
|
|
}
|
|
|
|
return 0l;
|
|
|
|
}
|