31size_t Chunk::Length() const noexcept {
74 return (tabSize > 0) && (ch ==
'\t');
80 x = (x + tabSize) / tabSize;
81 return tabSize*x + insetX;
90constexpr bool IsArrowCharacter(
char ch)
noexcept {
91 return (ch == 0) || (ch ==
'\001') || (ch ==
'\002');
96 const int width =
static_cast<int>(rc.
Width());
97 const int halfWidth = width / 2 - 3;
98 const int quarterWidth = halfWidth / 2;
99 const int centreX =
static_cast<int>(rc.
left) + width / 2 - 1;
100 const int centreY =
static_cast<int>(rc.
top + rc.
bottom) / 2;
110 surface->
Polygon(pts, Sci::size(pts), colourBG, colourBG);
117 surface->
Polygon(pts, Sci::size(pts), colourBG, colourBG);
126 int ytext,
PRectangle rcClient,
bool asHighlight,
bool draw) {
134 std::vector<size_t> ends(1);
135 for (
size_t i=0; i<len; i++) {
137 if (ends.back() != i)
142 if (ends.back() != len)
144 ends.erase(ends.begin());
147 for (
const size_t endSeg : ends) {
150 if (IsArrowCharacter(s[startSeg])) {
152 const bool upArrow = s[startSeg] ==
'\001';
167 const char *segText = s + startSeg;
168 xEnd = x +
static_cast<int>(Sci::lround(surface->
WidthText(
font, segText, endSeg - startSeg)));
173 segText, endSeg - startSeg,
194 int ytext =
static_cast<int>(rcClient.
top) + ascent + 1;
196 const char *remaining =
val.c_str();
198 size_t lineStart = 0;
200 const char *chunkVal = remaining;
201 const char *chunkEnd = strchr(remaining,
'\n');
203 chunkEnd = chunkVal + strlen(chunkVal);
205 const size_t chunkLength =
static_cast<size_t>(chunkEnd - chunkVal);
206 remaining += chunkLength;
211 const Chunk chunkLine(lineStart, lineStart + chunkLength);
212 Chunk chunkHighlight(
216 chunkHighlight.
start -= lineStart;
217 chunkHighlight.
end -= lineStart;
224 ytext, rcClient,
false, draw);
226 ytext, rcClient,
true, draw);
227 x =
DrawChunk(surfaceWindow, x, chunkVal + chunkHighlight.
end, chunkLength - chunkHighlight.
end,
228 ytext, rcClient,
false, draw);
233 lineStart += chunkLength + 1;
260 surfaceWindow->
LineTo(0, 0);
267 if (rectUp.Contains(pt))
269 if (rectDown.Contains(pt))
274 const char *faceName,
int size,
275 int codePage_,
int characterSet,
276 int technology,
const Window &wParent) {
281 surfaceMeasure->Init(wParent.
GetID());
283 surfaceMeasure->SetDBCSMode(
codePage);
287 const XYPOSITION deviceHeight =
static_cast<XYPOSITION>(surfaceMeasure->DeviceHeightFont(size));
292 const int numLines = 1 +
static_cast<int>(
std::count(
val.begin(),
val.end(),
'\n'));
297 lineHeight =
static_cast<int>(Sci::lround(surfaceMeasure->Height(
font)));
332 useStyleCallTip =
true;
Interface to the call tip control.
A rectangle with integer coordinates.
Defines global type name Position in the Sci internal namespace.
Interface to the edit control.
#define SC_FONT_SIZE_MULTIPLIER
int DrawChunk(Surface *surface, int x, const char *s, size_t len, int ytext, PRectangle rcClient, bool asHighlight, bool draw)
Sci::Position posStartCallTip
bool UseStyleCallTip() const noexcept
Used to determine which STYLE_xxxx to use for call tip information.
void PaintCT(Surface *surfaceWindow)
void SetPosition(bool aboveText) noexcept
Set calltip position.
int NextTabPos(int x) const noexcept
PRectangle CallTipStart(Sci::Position pos, Point pt, int textHeight, const char *defn, const char *faceName, int size, int codePage_, int characterSet, int technology, const Window &wParent)
Setup the calltip and return a rectangle of the area required.
ColourDesired colourLight
bool IsTabCharacter(char ch) const noexcept
ColourDesired colourShade
void SetForeBack(const ColourDesired &fore, const ColourDesired &back) noexcept
void SetTabSize(int tabSz) noexcept
Set the tab size in pixels for the call tip. 0 or -ve means no tab expand.
ColourDesired colourUnSel
void SetHighlight(size_t start, size_t end)
Set a range of characters to be displayed in a highlight style.
int PaintContents(Surface *surfaceWindow, bool draw)
void MouseClick(Point pt) noexcept
virtual void Create(const FontParameters &fp)
A geometric rectangle class.
constexpr XYPOSITION Width() const noexcept
static constexpr Point FromInts(int x_, int y_) noexcept
A surface abstracts a place to draw.
virtual XYPOSITION Descent(Font &font_)=0
static Surface * Allocate(int technology)
virtual void PenColour(ColourDesired fore)=0
virtual void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore)=0
virtual void Polygon(Point *pts, size_t npts, ColourDesired fore, ColourDesired back)=0
virtual void MoveTo(int x_, int y_)=0
virtual XYPOSITION Ascent(Font &font_)=0
virtual void LineTo(int x_, int y_)=0
virtual void FillRectangle(PRectangle rc, ColourDesired back)=0
virtual XYPOSITION WidthText(Font &font_, const char *s, int len)=0
virtual XYPOSITION InternalLeading(Font &font_)=0
Class to hide the details of window manipulation.
bool Created() const noexcept
PRectangle GetClientPosition() const
WindowID GetID() const noexcept
Styling buffer using one element for each run rather than using a filled buffer.
size_t Length() const noexcept