play around with Scintilla and Lexilla

This commit is contained in:
2024-07-02 23:47:26 +08:00
parent d7c71f41b2
commit 727a2ec214
992 changed files with 281111 additions and 195 deletions

View File

@ -0,0 +1,277 @@
// @file ScintillaDocument.cpp
// Wrapper for Scintilla document object so it can be manipulated independently.
// Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware
#include <stdexcept>
#include <string_view>
#include <vector>
#include <map>
#include <set>
#include <optional>
#include <memory>
#include "ScintillaTypes.h"
#include "ScintillaMessages.h"
#include "ScintillaStructures.h"
#include "ScintillaDocument.h"
#include "Debugging.h"
#include "Geometry.h"
#include "Platform.h"
#include "ILoader.h"
#include "ILexer.h"
#include "Scintilla.h"
#include "CharacterCategoryMap.h"
#include "Position.h"
#include "UniqueString.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "ContractionState.h"
#include "CellBuffer.h"
#include "KeyMap.h"
#include "Indicator.h"
#include "LineMarker.h"
#include "Style.h"
#include "ViewStyle.h"
#include "CharClassify.h"
#include "Decoration.h"
#include "CaseFolder.h"
#include "Document.h"
using namespace Scintilla;
using namespace Scintilla::Internal;
class WatcherHelper : public DocWatcher {
ScintillaDocument *owner;
public:
explicit WatcherHelper(ScintillaDocument *owner_);
void NotifyModifyAttempt(Document *doc, void *userData) override;
void NotifySavePoint(Document *doc, void *userData, bool atSavePoint) override;
void NotifyModified(Document *doc, DocModification mh, void *userData) override;
void NotifyDeleted(Document *doc, void *userData) noexcept override;
void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endPos) override;
void NotifyErrorOccurred(Document *doc, void *userData, Status status) override;
};
WatcherHelper::WatcherHelper(ScintillaDocument *owner_) : owner(owner_) {
}
void WatcherHelper::NotifyModifyAttempt(Document *, void *) {
emit owner->modify_attempt();
}
void WatcherHelper::NotifySavePoint(Document *, void *, bool atSavePoint) {
emit owner->save_point(atSavePoint);
}
void WatcherHelper::NotifyModified(Document *, DocModification mh, void *) {
int length = mh.length;
if (!mh.text)
length = 0;
QByteArray ba = QByteArray::fromRawData(mh.text, length);
emit owner->modified(mh.position, static_cast<int>(mh.modificationType), ba, length,
mh.linesAdded, mh.line, static_cast<int>(mh.foldLevelNow), static_cast<int>(mh.foldLevelPrev));
}
void WatcherHelper::NotifyDeleted(Document *, void *) noexcept {
}
void WatcherHelper::NotifyStyleNeeded(Document *, void *, Sci::Position endPos) {
emit owner->style_needed(endPos);
}
void WatcherHelper::NotifyErrorOccurred(Document *, void *, Status status) {
emit owner->error_occurred(static_cast<int>(status));
}
ScintillaDocument::ScintillaDocument(QObject *parent, void *pdoc_) :
QObject(parent), pdoc(static_cast<Scintilla::IDocumentEditable *>(pdoc_)), docWatcher(nullptr) {
if (!pdoc) {
pdoc = new Document(DocumentOption::Default);
}
docWatcher = new WatcherHelper(this);
(static_cast<Document *>(pdoc))->AddRef();
(static_cast<Document *>(pdoc))->AddWatcher(docWatcher, pdoc);
}
ScintillaDocument::~ScintillaDocument() {
Document *doc = static_cast<Document *>(pdoc);
if (doc) {
doc->RemoveWatcher(docWatcher, doc);
doc->Release();
}
pdoc = nullptr;
delete docWatcher;
docWatcher = nullptr;
}
void *ScintillaDocument::pointer() {
return pdoc;
}
int ScintillaDocument::line_from_position(int pos) {
return (static_cast<Document *>(pdoc))->LineFromPosition(pos);
}
bool ScintillaDocument::is_cr_lf(int pos) {
return (static_cast<Document *>(pdoc))->IsCrLf(pos);
}
bool ScintillaDocument::delete_chars(int pos, int len) {
return (static_cast<Document *>(pdoc))->DeleteChars(pos, len);
}
int ScintillaDocument::undo() {
return (static_cast<Document *>(pdoc))->Undo();
}
int ScintillaDocument::redo() {
return (static_cast<Document *>(pdoc))->Redo();
}
bool ScintillaDocument::can_undo() {
return (static_cast<Document *>(pdoc))->CanUndo();
}
bool ScintillaDocument::can_redo() {
return (static_cast<Document *>(pdoc))->CanRedo();
}
void ScintillaDocument::delete_undo_history() {
(static_cast<Document *>(pdoc))->DeleteUndoHistory();
}
bool ScintillaDocument::set_undo_collection(bool collect_undo) {
return (static_cast<Document *>(pdoc))->SetUndoCollection(collect_undo);
}
bool ScintillaDocument::is_collecting_undo() {
return (static_cast<Document *>(pdoc))->IsCollectingUndo();
}
void ScintillaDocument::begin_undo_action(bool coalesceWithPrior) {
(static_cast<Document *>(pdoc))->BeginUndoAction(coalesceWithPrior);
}
void ScintillaDocument::end_undo_action() {
(static_cast<Document *>(pdoc))->EndUndoAction();
}
void ScintillaDocument::set_save_point() {
(static_cast<Document *>(pdoc))->SetSavePoint();
}
bool ScintillaDocument::is_save_point() {
return (static_cast<Document *>(pdoc))->IsSavePoint();
}
void ScintillaDocument::set_read_only(bool read_only) {
(static_cast<Document *>(pdoc))->SetReadOnly(read_only);
}
bool ScintillaDocument::is_read_only() {
return (static_cast<Document *>(pdoc))->IsReadOnly();
}
void ScintillaDocument::insert_string(int position, QByteArray &str) {
(static_cast<Document *>(pdoc))->InsertString(position, str.data(), str.size());
}
QByteArray ScintillaDocument::get_char_range(int position, int length) {
const Document *doc = static_cast<Document *>(pdoc);
if (position < 0 || length <= 0 || position + length > doc->Length())
return QByteArray();
QByteArray ba(length, '\0');
doc->GetCharRange(ba.data(), position, length);
return ba;
}
char ScintillaDocument::style_at(int position) {
return (static_cast<Document *>(pdoc))->StyleAt(position);
}
int ScintillaDocument::line_start(int lineno) {
return (static_cast<Document *>(pdoc))->LineStart(lineno);
}
int ScintillaDocument::line_end(int lineno) {
return (static_cast<Document *>(pdoc))->LineEnd(lineno);
}
int ScintillaDocument::line_end_position(int pos) {
return (static_cast<Document *>(pdoc))->LineEndPosition(pos);
}
int ScintillaDocument::length() {
return (static_cast<Document *>(pdoc))->Length();
}
int ScintillaDocument::lines_total() {
return (static_cast<Document *>(pdoc))->LinesTotal();
}
void ScintillaDocument::start_styling(int position) {
(static_cast<Document *>(pdoc))->StartStyling(position);
}
bool ScintillaDocument::set_style_for(int length, char style) {
return (static_cast<Document *>(pdoc))->SetStyleFor(length, style);
}
int ScintillaDocument::get_end_styled() {
return (static_cast<Document *>(pdoc))->GetEndStyled();
}
void ScintillaDocument::ensure_styled_to(int position) {
(static_cast<Document *>(pdoc))->EnsureStyledTo(position);
}
void ScintillaDocument::set_current_indicator(int indic) {
(static_cast<Document *>(pdoc))->decorations->SetCurrentIndicator(indic);
}
void ScintillaDocument::decoration_fill_range(int position, int value, int fillLength) {
(static_cast<Document *>(pdoc))->DecorationFillRange(position, value, fillLength);
}
int ScintillaDocument::decorations_value_at(int indic, int position) {
return (static_cast<Document *>(pdoc))->decorations->ValueAt(indic, position);
}
int ScintillaDocument::decorations_start(int indic, int position) {
return (static_cast<Document *>(pdoc))->decorations->Start(indic, position);
}
int ScintillaDocument::decorations_end(int indic, int position) {
return (static_cast<Document *>(pdoc))->decorations->End(indic, position);
}
int ScintillaDocument::get_code_page() {
return (static_cast<Document *>(pdoc))->CodePage();
}
void ScintillaDocument::set_code_page(int code_page) {
(static_cast<Document *>(pdoc))->dbcsCodePage = code_page;
}
int ScintillaDocument::get_eol_mode() {
return static_cast<int>((static_cast<Document *>(pdoc))->eolMode);
}
void ScintillaDocument::set_eol_mode(int eol_mode) {
(static_cast<Document *>(pdoc))->eolMode = static_cast<EndOfLine>(eol_mode);
}
int ScintillaDocument::move_position_outside_char(int pos, int move_dir, bool check_line_end) {
return (static_cast<Document *>(pdoc))->MovePositionOutsideChar(pos, move_dir, check_line_end);
}
int ScintillaDocument::get_character(int pos) {
return (static_cast<Document *>(pdoc))->GetCharacterAndWidth(pos, nullptr);
}

