diff --git a/PowerEditor/scintilla.original.forUpdating/scintilla.original.forUpdating.7z b/PowerEditor/scintilla.original.forUpdating/scintilla.original.forUpdating.7z
new file mode 100644
index 00000000..1633e719
Binary files /dev/null and b/PowerEditor/scintilla.original.forUpdating/scintilla.original.forUpdating.7z differ
diff --git a/scintilla/boostregex/BoostRegExSearch.cxx b/scintilla/boostregex/BoostRegExSearch.cxx
index f8c8ce93..19a41e7d 100644
--- a/scintilla/boostregex/BoostRegExSearch.cxx
+++ b/scintilla/boostregex/BoostRegExSearch.cxx
@@ -9,6 +9,7 @@
*/
#include
#include
+#include
#include "scintilla.h"
#include "Platform.h"
#include "SplitVector.h"
@@ -18,6 +19,7 @@
#include "CharClassify.h"
#include "Decoration.h"
#include "ILexer.h"
+#include "CaseFolder.h"
#include "Document.h"
#include "UniConversion.h"
#include "UTF8DocumentIterator.h"
@@ -136,10 +138,17 @@ private:
}
}
}
+
virtual void NotifyDeleted(Document* deletedDocument, void* /*userData*/)
{
if (deletedDocument == _document)
+ {
+ // We set the _document here, as we don't want to call the RemoveWatcher on this deleted document.
+ // Calling RemoveWatcher inside NotifyDeleted results in a crash, as NotifyDeleted is called whilst
+ // iterating on the watchers list (since Scintilla 3.x). Before 3.x, it was just a really bad idea.
+ _document = NULL;
set(NULL);
+ }
}
virtual void NotifyModifyAttempt(Document* /*document*/, void* /*userData*/) {}
virtual void NotifySavePoint(Document* /*document*/, void* /*userData*/, bool /*atSavePoint*/) {}
diff --git a/scintilla/boostregex/UTF8DocumentIterator.h b/scintilla/boostregex/UTF8DocumentIterator.h
index 3f36aad2..fee1b6b4 100644
--- a/scintilla/boostregex/UTF8DocumentIterator.h
+++ b/scintilla/boostregex/UTF8DocumentIterator.h
@@ -3,6 +3,7 @@
#include
#include
+#include
#include "Platform.h"
#include "SplitVector.h"
#include "Partitioning.h"
@@ -11,6 +12,7 @@
#include "CharClassify.h"
#include "Decoration.h"
#include
+#include "CaseFolder.h"
#include
class UTF8DocumentIterator : public std::iterator
diff --git a/scintilla/cocoa/InfoBar.h b/scintilla/cocoa/InfoBar.h
index 96248115..1d10e795 100644
--- a/scintilla/cocoa/InfoBar.h
+++ b/scintilla/cocoa/InfoBar.h
@@ -45,7 +45,7 @@
- (void) setCallback: (id ) callback;
- (void) createItems;
-- (void) layout;
+- (void) positionSubViews;
- (void) setDisplay: (IBDisplay) display;
- (void) zoomItemAction: (id) sender;
- (void) setScaleFactor: (float) newScaleFactor adjustPopup: (BOOL) flag;
diff --git a/scintilla/cocoa/InfoBar.mm b/scintilla/cocoa/InfoBar.mm
index dccafa7e..14035795 100644
--- a/scintilla/cocoa/InfoBar.mm
+++ b/scintilla/cocoa/InfoBar.mm
@@ -88,7 +88,7 @@
NSBundle* bundle = [NSBundle bundleForClass: [InfoBar class]];
NSString* path = [bundle pathForResource: @"info_bar_bg" ofType: @"png" inDirectory: nil];
- mBackground = [[[NSImage alloc] initWithContentsOfFile: path] retain];
+ mBackground = [[NSImage alloc] initWithContentsOfFile: path];
if (![mBackground isValid])
NSLog(@"Background image for info bar is invalid.");
@@ -294,12 +294,12 @@ static float BarFontSize = 10.0;
- (void) setFrame: (NSRect) newFrame
{
[super setFrame: newFrame];
- [self layout];
+ [self positionSubViews];
}
//--------------------------------------------------------------------------------------------------
-- (void) layout
+- (void) positionSubViews
{
NSRect currentBounds = {0, 0, 0, [self frame].size.height};
if (mDisplayMask & IBShowZoom)
@@ -345,7 +345,7 @@ static float BarFontSize = 10.0;
if (mDisplayMask != display)
{
mDisplayMask = display;
- [self layout];
+ [self positionSubViews];
[self needsDisplay];
}
}
diff --git a/scintilla/cocoa/PlatCocoa.h b/scintilla/cocoa/PlatCocoa.h
index f84e3ff6..775602ba 100644
--- a/scintilla/cocoa/PlatCocoa.h
+++ b/scintilla/cocoa/PlatCocoa.h
@@ -57,8 +57,8 @@ private:
int bitmapWidth;
int bitmapHeight;
- /** Set the CGContext's fill colour to the specified allocated colour. */
- void FillColour( const ColourAllocated& back );
+ /** Set the CGContext's fill colour to the specified desired colour. */
+ void FillColour( const ColourDesired& back );
// 24-bit RGB+A bitmap data constants
@@ -76,7 +76,7 @@ public:
void Release();
bool Initialised();
- void PenColour(ColourAllocated fore);
+ void PenColour(ColourDesired fore);
/** Returns a CGImageRef that represents the surface. Returns NULL if this is not possible. */
CGImageRef GetImage();
@@ -86,31 +86,31 @@ public:
int DeviceHeightFont(int points);
void MoveTo(int x_, int y_);
void LineTo(int x_, int y_);
- void Polygon(Scintilla::Point *pts, int npts, ColourAllocated fore, ColourAllocated back);
- void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back);
- void FillRectangle(PRectangle rc, ColourAllocated back);
+ void Polygon(Scintilla::Point *pts, int npts, ColourDesired fore, ColourDesired back);
+ void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back);
+ void FillRectangle(PRectangle rc, ColourDesired back);
void FillRectangle(PRectangle rc, Surface &surfacePattern);
- void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back);
- void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
- ColourAllocated outline, int alphaOutline, int flags);
- void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back);
+ void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back);
+ void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill,
+ ColourDesired outline, int alphaOutline, int flags);
+ void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage);
+ void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back);
void Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSource);
- void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore,
- ColourAllocated back);
- void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore,
- ColourAllocated back);
- void DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore);
- void MeasureWidths(Font &font_, const char *s, int len, int *positions);
- int WidthText(Font &font_, const char *s, int len);
- int WidthChar(Font &font_, char ch);
- int Ascent(Font &font_);
- int Descent(Font &font_);
- int InternalLeading(Font &font_);
- int ExternalLeading(Font &font_);
- int Height(Font &font_);
- int AverageCharWidth(Font &font_);
+ void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore,
+ ColourDesired back);
+ void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore,
+ ColourDesired back);
+ void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore);
+ void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions);
+ XYPOSITION WidthText(Font &font_, const char *s, int len);
+ XYPOSITION WidthChar(Font &font_, char ch);
+ XYPOSITION Ascent(Font &font_);
+ XYPOSITION Descent(Font &font_);
+ XYPOSITION InternalLeading(Font &font_);
+ XYPOSITION ExternalLeading(Font &font_);
+ XYPOSITION Height(Font &font_);
+ XYPOSITION AverageCharWidth(Font &font_);
- int SetPalette(Scintilla::Palette *pal, bool inBackGround);
void SetClip(PRectangle rc);
void FlushCachedState();
diff --git a/scintilla/cocoa/PlatCocoa.mm b/scintilla/cocoa/PlatCocoa.mm
index f777a0db..a5e68795 100644
--- a/scintilla/cocoa/PlatCocoa.mm
+++ b/scintilla/cocoa/PlatCocoa.mm
@@ -28,8 +28,6 @@
#import
-#import // Temporary
-
using namespace Scintilla;
extern sptr_t scintilla_send_message(void* sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
@@ -92,48 +90,6 @@ Scintilla::Point Scintilla::Point::FromLong(long lpoint)
);
}
-//----------------- Palette ------------------------------------------------------------------------
-
-// The Palette implementation is only here because we would get linker errors if not.
-// We don't use indexed colors in ScintillaCocoa.
-
-Scintilla::Palette::Palette()
-{
-}
-
-//--------------------------------------------------------------------------------------------------
-
-Scintilla::Palette::~Palette()
-{
-}
-
-//--------------------------------------------------------------------------------------------------
-
-void Scintilla::Palette::Release()
-{
-}
-
-//--------------------------------------------------------------------------------------------------
-
-/**
- * Used to transform a given color, if needed. If the caller tries to find a color that matches the
- * desired color then we simply pass it on, as we support the full color space.
- */
-void Scintilla::Palette::WantFind(ColourPair &cp, bool want)
-{
- if (!want)
- cp.allocated.Set(cp.desired.AsLong());
-
- // Don't do anything if the caller wants the color it has already set.
-}
-
-//--------------------------------------------------------------------------------------------------
-
-void Scintilla::Palette::Allocate(Window& w)
-{
- // Nothing to allocate as we don't use palettes.
-}
-
//----------------- Font ---------------------------------------------------------------------------
Font::Font(): fid(0)
@@ -149,23 +105,24 @@ Font::~Font()
//--------------------------------------------------------------------------------------------------
+static int FontCharacterSet(Font &f) {
+ return reinterpret_cast(f.GetID())->getCharacterSet();
+}
+
/**
- * Creates a Quartz 2D font with the given properties.
- * TODO: rewrite to use NSFont.
+ * Creates a CTFontRef with the given properties.
*/
-void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic,
- int extraFontFlag)
+void Font::Create(const FontParameters &fp)
{
- // TODO: How should I handle the characterSet request?
Release();
QuartzTextStyle* style = new QuartzTextStyle();
fid = style;
// Create the font with attributes
- QuartzFont font(faceName, strlen(faceName), size, bold, italic);
+ QuartzFont font(fp.faceName, strlen(fp.faceName), fp.size, fp.weight, fp.italic);
CTFontRef fontRef = font.getFontID();
- style->setFontRef(fontRef);
+ style->setFontRef(fontRef, fp.characterSet);
}
//--------------------------------------------------------------------------------------------------
@@ -236,7 +193,7 @@ bool SurfaceImpl::Initialised()
//--------------------------------------------------------------------------------------------------
-void SurfaceImpl::Init(WindowID wid)
+void SurfaceImpl::Init(WindowID)
{
// To be able to draw, the surface must get a CGContext handle. We save the graphics port,
// then aquire/release the context on an as-need basis (see above).
@@ -249,7 +206,7 @@ void SurfaceImpl::Init(WindowID wid)
//--------------------------------------------------------------------------------------------------
-void SurfaceImpl::Init(SurfaceID sid, WindowID wid)
+void SurfaceImpl::Init(SurfaceID sid, WindowID)
{
Release();
gc = reinterpret_cast(sid);
@@ -259,7 +216,7 @@ void SurfaceImpl::Init(SurfaceID sid, WindowID wid)
//--------------------------------------------------------------------------------------------------
-void SurfaceImpl::InitPixMap(int width, int height, Surface* surface_, WindowID wid)
+void SurfaceImpl::InitPixMap(int width, int height, Surface* /* surface_ */, WindowID /* wid */)
{
Release();
@@ -277,26 +234,23 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface* surface_, WindowID
// Create the bitmap.
bitmapData = new uint8_t[bitmapByteCount];
- if (bitmapData != NULL)
- {
- // create the context
- gc = CGBitmapContextCreate(bitmapData,
- width,
- height,
- BITS_PER_COMPONENT,
- bitmapBytesPerRow,
- colorSpace,
- kCGImageAlphaPremultipliedLast);
+ // create the context
+ gc = CGBitmapContextCreate(bitmapData,
+ width,
+ height,
+ BITS_PER_COMPONENT,
+ bitmapBytesPerRow,
+ colorSpace,
+ kCGImageAlphaPremultipliedLast);
- if (gc == NULL)
- {
- // the context couldn't be created for some reason,
- // and we have no use for the bitmap without the context
- delete[] bitmapData;
- bitmapData = NULL;
- }
- textLayout->setContext (gc);
+ if (gc == NULL)
+ {
+ // the context couldn't be created for some reason,
+ // and we have no use for the bitmap without the context
+ delete[] bitmapData;
+ bitmapData = NULL;
}
+ textLayout->setContext (gc);
// the context retains the color space, so we can release it
CGColorSpaceRelease(colorSpace);
@@ -312,7 +266,7 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface* surface_, WindowID
//--------------------------------------------------------------------------------------------------
-void SurfaceImpl::PenColour(ColourAllocated fore)
+void SurfaceImpl::PenColour(ColourDesired fore)
{
if (gc)
{
@@ -326,7 +280,7 @@ void SurfaceImpl::PenColour(ColourAllocated fore)
//--------------------------------------------------------------------------------------------------
-void SurfaceImpl::FillColour(const ColourAllocated& back)
+void SurfaceImpl::FillColour(const ColourDesired& back)
{
if (gc)
{
@@ -356,9 +310,13 @@ CGImageRef SurfaceImpl::GetImage()
const int bitmapBytesPerRow = ((int) bitmapWidth * BYTES_PER_PIXEL);
const int bitmapByteCount = (bitmapBytesPerRow * (int) bitmapHeight);
+ // Make a copy of the bitmap data for the image creation and divorce it
+ // From the SurfaceImpl lifetime
+ CFDataRef dataRef = CFDataCreate(kCFAllocatorDefault, bitmapData, bitmapByteCount);
+
// Create a data provider.
- CGDataProviderRef dataProvider = CGDataProviderCreateWithData(NULL, bitmapData, bitmapByteCount,
- NULL);
+ CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData(dataRef);
+
CGImageRef image = NULL;
if (dataProvider != NULL)
{
@@ -384,6 +342,9 @@ CGImageRef SurfaceImpl::GetImage()
CGDataProviderRelease(dataProvider);
dataProvider = NULL;
+ // Done with the data provider.
+ CFRelease(dataRef);
+
return image;
}
@@ -391,27 +352,23 @@ CGImageRef SurfaceImpl::GetImage()
/**
* Returns the vertical logical device resolution of the main monitor.
+ * This is no longer called.
+ * For Cocoa, all screens are treated as 72 DPI, even retina displays.
*/
int SurfaceImpl::LogPixelsY()
{
- if (verticalDeviceResolution == 0)
- {
- NSSize deviceResolution = [[[[NSScreen mainScreen] deviceDescription]
- objectForKey: NSDeviceResolution] sizeValue];
- verticalDeviceResolution = (int) deviceResolution.height;
- }
- return verticalDeviceResolution;
+ return 72;
}
//--------------------------------------------------------------------------------------------------
/**
- * Converts the logical font height (in dpi) into a pixel height for the current main screen.
+ * Converts the logical font height in points into a device height.
+ * For Cocoa, points are always used for the result even on retina displays.
*/
int SurfaceImpl::DeviceHeightFont(int points)
{
- int logPix = LogPixelsY();
- return (points * logPix + logPix / 2) / 72;
+ return points;
}
//--------------------------------------------------------------------------------------------------
@@ -442,11 +399,11 @@ void SurfaceImpl::LineTo(int x_, int y_)
//--------------------------------------------------------------------------------------------------
-void SurfaceImpl::Polygon(Scintilla::Point *pts, int npts, ColourAllocated fore,
- ColourAllocated back)
+void SurfaceImpl::Polygon(Scintilla::Point *pts, int npts, ColourDesired fore,
+ ColourDesired back)
{
// Allocate memory for the array of points.
- CGPoint *points = new CGPoint[npts];
+ std::vector points(npts);
for (int i = 0;i < npts;i++)
{
@@ -462,21 +419,16 @@ void SurfaceImpl::Polygon(Scintilla::Point *pts, int npts, ColourAllocated fore,
PenColour(fore);
// Draw the polygon
- CGContextAddLines(gc, points, npts);
+ CGContextAddLines(gc, points.data(), npts);
- // TODO: Should the path be automatically closed, or is that the caller's responsability?
// Explicitly close the path, so it is closed for stroking AND filling (implicit close = filling only)
CGContextClosePath( gc );
CGContextDrawPath( gc, kCGPathFillStroke );
-
- // Deallocate memory.
- delete points;
- points = NULL;
}
//--------------------------------------------------------------------------------------------------
-void SurfaceImpl::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back)
+void SurfaceImpl::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back)
{
if (gc)
{
@@ -487,7 +439,6 @@ void SurfaceImpl::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAlloc
// Quartz integer -> float point conversion fun (see comment in SurfaceImpl::LineTo)
// We subtract 1 from the Width() and Height() so that all our drawing is within the area defined
// by the PRectangle. Otherwise, we draw one pixel too far to the right and bottom.
- // TODO: Create some version of PRectangleToCGRect to do this conversion for us?
CGContextAddRect( gc, CGRectMake( rc.left + 0.5, rc.top + 0.5, rc.Width() - 1, rc.Height() - 1 ) );
CGContextDrawPath( gc, kCGPathFillStroke );
}
@@ -495,11 +446,14 @@ void SurfaceImpl::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAlloc
//--------------------------------------------------------------------------------------------------
-void SurfaceImpl::FillRectangle(PRectangle rc, ColourAllocated back)
+void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back)
{
if (gc)
{
FillColour(back);
+ // Snap rectangle boundaries to nearest int
+ rc.left = lround(rc.left);
+ rc.right = lround(rc.right);
CGRect rect = PRectangleToCGRect(rc);
CGContextFillRect(gc, rect);
}
@@ -514,6 +468,13 @@ void drawImageRefCallback(CGImageRef pattern, CGContextRef gc)
//--------------------------------------------------------------------------------------------------
+void releaseImageRefCallback(CGImageRef pattern)
+{
+ CGImageRelease(pattern);
+}
+
+//--------------------------------------------------------------------------------------------------
+
void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern)
{
SurfaceImpl& patternSurface = static_cast(surfacePattern);
@@ -522,12 +483,13 @@ void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern)
CGImageRef image = patternSurface.GetImage();
if (image == NULL)
{
- FillRectangle(rc, ColourAllocated(0));
+ FillRectangle(rc, ColourDesired(0));
return;
}
- const CGPatternCallbacks drawImageCallbacks = { 0,
- reinterpret_cast(drawImageRefCallback), NULL };
+ const CGPatternCallbacks drawImageCallbacks = { 0,
+ reinterpret_cast(drawImageRefCallback),
+ reinterpret_cast(releaseImageRefCallback) };
CGPatternRef pattern = CGPatternCreate(image,
CGRectMake(0, 0, patternSurface.bitmapWidth, patternSurface.bitmapHeight),
@@ -559,14 +521,16 @@ void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern)
colorSpace = NULL;
CGPatternRelease( pattern );
pattern = NULL;
- CGImageRelease( image );
- image = NULL;
} /* pattern != NULL */
}
-void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
- // TODO: Look at the Win32 API to determine what this is supposed to do:
+void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back) {
+ // This is only called from the margin marker drawing code for SC_MARK_ROUNDRECT
+ // The Win32 version does
// ::RoundRect(hdc, rc.left + 1, rc.top, rc.right - 1, rc.bottom, 8, 8 );
+ // which is a rectangle with rounded corners each having a radius of 4 pixels.
+ // It would be almost as good just cutting off the corners with lines at
+ // 45 degrees as is done on GTK+.
// Create a rectangle with semicircles at the corners
const int MAX_RADIUS = 4;
@@ -600,12 +564,13 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAl
};
// Align the points in the middle of the pixels
- // TODO: Should I include these +0.5 in the array creation code above?
- for( int i = 0; i < 4*3; ++ i )
+ for( int i = 0; i < 4; ++ i )
{
- CGPoint* c = (CGPoint*) corners;
- c[i].x += 0.5;
- c[i].y += 0.5;
+ for( int j = 0; j < 3; ++ j )
+ {
+ corners[i][j].x += 0.5;
+ corners[i][j].y += 0.5;
+ }
}
PenColour( fore );
@@ -626,12 +591,15 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAl
CGContextDrawPath( gc, kCGPathFillStroke );
}
-void Scintilla::SurfaceImpl::AlphaRectangle(PRectangle rc, int /*cornerSize*/, ColourAllocated fill, int alphaFill,
- ColourAllocated /*outline*/, int /*alphaOutline*/, int /*flags*/)
+void Scintilla::SurfaceImpl::AlphaRectangle(PRectangle rc, int /*cornerSize*/, ColourDesired fill, int alphaFill,
+ ColourDesired /*outline*/, int /*alphaOutline*/, int /*flags*/)
{
if ( gc ) {
ColourDesired colour( fill.AsLong() );
-
+
+ // Snap rectangle boundaries to nearest int
+ rc.left = lround(rc.left);
+ rc.right = lround(rc.right);
// Set the Fill color to match
CGContextSetRGBFillColor( gc, colour.GetRed() / 255.0, colour.GetGreen() / 255.0, colour.GetBlue() / 255.0, alphaFill / 255.0 );
CGRect rect = PRectangleToCGRect( rc );
@@ -639,7 +607,72 @@ void Scintilla::SurfaceImpl::AlphaRectangle(PRectangle rc, int /*cornerSize*/, C
}
}
-void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
+static void ProviderReleaseData(void *, const void *data, size_t) {
+ const unsigned char *pixels = reinterpret_cast(data);
+ delete []pixels;
+}
+
+static CGImageRef ImageCreateFromRGBA(int width, int height, const unsigned char *pixelsImage, bool invert) {
+ CGImageRef image = 0;
+
+ // Create an RGB color space.
+ CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
+ if (colorSpace) {
+ const int bitmapBytesPerRow = ((int) width * 4);
+ const int bitmapByteCount = (bitmapBytesPerRow * (int) height);
+
+ // Create a data provider.
+ CGDataProviderRef dataProvider = 0;
+ if (invert) {
+ unsigned char *pixelsUpsideDown = new unsigned char[bitmapByteCount];
+
+ for (int y=0; y(font_.GetID());
style->setCTStyleColor(color);
+
+ CGColorRelease(color);
- textLayout->setText (reinterpret_cast(s), len, *reinterpret_cast(font_.GetID()));
+ textLayout->setText (reinterpret_cast(s), len, encoding, *reinterpret_cast(font_.GetID()));
textLayout->draw(rc.left, ybase);
}
+static size_t utf8LengthFromLead(unsigned char uch) {
+ if (uch >= (0x80 + 0x40 + 0x20 + 0x10)) {
+ return 4;
+ } else if (uch >= (0x80 + 0x40 + 0x20)) {
+ return 3;
+ } else if (uch >= (0x80)) {
+ return 2;
+ } else {
+ return 1;
+ }
+}
+
//--------------------------------------------------------------------------------------------------
-void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positions)
+void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions)
{
- for (int i = 0; i < len; i++)
- positions [i] = 0;
- textLayout->setText (reinterpret_cast(s), len, *reinterpret_cast(font_.GetID()));
+ CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_));
+ textLayout->setText (reinterpret_cast(s), len, encoding, *reinterpret_cast(font_.GetID()));
CTLineRef mLine = textLayout->getCTLine();
assert(mLine != NULL);
- CGFloat* secondaryOffset= 0;
- int unicodeCharStart = 0;
- for ( int i = 0; i < len+1; i ++ ){
- unsigned char uch = s[i];
- CFIndex charIndex = unicodeCharStart+1;
- CGFloat advance = CTLineGetOffsetForStringIndex(mLine, charIndex, secondaryOffset);
-
- if ( unicodeMode )
- {
- unsigned char mask = 0xc0;
- int lcount = 1;
- // Add one additonal byte for each extra high order one in the byte
- while ( uch >= mask && lcount < 8 )
- {
- positions[i++] = (int)(advance+0.5);
- lcount ++;
- mask = mask >> 1 | 0x80; // add an additional one in the highest order position
+ if (unicodeMode) {
+ // Map the widths given for UTF-16 characters back onto the UTF-8 input string
+ CFIndex fit = textLayout->getStringLength();
+ int ui=0;
+ const unsigned char *us = reinterpret_cast(s);
+ int i=0;
+ while (ui 0)
+ lastPos = positions[i-1];
+ while (isetText (reinterpret_cast(s), len, *reinterpret_cast(font_.GetID()));
+ CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_));
+ textLayout->setText (reinterpret_cast(s), len, encoding, *reinterpret_cast(font_.GetID()));
return textLayout->MeasureStringWidth();
}
return 1;
}
-int SurfaceImpl::WidthChar(Font &font_, char ch) {
+XYPOSITION SurfaceImpl::WidthChar(Font &font_, char ch) {
char str[2] = { ch, '\0' };
if (font_.GetID())
{
- textLayout->setText (reinterpret_cast(str), 1, *reinterpret_cast(font_.GetID()));
+ CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_));
+ textLayout->setText (reinterpret_cast(str), 1, encoding, *reinterpret_cast(font_.GetID()));
return textLayout->MeasureStringWidth();
}
@@ -909,7 +975,7 @@ int SurfaceImpl::WidthChar(Font &font_, char ch) {
const char sizeString[] = "`~!@#$%^&*()-_=+\\|[]{};:\"\'<,>.?/1234567890"
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
-int SurfaceImpl::Ascent(Font &font_) {
+XYPOSITION SurfaceImpl::Ascent(Font &font_) {
if (!font_.GetID())
return 1;
@@ -918,7 +984,7 @@ int SurfaceImpl::Ascent(Font &font_) {
}
-int SurfaceImpl::Descent(Font &font_) {
+XYPOSITION SurfaceImpl::Descent(Font &font_) {
if (!font_.GetID())
return 1;
@@ -927,13 +993,11 @@ int SurfaceImpl::Descent(Font &font_) {
}
-int SurfaceImpl::InternalLeading(Font &) {
- // TODO: How do we get EM_Size?
- // internal leading = ascent - descent - EM_size
+XYPOSITION SurfaceImpl::InternalLeading(Font &) {
return 0;
}
-int SurfaceImpl::ExternalLeading(Font &font_) {
+XYPOSITION SurfaceImpl::ExternalLeading(Font &font_) {
if (!font_.GetID())
return 1;
@@ -942,13 +1006,13 @@ int SurfaceImpl::ExternalLeading(Font &font_) {
}
-int SurfaceImpl::Height(Font &font_) {
+XYPOSITION SurfaceImpl::Height(Font &font_) {
int ht = Ascent(font_) + Descent(font_);
return ht;
}
-int SurfaceImpl::AverageCharWidth(Font &font_) {
+XYPOSITION SurfaceImpl::AverageCharWidth(Font &font_) {
if (!font_.GetID())
return 1;
@@ -959,11 +1023,6 @@ int SurfaceImpl::AverageCharWidth(Font &font_) {
return (int) ((width / (float) sizeStringLength) + 0.5);
}
-int SurfaceImpl::SetPalette(Scintilla::Palette *, bool) {
- // Mac OS X is always true colour (I think) so this doesn't matter
- return 0;
-}
-
void SurfaceImpl::SetClip(PRectangle rc) {
CGContextClipToRect( gc, PRectangleToCGRect( rc ) );
}
@@ -981,7 +1040,7 @@ void SurfaceImpl::SetDBCSMode(int codePage_) {
codePage = codePage_;
}
-Surface *Surface::Allocate()
+Surface *Surface::Allocate(int)
{
return new SurfaceImpl();
}
@@ -1041,8 +1100,7 @@ PRectangle Window::GetPosition()
// NSView
NSView* view = reinterpret_cast(idWin);
win = [view window];
- rect = [view bounds];
- rect = [view convertRectToBase: rect];
+ rect = [view convertRect: [view bounds] toView: nil];
rect.origin = [win convertBaseToScreen:rect.origin];
}
else
@@ -1260,17 +1318,18 @@ static NSImage* ImageFromXPM(XPM* pxpm)
const int width = pxpm->GetWidth();
const int height = pxpm->GetHeight();
PRectangle rcxpm(0, 0, width, height);
- Surface* surfaceXPM = Surface::Allocate();
+ Surface* surfaceXPM = Surface::Allocate(SC_TECHNOLOGY_DEFAULT);
if (surfaceXPM)
{
surfaceXPM->InitPixMap(width, height, NULL, NULL);
SurfaceImpl* surfaceIXPM = static_cast(surfaceXPM);
CGContextClearRect(surfaceIXPM->GetContext(), CGRectMake(0, 0, width, height));
pxpm->Draw(surfaceXPM, rcxpm);
- img = [NSImage alloc];
- [img autorelease];
+ img = [[[NSImage alloc] initWithSize:NSZeroSize] autorelease];
CGImageRef imageRef = surfaceIXPM->GetImage();
- [img initWithCGImage:imageRef size:NSZeroSize];
+ NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage: imageRef];
+ [img addRepresentation: bitmapRep];
+ [bitmapRep release];
CGImageRelease(imageRef);
delete surfaceXPM;
}
@@ -1278,19 +1337,85 @@ static NSImage* ImageFromXPM(XPM* pxpm)
return img;
}
-//----------------- ListBox ------------------------------------------------------------------------
+//----------------- ListBox and related classes ----------------------------------------------------
-ListBox::ListBox()
+namespace {
+
+// unnamed namespace hides IListBox interface
+
+class IListBox {
+public:
+ virtual int Rows() = 0;
+ virtual NSImage* ImageForRow(NSInteger row) = 0;
+ virtual NSString* TextForRow(NSInteger row) = 0;
+ virtual void DoubleClick() = 0;
+};
+
+} // unnamed namespace
+
+//----------------- AutoCompletionDataSource -------------------------------------------------------
+
+@interface AutoCompletionDataSource :
+NSObject
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
+
+#endif
{
+ IListBox* box;
}
-//--------------------------------------------------------------------------------------------------
+@property IListBox* box;
-ListBox::~ListBox()
+@end
+
+@implementation AutoCompletionDataSource
+
+@synthesize box;
+
+- (void) doubleClick: (id) sender
{
+#pragma unused(sender)
+ if (box)
+ {
+ box->DoubleClick();
+ }
}
-//--------------------------------------------------------------------------------------------------
+- (id)tableView: (NSTableView*)aTableView objectValueForTableColumn: (NSTableColumn*)aTableColumn row: (NSInteger)rowIndex
+{
+#pragma unused(aTableView)
+ if (!box)
+ return nil;
+ if ([(NSString*)[aTableColumn identifier] isEqualToString: @"icon"])
+ {
+ return box->ImageForRow(rowIndex);
+ }
+ else {
+ return box->TextForRow(rowIndex);
+ }
+}
+
+- (void)tableView: (NSTableView*)aTableView setObjectValue: anObject forTableColumn: (NSTableColumn*)aTableColumn row: (NSInteger)rowIndex
+{
+#pragma unused(aTableView)
+#pragma unused(anObject)
+#pragma unused(aTableColumn)
+#pragma unused(rowIndex)
+}
+
+- (NSInteger)numberOfRowsInTableView: (NSTableView*)aTableView
+{
+#pragma unused(aTableView)
+ if (!box)
+ return 0;
+ return box->Rows();
+}
+
+@end
+
+//----------------- ListBoxImpl --------------------------------------------------------------------
+
+namespace { // unnamed namespace hides ListBoxImpl and associated classes
struct RowData
{
@@ -1314,17 +1439,17 @@ public:
}
int Length() const
{
- return lines.size();
+ return static_cast(lines.size());
}
void Clear()
{
lines.clear();
}
- void Add(int index, int type, char* str)
+ void Add(int /* index */, int type, char* str)
{
lines.push_back(RowData(type, str));
}
- int GetType(int index) const
+ int GetType(size_t index) const
{
if (index < lines.size())
{
@@ -1335,7 +1460,7 @@ public:
return 0;
}
}
- const char* GetString(int index) const
+ const char* GetString(size_t index) const
{
if (index < lines.size())
{
@@ -1348,25 +1473,12 @@ public:
}
};
-class ListBoxImpl;
-
-@interface AutoCompletionDataSource :
-NSObject
-{
- ListBoxImpl* box;
-}
-
-@end
-
-//----------------- ListBoxImpl --------------------------------------------------------------------
-
// Map from icon type to an NSImage*
-typedef std::map ImageMap;
+typedef std::map ImageMap;
-class ListBoxImpl : public ListBox
+class ListBoxImpl : public ListBox, IListBox
{
private:
- ControlRef lb;
ImageMap images;
int lineHeight;
bool unicodeMode;
@@ -1381,22 +1493,23 @@ private:
NSScrollView* scroller;
NSTableColumn* colIcon;
NSTableColumn* colText;
-
+ AutoCompletionDataSource* ds;
+
LinesData ld;
CallBackAction doubleClickAction;
void* doubleClickActionData;
public:
- ListBoxImpl() : lb(NULL), lineHeight(10), unicodeMode(false),
+ ListBoxImpl() : lineHeight(10), unicodeMode(false),
desiredVisibleRows(5), maxItemWidth(0), aveCharWidth(8), maxIconWidth(0),
doubleClickAction(NULL), doubleClickActionData(NULL)
{
}
- ~ListBoxImpl() {};
+ ~ListBoxImpl() {}
// ListBox methods
void SetFont(Font& font);
- void Create(Window& parent, int ctrlID, Scintilla::Point pt, int lineHeight_, bool unicodeMode_);
+ void Create(Window& parent, int ctrlID, Scintilla::Point pt, int lineHeight_, bool unicodeMode_, int technology_);
void SetAverageCharWidth(int width);
void SetVisibleRows(int rows);
int GetVisibleRows() const;
@@ -1410,6 +1523,7 @@ public:
int Find(const char* prefix);
void GetValue(int n, char* value, int len);
void RegisterImage(int type, const char* xpm_data);
+ void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage);
void ClearRegisteredImages();
void SetDoubleClickAction(CallBackAction action, void* data)
{
@@ -1418,68 +1532,15 @@ public:
}
void SetList(const char* list, char separator, char typesep);
- // For access from AutoCompletionDataSource
+ // For access from AutoCompletionDataSource implement IListBox
int Rows();
- NSImage* ImageForRow(int row);
- NSString* TextForRow(int row);
+ NSImage* ImageForRow(NSInteger row);
+ NSString* TextForRow(NSInteger row);
void DoubleClick();
};
-@implementation AutoCompletionDataSource
-
-- (void)setBox: (ListBoxImpl*)box_
-{
- box = box_;
-}
-
-- (void) doubleClick: (id) sender
-{
- if (box)
- {
- box->DoubleClick();
- }
-}
-
-- (id)tableView: (NSTableView*)aTableView objectValueForTableColumn: (NSTableColumn*)aTableColumn row: (NSInteger)rowIndex
-{
-#pragma unused(aTableView)
- if (!box)
- return nil;
- if ([(NSString*)[aTableColumn identifier] isEqualToString: @"icon"])
- {
- return box->ImageForRow(rowIndex);
- }
- else {
- return box->TextForRow(rowIndex);
- }
-}
-
-- (void)tableView: (NSTableView*)aTableView setObjectValue: anObject forTableColumn: (NSTableColumn*)aTableColumn row: (NSInteger)rowIndex
-{
-#pragma unused(aTableView)
-#pragma unused(anObject)
-#pragma unused(aTableColumn)
-#pragma unused(rowIndex)
-}
-
-- (NSInteger)numberOfRowsInTableView: (NSTableView*)aTableView
-{
-#pragma unused(aTableView)
- if (!box)
- return 0;
- return box->Rows();
-}
-
-@end
-
-ListBox* ListBox::Allocate()
-{
- ListBoxImpl* lb = new ListBoxImpl();
- return lb;
-}
-
void ListBoxImpl::Create(Window& /*parent*/, int /*ctrlID*/, Scintilla::Point pt,
- int lineHeight_, bool unicodeMode_)
+ int lineHeight_, bool unicodeMode_, int)
{
lineHeight = lineHeight_;
unicodeMode = unicodeMode_;
@@ -1496,24 +1557,23 @@ void ListBoxImpl::Create(Window& /*parent*/, int /*ctrlID*/, Scintilla::Point pt
NSRect scRect = NSMakeRect(0, 0, lbRect.size.width, lbRect.size.height);
[scroller initWithFrame: scRect];
[scroller setHasVerticalScroller:YES];
- table = [NSTableView alloc];
- [table initWithFrame: scRect];
+ table = [[NSTableView alloc] initWithFrame: scRect];
[table setHeaderView:nil];
[scroller setDocumentView: table];
colIcon = [[NSTableColumn alloc] initWithIdentifier:@"icon"];
[colIcon setWidth: 20];
[colIcon setEditable:NO];
[colIcon setHidden:YES];
- NSImageCell* imCell = [[NSImageCell alloc] init];
+ NSImageCell* imCell = [[[NSImageCell alloc] init] autorelease];
[colIcon setDataCell:imCell];
[table addTableColumn:colIcon];
colText = [[NSTableColumn alloc] initWithIdentifier:@"name"];
[colText setResizingMask:NSTableColumnAutoresizingMask];
[colText setEditable:NO];
[table addTableColumn:colText];
- AutoCompletionDataSource* ds = [[AutoCompletionDataSource alloc] init];
+ ds = [[AutoCompletionDataSource alloc] init];
[ds setBox:this];
- [table setDataSource: ds];
+ [table setDataSource: ds]; // Weak reference
[scroller setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
[[winLB contentView] addSubview: scroller];
@@ -1524,13 +1584,14 @@ void ListBoxImpl::Create(Window& /*parent*/, int /*ctrlID*/, Scintilla::Point pt
void ListBoxImpl::SetFont(Font& font_)
{
- font.SetID(font_.GetID());
// NSCell setFont takes an NSFont* rather than a CTFontRef but they
// are the same thing toll-free bridged.
QuartzTextStyle* style = reinterpret_cast(font_.GetID());
+ font.Release();
+ font.SetID(new QuartzTextStyle(*style));
NSFont *pfont = (NSFont *)style->getFontRef();
[[colText dataCell] setFont: pfont];
- CGFloat itemHeight = lround([pfont ascender] - [pfont descender]);
+ CGFloat itemHeight = ceil([pfont boundingRectForFont].size.height);
[table setRowHeight:itemHeight];
}
@@ -1600,7 +1661,7 @@ void ListBoxImpl::Append(char* s, int type)
ld.Add(count, type, s);
Scintilla::SurfaceImpl surface;
- unsigned int width = surface.WidthText(font, s, strlen(s));
+ unsigned int width = surface.WidthText(font, s, static_cast(strlen(s)));
if (width > maxItemWidth)
{
maxItemWidth = width;
@@ -1626,37 +1687,32 @@ void ListBoxImpl::Append(char* s, int type)
void ListBoxImpl::SetList(const char* list, char separator, char typesep)
{
Clear();
- int count = strlen(list) + 1;
- char* words = new char[count];
- if (words)
+ size_t count = strlen(list) + 1;
+ std::vector words(list, list+count);
+ char* startword = words.data();
+ char* numword = NULL;
+ int i = 0;
+ for (; words[i]; i++)
{
- memcpy(words, list, count);
- char* startword = words;
- char* numword = NULL;
- int i = 0;
- for (; words[i]; i++)
- {
- if (words[i] == separator)
- {
- words[i] = '\0';
- if (numword)
- *numword = '\0';
- Append(startword, numword?atoi(numword + 1):-1);
- startword = words + i + 1;
- numword = NULL;
- }
- else if (words[i] == typesep)
- {
- numword = words + i;
- }
- }
- if (startword)
+ if (words[i] == separator)
{
+ words[i] = '\0';
if (numword)
*numword = '\0';
Append(startword, numword?atoi(numword + 1):-1);
+ startword = words.data() + i + 1;
+ numword = NULL;
}
- delete []words;
+ else if (words[i] == typesep)
+ {
+ numword = words.data() + i;
+ }
+ }
+ if (startword)
+ {
+ if (numword)
+ *numword = '\0';
+ Append(startword, numword?atoi(numword + 1):-1);
}
[table reloadData];
}
@@ -1674,7 +1730,7 @@ void ListBoxImpl::Select(int n)
int ListBoxImpl::GetSelection()
{
- return [table selectedRow];
+ return static_cast([table selectedRow]);
}
int ListBoxImpl::Find(const char* prefix)
@@ -1706,7 +1762,6 @@ void ListBoxImpl::GetValue(int n, char* value, int len)
void ListBoxImpl::RegisterImage(int type, const char* xpm_data)
{
XPM xpm(xpm_data);
- xpm.CopyDesiredColours();
NSImage* img = ImageFromXPM(&xpm);
[img retain];
ImageMap::iterator it=images.find(type);
@@ -1721,6 +1776,27 @@ void ListBoxImpl::RegisterImage(int type, const char* xpm_data)
}
}
+void ListBoxImpl::RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) {
+ CGImageRef imageRef = ImageCreateFromRGBA(width, height, pixelsImage, false);
+ NSSize sz = {static_cast(width), static_cast(height)};
+ NSImage *img = [[[NSImage alloc] initWithSize: sz] autorelease];
+ NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage: imageRef];
+ [img addRepresentation: bitmapRep];
+ [bitmapRep release];
+ CGImageRelease(imageRef);
+ [img retain];
+ ImageMap::iterator it=images.find(type);
+ if (it == images.end())
+ {
+ images[type] = img;
+ }
+ else
+ {
+ [it->second release];
+ it->second = img;
+ }
+}
+
void ListBoxImpl::ClearRegisteredImages()
{
for (ImageMap::iterator it=images.begin();
@@ -1737,13 +1813,12 @@ int ListBoxImpl::Rows()
return ld.Length();
}
-NSImage* ListBoxImpl::ImageForRow(int row)
+NSImage* ListBoxImpl::ImageForRow(NSInteger row)
{
ImageMap::iterator it = images.find(ld.GetType(row));
if (it != images.end())
{
NSImage* img = it->second;
- [img retain];
return img;
}
else
@@ -1752,7 +1827,7 @@ NSImage* ListBoxImpl::ImageForRow(int row)
}
}
-NSString* ListBoxImpl::TextForRow(int row)
+NSString* ListBoxImpl::TextForRow(NSInteger row)
{
const char* textString = ld.GetString(row);
NSString* sTitle;
@@ -1771,6 +1846,24 @@ void ListBoxImpl::DoubleClick()
}
}
+} // unnamed namespace
+
+//----------------- ListBox ------------------------------------------------------------------------
+
+ListBox::ListBox()
+{
+}
+
+ListBox::~ListBox()
+{
+}
+
+ListBox* ListBox::Allocate()
+{
+ ListBoxImpl* lb = new ListBoxImpl();
+ return lb;
+}
+
//----------------- ScintillaContextMenu -----------------------------------------------------------
@implementation ScintillaContextMenu : NSMenu
@@ -1818,7 +1911,7 @@ void Menu::Destroy()
//--------------------------------------------------------------------------------------------------
-void Menu::Show(Point pt, Window &)
+void Menu::Show(Point, Window &)
{
// Cocoa menus are handled a bit differently. We only create the menu. The framework
// takes care to show it properly.
@@ -1826,11 +1919,12 @@ void Menu::Show(Point pt, Window &)
//----------------- ElapsedTime --------------------------------------------------------------------
-// TODO: Consider if I should be using GetCurrentEventTime instead of gettimeoday
+// ElapsedTime is used for precise performance measurements during development
+// and not for anything a user sees.
+
ElapsedTime::ElapsedTime() {
struct timeval curTime;
- int retVal;
- retVal = gettimeofday( &curTime, NULL );
+ gettimeofday( &curTime, NULL );
bigBit = curTime.tv_sec;
littleBit = curTime.tv_usec;
@@ -1838,8 +1932,7 @@ ElapsedTime::ElapsedTime() {
double ElapsedTime::Duration(bool reset) {
struct timeval curTime;
- int retVal;
- retVal = gettimeofday( &curTime, NULL );
+ gettimeofday( &curTime, NULL );
long endBigBit = curTime.tv_sec;
long endLittleBit = curTime.tv_usec;
double result = 1000000.0 * (endBigBit - bigBit);
@@ -1884,7 +1977,8 @@ const char *Platform::DefaultFont()
*/
int Platform::DefaultFontSize()
{
- return [[NSUserDefaults standardUserDefaults] integerForKey: @"NSFixedPitchFontSize"];
+ return static_cast([[NSUserDefaults standardUserDefaults]
+ integerForKey: @"NSFixedPitchFontSize"]);
}
//--------------------------------------------------------------------------------------------------
@@ -1901,7 +1995,7 @@ unsigned int Platform::DoubleClickTime()
@"com.apple.mouse.doubleClickThreshold"];
if (threshold == 0)
threshold = 0.5;
- return static_cast(threshold / kEventDurationMillisecond);
+ return static_cast(threshold * 1000.0);
}
//--------------------------------------------------------------------------------------------------
@@ -1914,7 +2008,7 @@ bool Platform::MouseButtonBounce()
//--------------------------------------------------------------------------------------------------
/**
- * Helper method for the backend to reach through to the scintiall window.
+ * Helper method for the backend to reach through to the scintilla window.
*/
long Platform::SendScintilla(WindowID w, unsigned int msg, unsigned long wParam, long lParam)
{
@@ -1924,7 +2018,7 @@ long Platform::SendScintilla(WindowID w, unsigned int msg, unsigned long wParam,
//--------------------------------------------------------------------------------------------------
/**
- * Helper method for the backend to reach through to the scintiall window.
+ * Helper method for the backend to reach through to the scintilla window.
*/
long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long wParam, void *lParam)
{
@@ -1942,7 +2036,8 @@ bool Platform::IsDBCSLeadByte(int codePage, char ch)
case 932:
// Shift_jis
return ((uch >= 0x81) && (uch <= 0x9F)) ||
- ((uch >= 0xE0) && (uch <= 0xEF));
+ ((uch >= 0xE0) && (uch <= 0xFC));
+ // Lead bytes F0 to FC may be a Microsoft addition.
case 936:
// GBK
return (uch >= 0x81) && (uch <= 0xFE);
@@ -1964,9 +2059,9 @@ bool Platform::IsDBCSLeadByte(int codePage, char ch)
//--------------------------------------------------------------------------------------------------
-int Platform::DBCSCharLength(int codePage, const char* s)
+int Platform::DBCSCharLength(int /* codePage */, const char* /* s */)
{
- // No support for DBCS.
+ // DBCS no longer uses this.
return 1;
}
@@ -1974,7 +2069,6 @@ int Platform::DBCSCharLength(int codePage, const char* s)
int Platform::DBCSCharMaxLength()
{
- // No support for DBCS.
return 2;
}
@@ -1998,7 +2092,7 @@ int Platform::Maximum(int a, int b) {
void Platform::DebugDisplay(const char *s)
{
- fprintf( stderr, s );
+ fprintf( stderr, "%s", s );
}
//--------------------------------------------------------------------------------------------------
@@ -2067,8 +2161,9 @@ int Platform::Clamp(int val, int minVal, int maxVal)
* @param modulePath The path to the module to load.
* @return A library instance or NULL if the module could not be found or another problem occured.
*/
-DynamicLibrary* DynamicLibrary::Load(const char* modulePath)
+DynamicLibrary* DynamicLibrary::Load(const char* /* modulePath */)
{
+ // Not implemented.
return NULL;
}
diff --git a/scintilla/cocoa/QuartzTextLayout.h b/scintilla/cocoa/QuartzTextLayout.h
index df09cde2..9f2681ec 100644
--- a/scintilla/cocoa/QuartzTextLayout.h
+++ b/scintilla/cocoa/QuartzTextLayout.h
@@ -24,6 +24,7 @@ public:
{
mString = NULL;
mLine = NULL;
+ stringLength = 0;
setContext(context);
}
@@ -41,12 +42,14 @@ public:
}
}
- inline void setText( const UInt8* buffer, size_t byteLength, const QuartzTextStyle& r )
+ inline void setText( const UInt8* buffer, size_t byteLength, CFStringEncoding encoding, const QuartzTextStyle& r )
{
- CFStringRef str = CFStringCreateWithBytes( NULL, buffer, byteLength, kCFStringEncodingUTF8, false );
+ CFStringRef str = CFStringCreateWithBytes( NULL, buffer, byteLength, encoding, false );
if (!str)
return;
+ stringLength = CFStringGetLength(str);
+
CFMutableDictionaryRef stringAttribs = r.getCTStyle();
if (mString != NULL)
@@ -89,6 +92,10 @@ public:
return mLine;
}
+ CFIndex getStringLength() {
+ return stringLength;
+ }
+
inline void setContext (CGContextRef context)
{
gc = context;
@@ -98,6 +105,7 @@ private:
CGContextRef gc;
CFAttributedStringRef mString;
CTLineRef mLine;
+ CFIndex stringLength;
};
#endif
diff --git a/scintilla/cocoa/QuartzTextStyle.h b/scintilla/cocoa/QuartzTextStyle.h
index cd3a9012..976169b9 100644
--- a/scintilla/cocoa/QuartzTextStyle.h
+++ b/scintilla/cocoa/QuartzTextStyle.h
@@ -13,65 +13,96 @@
class QuartzTextStyle
{
public:
- QuartzTextStyle()
- {
- styleDict = CFDictionaryCreateMutable(NULL, 1, NULL, NULL);
- }
+ QuartzTextStyle()
+ {
+ fontRef = NULL;
+ styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
- ~QuartzTextStyle()
- {
+ characterSet = 0;
+ }
+
+ QuartzTextStyle(const QuartzTextStyle &other)
+ {
+ // Does not copy font colour attribute
+ fontRef = static_cast(CFRetain(other.fontRef));
+ styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef);
+ characterSet = other.characterSet;
+ }
+
+ ~QuartzTextStyle()
+ {
if (styleDict != NULL)
{
CFRelease(styleDict);
styleDict = NULL;
}
- }
-
+
+ if (fontRef)
+ {
+ CFRelease(fontRef);
+ fontRef = NULL;
+ }
+ }
+
CFMutableDictionaryRef getCTStyle() const
{
return styleDict;
}
-
- void setCTStyleColor(CGColor* inColor )
+
+ void setCTStyleColor(CGColor *inColor)
{
CFDictionarySetValue(styleDict, kCTForegroundColorAttributeName, inColor);
}
-
+
float getAscent() const
{
return ::CTFontGetAscent(fontRef);
}
-
+
float getDescent() const
{
return ::CTFontGetDescent(fontRef);
}
-
+
float getLeading() const
{
return ::CTFontGetLeading(fontRef);
}
-
- void setFontRef(CTFontRef inRef)
+
+ void setFontRef(CTFontRef inRef, int characterSet_)
{
fontRef = inRef;
-
+ characterSet = characterSet_;
+
if (styleDict != NULL)
CFRelease(styleDict);
- styleDict = CFDictionaryCreateMutable(NULL, 1, NULL, NULL);
-
+ styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+
CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef);
}
-
+
CTFontRef getFontRef()
{
return fontRef;
}
-
+
+ int getCharacterSet()
+ {
+ return characterSet;
+ }
+
private:
CFMutableDictionaryRef styleDict;
CTFontRef fontRef;
+ int characterSet;
};
#endif
diff --git a/scintilla/cocoa/QuartzTextStyleAttribute.h b/scintilla/cocoa/QuartzTextStyleAttribute.h
index c7505818..7f389b41 100644
--- a/scintilla/cocoa/QuartzTextStyleAttribute.h
+++ b/scintilla/cocoa/QuartzTextStyleAttribute.h
@@ -16,12 +16,13 @@ class QuartzFont
{
public:
/** Create a font style from a name. */
- QuartzFont( const char* name, int length, float size, bool bold, bool italic )
+ QuartzFont( const char* name, size_t length, float size, int weight, bool italic )
{
assert( name != NULL && length > 0 && name[length] == '\0' );
CFStringRef fontName = CFStringCreateWithCString(kCFAllocatorDefault, name, kCFStringEncodingMacRoman);
assert(fontName != NULL);
+ bool bold = weight > SC_WEIGHT_NORMAL;
if (bold || italic)
{
@@ -43,13 +44,29 @@ public:
// create a font and then a copy of it with the sym traits
CTFontRef iFont = ::CTFontCreateWithName(fontName, size, NULL);
fontid = ::CTFontCreateCopyWithSymbolicTraits(iFont, size, NULL, desiredTrait, traitMask);
- CFRelease(iFont);
+ if (fontid)
+ {
+ CFRelease(iFont);
+ }
+ else
+ {
+ // Traits failed so use base font
+ fontid = iFont;
+ }
}
else
{
// create the font, no traits
fontid = ::CTFontCreateWithName(fontName, size, NULL);
}
+
+ if (!fontid)
+ {
+ // Failed to create requested font so use font always present
+ fontid = ::CTFontCreateWithName((CFStringRef)@"Monaco", size, NULL);
+ }
+
+ CFRelease(fontName);
}
CTFontRef getFontID()
diff --git a/scintilla/cocoa/ScintillaCocoa.h b/scintilla/cocoa/ScintillaCocoa.h
index fbf4b002..c12c7e8f 100644
--- a/scintilla/cocoa/ScintillaCocoa.h
+++ b/scintilla/cocoa/ScintillaCocoa.h
@@ -20,6 +20,7 @@
#include
#include
+#include
+
OS X Find Indicator
+
+
On OS X search matches are highlighted with an animated gold rounded rectangle.
+ The indicator shows, then briefly grows 25% and shrinks to the original size to draw the user's attention.
+ While this feature is currently only implemented on OS X, it may be implemented on other platforms
+ in the future.
+
+
SCI_FINDINDICATORSHOW(int start, int end)
+ SCI_FINDINDICATORFLASH(int start, int end)
+ These two messages show and animate the find indicator. The indicator remains visible with
+ SCI_FINDINDICATORSHOW and fades out after showing for half a second with
+ SCI_FINDINDICATORFLASH.
+ SCI_FINDINDICATORSHOW behaves similarly to the OS X TextEdit and Safari applications
+ and is best suited to editing documentation where the search target is often a word.
+ SCI_FINDINDICATORFLASH is similar to Xcode and is suited to editing source code
+ where the match will often be located next to operators which would otherwise be hidden under the indicator's
+ padding.
+
+
+
SCI_FINDINDICATORHIDE
+ This message hides the find indicator.
+
The list of words should be in sorted order. If set to ignore case mode with SCI_AUTOCSETIGNORECASE, then
+
With default settings, the list of words should be in sorted order.
+ If set to ignore case mode with SCI_AUTOCSETIGNORECASE, then
strings are matched after being converted to upper case. One result of this is that the list
should be sorted with the punctuation characters '[', '\', ']', '^', '_', and '`' sorted after
- letters.
+ letters.
+ Alternative handling of list order may be specified with SCI_AUTOCSETORDER
+
SCI_AUTOCCANCEL
This message cancels any displayed autocompletion list. When in autocompletion mode, the list
@@ -3961,7 +4210,7 @@ struct Sci_TextToFind {
SCI_AUTOCGETCANCELATSTART
The default behavior is for the list to be cancelled if the caret moves to the location it
was at when the list was displayed. By calling this message with a false argument,
- the list is not cancelled until the caret moves before the first character of the word being
+ the list is not cancelled until the caret moves at least one character before the word being
completed.
SCI_AUTOCSETFILLUPS(<unused>, const char *chars)
@@ -3981,6 +4230,27 @@ struct Sci_TextToFind {
By default, matching of characters to list members is case sensitive. These messages let you
set and get case sensitivity.
+
SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)
+ SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR
+ When autocompletion is set to ignore case (SCI_AUTOCSETIGNORECASE), by default it will
+ nonetheless select the first list member that matches in a case sensitive way to entered characters.
+ This corresponds to a behaviour property of SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE (0).
+ If you want autocompletion to ignore case at all, choose SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE (1).
+
+
SCI_AUTOCSETORDER(int order)
+ SCI_AUTOCGETORDER
+ The default setting SC_ORDER_PRESORTED (0) requires that the list be provided in alphabetical sorted order.
+
+
Sorting the list can be done by Scintilla instead of the application with SC_ORDER_PERFORMSORT (1).
+ This will take additional time.
+
+
Applications that wish to prioritize some values and show the list in order of priority instead
+ of alphabetical order can use SC_ORDER_CUSTOM (2).
+ This requires extra processing in SCI_AUTOCSHOW to create a sorted index.
+
+
Setting the order should be done before calling SCI_AUTOCSHOW.
+
+
SCI_AUTOCSETAUTOHIDE(bool autoHide) SCI_AUTOCGETAUTOHIDE
By default, the list is cancelled if there are no viable matches (the user has typed
@@ -3995,6 +4265,7 @@ struct Sci_TextToFind {
SCI_REGISTERIMAGE(int type, const char *xpmData)
+ SCI_REGISTERRGBAIMAGE(int type, const char *pixels) SCI_CLEARREGISTEREDIMAGES SCI_AUTOCSETTYPESEPARATOR(char separatorCharacter) SCI_AUTOCGETTYPESEPARATOR
@@ -4002,8 +4273,11 @@ struct Sci_TextToFind {
Autocompletion list items may display an image as well as text. Each image is first registered with an integer
type. Then this integer is included in the text of the list separated by a '?' from the text. For example,
"fclose?2 fopen" displays image 2 before the string "fclose" and no image before "fopen".
- The images are in XPM format as is described for
- SCI_MARKERDEFINEPIXMAP
+ The images are in either the XPM format (SCI_REGISTERIMAGE) or
+ RGBA format (SCI_REGISTERRGBAIMAGE).
+ For SCI_REGISTERRGBAIMAGE the width and height must previously been set with
+ the SCI_RGBAIMAGESETWIDTH and
+ SCI_RGBAIMAGESETHEIGHT messages.
The set of registered images can be cleared with SCI_CLEARREGISTEREDIMAGES and the '?' separator changed
with SCI_AUTOCSETTYPESEPARATOR.
SCI_CALLTIPSHOW(int posStart, const char *definition)
@@ -4158,6 +4433,10 @@ struct Sci_TextToFind {
less than 1, Tab characters are not treated specially. Once this call has been used, the
call tip foreground and background colours are also taken from the style.
+
SCI_CALLTIPSETPOSITION(bool above)
+ By default the calltip is displayed below the text, setting above to true
+ (1) will display it above the text.
The SCI_HOME* commands move the caret to the start of the line, while the
- SCI_VCHOME*commands move the caret to the first non-blank character of the line
+ SCI_VCHOME* commands move the caret to the first non-blank character of the line
(ie. just after the indentation) unless it is already there; in this case, it acts as SCI_HOME*.
The SCI_[HOME|LINEEND]DISPLAY* commands are used when in line wrap mode to
@@ -4423,6 +4712,12 @@ struct Sci_TextToFind {
as appropriate for SCI_[[VC]HOME|LINEEND]*.
+
The SCI_SCROLLTO[START|END] commands scroll the document to the start
+ or end without changing the selection. These commands match OS X platform conventions for the behaviour of the
+ home and end keys. Scintilla can be made to match OS X applications
+ by binding the home and end keys to these commands.
+
+
Key bindings
There is a default binding of keys to commands that is defined in the Scintilla source in
@@ -4456,7 +4751,7 @@ struct Sci_TextToFind {
The modifiers are a combination of zero or more of SCMOD_ALT,
SCMOD_CTRL, SCMOD_SHIFT, and SCMOD_META.
- On OS X, the Command key is mapped to SCMOD_CTRL and the Control key to
+ On OS X, the Command key is mapped to SCMOD_CTRL and the Control key to
SCMOD_META.
If you are building a table, you might
want to use SCMOD_NORM, which has the value 0, to mean no modifiers.
@@ -4501,10 +4796,15 @@ struct Sci_TextToFind {
Printing
-
On Windows SCI_FORMATRANGE can be used to draw the text onto a display context
- which can include a printer display context. Printed output shows text styling as on the
+
SCI_FORMATRANGE can be used to draw the text onto a display surface
+ which can include a printer display surface. Printed output shows text styling as on the
screen, but it hides all margins except a line number margin. All special marker effects are
removed and the selection and caret are hidden.
+
+
Different platforms use different display surface ID types to print on. On Windows, these are
+ HDCs., on GTK+ 3.x cairo_t *,
+ and on Cocoa CGContextRef is used.
SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat *pfr)
- This call allows Windows users to render a range of text into a device context. If you use
+ This call renders a range of text into a device context. If you use
this for printing, you will probably want to arrange a page header and footer; Scintilla does
not do this for you. See SciTEWin::Print() in SciTEWinDlg.cxx for an
example. Each use of this message renders a range of text into a rectangular area and returns
@@ -4530,15 +4830,15 @@ struct Sci_TextToFind {
struct Sci_Rectangle { int left; int top; int right; int bottom; };
struct Sci_RangeToFormat {
- Sci_SurfaceID hdc; // The HDC (device context) we print to
- Sci_SurfaceID hdcTarget; // The HDC we use for measuring (may be same as hdc)
+ Sci_SurfaceID hdc; // The Surface ID we print to
+ Sci_SurfaceID hdcTarget; // The Surface ID we use for measuring (may be same as hdc)
Sci_Rectangle rc; // Rectangle in which to print
Sci_Rectangle rcPage; // Physically printable page size
Sci_CharacterRange chrg; // Range of characters to print
};
-
hdc and hdcTarget should both be set to the device context handle
+
On Windows, hdc and hdcTarget should both be set to the device context handle
of the output device (usually a printer). If you print to a metafile these will not be the same
as Windows metafiles (unlike extended metafiles) do not implement the full API for returning
information. In this case, set hdcTarget to the screen DC.
@@ -4549,6 +4849,17 @@ struct Sci_RangeToFormat {
chrg.cpMin and chrg.cpMax define the start position and maximum
position of characters to output. All of each line within this character range is drawn.
+
On Cocoa, the surface IDs for printing (bDraw=1) should be the graphics port of the current context
+ ((CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]) when the view's drawRect method is called.
+ The Surface IDs are not really used for measurement (bDraw=0) but can be set
+ to a bitmap context (created with CGBitmapContextCreate) to avoid runtime warnings.
+
+
On GTK+, the surface IDs to use can be found from the printing context with
+ gtk_print_context_get_cairo_context(context).
+
+ chrg.cpMin and chrg.cpMax define the start position and maximum
+ position of characters to output. All of each line within this character range is drawn.
+
On Windows, the message-passing scheme used to communicate between the container and
@@ -4689,8 +5002,13 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
pass in the direct pointer associated with the target window.
SCI_GETCHARACTERPOINTER
- Move the gap within Scintilla so that the text of the document is stored consecutively
- and ensure there is a NUL character after the text, then return a pointer to the first character.
+ SCI_GETRANGEPOINTER(int position, int rangeLength)
+ SCI_GETGAPPOSITION
+ Grant temporary direct read-only access to the memory used by Scintilla to store
+ the document.
+
SCI_GETCHARACTERPOINTER moves the gap within Scintilla so that the
+ text of the document is stored consecutively
+ and ensure there is a NUL character after the text, then returns a pointer to the first character.
Applications may then pass this to a function that accepts a character pointer such as a regular
expression search or a parser. The pointer should not be written to as that may desynchronize
the internal state of Scintilla.
@@ -4707,6 +5025,15 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
each replacement then the operation will become O(n^2) rather than O(n). Instead, all
matches should be found and remembered, then all the replacements performed.
+
SCI_GETRANGEPOINTER provides direct access to just the
+ range requested. The gap is not moved unless it is within the requested range so this call
+ can be faster than SCI_GETCHARACTERPOINTER.
+ This can be used by application code that is able to act on blocks of text or ranges of lines.
+
+
SCI_GETGAPPOSITION returns the current gap position.
+ This is a hint that applications can use to avoid calling SCI_GETRANGEPOINTER
+ with a range that contains the gap and consequent costs of moving the gap.
+
Multiple views
A Scintilla window and the document that it displays are separate entities. When you create
@@ -4771,6 +5098,59 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
world spinning in its orbit you must balance each call to SCI_CREATEDOCUMENT or
SCI_ADDREFDOCUMENT with a call to SCI_RELEASEDOCUMENT.
+
Background loading and saving
+
+
To ensure a responsive user interface, applications may decide to load and save documents using a separate thread
+ from the user interface.
+
+
Loading in the background
+
+
An application can load all of a file into a buffer it allocates on a background thread and then add the data in that buffer
+ into a Scintilla document on the user interface thread. That technique uses extra memory to store a complete copy of the
+ file and also means that the time that Scintilla takes to perform initial line end discovery blocks the user interface.
+
+
To avoid these issues, a loader object may be created and used to load the file. The loader object supports the ILoader interface.
+
+
SCI_CREATELOADER(int bytes)
+ Create an object that supports the ILoader interface which can be used to load data and then
+ be turned into a Scintilla document object for attachment to a view object.
+ The bytes argument determines the initial memory allocation for the document as it is more efficient
+ to allocate once rather than rely on the buffer growing as data is added.
+ If SCI_CREATELOADER fails then 0 is returned.
+
+
ILoader
+
+
+classILoader{
+public:
+virtualintSCI_METHODRelease()=0;
+// Returns a status code from SC_STATUS_*
+virtualintSCI_METHODAddData(char*data,intlength)=0;
+virtualvoid*SCI_METHODConvertToDocument()=0;
+};
+
+
+
The application should call the AddData method with each block of data read from the file.
+ AddData will return SC_STATUS_OK unless a failure, such as memory exhaustion occurs.
+ If a failure occurs in AddData or in a file reading call then loading can be abandoned and the loader released with
+ the Release call.
+ When the whole file has been read, the ConvertToDocument method should be called to produce a Scintilla
+ document pointer which can be used in the same way as a document pointer returned from
+ SCI_CREATEDOCUMENT.
+ There is no need to call Release after ConvertToDocument.
+
+
Saving in the background
+
+
An application that wants to save in the background should lock the document with SCI_SETREADONLY(1)
+ to prevent modifications and retrieve a pointer to the unified document contents with
+ SCI_GETCHARACTERPOINTER.
+ The buffer of a locked document will not move so the pointer is valid until the application calls SCI_SETREADONLY(0).
+
+
If the user tries to performs a modification while the document is locked then a SCN_MODIFYATTEMPTRO notification is sent to the application.
+ The application may then decide to ignore the modification or to terminate the background saving thread and reenable
+ modification before returning from the notification.
SCI_VISIBLEFROMDOCLINE(int docLine)
- When some lines are folded, then a particular line in the document may be displayed at a
- different position to its document position. If no lines are folded, this message returns
+ When some lines are hidden and/or annotations are displayed, then a particular line in the
+ document may be displayed at a
+ different position to its document position. If no lines are hidden and there are no annotations,
+ this message returns
docLine. Otherwise, this returns the display line (counting the very first visible
line as 0). The display line of an invisible line is the same as the previous visible line. The
- display line number of the first line in the document is 0. If there is folding and
+ display line number of the first line in the document is 0. If lines are hidden and
docLine is outside the range of lines in the document, the return value is -1.
Lines can occupy more than one display line if they wrap.
SCI_DOCLINEFROMVISIBLE(int displayLine)
- When some lines are hidden, then a particular line in the document may be displayed at a
+ When some lines are hidden and/or annotations are displayed, then a particular line in the
+ document may be displayed at a
different position to its document position. This message returns the document line number that
corresponds to a display line (counting the display line of the first line in the document as
0). If displayLine is less than or equal to 0, the result is 0. If
@@ -4830,9 +5220,14 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
SCI_SHOWLINES(int lineStart, int lineEnd) SCI_HIDELINES(int lineStart, int lineEnd) SCI_GETLINEVISIBLE(int line)
+ SCI_GETALLLINESVISIBLE
The first two messages mark a range of lines as visible or invisible and then redraw the
- display. The third message reports on the visible state of a line and returns 1 if it is
- visible and 0 if it is not visible. These messages have no effect on fold levels or fold
+ display.
+ SCI_GETLINEVISIBLE reports on the visible state of a line and returns 1 if it is
+ visible and 0 if it is not visible.
+ SCI_GETALLLINESVISIBLE returns 1 if all lines are visible and 0
+ if some lines are hidden.
+ These messages have no effect on fold levels or fold
flags. The first line can not be hidden.
SCI_SETFOLDLEVEL(int line, int level)
@@ -4954,6 +5349,102 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
until you had finished. See SciTEBase::FoldAll() and
SciTEBase::Expand() for examples of the use of these messages.
+
SCI_FOLDLINE(int line, int action)
+ SCI_FOLDCHILDREN(int line, int action)
+ SCI_FOLDALL(int action)
+ These messages provide a higher-level approach to folding instead of setting expanded flags and showing
+ or hiding individual lines.
+
An individual fold can be contracted/expanded/toggled with SCI_FOLDLINE.
+ To affect all child folds as well call SCI_FOLDCHILDREN.
+
To affect the entire document call SCI_FOLDALL. With SC_FOLDACTION_TOGGLE
+ the first fold header in the document is examined to decide whether to expand or contract.
+
+
+
+
+
Symbol
+
Value
+
Effect
+
+
+
+
+
+
SC_FOLDACTION_CONTRACT
+
0
+
Contract.
+
+
+
+
SC_FOLDACTION_EXPAND
+
1
+
Expand.
+
+
+
+
SC_FOLDACTION_TOGGLE
+
2
+
Toggle between contracted and expanded.
+
+
+
+
+
+
+
SCI_EXPANDCHILDREN(int line, int level)
+ This is used to respond to a change to a line causing its fold level or whether it is a header to change,
+ perhaps when adding or removing a '{'.
+
By the time the container has received the notification that the line has changed,
+ the fold level has already been set, so the container has to use the previous level in this call
+ so that any range hidden underneath this line can be shown.
+
+
+
SCI_SETAUTOMATICFOLD(int automaticFold)
+ SCI_GETAUTOMATICFOLD
+ Instead of implementing all the logic for handling folding in the container, Scintilla can provide behaviour
+ that is adequate for many applications. The automaticFold argument is a bit set defining
+ which of the 3 pieces of folding implementation should be enabled. Most applications should be able to use the
+ SC_AUTOMATICFOLD_SHOW and SC_AUTOMATICFOLD_CHANGE
+ flags unless they wish to implement quite different behavious such as defining their own fold structure.
+ SC_AUTOMATICFOLD_CLICK is more likely to be set off when an application would
+ like to add or change click behaviour such as showing method headers only when Shift+Alt is used in
+ conjunction with a click.
+
+
+
+
+
Symbol
+
Value
+
Effect
+
+
+
+
+
+
SC_AUTOMATICFOLD_SHOW
+
1
+
Automatically show lines as needed.
+ This avoids sending the SCN_NEEDSHOWN notification.
+
+
+
+
SC_AUTOMATICFOLD_CLICK
+
2
+
Handle clicks in fold margin automatically.
+ This avoids sending the SCN_MARGINCLICK notification for folding margins.
+
+
+
+
SC_AUTOMATICFOLD_CHANGE
+
4
+
Show lines as needed when fold structure is changed.
+ The SCN_MODIFIED notification is still sent unless it is disabled by the
+ container.
+
+
+
+
+
SCI_CONTRACTEDFOLDNEXT(int lineStart)
Search efficiently for lines that are contracted fold headers.
This is useful when saving the user's folding when switching documents or saving folding with a file.
@@ -5064,6 +5555,12 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
Subline is indented by at least 1 to make room for the flag.
+
+
Lexers may support several different sublanguages and each sublanguage may want to style some number of
+ sets of identifiers (or similar lexemes such as documentation keywords) uniquely. Preallocating a large number for each
+ purpose would exhaust the number of allowed styles quickly.
+ This is alleviated by substyles which allow the application to determine how many sets of identifiers to allocate for
+ each purpose.
+ Lexers have to explicitly support this feature by implementing the methods in ILexerWithSubStyles.
+
+
SCI_GETSUBSTYLEBASES(<unused>, char *styles)
+ Fill styles with a byte for each style that can be split into substyles.
+
+
SCI_DISTANCETOSECONDARYSTYLES
+ Returns the distance between a primary style and its corresponding secondary style.
+
+
SCI_ALLOCATESUBSTYLES(int styleBase, int numberStyles)
+ Allocate some number of substyles for a particular base style returning the first substyle number allocated.
+ Substyles are allocated contiguously.
+
+
SCI_FREESUBSTYLES
+ Free all allocated substyles.
+
+
SCI_GETSUBSTYLESSTART(int styleBase)
+ SCI_GETSUBSTYLESLENGTH(int styleBase)
+ Return the start and length of the substyles allocated for a base style.
+
+
SCI_SETIDENTIFIERS(int style, const char *identifiers)
+ Similar to SCI_SETKEYWORDS but for substyles.
+
+
Lexer Objects
Lexers are programmed as objects that implement the ILexer interface and that interact
@@ -5613,6 +6151,27 @@ needs to be folded as this allowed fixing up the last line from the previous fol
The new approach allows the lexer to decide whether to backtrack or to handle this
more efficiently.
+
ILexerWithSubStyles
+
+
+To allow lexers to report which line ends they support, and to support substyles,
+Ilexer is extended to ILexerWithSubStyles.
+
@@ -5761,7 +6320,32 @@ exceptions. Exceptions should not be thrown over build boundaries as the
two sides may be built with different compilers or incompatible
exception options.
-
The ILexer and IDocument interfaces may be
+
IDocumentWithLineEnd
+
+
+To allow lexers to determine the end position of a line and thus more easily support Unicode line ends
+IDocument is extended to IDocumentWithLineEnd.
+
GetRelativePosition navigates the document by whole characters,
+returning INVALID_POSITION for movement beyond the start and end of the document.
+
GetCharacterAndWidth provides a standard
+conversion from UTF-8 bytes to a UTF-32 character or from DBCS to a 16 bit value.
+Bytes in invalid UTF-8 are reported individually with values 0xDC80+byteValue, which are
+not valid Unicode code points.
+The pWidth argument can be NULL if the caller does not need to know the number of
+bytes in the character.
+
The ILexer, ILexerWithSubStyles, IDocument, and
+IDocumentWithLineEnd interfaces may be
expanded in the future with extended versions (ILexer2...).
The Version method indicates which interface is
implemented and thus which methods may be called.
@@ -5865,11 +6449,11 @@ struct SCNotification {
SCI_SETIDENTIFIER(int identifier) SCI_GETIDENTIFIER
- These two messages set and get the identifier of the Scintilla instance which is included in notifications as the
- idFrom field.
+ These two messages set and get the identifier of the Scintilla instance which is included in notifications as the
+ idFrom field.
When an application creates multiple Scintilla widgets, this allows the source of each notification to be found.
- On Windows, this value is initialised in the CreateWindow call and stored as the
- GWLP_ID attribute of the window.
+ On Windows, this value is initialised in the CreateWindow call and stored as the
+ GWLP_ID attribute of the window.
The value should be small, preferrably less than 16 bits,
rather than a pointer as some of the functions will only transmit 16 or 32 bits.
Valid for text changes, not for style changes. If we are collecting undo
information this holds a pointer to the text that is handed to the Undo system, otherwise
- it is zero. For user performed SC_MOD_BEFOREDELETE the text field is 0 and
- for user performed SC_MOD_BEFOREINSERT the text field points to an array of cells,
- not bytes and the length is the number of cells.
+ it is zero. For user performed SC_MOD_BEFOREDELETE the text field is 0.
@@ -6595,6 +7177,54 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
The user deleted a character while autocompletion list was active.
There is no other information in SCNotification.
+
Images
+
+
Two formats are supported for images used in margin markers and autocompletion lists, RGBA and XPM.
+
+
RGBA
+
+
The RGBA format allows translucency with an alpha
+ value for each pixel. It is simpler than
+ XPM and more capable.
+
+
The data is a sequence of 4 byte pixel values starting with the pixels for the top line, with the
+ leftmost pixel first, then continuing with the pixels for subsequent lines. There is no gap between
+ lines for alignment reasons.
+
+
Each pixel consists of, in order, a red byte, a green byte, a blue byte and an alpha byte.
+ The colour bytes are not premultiplied by the alpha value. That is, a fully red pixel that is
+ 25% opaque will be [FF, 00, 00, 3F]
+
+
Since the RGBA pixel data does not include any size information the
+ width and height must previously been set with the
+ SCI_RGBAIMAGESETWIDTH and
+ SCI_RGBAIMAGESETHEIGHT messages.
+
+
GUI platforms often include functions for reading image file formats like PNG into memory
+ in the RGBA form or a similar form.
+ If there is no suitable platform support, the LodePNG and picoPNG libraries are small libraries
+ for loading and decoding PNG files available under a BSD-style license.
+
+
RGBA format is supported on Windows, GTK+ and OS X Cocoa.
+
+
XPM
+
+
The XPM format is
+ described here.
+ Scintilla is only able to handle XPM pixmaps that use one character per pixel with no named colours.
+ There may be a completely transparent colour named "None".
+
There are two forms of data structure used for XPM images, the first "lines form" format is well suited
+ to embedding an image inside C source code and the "text form" is suited to reading from a file.
+ In the lines form, an array of strings is used with the first string indicating the dimensions and number of colours
+ used. This is followed by a string for each colour and that section is followed by the image with one string per line.
+ The text form contains the same data as one null terminated block formatted as C source code starting
+ with a "/* XPM */" comment to mark the format.
+
Either format may be used with Scintilla APIs with the bytes at the location pointed to examined
+ to determine which format: if the bytes start with "/* XPM */" then it is treated as text form,
+ otherwise it is treated as lines form.
+
+
XPM format is supported on on all platforms.
+
GTK+
On GTK+, the following functions create a Scintilla widget, communicate with it and allow
resources to be released after all Scintilla widgets have been destroyed.
@@ -6619,6 +7249,17 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
void scintilla_release_resources()
Call this to free any remaining resources after all the Scintilla widgets have been destroyed.
+
Provisional messages
+
+
Complex new features may be added as 'provisional' to allow further changes to the API.
+ Provisional features may even be removed if experience shows they are a mistake.
+
+
Provisional features are displayed in this document with a distinctive background colour.
+
+
Some developers may want to only use features that are stable and have graduated from
+ provisional status. To avoid using provisional messages compile with the symbol
+ SCI_DISABLE_PROVISIONAL defined.
+
Deprecated messages and notifications
The following messages are currently supported to emulate existing Windows controls, but
@@ -6672,15 +7313,14 @@ EM_FORMATRANGE
INCLUDE_DEPRECATED_FEATURES in Scintilla.h. To ensure future
compatibility you should change them as indicated.
-
SCN_POSCHANGED() Deprecated
- Fired when the user moves the cursor to a different position in the text. Use SCN_UPDATEUI instead.
+
SC_CP_DBCS Deprecated
+ This was used to set a DBCS (Double Byte Character Set) mode on GTK+.
+ An explicit DBCS code page should be used when calling SCI_SETCODEPAGE
-
SCN_CHECKBRACE Deprecated
- Either the text or styling of the document has changed or the selection range has changed.
- This is replaced by SCN_UPDATEUI. You
- can also use SCN_MODIFIED for more
- detailed information on text and styling changes,
+
SCI_SETUSEPALETTE(bool allowPaletteUse) Deprecated
+ SCI_GETUSEPALETTE Deprecated
+ Scintilla no longer supports palette mode. The last version to support palettes was 2.29.
+ Any calls to these methods should be removed.
Edit messages never supported by Scintilla
@@ -6720,11 +7360,10 @@ EM_SETTARGETDEVICE
Building Scintilla
To build Scintilla or SciTE, see the README file present in both the Scintilla and SciTE
- directories. For Windows, GCC 3.2, Borland C++ or Microsoft Visual Studio .NET can be used
- for building. There is a make file for building Scintilla but not SciTE with Visual C++ 6 at
- scintilla/win32/scintilla_vc6.mak. For GTK+, GCC 3.1 should be used. GTK+ 1.2x and 2.0x are
+ directories. For Windows, GCC 4.7 or Microsoft Visual C++ 2010 can be used
+ for building. For GTK+, GCC 4.1 or newer should be used. GTK+ 2.8+ and 3.x are
supported. The version of GTK+ installed should be detected automatically.
- When both GTK+ 1 and GTK+ 2 are present, building for GTK+ 1.x requires defining GTK1
+ When both GTK+ 2 and GTK+ 3 are present, building for GTK+ 3.x requires defining GTK3
on the command line.
+ Handling of UTF-8 and DBCS text in lexers improved with methods ForwardBytes and
+ GetRelativeCharacter added to StyleContext.
+ Bug #1483.
+
+
+ For Unicode text, case-insensitive searching and making text upper or lower case is now
+ compliant with Unicode standards on all platforms and is much faster for non-ASCII characters.
+
+
+ A CategoriseCharacter function was added to return the Unicode general category of a character
+ which can be useful in lexers.
+
+
+ On Cocoa, the LCD Optimized font quality level turns font smoothing on.
+
+
+ SciTE 'immediate' subsystem added to allow scripts that work while tools are executed.
+
+
+ Font quality exposed in SciTE as font.quality setting.
+
+
+ On Cocoa, message:... methods simplify direct access to Scintilla and avoid call layers..
+
+
+ A68K lexer updated.
+
+
+ CoffeeScript lexer fixes a bug with comment blocks.
+ Feature #1495.
+
+ errorlist lexer only recognises Perl diagnostics when there is a filename between
+ "at" and "line". Had been triggering for MSVC errors containing "at line".
+
+
+ Haskell lexer fixed to avoid unnecessary full redraws.
+ Don't highlight CPP inside comments when styling.within.preprocessor is on.
+ Bug #1459.
+
+
+ Lua lexer fixes bug in labels with UTF-8 text.
+ Bug #1483.
+
+
+ Perl lexer fixes bug in string interpolation with UTF-8 text.
+ Bug #1483.
+
+
+ Fixed bugs with case conversion when the result was longer or shorter than the original text.
+ Could access past end of string potentially crashing.
+ Selection now updated to result length.
+
+
+ Fixed bug where data being inserted and removed was not being reported in
+ notification messages. Bug was introduced in 3.3.2.
+
+
+ Word wrap bug fixed where the last line could be shown twice.
+
+
+ Word wrap bug fixed for lines wrapping too short on Windows and GTK+.
+
+ On Cocoa, fixed insertText: method which was broken when implementing a newer protocol.
+
+
+ On Cocoa, fixed a crash when performing string folding for bytes that do not represent a character
+ in the current encoding.
+
+
+ On Qt, fixed layout problem when QApplication construction delayed.
+
+
+ On Qt, find_text reports failure with -1 as first element of return value.
+
+
+ Fixed SciTE on GTK+ bug where a tool command could be performed using the keyboard while one was
+ already running leading to confusion and crashes.
+ Bug #1486.
+
+
+ Fixed SciTE bug in Copy as RTF which was limited to first 32 styles.
+ Bug #1011.
+
+
+ Fixed SciTE on Windows user strip height when the system text scaling factor is 125% or 150%.
+
+
+ Compile time checks for Digital Mars C++ removed.
+
+ Basic implementations of common folding methods added to Scintilla to make it
+ easier for containers to implement folding.
+
+
+ Add indicator INDIC_COMPOSITIONTHICK, a thick low underline, to mimic an
+ appearance used for Asian language input composition.
+
+
+ On Cocoa, implement font quality setting.
+ Feature #988.
+
+
+ On Cocoa, implement automatic enabling of commands and added clear command.
+ Feature #987.
+
+
+ C++ lexer adds style for preprocessor doc comment.
+ Feature #990.
+
+
+ Haskell lexer and folder improved. Separate mode for literate Haskell "literatehaskell" SCLEX_LITERATEHASKELL.
+ Bug #1459 .
+
+
+ LaTeX lexer bug fixed for Unicode character following '\'.
+ Bug #1468 .
+
+
+ PowerShell lexer recognises here strings and doccomment keywords.
+ #region folding added.
+ Feature #985.
+
+
+ Fix multi-typing when two carets are located in virtual space on one line so that spaces
+ are preserved.
+
+
+ Fixes to input composition on Cocoa and implementation of accented character input through
+ press and hold. Set selection correctly so that changes to pieces of composition text are easier to perform.
+ Restore undo collection after a sequence of composition actions.
+ Composition popups appear near input.
+
+
+ Fix lexer problem where no line end was seen at end of document.
+
+
+ Fix crash on Cocoa when view deallocated.
+ Bug #1466.
+
+
+ Fix Qt window positioning to not assume the top right of a monitor is at 0, 0.
+
+
+ Fix Qt to not track mouse when widget is hidden.
+
+ Fix drawing on Windows with Direct2D when returning from lock screen.
+ The render target had to be recreated and an area would be black since the drawing was not retried.
+
+
+ Fix display of DBCS documents on Windows Direct2D/DirectWrite with default character set.
+
+
+ For SciTE on Windows, fixed most-recently-used menu when files opened through check.if.already.opened.
+
+
+ In SciTE, do not call OnSave twice when files saved asynchronously.
+
+
+ Scintilla no longer builds with Visual C++ 6.0.
+
+ Autocompletion lists can now appear in priority order or be sorted by Scintilla.
+ Feature #981.
+
+
+ Most lexers now lex an extra NUL byte at the end of the
+ document which makes it more likely they will classify keywords at document end correctly.
+ Bug #574,
+ Bug #588.
+
+
+ Haskell lexer improved in several ways.
+ Bug #1459.
+
+ Ruby lexer crash fixed with keyword at start of document.
+
+
+ The PLAT_NCURSES platform now called PLAT_CURSES as may work on other implementations.
+
+
+ Bug on Cocoa fixed where input composition with multiple selection or virtual space selection
+ could make undo stop working.
+
+
+ Direct2D/DirectWrite mode on Windows now displays documents in non-Latin1 8-bit encodings correctly.
+
+
+ Character positioning corrected in Direct2D/DirectWrite mode on Windows to avoid text moving and cutting off
+ lower parts of characters.
+
+
+ Position of calltip and autocompletion lists fixed on Cocoa.
+
+
+ While regular expression search in DBCS text is still not working, matching partial characters is now avoided
+ by moving end of match to end of character.
+
+ Overlay scrollers and kinetic scrolling implemented on Cocoa.
+
+
+ To improve display smoothness, styling and UI Update notifications will, when possible, be performed in
+ a high-priority idle task on Cocoa instead of during painting.
+ Performing these jobs inside painting can cause paints to be abandoned and a new paint scheduled.
+ On GTK+, the high-priority idle task is used in more cases.
+
+
+ SCI_SCROLLRANGE added to scroll the view to display a range of text.
+ If the whole range can not be displayed, priority is given to one end.
+
+
+ C++ lexer no longer recognises raw (R"") strings when the first character after "
+ is invalid.
+ Bug #1454.
+
+
+ HTML lexer recognises JavaScript RegEx literals in more contexts.
+ Bug #1412.
+
+
+ Fixed automatic display of folded text when return pressed at end of fold header and
+ first folded line was blank.
+ Bug #1455.
+
+
+ SCI_VISIBLEFROMDOCLINE fixed to never return a line beyond the document end.
+
+
+ SCI_LINESCROLL fixed for a negative column offset.
+ Bug #1450.
+
+
+ On GTK+, fix tab markers so visible if indent markers are visible.
+ Bug #1453.
+
+ To allow cooperation between different uses of extended (beyond 255) styles they should be allocated
+ using SCI_ALLOCATEEXTENDEDSTYLES.
+
+
+ For Unicode documents, lexers that use StyleContext will retrieve whole characters
+ instead of bytes.
+ LexAccessor provides a LineEnd method which can be a more efficient way to
+ handle line ends and can enable Unicode line ends.
+
+
+ The C++ lexer understands the #undef directive when determining preprocessor definitions.
+ Feature #978.
+
+
+ The errorlist lexer recognises gcc include path diagnostics that appear before an error.
+
+ Fixed bug where vertical scrollbar thumb appeared at beginning of document when
+ scrollbar shown.
+ Bug #1446.
+
+
+ Fixed brace-highlighting bug on OS X 10.8 where matching brace is on a different line.
+
+
+ Provisional features
+ are new features that may change or be removed if they cause problems but should become
+ permanent if they work well.
+ For this release Unicode line ends and
+ substyles
+ are provisional features.
+
+ Retina display support for Cocoa. Text size fixed.
+ Scale factor for images implemented so they can be displayed in high definition.
+
+
+ Implement INDIC_SQUIGGLEPIXMAP as a faster version of INDIC_SQUIGGLE.
+ Avoid poor drawing at right of INDIC_SQUIGGLE.
+ Align INDIC_DOTBOX to pixel grid for full intensity.
+
+ HTML folder fixes folding of CDATA when fold.html.preprocessor=0.
+ Bug #3540491.
+
+
+ On Cocoa, fix autocompletion font lifetime issue and row height computation.
+
+
+ In 'choose single' mode, autocompletion will close an existing list if asked to display a single entry list.
+
+
+ Fixed SCI_MARKERDELETE to only delete one marker per call.
+ Bug #3535806.
+
+
+ Properly position caret after undoing coalesced delete operations.
+ Bug #3523326.
+
+
+ Ensure margin is redrawn when SCI_MARGINSETSTYLE called.
+
+
+ Fix clicks in first pixel of margins to send SCN_MARGINCLICK.
+
+
+ Fix infinite loop when drawing block caret for a zero width space character at document start.
+
+
+ Crash fixed for deleting negative range.
+
+
+ For characters that overlap the beginning of their space such as italics descenders and bold serifs, allow start
+ of text to draw 1 pixel into margin.
+ Bug #699587.
+ Bug #3537799.
+
+
+ Fixed problems compiling Scintilla for Qt with GCC 4.7.1 x64.
+
+
+ Fixed problem with determining GTK+ sub-platform caused when adding Qt support in 3.2.0.
+
+
+ Fix incorrect measurement of untitled file in SciTE on Linux leading to message "File ...' is 2147483647 bytes long".
+ Bug #3537764.
+
+
+ In SciTE, fix open of selected filename with line number to go to that line.
+
+
+ Fix problem with last visible buffer closing in SciTE causing invisible buffers to be active.
+
+
+ Avoid blinking of SciTE's current word highlight when output pane changes.
+
+
+ SciTE properties files can be longer than 60K.
+
+ Platform layer added for the Qt open-source cross-platform application and user interface framework
+ for development in C++ or in Python with the PySide bindings for Qt.
+
+
+ Direct access provided to the document bytes for ranges within Scintilla.
+ This is similar to the existing SCI_GETCHARACTERPOINTER API but allows for better performance.
+
+
+ Ctrl+Double Click and Ctrl+Triple Click add the word or line to the set of selections.
+ Feature #3520037.
+
+
+ A SCI_DELETERANGE API was added for deleting a range of text.
+
+
+ Line wrap markers may now be drawn in the line number margin.
+ Feature #3518198.
+
+
+ SciTE on OS X adds option to hide hidden files in the open dialog box.
+
+ On Windows, Scintilla is more responsive in wrap mode.
+ Bug #3487397.
+
+
+ Unimportant "Gdk-CRITICAL" messages are no longer displayed.
+ Bug #3488481.
+
+
+ SciTE on Windows Find in Files sets focus to dialog when already created; allows opening dialog when a job is running.
+ Bug #3480635.
+ Bug #3486657.
+
+
+ Fixed problems with multiple clicks in margin and with mouse actions combined with virtual space.
+ Bug #3484370.
+
+
+ Fixed bug with using page up and down and not returning to original line.
+ Bug #3485669.
+
+
+ Down arrow with wrapped text no longer skips lines.
+ Bug #1776560.
+
+
+ Fix problem with dwell ending immediately due to word wrap.
+ Bug #3484416.
+
+
+ Wrapped lines are rewrapped more consistently while resizing window.
+ Bug #3484179.
+
+
+ Selected line ends are highlighted more consistently.
+ Bug #3484330.
+
+
+ Fix grey background on files that use shbang to choose language.
+ Bug #3482777.
+
+
+ Fix failure messages from empty commands in SciTE.
+ Bug #3480645.
+
+ CPP lexer fixes problems in the preprocessor structure caused by continuation lines.
+ Bug #3458508.
+
+
+ Errorlist lexer handles column numbers for GCC format diagnostics.
+ In SciTE, Next Message goes to column where this can be decoded from GCC format diagnostics.
+ Feature #3453075.
+
+
+ HTML folder fixes spurious folds on some tags.
+ Bug #3459262.
+
+
+ Ruby lexer fixes bug where '=' at start of file caused whole file to appear as a comment.
+ Bug #3452488.
+
+
+ SQL folder folds blocks of single line comments.
+ Feature #3467425.
+
+
+ On Windows using Direct2D, defer invalidation of render target until completion of painting to avoid failures.
+
+
+ Further support of fractional positioning. Spaces, tabs, and single character tokens can take fractional space
+ and wrapped lines are positioned taking fractional positions into account.
+ Bug #3471998.
+
+
+ On Windows using Direct2D, fix extra carets appearing.
+ Bug #3471998.
+
+
+ For autocompletion lists Page Up and Down move by the list height instead of by 5 lines.
+ Bug #3455493.
+
+
+ For SCI_LINESCROLLDOWN/UP don't select into virtual space.
+ Bug #3451681.
+
+
+ Fix fold highlight not being fully drawn.
+ Bug #3469936.
+
+
+ Fix selection margin appearing black when starting in wrap mode.
+
+
+ Fix crash when changing end of document after adding an annotation.
+ Bug #3476637.
+
+
+ Fix problems with building to make RPMs.
+ Bug #3476149.
+
+
+ Fix problem with building on GTK+ where recent distributions could not find gmodule.
+ Bug #3469056.
+
+
+ Fix problem with installing SciTE on GTK+ due to icon definition in .desktop file including an extension.
+ Bug #3476117.
+
+
+ Fix SciTE bug where new buffers inherited some properties from previously opened file.
+ Bug #3457060.
+
+
+ Fix focus when closing tab in SciTE with middle click. Focus moves to edit pane instead of staying on tab bar.
+ Bug #3440142.
+
+
+ For SciTE on Windows fix bug where Open Selected Filename for URL would append a file extension.
+ Feature #3459185.
+
+
+ For SciTE on Windows fix key handling of control characters in Parameters dialog so normal editing (Ctrl+C, ...) works.
+ Bug #3459345.
+
+
+ Fix SciTE bug where files became read-only after saving. Drop the "*" dirty marker after save completes.
+ Bug #3467432.
+
+
+ For SciTE handling of diffs with "+++" and "---" lines, also handle case where not followed by tab.
+ Go to correct line for diff "+++" message.
+ Bug #3467143.
+ Bug #3467178.
+
+
+ SciTE on GTK+ now performs threaded actions even on GTK+ versions before 2.12.
+
+ SciTE on Windows now runs Lua scripts directly on the main thread instead of starting them on a
+ secondary thread and then moving back to the main thread.
+
+
+ Highlight "else" as a keyword for TCL in the same way as other languages.
+ Bug #1836954.
+
+
+ Fix problems with setting fonts for autocompletion lists on Windows where
+ font handles were copied and later deleted causing a system default font to be used.
+
+
+ Fix font size used on Windows for Asian language input methods which sometimes led to IME not being visible.
+ Bug #3436753.
+
+
+ Fixed polygon drawing on Windows so fold symbols are visible again.
+ Bug #3433558.
+
+
+ Changed background drawing on GTK+ to allow for fractional character positioning as occurs on OS X
+ as this avoids faint lines at lexeme boundaries.
+
+
+ Ensure pixmaps allocated before painting as there was a crash when Scintilla drew without common initialisation calls.
+ Bug #3432354.
+
+
+ Fixed SciTE on Windows bug causing wrong caret position after indenting a selection.
+ Bug #3433433.
+
+
+ Fixed SciTE session saving to store buffer position matching buffer.
+ Bug #3434372.
+
+
+ Fixed leak of document objects in SciTE.
+
+
+ Recognise URL characters '?' and '%' for Open Selected command in SciTE.
+ Bug #3429409.
+
+ Carbon platform support removed. OS X applications should switch to Cocoa.
+
+
+ On Windows Vista or newer, drawing may be performed with Direct2D and DirectWrite instead of GDI.
+
+
+ Cairo is now used for all drawing on GTK+. GDK drawing was removed.
+
+
+ Paletted display support removed.
+
+
+ Fractional font sizes can be specified.
+
+
+ Different weights of text supported on some platforms instead of just normal and bold.
+
+
+ Sub-pixel character positioning supported.
+
+
+ SciTE loads files in the background without blocking the user interface.
+
+
+ SciTE can display diagnostic messages interleaved with the text of files immediately after the
+ line referred to by the diagnostic.
+
+
+ New API to see if all lines are visible which can be used to optimize processing fold structure notifications.
+
+
+ Scrolling optimized by avoiding invalidation of fold margin when redrawing whole window.
+
+
+ Optimized SCI_MARKERNEXT.
+
+
+ C++ lexer supports Pike hash quoted strings when turned on with lexer.cpp.hashquoted.strings.
+
+
+ Fixed incorrect line height with annotations in wrapped mode when there are multiple views.
+ Bug #3388159.
+
+
+ Calltips may be displayed above the text as well as below.
+ Bug #3410830.
+
+
+ For huge files SciTE only examines the first megabyte for newline discovery.
+
+
+ SciTE on GTK+ removes the fileselector.show.hidden property and check box as this was buggy and GTK+ now
+ supports an equivalent feature.
+ Bug #3413630.
+
+
+ SciTE on GTK+ supports mnemonics in dynamic menus.
+
+
+ SciTE on GTK+ displays the user's home directory as '~' in menus to make them shorter.
+
+ To automatically discover the encoding of a file when opening it, SciTE can run a program set with command.discover.properties.
+ Feature #3324341.
+
+
+ Cairo always used for drawing on GTK+.
+
+
+ The set of properties files imported by SciTE can be controlled with the properties imports.include and imports.exclude.
+ The import statement has been extended to allow "import *".
+ The properties files for some languages are no longer automatically loaded by default. The properties files affected are
+ avenue, baan, escript, lot, metapost, and mmixal.
+
+
+ C++ lexer fixed a bug with raw strings being recognised too easily.
+ Bug #3388122.
+
+ GTK+ Cairo support works back to GTK+ version 2.8. Requires changing Scintilla source code to enable before GTK+ 2.22.
+ Bug #3322351.
+
+
+ Translucent images in RGBA format can be used for margin markers and in autocompletion lists.
+
+
+ INDIC_DOTBOX added as a translucent dotted rectangular indicator.
+
+
+ Asian text input using IME works for GTK+ 3.x and GTK+ 2.x with Cairo.
+
+
+ On GTK+, IME works for Ctrl+Shift+U Unicode input in Scintilla. For SciTE, Ctrl+Shift+U is still Make Selection Uppercase.
+
+
+ Key bindings for GTK+ on OS X made compatible with Cocoa port and platform conventions.
+
+
+ Cocoa port supports different character encodings, improves scrolling performance and drag image appearance.
+ The control ID is included in WM_COMMAND notifications. Text may be deleted by dragging to the trash.
+ ScrollToStart and ScrollToEnd key commands added to simplify implementation of standard OS X Home and End
+ behaviour.
+
+
+ SciTE on GTK+ uses a paned widget to contain the edit and output panes instead of custom code.
+ This allows the divider to be moved easily on GTK+ 3 and its appearance follows GTK+ conventions more closely.
+
+
+ SciTE builds and installs on BSD.
+ Bug #3324644.
+
+
+ Cobol supports fixed format comments.
+ Bug #3014850.
+
- SQL folder recognizes case statements and understands the fold.at.else property.
+ SQL folder recognises case statements and understands the fold.at.else property.
Bug #3104091.Bug #3107362.
- JavaScript lexer recognize regexes following return keyword.‎
+ JavaScript lexer recognise regexes following return keyword.‎
Bug #3062287.
@@ -1392,7 +3050,7 @@
Erlang lexer extended set of numeric bases recognised; separate style for module:function_name; detects
- built-in functions, known module attributes, and known preprocessor instructions; recognizes EDoc and EDoc macros;
+ built-in functions, known module attributes, and known preprocessor instructions; recognises EDoc and EDoc macros;
separates types of comments.
Bug #2942448.
@@ -2345,7 +4003,7 @@
Style changes may be made during text modification events.
Support for cmake language added.
diff --git a/scintilla/doc/ScintillaRelated.html b/scintilla/doc/ScintillaRelated.html
index f060ce0f..956f8055 100644
--- a/scintilla/doc/ScintillaRelated.html
+++ b/scintilla/doc/ScintillaRelated.html
@@ -28,6 +28,18 @@
Ports and Bindings of Scintilla
+
+ Scinterm
+ is an implementation of Scintilla for the ncurses platform.
+
CoderStudio
is an IDE for Assembly programming similar to Visual Studio 6.0.
@@ -148,7 +194,7 @@
is a basic Lisp editor for Windows 2000, XP and Vista.
+ UniCodeEditor
+ is a Unicode aware syntax editor control for Delphi and C++ Builder.
+
GtkSourceView
is a text widget that extends the standard GTK+ 2.x text widget and improves it
diff --git a/scintilla/doc/ScintillaToDo.html b/scintilla/doc/ScintillaToDo.html
index 972d95c4..17b93077 100644
--- a/scintilla/doc/ScintillaToDo.html
+++ b/scintilla/doc/ScintillaToDo.html
@@ -29,31 +29,15 @@
Feedback
- At the end of italics style runs characters can be chopped off. An example
- is using Verdana 12 point italics for strings makes an ending double quote
- half visible and an ending single quote invisible. This is hard to solve
- completely, may be better to avoid these situations by, for example,
- choosing a font like Times New Roman for strings. There is a specific kluge
- for the end of line which adds some room for italics but this does not
- work elsewhere.
-
-
- Dragging over bold text in some fonts will ripple because of the difference in
- size between drawing all of a string at once and drawing it in parts.
-
Automatic scrolling when text dragged near edge of window.
-
- GTK+ Version Bugs
-
Scintilla To Do
@@ -72,16 +56,9 @@
Composition of lexing for mixed languages (such as ASP+ over COBOL) by
combining lexers.
-
- Printing support on GTK+. Maybe Postscript output or use Gnome?
-
Stream folding which could be used to fold up the contents of HTML elements.
-
- Persisting view state such as current folding into a stream or blob so it is easy
- to restore.
-
Printing of highlight lines and folding margin.
@@ -89,12 +66,6 @@
Flow diagrams inside editor similar to
GRASP.
-
- A VCL component wrapper around Scintilla so it can be used with Delphi or
- Borland C++ Builder.
- There is some work
- on this available.
-