]>
git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/src/CellBuffer.h
3381c19c2c6ad90c3b6726d930d3af5fadeaf4f6
1 // Scintilla source code edit control
3 ** Manages the text of the document.
5 // Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
15 // Interface to per-line data that wants to see each line insertion and deletion
19 virtual void Init()=0;
20 virtual void InsertLine(int)=0;
21 virtual void RemoveLine(int)=0;
25 * The line vector contains information about each of the lines in a cell buffer.
37 void SetPerLine(PerLine
*pl
);
39 void InsertText(int line
, int delta
);
40 void InsertLine(int line
, int position
);
41 void SetLineStart(int line
, int position
);
42 void RemoveLine(int line
);
44 return starts
.Partitions();
46 int LineFromPosition(int pos
) const;
47 int LineStart(int line
) const {
48 return starts
.PositionFromPartition(line
);
51 int MarkValue(int line
);
52 int AddMark(int line
, int marker
);
53 void MergeMarkers(int pos
);
54 void DeleteMark(int line
, int markerNum
, bool all
);
55 void DeleteMarkFromHandle(int markerHandle
);
56 int LineFromHandle(int markerHandle
);
59 int SetLevel(int line
, int level
);
60 int GetLevel(int line
);
62 int SetLineState(int line
, int state
);
63 int GetLineState(int line
);
64 int GetMaxLineState();
68 enum actionType
{ insertAction
, removeAction
, startAction
, containerAction
};
71 * Actions are used to store all the information required to perform one undo/redo step.
83 void Create(actionType at_
, int position_
=0, char *data_
=0, int lenData_
=0, bool mayCoalesce_
=true);
85 void Grab(Action
*source
);
96 int undoSequenceDepth
;
99 void EnsureUndoRoom();
105 void AppendAction(actionType at
, int position
, char *data
, int length
, bool &startSequence
, bool mayCoalesce
=true);
107 void BeginUndoAction();
108 void EndUndoAction();
109 void DropUndoSequence();
110 void DeleteUndoHistory();
112 /// The save point is a marker in the undo stack where the container has stated that
113 /// the buffer was saved. Undo and redo can move over the save point.
115 bool IsSavePoint() const;
117 /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
118 /// called that many times. Similarly for redo.
119 bool CanUndo() const;
121 const Action
&GetUndoStep() const;
122 void CompletedUndoStep();
123 bool CanRedo() const;
125 const Action
&GetRedoStep() const;
126 void CompletedRedoStep();
130 * Holder for an expandable array of characters that supports undo and line markers.
131 * Based on article "Data Structures in a Bit-Mapped Text Editor"
132 * by Wilfred J. Hansen, Byte January 1987, page 183.
136 SplitVector
<char> substance
;
137 SplitVector
<char> style
;
150 /// Retrieving positions outside the range of the buffer works and returns 0
151 char CharAt(int position
) const;
152 void GetCharRange(char *buffer
, int position
, int lengthRetrieve
);
153 char StyleAt(int position
);
154 const char *BufferPointer();
157 void Allocate(int newSize
);
158 void SetPerLine(PerLine
*pl
);
160 int LineStart(int line
) const;
161 int LineFromPosition(int pos
) const { return lv
.LineFromPosition(pos
); }
162 void InsertLine(int line
, int position
);
163 void RemoveLine(int line
);
164 const char *InsertString(int position
, const char *s
, int insertLength
, bool &startSequence
);
166 /// Setting styles for positions outside the range of the buffer is safe and has no effect.
167 /// @return true if the style of a character is changed.
168 bool SetStyleAt(int position
, char styleValue
, char mask
='\377');
169 bool SetStyleFor(int position
, int length
, char styleValue
, char mask
);
171 const char *DeleteChars(int position
, int deleteLength
, bool &startSequence
);
174 void SetReadOnly(bool set
);
176 /// The save point is a marker in the undo stack where the container has stated that
177 /// the buffer was saved. Undo and redo can move over the save point.
181 /// Actions without undo
182 void BasicInsertString(int position
, const char *s
, int insertLength
);
183 void BasicDeleteChars(int position
, int deleteLength
);
185 bool SetUndoCollection(bool collectUndo
);
186 bool IsCollectingUndo();
187 void BeginUndoAction();
188 void EndUndoAction();
189 void AddUndoAction(int token
, bool mayCoalesce
);
190 void DeleteUndoHistory();
192 /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
193 /// called that many times. Similarly for redo.
196 const Action
&GetUndoStep() const;
197 void PerformUndoStep();
200 const Action
&GetRedoStep() const;
201 void PerformRedoStep();