View File

@ -0,0 +1,95 @@
// @file ScintillaDocument.h
// Wrapper for Scintilla document object so it can be manipulated independently.
// Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware
#ifndef SCINTILLADOCUMENT_H
#define SCINTILLADOCUMENT_H
#include <QObject>
class WatcherHelper;
#ifndef EXPORT_IMPORT_API
#ifdef WIN32
#ifdef MAKING_LIBRARY
#define EXPORT_IMPORT_API __declspec(dllexport)
#else
// Defining dllimport upsets moc
#define EXPORT_IMPORT_API __declspec(dllimport)
//#define EXPORT_IMPORT_API
#endif
#else
#define EXPORT_IMPORT_API
#endif
#endif
// Forward declaration
namespace Scintilla {
class IDocumentEditable;
}
class EXPORT_IMPORT_API ScintillaDocument : public QObject
{
Q_OBJECT
Scintilla::IDocumentEditable *pdoc;
WatcherHelper *docWatcher;
public:
explicit ScintillaDocument(QObject *parent = 0, void *pdoc_=0);
virtual ~ScintillaDocument();
void *pointer();
int line_from_position(int pos);
bool is_cr_lf(int pos);
bool delete_chars(int pos, int len);
int undo();
int redo();
bool can_undo();
bool can_redo();
void delete_undo_history();
bool set_undo_collection(bool collect_undo);
bool is_collecting_undo();
void begin_undo_action(bool coalesceWithPrior = false);
void end_undo_action();
void set_save_point();
bool is_save_point();
void set_read_only(bool read_only);
bool is_read_only();
void insert_string(int position, QByteArray &str);
QByteArray get_char_range(int position, int length);
char style_at(int position);
int line_start(int lineno);
int line_end(int lineno);
int line_end_position(int pos);
int length();
int lines_total();
void start_styling(int position);
bool set_style_for(int length, char style);
int get_end_styled();
void ensure_styled_to(int position);
void set_current_indicator(int indic);
void decoration_fill_range(int position, int value, int fillLength);
int decorations_value_at(int indic, int position);
int decorations_start(int indic, int position);
int decorations_end(int indic, int position);
int get_code_page();
void set_code_page(int code_page);
int get_eol_mode();
void set_eol_mode(int eol_mode);
int move_position_outside_char(int pos, int move_dir, bool check_line_end);
int get_character(int pos); // Calls GetCharacterAndWidth(pos, NULL)
signals:
void modify_attempt();
void save_point(bool atSavePoint);
void modified(int position, int modification_type, const QByteArray &text, int length,
int linesAdded, int line, int foldLevelNow, int foldLevelPrev);
void style_needed(int pos);
void error_occurred(int status);
friend class ::WatcherHelper;
};
#endif /* SCINTILLADOCUMENT_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,87 @@
// @file ScintillaEdit.cpp
// Extended version of ScintillaEditBase with a method for each API
// Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware
#include "ScintillaEdit.h"
using namespace Scintilla;
ScintillaEdit::ScintillaEdit(QWidget *parent) : ScintillaEditBase(parent) {
}
ScintillaEdit::~ScintillaEdit() {
}
QByteArray ScintillaEdit::TextReturner(int message, uptr_t wParam) const {
// While Scintilla can return strings longer than maximum(int), QByteArray uses int size
const int length = static_cast<int>(send(message, wParam, 0));
QByteArray ba(length + 1, '\0');
send(message, wParam, (sptr_t)ba.data());
// Remove extra NULs
if (ba.at(ba.size()-1) == 0)
ba.chop(1);
return ba;
}
QPair<int, int>ScintillaEdit::find_text(int flags, const char *text, int cpMin, int cpMax) {
struct Sci_TextToFind ft = {{0, 0}, 0, {0, 0}};
ft.chrg.cpMin = cpMin;
ft.chrg.cpMax = cpMax;
ft.chrgText.cpMin = cpMin;
ft.chrgText.cpMax = cpMax;
ft.lpstrText = text;
int start = send(SCI_FINDTEXT, flags, (uptr_t) (&ft));
return QPair<int,int>(start, ft.chrgText.cpMax);
}
QByteArray ScintillaEdit::get_text_range(int start, int end) {
if (start > end)
start = end;
int length = end-start;
QByteArray ba(length+1, '\0');
struct Sci_TextRange tr = {{start, end}, ba.data()};
send(SCI_GETTEXTRANGE, 0, (sptr_t)&tr);
ba.chop(1); // Remove extra NUL
return ba;
}
ScintillaDocument *ScintillaEdit::get_doc() {
return new ScintillaDocument(0, (void *)send(SCI_GETDOCPOINTER, 0, 0));
}
void ScintillaEdit::set_doc(ScintillaDocument *pdoc_) {
send(SCI_SETDOCPOINTER, 0, (sptr_t)(pdoc_->pointer()));
}
long ScintillaEdit::format_range(bool draw, QPaintDevice* target, QPaintDevice* measure,
const QRect& print_rect, const QRect& page_rect,
long range_start, long range_end)
{
Sci_RangeToFormat to_format;
to_format.hdc = target;
to_format.hdcTarget = measure;
to_format.rc.left = print_rect.left();
to_format.rc.top = print_rect.top();
to_format.rc.right = print_rect.right();
to_format.rc.bottom = print_rect.bottom();
to_format.rcPage.left = page_rect.left();
to_format.rcPage.top = page_rect.top();
to_format.rcPage.right = page_rect.right();
to_format.rcPage.bottom = page_rect.bottom();
to_format.chrg.cpMin = range_start;
to_format.chrg.cpMax = range_end;
return send(SCI_FORMATRANGE, draw, reinterpret_cast<sptr_t>(&to_format));
}
/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */

View File

