geany  1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

EditView.h
Go to the documentation of this file.
1// Scintilla source code edit control
2/** @file EditView.h
3 ** Defines the appearance of the main text area of the editor window.
4 **/
5// Copyright 1998-2014 by Neil Hodgson <neilh@scintilla.org>
6// The License.txt file describes the conditions under which this software may be distributed.
7
8#ifndef EDITVIEW_H
9#define EDITVIEW_H
10
11namespace Scintilla {
12
17 PrintParameters() noexcept;
18};
19
20/**
21* The view may be drawn in separate phases.
22*/
24 drawBack = 0x1,
26 drawText = 0x4,
32 drawCarets = 0x100,
33 drawAll = 0x1FF
34};
35
36bool ValidStyledText(const ViewStyle &vs, size_t styleOffset, const StyledText &st) noexcept;
37int WidestLineWidth(Surface *surface, const ViewStyle &vs, int styleOffset, const StyledText &st);
38void DrawTextNoClipPhase(Surface *surface, PRectangle rc, const Style &style, XYPOSITION ybase,
39 const char *s, int len, DrawPhase phase);
40void DrawStyledText(Surface *surface, const ViewStyle &vs, int styleOffset, PRectangle rcText,
41 const StyledText &st, size_t start, size_t length, DrawPhase phase);
42
43typedef void (*DrawTabArrowFn)(Surface *surface, PRectangle rcTab, int ymid);
44
45class LineTabstops;
46
47/**
48* EditView draws the main text area.
49*/
50class EditView {
51public:
53 std::unique_ptr<LineTabstops> ldTabstops;
55
57 bool drawOverstrikeCaret; // used by the curses platform
58
59 /** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to
60 * the screen. This avoids flashing but is about 30% slower. */
62 /** In phasesTwo mode, drawing is performed in two phases, first the background
63 * and then the foreground. This avoids chopping off characters that overlap the next run.
64 * In multiPhaseDraw mode, drawing is performed in multiple phases with each phase drawing
65 * one feature over the whole drawing area, instead of within one line. This allows text to
66 * overlap from one line to the next. */
67 enum PhasesDraw { phasesOne, phasesTwo, phasesMultiple };
69
71
74
76
77 std::unique_ptr<Surface> pixmapLine;
78 std::unique_ptr<Surface> pixmapIndentGuide;
79 std::unique_ptr<Surface> pixmapIndentGuideHighlight;
80
83
84 int tabArrowHeight; // draw arrow heads this many pixels above/below line midpoint
85 /** Some platforms, notably PLAT_CURSES, do not support Scintilla's native
86 * DrawTabArrow function for drawing tab characters. Allow those platforms to
87 * override it instead of creating a new method in the Surface class that
88 * existing platforms must implement as empty. */
91
92 EditView();
93 // Deleted so EditView objects can not be copied.
94 EditView(const EditView &) = delete;
95 EditView(EditView &&) = delete;
96 void operator=(const EditView &) = delete;
97 void operator=(EditView &&) = delete;
98 virtual ~EditView();
99
100 bool SetTwoPhaseDraw(bool twoPhaseDraw) noexcept;
101 bool SetPhasesDraw(int phases) noexcept;
102 bool LinesOverlap() const noexcept;
103
104 void ClearAllTabstops() noexcept;
105 XYPOSITION NextTabstopPos(Sci::Line line, XYPOSITION x, XYPOSITION tabWidth) const noexcept;
106 bool ClearTabstops(Sci::Line line) noexcept;
107 bool AddTabstop(Sci::Line line, int x);
108 int GetNextTabstop(Sci::Line line, int x) const noexcept;
109 void LinesAddedOrRemoved(Sci::Line lineOfPos, Sci::Line linesAdded);
110
111 void DropGraphics(bool freeObjects);
112 void AllocateGraphics(const ViewStyle &vsDraw);
113 void RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw);
114
115 LineLayout *RetrieveLineLayout(Sci::Line lineNumber, const EditModel &model);
116 void LayoutLine(const EditModel &model, Sci::Line line, Surface *surface, const ViewStyle &vstyle,
117 LineLayout *ll, int width = LineLayout::wrapWidthInfinite);
118
119 Point LocationFromPosition(Surface *surface, const EditModel &model, SelectionPosition pos, Sci::Line topLine,
120 const ViewStyle &vs, PointEnd pe);
121 Range RangeDisplayLine(Surface *surface, const EditModel &model, Sci::Line lineVisible, const ViewStyle &vs);
122 SelectionPosition SPositionFromLocation(Surface *surface, const EditModel &model, PointDocument pt, bool canReturnInvalid,
123 bool charPosition, bool virtualSpace, const ViewStyle &vs);
124 SelectionPosition SPositionFromLineX(Surface *surface, const EditModel &model, Sci::Line lineDoc, int x, const ViewStyle &vs);
125 Sci::Line DisplayFromPosition(Surface *surface, const EditModel &model, Sci::Position pos, const ViewStyle &vs);
126 Sci::Position StartEndDisplayLine(Surface *surface, const EditModel &model, Sci::Position pos, bool start, const ViewStyle &vs);
127
128 void DrawIndentGuide(Surface *surface, Sci::Line lineVisible, int lineHeight, XYPOSITION start, PRectangle rcSegment, bool highlight);
129 void DrawEOL(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine,
130 Sci::Line line, Sci::Position lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart,
131 ColourOptional background);
132 void DrawFoldDisplayText(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
133 Sci::Line line, int xStart, PRectangle rcLine, int subLine, XYACCUMULATOR subLineStart, DrawPhase phase);
134 void DrawEOLAnnotationText(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
135 Sci::Line line, int xStart, PRectangle rcLine, int subLine, XYACCUMULATOR subLineStart, DrawPhase phase);
136 void DrawAnnotation(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
137 Sci::Line line, int xStart, PRectangle rcLine, int subLine, DrawPhase phase);
138 void DrawCarets(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, Sci::Line lineDoc,
139 int xStart, PRectangle rcLine, int subLine) const;
140 void DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine,
141 Range lineRange, Sci::Position posLineStart, int xStart,
142 int subLine, ColourOptional background) const;
143 void DrawForeground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, Sci::Line lineVisible,
144 PRectangle rcLine, Range lineRange, Sci::Position posLineStart, int xStart,
145 int subLine, ColourOptional background);
146 void DrawIndentGuidesOverEmpty(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
147 Sci::Line line, Sci::Line lineVisible, PRectangle rcLine, int xStart, int subLine);
148 void DrawLine(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, Sci::Line line,
149 Sci::Line lineVisible, int xStart, PRectangle rcLine, int subLine, DrawPhase phase);
150 void PaintText(Surface *surfaceWindow, const EditModel &model, PRectangle rcArea, PRectangle rcClient,
151 const ViewStyle &vsDraw);
152 void FillLineRemainder(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
153 Sci::Line line, PRectangle rcArea, int subLine) const;
154 Sci::Position FormatRange(bool draw, const Sci_RangeToFormat *pfr, Surface *surface, Surface *surfaceMeasure,
155 const EditModel &model, const ViewStyle &vs);
156};
157
158/**
159* Convenience class to ensure LineLayout objects are always disposed.
160*/
164public:
165 AutoLineLayout(LineLayoutCache &llc_, LineLayout *ll_) noexcept : llc(llc_), ll(ll_) {}
170 ~AutoLineLayout() noexcept {
171 llc.Dispose(ll);
172 ll = nullptr;
173 }
174 LineLayout *operator->() const noexcept {
175 return ll;
176 }
177 operator LineLayout *() const noexcept {
178 return ll;
179 }
180 void Set(LineLayout *ll_) noexcept {
181 llc.Dispose(ll);
182 ll = ll_;
183 }
184};
185
186}
187
188#endif
Convenience class to ensure LineLayout objects are always disposed.
Definition: EditView.h:161
AutoLineLayout(LineLayoutCache &llc_, LineLayout *ll_) noexcept
Definition: EditView.h:165
AutoLineLayout(const AutoLineLayout &)=delete
~AutoLineLayout() noexcept
Definition: EditView.h:170
LineLayoutCache & llc
Definition: EditView.h:162
AutoLineLayout(AutoLineLayout &&)=delete
LineLayout * operator->() const noexcept
Definition: EditView.h:174
AutoLineLayout & operator=(const AutoLineLayout &)=delete
AutoLineLayout & operator=(AutoLineLayout &&)=delete
void Set(LineLayout *ll_) noexcept
Definition: EditView.h:180
EditView draws the main text area.
Definition: EditView.h:50
EditView(EditView &&)=delete
EditView(const EditView &)=delete
void operator=(EditView &&)=delete
PhasesDraw phasesDraw
Definition: EditView.h:68
PrintParameters printParameters
Definition: EditView.h:52
LineLayoutCache llc
Definition: EditView.h:81
std::unique_ptr< Surface > pixmapIndentGuide
Definition: EditView.h:78
PhasesDraw
In phasesTwo mode, drawing is performed in two phases, first the background and then the foreground.
Definition: EditView.h:67
bool bufferedDraw
In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to the screen.
Definition: EditView.h:61
void operator=(const EditView &)=delete
PositionCache posCache
Definition: EditView.h:82
bool drawOverstrikeCaret
Definition: EditView.h:57
std::unique_ptr< LineTabstops > ldTabstops
Definition: EditView.h:53
bool imeCaretBlockOverride
Definition: EditView.h:75
std::unique_ptr< Surface > pixmapLine
Definition: EditView.h:77
int tabWidthMinimumPixels
Definition: EditView.h:54
std::unique_ptr< Surface > pixmapIndentGuideHighlight
Definition: EditView.h:79
bool additionalCaretsVisible
Definition: EditView.h:73
bool additionalCaretsBlink
Definition: EditView.h:72
DrawTabArrowFn customDrawTabArrow
Some platforms, notably PLAT_CURSES, do not support Scintilla's native DrawTabArrow function for draw...
Definition: EditView.h:89
DrawWrapMarkerFn customDrawWrapMarker
Definition: EditView.h:90
void Dispose(LineLayout *ll) noexcept
A geometric rectangle class.
Definition: Platform.h:131
A point in document space.
Definition: PositionCache.h:25
A geometric point class.
Definition: Platform.h:99
The range class represents a range of text in a document.
Definition: Document.h:29
A surface abstracts a place to draw.
Definition: Platform.h:340
gint pos
Definition: editor.c:87
unsigned long int lineNumber
Definition: geany_cobol.c:134
vString * line
Definition: geany_cobol.c:133
A Position is a position within a document between two characters or at the beginning or end.
Definition: Position.h:17
ptrdiff_t Position
Definition: Position.h:19
ptrdiff_t Line
Definition: Position.h:20
Styling buffer using one element for each run rather than using a filled buffer.
Definition: Converter.h:9
double XYACCUMULATOR
Definition: Platform.h:82
void DrawTextNoClipPhase(Surface *surface, PRectangle rc, const Style &style, XYPOSITION ybase, const char *s, int len, DrawPhase phase)
Definition: EditView.cxx:119
float XYPOSITION
Definition: Platform.h:81
bool ValidStyledText(const ViewStyle &vs, size_t styleOffset, const StyledText &st) noexcept
Definition: EditView.cxx:69
void DrawStyledText(Surface *surface, const ViewStyle &vs, int styleOffset, PRectangle rcText, const StyledText &st, size_t start, size_t length, DrawPhase phase)
Definition: EditView.cxx:135
void(* DrawWrapMarkerFn)(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour)
Definition: MarginView.h:15
DrawPhase
The view may be drawn in separate phases.
Definition: EditView.h:23
@ drawCarets
Definition: EditView.h:32
@ drawAll
Definition: EditView.h:33
@ drawIndicatorsFore
Definition: EditView.h:28
@ drawLineTranslucent
Definition: EditView.h:30
@ drawBack
Definition: EditView.h:24
@ drawSelectionTranslucent
Definition: EditView.h:29
@ drawText
Definition: EditView.h:26
@ drawIndentationGuides
Definition: EditView.h:27
@ drawFoldLines
Definition: EditView.h:31
@ drawIndicatorsBack
Definition: EditView.h:25
void(* DrawTabArrowFn)(Surface *surface, PRectangle rcTab, int ymid)
Definition: EditView.h:43
void * WindowID
Definition: Platform.h:89
int WidestLineWidth(Surface *surface, const ViewStyle &vs, int styleOffset, const StyledText &st)
Definition: EditView.cxx:99