From 803e7ff02753ff859e44b78ba1368aa4e1c07af9 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 1 Apr 2009 01:54:21 +0000 Subject: Added commands to add extra ascent and descent space. --- doc/ScintillaDoc.html | 19 ++++++++++++++++++- include/Scintilla.h | 4 ++++ include/Scintilla.iface | 12 ++++++++++++ src/Editor.cxx | 16 ++++++++++++++++ src/ViewStyle.cxx | 6 ++++++ src/ViewStyle.h | 2 ++ 6 files changed, 58 insertions(+), 1 deletion(-) diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index c56669ba3..67524b6f8 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -1680,8 +1680,12 @@ struct TextToFind { useWhitespaceForeColour, int colour)
SCI_SETWHITESPACEBACK(bool useWhitespaceBackColour, int colour)
+ SCI_SETEXTRAASCENT(int extraAscent)
+ SCI_GETEXTRAASCENT
+ SCI_SETEXTRADESCENT(int extraDescent)
+ SCI_GETEXTRADESCENT
- +

SCI_SETVIEWWS(int wsMode)
SCI_GETVIEWWS
White space can be made visible which may useful for languages in which white space is @@ -1731,6 +1735,19 @@ struct TextToFind { the lexer's colours with SCI_SETWHITESPACEFORE and SCI_SETWHITESPACEBACK.

+

+ SCI_SETEXTRAASCENT(int extraAscent)
+ SCI_GETEXTRAASCENT
+ SCI_SETEXTRADESCENT(int extraDescent)
+ SCI_GETEXTRADESCENT
+ Text is drawn with the base of each character on a 'baseline'. The height of a line is found from the maximum + that any style extends above the baseline (its 'ascent'), added to the maximum that any style extends below the + baseline (its 'descent'). + Space may be added to the maximum ascent (SCI_SETEXTRAASCENT) and the + maximum descent (SCI_SETEXTRADESCENT) to allow for more space between lines. + This may done to make the text easier to read or to accomodate underlines or highlights. +

+

Cursor

SCI_SETCURSOR(int curType)
diff --git a/include/Scintilla.h b/include/Scintilla.h index fa28c1dbc..3edb6da41 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -673,6 +673,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETKEYSUNICODE 2522 #define SCI_INDICSETALPHA 2523 #define SCI_INDICGETALPHA 2524 +#define SCI_SETEXTRAASCENT 2525 +#define SCI_GETEXTRAASCENT 2526 +#define SCI_SETEXTRADESCENT 2527 +#define SCI_GETEXTRADESCENT 2528 #define SCI_STARTRECORD 3001 #define SCI_STOPRECORD 3002 #define SCI_SETLEXER 4001 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index f13c144a9..166d37d2a 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1816,6 +1816,18 @@ set void IndicSetAlpha=2523(int indicator, int alpha) # Get the alpha fill colour of the given indicator. get int IndicGetAlpha=2524(int indicator,) +# Set extra ascent for each line +set void SetExtraAscent=2525(int extraAscent,) + +# Get extra ascent for each line +get int GetExtraAscent=2526(,) + +# Set extra descent for each line +set void SetExtraDescent=2527(int extraDescent,) + +# Get extra descent for each line +get int GetExtraDescent=2528(,) + # Start notifying the container of all key presses and commands. fun void StartRecord=3001(,) diff --git a/src/Editor.cxx b/src/Editor.cxx index c4c3a8179..0a619d9a6 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -7610,6 +7610,22 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETCHARACTERPOINTER: return reinterpret_cast(pdoc->BufferPointer()); + case SCI_SETEXTRAASCENT: + vs.extraAscent = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETEXTRAASCENT: + return vs.extraAscent; + + case SCI_SETEXTRADESCENT: + vs.extraDescent = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETEXTRADESCENT: + return vs.extraDescent; + default: return DefWndProc(iMessage, wParam, lParam); } diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 811f79a6d..686862a2d 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -139,6 +139,8 @@ ViewStyle::ViewStyle(const ViewStyle &source) { viewEOL = source.viewEOL; showMarkedLines = source.showMarkedLines; extraFontFlag = source.extraFontFlag; + extraAscent = source.extraAscent; + extraDescent = source.extraDescent; } ViewStyle::~ViewStyle() { @@ -233,6 +235,8 @@ void ViewStyle::Init(size_t stylesSize_) { viewEOL = false; showMarkedLines = true; extraFontFlag = false; + extraAscent = 0; + extraDescent = 0; } void ViewStyle::RefreshColourPalette(Palette &pal, bool want) { @@ -284,6 +288,8 @@ void ViewStyle::Refresh(Surface &surface) { someStylesProtected = true; } } + maxAscent += extraAscent; + maxDescent += extraDescent; lineHeight = maxAscent + maxDescent; aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth; diff --git a/src/ViewStyle.h b/src/ViewStyle.h index 2f2d52461..3f8b856b9 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -102,6 +102,8 @@ public: int caretWidth; bool someStylesProtected; bool extraFontFlag; + int extraAscent; + int extraDescent; ViewStyle(); ViewStyle(const ViewStyle &source); -- cgit v1.2.3