notepad-plus-plus/scintilla/qt/ScintillaEdit/ScintillaDocument.h

96 lines
2.8 KiB
C
Raw Normal View History

// @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
Updated to Scintilla 5.4.2 & Lexilla 5.3.1 https://www.scintilla.org/scintilla542.zip Release 5.4.2 Released 5 March 2024. Significantly reduce memory used for undo actions, often to a half or quarter of previous versions. Feature #1458. Add APIs for saving and restoring undo history. For GTK, when laying out text, detect runs with both left-to-right and right-to-left ranges and divide into an ASCII prefix and more complex suffix. Lay out the ASCII prefix in the standard manner but, for the suffix, measure the whole width and spread that over the suffix bytes. This produces more usable results where the caret moves over the ASCII prefix correctly and over the suffix reasonably but not accurately. For ScintillaEdit on Qt, fix reference from ScintillaDocument to Document to match change in 5.4.1 using IDocumentEditable for SCI_GETDOCPOINTER and SCI_SETDOCPOINTER. For Direct2D on Win32, use the multi-threaded option to avoid crashes when Scintilla instances created on different threads. There may be more problems with this scenario so it should be avoided. Bug #2420. For Win32, ensure keyboard-initiated context menu appears in multi-screen situations. https://www.scintilla.org/lexilla531.zip Release 5.3.1 Released 5 March 2024. Assembler: After comments, treat \r\n line ends the same as \n. This makes testing easier. Bash: Fix folding when line changed to/from comment and previous line is comment. Issue #224. Batch: Fix handling ':' next to keywords. Issue #222. JavaScript: in cpp lexer, add lexer.cpp.backquoted.strings=2 mode to treat ` back-quoted strings as template literals which allow embedded ${expressions}. Issue #94. Python: fix lexing of rb'' and rf'' strings. Issue #223, Pull request #227. Ruby: fix lexing of methods on numeric literals like '3.times' so the '.' and method name do not appear in numeric style. Issue #225.
2024-03-06 22:05:54 +01:00
// Forward declaration
namespace Scintilla {
class IDocumentEditable;
}
class EXPORT_IMPORT_API ScintillaDocument : public QObject
{
Q_OBJECT
Updated to Scintilla 5.4.2 & Lexilla 5.3.1 https://www.scintilla.org/scintilla542.zip Release 5.4.2 Released 5 March 2024. Significantly reduce memory used for undo actions, often to a half or quarter of previous versions. Feature #1458. Add APIs for saving and restoring undo history. For GTK, when laying out text, detect runs with both left-to-right and right-to-left ranges and divide into an ASCII prefix and more complex suffix. Lay out the ASCII prefix in the standard manner but, for the suffix, measure the whole width and spread that over the suffix bytes. This produces more usable results where the caret moves over the ASCII prefix correctly and over the suffix reasonably but not accurately. For ScintillaEdit on Qt, fix reference from ScintillaDocument to Document to match change in 5.4.1 using IDocumentEditable for SCI_GETDOCPOINTER and SCI_SETDOCPOINTER. For Direct2D on Win32, use the multi-threaded option to avoid crashes when Scintilla instances created on different threads. There may be more problems with this scenario so it should be avoided. Bug #2420. For Win32, ensure keyboard-initiated context menu appears in multi-screen situations. https://www.scintilla.org/lexilla531.zip Release 5.3.1 Released 5 March 2024. Assembler: After comments, treat \r\n line ends the same as \n. This makes testing easier. Bash: Fix folding when line changed to/from comment and previous line is comment. Issue #224. Batch: Fix handling ':' next to keywords. Issue #222. JavaScript: in cpp lexer, add lexer.cpp.backquoted.strings=2 mode to treat ` back-quoted strings as template literals which allow embedded ${expressions}. Issue #94. Python: fix lexing of rb'' and rf'' strings. Issue #223, Pull request #227. Ruby: fix lexing of methods on numeric literals like '3.times' so the '.' and method name do not appear in numeric style. Issue #225.
2024-03-06 22:05:54 +01:00
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();
Updated to Scintilla 5.4.2 & Lexilla 5.3.1 https://www.scintilla.org/scintilla542.zip Release 5.4.2 Released 5 March 2024. Significantly reduce memory used for undo actions, often to a half or quarter of previous versions. Feature #1458. Add APIs for saving and restoring undo history. For GTK, when laying out text, detect runs with both left-to-right and right-to-left ranges and divide into an ASCII prefix and more complex suffix. Lay out the ASCII prefix in the standard manner but, for the suffix, measure the whole width and spread that over the suffix bytes. This produces more usable results where the caret moves over the ASCII prefix correctly and over the suffix reasonably but not accurately. For ScintillaEdit on Qt, fix reference from ScintillaDocument to Document to match change in 5.4.1 using IDocumentEditable for SCI_GETDOCPOINTER and SCI_SETDOCPOINTER. For Direct2D on Win32, use the multi-threaded option to avoid crashes when Scintilla instances created on different threads. There may be more problems with this scenario so it should be avoided. Bug #2420. For Win32, ensure keyboard-initiated context menu appears in multi-screen situations. https://www.scintilla.org/lexilla531.zip Release 5.3.1 Released 5 March 2024. Assembler: After comments, treat \r\n line ends the same as \n. This makes testing easier. Bash: Fix folding when line changed to/from comment and previous line is comment. Issue #224. Batch: Fix handling ':' next to keywords. Issue #222. JavaScript: in cpp lexer, add lexer.cpp.backquoted.strings=2 mode to treat ` back-quoted strings as template literals which allow embedded ${expressions}. Issue #94. Python: fix lexing of rb'' and rf'' strings. Issue #223, Pull request #227. Ruby: fix lexing of methods on numeric literals like '3.times' so the '.' and method name do not appear in numeric style. Issue #225.
2024-03-06 22:05:54 +01:00
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();
2019-05-04 20:14:48 +02:00
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);
2019-05-04 20:14:48 +02:00
int get_character(int pos); // Calls GetCharacterAndWidth(pos, NULL)
signals:
void modify_attempt();
void save_point(bool atSavePoint);
2019-05-04 20:14:48 +02:00
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 */