@ -0,0 +1,863 @@
// @file ScintillaEdit.h
// Extended version of ScintillaEditBase with a method for each API
// Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware
#ifndef SCINTILLAEDIT_H
#define SCINTILLAEDIT_H
#include <QPair>
#include "ScintillaEditBase.h"
#include "ScintillaDocument.h"
#ifndef EXPORT_IMPORT_API
#ifdef WIN32
#ifdef MAKING_LIBRARY
#define EXPORT_IMPORT_API __declspec(dllexport)
#else
// Defining dllimport upsets moc
#define EXPORT_IMPORT_API __declspec(dllimport)
//#define EXPORT_IMPORT_API
#endif
#else
#define EXPORT_IMPORT_API
#endif
#endif
class EXPORT_IMPORT_API ScintillaEdit : public ScintillaEditBase {
Q_OBJECT
public:
ScintillaEdit(QWidget *parent = 0);
virtual ~ScintillaEdit();
QByteArray TextReturner(int message, uptr_t wParam) const;
QPair<int, int>find_text(int flags, const char *text, int cpMin, int cpMax);
QByteArray get_text_range(int start, int end);
ScintillaDocument *get_doc();
void set_doc(ScintillaDocument *pdoc_);
// Same as previous two methods but with Qt style names
QPair<int, int>findText(int flags, const char *text, int cpMin, int cpMax) {
return find_text(flags, text, cpMin, cpMax);
}
QByteArray textRange(int start, int end) {
return get_text_range(start, end);
}
// Exposing the FORMATRANGE api with both underscore & qt style names
long format_range(bool draw, QPaintDevice* target, QPaintDevice* measure,
const QRect& print_rect, const QRect& page_rect,
long range_start, long range_end);
long formatRange(bool draw, QPaintDevice* target, QPaintDevice* measure,
const QRect& print_rect, const QRect& page_rect,
long range_start, long range_end) {
return format_range(draw, target, measure, print_rect, page_rect,
range_start, range_end);
}
/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */
void addText(sptr_t length, const char * text);
void addStyledText(sptr_t length, const char * c);
void insertText(sptr_t pos, const char * text);
void changeInsertion(sptr_t length, const char * text);
void clearAll();
void deleteRange(sptr_t start, sptr_t lengthDelete);
void clearDocumentStyle();
sptr_t length() const;
sptr_t charAt(sptr_t pos) const;
sptr_t currentPos() const;
sptr_t anchor() const;
sptr_t styleAt(sptr_t pos) const;
sptr_t styleIndexAt(sptr_t pos) const;
void redo();
void setUndoCollection(bool collectUndo);
void selectAll();
void setSavePoint();
bool canRedo();
sptr_t markerLineFromHandle(sptr_t markerHandle);
void markerDeleteHandle(sptr_t markerHandle);
sptr_t markerHandleFromLine(sptr_t line, sptr_t which);
sptr_t markerNumberFromLine(sptr_t line, sptr_t which);
bool undoCollection() const;
sptr_t viewWS() const;
void setViewWS(sptr_t viewWS);
sptr_t tabDrawMode() const;
void setTabDrawMode(sptr_t tabDrawMode);
sptr_t positionFromPoint(sptr_t x, sptr_t y);
sptr_t positionFromPointClose(sptr_t x, sptr_t y);
void gotoLine(sptr_t line);
void gotoPos(sptr_t caret);
void setAnchor(sptr_t anchor);
QByteArray getCurLine(sptr_t length);
sptr_t endStyled() const;
void convertEOLs(sptr_t eolMode);
sptr_t eOLMode() const;
void setEOLMode(sptr_t eolMode);
void startStyling(sptr_t start, sptr_t unused);
void setStyling(sptr_t length, sptr_t style);
bool bufferedDraw() const;
void setBufferedDraw(bool buffered);
void setTabWidth(sptr_t tabWidth);
sptr_t tabWidth() const;
void setTabMinimumWidth(sptr_t pixels);
sptr_t tabMinimumWidth() const;
void clearTabStops(sptr_t line);
void addTabStop(sptr_t line, sptr_t x);
sptr_t getNextTabStop(sptr_t line, sptr_t x);
void setCodePage(sptr_t codePage);
void setFontLocale(const char * localeName);
QByteArray fontLocale() const;
sptr_t iMEInteraction() const;
void setIMEInteraction(sptr_t imeInteraction);
void markerDefine(sptr_t markerNumber, sptr_t markerSymbol);
void markerSetFore(sptr_t markerNumber, sptr_t fore);
void markerSetBack(sptr_t markerNumber, sptr_t back);
void markerSetBackSelected(sptr_t markerNumber, sptr_t back);
void markerSetForeTranslucent(sptr_t markerNumber, sptr_t fore);
void markerSetBackTranslucent(sptr_t markerNumber, sptr_t back);
void markerSetBackSelectedTranslucent(sptr_t markerNumber, sptr_t back);
void markerSetStrokeWidth(sptr_t markerNumber, sptr_t hundredths);
void markerEnableHighlight(bool enabled);
sptr_t markerAdd(sptr_t line, sptr_t markerNumber);
void markerDelete(sptr_t line, sptr_t markerNumber);
void markerDeleteAll(sptr_t markerNumber);
sptr_t markerGet(sptr_t line);
sptr_t markerNext(sptr_t lineStart, sptr_t markerMask);
sptr_t markerPrevious(sptr_t lineStart, sptr_t markerMask);
void markerDefinePixmap(sptr_t markerNumber, const char * pixmap);
void markerAddSet(sptr_t line, sptr_t markerSet);
void markerSetAlpha(sptr_t markerNumber, sptr_t alpha);
sptr_t markerLayer(sptr_t markerNumber) const;
void markerSetLayer(sptr_t markerNumber, sptr_t layer);
void setMarginTypeN(sptr_t margin, sptr_t marginType);
sptr_t marginTypeN(sptr_t margin) const;
void setMarginWidthN(sptr_t margin, sptr_t pixelWidth);
sptr_t marginWidthN(sptr_t margin) const;
void setMarginMaskN(sptr_t margin, sptr_t mask);
sptr_t marginMaskN(sptr_t margin) const;
void setMarginSensitiveN(sptr_t margin, bool sensitive);
bool marginSensitiveN(sptr_t margin) const;
void setMarginCursorN(sptr_t margin, sptr_t cursor);
sptr_t marginCursorN(sptr_t margin) const;
void setMarginBackN(sptr_t margin, sptr_t back);
sptr_t marginBackN(sptr_t margin) const;
void setMargins(sptr_t margins);
sptr_t margins() const;
void styleClearAll();
void styleSetFore(sptr_t style, sptr_t fore);
void styleSetBack(sptr_t style, sptr_t back);
void styleSetBold(sptr_t style, bool bold);
void styleSetItalic(sptr_t style, bool italic);
void styleSetSize(sptr_t style, sptr_t sizePoints);
void styleSetFont(sptr_t style, const char * fontName);
void styleSetEOLFilled(sptr_t style, bool eolFilled);
void styleResetDefault();
void styleSetUnderline(sptr_t style, bool underline);
sptr_t styleFore(sptr_t style) const;
sptr_t styleBack(sptr_t style) const;
bool styleBold(sptr_t style) const;
bool styleItalic(sptr_t style) const;
sptr_t styleSize(sptr_t style) const;
QByteArray styleFont(sptr_t style) const;
bool styleEOLFilled(sptr_t style) const;
bool styleUnderline(sptr_t style) const;
sptr_t styleCase(sptr_t style) const;
sptr_t styleCharacterSet(sptr_t style) const;
bool styleVisible(sptr_t style) const;
bool styleChangeable(sptr_t style) const;
bool styleHotSpot(sptr_t style) const;
void styleSetCase(sptr_t style, sptr_t caseVisible);
void styleSetSizeFractional(sptr_t style, sptr_t sizeHundredthPoints);
sptr_t styleSizeFractional(sptr_t style) const;
void styleSetWeight(sptr_t style, sptr_t weight);
sptr_t styleWeight(sptr_t style) const;
void styleSetCharacterSet(sptr_t style, sptr_t characterSet);
void styleSetHotSpot(sptr_t style, bool hotspot);
void styleSetCheckMonospaced(sptr_t style, bool checkMonospaced);
bool styleCheckMonospaced(sptr_t style) const;
void styleSetInvisibleRepresentation(sptr_t style, const char * representation);
QByteArray styleInvisibleRepresentation(sptr_t style) const;
void setElementColour(sptr_t element, sptr_t colourElement);
sptr_t elementColour(sptr_t element) const;
void resetElementColour(sptr_t element);
bool elementIsSet(sptr_t element) const;
bool elementAllowsTranslucent(sptr_t element) const;
sptr_t elementBaseColour(sptr_t element) const;
void setSelFore(bool useSetting, sptr_t fore);
void setSelBack(bool useSetting, sptr_t back);
sptr_t selAlpha() const;
void setSelAlpha(sptr_t alpha);
bool selEOLFilled() const;
void setSelEOLFilled(bool filled);
sptr_t selectionLayer() const;
void setSelectionLayer(sptr_t layer);
sptr_t caretLineLayer() const;
void setCaretLineLayer(sptr_t layer);
bool caretLineHighlightSubLine() const;
void setCaretLineHighlightSubLine(bool subLine);
void setCaretFore(sptr_t fore);
void assignCmdKey(sptr_t keyDefinition, sptr_t sciCommand);
void clearCmdKey(sptr_t keyDefinition);
void clearAllCmdKeys();
void setStylingEx(sptr_t length, const char * styles);
void styleSetVisible(sptr_t style, bool visible);
sptr_t caretPeriod() const;
void setCaretPeriod(sptr_t periodMilliseconds);
void setWordChars(const char * characters);
QByteArray wordChars() const;
void setCharacterCategoryOptimization(sptr_t countCharacters);
sptr_t characterCategoryOptimization() const;
void beginUndoAction();
void endUndoAction();
sptr_t undoActions() const;
void setUndoSavePoint(sptr_t action);
sptr_t undoSavePoint() const;
void setUndoDetach(sptr_t action);
sptr_t undoDetach() const;
void setUndoTentative(sptr_t action);
sptr_t undoTentative() const;
void setUndoCurrent(sptr_t action);
sptr_t undoCurrent() const;
void pushUndoActionType(sptr_t type, sptr_t pos);
void changeLastUndoActionText(sptr_t length, const char * text);
sptr_t undoActionType(sptr_t action) const;
sptr_t undoActionPosition(sptr_t action) const;
QByteArray undoActionText(sptr_t action) const;
void indicSetStyle(sptr_t indicator, sptr_t indicatorStyle);
sptr_t indicStyle(sptr_t indicator) const;
void indicSetFore(sptr_t indicator, sptr_t fore);
sptr_t indicFore(sptr_t indicator) const;
void indicSetUnder(sptr_t indicator, bool under);
bool indicUnder(sptr_t indicator) const;
void indicSetHoverStyle(sptr_t indicator, sptr_t indicatorStyle);
sptr_t indicHoverStyle(sptr_t indicator) const;
void indicSetHoverFore(sptr_t indicator, sptr_t fore);
sptr_t indicHoverFore(sptr_t indicator) const;
void indicSetFlags(sptr_t indicator, sptr_t flags);
sptr_t indicFlags(sptr_t indicator) const;
void indicSetStrokeWidth(sptr_t indicator, sptr_t hundredths);
sptr_t indicStrokeWidth(sptr_t indicator) const;
void setWhitespaceFore(bool useSetting, sptr_t fore);
void setWhitespaceBack(bool useSetting, sptr_t back);
void setWhitespaceSize(sptr_t size);
sptr_t whitespaceSize() const;
void setLineState(sptr_t line, sptr_t state);
sptr_t lineState(sptr_t line) const;
sptr_t maxLineState() const;
bool caretLineVisible() const;
void setCaretLineVisible(bool show);
sptr_t caretLineBack() const;
void setCaretLineBack(sptr_t back);
sptr_t caretLineFrame() const;
void setCaretLineFrame(sptr_t width);
void styleSetChangeable(sptr_t style, bool changeable);
void autoCShow(sptr_t lengthEntered, const char * itemList);
void autoCCancel();
bool autoCActive();
sptr_t autoCPosStart();
void autoCComplete();
void autoCStops(const char * characterSet);
void autoCSetSeparator(sptr_t separatorCharacter);
sptr_t autoCSeparator() const;
void autoCSelect(const char * select);
void autoCSetCancelAtStart(bool cancel);
bool autoCCancelAtStart() const;
void autoCSetFillUps(const char * characterSet);
void autoCSetChooseSingle(bool chooseSingle);
bool autoCChooseSingle() const;
void autoCSetIgnoreCase(bool ignoreCase);
bool autoCIgnoreCase() const;
void userListShow(sptr_t listType, const char * itemList);
void autoCSetAutoHide(bool autoHide);
bool autoCAutoHide() const;
void autoCSetOptions(sptr_t options);
sptr_t autoCOptions() const;
void autoCSetDropRestOfWord(bool dropRestOfWord);
bool autoCDropRestOfWord() const;
void registerImage(sptr_t type, const char * xpmData);
void clearRegisteredImages();
sptr_t autoCTypeSeparator() const;
void autoCSetTypeSeparator(sptr_t separatorCharacter);
void autoCSetMaxWidth(sptr_t characterCount);
sptr_t autoCMaxWidth() const;
void autoCSetMaxHeight(sptr_t rowCount);
sptr_t autoCMaxHeight() const;
void setIndent(sptr_t indentSize);
sptr_t indent() const;
void setUseTabs(bool useTabs);
bool useTabs() const;
void setLineIndentation(sptr_t line, sptr_t indentation);
sptr_t lineIndentation(sptr_t line) const;
sptr_t lineIndentPosition(sptr_t line) const;
sptr_t column(sptr_t pos) const;
sptr_t countCharacters(sptr_t start, sptr_t end);
sptr_t countCodeUnits(sptr_t start, sptr_t end);
void setHScrollBar(bool visible);
bool hScrollBar() const;
void setIndentationGuides(sptr_t indentView);
sptr_t indentationGuides() const;
void setHighlightGuide(sptr_t column);
sptr_t highlightGuide() const;
sptr_t lineEndPosition(sptr_t line) const;
sptr_t codePage() const;
sptr_t caretFore() const;
bool readOnly() const;
void setCurrentPos(sptr_t caret);
void setSelectionStart(sptr_t anchor);
sptr_t selectionStart() const;
void setSelectionEnd(sptr_t caret);
sptr_t selectionEnd() const;
void setEmptySelection(sptr_t caret);
void setPrintMagnification(sptr_t magnification);
sptr_t printMagnification() const;
void setPrintColourMode(sptr_t mode);
sptr_t printColourMode() const;
void setChangeHistory(sptr_t changeHistory);
sptr_t changeHistory() const;
sptr_t firstVisibleLine() const;
QByteArray getLine(sptr_t line);
sptr_t lineCount() const;
void allocateLines(sptr_t lines);
void setMarginLeft(sptr_t pixelWidth);
sptr_t marginLeft() const;
void setMarginRight(sptr_t pixelWidth);
sptr_t marginRight() const;
bool modify() const;
void setSel(sptr_t anchor, sptr_t caret);
QByteArray getSelText();
void hideSelection(bool hide);
bool selectionHidden() const;
sptr_t pointXFromPosition(sptr_t pos);
sptr_t pointYFromPosition(sptr_t pos);
sptr_t lineFromPosition(sptr_t pos);
sptr_t positionFromLine(sptr_t line);
void lineScroll(sptr_t columns, sptr_t lines);
void scrollCaret();
void scrollRange(sptr_t secondary, sptr_t primary);
void replaceSel(const char * text);
void setReadOnly(bool readOnly);
void null();
bool canPaste();
bool canUndo();
void emptyUndoBuffer();
void undo();
void cut();
void copy();
void paste();
void clear();
void setText(const char * text);
QByteArray getText(sptr_t length);
sptr_t textLength() const;
sptr_t directFunction() const;
sptr_t directStatusFunction() const;
sptr_t directPointer() const;
void setOvertype(bool overType);
bool overtype() const;
void setCaretWidth(sptr_t pixelWidth);
sptr_t caretWidth() const;
void setTargetStart(sptr_t start);
sptr_t targetStart() const;
void setTargetStartVirtualSpace(sptr_t space);
sptr_t targetStartVirtualSpace() const;
void setTargetEnd(sptr_t end);
sptr_t targetEnd() const;
void setTargetEndVirtualSpace(sptr_t space);
sptr_t targetEndVirtualSpace() const;
void setTargetRange(sptr_t start, sptr_t end);
QByteArray targetText() const;
void targetFromSelection();
void targetWholeDocument();
sptr_t replaceTarget(sptr_t length, const char * text);
sptr_t replaceTargetRE(sptr_t length, const char * text);
sptr_t replaceTargetMinimal(sptr_t length, const char * text);
sptr_t searchInTarget(sptr_t length, const char * text);
void setSearchFlags(sptr_t searchFlags);
sptr_t searchFlags() const;
void callTipShow(sptr_t pos, const char * definition);
void callTipCancel();
bool callTipActive();
sptr_t callTipPosStart();
void callTipSetPosStart(sptr_t posStart);
void callTipSetHlt(sptr_t highlightStart, sptr_t highlightEnd);
void callTipSetBack(sptr_t back);
void callTipSetFore(sptr_t fore);
void callTipSetForeHlt(sptr_t fore);
void callTipUseStyle(sptr_t tabSize);
void callTipSetPosition(bool above);
sptr_t visibleFromDocLine(sptr_t docLine);
sptr_t docLineFromVisible(sptr_t displayLine);
sptr_t wrapCount(sptr_t docLine);
void setFoldLevel(sptr_t line, sptr_t level);
sptr_t foldLevel(sptr_t line) const;
sptr_t lastChild(sptr_t line, sptr_t level) const;
sptr_t foldParent(sptr_t line) const;
void showLines(sptr_t lineStart, sptr_t lineEnd);
void hideLines(sptr_t lineStart, sptr_t lineEnd);
bool lineVisible(sptr_t line) const;
bool allLinesVisible() const;
void setFoldExpanded(sptr_t line, bool expanded);
bool foldExpanded(sptr_t line) const;
void toggleFold(sptr_t line);
void toggleFoldShowText(sptr_t line, const char * text);
void foldDisplayTextSetStyle(sptr_t style);
sptr_t foldDisplayTextStyle() const;
void setDefaultFoldDisplayText(const char * text);
QByteArray getDefaultFoldDisplayText();
void foldLine(sptr_t line, sptr_t action);
void foldChildren(sptr_t line, sptr_t action);
void expandChildren(sptr_t line, sptr_t level);
void foldAll(sptr_t action);
void ensureVisible(sptr_t line);
void setAutomaticFold(sptr_t automaticFold);
sptr_t automaticFold() const;
void setFoldFlags(sptr_t flags);
void ensureVisibleEnforcePolicy(sptr_t line);
void setTabIndents(bool tabIndents);
bool tabIndents() const;
void setBackSpaceUnIndents(bool bsUnIndents);
bool backSpaceUnIndents() const;
void setMouseDwellTime(sptr_t periodMilliseconds);
sptr_t mouseDwellTime() const;
sptr_t wordStartPosition(sptr_t pos, bool onlyWordCharacters);
sptr_t wordEndPosition(sptr_t pos, bool onlyWordCharacters);
bool isRangeWord(sptr_t start, sptr_t end);
void setIdleStyling(sptr_t idleStyling);
sptr_t idleStyling() const;
void setWrapMode(sptr_t wrapMode);
sptr_t wrapMode() const;
void setWrapVisualFlags(sptr_t wrapVisualFlags);
sptr_t wrapVisualFlags() const;
void setWrapVisualFlagsLocation(sptr_t wrapVisualFlagsLocation);
sptr_t wrapVisualFlagsLocation() const;
void setWrapStartIndent(sptr_t indent);
sptr_t wrapStartIndent() const;
void setWrapIndentMode(sptr_t wrapIndentMode);
sptr_t wrapIndentMode() const;
void setLayoutCache(sptr_t cacheMode);
sptr_t layoutCache() const;
void setScrollWidth(sptr_t pixelWidth);
sptr_t scrollWidth() const;
void setScrollWidthTracking(bool tracking);
bool scrollWidthTracking() const;
sptr_t textWidth(sptr_t style, const char * text);
void setEndAtLastLine(bool endAtLastLine);
bool endAtLastLine() const;
sptr_t textHeight(sptr_t line);
void setVScrollBar(bool visible);
bool vScrollBar() const;
void appendText(sptr_t length, const char * text);
sptr_t phasesDraw() const;
void setPhasesDraw(sptr_t phases);
void setFontQuality(sptr_t fontQuality);
sptr_t fontQuality() const;
void setFirstVisibleLine(sptr_t displayLine);
void setMultiPaste(sptr_t multiPaste);
sptr_t multiPaste() const;
QByteArray tag(sptr_t tagNumber) const;
void linesJoin();
void linesSplit(sptr_t pixelWidth);
void setFoldMarginColour(bool useSetting, sptr_t back);
void setFoldMarginHiColour(bool useSetting, sptr_t fore);
void setAccessibility(sptr_t accessibility);
sptr_t accessibility() const;
void lineDown();
void lineDownExtend();
void lineUp();
void lineUpExtend();
void charLeft();
void charLeftExtend();
void charRight();
void charRightExtend();
void wordLeft();
void wordLeftExtend();
void wordRight();
void wordRightExtend();
void home();
void homeExtend();
void lineEnd();
void lineEndExtend();
void documentStart();
void documentStartExtend();
void documentEnd();
void documentEndExtend();
void pageUp();
void pageUpExtend();
void pageDown();
void pageDownExtend();
void editToggleOvertype();
void cancel();
void deleteBack();
void tab();
void backTab();
void newLine();
void formFeed();
void vCHome();
void vCHomeExtend();
void zoomIn();
void zoomOut();
void delWordLeft();
void delWordRight();
void delWordRightEnd();
void lineCut();
void lineDelete();
void lineTranspose();
void lineReverse();
void lineDuplicate();
void lowerCase();
void upperCase();
void lineScrollDown();
void lineScrollUp();
void deleteBackNotLine();
void homeDisplay();
void homeDisplayExtend();
void lineEndDisplay();
void lineEndDisplayExtend();
void homeWrap();
void homeWrapExtend();
void lineEndWrap();
void lineEndWrapExtend();
void vCHomeWrap();
void vCHomeWrapExtend();
void lineCopy();
void moveCaretInsideView();
sptr_t lineLength(sptr_t line);
void braceHighlight(sptr_t posA, sptr_t posB);
void braceHighlightIndicator(bool useSetting, sptr_t indicator);
void braceBadLight(sptr_t pos);
void braceBadLightIndicator(bool useSetting, sptr_t indicator);
sptr_t braceMatch(sptr_t pos, sptr_t maxReStyle);
sptr_t braceMatchNext(sptr_t pos, sptr_t startPos);
bool viewEOL() const;
void setViewEOL(bool visible);
sptr_t docPointer() const;
void setDocPointer(sptr_t doc);
void setModEventMask(sptr_t eventMask);
sptr_t edgeColumn() const;
void setEdgeColumn(sptr_t column);
sptr_t edgeMode() const;
void setEdgeMode(sptr_t edgeMode);
sptr_t edgeColour() const;
void setEdgeColour(sptr_t edgeColour);
void multiEdgeAddLine(sptr_t column, sptr_t edgeColour);
void multiEdgeClearAll();
sptr_t multiEdgeColumn(sptr_t which) const;
void searchAnchor();
sptr_t searchNext(sptr_t searchFlags, const char * text);
sptr_t searchPrev(sptr_t searchFlags, const char * text);
sptr_t linesOnScreen() const;
void usePopUp(sptr_t popUpMode);
bool selectionIsRectangle() const;
void setZoom(sptr_t zoomInPoints);
sptr_t zoom() const;
sptr_t createDocument(sptr_t bytes, sptr_t documentOptions);
void addRefDocument(sptr_t doc);
void releaseDocument(sptr_t doc);
sptr_t documentOptions() const;
sptr_t modEventMask() const;
void setCommandEvents(bool commandEvents);
bool commandEvents() const;
void setFocus(bool focus);
bool focus() const;
void setStatus(sptr_t status);
sptr_t status() const;
void setMouseDownCaptures(bool captures);
bool mouseDownCaptures() const;
void setMouseWheelCaptures(bool captures);
bool mouseWheelCaptures() const;
void setCursor(sptr_t cursorType);
sptr_t cursor() const;
void setControlCharSymbol(sptr_t symbol);
sptr_t controlCharSymbol() const;
void wordPartLeft();
void wordPartLeftExtend();
void wordPartRight();
void wordPartRightExtend();
void setVisiblePolicy(sptr_t visiblePolicy, sptr_t visibleSlop);
void delLineLeft();
void delLineRight();
void setXOffset(sptr_t xOffset);
sptr_t xOffset() const;
void chooseCaretX();
void grabFocus();
void setXCaretPolicy(sptr_t caretPolicy, sptr_t caretSlop);
void setYCaretPolicy(sptr_t caretPolicy, sptr_t caretSlop);
void setPrintWrapMode(sptr_t wrapMode);
sptr_t printWrapMode() const;
void setHotspotActiveFore(bool useSetting, sptr_t fore);
sptr_t hotspotActiveFore() const;
void setHotspotActiveBack(bool useSetting, sptr_t back);
sptr_t hotspotActiveBack() const;
void setHotspotActiveUnderline(bool underline);
bool hotspotActiveUnderline() const;
void setHotspotSingleLine(bool singleLine);
bool hotspotSingleLine() const;
void paraDown();
void paraDownExtend();
void paraUp();
void paraUpExtend();
sptr_t positionBefore(sptr_t pos);
sptr_t positionAfter(sptr_t pos);
sptr_t positionRelative(sptr_t pos, sptr_t relative);
sptr_t positionRelativeCodeUnits(sptr_t pos, sptr_t relative);
void copyRange(sptr_t start, sptr_t end);
void copyText(sptr_t length, const char * text);
void setSelectionMode(sptr_t selectionMode);
void changeSelectionMode(sptr_t selectionMode);
sptr_t selectionMode() const;
void setMoveExtendsSelection(bool moveExtendsSelection);
bool moveExtendsSelection() const;
sptr_t getLineSelStartPosition(sptr_t line);
sptr_t getLineSelEndPosition(sptr_t line);
void lineDownRectExtend();
void lineUpRectExtend();
void charLeftRectExtend();
void charRightRectExtend();
void homeRectExtend();
void vCHomeRectExtend();
void lineEndRectExtend();
void pageUpRectExtend();
void pageDownRectExtend();
void stutteredPageUp();
void stutteredPageUpExtend();
void stutteredPageDown();
void stutteredPageDownExtend();
void wordLeftEnd();
void wordLeftEndExtend();
void wordRightEnd();
void wordRightEndExtend();
void setWhitespaceChars(const char * characters);
QByteArray whitespaceChars() const;
void setPunctuationChars(const char * characters);
QByteArray punctuationChars() const;
void setCharsDefault();
sptr_t autoCCurrent() const;
QByteArray autoCCurrentText() const;
void autoCSetCaseInsensitiveBehaviour(sptr_t behaviour);
sptr_t autoCCaseInsensitiveBehaviour() const;
void autoCSetMulti(sptr_t multi);
sptr_t autoCMulti() const;
void autoCSetOrder(sptr_t order);
sptr_t autoCOrder() const;
void allocate(sptr_t bytes);
QByteArray targetAsUTF8();
void setLengthForEncode(sptr_t bytes);
QByteArray encodedFromUTF8(const char * utf8);
sptr_t findColumn(sptr_t line, sptr_t column);
sptr_t caretSticky() const;
void setCaretSticky(sptr_t useCaretStickyBehaviour);
void toggleCaretSticky();
void setPasteConvertEndings(bool convert);
bool pasteConvertEndings() const;
void replaceRectangular(sptr_t length, const char * text);
void selectionDuplicate();
void setCaretLineBackAlpha(sptr_t alpha);
sptr_t caretLineBackAlpha() const;
void setCaretStyle(sptr_t caretStyle);
sptr_t caretStyle() const;
void setIndicatorCurrent(sptr_t indicator);
sptr_t indicatorCurrent() const;
void setIndicatorValue(sptr_t value);
sptr_t indicatorValue() const;
void indicatorFillRange(sptr_t start, sptr_t lengthFill);
void indicatorClearRange(sptr_t start, sptr_t lengthClear);
sptr_t indicatorAllOnFor(sptr_t pos);
sptr_t indicatorValueAt(sptr_t indicator, sptr_t pos);
sptr_t indicatorStart(sptr_t indicator, sptr_t pos);
sptr_t indicatorEnd(sptr_t indicator, sptr_t pos);
void setPositionCache(sptr_t size);
sptr_t positionCache() const;
void setLayoutThreads(sptr_t threads);
sptr_t layoutThreads() const;
void copyAllowLine();
sptr_t characterPointer() const;
sptr_t rangePointer(sptr_t start, sptr_t lengthRange) const;
sptr_t gapPosition() const;
void indicSetAlpha(sptr_t indicator, sptr_t alpha);
sptr_t indicAlpha(sptr_t indicator) const;
void indicSetOutlineAlpha(sptr_t indicator, sptr_t alpha);
sptr_t indicOutlineAlpha(sptr_t indicator) const;
void setExtraAscent(sptr_t extraAscent);
sptr_t extraAscent() const;
void setExtraDescent(sptr_t extraDescent);
sptr_t extraDescent() const;
sptr_t markerSymbolDefined(sptr_t markerNumber);
void marginSetText(sptr_t line, const char * text);
QByteArray marginText(sptr_t line) const;
void marginSetStyle(sptr_t line, sptr_t style);
sptr_t marginStyle(sptr_t line) const;
void marginSetStyles(sptr_t line, const char * styles);
QByteArray marginStyles(sptr_t line) const;
void marginTextClearAll();
void marginSetStyleOffset(sptr_t style);
sptr_t marginStyleOffset() const;
void setMarginOptions(sptr_t marginOptions);
sptr_t marginOptions() const;
void annotationSetText(sptr_t line, const char * text);
QByteArray annotationText(sptr_t line) const;
void annotationSetStyle(sptr_t line, sptr_t style);
sptr_t annotationStyle(sptr_t line) const;
void annotationSetStyles(sptr_t line, const char * styles);
QByteArray annotationStyles(sptr_t line) const;
sptr_t annotationLines(sptr_t line) const;
void annotationClearAll();
void annotationSetVisible(sptr_t visible);
sptr_t annotationVisible() const;
void annotationSetStyleOffset(sptr_t style);
sptr_t annotationStyleOffset() const;
void releaseAllExtendedStyles();
sptr_t allocateExtendedStyles(sptr_t numberStyles);
void addUndoAction(sptr_t token, sptr_t flags);
sptr_t charPositionFromPoint(sptr_t x, sptr_t y);
sptr_t charPositionFromPointClose(sptr_t x, sptr_t y);
void setMouseSelectionRectangularSwitch(bool mouseSelectionRectangularSwitch);
bool mouseSelectionRectangularSwitch() const;
void setMultipleSelection(bool multipleSelection);
bool multipleSelection() const;
void setAdditionalSelectionTyping(bool additionalSelectionTyping);
bool additionalSelectionTyping() const;
void setAdditionalCaretsBlink(bool additionalCaretsBlink);
bool additionalCaretsBlink() const;
void setAdditionalCaretsVisible(bool additionalCaretsVisible);
bool additionalCaretsVisible() const;
sptr_t selections() const;
bool selectionEmpty() const;
void clearSelections();
void setSelection(sptr_t caret, sptr_t anchor);
void addSelection(sptr_t caret, sptr_t anchor);
sptr_t selectionFromPoint(sptr_t x, sptr_t y);
void dropSelectionN(sptr_t selection);
void setMainSelection(sptr_t selection);
sptr_t mainSelection() const;
void setSelectionNCaret(sptr_t selection, sptr_t caret);
sptr_t selectionNCaret(sptr_t selection) const;
void setSelectionNAnchor(sptr_t selection, sptr_t anchor);
sptr_t selectionNAnchor(sptr_t selection) const;
void setSelectionNCaretVirtualSpace(sptr_t selection, sptr_t space);
sptr_t selectionNCaretVirtualSpace(sptr_t selection) const;
void setSelectionNAnchorVirtualSpace(sptr_t selection, sptr_t space);
sptr_t selectionNAnchorVirtualSpace(sptr_t selection) const;
void setSelectionNStart(sptr_t selection, sptr_t anchor);
sptr_t selectionNStart(sptr_t selection) const;
sptr_t selectionNStartVirtualSpace(sptr_t selection) const;
void setSelectionNEnd(sptr_t selection, sptr_t caret);
sptr_t selectionNEndVirtualSpace(sptr_t selection) const;
sptr_t selectionNEnd(sptr_t selection) const;
void setRectangularSelectionCaret(sptr_t caret);
sptr_t rectangularSelectionCaret() const;
void setRectangularSelectionAnchor(sptr_t anchor);
sptr_t rectangularSelectionAnchor() const;
void setRectangularSelectionCaretVirtualSpace(sptr_t space);
sptr_t rectangularSelectionCaretVirtualSpace() const;
void setRectangularSelectionAnchorVirtualSpace(sptr_t space);
sptr_t rectangularSelectionAnchorVirtualSpace() const;
void setVirtualSpaceOptions(sptr_t virtualSpaceOptions);
sptr_t virtualSpaceOptions() const;
void setRectangularSelectionModifier(sptr_t modifier);
sptr_t rectangularSelectionModifier() const;
void setAdditionalSelFore(sptr_t fore);
void setAdditionalSelBack(sptr_t back);
void setAdditionalSelAlpha(sptr_t alpha);
sptr_t additionalSelAlpha() const;
void setAdditionalCaretFore(sptr_t fore);
sptr_t additionalCaretFore() const;
void rotateSelection();
void swapMainAnchorCaret();
void multipleSelectAddNext();
void multipleSelectAddEach();
sptr_t changeLexerState(sptr_t start, sptr_t end);
sptr_t contractedFoldNext(sptr_t lineStart);
void verticalCentreCaret();
void moveSelectedLinesUp();
void moveSelectedLinesDown();
void setIdentifier(sptr_t identifier);
sptr_t identifier() const;
void rGBAImageSetWidth(sptr_t width);
void rGBAImageSetHeight(sptr_t height);
void rGBAImageSetScale(sptr_t scalePercent);
void markerDefineRGBAImage(sptr_t markerNumber, const char * pixels);
void registerRGBAImage(sptr_t type, const char * pixels);
void scrollToStart();
void scrollToEnd();
void setTechnology(sptr_t technology);
sptr_t technology() const;
sptr_t createLoader(sptr_t bytes, sptr_t documentOptions);
void findIndicatorShow(sptr_t start, sptr_t end);
void findIndicatorFlash(sptr_t start, sptr_t end);
void findIndicatorHide();
void vCHomeDisplay();
void vCHomeDisplayExtend();
bool caretLineVisibleAlways() const;
void setCaretLineVisibleAlways(bool alwaysVisible);
void setLineEndTypesAllowed(sptr_t lineEndBitSet);
sptr_t lineEndTypesAllowed() const;
sptr_t lineEndTypesActive() const;
void setRepresentation(const char * encodedCharacter, const char * representation);
QByteArray representation(const char * encodedCharacter) const;
void clearRepresentation(const char * encodedCharacter);
void clearAllRepresentations();
void setRepresentationAppearance(const char * encodedCharacter, sptr_t appearance);
sptr_t representationAppearance(const char * encodedCharacter) const;
void setRepresentationColour(const char * encodedCharacter, sptr_t colour);
sptr_t representationColour(const char * encodedCharacter) const;
void eOLAnnotationSetText(sptr_t line, const char * text);
QByteArray eOLAnnotationText(sptr_t line) const;
void eOLAnnotationSetStyle(sptr_t line, sptr_t style);
sptr_t eOLAnnotationStyle(sptr_t line) const;
void eOLAnnotationClearAll();
void eOLAnnotationSetVisible(sptr_t visible);
sptr_t eOLAnnotationVisible() const;
void eOLAnnotationSetStyleOffset(sptr_t style);
sptr_t eOLAnnotationStyleOffset() const;
bool supportsFeature(sptr_t feature) const;
sptr_t lineCharacterIndex() const;
void allocateLineCharacterIndex(sptr_t lineCharacterIndex);
void releaseLineCharacterIndex(sptr_t lineCharacterIndex);
sptr_t lineFromIndexPosition(sptr_t pos, sptr_t lineCharacterIndex);
sptr_t indexPositionFromLine(sptr_t line, sptr_t lineCharacterIndex);
void startRecord();
void stopRecord();
sptr_t lexer() const;
void colourise(sptr_t start, sptr_t end);
void setProperty(const char * key, const char * value);
void setKeyWords(sptr_t keyWordSet, const char * keyWords);
QByteArray property(const char * key) const;
QByteArray propertyExpanded(const char * key) const;
sptr_t propertyInt(const char * key, sptr_t defaultValue) const;
QByteArray lexerLanguage() const;
sptr_t privateLexerCall(sptr_t operation, sptr_t pointer);
QByteArray propertyNames();
sptr_t propertyType(const char * name);
QByteArray describeProperty(const char * name);
QByteArray describeKeyWordSets();
sptr_t lineEndTypesSupported() const;
sptr_t allocateSubStyles(sptr_t styleBase, sptr_t numberStyles);
sptr_t subStylesStart(sptr_t styleBase) const;
sptr_t subStylesLength(sptr_t styleBase) const;
sptr_t styleFromSubStyle(sptr_t subStyle) const;
sptr_t primaryStyleFromStyle(sptr_t style) const;
void freeSubStyles();
void setIdentifiers(sptr_t style, const char * identifiers);
sptr_t distanceToSecondaryStyles() const;
QByteArray subStyleBases() const;
sptr_t namedStyles() const;
QByteArray nameOfStyle(sptr_t style);
QByteArray tagsOfStyle(sptr_t style);
QByteArray descriptionOfStyle(sptr_t style);
void setILexer(sptr_t ilexer);
sptr_t bidirectional() const;
void setBidirectional(sptr_t bidirectional);
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
};
#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#if !defined(__clang__) && (__GNUC__ >= 8)
#pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
#endif
#endif /* SCINTILLAEDIT_H */

