-// SciTE - Scintilla based Text Editor
-// Accessor.cxx - rapid easy access to contents of a Scintilla
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file WindowAccessor.cxx
+ ** Rapid easy access to contents of a Scintilla.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include "WindowAccessor.h"
#include "Scintilla.h"
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
WindowAccessor::~WindowAccessor() {
}
-#if PLAT_WIN
bool WindowAccessor::InternalIsLeadByte(char ch) {
if (SC_CP_UTF8 == codePage)
// For lexing, all characters >= 0x80 are treated the
// same so none is considered a lead byte.
return false;
else
- return IsDBCSLeadByteEx(codePage, ch);
-}
-#else
-// PLAT_GTK or PLAT_WX
-// TODO: support DBCS under GTK+ and WX
-bool WindowAccessor::InternalIsLeadByte(char) {
- return false;
+ return Platform::IsDBCSLeadByte(codePage, ch);
}
-#endif
void WindowAccessor::Fill(int position) {
if (lenDoc == -1)
endPos = lenDoc;
TextRange tr = {{startPos, endPos}, buf};
- Platform::SendScintilla(id, SCI_GETTEXTRANGE, 0, reinterpret_cast<long>(&tr));
+ Platform::SendScintillaPointer(id, SCI_GETTEXTRANGE, 0, &tr);
+}
+
+bool WindowAccessor::Match(int pos, const char *s) {
+ for (int i=0; *s; i++) {
+ if (*s != SafeGetCharAt(pos+i))
+ return false;
+ s++;
+ }
+ return true;
}
char WindowAccessor::StyleAt(int position) {
startPos = extremePosition;
lenDoc = -1;
if (validLen > 0) {
- Platform::SendScintilla(id, SCI_SETSTYLINGEX, validLen,
- reinterpret_cast<long>(styleBuf));
+ Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen,
+ styleBuf);
validLen = 0;
}
}
return indent;
}
+void WindowAccessor::IndicatorFill(int start, int end, int indicator, int value) {
+ Platform::SendScintilla(id, SCI_SETINDICATORCURRENT, indicator);
+ if (value) {
+ Platform::SendScintilla(id, SCI_SETINDICATORVALUE, value);
+ Platform::SendScintilla(id, SCI_INDICATORFILLRANGE, start, end - start);
+ } else {
+ Platform::SendScintilla(id, SCI_INDICATORCLEARRANGE, start, end - start);
+ }
+}