View File

@ -0,0 +1,73 @@
// @file ScintillaEdit.h
// Extended version of ScintillaEditBase with a method for each API
// Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware
#ifndef SCINTILLAEDIT_H
#define SCINTILLAEDIT_H
#include <QPair>
#include "ScintillaEditBase.h"
#include "ScintillaDocument.h"
#ifndef EXPORT_IMPORT_API
#ifdef WIN32
#ifdef MAKING_LIBRARY
#define EXPORT_IMPORT_API __declspec(dllexport)
#else
// Defining dllimport upsets moc
#define EXPORT_IMPORT_API __declspec(dllimport)
//#define EXPORT_IMPORT_API
#endif
#else
#define EXPORT_IMPORT_API
#endif
#endif
class EXPORT_IMPORT_API ScintillaEdit : public ScintillaEditBase {
Q_OBJECT
public:
ScintillaEdit(QWidget *parent = 0);
virtual ~ScintillaEdit();
QByteArray TextReturner(int message, uptr_t wParam) const;
QPair<int, int>find_text(int flags, const char *text, int cpMin, int cpMax);
QByteArray get_text_range(int start, int end);
ScintillaDocument *get_doc();
void set_doc(ScintillaDocument *pdoc_);
// Same as previous two methods but with Qt style names
QPair<int, int>findText(int flags, const char *text, int cpMin, int cpMax) {
return find_text(flags, text, cpMin, cpMax);
}
QByteArray textRange(int start, int end) {
return get_text_range(start, end);
}
// Exposing the FORMATRANGE api with both underscore & qt style names
long format_range(bool draw, QPaintDevice* target, QPaintDevice* measure,
const QRect& print_rect, const QRect& page_rect,
long range_start, long range_end);
long formatRange(bool draw, QPaintDevice* target, QPaintDevice* measure,
const QRect& print_rect, const QRect& page_rect,
long range_start, long range_end) {
return format_range(draw, target, measure, print_rect, page_rect,
range_start, range_end);
}
/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
};
#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#if !defined(__clang__) && (__GNUC__ >= 8)
#pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
#endif
#endif /* SCINTILLAEDIT_H */

View File

@ -0,0 +1,78 @@
#-------------------------------------------------
#
# Project created by QtCreator 2011-05-05T12:41:23
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
equals(QT_MAJOR_VERSION, 6): QT += core5compat
TARGET = ScintillaEdit
TEMPLATE = lib
CONFIG += lib_bundle
CONFIG += c++1z
VERSION = 5.5.0
SOURCES += \
ScintillaEdit.cpp \
ScintillaDocument.cpp \
../ScintillaEditBase/PlatQt.cpp \
../ScintillaEditBase/ScintillaQt.cpp \
../ScintillaEditBase/ScintillaEditBase.cpp \
../../src/XPM.cxx \
../../src/ViewStyle.cxx \
../../src/UndoHistory.cxx \
../../src/UniqueString.cxx \
../../src/UniConversion.cxx \
../../src/Style.cxx \
../../src/Selection.cxx \
../../src/ScintillaBase.cxx \
../../src/RunStyles.cxx \
../../src/RESearch.cxx \
../../src/PositionCache.cxx \
../../src/PerLine.cxx \
../../src/MarginView.cxx \
../../src/LineMarker.cxx \
../../src/KeyMap.cxx \
../../src/Indicator.cxx \
../../src/Geometry.cxx \
../../src/EditView.cxx \
../../src/Editor.cxx \
../../src/EditModel.cxx \
../../src/Document.cxx \
../../src/Decoration.cxx \
../../src/DBCS.cxx \
../../src/ContractionState.cxx \
../../src/CharClassify.cxx \
../../src/CharacterType.cxx \
../../src/CharacterCategoryMap.cxx \
../../src/ChangeHistory.cxx \
../../src/CellBuffer.cxx \
../../src/CaseFolder.cxx \
../../src/CaseConvert.cxx \
../../src/CallTip.cxx \
../../src/AutoComplete.cxx
HEADERS += \
ScintillaEdit.h \
ScintillaDocument.h \
../ScintillaEditBase/ScintillaEditBase.h \
../ScintillaEditBase/ScintillaQt.h
OTHER_FILES +=
INCLUDEPATH += ../ScintillaEditBase ../../include ../../src
DEFINES += SCINTILLA_QT=1 MAKING_LIBRARY=1
CONFIG(release, debug|release) {
DEFINES += NDEBUG=1
}
DESTDIR = ../../bin
DLLDESTDIR = ../../bin
macx {
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Frameworks/
}

View File

@ -0,0 +1,252 @@
#!/usr/bin/env python3
# WidgetGen.py - regenerate the ScintillaEdit.cpp and ScintillaEdit.h files
# Check that API includes all gtkscintilla2 functions
import sys
import os
import getopt
scintillaDirectory = "../.."
scintillaScriptsDirectory = os.path.join(scintillaDirectory, "scripts")
sys.path.append(scintillaScriptsDirectory)
import Face
from FileGenerator import GenerateFile
def underscoreName(s):
# Name conversion fixes to match gtkscintilla2
irregular = ['WS', 'EOL', 'AutoC', 'KeyWords', 'BackSpace', 'UnIndents', 'RE', 'RGBA']
for word in irregular:
replacement = word[0] + word[1:].lower()
s = s.replace(word, replacement)
out = ""
for c in s:
if c.isupper():
if out:
out += "_"
out += c.lower()
else:
out += c
return out
def normalisedName(s, options, role=None):
if options["qtStyle"]:
if role == "get":
s = s.replace("Get", "")
return s[0].lower() + s[1:]
else:
return underscoreName(s)
typeAliases = {
"position": "int",
"line": "int",
"pointer": "int",
"colour": "int",
"colouralpha": "int",
"keymod": "int",
"string": "const char *",
"stringresult": "const char *",
"cells": "const char *",
}
def cppAlias(s):
if s in typeAliases:
return typeAliases[s]
elif Face.IsEnumeration(s):
return "int"
else:
return s
understoodTypes = ["", "void", "int", "bool", "position", "line", "pointer",
"colour", "colouralpha", "keymod", "string", "stringresult", "cells"]
def understoodType(t):
return t in understoodTypes or Face.IsEnumeration(t)
def checkTypes(name, v):
understandAllTypes = True
if not understoodType(v["ReturnType"]):
#~ print("Do not understand", v["ReturnType"], "for", name)
understandAllTypes = False
if not understoodType(v["Param1Type"]):
#~ print("Do not understand", v["Param1Type"], "for", name)
understandAllTypes = False
if not understoodType(v["Param2Type"]):
#~ print("Do not understand", v["Param2Type"], "for", name)
understandAllTypes = False
return understandAllTypes
def arguments(v, stringResult, options):
ret = ""
p1Type = cppAlias(v["Param1Type"])
if p1Type == "int":
p1Type = "sptr_t"
if p1Type:
ret = ret + p1Type + " " + normalisedName(v["Param1Name"], options)
p2Type = cppAlias(v["Param2Type"])
if p2Type == "int":
p2Type = "sptr_t"
if p2Type and not stringResult:
if p1Type:
ret = ret + ", "
ret = ret + p2Type + " " + normalisedName(v["Param2Name"], options)
return ret
def printHFile(f, options):
out = []
for name in f.order:
v = f.features[name]
if v["Category"] != "Deprecated":
feat = v["FeatureType"]
if feat in ["fun", "get", "set"]:
if checkTypes(name, v):
constDeclarator = " const" if feat == "get" else ""
returnType = cppAlias(v["ReturnType"])
if returnType == "int":
returnType = "sptr_t"
stringResult = v["Param2Type"] == "stringresult"
if stringResult:
returnType = "QByteArray"
out.append("\t" + returnType + " " + normalisedName(name, options, feat) + "(" +
arguments(v, stringResult, options)+
")" + constDeclarator + ";")
return out
def methodNames(f, options):
for name in f.order:
v = f.features[name]
if v["Category"] != "Deprecated":
feat = v["FeatureType"]
if feat in ["fun", "get", "set"]:
if checkTypes(name, v):
yield normalisedName(name, options)
def printCPPFile(f, options):
out = []
for name in f.order:
v = f.features[name]
if v["Category"] != "Deprecated":
feat = v["FeatureType"]
if feat in ["fun", "get", "set"]:
if checkTypes(name, v):
constDeclarator = " const" if feat == "get" else ""
featureDefineName = "SCI_" + name.upper()
returnType = cppAlias(v["ReturnType"])
if returnType == "int":
returnType = "sptr_t"
stringResult = v["Param2Type"] == "stringresult"
if stringResult:
returnType = "QByteArray"
returnStatement = ""
if returnType != "void":
returnStatement = "return "
out.append(returnType + " ScintillaEdit::" + normalisedName(name, options, feat) + "(" +
arguments(v, stringResult, options) +
")" + constDeclarator + " {")
returns = ""
if stringResult:
returns += " " + returnStatement + "TextReturner(" + featureDefineName + ", "
if "*" in cppAlias(v["Param1Type"]):
returns += "(sptr_t)"
if v["Param1Name"]:
returns += normalisedName(v["Param1Name"], options)
else:
returns += "0"
returns += ");"
else:
returns += " " + returnStatement + "send(" + featureDefineName + ", "
if "*" in cppAlias(v["Param1Type"]):
returns += "(sptr_t)"
if v["Param1Name"]:
returns += normalisedName(v["Param1Name"], options)
else:
returns += "0"
returns += ", "
if "*" in cppAlias(v["Param2Type"]):
returns += "(sptr_t)"
if v["Param2Name"]:
returns += normalisedName(v["Param2Name"], options)
else:
returns += "0"
returns += ");"
out.append(returns)
out.append("}")
out.append("")
return out
def gtkNames():
# The full path on my machine: should be altered for anyone else
p = "C:/Users/Neil/Downloads/wingide-source-4.0.1-1/wingide-source-4.0.1-1/external/gtkscintilla2/gtkscintilla.c"
with open(p) as f:
for l in f.readlines():
if "gtk_scintilla_" in l:
name = l.split()[1][14:]
if '(' in name:
name = name.split('(')[0]
yield name
def usage():
print("WidgetGen.py [-c|--clean][-h|--help][-u|--underscore-names]")
print("")
print("Generate full APIs for ScintillaEdit class.")
print("")
print("options:")
print("")
print("-c --clean remove all generated code from files")
print("-h --help display this text")
print("-u --underscore-names use method_names consistent with GTK+ standards")
def readInterface(cleanGenerated):
f = Face.Face()
if not cleanGenerated:
f.ReadFromFile("../../include/Scintilla.iface")
return f
def main(argv):
# Using local path for gtkscintilla2 so don't default to checking
checkGTK = False
cleanGenerated = False
qtStyleInterface = True
# The --gtk-check option checks for full coverage of the gtkscintilla2 API but
# depends on a particular directory so is not mentioned in --help.
opts, args = getopt.getopt(argv, "hcgu", ["help", "clean", "gtk-check", "underscore-names"])
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
sys.exit()
elif opt in ("-c", "--clean"):
cleanGenerated = True
elif opt in ("-g", "--gtk-check"):
checkGTK = True
elif opt in ("-u", "--underscore-names"):
qtStyleInterface = False
options = {"qtStyle": qtStyleInterface}
f = readInterface(cleanGenerated)
try:
GenerateFile("ScintillaEdit.cpp.template", "ScintillaEdit.cpp",
"/* ", True, printCPPFile(f, options))
GenerateFile("ScintillaEdit.h.template", "ScintillaEdit.h",
"/* ", True, printHFile(f, options))
if checkGTK:
names = set(methodNames(f))
#~ print("\n".join(names))
namesGtk = set(gtkNames())
for name in namesGtk:
if name not in names:
print(name, "not found in Qt version")
for name in names:
if name not in namesGtk:
print(name, "not found in GTK+ version")
except:
raise
if cleanGenerated:
for file in ["ScintillaEdit.cpp", "ScintillaEdit.h"]:
try:
os.remove(file)
except OSError:
pass
if __name__ == "__main__":
main(sys.argv[1:])