diff --git a/PowerEditor/scintilla.original.forUpdating/scintilla.original.forUpdating.7z b/PowerEditor/scintilla.original.forUpdating/scintilla.original.forUpdating.7z index 1633e719..96dbc453 100644 Binary files a/PowerEditor/scintilla.original.forUpdating/scintilla.original.forUpdating.7z and b/PowerEditor/scintilla.original.forUpdating/scintilla.original.forUpdating.7z differ diff --git a/scintilla/README b/scintilla/README index cada051b..3fe033e7 100644 --- a/scintilla/README +++ b/scintilla/README @@ -40,8 +40,8 @@ The current make file only supports static linking between SciTE and Scintilla. *** Windows version *** -A C++ compiler is required. Visual Studio .NET 2010 is the development system -used for most development although TDM Mingw32 4.4.1 is also supported. +A C++ compiler is required. Visual Studio 2010 is the development system +used for most development although TDM Mingw32 4.7.1 is also supported. To build Scintilla, make in the scintilla/win32 directory cd scintilla\win32 @@ -54,10 +54,7 @@ To build SciTE, use the makefiles located in the scite/win32 directory GCC: mingw32-make VS .NET: nmake -f scite.mak -An executable SciTE will now be in scite\bin. - -The Visual C++ 6.0 project (.dsp) and make files are no longer supported but are left -in the download for people that are prepared to update them. +An executable SciTE will now be in scite/bin. *** GTK+/Windows version *** diff --git a/scintilla/cocoa/Framework.mk b/scintilla/cocoa/Framework.mk deleted file mode 100644 index d18ee813..00000000 --- a/scintilla/cocoa/Framework.mk +++ /dev/null @@ -1,71 +0,0 @@ -### start defines ### -include common.mk - -INST_NAME=-install_name \ - @executable_path/../Frameworks/Sci.framework/Versions/A/Sci - -LD=gcc $(ARCH) -dynamiclib -framework Cocoa $(INST_NAME) - -LEXOBJS:=$(addsuffix .o,$(basename $(notdir $(wildcard ../lexers/Lex*.cxx)))) - -SCI_LEXERS=$(LEXOBJS) \ - LexerBase.o LexerModule.o LexerSimple.o Accessor.o - -SCI_OBJ=AutoComplete.o CallTip.o CellBuffer.o CharClassify.o \ - ContractionState.o Decoration.o Document.o Editor.o \ - ExternalLexer.o Indicator.o KeyMap.o LineMarker.o PerLine.o \ - PositionCache.o PropSetSimple.o RESearch.o RunStyles.o ScintillaBase.o Style.o \ - StyleContext.o UniConversion.o ViewStyle.o XPM.o WordList.o \ - Selection.o CharacterSet.o Catalogue.o $(SCI_LEXERS) - -WAH_OBJ=DocumentAccessor.o KeyWords.o WindowAccessor.o - -COC_OBJ=PlatCocoa.o ScintillaCocoa.o ScintillaView.o InfoBar.o - -OBJ=$(SCI_OBJ) $(UNUSED_OBJ) $(COC_OBJ) -OBJS=$(addprefix $(FRM_BLD)/,$(OBJ)) - -TARG=$(APP)/Versions/A/Sci -APP=$(FRM_BLD)/Sci.framework -### end defines ### - -### start targets ### - -all: $(FRM_BLD) $(TARG) - -cleanfrm: - -rm -rf $(FRM_BLD) - -$(APP): $(FRM_BLD) - -rm -rf $(APP) - -mkdir $(APP) - -mkdir $(APP)/Versions - -mkdir $(APP)/Versions/A - -mkdir $(APP)/Versions/A/Headers - -mkdir $(APP)/Versions/A/Resources - -ln -sf `pwd`/$(APP)/Versions/A `pwd`/$(APP)/Versions/Current - -ln -sf `pwd`/$(APP)/Versions/A/Headers `pwd`/$(APP)/Headers - -ln -sf `pwd`/$(APP)/Versions/A/Resources `pwd`/$(APP)/Resources - -cp *.h $(APP)/Headers/ - -cp ../src/*.h $(APP)/Headers/ - -cp ../include/*.h $(APP)/Headers/ - -cp -R ScintillaFramework/English.lproj $(APP)/Resources - -cp res/*.png $(APP)/Resources - -cp ScintillaFramework/Info.plist $(APP)/Resources - -$(TARG) : $(OBJS) $(APP) - $(LD) $(OBJS) $(gDEFs) -o $(TARG) -lstdc++ - -ln `pwd`/$(TARG) `pwd`/$(APP)/Sci - -$(FRM_BLD): - -mkdir $(BLD) - -mkdir $(FRM_BLD) - -### get around to filling out the real dependencies later ### -#$(FRM_BLD)/AutoComplete.o : ../src/AutoComplete.cxx ../src/AutoComplete.h \ -# ../include/Platform.h - -#$(FRM_BLD)/CallTip.o : ../src/CallTip.cxx ../src/CallTip.h \ -# ../include/Platform.h - -### end targets ### diff --git a/scintilla/cocoa/InfoBar.h b/scintilla/cocoa/InfoBar.h index 1d10e795..bc30ca28 100644 --- a/scintilla/cocoa/InfoBar.h +++ b/scintilla/cocoa/InfoBar.h @@ -28,15 +28,15 @@ @private NSImage* mBackground; IBDisplay mDisplayMask; - + float mScaleFactor; NSPopUpButton* mZoomPopup; - + int mCurrentCaretX; int mCurrentCaretY; NSTextField* mCaretPositionLabel; NSTextField* mStatusTextLabel; - + id mCallback; } diff --git a/scintilla/cocoa/InfoBar.mm b/scintilla/cocoa/InfoBar.mm index 14035795..2ae1ed5a 100644 --- a/scintilla/cocoa/InfoBar.mm +++ b/scintilla/cocoa/InfoBar.mm @@ -22,7 +22,7 @@ { // Get the parent's idea of where we should draw NSRect newRect = [super drawingRectForBounds: theRect]; - + // When the text field is being edited or selected, we have to turn off the magic because it // screws up the configuration of the field editor. We sneak around this by intercepting // selectWithFrame and editWithFrame and sneaking a reduced, centered rect in at the last minute. @@ -30,26 +30,26 @@ { // Get our ideal size for current text NSSize textSize = [self cellSizeForBounds: theRect]; - + // Center that in the proposed rect - float heightDelta = newRect.size.height - textSize.height; + CGFloat heightDelta = newRect.size.height - textSize.height; if (heightDelta > 0) { newRect.size.height -= heightDelta; newRect.origin.y += ceil(heightDelta / 2); } } - + return newRect; } //-------------------------------------------------------------------------------------------------- -- (void) selectWithFrame: (NSRect) aRect inView: (NSView*) controlView editor: (NSText*) textObj +- (void) selectWithFrame: (NSRect) aRect inView: (NSView*) controlView editor: (NSText*) textObj delegate:(id) anObject start: (NSInteger) selStart length: (NSInteger) selLength { aRect = [self drawingRectForBounds: aRect]; - mIsEditingOrSelecting = YES; + mIsEditingOrSelecting = YES; [super selectWithFrame: aRect inView: controlView editor: textObj @@ -63,7 +63,7 @@ - (void) editWithFrame: (NSRect) aRect inView: (NSView*) controlView editor: (NSText*) textObj delegate: (id) anObject event: (NSEvent*) theEvent -{ +{ aRect = [self drawingRectForBounds: aRect]; mIsEditingOrSelecting = YES; [super editWithFrame: aRect @@ -86,8 +86,8 @@ if (self) { NSBundle* bundle = [NSBundle bundleForClass: [InfoBar class]]; - - NSString* path = [bundle pathForResource: @"info_bar_bg" ofType: @"png" inDirectory: nil]; + + NSString* path = [bundle pathForResource: @"info_bar_bg" ofType: @"tiff" inDirectory: nil]; mBackground = [[NSImage alloc] initWithContentsOfFile: path]; if (![mBackground isValid]) NSLog(@"Background image for info bar is invalid."); @@ -103,12 +103,12 @@ //-------------------------------------------------------------------------------------------------- /** - * Called by a connected compontent (usually the info bar) if something changed there. + * Called by a connected component (usually the info bar) if something changed there. * * @param type The type of the notification. * @param message Carries the new status message if the type is a status message change. * @param location Carries the new location (e.g. caret) if the type is a caret change or similar type. - * @param location Carries the new zoom value if the type is a zoom change. + * @param value Carries the new zoom value if the type is a zoom change. */ - (void) notify: (NotificationType) type message: (NSString*) message location: (NSPoint) location value: (float) value @@ -143,7 +143,7 @@ static NSString *DefaultScaleMenuLabels[] = { @"20%", @"30%", @"50%", @"75%", @"100%", @"130%", @"160%", @"200%", @"250%", @"300%" }; static float DefaultScaleMenuFactors[] = { - 0.2, 0.3, 0.5, 0.75, 1.0, 1.3, 1.6, 2.0, 2.5, 3.0 + 0.2f, 0.3f, 0.5f, 0.75f, 1.0f, 1.3f, 1.6f, 2.0f, 2.5f, 3.0f }; static unsigned DefaultScaleMenuSelectedItemIndex = 4; static float BarFontSize = 10.0; @@ -152,14 +152,14 @@ static float BarFontSize = 10.0; { // 1) The zoom popup. unsigned numberOfDefaultItems = sizeof(DefaultScaleMenuLabels) / sizeof(NSString *); - + // Create the popup button. mZoomPopup = [[NSPopUpButton allocWithZone:[self zone]] initWithFrame: NSMakeRect(0.0, 0.0, 1.0, 1.0) pullsDown: NO]; - + // No border or background please. [[mZoomPopup cell] setBordered: NO]; [[mZoomPopup cell] setArrowPosition: NSPopUpArrowAtBottom]; - + // Fill it. for (unsigned count = 0; count < numberOfDefaultItems; count++) { @@ -169,28 +169,28 @@ static float BarFontSize = 10.0; [currentItem setRepresentedObject: [NSNumber numberWithFloat: DefaultScaleMenuFactors[count]]]; } [mZoomPopup selectItemAtIndex: DefaultScaleMenuSelectedItemIndex]; - + // Hook it up. [mZoomPopup setTarget: self]; [mZoomPopup setAction: @selector(zoomItemAction:)]; - + // Set a suitable font. [mZoomPopup setFont: [NSFont menuBarFontOfSize: BarFontSize]]; - + // Make sure the popup is big enough to fit the cells. [mZoomPopup sizeToFit]; - + // Don't let it become first responder [mZoomPopup setRefusesFirstResponder: YES]; - + // put it in the scrollview. [self addSubview: mZoomPopup]; [mZoomPopup release]; - + // 2) The caret position label. Class oldCellClass = [NSTextField cellClass]; [NSTextField setCellClass: [VerticallyCenteredTextFieldCell class]]; - + mCaretPositionLabel = [[NSTextField alloc] initWithFrame: NSMakeRect(0.0, 0.0, 50.0, 1.0)]; [mCaretPositionLabel setBezeled: NO]; [mCaretPositionLabel setBordered: NO]; @@ -205,7 +205,7 @@ static float BarFontSize = 10.0; [self addSubview: mCaretPositionLabel]; [mCaretPositionLabel release]; - + // 3) The status text. mStatusTextLabel = [[NSTextField alloc] initWithFrame: NSMakeRect(0.0, 0.0, 1.0, 1.0)]; [mStatusTextLabel setBezeled: NO]; @@ -220,7 +220,7 @@ static float BarFontSize = 10.0; [self addSubview: mStatusTextLabel]; [mStatusTextLabel release]; - + // Restore original cell class so that everything else doesn't get broken [NSTextField setCellClass: oldCellClass]; } @@ -248,12 +248,12 @@ static float BarFontSize = 10.0; [mBackground drawAtPoint: target fromRect: NSZeroRect operation: NSCompositeCopy fraction: 1]; target.x += mBackground.size.width; } - + // Draw separator lines between items. NSRect verticalLineRect; - float component = 190.0 / 255.0; + CGFloat component = 190.0 / 255.0; NSColor* lineColor = [NSColor colorWithDeviceRed: component green: component blue: component alpha: 1]; - + if (mDisplayMask & IBShowZoom) { verticalLineRect = [mZoomPopup frame]; @@ -265,7 +265,7 @@ static float BarFontSize = 10.0; NSRectFill(verticalLineRect); } } - + if (mDisplayMask & IBShowCaretPosition) { verticalLineRect = [mCaretPositionLabel frame]; @@ -301,7 +301,7 @@ static float BarFontSize = 10.0; - (void) positionSubViews { - NSRect currentBounds = {0, 0, 0, [self frame].size.height}; + NSRect currentBounds = {{0, 0}, {0, [self frame].size.height}}; if (mDisplayMask & IBShowZoom) { [mZoomPopup setHidden: NO]; @@ -347,7 +347,7 @@ static float BarFontSize = 10.0; mDisplayMask = display; [self positionSubViews]; [self needsDisplay]; - } + } } //-------------------------------------------------------------------------------------------------- @@ -358,7 +358,7 @@ static float BarFontSize = 10.0; - (void) zoomItemAction: (id) sender { NSNumber* selectedFactorObject = [[sender selectedCell] representedObject]; - + if (selectedFactorObject == nil) { NSLog(@"Scale popup action: setting arbitrary zoom factors is not yet supported."); @@ -369,9 +369,9 @@ static float BarFontSize = 10.0; [self setScaleFactor: [selectedFactorObject floatValue] adjustPopup: NO]; } } - + //-------------------------------------------------------------------------------------------------- - + - (void) setScaleFactor: (float) newScaleFactor adjustPopup: (BOOL) flag { if (mScaleFactor != newScaleFactor) @@ -381,7 +381,7 @@ static float BarFontSize = 10.0; { unsigned count = 0; unsigned numberOfDefaultItems = sizeof(DefaultScaleMenuFactors) / sizeof(float); - + // We only work with some preset zoom values. If the given value does not correspond // to one then show no selection. while (count < numberOfDefaultItems && (fabs(newScaleFactor - DefaultScaleMenuFactors[count]) > 0.07)) @@ -391,7 +391,7 @@ static float BarFontSize = 10.0; else { [mZoomPopup selectItemAtIndex: count]; - + // Set scale factor to found preset value if it comes close. mScaleFactor = DefaultScaleMenuFactors[count]; } @@ -400,7 +400,7 @@ static float BarFontSize = 10.0; { // Internally set. Notify owner. [mCallback notify: IBNZoomChanged message: nil location: NSZeroPoint value: newScaleFactor]; - } + } } } @@ -414,12 +414,12 @@ static float BarFontSize = 10.0; // Make the position one-based. int newX = (int) position.x + 1; int newY = (int) position.y + 1; - + if (mCurrentCaretX != newX || mCurrentCaretY != newY) { mCurrentCaretX = newX; mCurrentCaretY = newY; - + [mCaretPositionLabel setStringValue: [NSString stringWithFormat: @"%d:%d", newX, newY]]; } } @@ -427,7 +427,7 @@ static float BarFontSize = 10.0; //-------------------------------------------------------------------------------------------------- /** - * Makes the bar resize to the smallest width that can accomodate the currently enabled items. + * Makes the bar resize to the smallest width that can accommodate the currently enabled items. */ - (void) sizeToFit { @@ -435,13 +435,13 @@ static float BarFontSize = 10.0; frame.size.width = 0; if (mDisplayMask & IBShowZoom) frame.size.width += [mZoomPopup frame].size.width; - + if (mDisplayMask & IBShowCaretPosition) frame.size.width += [mCaretPositionLabel frame].size.width; - + if (mDisplayMask & IBShowStatusText) frame.size.width += [mStatusTextLabel frame].size.width; - + [self setFrame: frame]; } diff --git a/scintilla/cocoa/InfoBarCommunicator.h b/scintilla/cocoa/InfoBarCommunicator.h index ba8ae7a1..5727c3a1 100644 --- a/scintilla/cocoa/InfoBarCommunicator.h +++ b/scintilla/cocoa/InfoBarCommunicator.h @@ -8,7 +8,7 @@ * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). */ -enum IBDisplay { +typedef NS_OPTIONS(NSUInteger, IBDisplay) { IBShowZoom = 0x01, IBShowCaretPosition = 0x02, IBShowStatusText = 0x04, @@ -21,7 +21,7 @@ enum IBDisplay { * ScintillaView implementation. The protocol is used two-way. */ -enum NotificationType { +typedef NS_ENUM(NSInteger, NotificationType) { IBNZoomChanged, // The user selected another zoom value. IBNCaretChanged, // The caret in the editor changed. IBNStatusChanged, // The application set a new status message. diff --git a/scintilla/cocoa/PlatCocoa.h b/scintilla/cocoa/PlatCocoa.h index 775602ba..2a1b807a 100644 --- a/scintilla/cocoa/PlatCocoa.h +++ b/scintilla/cocoa/PlatCocoa.h @@ -7,14 +7,14 @@ #ifndef PLATCOCOA_H #define PLATCOCOA_H -#include -#include -#include - #include #include +#include +#include +#include + #include #include "QuartzTextLayout.h" @@ -50,7 +50,7 @@ private: QuartzTextLayout* textLayout; int codePage; int verticalDeviceResolution; - + /** If the surface is a bitmap context, contains a reference to the bitmap data. */ uint8_t* bitmapData; /** If the surface is a bitmap context, stores the dimensions of the bitmap. */ @@ -98,7 +98,7 @@ public: void Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSource); 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, + 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); @@ -117,7 +117,7 @@ public: void SetUnicodeMode(bool unicodeMode_); void SetDBCSMode(int codePage_); }; // SurfaceImpl class - + } // Scintilla namespace #endif diff --git a/scintilla/cocoa/PlatCocoa.mm b/scintilla/cocoa/PlatCocoa.mm index a5e68795..98373fdd 100644 --- a/scintilla/cocoa/PlatCocoa.mm +++ b/scintilla/cocoa/PlatCocoa.mm @@ -12,22 +12,27 @@ * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). */ -#import - -#include "PlatCocoa.h" - -#include -#include -#include #include #include + +#include +#include +#include + #include +#include #include -#include "XPM.h" - #import +#import "Platform.h" +#import "ScintillaView.h" +#import "ScintillaCocoa.h" +#import "PlatCocoa.h" + +#include "StringCopy.h" +#include "XPM.h" + using namespace Scintilla; extern sptr_t scintilla_send_message(void* sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam); @@ -49,13 +54,15 @@ NSRect PRectangleToNSRect(PRectangle& rc) */ PRectangle NSRectToPRectangle(NSRect& rc) { - return PRectangle(rc.origin.x, rc.origin.y, rc.size.width + rc.origin.x, rc.size.height + rc.origin.y); + return PRectangle(static_cast(rc.origin.x), static_cast(rc.origin.y), + static_cast(NSMaxX(rc)), + static_cast(NSMaxY(rc))); } //-------------------------------------------------------------------------------------------------- /** - * Converts a PRctangle as used by Scintilla to a Quartz-style rectangle. + * Converts a PRectangle as used by Scintilla to a Quartz-style rectangle. */ inline CGRect PRectangleToCGRect(PRectangle& rc) { @@ -176,7 +183,7 @@ void SurfaceImpl::Release() } bitmapData = NULL; gc = NULL; - + bitmapWidth = 0; bitmapHeight = 0; x = 0; @@ -196,11 +203,11 @@ bool SurfaceImpl::Initialised() 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). + // then acquire/release the context on an as-need basis (see above). // XXX Docs on QDBeginCGContext are light, a better way to do this would be good. // AFAIK we should not hold onto a context retrieved this way, thus the need for - // aquire/release of the context. - + // acquire/release of the context. + Release(); } @@ -216,22 +223,22 @@ void SurfaceImpl::Init(SurfaceID sid, WindowID) //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::InitPixMap(int width, int height, Surface* /* surface_ */, WindowID /* wid */) +void SurfaceImpl::InitPixMap(int width, int height, Surface* surface_, WindowID /* wid */) { Release(); - + // Create a new bitmap context, along with the RAM for the bitmap itself bitmapWidth = width; bitmapHeight = height; - + const int bitmapBytesPerRow = (width * BYTES_PER_PIXEL); const int bitmapByteCount = (bitmapBytesPerRow * height); - + // Create an RGB color space. CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); if (colorSpace == NULL) return; - + // Create the bitmap. bitmapData = new uint8_t[bitmapByteCount]; // create the context @@ -242,7 +249,7 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface* /* surface_ */, Win bitmapBytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast); - + if (gc == NULL) { // the context couldn't be created for some reason, @@ -251,10 +258,10 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface* /* surface_ */, Win bitmapData = NULL; } textLayout->setContext (gc); - + // the context retains the color space, so we can release it CGColorSpaceRelease(colorSpace); - + if (gc != NULL && bitmapData != NULL) { // "Erase" to white. @@ -262,6 +269,10 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface* /* surface_ */, Win CGContextSetRGBFillColor( gc, 1.0, 1.0, 1.0, 1.0 ); CGContextFillRect( gc, CGRectMake( 0, 0, width, height ) ); } + + SurfaceImpl *psurfOther = static_cast(surface_); + unicodeMode = psurfOther->unicodeMode; + codePage = psurfOther->codePage; } //-------------------------------------------------------------------------------------------------- @@ -271,9 +282,9 @@ void SurfaceImpl::PenColour(ColourDesired fore) if (gc) { ColourDesired colour(fore.AsLong()); - + // Set the Stroke color to match - CGContextSetRGBStrokeColor(gc, colour.GetRed() / 255.0, colour.GetGreen() / 255.0, + CGContextSetRGBStrokeColor(gc, colour.GetRed() / 255.0, colour.GetGreen() / 255.0, colour.GetBlue() / 255.0, 1.0 ); } } @@ -285,9 +296,9 @@ void SurfaceImpl::FillColour(const ColourDesired& back) if (gc) { ColourDesired colour(back.AsLong()); - + // Set the Fill color to match - CGContextSetRGBFillColor(gc, colour.GetRed() / 255.0, colour.GetGreen() / 255.0, + CGContextSetRGBFillColor(gc, colour.GetRed() / 255.0, colour.GetGreen() / 255.0, colour.GetBlue() / 255.0, 1.0 ); } } @@ -299,17 +310,17 @@ CGImageRef SurfaceImpl::GetImage() // For now, assume that GetImage can only be called on PixMap surfaces. if (bitmapData == NULL) return NULL; - + CGContextFlush(gc); - + // Create an RGB color space. CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); if( colorSpace == NULL ) return NULL; - + 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); @@ -333,18 +344,18 @@ CGImageRef SurfaceImpl::GetImage() 0, kCGRenderingIntentDefault); } - + // The image retains the color space, so we can release it. CGColorSpaceRelease(colorSpace); colorSpace = NULL; - + // Done with the data provider. CGDataProviderRelease(dataProvider); dataProvider = NULL; - + // Done with the data provider. CFRelease(dataRef); - + return image; } @@ -384,10 +395,10 @@ void SurfaceImpl::MoveTo(int x_, int y_) void SurfaceImpl::LineTo(int x_, int y_) { CGContextBeginPath( gc ); - + // Because Quartz is based on floating point, lines are drawn with half their colour // on each side of the line. Integer coordinates specify the INTERSECTION of the pixel - // divison lines. If you specify exact pixel values, you get a line that + // division lines. If you specify exact pixel values, you get a line that // is twice as thick but half as intense. To get pixel aligned rendering, // we render the "middle" of the pixels by adding 0.5 to the coordinates. CGContextMoveToPoint( gc, x + 0.5, y + 0.5 ); @@ -404,23 +415,23 @@ void SurfaceImpl::Polygon(Scintilla::Point *pts, int npts, ColourDesired fore, { // Allocate memory for the array of points. std::vector points(npts); - + for (int i = 0;i < npts;i++) { // Quartz floating point issues: plot the MIDDLE of the pixels points[i].x = pts[i].x + 0.5; points[i].y = pts[i].y + 0.5; } - + CGContextBeginPath(gc); - + // Set colours FillColour(back); PenColour(fore); - + // Draw the polygon CGContextAddLines(gc, points.data(), npts); - + // Explicitly close the path, so it is closed for stroking AND filling (implicit close = filling only) CGContextClosePath( gc ); CGContextDrawPath( gc, kCGPathFillStroke ); @@ -435,7 +446,7 @@ void SurfaceImpl::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired CGContextBeginPath( gc ); FillColour(back); PenColour(fore); - + // 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. @@ -478,7 +489,7 @@ void releaseImageRefCallback(CGImageRef pattern) void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) { SurfaceImpl& patternSurface = static_cast(surfacePattern); - + // For now, assume that copy can only be called on PixMap surfaces. Shows up black. CGImageRef image = patternSurface.GetImage(); if (image == NULL) @@ -486,11 +497,11 @@ void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) FillRectangle(rc, ColourDesired(0)); return; } - + const CGPatternCallbacks drawImageCallbacks = { 0, reinterpret_cast(drawImageRefCallback), reinterpret_cast(releaseImageRefCallback) }; - + CGPatternRef pattern = CGPatternCreate(image, CGRectMake(0, 0, patternSurface.bitmapWidth, patternSurface.bitmapHeight), CGAffineTransformIdentity, @@ -505,10 +516,10 @@ void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) // Create a pattern color space CGColorSpaceRef colorSpace = CGColorSpaceCreatePattern( NULL ); if( colorSpace != NULL ) { - + CGContextSaveGState( gc ); CGContextSetFillColorSpace( gc, colorSpace ); - + // Unlike the documentation, you MUST pass in a "components" parameter: // For coloured patterns it is the alpha value. const CGFloat alpha = 1.0; @@ -531,12 +542,11 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesi // 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; - int radius = Platform::Minimum( MAX_RADIUS, rc.Height()/2 ); - radius = Platform::Minimum( radius, rc.Width()/2 ); - + const int radius = std::min(MAX_RADIUS, static_cast(std::min(rc.Height()/2, rc.Width()/2))); + // Points go clockwise, starting from just below the top left // Corners are kept together, so we can easily create arcs to connect them CGPoint corners[4][3] = @@ -562,7 +572,7 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesi { rc.left, rc.bottom - radius - 1 }, }, }; - + // Align the points in the middle of the pixels for( int i = 0; i < 4; ++ i ) { @@ -572,38 +582,120 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesi corners[i][j].y += 0.5; } } - + PenColour( fore ); FillColour( back ); - + // Move to the last point to begin the path CGContextBeginPath( gc ); CGContextMoveToPoint( gc, corners[3][2].x, corners[3][2].y ); - + for ( int i = 0; i < 4; ++ i ) { CGContextAddLineToPoint( gc, corners[i][0].x, corners[i][0].y ); CGContextAddArcToPoint( gc, corners[i][1].x, corners[i][1].y, corners[i][2].x, corners[i][2].y, radius ); } - + // Close the path to enclose it for stroking and for filling, then draw it CGContextClosePath( gc ); CGContextDrawPath( gc, kCGPathFillStroke ); } -void Scintilla::SurfaceImpl::AlphaRectangle(PRectangle rc, int /*cornerSize*/, ColourDesired fill, int alphaFill, - ColourDesired /*outline*/, int /*alphaOutline*/, int /*flags*/) +// DrawChamferedRectangle is a helper function for AlphaRectangle that either fills or strokes a +// rectangle with its corners chamfered at 45 degrees. +static void DrawChamferedRectangle(CGContextRef gc, PRectangle rc, int cornerSize, CGPathDrawingMode mode) { + // Points go clockwise, starting from just below the top left + CGPoint corners[4][2] = + { + { + { rc.left, rc.top + cornerSize }, + { rc.left + cornerSize, rc.top }, + }, + { + { rc.right - cornerSize - 1, rc.top }, + { rc.right - 1, rc.top + cornerSize }, + }, + { + { rc.right - 1, rc.bottom - cornerSize - 1 }, + { rc.right - cornerSize - 1, rc.bottom - 1 }, + }, + { + { rc.left + cornerSize, rc.bottom - 1 }, + { rc.left, rc.bottom - cornerSize - 1 }, + }, + }; + + // Align the points in the middle of the pixels + for( int i = 0; i < 4; ++ i ) + { + for( int j = 0; j < 2; ++ j ) + { + corners[i][j].x += 0.5; + corners[i][j].y += 0.5; + } + } + + // Move to the last point to begin the path + CGContextBeginPath( gc ); + CGContextMoveToPoint( gc, corners[3][1].x, corners[3][1].y ); + + for ( int i = 0; i < 4; ++ i ) + { + CGContextAddLineToPoint( gc, corners[i][0].x, corners[i][0].y ); + CGContextAddLineToPoint( gc, corners[i][1].x, corners[i][1].y ); + } + + // Close the path to enclose it for stroking and for filling, then draw it + CGContextClosePath( gc ); + CGContextDrawPath( gc, mode ); +} + +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 ); - CGContextFillRect( gc, rect ); + CGContextSetRGBFillColor( gc, fill.GetRed() / 255.0, fill.GetGreen() / 255.0, fill.GetBlue() / 255.0, alphaFill / 255.0 ); + CGContextSetRGBStrokeColor( gc, outline.GetRed() / 255.0, outline.GetGreen() / 255.0, outline.GetBlue() / 255.0, alphaOutline / 255.0 ); + PRectangle rcFill = rc; + if (cornerSize == 0) { + // A simple rectangle, no rounded corners + if ((fill == outline) && (alphaFill == alphaOutline)) { + // Optimization for simple case + CGRect rect = PRectangleToCGRect( rcFill ); + CGContextFillRect( gc, rect ); + } else { + rcFill.left += 1.0; + rcFill.top += 1.0; + rcFill.right -= 1.0; + rcFill.bottom -= 1.0; + CGRect rect = PRectangleToCGRect( rcFill ); + CGContextFillRect( gc, rect ); + CGContextAddRect( gc, CGRectMake( rc.left + 0.5, rc.top + 0.5, rc.Width() - 1, rc.Height() - 1 ) ); + CGContextStrokePath( gc ); + } + } else { + // Approximate rounded corners with 45 degree chamfers. + // Drawing real circular arcs often leaves some over- or under-drawn pixels. + if ((fill == outline) && (alphaFill == alphaOutline)) { + // Specializing this case avoids a few stray light/dark pixels in corners. + rcFill.left -= 0.5; + rcFill.top -= 0.5; + rcFill.right += 0.5; + rcFill.bottom += 0.5; + DrawChamferedRectangle( gc, rcFill, cornerSize, kCGPathFill ); + } else { + rcFill.left += 0.5; + rcFill.top += 0.5; + rcFill.right -= 0.5; + rcFill.bottom -= 0.5; + DrawChamferedRectangle( gc, rcFill, cornerSize-1, kCGPathFill ); + DrawChamferedRectangle( gc, rc, cornerSize, kCGPathStroke ); + } + } } } @@ -620,25 +712,25 @@ static CGImageRef ImageCreateFromRGBA(int width, int height, const unsigned char 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(surfaceSource); CGImageRef image = source.GetImage(); - + CGRect src = PRectangleToCGRect(srcRect); CGRect dst = PRectangleToCGRect(dstRect); - + /* source from QuickDrawToQuartz2D.pdf on developer.apple.com */ float w = (float) CGImageGetWidth(image); float h = (float) CGImageGetHeight(image); CGRect drawRect = CGRectMake (0, 0, w, h); if (!CGRectEqualToRect (src, dst)) { - float sx = CGRectGetWidth(dst) / CGRectGetWidth(src); - float sy = CGRectGetHeight(dst) / CGRectGetHeight(src); - float dx = CGRectGetMinX(dst) - (CGRectGetMinX(src) * sx); - float dy = CGRectGetMinY(dst) - (CGRectGetMinY(src) * sy); + CGFloat sx = CGRectGetWidth(dst) / CGRectGetWidth(src); + CGFloat sy = CGRectGetHeight(dst) / CGRectGetHeight(src); + CGFloat dx = CGRectGetMinX(dst) - (CGRectGetMinX(src) * sx); + CGFloat dy = CGRectGetMinY(dst) - (CGRectGetMinY(src) * sy); drawRect = CGRectMake (dx, dy, w*sx, h*sy); } CGContextSaveGState (gc); @@ -760,10 +804,10 @@ void SurfaceImpl::Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSou // Maybe we have to make the Surface two contexts: // a bitmap context which we do all the drawing on, and then a "real" context // which we copy the output to when we call "Synchronize". Ugh! Gross and slow! - + // For now, assume that copy can only be called on PixMap surfaces SurfaceImpl& source = static_cast(surfaceSource); - + // Get the CGImageRef CGImageRef image = source.GetImage(); // If we could not get an image reference, fill the rectangle black @@ -772,19 +816,19 @@ void SurfaceImpl::Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSou FillRectangle( rc, ColourDesired( 0 ) ); return; } - + // Now draw the image on the surface - + // Some fancy clipping work is required here: draw only inside of rc CGContextSaveGState( gc ); CGContextClipToRect( gc, PRectangleToCGRect( rc ) ); - + //Platform::DebugPrintf(stderr, "Copy: CGContextDrawImage: (%d, %d) - (%d X %d)\n", rc.left - from.x, rc.top - from.y, source.bitmapWidth, source.bitmapHeight ); CGContextDrawImage( gc, CGRectMake( rc.left - from.x, rc.top - from.y, source.bitmapWidth, source.bitmapHeight ), image ); - + // Undo the clipping fun CGContextRestoreGState( gc ); - + // Done with the image CGImageRelease( image ); image = NULL; @@ -869,7 +913,7 @@ CFStringEncoding EncodingFromCharacterSet(bool unicode, int characterSet) } } -void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, +void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore) { CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_)); @@ -878,7 +922,7 @@ void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION yba QuartzTextStyle* style = reinterpret_cast(font_.GetID()); style->setCTStyleColor(color); - + CGColorRelease(color); textLayout->setText (reinterpret_cast(s), len, encoding, *reinterpret_cast(font_.GetID())); @@ -903,10 +947,10 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION { CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_)); textLayout->setText (reinterpret_cast(s), len, encoding, *reinterpret_cast(font_.GetID())); - + CTLineRef mLine = textLayout->getCTLine(); assert(mLine != NULL); - + if (unicodeMode) { // Map the widths given for UTF-16 characters back onto the UTF-8 input string CFIndex fit = textLayout->getStringLength(); @@ -916,13 +960,13 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION while (ui(xPosition); } ui += codeUnits; } - int lastPos = 0; + XYPOSITION lastPos = 0.0f; if (i > 0) lastPos = positions[i-1]; while (i(xPosition); } ui++; } } else { // Single byte encoding for (int i=0;i(xPosition); } } @@ -952,8 +996,8 @@ XYPOSITION SurfaceImpl::WidthText(Font &font_, const char *s, int len) { { CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_)); textLayout->setText (reinterpret_cast(s), len, encoding, *reinterpret_cast(font_.GetID())); - - return textLayout->MeasureStringWidth(); + + return static_cast(textLayout->MeasureStringWidth()); } return 1; } @@ -964,7 +1008,7 @@ XYPOSITION SurfaceImpl::WidthChar(Font &font_, char ch) { { CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_)); textLayout->setText (reinterpret_cast(str), 1, encoding, *reinterpret_cast(font_.GetID())); - + return textLayout->MeasureStringWidth(); } else @@ -978,18 +1022,18 @@ const char sizeString[] = "`~!@#$%^&*()-_=+\\|[]{};:\"\'<,>.?/1234567890" XYPOSITION SurfaceImpl::Ascent(Font &font_) { if (!font_.GetID()) return 1; - + float ascent = reinterpret_cast( font_.GetID() )->getAscent(); - return ascent + 0.5; + return ascent + 0.5f; } XYPOSITION SurfaceImpl::Descent(Font &font_) { if (!font_.GetID()) return 1; - + float descent = reinterpret_cast( font_.GetID() )->getDescent(); - return descent + 0.5; + return descent + 0.5f; } @@ -1000,26 +1044,25 @@ XYPOSITION SurfaceImpl::InternalLeading(Font &) { XYPOSITION SurfaceImpl::ExternalLeading(Font &font_) { if (!font_.GetID()) return 1; - + float leading = reinterpret_cast( font_.GetID() )->getLeading(); - return leading + 0.5; + return leading + 0.5f; } XYPOSITION SurfaceImpl::Height(Font &font_) { - int ht = Ascent(font_) + Descent(font_); - return ht; + return Ascent(font_) + Descent(font_); } XYPOSITION SurfaceImpl::AverageCharWidth(Font &font_) { - + if (!font_.GetID()) return 1; - - const int sizeStringLength = (sizeof( sizeString ) / sizeof( sizeString[0] ) - 1); - int width = WidthText( font_, sizeString, sizeStringLength ); - + + const int sizeStringLength = ELEMENTS( sizeString ); + XYPOSITION width = WidthText( font_, sizeString, sizeStringLength ); + return (int) ((width / (float) sizeStringLength) + 0.5); } @@ -1055,21 +1098,7 @@ Window::~Window() { } -//-------------------------------------------------------------------------------------------------- - -void Window::Destroy() -{ - if (wid) - { - id idWin = reinterpret_cast(wid); - if ([idWin isKindOfClass: [NSWindow class]]) - { - NSWindow* win = reinterpret_cast(idWin); - [win release]; - } - } - wid = 0; -} +// Window::Destroy needs to see definition of ListBoxImpl so is located after ListBoxImpl //-------------------------------------------------------------------------------------------------- @@ -1081,13 +1110,13 @@ bool Window::HasFocus() //-------------------------------------------------------------------------------------------------- -static int ScreenMax(NSWindow* win) +static CGFloat ScreenMax(NSWindow* win) { - NSScreen* screen = [win screen]; - NSRect frame = [screen frame]; - return frame.origin.y + frame.size.height; + return NSMaxY([[NSScreen mainScreen] frame]); } +//-------------------------------------------------------------------------------------------------- + PRectangle Window::GetPosition() { if (wid) @@ -1101,7 +1130,7 @@ PRectangle Window::GetPosition() NSView* view = reinterpret_cast(idWin); win = [view window]; rect = [view convertRect: [view bounds] toView: nil]; - rect.origin = [win convertBaseToScreen:rect.origin]; + rect = [win convertRectToScreen:rect]; } else { @@ -1109,11 +1138,11 @@ PRectangle Window::GetPosition() win = reinterpret_cast(idWin); rect = [win frame]; } - int screenHeight = ScreenMax(win); + CGFloat screenHeight = ScreenMax(win); // Invert screen positions to match Scintilla return PRectangle( - NSMinX(rect), screenHeight - NSMaxY(rect), - NSMaxX(rect), screenHeight - NSMinY(rect)); + static_cast(NSMinX(rect)), static_cast(screenHeight - NSMaxY(rect)), + static_cast(NSMaxX(rect)), static_cast(screenHeight - NSMinY(rect))); } else { @@ -1134,14 +1163,15 @@ void Window::SetPosition(PRectangle rc) // Moves this view inside the parent view NSRect nsrc = NSMakeRect(rc.left, rc.bottom, rc.Width(), rc.Height()); NSView* view = reinterpret_cast(idWin); - nsrc.origin = [[view window] convertScreenToBase:nsrc.origin]; + nsrc = [[view window] convertRectFromScreen:nsrc]; [view setFrame: nsrc]; } else { // NSWindow + PLATFORM_ASSERT([idWin isKindOfClass: [NSWindow class]]); NSWindow* win = reinterpret_cast(idWin); - int screenHeight = ScreenMax(win); + CGFloat screenHeight = ScreenMax(win); NSRect nsrc = NSMakeRect(rc.left, screenHeight - rc.bottom, rc.Width(), rc.Height()); [win setFrame: nsrc display:YES]; @@ -1260,9 +1290,9 @@ void Window::SetCursor(Cursor curs) if (wid) { id idWin = reinterpret_cast(wid); - if ([idWin isMemberOfClass: [InnerView class]]) + if ([idWin isMemberOfClass: [SCIContentView class]]) { - InnerView* container = reinterpret_cast(idWin); + SCIContentView* container = reinterpret_cast(idWin); [container setCursor: curs]; } } @@ -1296,11 +1326,11 @@ PRectangle Window::GetMonitorRect(Point) NSWindow* win = reinterpret_cast(idWin); NSScreen* screen = [win screen]; NSRect rect = [screen frame]; - int screenHeight = rect.origin.y + rect.size.height; + CGFloat screenHeight = rect.origin.y + rect.size.height; // Invert screen positions to match Scintilla return PRectangle( - NSMinX(rect), screenHeight - NSMaxY(rect), - NSMaxX(rect), screenHeight - NSMinY(rect)); + static_cast(NSMinX(rect)), static_cast(screenHeight - NSMaxY(rect)), + static_cast(NSMaxX(rect)), static_cast(screenHeight - NSMinY(rect))); } } return PRectangle(); @@ -1339,6 +1369,8 @@ static NSImage* ImageFromXPM(XPM* pxpm) //----------------- ListBox and related classes ---------------------------------------------------- +//----------------- IListBox ----------------------------------------------------------------------- + namespace { // unnamed namespace hides IListBox interface @@ -1483,9 +1515,9 @@ private: int lineHeight; bool unicodeMode; int desiredVisibleRows; - unsigned int maxItemWidth; + XYPOSITION maxItemWidth; unsigned int aveCharWidth; - unsigned int maxIconWidth; + XYPOSITION maxIconWidth; Font font; int maxWidth; @@ -1494,7 +1526,7 @@ private: NSTableColumn* colIcon; NSTableColumn* colText; AutoCompletionDataSource* ds; - + LinesData ld; CallBackAction doubleClickAction; void* doubleClickActionData; @@ -1532,6 +1564,9 @@ public: } void SetList(const char* list, char separator, char typesep); + // To clean up when closed + void ReleaseViews(); + // For access from AutoCompletionDataSource implement IListBox int Rows(); NSImage* ImageForRow(NSInteger row); @@ -1579,6 +1614,7 @@ void ListBoxImpl::Create(Window& /*parent*/, int /*ctrlID*/, Scintilla::Point pt [table setTarget:ds]; [table setDoubleAction:@selector(doubleClick:)]; + table.selectionHighlightStyle = NSTableViewSelectionHighlightStyleSourceList; wid = winLB; } @@ -1616,19 +1652,20 @@ PRectangle ListBoxImpl::GetDesiredRect() rcDesired = GetPosition(); // There appears to be an extra pixel above and below the row contents - int itemHeight = [table rowHeight] + 2; + CGFloat itemHeight = [table rowHeight] + 2; int rows = Length(); if ((rows == 0) || (rows > desiredVisibleRows)) rows = desiredVisibleRows; - rcDesired.bottom = rcDesired.top + itemHeight * rows; + rcDesired.bottom = rcDesired.top + static_cast(itemHeight * rows); rcDesired.right = rcDesired.left + maxItemWidth + aveCharWidth; if (Length() > rows) { [scroller setHasVerticalScroller:YES]; - rcDesired.right += [NSScroller scrollerWidth]; + rcDesired.right += [NSScroller scrollerWidthForControlSize:NSRegularControlSize + scrollerStyle:NSScrollerStyleLegacy]; } else { @@ -1645,7 +1682,21 @@ int ListBoxImpl::CaretFromEdge() if ([colIcon isHidden]) return 3; else - return 6 + [colIcon width]; + return 6 + static_cast([colIcon width]); +} + +void ListBoxImpl::ReleaseViews() +{ + [table release]; + table = nil; + [scroller release]; + scroller = nil; + [colIcon release]; + colIcon = nil; + [colText release ]; + colText = nil; + [ds release]; + ds = nil; } void ListBoxImpl::Clear() @@ -1661,7 +1712,7 @@ void ListBoxImpl::Append(char* s, int type) ld.Add(count, type, s); Scintilla::SurfaceImpl surface; - unsigned int width = surface.WidthText(font, s, static_cast(strlen(s))); + XYPOSITION width = surface.WidthText(font, s, static_cast(strlen(s))); if (width > maxItemWidth) { maxItemWidth = width; @@ -1673,7 +1724,7 @@ void ListBoxImpl::Append(char* s, int type) NSImage* img = it->second; if (img) { - unsigned int widthIcon = img.size.width; + XYPOSITION widthIcon = static_cast(img.size.width); if (widthIcon > maxIconWidth) { [colIcon setHidden: NO]; @@ -1755,8 +1806,7 @@ void ListBoxImpl::GetValue(int n, char* value, int len) value[0] = '\0'; return; } - strncpy(value, textString, len); - value[len - 1] = '\0'; + strlcpy(value, textString, len); } void ListBoxImpl::RegisterImage(int type, const char* xpm_data) @@ -1864,12 +1914,34 @@ ListBox* ListBox::Allocate() return lb; } +//-------------------------------------------------------------------------------------------------- + +void Window::Destroy() +{ + ListBoxImpl *listbox = dynamic_cast(this); + if (listbox) + { + listbox->ReleaseViews(); + } + if (wid) + { + id idWin = reinterpret_cast(wid); + if ([idWin isKindOfClass: [NSWindow class]]) + { + NSWindow* win = reinterpret_cast(idWin); + [win release]; + } + } + wid = 0; +} + + //----------------- ScintillaContextMenu ----------------------------------------------------------- @implementation ScintillaContextMenu : NSMenu // This NSMenu subclass serves also as target for menu commands and forwards them as -// notfication messages to the front end. +// notification messages to the front end. - (void) handleCommand: (NSMenuItem*) sender { @@ -1925,7 +1997,7 @@ void Menu::Show(Point, Window &) ElapsedTime::ElapsedTime() { struct timeval curTime; gettimeofday( &curTime, NULL ); - + bigBit = curTime.tv_sec; littleBit = curTime.tv_usec; } @@ -1984,14 +2056,14 @@ int Platform::DefaultFontSize() //-------------------------------------------------------------------------------------------------- /** - * Returns the time span in which two consequtive mouse clicks must occur to be considered as + * Returns the time span in which two consecutive mouse clicks must occur to be considered as * double click. * - * @return + * @return time span in milliseconds */ unsigned int Platform::DoubleClickTime() { - float threshold = [[NSUserDefaults standardUserDefaults] floatForKey: + float threshold = [[NSUserDefaults standardUserDefaults] floatForKey: @"com.apple.mouse.doubleClickThreshold"]; if (threshold == 0) threshold = 0.5; @@ -2010,7 +2082,7 @@ bool Platform::MouseButtonBounce() /** * 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) +long Platform::SendScintilla(WindowID w, unsigned int msg, unsigned long wParam, long lParam) { return scintilla_send_message(w, msg, wParam, lParam); } @@ -2037,7 +2109,7 @@ bool Platform::IsDBCSLeadByte(int codePage, char ch) // Shift_jis return ((uch >= 0x81) && (uch <= 0x9F)) || ((uch >= 0xE0) && (uch <= 0xFC)); - // Lead bytes F0 to FC may be a Microsoft addition. + // Lead bytes F0 to FC may be a Microsoft addition. case 936: // GBK return (uch >= 0x81) && (uch <= 0xFE); @@ -2101,7 +2173,7 @@ void Platform::DebugPrintf(const char *format, ...) { const int BUF_SIZE = 2000; char buffer[BUF_SIZE]; - + va_list pArguments; va_start(pArguments, format); vsnprintf(buffer, BUF_SIZE, format, pArguments); @@ -2133,10 +2205,9 @@ bool Platform::ShowAssertionPopUps(bool assertionPopUps_) void Platform::Assert(const char *c, const char *file, int line) { char buffer[2000]; - sprintf(buffer, "Assertion [%s] failed at %s %d", c, file, line); - strcat(buffer, "\r\n"); + snprintf(buffer, sizeof(buffer), "Assertion [%s] failed at %s %d\r\n", c, file, line); Platform::DebugDisplay(buffer); -#ifdef DEBUG +#ifdef DEBUG // Jump into debugger in assert on Mac (CL269835) ::Debugger(); #endif @@ -2157,9 +2228,9 @@ int Platform::Clamp(int val, int minVal, int maxVal) /** * Implements the platform specific part of library loading. - * + * * @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. + * @return A library instance or NULL if the module could not be found or another problem occurred. */ DynamicLibrary* DynamicLibrary::Load(const char* /* modulePath */) { diff --git a/scintilla/cocoa/QuartzTextLayout.h b/scintilla/cocoa/QuartzTextLayout.h index 9f2681ec..102e4fed 100644 --- a/scintilla/cocoa/QuartzTextLayout.h +++ b/scintilla/cocoa/QuartzTextLayout.h @@ -20,7 +20,7 @@ class QuartzTextLayout { public: /** Create a text layout for drawing on the specified context. */ - QuartzTextLayout( CGContextRef context ) + explicit QuartzTextLayout( CGContextRef context ) { mString = NULL; mLine = NULL; @@ -39,7 +39,7 @@ public: { CFRelease(mLine); mLine = NULL; - } + } } inline void setText( const UInt8* buffer, size_t byteLength, CFStringEncoding encoding, const QuartzTextStyle& r ) @@ -47,19 +47,19 @@ public: CFStringRef str = CFStringCreateWithBytes( NULL, buffer, byteLength, encoding, false ); if (!str) return; - + stringLength = CFStringGetLength(str); CFMutableDictionaryRef stringAttribs = r.getCTStyle(); - + if (mString != NULL) CFRelease(mString); mString = ::CFAttributedStringCreate(NULL, str, stringAttribs); - + if (mLine != NULL) CFRelease(mLine); mLine = ::CTLineCreateWithAttributedString(mString); - + CFRelease( str ); } @@ -70,28 +70,28 @@ public: { if (mLine == NULL) return; - + ::CGContextSetTextMatrix(gc, CGAffineTransformMakeScale(1.0, -1.0)); - + // Set the text drawing position. ::CGContextSetTextPosition(gc, x, y); - + // And finally, draw! ::CTLineDraw(mLine, gc); } - + float MeasureStringWidth() - { + { if (mLine == NULL) return 0.0f; - - return ::CTLineGetTypographicBounds(mLine, NULL, NULL, NULL); + + return static_cast(::CTLineGetTypographicBounds(mLine, NULL, NULL, NULL)); } - + CTLineRef getCTLine() { return mLine; } - + CFIndex getStringLength() { return stringLength; } diff --git a/scintilla/cocoa/QuartzTextStyle.h b/scintilla/cocoa/QuartzTextStyle.h index 976169b9..0e1210b0 100644 --- a/scintilla/cocoa/QuartzTextStyle.h +++ b/scintilla/cocoa/QuartzTextStyle.h @@ -61,17 +61,17 @@ public: float getAscent() const { - return ::CTFontGetAscent(fontRef); + return static_cast(::CTFontGetAscent(fontRef)); } float getDescent() const { - return ::CTFontGetDescent(fontRef); + return static_cast(::CTFontGetDescent(fontRef)); } float getLeading() const { - return ::CTFontGetLeading(fontRef); + return static_cast(::CTFontGetLeading(fontRef)); } void setFontRef(CTFontRef inRef, int characterSet_) diff --git a/scintilla/cocoa/SciTest.mk b/scintilla/cocoa/SciTest.mk deleted file mode 100644 index c0647111..00000000 --- a/scintilla/cocoa/SciTest.mk +++ /dev/null @@ -1,36 +0,0 @@ -### start defines ### -include common.mk - -NAME=Demo - -LD=gcc $(ARCH) -framework Cocoa - -TARG=$(APP)/Contents/MacOS/$(NAME) -APP=$(APP_BLD)/$(NAME).app - -all: $(APP_BLD) $(TARG) - -$(APP): - -rm -rf $(APP) - -mkdir $(APP) - -mkdir $(APP)/Contents/ - -mkdir $(APP)/Contents/Frameworks/ - -mkdir $(APP)/Contents/MacOS/ - -mkdir $(APP)/Contents/Resources/ - -cp ScintillaTest/Info.plist $(APP)/Contents/Info.plist.bak - -sed "s/\$${EXECUTABLE_NAME}/$(NAME)/g" < $(APP)/Contents/Info.plist.bak > $(APP)/Contents/Info.plist.bak2 - -sed "s/\$${PRODUCT_NAME}/$(NAME)/g" < $(APP)/Contents/Info.plist.bak2 > $(APP)/Contents/Info.plist - -rm $(APP)/Contents/Info.plist.bak $(APP)/Contents/Info.plist.bak2 - -cp -r ScintillaTest/English.lproj $(APP)/Contents/Resources/ - /Developer/usr/bin/ibtool --errors --warnings --notices --output-format human-readable-text \ - --compile $(APP)/Contents/Resources/English.lproj/MainMenu.nib ScintillaTest/English.lproj/MainMenu.xib - -cp ScintillaTest/TestData.sql $(APP)/Contents/Resources/ - -make -f Framework.mk all - -$(TARG) : $(APP_BLD)/main.o $(APP_BLD)/AppController.o $(APP) - -cp -R $(FRM_BLD)/Sci.framework $(APP)/Contents/Frameworks/ - $(LD) $(APP_BLD)/main.o $(APP_BLD)/AppController.o $(APP)/Contents/Frameworks/Sci.framework/Sci -o $(TARG) -lstdc++ - -$(APP_BLD) : - -mkdir $(BLD) - -mkdir $(APP_BLD) diff --git a/scintilla/cocoa/ScintillaCocoa.h b/scintilla/cocoa/ScintillaCocoa.h index c12c7e8f..03847edc 100644 --- a/scintilla/cocoa/ScintillaCocoa.h +++ b/scintilla/cocoa/ScintillaCocoa.h @@ -14,11 +14,12 @@ */ #include -#include #include -#include #include +#include +#include +#include #include #include @@ -40,23 +41,26 @@ #include "XPM.h" #include "LineMarker.h" #include "Style.h" -#include "AutoComplete.h" #include "ViewStyle.h" #include "CharClassify.h" #include "Decoration.h" #include "CaseFolder.h" #include "Document.h" +#include "CaseConvert.h" #include "Selection.h" #include "PositionCache.h" +#include "EditModel.h" +#include "MarginView.h" +#include "EditView.h" #include "Editor.h" +#include "AutoComplete.h" #include "ScintillaBase.h" -#include "CaseConvert.h" extern "C" NSString* ScintillaRecPboardType; -@class InnerView; -@class MarginView; +@class SCIContentView; +@class SCIMarginView; @class ScintillaView; @class FindHighlightLayer; @@ -77,26 +81,6 @@ extern "C" NSString* ScintillaRecPboardType; namespace Scintilla { -/** - * On the Mac, there is no WM_COMMAND or WM_NOTIFY message that can be sent - * back to the parent. Therefore, there must be a callback handler that acts - * like a Windows WndProc, where Scintilla can send notifications to. Use - * ScintillaCocoa::RegisterNotifyHandler() to register such a handler. - * Message format is: - *
- * WM_COMMAND: HIWORD (wParam) = notification code, LOWORD (wParam) = 0 (no control ID), lParam = ScintillaCocoa* - *
- * WM_NOTIFY: wParam = 0 (no control ID), lParam = ptr to SCNotification structure, with hwndFrom set to ScintillaCocoa* - */ -typedef void(*SciNotifyFunc) (intptr_t windowid, unsigned int iMessage, uintptr_t wParam, uintptr_t lParam); - -/** - * Scintilla sends these two messages to the nofity handler. Please refer - * to the Windows API doc for details about the message format. - */ -#define WM_COMMAND 1001 -#define WM_NOTIFY 1002 - /** * Main scintilla class, implemented for OS X (Cocoa). */ @@ -105,7 +89,9 @@ class ScintillaCocoa : public ScintillaBase private: TimerTarget* timerTarget; NSEvent* lastMouseEvent; - + + id delegate; + SciNotifyFunc notifyProc; intptr_t notifyObj; @@ -119,20 +105,26 @@ private: bool GetPasteboardData(NSPasteboard* board, SelectionText* selectedText); void SetPasteboardData(NSPasteboard* board, const SelectionText& selectedText); - + int TargetAsUTF8(char *text); + int EncodedFromUTF8(char *utf8, char *encoded) const; + int scrollSpeed; int scrollTicks; NSTimer* tickTimer; NSTimer* idleTimer; CFRunLoopObserverRef observer; - + FindHighlightLayer *layerFindIndicator; protected: - Point GetVisibleOriginInMain(); - PRectangle GetClientRectangle(); + Point GetVisibleOriginInMain() const; + PRectangle GetClientRectangle() const; + virtual PRectangle GetClientDrawingRectangle(); Point ConvertPoint(NSPoint point); - + virtual void RedrawRect(PRectangle rc); + virtual void DiscardOverdraw(); + virtual void Redraw(); + virtual void Initialise(); virtual void Finalise(); virtual CaseFolder *CaseFolderForEncoding(); @@ -140,25 +132,30 @@ protected: virtual void CancelModes(); public: - ScintillaCocoa(InnerView* view, MarginView* viewMargin); + ScintillaCocoa(SCIContentView* view, SCIMarginView* viewMargin); virtual ~ScintillaCocoa(); + void SetDelegate(id delegate_); void RegisterNotifyCallback(intptr_t windowid, SciNotifyFunc callback); sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - ScintillaView* TopContainer(); - NSScrollView* ScrollContainer(); - InnerView* ContentView(); + NSScrollView* ScrollContainer() const; + SCIContentView* ContentView(); bool SyncPaint(void* gc, PRectangle rc); bool Draw(NSRect rect, CGContextRef gc); void PaintMargin(NSRect aRect); virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - void SetTicking(bool on); + void TickFor(TickReason reason); + bool FineTickerAvailable(); + bool FineTickerRunning(TickReason reason); + void FineTickerStart(TickReason reason, int millis, int tolerance); + void FineTickerCancel(TickReason reason); bool SetIdle(bool on); void SetMouseCapture(bool on); bool HaveMouseCapture(); + void WillDraw(NSRect rect); void ScrollText(int linesToMove); void SetVerticalScrollPos(); void SetHorizontalScrollPos(); @@ -188,9 +185,10 @@ public: virtual void ClaimSelection(); NSPoint GetCaretPosition(); - - static sptr_t DirectFunction(ScintillaCocoa *sciThis, unsigned int iMessage, uptr_t wParam, sptr_t lParam); + static sptr_t DirectFunction(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam); + + NSTimer *timers[tickPlatform+1]; void TimerFired(NSTimer* timer); void IdleTimerFired(); static void UpdateObserver(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *sci); @@ -199,7 +197,14 @@ public: virtual void IdleWork(); virtual void QueueIdleWork(WorkNeeded::workItems items, int upTo); int InsertText(NSString* input); + NSRange PositionsFromCharacters(NSRange range) const; + NSRange CharactersFromPositions(NSRange range) const; void SelectOnlyMainSelection(); + void ConvertSelectionVirtualSpace(); + bool ClearAllSelections(); + void CompositionStart(); + void CompositionCommit(); + void CompositionUndo(); virtual void SetDocPointer(Document *document); bool KeyboardInput(NSEvent* event); @@ -218,14 +223,14 @@ public: void DraggingExited(id info); bool PerformDragOperation(id info); void DragScroll(); - + // Promote some methods needed for NSResponder actions. virtual void SelectAll(); void DeleteBackward(); virtual void Cut(); virtual void Undo(); virtual void Redo(); - + virtual NSMenu* CreateContextMenu(NSEvent* event); void HandleCommand(NSInteger command); diff --git a/scintilla/cocoa/ScintillaCocoa.mm b/scintilla/cocoa/ScintillaCocoa.mm index 8b93521b..618b2cbd 100644 --- a/scintilla/cocoa/ScintillaCocoa.mm +++ b/scintilla/cocoa/ScintillaCocoa.mm @@ -2,7 +2,7 @@ /** * Scintilla source code edit control * ScintillaCocoa.mm - Cocoa subclass of ScintillaBase - * + * * Written by Mike Lischke * * Loosely based on ScintillaMacOSX.cxx. @@ -21,15 +21,13 @@ #import #import -#include "ScintillaView.h" -#include "PlatCocoa.h" +#import "Platform.h" +#import "ScintillaView.h" +#import "ScintillaCocoa.h" +#import "PlatCocoa.h" using namespace Scintilla; -#ifndef WM_UNICHAR -#define WM_UNICHAR 0x0109 -#endif - NSString* ScintillaRecPboardType = @"com.scintilla.utf16-plain-text.rectangular"; //-------------------------------------------------------------------------------------------------- @@ -197,7 +195,7 @@ static const KeyToCommand macMapDefault[] = self.anchorPoint = CGPointMake(0.5, 0.5); } return self; - + } const CGFloat paddingHighlightX = 4; @@ -206,23 +204,23 @@ const CGFloat paddingHighlightY = 2; -(void) drawInContext:(CGContextRef)context { if (!sFind || !sFont) return; - + CFStringRef str = CFStringRef(sFind); - + CFMutableDictionaryRef styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, - &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CGColorRef color = CGColorCreateGenericRGB(0.0, 0.0, 0.0, 1.0); CFDictionarySetValue(styleDict, kCTForegroundColorAttributeName, color); CTFontRef fontRef = ::CTFontCreateWithName((CFStringRef)sFont, fontSize, NULL); CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef); - + CFAttributedStringRef attrString = ::CFAttributedStringCreate(NULL, str, styleDict); CTLineRef textLine = ::CTLineCreateWithAttributedString(attrString); // Indent from corner of bounds CGContextSetTextPosition(context, paddingHighlightX, 3 + paddingHighlightY); CTLineDraw(textLine, context); - + CFRelease(textLine); CFRelease(attrString); CFRelease(fontRef); @@ -260,7 +258,7 @@ const CGFloat paddingHighlightY = 2; } [self setNeedsDisplay]; [CATransaction commit]; - + if (bounce) { CABasicAnimation *animBounce = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; animBounce.duration = 0.15; @@ -268,26 +266,26 @@ const CGFloat paddingHighlightY = 2; animBounce.removedOnCompletion = NO; animBounce.fromValue = [NSNumber numberWithFloat: 1.0]; animBounce.toValue = [NSNumber numberWithFloat: 1.25]; - + if (self.retaining) { - + [self addAnimation: animBounce forKey:@"animateFound"]; - + } else { - + CABasicAnimation *animFade = [CABasicAnimation animationWithKeyPath:@"opacity"]; animFade.duration = 0.1; animFade.beginTime = 0.4; animFade.removedOnCompletion = NO; animFade.fromValue = [NSNumber numberWithFloat: 1.0]; animFade.toValue = [NSNumber numberWithFloat: 0.0]; - + CAAnimationGroup *group = [CAAnimationGroup animation]; [group setDuration:0.5]; group.removedOnCompletion = NO; group.fillMode = kCAFillModeForwards; [group setAnimations:[NSArray arrayWithObjects:animBounce, animFade, nil]]; - + [self addAnimation:group forKey:@"animateFound"]; } } @@ -316,9 +314,9 @@ const CGFloat paddingHighlightY = 2; // Get the default notification queue for the thread which created the instance (usually the // main thread). We need that later for idle event processing. - NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; + NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; notificationQueue = [[NSNotificationQueue alloc] initWithNotificationCenter: center]; - [center addObserver: self selector: @selector(idleTriggered:) name: @"Idle" object: nil]; + [center addObserver: self selector: @selector(idleTriggered:) name: @"Idle" object: nil]; } return self; } @@ -356,11 +354,11 @@ const CGFloat paddingHighlightY = 2; // Post a new idle notification, which gets executed when the run loop is idle. // Since we are coalescing on name and sender there will always be only one actual notification // even for multiple requests. - NSNotification *notification = [NSNotification notificationWithName: @"Idle" object: self]; + NSNotification *notification = [NSNotification notificationWithName: @"Idle" object: self]; [notificationQueue enqueueNotification: notification postingStyle: NSPostWhenIdle coalesceMask: (NSNotificationCoalescingOnName | NSNotificationCoalescingOnSender) - forModes: nil]; + forModes: nil]; } //-------------------------------------------------------------------------------------------------- @@ -379,13 +377,14 @@ const CGFloat paddingHighlightY = 2; //----------------- ScintillaCocoa ----------------------------------------------------------------- -ScintillaCocoa::ScintillaCocoa(InnerView* view, MarginView* viewMargin) +ScintillaCocoa::ScintillaCocoa(SCIContentView* view, SCIMarginView* viewMargin) { vs.marginInside = false; wMain = view; // Don't retain since we're owned by view, which would cause a cycle wMargin = viewMargin; timerTarget = [[TimerTarget alloc] init: this]; lastMouseEvent = NULL; + delegate = NULL; notifyObj = NULL; notifyProc = NULL; capturedMouse = false; @@ -396,6 +395,11 @@ ScintillaCocoa::ScintillaCocoa(InnerView* view, MarginView* viewMargin) idleTimer = NULL; observer = NULL; layerFindIndicator = NULL; + imeInteraction = imeInline; + for (TickReason tr=tickCaret; tr<=tickPlatform; tr = static_cast(tr+1)) + { + timers[tr] = nil; + } Initialise(); } @@ -412,20 +416,20 @@ ScintillaCocoa::~ScintillaCocoa() /** * Core initialization of the control. Everything that needs to be set up happens here. */ -void ScintillaCocoa::Initialise() +void ScintillaCocoa::Initialise() { Scintilla_LinkLexers(); - + // Tell Scintilla not to buffer: Quartz buffers drawing for us. WndProc(SCI_SETBUFFEREDDRAW, 0, 0); - + // We are working with Unicode exclusively. WndProc(SCI_SETCODEPAGE, SC_CP_UTF8, 0); // Add Mac specific key bindings. - for (int i = 0; macMapDefault[i].key; i++) + for (int i = 0; macMapDefault[i].key; i++) kmap.AssignCmdKey(macMapDefault[i].key, macMapDefault[i].modifiers, macMapDefault[i].msg); - + } //-------------------------------------------------------------------------------------------------- @@ -436,13 +440,16 @@ void ScintillaCocoa::Initialise() void ScintillaCocoa::Finalise() { ObserverRemove(); - SetTicking(false); + for (TickReason tr=tickCaret; tr<=tickPlatform; tr = static_cast(tr+1)) + { + FineTickerCancel(tr); + } ScintillaBase::Finalise(); } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::UpdateObserver(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info) { +void ScintillaCocoa::UpdateObserver(CFRunLoopObserverRef /* observer */, CFRunLoopActivity /* activity */, void *info) { ScintillaCocoa* sci = reinterpret_cast(info); sci->IdleWork(); } @@ -508,7 +515,7 @@ static char *EncodedBytes(CFStringRef cfsRef, CFStringEncoding encoding) { CFIndex usedLen = 0; CFStringGetBytes(cfsRef, rangeAll, encoding, '?', false, NULL, 0, &usedLen); - + char *buffer = new char[usedLen+1]; CFStringGetBytes(cfsRef, rangeAll, encoding, '?', false, (UInt8 *)buffer,usedLen, NULL); @@ -518,6 +525,26 @@ static char *EncodedBytes(CFStringRef cfsRef, CFStringEncoding encoding) { //-------------------------------------------------------------------------------------------------- +/** + * Convert a core foundation string into a std::string in a particular encoding + */ + +static std::string EncodedBytesString(CFStringRef cfsRef, CFStringEncoding encoding) { + const CFRange rangeAll = {0, CFStringGetLength(cfsRef)}; + CFIndex usedLen = 0; + CFStringGetBytes(cfsRef, rangeAll, encoding, '?', false, + NULL, 0, &usedLen); + + std::string buffer(usedLen, '\0'); + if (usedLen > 0) { + CFStringGetBytes(cfsRef, rangeAll, encoding, '?', false, + reinterpret_cast(&buffer[0]), usedLen, NULL); + } + return buffer; +} + +//-------------------------------------------------------------------------------------------------- + /** * Case folders. */ @@ -525,7 +552,7 @@ static char *EncodedBytes(CFStringRef cfsRef, CFStringEncoding encoding) { class CaseFolderDBCS : public CaseFolderTable { CFStringEncoding encoding; public: - CaseFolderDBCS(CFStringEncoding encoding_) : encoding(encoding_) { + explicit CaseFolderDBCS(CFStringEncoding encoding_) : encoding(encoding_) { StandardASCII(); } virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { @@ -534,12 +561,12 @@ public: return 1; } else { CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, - reinterpret_cast(mixed), + reinterpret_cast(mixed), lenMixed, encoding, false); NSString *sMapped = [(NSString *)cfsVal stringByFoldingWithOptions:NSCaseInsensitiveSearch locale:[NSLocale currentLocale]]; - + char *encoded = EncodedBytes((CFStringRef)sMapped, encoding); size_t lenMapped = strlen(encoded); @@ -553,9 +580,6 @@ public: CFRelease(cfsVal); return lenMapped; } - // Something failed so return a single NUL byte - folded[0] = '\0'; - return 1; } }; @@ -571,22 +595,22 @@ CaseFolder *ScintillaCocoa::CaseFolderForEncoding() { // Only for single byte encodings for (int i=0x80; i<0x100; i++) { char sCharacter[2] = "A"; - sCharacter[0] = i; + sCharacter[0] = static_cast(i); CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, - reinterpret_cast(sCharacter), + reinterpret_cast(sCharacter), 1, encoding, false); if (!cfsVal) continue; - + NSString *sMapped = [(NSString *)cfsVal stringByFoldingWithOptions:NSCaseInsensitiveSearch locale:[NSLocale currentLocale]]; - + char *encoded = EncodedBytes((CFStringRef)sMapped, encoding); - + if (strlen(encoded) == 1) { pcf->SetTranslation(sCharacter[0], encoded[0]); } - + delete []encoded; CFRelease(cfsVal); } @@ -608,10 +632,10 @@ std::string ScintillaCocoa::CaseMapString(const std::string &s, int caseMapping) { if ((s.size() == 0) || (caseMapping == cmSame)) return s; - + if (IsUnicodeMode()) { std::string retMapped(s.length() * maxExpansionCaseConversion, 0); - size_t lenMapped = CaseConvertString(&retMapped[0], retMapped.length(), s.c_str(), s.length(), + size_t lenMapped = CaseConvertString(&retMapped[0], retMapped.length(), s.c_str(), s.length(), (caseMapping == cmUpper) ? CaseConversionUpper : CaseConversionLower); retMapped.resize(lenMapped); return retMapped; @@ -620,7 +644,7 @@ std::string ScintillaCocoa::CaseMapString(const std::string &s, int caseMapping) CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), vs.styles[STYLE_DEFAULT].characterSet); CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, - reinterpret_cast(s.c_str()), + reinterpret_cast(s.c_str()), s.length(), encoding, false); NSString *sMapped; @@ -656,21 +680,10 @@ void ScintillaCocoa::CancelModes() { //-------------------------------------------------------------------------------------------------- -/** - * Helper function to get the outer container which represents the Scintilla editor on application side. - */ -ScintillaView* ScintillaCocoa::TopContainer() -{ - NSView* container = static_cast(wMain.GetID()); - return static_cast([[[container superview] superview] superview]); -} - -//-------------------------------------------------------------------------------------------------- - /** * Helper function to get the scrolling view. */ -NSScrollView* ScintillaCocoa::ScrollContainer() { +NSScrollView* ScintillaCocoa::ScrollContainer() const { NSView* container = static_cast(wMain.GetID()); return static_cast([[container superview] superview]); } @@ -680,9 +693,9 @@ NSScrollView* ScintillaCocoa::ScrollContainer() { /** * Helper function to get the inner container which represents the actual "canvas" we work with. */ -InnerView* ScintillaCocoa::ContentView() +SCIContentView* ScintillaCocoa::ContentView() { - return static_cast(wMain.GetID()); + return static_cast(wMain.GetID()); } //-------------------------------------------------------------------------------------------------- @@ -690,11 +703,11 @@ InnerView* ScintillaCocoa::ContentView() /** * Return the top left visible point relative to the origin point of the whole document. */ -Scintilla::Point ScintillaCocoa::GetVisibleOriginInMain() +Scintilla::Point ScintillaCocoa::GetVisibleOriginInMain() const { NSScrollView *scrollView = ScrollContainer(); NSRect contentRect = [[scrollView contentView] bounds]; - return Point(contentRect.origin.x, contentRect.origin.y); + return Point(static_cast(contentRect.origin.x), static_cast(contentRect.origin.y)); } //-------------------------------------------------------------------------------------------------- @@ -704,12 +717,30 @@ Scintilla::Point ScintillaCocoa::GetVisibleOriginInMain() * in order to make scrolling working properly. * The returned value is in document coordinates. */ -PRectangle ScintillaCocoa::GetClientRectangle() +PRectangle ScintillaCocoa::GetClientRectangle() const { NSScrollView *scrollView = ScrollContainer(); NSSize size = [[scrollView contentView] bounds].size; Point origin = GetVisibleOriginInMain(); - return PRectangle(origin.x, origin.y, origin.x+size.width, origin.y + size.height); + return PRectangle(origin.x, origin.y, static_cast(origin.x+size.width), + static_cast(origin.y + size.height)); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Allow for prepared rectangle + */ +PRectangle ScintillaCocoa::GetClientDrawingRectangle() { +#if MAC_OS_X_VERSION_MAX_ALLOWED > 1080 + NSView *content = ContentView(); + if ([content respondsToSelector: @selector(setPreparedContentRect:)]) { + NSRect rcPrepared = [content preparedContentRect]; + if (!NSIsEmptyRect(rcPrepared)) + return NSRectToPRectangle(rcPrepared); + } +#endif + return ScintillaCocoa::GetClientRectangle(); } //-------------------------------------------------------------------------------------------------- @@ -717,33 +748,69 @@ PRectangle ScintillaCocoa::GetClientRectangle() /** * Converts the given point from base coordinates to local coordinates and at the same time into * a native Point structure. Base coordinates are used for the top window used in the view hierarchy. - * Returned value is in view coordinates. + * Returned value is in view coordinates. */ Scintilla::Point ScintillaCocoa::ConvertPoint(NSPoint point) { NSView* container = ContentView(); NSPoint result = [container convertPoint: point fromView: nil]; Scintilla::Point ptOrigin = GetVisibleOriginInMain(); - return Point(result.x - ptOrigin.x, result.y - ptOrigin.y); + return Point(static_cast(result.x - ptOrigin.x), static_cast(result.y - ptOrigin.y)); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Do not clip like superclass as Cocoa is not reporting all of prepared area. + */ +void ScintillaCocoa::RedrawRect(PRectangle rc) +{ + if (!rc.Empty()) + wMain.InvalidateRectangle(rc); +} + +//-------------------------------------------------------------------------------------------------- + +void ScintillaCocoa::DiscardOverdraw() +{ +#if MAC_OS_X_VERSION_MAX_ALLOWED > 1080 + // If running on 10.9, reset prepared area to visible area + NSView *content = ContentView(); + if ([content respondsToSelector: @selector(setPreparedContentRect:)]) { + content.preparedContentRect = [content visibleRect]; + } +#endif +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Ensure all of prepared content is also redrawn. + */ +void ScintillaCocoa::Redraw() +{ + wMargin.InvalidateAll(); + DiscardOverdraw(); + wMain.InvalidateAll(); } //-------------------------------------------------------------------------------------------------- /** * A function to directly execute code that would usually go the long way via window messages. - * However this is a Windows metapher and not used here, hence we just call our fake + * However this is a Windows metaphor and not used here, hence we just call our fake * window proc. The given parameters directly reflect the message parameters used on Windows. * - * @param sciThis The target which is to be called. + * @param ptr The target which is to be called. * @param iMessage A code that indicates which message was sent. - * @param wParam One of the two free parameters for the message. Traditionally a word sized parameter + * @param wParam One of the two free parameters for the message. Traditionally a word sized parameter * (hence the w prefix). * @param lParam The other of the two free parameters. A signed long. */ -sptr_t ScintillaCocoa::DirectFunction(ScintillaCocoa *sciThis, unsigned int iMessage, uptr_t wParam, +sptr_t ScintillaCocoa::DirectFunction(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { - return sciThis->WndProc(iMessage, wParam, lParam); + return reinterpret_cast(ptr)->WndProc(iMessage, wParam, lParam); } //-------------------------------------------------------------------------------------------------- @@ -755,8 +822,7 @@ sptr_t ScintillaCocoa::DirectFunction(ScintillaCocoa *sciThis, unsigned int iMes sptr_t scintilla_send_message(void* sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { ScintillaView *control = reinterpret_cast(sci); - ScintillaCocoa* scintilla = [control backend]; - return scintilla->WndProc(iMessage, wParam, lParam); + return [control message:iMessage wParam:wParam lParam:lParam]; } //-------------------------------------------------------------------------------------------------- @@ -766,7 +832,7 @@ sptr_t scintilla_send_message(void* sci, unsigned int iMessage, uptr_t wParam, s * commands (also used to synchronize UI and background threads), which is not the case in Cocoa. * * Messages handled here are almost solely for special commands of the backend. Everything which - * would be sytem messages on Windows (e.g. for key down, mouse move etc.) are handled by + * would be system messages on Windows (e.g. for key down, mouse move etc.) are handled by * directly calling appropriate handlers. */ sptr_t ScintillaCocoa::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) @@ -775,47 +841,45 @@ sptr_t ScintillaCocoa::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPar { case SCI_GETDIRECTFUNCTION: return reinterpret_cast(DirectFunction); - + case SCI_GETDIRECTPOINTER: return reinterpret_cast(this); - + + case SCI_TARGETASUTF8: + return TargetAsUTF8(reinterpret_cast(lParam)); + + case SCI_ENCODEDFROMUTF8: + return EncodedFromUTF8(reinterpret_cast(wParam), + reinterpret_cast(lParam)); + + case SCI_SETIMEINTERACTION: + // Only inline IME supported on Cocoa + break; + case SCI_GRABFOCUS: [[ContentView() window] makeFirstResponder:ContentView()]; break; - + case SCI_SETBUFFEREDDRAW: // Buffered drawing not supported on Cocoa - bufferedDraw = false; + view.bufferedDraw = false; break; - + case SCI_FINDINDICATORSHOW: ShowFindIndicatorForRange(NSMakeRange(wParam, lParam-wParam), YES); return 0; - + case SCI_FINDINDICATORFLASH: ShowFindIndicatorForRange(NSMakeRange(wParam, lParam-wParam), NO); return 0; - + case SCI_FINDINDICATORHIDE: HideFindIndicator(); return 0; - - case WM_UNICHAR: - // Special case not used normally. Characters passed in this way will be inserted - // regardless of their value or modifier states. That means no command interpretation is - // performed. - if (IsUnicodeMode()) - { - NSString* input = [NSString stringWithCharacters: (const unichar*) &wParam length: 1]; - const char* utf8 = [input UTF8String]; - AddCharUTF((char*) utf8, static_cast(strlen(utf8)), false); - return 1; - } - return 0; - + default: sptr_t r = ScintillaBase::WndProc(iMessage, wParam, lParam); - + return r; } return 0l; @@ -824,7 +888,7 @@ sptr_t ScintillaCocoa::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPar //-------------------------------------------------------------------------------------------------- /** - * In Windows lingo this is the handler which handles anything that wasn't handled in the normal + * In Windows lingo this is the handler which handles anything that wasn't handled in the normal * window proc which would usually send the message back to generic window proc that Windows uses. */ sptr_t ScintillaCocoa::DefWndProc(unsigned int, uptr_t, sptr_t) @@ -835,32 +899,72 @@ sptr_t ScintillaCocoa::DefWndProc(unsigned int, uptr_t, sptr_t) //-------------------------------------------------------------------------------------------------- /** - * Enables or disables a timer that can trigger background processing at a regular interval, like - * drag scrolling or caret blinking. + * Handle any ScintillaCocoa-specific ticking or call superclass. */ -void ScintillaCocoa::SetTicking(bool on) +void ScintillaCocoa::TickFor(TickReason reason) { - if (timer.ticking != on) + if (reason == tickPlatform) { - timer.ticking = on; - if (timer.ticking) - { - // Scintilla ticks = milliseconds - tickTimer = [NSTimer scheduledTimerWithTimeInterval: timer.tickSize / 1000.0 - target: timerTarget - selector: @selector(timerFired:) - userInfo: nil - repeats: YES]; - timer.tickerID = reinterpret_cast(tickTimer); - } - else - if (timer.tickerID != NULL) - { - [reinterpret_cast(timer.tickerID) invalidate]; - timer.tickerID = 0; - } + DragScroll(); + } + else + { + Editor::TickFor(reason); + } +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Report that this Editor subclass has a working implementation of FineTickerStart. + */ +bool ScintillaCocoa::FineTickerAvailable() +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Is a particular timer currently running? + */ +bool ScintillaCocoa::FineTickerRunning(TickReason reason) +{ + return timers[reason] != nil; +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Start a fine-grained timer. + */ +void ScintillaCocoa::FineTickerStart(TickReason reason, int millis, int tolerance) +{ + FineTickerCancel(reason); + NSTimer *fineTimer = [NSTimer scheduledTimerWithTimeInterval: millis / 1000.0 + target: timerTarget + selector: @selector(timerFired:) + userInfo: nil + repeats: YES]; + if (tolerance && [fineTimer respondsToSelector: @selector(setTolerance:)]) + { + [fineTimer setTolerance: tolerance / 1000.0]; + } + timers[reason] = fineTimer; +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Cancel a fine-grained timer. + */ +void ScintillaCocoa::FineTickerCancel(TickReason reason) +{ + if (timers[reason]) + { + [timers[reason] invalidate]; + timers[reason] = nil; } - timer.ticksToWait = caret.period; } //-------------------------------------------------------------------------------------------------- @@ -915,7 +1019,7 @@ bool ScintillaCocoa::CanPaste() { if (!Editor::CanPaste()) return false; - + return GetPasteboardData([NSPasteboard generalPasteboard], NULL); } @@ -937,25 +1041,17 @@ void ScintillaCocoa::Paste(bool forceRectangular) bool ok = GetPasteboardData([NSPasteboard generalPasteboard], &selectedText); if (forceRectangular) selectedText.rectangular = forceRectangular; - + if (!ok || selectedText.Empty()) // No data or no flavor we support. return; - + pdoc->BeginUndoAction(); ClearSelection(false); - int length = selectedText.Length(); - if (selectedText.rectangular) - { - SelectionPosition selStart = sel.RangeMain().Start(); - PasteRectangular(selStart, selectedText.Data(), length); - } - else - if (pdoc->InsertString(sel.RangeMain().caret.Position(), selectedText.Data(), length)) - SetEmptySelection(sel.RangeMain().caret.Position() + length); - + InsertPasteShape(selectedText.Data(), static_cast(selectedText.Length()), + selectedText.rectangular ? pasteRectangular : pasteStream); pdoc->EndUndoAction(); - + Redraw(); EnsureCaretVisible(); } @@ -989,7 +1085,7 @@ void ScintillaCocoa::CTPaint(void* gc, NSRect rc) { if (self) { sci = NULL; } - + return self; } @@ -1029,15 +1125,25 @@ void ScintillaCocoa::CTPaint(void* gc, NSRect rc) { void ScintillaCocoa::CallTipMouseDown(NSPoint pt) { NSRect rectBounds = [(NSView *)(ct.wDraw.GetID()) bounds]; - Point location(pt.x, rectBounds.size.height - pt.y); + Point location(static_cast(pt.x), + static_cast(rectBounds.size.height - pt.y)); ct.MouseClick(location); CallTipClick(); } +static bool HeightDifferent(WindowID wCallTip, PRectangle rc) { + NSWindow *callTip = (NSWindow *)wCallTip; + CGFloat height = NSHeight([callTip frame]); + return height != rc.Height(); +} + void ScintillaCocoa::CreateCallTipWindow(PRectangle rc) { + if (ct.wCallTip.Created() && HeightDifferent(ct.wCallTip.GetID(), rc)) { + ct.wCallTip.Destroy(); + } if (!ct.wCallTip.Created()) { NSRect ctRect = NSMakeRect(rc.top,rc.bottom, rc.Width(), rc.Height()); - NSWindow *callTip = [[NSWindow alloc] initWithContentRect: ctRect + NSWindow *callTip = [[NSWindow alloc] initWithContentRect: ctRect styleMask: NSBorderlessWindowMask backing: NSBackingStoreBuffered defer: NO]; @@ -1060,7 +1166,7 @@ void ScintillaCocoa::AddToPopUp(const char *label, int cmd, bool enabled) ScintillaContextMenu *menu= reinterpret_cast(popup.GetID()); [menu setOwner: this]; [menu setAutoenablesItems: NO]; - + if (cmd == 0) { item = [NSMenuItem separatorItem]; } else { @@ -1071,7 +1177,7 @@ void ScintillaCocoa::AddToPopUp(const char *label, int cmd, bool enabled) [item setAction: @selector(handleCommand:)]; [item setTag: cmd]; [item setEnabled: enabled]; - + [menu addItem: item]; } @@ -1090,10 +1196,11 @@ void ScintillaCocoa::ClaimSelection() */ NSPoint ScintillaCocoa::GetCaretPosition() { + const int line = pdoc->LineFromPosition(sel.RangeMain().caret.Position()); NSPoint result; - result.y = pdoc->LineFromPosition(sel.RangeMain().caret.Position()); - result.x = sel.RangeMain().caret.Position() - pdoc->LineStart(result.y); + result.y = line; + result.x = sel.RangeMain().caret.Position() - pdoc->LineStart(line); return result; } @@ -1117,7 +1224,7 @@ void ScintillaCocoa::DragScroll() int line = pdoc->LineFromPosition(posDrag.Position()); int currentVisibleLine = cs.DisplayFromDoc(line); int lastVisibleLine = Platform::Minimum(topLine + LinesOnScreen(), cs.LinesDisplayed()) - 2; - + if (currentVisibleLine <= topLine && topLine > 0) ScrollTo(topLine - scrollSpeed); else @@ -1129,9 +1236,9 @@ void ScintillaCocoa::DragScroll() scrollTicks = 2000; return; } - + // TODO: also handle horizontal scrolling. - + if (scrollSpeed == 1) { scrollTicks -= timer.tickSize; @@ -1141,9 +1248,63 @@ void ScintillaCocoa::DragScroll() scrollTicks = 2000; } } - + } +//----------------- DragProviderSource ------------------------------------------------------- + +@interface DragProviderSource : NSObject +{ + SelectionText selectedText; +} + +@end + +@implementation DragProviderSource + +- (id)initWithSelectedText:(const SelectionText *)other +{ + self = [super init]; + + if (self) { + selectedText.Copy(*other); + } + + return self; +} + +- (void)pasteboard:(NSPasteboard *)pasteboard item:(NSPasteboardItem *)item provideDataForType:(NSString *)type +{ + if (selectedText.Length() == 0) + return; + + if (([type compare: NSPasteboardTypeString] != NSOrderedSame) && + ([type compare: ScintillaRecPboardType] != NSOrderedSame)) + return; + + CFStringEncoding encoding = EncodingFromCharacterSet(selectedText.codePage == SC_CP_UTF8, + selectedText.characterSet); + CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, + reinterpret_cast(selectedText.Data()), + selectedText.Length(), encoding, false); + + if ([type compare: NSPasteboardTypeString] == NSOrderedSame) + { + [pasteboard setString:(NSString *)cfsVal forType: NSStringPboardType]; + } + else if ([type compare: ScintillaRecPboardType] == NSOrderedSame) + { + // This is specific to scintilla, allows us to drag rectangular selections around the document. + if (selectedText.rectangular) + [pasteboard setString:(NSString *)cfsVal forType: ScintillaRecPboardType]; + } + + if (cfsVal) + CFRelease(cfsVal); +} + +@end + //-------------------------------------------------------------------------------------------------- /** @@ -1154,12 +1315,16 @@ void ScintillaCocoa::StartDrag() if (sel.Empty()) return; + inDragDrop = ddDragging; + + FineTickerStart(tickPlatform, timer.tickSize, 0); + // Put the data to be dragged on the drag pasteboard. SelectionText selectedText; NSPasteboard* pasteboard = [NSPasteboard pasteboardWithName: NSDragPboard]; CopySelectionRange(&selectedText); SetPasteboardData(pasteboard, selectedText); - + // calculate the bounds of the selection PRectangle client = GetTextRectangle(); int selStart = sel.RangeMain().Start().Position(); @@ -1168,14 +1333,14 @@ void ScintillaCocoa::StartDrag() int endLine = pdoc->LineFromPosition(selEnd); Point pt; long startPos, endPos, ep; - Rect rcSel; - + PRectangle rcSel; + if (startLine==endLine && WndProc(SCI_GETWRAPMODE, 0, 0) != SC_WRAP_NONE) { // Komodo bug http://bugs.activestate.com/show_bug.cgi?id=87571 // Scintilla bug https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3040200&group_id=2439 // If the width on a wrapped-line selection is negative, // find a better bounding rectangle. - + Point ptStart, ptEnd; startPos = WndProc(SCI_GETLINESELSTARTPOSITION, startLine, 0); endPos = WndProc(SCI_GETLINESELENDPOSITION, startLine, 0); @@ -1229,47 +1394,45 @@ void ScintillaCocoa::StartDrag() } // must convert to global coordinates for drag regions, but also save the // image rectangle for further calculations and copy operations - PRectangle localRectangle = PRectangle(rcSel.left, rcSel.top, rcSel.right, rcSel.bottom); - + // Prepare drag image. - NSRect selectionRectangle = PRectangleToNSRect(localRectangle); - - NSView* content = ContentView(); - -#if 1 + NSRect selectionRectangle = PRectangleToNSRect(rcSel); + + SCIContentView* content = ContentView(); // To get a bitmap of the text we're dragging, we just use Paint on a pixmap surface. SurfaceImpl *sw = new SurfaceImpl(); SurfaceImpl *pixmap = NULL; - - bool lastHideSelection = hideSelection; - hideSelection = true; + + bool lastHideSelection = view.hideSelection; + view.hideSelection = true; if (sw) { pixmap = new SurfaceImpl(); if (pixmap) { - PRectangle imageRect = NSRectToPRectangle(selectionRectangle); + PRectangle imageRect = rcSel; paintState = painting; - sw->InitPixMap(client.Width(), client.Height(), NULL, NULL); + sw->InitPixMap(static_cast(client.Width()), static_cast(client.Height()), NULL, NULL); paintingAllText = true; - // Have to create a new context and make current as text drawing goes + // Have to create a new context and make current as text drawing goes // to the current context, not a passed context. - CGContextRef gcsw = sw->GetContext(); - NSGraphicsContext *nsgc = [NSGraphicsContext graphicsContextWithGraphicsPort: gcsw + CGContextRef gcsw = sw->GetContext(); + NSGraphicsContext *nsgc = [NSGraphicsContext graphicsContextWithGraphicsPort: gcsw flipped: YES]; [NSGraphicsContext setCurrentContext:nsgc]; + CGContextTranslateCTM(gcsw, -client.left, -client.top); Paint(sw, client); paintState = notPainting; - - pixmap->InitPixMap(imageRect.Width(), imageRect.Height(), NULL, NULL); - - CGContextRef gc = pixmap->GetContext(); + + pixmap->InitPixMap(static_cast(imageRect.Width()), static_cast(imageRect.Height()), NULL, NULL); + + CGContextRef gc = pixmap->GetContext(); // To make Paint() work on a bitmap, we have to flip our coordinates and translate the origin CGContextTranslateCTM(gc, 0, imageRect.Height()); CGContextScaleCTM(gc, 1.0, -1.0); - - pixmap->CopyImageRectangle(*sw, imageRect, PRectangle(0, 0, imageRect.Width(), imageRect.Height())); + + pixmap->CopyImageRectangle(*sw, imageRect, PRectangle(0.0f, 0.0f, imageRect.Width(), imageRect.Height())); // XXX TODO: overwrite any part of the image that is not part of the // selection to make it transparent. right now we just use // the full rectangle which may include non-selected text. @@ -1277,46 +1440,52 @@ void ScintillaCocoa::StartDrag() sw->Release(); delete sw; } - hideSelection = lastHideSelection; - + view.hideSelection = lastHideSelection; + NSBitmapImageRep* bitmap = NULL; if (pixmap) { CGImageRef imagePixmap = pixmap->GetImage(); - bitmap = [[[NSBitmapImageRep alloc] initWithCGImage: imagePixmap] autorelease]; + if (imagePixmap) + bitmap = [[[NSBitmapImageRep alloc] initWithCGImage: imagePixmap] autorelease]; CGImageRelease(imagePixmap); pixmap->Release(); delete pixmap; } -#else - - // Poor man's drag image: take a snapshot of the content view. - [content lockFocus]; - NSBitmapImageRep* bitmap = [[[NSBitmapImageRep alloc] initWithFocusedViewRect: selectionRectangle] autorelease]; - [bitmap setColorSpaceName: NSDeviceRGBColorSpace]; - [content unlockFocus]; - -#endif - + NSImage* image = [[[NSImage alloc] initWithSize: selectionRectangle.size] autorelease]; [image addRepresentation: bitmap]; - + NSImage* dragImage = [[[NSImage alloc] initWithSize: selectionRectangle.size] autorelease]; [dragImage setBackgroundColor: [NSColor clearColor]]; [dragImage lockFocus]; - [image dissolveToPoint: NSMakePoint(0.0, 0.0) fraction: 0.5]; + [image drawAtPoint: NSZeroPoint fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 0.5]; [dragImage unlockFocus]; - + NSPoint startPoint; - startPoint.x = selectionRectangle.origin.x; - startPoint.y = selectionRectangle.origin.y + selectionRectangle.size.height; - [content dragImage: dragImage - at: startPoint - offset: NSZeroSize - event: lastMouseEvent // Set in MouseMove. - pasteboard: pasteboard - source: content - slideBack: YES]; + startPoint.x = selectionRectangle.origin.x + client.left; + startPoint.y = selectionRectangle.origin.y + selectionRectangle.size.height + client.top; + + NSPasteboardItem *pbItem = [NSPasteboardItem new]; + DragProviderSource *dps = [[[DragProviderSource alloc] initWithSelectedText:&selectedText] autorelease]; + + NSArray *pbTypes = selectedText.rectangular ? + @[NSPasteboardTypeString, ScintillaRecPboardType] : + @[NSPasteboardTypeString]; + [pbItem setDataProvider:dps forTypes:pbTypes]; + NSDraggingItem *dragItem = [[NSDraggingItem alloc ]initWithPasteboardWriter:pbItem]; + [pbItem release]; + + NSScrollView *scrollContainer = ScrollContainer(); + NSRect contentRect = [[scrollContainer contentView] bounds]; + NSRect draggingRect = NSOffsetRect(selectionRectangle, contentRect.origin.x, contentRect.origin.y); + [dragItem setDraggingFrame:draggingRect contents:dragImage]; + NSDraggingSession *dragSession = + [content beginDraggingSessionWithItems:@[[dragItem autorelease]] + event:lastMouseEvent + source:content]; + dragSession.animatesToStartingPositionsOnCancelOrFail = YES; + dragSession.draggingFormation = NSDraggingFormationNone; } //-------------------------------------------------------------------------------------------------- @@ -1326,7 +1495,7 @@ void ScintillaCocoa::StartDrag() */ NSDragOperation ScintillaCocoa::DraggingEntered(id info) { - inDragDrop = ddDragging; + FineTickerStart(tickPlatform, timer.tickSize, 0); return DraggingUpdated(info); } @@ -1339,22 +1508,22 @@ NSDragOperation ScintillaCocoa::DraggingEntered(id info) */ NSDragOperation ScintillaCocoa::DraggingUpdated(id info) { - // Convert the drag location from window coordinates to view coordinates and + // Convert the drag location from window coordinates to view coordinates and // from there to a text position to finally set the drag position. Point location = ConvertPoint([info draggingLocation]); SetDragPosition(SPositionFromLocation(location)); - + NSDragOperation sourceDragMask = [info draggingSourceOperationMask]; if (sourceDragMask == NSDragOperationNone) return sourceDragMask; - + NSPasteboard* pasteboard = [info draggingPasteboard]; - + // Return what type of operation we will perform. Prefer move over copy. if ([[pasteboard types] containsObject: NSStringPboardType] || [[pasteboard types] containsObject: ScintillaRecPboardType]) return (sourceDragMask & NSDragOperationMove) ? NSDragOperationMove : NSDragOperationCopy; - + if ([[pasteboard types] containsObject: NSFilenamesPboardType]) return (sourceDragMask & NSDragOperationGeneric); return NSDragOperationNone; @@ -1369,6 +1538,7 @@ void ScintillaCocoa::DraggingExited(id info) { #pragma unused(info) SetDragPosition(SelectionPosition(invalidPosition)); + FineTickerCancel(tickPlatform); inDragDrop = ddNone; } @@ -1380,7 +1550,7 @@ void ScintillaCocoa::DraggingExited(id info) bool ScintillaCocoa::PerformDragOperation(id info) { NSPasteboard* pasteboard = [info draggingPasteboard]; - + if ([[pasteboard types] containsObject: NSFilenamesPboardType]) { NSArray* files = [pasteboard propertyListForType: NSFilenamesPboardType]; @@ -1391,12 +1561,12 @@ bool ScintillaCocoa::PerformDragOperation(id info) { SelectionText text; GetPasteboardData(pasteboard, &text); - + if (text.Length() > 0) { NSDragOperation operation = [info draggingSourceOperationMask]; bool moving = (operation & NSDragOperationMove) != 0; - + DropAt(posDrag, text.Data(), text.Length(), moving, text.rectangular); }; } @@ -1421,13 +1591,13 @@ void ScintillaCocoa::SetPasteboardData(NSPasteboard* board, const SelectionText [NSArray arrayWithObjects: NSStringPboardType, ScintillaRecPboardType, nil] : [NSArray arrayWithObjects: NSStringPboardType, nil]; [board declareTypes:pbTypes owner:nil]; - + if (selectedText.rectangular) { // This is specific to scintilla, allows us to drag rectangular selections around the document. [board setString: (NSString *)cfsVal forType: ScintillaRecPboardType]; } - + [board setString: (NSString *)cfsVal forType: NSStringPboardType]; if (cfsVal) @@ -1441,12 +1611,12 @@ void ScintillaCocoa::SetPasteboardData(NSPasteboard* board, const SelectionText */ bool ScintillaCocoa::GetPasteboardData(NSPasteboard* board, SelectionText* selectedText) { - NSArray* supportedTypes = [NSArray arrayWithObjects: ScintillaRecPboardType, - NSStringPboardType, + NSArray* supportedTypes = [NSArray arrayWithObjects: ScintillaRecPboardType, + NSStringPboardType, nil]; NSString *bestType = [board availableTypeFromArray: supportedTypes]; NSString* data = [board stringForType: bestType]; - + if (data != nil) { if (selectedText != nil) @@ -1459,26 +1629,87 @@ bool ScintillaCocoa::GetPasteboardData(NSPasteboard* board, SelectionText* selec false, NULL, 0, &usedLen); std::vector buffer(usedLen); - + CFStringGetBytes((CFStringRef)data, rangeAll, encoding, '?', false, buffer.data(),usedLen, NULL); bool rectangular = bestType == ScintillaRecPboardType; - int len = static_cast(usedLen); - std::string dest = Document::TransformLineEnds((char *)buffer.data(), len, pdoc->eolMode); + std::string dest(reinterpret_cast(buffer.data()), usedLen); selectedText->Copy(dest, pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet , rectangular, false); } return true; } - + return false; } //-------------------------------------------------------------------------------------------------- +// Returns the target converted to UTF8. +// Return the length in bytes. +int ScintillaCocoa::TargetAsUTF8(char *text) +{ + const int targetLength = targetEnd - targetStart; + if (IsUnicodeMode()) + { + if (text) + pdoc->GetCharRange(text, targetStart, targetLength); + } + else + { + // Need to convert + const CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), + vs.styles[STYLE_DEFAULT].characterSet); + const std::string s = RangeText(targetStart, targetEnd); + CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, + reinterpret_cast(s.c_str()), + s.length(), encoding, false); + + const std::string tmputf = EncodedBytesString(cfsVal, kCFStringEncodingUTF8); + + if (text) + memcpy(text, tmputf.c_str(), tmputf.length()); + CFRelease(cfsVal); + return tmputf.length(); + } + return targetLength; +} + +//-------------------------------------------------------------------------------------------------- + +// Translates a UTF8 string into the document encoding. +// Return the length of the result in bytes. +int ScintillaCocoa::EncodedFromUTF8(char *utf8, char *encoded) const +{ + const int inputLength = (lengthForEncode >= 0) ? lengthForEncode : strlen(utf8); + if (IsUnicodeMode()) + { + if (encoded) + memcpy(encoded, utf8, inputLength); + return inputLength; + } + else + { + // Need to convert + const CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), + vs.styles[STYLE_DEFAULT].characterSet); + + CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, + reinterpret_cast(utf8), + inputLength, kCFStringEncodingUTF8, false); + const std::string sEncoded = EncodedBytesString(cfsVal, encoding); + if (encoded) + memcpy(encoded, sEncoded.c_str(), sEncoded.length()); + CFRelease(cfsVal); + return sEncoded.length(); + } +} + +//-------------------------------------------------------------------------------------------------- + void ScintillaCocoa::SetMouseCapture(bool on) { capturedMouse = on; @@ -1510,12 +1741,9 @@ bool ScintillaCocoa::SyncPaint(void* gc, PRectangle rc) vs.extraFontFlag != SC_EFF_QUALITY_NON_ANTIALIASED); CGContextSetAllowsFontSmoothing((CGContextRef)gc, vs.extraFontFlag == SC_EFF_QUALITY_LCD_OPTIMIZED); -#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 - if (CGContextSetAllowsFontSubpixelPositioning != NULL) - CGContextSetAllowsFontSubpixelPositioning((CGContextRef)gc, - vs.extraFontFlag == SC_EFF_QUALITY_DEFAULT || - vs.extraFontFlag == SC_EFF_QUALITY_LCD_OPTIMIZED); -#endif + CGContextSetAllowsFontSubpixelPositioning((CGContextRef)gc, + vs.extraFontFlag == SC_EFF_QUALITY_DEFAULT || + vs.extraFontFlag == SC_EFF_QUALITY_LCD_OPTIMIZED); sw->Init(gc, wMain.GetID()); Paint(sw, rc); succeeded = paintState != paintAbandoned; @@ -1534,7 +1762,7 @@ bool ScintillaCocoa::SyncPaint(void* gc, PRectangle rc) //-------------------------------------------------------------------------------------------------- /** - * Paint the margin into the MarginView space. + * Paint the margin into the SCIMarginView space. */ void ScintillaCocoa::PaintMargin(NSRect aRect) { @@ -1545,6 +1773,13 @@ void ScintillaCocoa::PaintMargin(NSRect aRect) Surface *sw = Surface::Allocate(SC_TECHNOLOGY_DEFAULT); if (sw) { + CGContextSetAllowsAntialiasing(gc, + vs.extraFontFlag != SC_EFF_QUALITY_NON_ANTIALIASED); + CGContextSetAllowsFontSmoothing(gc, + vs.extraFontFlag == SC_EFF_QUALITY_LCD_OPTIMIZED); + CGContextSetAllowsFontSubpixelPositioning(gc, + vs.extraFontFlag == SC_EFF_QUALITY_DEFAULT || + vs.extraFontFlag == SC_EFF_QUALITY_LCD_OPTIMIZED); sw->Init(gc, wMargin.GetID()); PaintSelMargin(sw, rc); sw->Release(); @@ -1554,10 +1789,33 @@ void ScintillaCocoa::PaintMargin(NSRect aRect) //-------------------------------------------------------------------------------------------------- +/** + * Prepare for drawing. + * + * @param rect The area that will be drawn, given in the sender's coordinate system. + */ +void ScintillaCocoa::WillDraw(NSRect rect) +{ + RefreshStyleData(); + PRectangle rcWillDraw = NSRectToPRectangle(rect); + int positionAfterRect = PositionAfterArea(rcWillDraw); + pdoc->EnsureStyledTo(positionAfterRect); + NotifyUpdateUI(); + if (WrapLines(wsVisible)) { + // Wrap may have reduced number of lines so more lines may need to be styled + positionAfterRect = PositionAfterArea(rcWillDraw); + pdoc->EnsureStyledTo(positionAfterRect); + // The wrapping process has changed the height of some lines so redraw all. + Redraw(); + } +} + +//-------------------------------------------------------------------------------------------------- + /** * ScrollText is empty because scrolling is handled by the NSScrollView. */ -void ScintillaCocoa::ScrollText(int linesToMove) +void ScintillaCocoa::ScrollText(int) { } @@ -1586,7 +1844,7 @@ void ScintillaCocoa::SetHorizontalScrollPos() { PRectangle textRect = GetTextRectangle(); - int maxXOffset = scrollWidth - textRect.Width(); + int maxXOffset = scrollWidth - static_cast(textRect.Width()); if (maxXOffset < 0) maxXOffset = 0; if (xOffset > maxXOffset) @@ -1619,13 +1877,13 @@ bool ScintillaCocoa::ModifyScrollBars(int nMax, int nPage) bool ScintillaCocoa::SetScrollingSize(void) { bool changes = false; - InnerView *inner = ContentView(); + SCIContentView *inner = ContentView(); if (!enteredSetScrollingSize) { enteredSetScrollingSize = true; NSScrollView *scrollView = ScrollContainer(); NSClipView *clipView = [ScrollContainer() contentView]; NSRect clipRect = [clipView bounds]; - int docHeight = (cs.LinesDisplayed()+1) * vs.lineHeight; + CGFloat docHeight = cs.LinesDisplayed() * vs.lineHeight; if (!endAtLastLine) docHeight += (int([scrollView bounds].size.height / vs.lineHeight)-3) * vs.lineHeight; // Allow extra space so that last scroll position places whole line at top @@ -1634,12 +1892,12 @@ bool ScintillaCocoa::SetScrollingSize(void) { // Ensure all of clipRect covered by Scintilla drawing if (docHeight < clipRect.size.height) docHeight = clipRect.size.height; - int docWidth = scrollWidth; + CGFloat docWidth = scrollWidth; bool showHorizontalScroll = horizontalScrollBarVisible && - (wrapState == eWrapNone); + !Wrapping(); if (!showHorizontalScroll) docWidth = clipRect.size.width; - NSRect contentRect = {0, 0, docWidth, docHeight}; + NSRect contentRect = {{0, 0}, {docWidth, docHeight}}; NSRect contentRectNow = [inner frame]; changes = (contentRect.size.width != contentRectNow.size.width) || (contentRect.size.height != contentRectNow.size.height); @@ -1670,16 +1928,31 @@ void ScintillaCocoa::Resize() */ void ScintillaCocoa::UpdateForScroll() { Point ptOrigin = GetVisibleOriginInMain(); - xOffset = ptOrigin.x; - int newTop = Platform::Minimum(ptOrigin.y / vs.lineHeight, MaxScrollPos()); + xOffset = static_cast(ptOrigin.x); + int newTop = Platform::Minimum(static_cast(ptOrigin.y / vs.lineHeight), MaxScrollPos()); SetTopLine(newTop); } //-------------------------------------------------------------------------------------------------- +/** + * Register a delegate that will be called for notifications and commands. + * This provides similar functionality to RegisterNotifyCallback but in an + * Objective C way. + * + * @param delegate_ A pointer to an object that implements ScintillaNotificationProtocol. + */ + +void ScintillaCocoa::SetDelegate(id delegate_) +{ + delegate = delegate_; +} + +//-------------------------------------------------------------------------------------------------- + /** * Used to register a callback function for a given window. This is used to emulate the way - * Windows notfies other controls (mainly up in the view hierarchy) about certain events. + * Windows notifies other controls (mainly up in the view hierarchy) about certain events. * * @param windowid A handle to a window. That value is generic and can be anything. It is passed * through to the callback. @@ -1697,7 +1970,7 @@ void ScintillaCocoa::RegisterNotifyCallback(intptr_t windowid, SciNotifyFunc cal void ScintillaCocoa::NotifyChange() { if (notifyProc != NULL) - notifyProc(notifyObj, WM_COMMAND, Platform::LongFromTwoShorts(GetCtrlID(), SCEN_CHANGE), + notifyProc(notifyObj, WM_COMMAND, Platform::LongFromTwoShorts(static_cast(GetCtrlID()), SCEN_CHANGE), (uintptr_t) this); } @@ -1706,8 +1979,11 @@ void ScintillaCocoa::NotifyChange() void ScintillaCocoa::NotifyFocus(bool focus) { if (notifyProc != NULL) - notifyProc(notifyObj, WM_COMMAND, Platform::LongFromTwoShorts(GetCtrlID(), (focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS)), + notifyProc(notifyObj, WM_COMMAND, Platform::LongFromTwoShorts(static_cast(GetCtrlID()), + (focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS)), (uintptr_t) this); + + Editor::NotifyFocus(focus); } //-------------------------------------------------------------------------------------------------- @@ -1719,13 +1995,13 @@ void ScintillaCocoa::NotifyFocus(bool focus) * @param scn The notification to send. */ void ScintillaCocoa::NotifyParent(SCNotification scn) -{ +{ + scn.nmhdr.hwndFrom = (void*) this; + scn.nmhdr.idFrom = GetCtrlID(); if (notifyProc != NULL) - { - scn.nmhdr.hwndFrom = (void*) this; - scn.nmhdr.idFrom = GetCtrlID(); - notifyProc(notifyObj, WM_NOTIFY, (uintptr_t) 0, (uintptr_t) &scn); - } + notifyProc(notifyObj, WM_NOTIFY, GetCtrlID(), (uintptr_t) &scn); + if (delegate) + [delegate notification:&scn]; } //-------------------------------------------------------------------------------------------------- @@ -1735,7 +2011,7 @@ void ScintillaCocoa::NotifyURIDropped(const char *uri) SCNotification scn; scn.nmhdr.code = SCN_URIDROPPED; scn.text = uri; - + NotifyParent(scn); } @@ -1764,9 +2040,13 @@ bool ScintillaCocoa::CanRedo() void ScintillaCocoa::TimerFired(NSTimer* timer) { -#pragma unused(timer) - Tick(); - DragScroll(); + for (TickReason tr=tickCaret; tr<=tickPlatform; tr = static_cast(tr+1)) + { + if (timers[tr] == timer) + { + TickFor(tr); + } + } } //-------------------------------------------------------------------------------------------------- @@ -1792,7 +2072,7 @@ bool ScintillaCocoa::Draw(NSRect rect, CGContextRef gc) } //-------------------------------------------------------------------------------------------------- - + /** * Helper function to translate OS X key codes to Scintilla key codes. */ @@ -1837,9 +2117,27 @@ static inline UniChar KeyTranslate(UniChar unicodeChar) //-------------------------------------------------------------------------------------------------- +/** + * Translate NSEvent modifier flags into SCI_* modifier flags. + * + * @param modifiers An integer bit set of NSSEvent modifier flags. + * @return A set of SCI_* modifier flags. + */ +static int TranslateModifierFlags(NSUInteger modifiers) +{ + // Signal Control as SCI_META + return + (((modifiers & NSShiftKeyMask) != 0) ? SCI_SHIFT : 0) | + (((modifiers & NSCommandKeyMask) != 0) ? SCI_CTRL : 0) | + (((modifiers & NSAlternateKeyMask) != 0) ? SCI_ALT : 0) | + (((modifiers & NSControlKeyMask) != 0) ? SCI_META : 0); +} + +//-------------------------------------------------------------------------------------------------- + /** * Main keyboard input handling method. It is called for any key down event, including function keys, - * numeric keypad input and whatnot. + * numeric keypad input and whatnot. * * @param event The event instance associated with the key down event. * @return True if the input was handled, false otherwise. @@ -1847,37 +2145,24 @@ static inline UniChar KeyTranslate(UniChar unicodeChar) bool ScintillaCocoa::KeyboardInput(NSEvent* event) { // For now filter out function keys. - NSUInteger modifiers = [event modifierFlags]; - NSString* input = [event characters]; - - bool control = (modifiers & NSControlKeyMask) != 0; - bool shift = (modifiers & NSShiftKeyMask) != 0; - bool command = (modifiers & NSCommandKeyMask) != 0; - bool alt = (modifiers & NSAlternateKeyMask) != 0; - + bool handled = false; - - // Handle each entry individually. Usually we only have one entry anway. + + // Handle each entry individually. Usually we only have one entry anyway. for (size_t i = 0; i < input.length; i++) { const UniChar originalKey = [input characterAtIndex: i]; UniChar key = KeyTranslate(originalKey); - + bool consumed = false; // Consumed as command? - - // Signal Control as SCMOD_META - int modifierKeys = - (shift ? SCI_SHIFT : 0) | - (command ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0) | - (control ? SCI_META : 0); - if (KeyDownWithModifiers(key, modifierKeys, &consumed)) + + if (KeyDownWithModifiers(key, TranslateModifierFlags([event modifierFlags]), &consumed)) handled = true; if (consumed) handled = true; } - + return handled; } @@ -1889,19 +2174,42 @@ bool ScintillaCocoa::KeyboardInput(NSEvent* event) int ScintillaCocoa::InsertText(NSString* input) { CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), - vs.styles[STYLE_DEFAULT].characterSet); - CFRange rangeAll = {0, static_cast([input length])}; - CFIndex usedLen = 0; - CFStringGetBytes((CFStringRef)input, rangeAll, encoding, '?', - false, NULL, 0, &usedLen); - - std::vector buffer(usedLen); - - CFStringGetBytes((CFStringRef)input, rangeAll, encoding, '?', - false, buffer.data(),usedLen, NULL); - - AddCharUTF((char*) buffer.data(), static_cast(usedLen), false); - return static_cast(usedLen); + vs.styles[STYLE_DEFAULT].characterSet); + std::string encoded = EncodedBytesString((CFStringRef)input, encoding); + + if (encoded.length() > 0) + { + AddCharUTF((char*) encoded.c_str(), static_cast(encoded.length()), false); + } + return static_cast(encoded.length()); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Convert from a range of characters to a range of bytes. + */ +NSRange ScintillaCocoa::PositionsFromCharacters(NSRange range) const +{ + long start = pdoc->GetRelativePositionUTF16(0, range.location); + if (start == INVALID_POSITION) + start = pdoc->Length(); + long end = pdoc->GetRelativePositionUTF16(start, range.length); + if (end == INVALID_POSITION) + end = pdoc->Length(); + return NSMakeRange(start, end - start); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Convert from a range of characters from a range of bytes. + */ +NSRange ScintillaCocoa::CharactersFromPositions(NSRange range) const +{ + const long start = pdoc->CountUTF16(0, range.location); + const long len = pdoc->CountUTF16(range.location, NSMaxRange(range)); + return NSMakeRange(start, len); } //-------------------------------------------------------------------------------------------------- @@ -1909,16 +2217,71 @@ int ScintillaCocoa::InsertText(NSString* input) /** * Used to ensure that only one selection is active for input composition as composition * does not support multi-typing. - * Also drop virtual space as that is not supported by composition. */ void ScintillaCocoa::SelectOnlyMainSelection() { - SelectionRange mainSel = sel.RangeMain(); - mainSel.ClearVirtualSpace(); - sel.SetSelection(mainSel); + sel.SetSelection(sel.RangeMain()); Redraw(); } +//-------------------------------------------------------------------------------------------------- + +/** + * Convert virtual space before selection into real space. + */ +void ScintillaCocoa::ConvertSelectionVirtualSpace() +{ + FillVirtualSpace(); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Erase all selected text and return whether the selection is now empty. + * The selection may not be empty if the selection contained protected text. + */ +bool ScintillaCocoa::ClearAllSelections() +{ + ClearSelection(true); + return sel.Empty(); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Start composing for IME. + */ +void ScintillaCocoa::CompositionStart() +{ + if (!sel.Empty()) + { + NSLog(@"Selection not empty when starting composition"); + } + pdoc->TentativeStart(); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Commit the IME text. + */ +void ScintillaCocoa::CompositionCommit() +{ + pdoc->TentativeCommit(); + pdoc->decorations.SetCurrentIndicator(INDIC_IME); + pdoc->DecorationFillRange(0, 0, pdoc->Length()); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Remove the IME text. + */ +void ScintillaCocoa::CompositionUndo() +{ + pdoc->TentativeUndo(); +} + //-------------------------------------------------------------------------------------------------- /** * When switching documents discard any incomplete character composition state as otherwise tries to @@ -1929,7 +2292,7 @@ void ScintillaCocoa::SetDocPointer(Document *document) // Drop input composition. NSTextInputContext *inctxt = [NSTextInputContext currentInputContext]; [inctxt discardMarkedText]; - InnerView *inner = ContentView(); + SCIContentView *inner = ContentView(); [inner unmarkText]; Editor::SetDocPointer(document); } @@ -1944,7 +2307,7 @@ void ScintillaCocoa::MouseEntered(NSEvent* event) if (!HaveMouseCapture()) { WndProc(SCI_SETCURSOR, (long int)SC_CURSORNORMAL, 0); - + // Mouse location is given in screen coordinates and might also be outside of our bounds. Point location = ConvertPoint([event locationInWindow]); ButtonMove(location); @@ -1967,7 +2330,7 @@ void ScintillaCocoa::MouseDown(NSEvent* event) bool command = ([event modifierFlags] & NSCommandKeyMask) != 0; bool shift = ([event modifierFlags] & NSShiftKeyMask) != 0; bool alt = ([event modifierFlags] & NSAlternateKeyMask) != 0; - + ButtonDown(Point(location.x, location.y), (int) (time * 1000), shift, command, alt); } @@ -1977,7 +2340,7 @@ void ScintillaCocoa::MouseMove(NSEvent* event) { lastMouseEvent = event; - ButtonMove(ConvertPoint([event locationInWindow])); + ButtonMoveWithModifiers(ConvertPoint([event locationInWindow]), TranslateModifierFlags([event modifierFlags])); } //-------------------------------------------------------------------------------------------------- @@ -1997,13 +2360,13 @@ void ScintillaCocoa::MouseWheel(NSEvent* event) bool command = ([event modifierFlags] & NSCommandKeyMask) != 0; int dY = 0; - // In order to make scrolling with larger offset smoother we scroll less lines the larger the + // In order to make scrolling with larger offset smoother we scroll less lines the larger the // delta value is. if ([event deltaY] < 0) dY = -(int) sqrt(-10.0 * [event deltaY]); else dY = (int) sqrt(10.0 * [event deltaY]); - + if (command) { // Zoom! We play with the font sizes in the styles. @@ -2056,7 +2419,7 @@ NSMenu* ScintillaCocoa::CreateContextMenu(NSEvent* /* event */) { // Call ScintillaBase to create the context menu. ContextMenu(Point(0, 0)); - + return reinterpret_cast(popup.GetID()); } @@ -2079,12 +2442,16 @@ void ScintillaCocoa::ActiveStateChanged(bool isActive) if (!isActive) { DropCaret(); //SetFocusState( false ); - SetTicking( false ); + FineTickerCancel(tickCaret); } else { ShowCaretAtCurrentPosition(); } } +// If building with old SDK, need to define version number for 10.8 +#ifndef NSAppKitVersionNumber10_8 +#define NSAppKitVersionNumber10_8 1187 +#endif //-------------------------------------------------------------------------------------------------- @@ -2097,31 +2464,36 @@ void ScintillaCocoa::ShowFindIndicatorForRange(NSRange charRange, BOOL retaining layerFindIndicator = [[FindHighlightLayer alloc] init]; [content setWantsLayer: YES]; layerFindIndicator.geometryFlipped = content.layer.geometryFlipped; + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_8) + { + // Content layer is unflipped on 10.9, but the indicator shows wrong unless flipped + layerFindIndicator.geometryFlipped = YES; + } [[content layer] addSublayer:layerFindIndicator]; } [layerFindIndicator removeAnimationForKey:@"animateFound"]; - + if (charRange.length) { CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), vs.styles[STYLE_DEFAULT].characterSet); std::vector buffer(charRange.length); - pdoc->GetCharRange(&buffer[0], charRange.location, charRange.length); - + pdoc->GetCharRange(&buffer[0], static_cast(charRange.location), static_cast(charRange.length)); + CFStringRef cfsFind = CFStringCreateWithBytes(kCFAllocatorDefault, - reinterpret_cast(&buffer[0]), + reinterpret_cast(&buffer[0]), charRange.length, encoding, false); layerFindIndicator.sFind = (NSString *)cfsFind; if (cfsFind) CFRelease(cfsFind); layerFindIndicator.retaining = retaining; - layerFindIndicator.positionFind = charRange.location; - int style = WndProc(SCI_GETSTYLEAT, charRange.location, 0); + layerFindIndicator.positionFind = static_cast(charRange.location); + long style = WndProc(SCI_GETSTYLEAT, charRange.location, 0); std::vector bufferFontName(WndProc(SCI_STYLEGETFONT, style, 0) + 1); WndProc(SCI_STYLEGETFONT, style, (sptr_t)&bufferFontName[0]); layerFindIndicator.sFont = [NSString stringWithUTF8String: &bufferFontName[0]]; - - layerFindIndicator.fontSize = WndProc(SCI_STYLEGETSIZEFRACTIONAL, style, 0) / + + layerFindIndicator.fontSize = WndProc(SCI_STYLEGETSIZEFRACTIONAL, style, 0) / (float)SC_FONT_SIZE_MULTIPLIER; layerFindIndicator.widthText = WndProc(SCI_POINTXFROMPOSITION, 0, charRange.location + charRange.length) - WndProc(SCI_POINTXFROMPOSITION, 0, charRange.location); diff --git a/scintilla/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj b/scintilla/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj index a519d2ed..2822fb89 100644 --- a/scintilla/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj +++ b/scintilla/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj @@ -167,6 +167,7 @@ 1152A77315313E58000D4E1A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1152A77215313E58000D4E1A /* QuartzCore.framework */; }; 11594BE9155B91DF0099E1FA /* LexOScript.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11594BE7155B91DF0099E1FA /* LexOScript.cxx */; }; 11594BEA155B91DF0099E1FA /* LexVisualProlog.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11594BE8155B91DF0099E1FA /* LexVisualProlog.cxx */; }; + 1160E0381803651C00BCEBCB /* LexRust.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1160E0371803651C00BCEBCB /* LexRust.cxx */; }; 117ACE9114A29A1E002876F9 /* LexTCMD.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 117ACE9014A29A1E002876F9 /* LexTCMD.cxx */; }; 119FF1BF13C9D1820007CE42 /* QuartzTextStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 119FF1BE13C9D1820007CE42 /* QuartzTextStyle.h */; }; 11A0A8A1148602DF0018D143 /* LexCoffeeScript.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11A0A8A0148602DF0018D143 /* LexCoffeeScript.cxx */; }; @@ -176,6 +177,8 @@ 11FBA39D17817DA00048C071 /* CharacterCategory.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11FBA39B17817DA00048C071 /* CharacterCategory.cxx */; }; 11FBA39E17817DA00048C071 /* CharacterCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 11FBA39C17817DA00048C071 /* CharacterCategory.h */; }; 11FDAEB7174E1A9800FA161B /* LexSTTXT.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11FDAEB6174E1A9700FA161B /* LexSTTXT.cxx */; }; + 11FDD0E017C480D4001541B9 /* LexKVIrc.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11FDD0DF17C480D4001541B9 /* LexKVIrc.cxx */; }; + 11FF3FE21810EB3900E13F13 /* LexDMAP.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11FF3FE11810EB3900E13F13 /* LexDMAP.cxx */; }; 2744E5A40FC168A100E85C33 /* InfoBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59D0FC168A100E85C33 /* InfoBar.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2744E5AA0FC168A100E85C33 /* ScintillaView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A30FC168A100E85C33 /* ScintillaView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2744E5AC0FC168B200E85C33 /* InfoBarCommunicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5AB0FC168B200E85C33 /* InfoBarCommunicator.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -183,16 +186,32 @@ 2744E5B30FC168C500E85C33 /* PlatCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2744E5AE0FC168C500E85C33 /* PlatCocoa.mm */; }; 2744E5B50FC168C500E85C33 /* ScintillaCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2744E5B00FC168C500E85C33 /* ScintillaCocoa.mm */; }; 2744E5B60FC168C500E85C33 /* ScintillaView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2744E5B10FC168C500E85C33 /* ScintillaView.mm */; }; - 2791F3C60FC19F71009DBCF9 /* PlatCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59E0FC168A100E85C33 /* PlatCocoa.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2791F3C70FC19F71009DBCF9 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E4850FC1678600E85C33 /* Platform.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2791F3C60FC19F71009DBCF9 /* PlatCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59E0FC168A100E85C33 /* PlatCocoa.h */; }; + 2791F3C70FC19F71009DBCF9 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E4850FC1678600E85C33 /* Platform.h */; }; 2791F3C80FC19F71009DBCF9 /* SciLexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E4870FC1678600E85C33 /* SciLexer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2791F3C90FC19F71009DBCF9 /* Scintilla.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E4880FC1678600E85C33 /* Scintilla.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2791F3E00FC1A390009DBCF9 /* ScintillaCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A20FC168A100E85C33 /* ScintillaCocoa.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2791F3E30FC1A3AE009DBCF9 /* QuartzTextLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59F0FC168A100E85C33 /* QuartzTextLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2791F3E40FC1A3AE009DBCF9 /* QuartzTextStyleAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A00FC168A100E85C33 /* QuartzTextStyleAttribute.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2791F3E00FC1A390009DBCF9 /* ScintillaCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A20FC168A100E85C33 /* ScintillaCocoa.h */; }; + 2791F3E30FC1A3AE009DBCF9 /* QuartzTextLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59F0FC168A100E85C33 /* QuartzTextLayout.h */; }; + 2791F3E40FC1A3AE009DBCF9 /* QuartzTextStyleAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A00FC168A100E85C33 /* QuartzTextStyleAttribute.h */; }; 27FEF4540FC1B413005E115A /* info_bar_bg.png in Resources */ = {isa = PBXBuildFile; fileRef = 27FEF4510FC1B413005E115A /* info_bar_bg.png */; }; 27FEF4550FC1B413005E115A /* mac_cursor_busy.png in Resources */ = {isa = PBXBuildFile; fileRef = 27FEF4520FC1B413005E115A /* mac_cursor_busy.png */; }; 27FEF4560FC1B413005E115A /* mac_cursor_flipped.png in Resources */ = {isa = PBXBuildFile; fileRef = 27FEF4530FC1B413005E115A /* mac_cursor_flipped.png */; }; + 280056FB188DDD2C00F200AE /* SparseState.h in Headers */ = {isa = PBXBuildFile; fileRef = 280056F8188DDD2C00F200AE /* SparseState.h */; }; + 280056FC188DDD2C00F200AE /* StringCopy.h in Headers */ = {isa = PBXBuildFile; fileRef = 280056F9188DDD2C00F200AE /* StringCopy.h */; }; + 280056FD188DDD2C00F200AE /* SubStyles.h in Headers */ = {isa = PBXBuildFile; fileRef = 280056FA188DDD2C00F200AE /* SubStyles.h */; }; + 28064A05190F12E100E6E47F /* LexDMIS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28064A04190F12E100E6E47F /* LexDMIS.cxx */; }; + 28A067111A36B42600B4966A /* LexHex.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A067101A36B42600B4966A /* LexHex.cxx */; }; + 28A1DD51196BE0CA006EFCDD /* EditModel.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */; }; + 28A1DD52196BE0CA006EFCDD /* EditView.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A1DD4F196BE0CA006EFCDD /* EditView.cxx */; }; + 28A1DD53196BE0CA006EFCDD /* MarginView.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A1DD50196BE0CA006EFCDD /* MarginView.cxx */; }; + 28A1DD57196BE0ED006EFCDD /* EditModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 28A1DD54196BE0ED006EFCDD /* EditModel.h */; }; + 28A1DD58196BE0ED006EFCDD /* EditView.h in Headers */ = {isa = PBXBuildFile; fileRef = 28A1DD55196BE0ED006EFCDD /* EditView.h */; }; + 28A1DD59196BE0ED006EFCDD /* MarginView.h in Headers */ = {isa = PBXBuildFile; fileRef = 28A1DD56196BE0ED006EFCDD /* MarginView.h */; }; + 28A7D6051995E47D0062D204 /* LexRegistry.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A7D6041995E47D0062D204 /* LexRegistry.cxx */; }; + 28D516D81830FFCA0047C93D /* info_bar_bg@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 28D516D51830FFCA0047C93D /* info_bar_bg@2x.png */; }; + 28D516D91830FFCA0047C93D /* mac_cursor_busy@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 28D516D61830FFCA0047C93D /* mac_cursor_busy@2x.png */; }; + 28D516DA1830FFCA0047C93D /* mac_cursor_flipped@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 28D516D71830FFCA0047C93D /* mac_cursor_flipped@2x.png */; }; + 28FDA42119B6967B00BE27D7 /* LexBibTeX.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28FDA42019B6967B00BE27D7 /* LexBibTeX.cxx */; }; 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; }; /* End PBXBuildFile section */ @@ -362,6 +381,7 @@ 1152A77215313E58000D4E1A /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = ../../../../../../../../System/Library/Frameworks/QuartzCore.framework; sourceTree = ""; }; 11594BE7155B91DF0099E1FA /* LexOScript.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexOScript.cxx; path = ../../lexers/LexOScript.cxx; sourceTree = ""; }; 11594BE8155B91DF0099E1FA /* LexVisualProlog.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexVisualProlog.cxx; path = ../../lexers/LexVisualProlog.cxx; sourceTree = ""; }; + 1160E0371803651C00BCEBCB /* LexRust.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexRust.cxx; path = ../../lexers/LexRust.cxx; sourceTree = ""; }; 117ACE9014A29A1E002876F9 /* LexTCMD.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTCMD.cxx; path = ../../lexers/LexTCMD.cxx; sourceTree = ""; }; 119FF1BE13C9D1820007CE42 /* QuartzTextStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QuartzTextStyle.h; path = ../QuartzTextStyle.h; sourceTree = ""; }; 11A0A8A0148602DF0018D143 /* LexCoffeeScript.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCoffeeScript.cxx; path = ../../lexers/LexCoffeeScript.cxx; sourceTree = ""; }; @@ -371,6 +391,8 @@ 11FBA39B17817DA00048C071 /* CharacterCategory.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CharacterCategory.cxx; path = ../../lexlib/CharacterCategory.cxx; sourceTree = ""; }; 11FBA39C17817DA00048C071 /* CharacterCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CharacterCategory.h; path = ../../lexlib/CharacterCategory.h; sourceTree = ""; }; 11FDAEB6174E1A9700FA161B /* LexSTTXT.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSTTXT.cxx; path = ../../lexers/LexSTTXT.cxx; sourceTree = ""; }; + 11FDD0DF17C480D4001541B9 /* LexKVIrc.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexKVIrc.cxx; path = ../../lexers/LexKVIrc.cxx; sourceTree = ""; }; + 11FF3FE11810EB3900E13F13 /* LexDMAP.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDMAP.cxx; path = ../../lexers/LexDMAP.cxx; sourceTree = ""; }; 2744E4850FC1678600E85C33 /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Platform.h; path = ../../include/Platform.h; sourceTree = SOURCE_ROOT; }; 2744E4870FC1678600E85C33 /* SciLexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SciLexer.h; path = ../../include/SciLexer.h; sourceTree = SOURCE_ROOT; }; 2744E4880FC1678600E85C33 /* Scintilla.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Scintilla.h; path = ../../include/Scintilla.h; sourceTree = SOURCE_ROOT; }; @@ -388,6 +410,22 @@ 27FEF4510FC1B413005E115A /* info_bar_bg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = info_bar_bg.png; sourceTree = ""; }; 27FEF4520FC1B413005E115A /* mac_cursor_busy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mac_cursor_busy.png; sourceTree = ""; }; 27FEF4530FC1B413005E115A /* mac_cursor_flipped.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mac_cursor_flipped.png; sourceTree = ""; }; + 280056F8188DDD2C00F200AE /* SparseState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SparseState.h; path = ../../lexlib/SparseState.h; sourceTree = ""; }; + 280056F9188DDD2C00F200AE /* StringCopy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringCopy.h; path = ../../lexlib/StringCopy.h; sourceTree = ""; }; + 280056FA188DDD2C00F200AE /* SubStyles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SubStyles.h; path = ../../lexlib/SubStyles.h; sourceTree = ""; }; + 28064A04190F12E100E6E47F /* LexDMIS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDMIS.cxx; path = ../../lexers/LexDMIS.cxx; sourceTree = ""; }; + 28A067101A36B42600B4966A /* LexHex.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexHex.cxx; path = ../../lexers/LexHex.cxx; sourceTree = ""; }; + 28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EditModel.cxx; path = ../../src/EditModel.cxx; sourceTree = ""; }; + 28A1DD4F196BE0CA006EFCDD /* EditView.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EditView.cxx; path = ../../src/EditView.cxx; sourceTree = ""; }; + 28A1DD50196BE0CA006EFCDD /* MarginView.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MarginView.cxx; path = ../../src/MarginView.cxx; sourceTree = ""; }; + 28A1DD54196BE0ED006EFCDD /* EditModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EditModel.h; path = ../../src/EditModel.h; sourceTree = ""; }; + 28A1DD55196BE0ED006EFCDD /* EditView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EditView.h; path = ../../src/EditView.h; sourceTree = ""; }; + 28A1DD56196BE0ED006EFCDD /* MarginView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MarginView.h; path = ../../src/MarginView.h; sourceTree = ""; }; + 28A7D6041995E47D0062D204 /* LexRegistry.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexRegistry.cxx; path = ../../lexers/LexRegistry.cxx; sourceTree = ""; }; + 28D516D51830FFCA0047C93D /* info_bar_bg@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "info_bar_bg@2x.png"; sourceTree = ""; }; + 28D516D61830FFCA0047C93D /* mac_cursor_busy@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "mac_cursor_busy@2x.png"; sourceTree = ""; }; + 28D516D71830FFCA0047C93D /* mac_cursor_flipped@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "mac_cursor_flipped@2x.png"; sourceTree = ""; }; + 28FDA42019B6967B00BE27D7 /* LexBibTeX.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBibTeX.cxx; path = ../../lexers/LexBibTeX.cxx; sourceTree = ""; }; 32DBCF5E0370ADEE00C91783 /* Scintilla_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scintilla_Prefix.pch; sourceTree = ""; }; 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8DC2EF5B0486A6940098B216 /* Scintilla.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Scintilla.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -501,6 +539,7 @@ 114B6EC611FA7526004FB6AB /* LexBaan.cxx */, 114B6EC711FA7526004FB6AB /* LexBash.cxx */, 114B6EC811FA7526004FB6AB /* LexBasic.cxx */, + 28FDA42019B6967B00BE27D7 /* LexBibTeX.cxx */, 114B6EC911FA7526004FB6AB /* LexBullant.cxx */, 114B6ECA11FA7526004FB6AB /* LexCaml.cxx */, 114B6ECB11FA7526004FB6AB /* LexCLW.cxx */, @@ -513,6 +552,8 @@ 114B6ED111FA7526004FB6AB /* LexCsound.cxx */, 114B6ED211FA7526004FB6AB /* LexCSS.cxx */, 114B6ED311FA7526004FB6AB /* LexD.cxx */, + 11FF3FE11810EB3900E13F13 /* LexDMAP.cxx */, + 28064A04190F12E100E6E47F /* LexDMIS.cxx */, 11BEB6A114EF189600BDE92A /* LexECL.cxx */, 114B6ED411FA7526004FB6AB /* LexEiffel.cxx */, 114B6ED511FA7526004FB6AB /* LexErlang.cxx */, @@ -523,9 +564,11 @@ 114B6EDA11FA7526004FB6AB /* LexGAP.cxx */, 114B6EDB11FA7526004FB6AB /* LexGui4Cli.cxx */, 114B6EDC11FA7526004FB6AB /* LexHaskell.cxx */, + 28A067101A36B42600B4966A /* LexHex.cxx */, 114B6EDD11FA7526004FB6AB /* LexHTML.cxx */, 114B6EDE11FA7526004FB6AB /* LexInno.cxx */, 114B6EDF11FA7526004FB6AB /* LexKix.cxx */, + 11FDD0DF17C480D4001541B9 /* LexKVIrc.cxx */, 1102C31B169FB49300DC16AB /* LexLaTeX.cxx */, 114B6EE011FA7526004FB6AB /* LexLisp.cxx */, 114B6EE111FA7526004FB6AB /* LexLout.cxx */, @@ -557,7 +600,9 @@ 114B6EF811FA7526004FB6AB /* LexPython.cxx */, 114B6EF911FA7526004FB6AB /* LexR.cxx */, 114B6EFA11FA7526004FB6AB /* LexRebol.cxx */, + 28A7D6041995E47D0062D204 /* LexRegistry.cxx */, 114B6EFB11FA7526004FB6AB /* LexRuby.cxx */, + 1160E0371803651C00BCEBCB /* LexRust.cxx */, 114B6EFC11FA7526004FB6AB /* LexScriptol.cxx */, 114B6EFD11FA7526004FB6AB /* LexSmalltalk.cxx */, 114B6EFE11FA7526004FB6AB /* LexSML.cxx */, @@ -598,7 +643,9 @@ 114B6FA711FA7623004FB6AB /* ContractionState.h */, 114B6FA811FA7623004FB6AB /* Decoration.h */, 114B6FA911FA7623004FB6AB /* Document.h */, + 28A1DD54196BE0ED006EFCDD /* EditModel.h */, 114B6FAA11FA7623004FB6AB /* Editor.h */, + 28A1DD55196BE0ED006EFCDD /* EditView.h */, 114B6FAB11FA7623004FB6AB /* ExternalLexer.h */, 114B6FAC11FA7623004FB6AB /* FontQuality.h */, 114B6FA011FA75DB004FB6AB /* ILexer.h */, @@ -610,6 +657,7 @@ 114B6FDD11FA7645004FB6AB /* LexerNoExceptions.h */, 114B6FDE11FA7645004FB6AB /* LexerSimple.h */, 114B6FAF11FA7623004FB6AB /* LineMarker.h */, + 28A1DD56196BE0ED006EFCDD /* MarginView.h */, 114B6FDF11FA7645004FB6AB /* OptionSet.h */, 114B6FB011FA7623004FB6AB /* Partitioning.h */, 114B6FB111FA7623004FB6AB /* PerLine.h */, @@ -619,9 +667,12 @@ 114B6FB411FA7623004FB6AB /* RunStyles.h */, 114B6FB511FA7623004FB6AB /* ScintillaBase.h */, 114B6FB611FA7623004FB6AB /* Selection.h */, + 280056F8188DDD2C00F200AE /* SparseState.h */, 114B6FB711FA7623004FB6AB /* SplitVector.h */, + 280056F9188DDD2C00F200AE /* StringCopy.h */, 114B6FB811FA7623004FB6AB /* Style.h */, 114B6FE111FA7645004FB6AB /* StyleContext.h */, + 280056FA188DDD2C00F200AE /* SubStyles.h */, 1100F1EA178E393200105727 /* UnicodeFromUTF8.h */, 114B6FBA11FA7623004FB6AB /* UniConversion.h */, 114B6FBB11FA7623004FB6AB /* ViewStyle.h */, @@ -647,7 +698,9 @@ 114B6F6511FA7597004FB6AB /* ContractionState.cxx */, 114B6F6611FA7597004FB6AB /* Decoration.cxx */, 114B6F6711FA7597004FB6AB /* Document.cxx */, + 28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */, 114B6F6811FA7597004FB6AB /* Editor.cxx */, + 28A1DD4F196BE0CA006EFCDD /* EditView.cxx */, 114B6F6911FA7598004FB6AB /* ExternalLexer.cxx */, 114B6F6A11FA7598004FB6AB /* Indicator.cxx */, 114B6F6B11FA7598004FB6AB /* KeyMap.cxx */, @@ -656,6 +709,7 @@ 114B6F9211FA75BE004FB6AB /* LexerNoExceptions.cxx */, 114B6F9311FA75BE004FB6AB /* LexerSimple.cxx */, 114B6F6C11FA7598004FB6AB /* LineMarker.cxx */, + 28A1DD50196BE0CA006EFCDD /* MarginView.cxx */, 114B6F6D11FA7598004FB6AB /* PerLine.cxx */, 114B6F6E11FA7598004FB6AB /* PositionCache.cxx */, 114B6F9411FA75BE004FB6AB /* PropSetSimple.cxx */, @@ -705,6 +759,9 @@ 27FEF4500FC1B413005E115A /* res */ = { isa = PBXGroup; children = ( + 28D516D51830FFCA0047C93D /* info_bar_bg@2x.png */, + 28D516D61830FFCA0047C93D /* mac_cursor_busy@2x.png */, + 28D516D71830FFCA0047C93D /* mac_cursor_flipped@2x.png */, 27FEF4510FC1B413005E115A /* info_bar_bg.png */, 27FEF4520FC1B413005E115A /* mac_cursor_busy.png */, 27FEF4530FC1B413005E115A /* mac_cursor_flipped.png */, @@ -730,13 +787,14 @@ files = ( 2744E5A40FC168A100E85C33 /* InfoBar.h in Headers */, 2744E5AC0FC168B200E85C33 /* InfoBarCommunicator.h in Headers */, + 2744E5AA0FC168A100E85C33 /* ScintillaView.h in Headers */, + 280056FB188DDD2C00F200AE /* SparseState.h in Headers */, + 2791F3C80FC19F71009DBCF9 /* SciLexer.h in Headers */, 2791F3C60FC19F71009DBCF9 /* PlatCocoa.h in Headers */, 2791F3E30FC1A3AE009DBCF9 /* QuartzTextLayout.h in Headers */, 2791F3E40FC1A3AE009DBCF9 /* QuartzTextStyleAttribute.h in Headers */, 2791F3E00FC1A390009DBCF9 /* ScintillaCocoa.h in Headers */, - 2744E5AA0FC168A100E85C33 /* ScintillaView.h in Headers */, 2791F3C70FC19F71009DBCF9 /* Platform.h in Headers */, - 2791F3C80FC19F71009DBCF9 /* SciLexer.h in Headers */, 2791F3C90FC19F71009DBCF9 /* Scintilla.h in Headers */, 114B6FA111FA75DB004FB6AB /* ILexer.h in Headers */, 114B6FBD11FA7623004FB6AB /* AutoComplete.h in Headers */, @@ -750,6 +808,7 @@ 114B6FC511FA7623004FB6AB /* Editor.h in Headers */, 114B6FC611FA7623004FB6AB /* ExternalLexer.h in Headers */, 114B6FC711FA7623004FB6AB /* FontQuality.h in Headers */, + 28A1DD57196BE0ED006EFCDD /* EditModel.h in Headers */, 114B6FC811FA7623004FB6AB /* Indicator.h in Headers */, 114B6FC911FA7623004FB6AB /* KeyMap.h in Headers */, 114B6FCA11FA7623004FB6AB /* LineMarker.h in Headers */, @@ -757,11 +816,14 @@ 114B6FCC11FA7623004FB6AB /* PerLine.h in Headers */, 114B6FCD11FA7623004FB6AB /* PositionCache.h in Headers */, 114B6FCE11FA7623004FB6AB /* RESearch.h in Headers */, + 28A1DD58196BE0ED006EFCDD /* EditView.h in Headers */, 114B6FCF11FA7623004FB6AB /* RunStyles.h in Headers */, + 280056FD188DDD2C00F200AE /* SubStyles.h in Headers */, 114B6FD011FA7623004FB6AB /* ScintillaBase.h in Headers */, 114B6FD111FA7623004FB6AB /* Selection.h in Headers */, 114B6FD211FA7623004FB6AB /* SplitVector.h in Headers */, 114B6FD311FA7623004FB6AB /* Style.h in Headers */, + 280056FC188DDD2C00F200AE /* StringCopy.h in Headers */, 114B6FD511FA7623004FB6AB /* UniConversion.h in Headers */, 114B6FD611FA7623004FB6AB /* ViewStyle.h in Headers */, 114B6FD711FA7623004FB6AB /* XPM.h in Headers */, @@ -773,6 +835,7 @@ 114B6FE811FA7645004FB6AB /* LexerNoExceptions.h in Headers */, 114B6FE911FA7645004FB6AB /* LexerSimple.h in Headers */, 114B6FEA11FA7645004FB6AB /* OptionSet.h in Headers */, + 28A1DD59196BE0ED006EFCDD /* MarginView.h in Headers */, 114B6FEB11FA7645004FB6AB /* PropSetSimple.h in Headers */, 114B6FEC11FA7645004FB6AB /* StyleContext.h in Headers */, 114B6FED11FA7645004FB6AB /* WordList.h in Headers */, @@ -812,7 +875,7 @@ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0460; + LastUpgradeCheck = 0610; }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ScintillaFramework" */; compatibilityVersion = "Xcode 3.2"; @@ -841,8 +904,11 @@ files = ( 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, 27FEF4540FC1B413005E115A /* info_bar_bg.png in Resources */, + 28D516D81830FFCA0047C93D /* info_bar_bg@2x.png in Resources */, + 28D516D91830FFCA0047C93D /* mac_cursor_busy@2x.png in Resources */, 27FEF4550FC1B413005E115A /* mac_cursor_busy.png in Resources */, 27FEF4560FC1B413005E115A /* mac_cursor_flipped.png in Resources */, + 28D516DA1830FFCA0047C93D /* mac_cursor_flipped@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -883,19 +949,23 @@ 114B6F2411FA7526004FB6AB /* LexErlang.cxx in Sources */, 114B6F2511FA7526004FB6AB /* LexEScript.cxx in Sources */, 114B6F2611FA7526004FB6AB /* LexFlagship.cxx in Sources */, + 28064A05190F12E100E6E47F /* LexDMIS.cxx in Sources */, 114B6F2711FA7526004FB6AB /* LexForth.cxx in Sources */, 114B6F2811FA7526004FB6AB /* LexFortran.cxx in Sources */, + 28FDA42119B6967B00BE27D7 /* LexBibTeX.cxx in Sources */, 114B6F2911FA7526004FB6AB /* LexGAP.cxx in Sources */, 114B6F2A11FA7526004FB6AB /* LexGui4Cli.cxx in Sources */, 114B6F2B11FA7526004FB6AB /* LexHaskell.cxx in Sources */, 114B6F2C11FA7526004FB6AB /* LexHTML.cxx in Sources */, 114B6F2D11FA7526004FB6AB /* LexInno.cxx in Sources */, 114B6F2E11FA7526004FB6AB /* LexKix.cxx in Sources */, + 28A067111A36B42600B4966A /* LexHex.cxx in Sources */, 114B6F2F11FA7526004FB6AB /* LexLisp.cxx in Sources */, 114B6F3011FA7526004FB6AB /* LexLout.cxx in Sources */, 114B6F3111FA7526004FB6AB /* LexLua.cxx in Sources */, 114B6F3211FA7526004FB6AB /* LexMagik.cxx in Sources */, 114B6F3311FA7526004FB6AB /* LexMarkdown.cxx in Sources */, + 28A1DD52196BE0CA006EFCDD /* EditView.cxx in Sources */, 114B6F3411FA7526004FB6AB /* LexMatlab.cxx in Sources */, 114B6F3511FA7526004FB6AB /* LexMetapost.cxx in Sources */, 114B6F3611FA7526004FB6AB /* LexMMIXAL.cxx in Sources */, @@ -931,6 +1001,7 @@ 114B6F5411FA7526004FB6AB /* LexTAL.cxx in Sources */, 114B6F5511FA7526004FB6AB /* LexTCL.cxx in Sources */, 114B6F5611FA7526004FB6AB /* LexTeX.cxx in Sources */, + 28A1DD53196BE0CA006EFCDD /* MarginView.cxx in Sources */, 114B6F5711FA7526004FB6AB /* LexTxt2tags.cxx in Sources */, 114B6F5811FA7526004FB6AB /* LexVB.cxx in Sources */, 114B6F5911FA7526004FB6AB /* LexVerilog.cxx in Sources */, @@ -941,6 +1012,7 @@ 114B6F7911FA7598004FB6AB /* Catalogue.cxx in Sources */, 114B6F7A11FA7598004FB6AB /* CellBuffer.cxx in Sources */, 114B6F7B11FA7598004FB6AB /* CharClassify.cxx in Sources */, + 28A1DD51196BE0CA006EFCDD /* EditModel.cxx in Sources */, 114B6F7C11FA7598004FB6AB /* ContractionState.cxx in Sources */, 114B6F7D11FA7598004FB6AB /* Decoration.cxx in Sources */, 114B6F7E11FA7598004FB6AB /* Document.cxx in Sources */, @@ -956,6 +1028,7 @@ 114B6F8811FA7598004FB6AB /* ScintillaBase.cxx in Sources */, 114B6F8911FA7598004FB6AB /* Selection.cxx in Sources */, 114B6F8A11FA7598004FB6AB /* Style.cxx in Sources */, + 28A7D6051995E47D0062D204 /* LexRegistry.cxx in Sources */, 114B6F8B11FA7598004FB6AB /* UniConversion.cxx in Sources */, 114B6F8C11FA7598004FB6AB /* ViewStyle.cxx in Sources */, 114B6F8D11FA7598004FB6AB /* XPM.cxx in Sources */, @@ -982,6 +1055,9 @@ 11FBA39D17817DA00048C071 /* CharacterCategory.cxx in Sources */, 1100F1EB178E393200105727 /* CaseConvert.cxx in Sources */, 1100F1ED178E393200105727 /* CaseFolder.cxx in Sources */, + 11FDD0E017C480D4001541B9 /* LexKVIrc.cxx in Sources */, + 1160E0381803651C00BCEBCB /* LexRust.cxx in Sources */, + 11FF3FE21810EB3900E13F13 /* LexDMAP.cxx in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1003,7 +1079,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_CXX_LIBRARY = "libc++"; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -1018,15 +1095,15 @@ SCI_NAMESPACE, SCI_LEXER, ); - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_UNINITIALIZED_AUTOS = NO; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.7; PRODUCT_NAME = Scintilla; - SDKROOT = macosx10.7; + SKIP_INSTALL = YES; WRAPPER_EXTENSION = framework; }; name = Debug; @@ -1035,7 +1112,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_CXX_LIBRARY = "libc++"; + COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -1047,15 +1125,15 @@ SCI_NAMESPACE, SCI_LEXER, ); - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_UNINITIALIZED_AUTOS = NO; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.7; PRODUCT_NAME = Scintilla; - SDKROOT = macosx10.7; + SKIP_INSTALL = YES; WRAPPER_EXTENSION = framework; }; name = Release; @@ -1063,7 +1141,7 @@ 1DEB91B208733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; GCC_C_LANGUAGE_STANDARD = c99; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -1073,15 +1151,16 @@ ../../src, ../../lexlib, ); + MACOSX_DEPLOYMENT_TARGET = 10.5; ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx10.7; + SDKROOT = macosx; }; name = Debug; }; 1DEB91B308733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -1090,7 +1169,8 @@ ../../src, ../../lexlib, ); - SDKROOT = macosx10.7; + MACOSX_DEPLOYMENT_TARGET = 10.5; + SDKROOT = macosx; }; name = Release; }; diff --git a/scintilla/cocoa/ScintillaTest/AppController.h b/scintilla/cocoa/ScintillaTest/AppController.h index a9ceb6ed..e89ad4c0 100644 --- a/scintilla/cocoa/ScintillaTest/AppController.h +++ b/scintilla/cocoa/ScintillaTest/AppController.h @@ -9,8 +9,8 @@ #import -#import "ScintillaView.h" -#import "InfoBar.h" +#import "Scintilla/ScintillaView.h" +#import "Scintilla/InfoBar.h" @interface AppController : NSObject { IBOutlet NSBox *mEditHost; diff --git a/scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj b/scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj index ba5405c3..ff962ef6 100644 --- a/scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj +++ b/scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj @@ -191,7 +191,7 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0450; + LastUpgradeCheck = 0510; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ScintillaTest" */; compatibilityVersion = "Xcode 3.2"; @@ -286,6 +286,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_DYNAMIC_NO_PIC = NO; @@ -297,13 +298,13 @@ SCI_LEXER, SCI_NAMESPACE, ); - HEADER_SEARCH_PATHS = "../..//**"; + HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; LIBRARY_SEARCH_PATHS = "$(inherited)"; OTHER_LDFLAGS = ""; PRODUCT_NAME = ScintillaTest; - SDKROOT = macosx10.7; + SDKROOT = macosx; USER_HEADER_SEARCH_PATHS = ""; }; name = Debug; @@ -313,6 +314,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_MODEL_TUNING = G5; @@ -322,13 +324,13 @@ SCI_LEXER, SCI_NAMESPACE, ); - HEADER_SEARCH_PATHS = "../..//**"; + HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; LIBRARY_SEARCH_PATHS = "$(inherited)"; OTHER_LDFLAGS = ""; PRODUCT_NAME = ScintillaTest; - SDKROOT = macosx10.7; + SDKROOT = macosx; USER_HEADER_SEARCH_PATHS = ""; }; name = Release; @@ -337,14 +339,24 @@ isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; GCC_C_LANGUAGE_STANDARD = c99; GCC_OPTIMIZATION_LEVEL = 0; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ""; - SDKROOT = macosx10.7; + SDKROOT = macosx; }; name = Debug; }; @@ -352,12 +364,22 @@ isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; GCC_C_LANGUAGE_STANDARD = c99; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; OTHER_LDFLAGS = ""; - SDKROOT = macosx10.7; + SDKROOT = macosx; }; name = Release; }; diff --git a/scintilla/cocoa/ScintillaView.h b/scintilla/cocoa/ScintillaView.h index 8d0a9bb8..a70399fa 100644 --- a/scintilla/cocoa/ScintillaView.h +++ b/scintilla/cocoa/ScintillaView.h @@ -11,25 +11,47 @@ #import -#import "Platform.h" #import "Scintilla.h" #import "SciLexer.h" #import "InfoBarCommunicator.h" -#import "ScintillaCocoa.h" + +/** + * Scintilla sends these two messages to the notify handler. Please refer + * to the Windows API doc for details about the message format. + */ +#define WM_COMMAND 1001 +#define WM_NOTIFY 1002 + +namespace Scintilla { +/** + * On the Mac, there is no WM_COMMAND or WM_NOTIFY message that can be sent + * back to the parent. Therefore, there must be a callback handler that acts + * like a Windows WndProc, where Scintilla can send notifications to. Use + * ScintillaView registerNotifyCallback() to register such a handler. + * Message format is: + *
+ * WM_COMMAND: HIWORD (wParam) = notification code, LOWORD (wParam) = control ID, lParam = ScintillaCocoa* + *
+ * WM_NOTIFY: wParam = control ID, lParam = ptr to SCNotification structure, with hwndFrom set to ScintillaCocoa* + */ +typedef void(*SciNotifyFunc) (intptr_t windowid, unsigned int iMessage, uintptr_t wParam, uintptr_t lParam); + +class ScintillaCocoa; +} @class ScintillaView; -extern NSString *SCIUpdateUINotification; +extern NSString *const SCIUpdateUINotification; @protocol ScintillaNotificationProtocol - (void)notification: (Scintilla::SCNotification*)notification; @end /** - * MarginView draws line numbers and other margins next to the text view. + * SCIMarginView draws line numbers and other margins next to the text view. */ -@interface MarginView : NSRulerView +@interface SCIMarginView : NSRulerView { @private int marginWidth; @@ -45,51 +67,51 @@ extern NSString *SCIUpdateUINotification; @end /** - * InnerView is the Cocoa interface to the Scintilla backend. It handles text input and + * SCIContentView is the Cocoa interface to the Scintilla backend. It handles text input and * provides a canvas for painting the output. */ -@interface InnerView : NSView +@interface SCIContentView : NSView < + NSTextInputClient, + NSUserInterfaceValidations, + NSDraggingSource, + NSDraggingDestination> { @private ScintillaView* mOwner; NSCursor* mCurrentCursor; - NSTrackingRectTag mCurrentTrackingRect; + NSTrackingArea *trackingArea; // Set when we are in composition mode and partial input is displayed. NSRange mMarkedTextRange; - BOOL undoCollectionWasActive; } @property (nonatomic, assign) ScintillaView* owner; -- (void) dealloc; -- (void) removeMarkedText; -- (void) setCursor: (Scintilla::Window::Cursor) cursor; +- (void) setCursor: (int) cursor; - (BOOL) canUndo; - (BOOL) canRedo; @end -@interface ScintillaView : NSView +@interface ScintillaView : NSView { @private // The back end is kind of a controller and model in one. // It uses the content view for display. Scintilla::ScintillaCocoa* mBackend; - + // This is the actual content to which the backend renders itself. - InnerView* mContent; - + SCIContentView* mContent; + NSScrollView *scrollView; - MarginView *marginView; - + SCIMarginView *marginView; + CGFloat zoomDelta; - + // Area to display additional controls (e.g. zoom info, caret position, status info). NSView * mInfoBar; BOOL mInfoBarAtTop; - int mInitialInfoBarWidth; id mDelegate; } @@ -98,31 +120,32 @@ extern NSString *SCIUpdateUINotification; @property (nonatomic, assign) id delegate; @property (nonatomic, readonly) NSScrollView *scrollView; -- (void) dealloc; -- (void) positionSubViews; ++ (Class) contentViewClass; -- (void) sendNotification: (NSString*) notificationName; - (void) notify: (NotificationType) type message: (NSString*) message location: (NSPoint) location value: (float) value; - (void) setCallback: (id ) callback; - (void) suspendDrawing: (BOOL) suspend; +- (void) notification: (Scintilla::SCNotification*) notification; // Scroller handling - (void) setMarginWidth: (int) width; -- (void) scrollerAction: (id) sender; -- (InnerView*) content; +- (SCIContentView*) content; +- (void) updateMarginCursors; // NSTextView compatibility layer. - (NSString*) string; - (void) setString: (NSString*) aString; -- (void) insertText: (NSString*) aString; +- (void) insertText: (id) aString; - (void) setEditable: (BOOL) editable; - (BOOL) isEditable; - (NSRange) selectedRange; - (NSString*) selectedString; +- (void) deleteRange: (NSRange) range; + - (void)setFontName: (NSString*) font size: (int) size bold: (BOOL) bold @@ -153,7 +176,8 @@ extern NSString *SCIUpdateUINotification; - (void) setLexerProperty: (NSString*) name value: (NSString*) value; - (NSString*) getLexerProperty: (NSString*) name; -- (void) registerNotifyCallback: (intptr_t) windowid value: (Scintilla::SciNotifyFunc) callback; +// The delegate property should be used instead of registerNotifyCallback which is deprecated. +- (void) registerNotifyCallback: (intptr_t) windowid value: (Scintilla::SciNotifyFunc) callback __attribute__((deprecated)); - (void) setInfoBar: (NSView *) aView top: (BOOL) top; - (void) setStatusText: (NSString*) text; diff --git a/scintilla/cocoa/ScintillaView.mm b/scintilla/cocoa/ScintillaView.mm index 1ec29a67..cb84066c 100644 --- a/scintilla/cocoa/ScintillaView.mm +++ b/scintilla/cocoa/ScintillaView.mm @@ -9,7 +9,9 @@ * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). */ +#import "Platform.h" #import "ScintillaView.h" +#import "ScintillaCocoa.h" using namespace Scintilla; @@ -17,10 +19,7 @@ using namespace Scintilla; static NSCursor* reverseArrowCursor; static NSCursor* waitCursor; -// The scintilla indicator used for keyboard input. -#define INPUT_INDICATOR INDIC_MAX - 1 - -NSString *SCIUpdateUINotification = @"SCIUpdateUI"; +NSString *const SCIUpdateUINotification = @"SCIUpdateUI"; /** * Provide an NSCursor object that matches the Window::Cursor enumeration. @@ -48,7 +47,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) } -@implementation MarginView +@implementation SCIMarginView @synthesize marginWidth, owner; @@ -60,7 +59,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) owner = nil; marginWidth = 20; currentCursors = [[NSMutableArray arrayWithCapacity:0] retain]; - for (size_t i=0; i<5; i++) + for (size_t i=0; i<=SC_MAX_MARGIN; i++) { [currentCursors addObject: [reverseArrowCursor retain]]; } @@ -78,7 +77,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) - (void) setFrame: (NSRect) frame { [super setFrame: frame]; - + [[self window] invalidateCursorRectsForView: self]; } @@ -103,6 +102,8 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) - (void) mouseDown: (NSEvent *) theEvent { + NSClipView *textView = [[self scrollView] contentView]; + [[textView window] makeFirstResponder:textView]; owner.backend->MouseDown(theEvent); } @@ -127,14 +128,14 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) - (void) resetCursorRects { [super resetCursorRects]; - + int x = 0; NSRect marginRect = [self bounds]; size_t co = [currentCursors count]; for (size_t i=0; iWndProc(SCI_GETMARGINCURSORN, i, 0); - int width =owner.backend->WndProc(SCI_GETMARGINWIDTHN, i, 0); + long cursType = owner.backend->WndProc(SCI_GETMARGINCURSORN, i, 0); + long width =owner.backend->WndProc(SCI_GETMARGINWIDTHN, i, 0); NSCursor *cc = cursorFromEnum(static_cast(cursType)); [currentCursors replaceObjectAtIndex:i withObject: cc]; marginRect.origin.x = x; @@ -147,7 +148,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) @end -@implementation InnerView +@implementation SCIContentView @synthesize owner = mOwner; @@ -156,37 +157,49 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) - (NSView*) initWithFrame: (NSRect) frame { self = [super initWithFrame: frame]; - + if (self != nil) { // Some initialization for our view. mCurrentCursor = [[NSCursor arrowCursor] retain]; - mCurrentTrackingRect = 0; + trackingArea = nil; mMarkedTextRange = NSMakeRange(NSNotFound, 0); - + [self registerForDraggedTypes: [NSArray arrayWithObjects: NSStringPboardType, ScintillaRecPboardType, NSFilenamesPboardType, nil]]; } - + return self; } //-------------------------------------------------------------------------------------------------- /** - * When the view is resized we need to update our tracking rectangle and let the backend know. + * When the view is resized or scrolled we need to update our tracking area. + */ +- (void) updateTrackingAreas +{ + if (trackingArea) + [self removeTrackingArea:trackingArea]; + + int opts = (NSTrackingActiveAlways | NSTrackingInVisibleRect | NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved); + trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds] + options:opts + owner:self + userInfo:nil]; + [self addTrackingArea: trackingArea]; + [super updateTrackingAreas]; +} + +//-------------------------------------------------------------------------------------------------- + +/** + * When the view is resized we need to let the backend know. */ - (void) setFrame: (NSRect) frame { [super setFrame: frame]; - - // Make the content also a tracking rectangle for mouse events. - if (mCurrentTrackingRect != 0) - [self removeTrackingRect: mCurrentTrackingRect]; - mCurrentTrackingRect = [self addTrackingRect: [self bounds] - owner: self - userData: nil - assumeInside: YES]; + mOwner.backend->Resize(); } @@ -195,14 +208,16 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) /** * Called by the backend if a new cursor must be set for the view. */ -- (void) setCursor: (Window::Cursor) cursor +- (void) setCursor: (int) cursor { + Window::Cursor eCursor = (Window::Cursor)cursor; [mCurrentCursor autorelease]; - mCurrentCursor = cursorFromEnum(cursor); + mCurrentCursor = cursorFromEnum(eCursor); [mCurrentCursor retain]; - + // Trigger recreation of the cursor rectangle(s). [[self window] invalidateCursorRectsForView: self]; + [mOwner updateMarginCursors]; } //-------------------------------------------------------------------------------------------------- @@ -213,7 +228,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) - (void) resetCursorRects { [super resetCursorRects]; - + // We only have one cursor rect: our bounds. [self addCursorRect: [self bounds] cursor: mCurrentCursor]; [mCurrentCursor setOnMouseEntered: YES]; @@ -221,13 +236,46 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) //-------------------------------------------------------------------------------------------------- +/** + * Called before repainting. + */ +- (void) viewWillDraw +{ + const NSRect *rects; + NSInteger nRects = 0; + [self getRectsBeingDrawn:&rects count:&nRects]; + if (nRects > 0) { + NSRect rectUnion = rects[0]; + for (int i=0;iWillDraw(rectUnion); + } + [super viewWillDraw]; +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Called before responsive scrolling overdraw. + */ +- (void) prepareContentInRect: (NSRect) rect +{ + mOwner.backend->WillDraw(rect); +#if MAC_OS_X_VERSION_MAX_ALLOWED > 1080 + [super prepareContentInRect: rect]; +#endif +} + +//-------------------------------------------------------------------------------------------------- + /** * Gets called by the runtime when the view needs repainting. */ - (void) drawRect: (NSRect) rect { CGContextRef context = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]; - + if (!mOwner.backend->Draw(rect, context)) { dispatch_async(dispatch_get_main_queue(), ^{ [self setNeedsDisplay:YES]; @@ -239,7 +287,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) /** * Windows uses a client coordinate system where the upper left corner is the origin in a window - * (and so does Scintilla). We have to adjust for that. However by returning YES here, we are + * (and so does Scintilla). We have to adjust for that. However by returning YES here, we are * already done with that. * Note that because of returning YES here most coordinates we use now (e.g. for painting, * invalidating rectangles etc.) are given with +Y pointing down! @@ -296,14 +344,52 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) - (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange { - return nil; + const NSRange posRange = mOwner.backend->PositionsFromCharacters(aRange); + // The backend validated aRange and may have removed characters beyond the end of the document. + const NSRange charRange = mOwner.backend->CharactersFromPositions(posRange); + if (!NSEqualRanges(aRange, charRange)) + { + *actualRange = charRange; + } + + [mOwner message: SCI_SETTARGETRANGE wParam: posRange.location lParam: NSMaxRange(posRange)]; + std::string text([mOwner message: SCI_TARGETASUTF8] + 1, 0); + [mOwner message: SCI_TARGETASUTF8 wParam: 0 lParam: reinterpret_cast(&text[0])]; + NSString *result = [NSString stringWithUTF8String: text.c_str()]; + NSMutableAttributedString *asResult = [[[NSMutableAttributedString alloc] initWithString:result] autorelease]; + + const NSRange rangeAS = NSMakeRange(0, [asResult length]); + const long style = [mOwner message: SCI_GETSTYLEAT wParam:posRange.location]; + std::string fontName([mOwner message: SCI_STYLEGETFONT wParam:style lParam:0] + 1, 0); + [mOwner message: SCI_STYLEGETFONT wParam:style lParam:(sptr_t)&fontName[0]]; + const CGFloat fontSize = [mOwner message: SCI_STYLEGETSIZEFRACTIONAL wParam:style] / 100.0f; + NSString *sFontName = [NSString stringWithUTF8String: fontName.c_str()]; + NSFont *font = [NSFont fontWithName:sFontName size:fontSize]; + [asResult addAttribute:NSFontAttributeName value:font range:rangeAS]; + + return asResult; } //-------------------------------------------------------------------------------------------------- - (NSUInteger) characterIndexForPoint: (NSPoint) point { - return NSNotFound; + const NSRect rectPoint = {point, NSZeroSize}; + const NSRect rectInWindow = [self.window convertRectFromScreen:rectPoint]; + const NSRect rectLocal = [[[self superview] superview] convertRect:rectInWindow fromView:nil]; + + const long position = [mOwner message: SCI_CHARPOSITIONFROMPOINT + wParam: rectLocal.origin.x + lParam: rectLocal.origin.y]; + if (position == INVALID_POSITION) + { + return NSNotFound; + } + else + { + const NSRange index = mOwner.backend->CharactersFromPositions(NSMakeRange(position, 0)); + return index.location; + } } //-------------------------------------------------------------------------------------------------- @@ -318,39 +404,19 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) - (NSRect) firstRectForCharacterRange: (NSRange) aRange actualRange: (NSRangePointer) actualRange { - NSRect rect; - rect.origin.x = [ScintillaView directCall: mOwner - message: SCI_POINTXFROMPOSITION - wParam: 0 - lParam: aRange.location]; - rect.origin.y = [ScintillaView directCall: mOwner - message: SCI_POINTYFROMPOSITION - wParam: 0 - lParam: aRange.location]; - int rangeEnd = aRange.location + aRange.length; - rect.size.width = [ScintillaView directCall: mOwner - message: SCI_POINTXFROMPOSITION - wParam: 0 - lParam: rangeEnd] - rect.origin.x; - rect.size.height = [ScintillaView directCall: mOwner - message: SCI_POINTYFROMPOSITION - wParam: 0 - lParam: rangeEnd] - rect.origin.y; - rect.size.height += [ScintillaView directCall: mOwner - message: SCI_TEXTHEIGHT - wParam: 0 - lParam: 0]; - rect = [[[self superview] superview] convertRect:rect toView:nil]; -#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_6 - if ([self.window respondsToSelector:@selector(convertRectToScreen:)]) - rect = [self.window convertRectToScreen:rect]; - else // convertRectToScreen not available on 10.6 - rect.origin = [self.window convertBaseToScreen:rect.origin]; -#else - rect.origin = [self.window convertBaseToScreen:rect.origin]; -#endif + const NSRange posRange = mOwner.backend->PositionsFromCharacters(aRange); - return rect; + NSRect rect; + rect.origin.x = [mOwner message: SCI_POINTXFROMPOSITION wParam: 0 lParam: posRange.location]; + rect.origin.y = [mOwner message: SCI_POINTYFROMPOSITION wParam: 0 lParam: posRange.location]; + const NSUInteger rangeEnd = NSMaxRange(posRange); + rect.size.width = [mOwner message: SCI_POINTXFROMPOSITION wParam: 0 lParam: rangeEnd] - rect.origin.x; + rect.size.height = [mOwner message: SCI_POINTYFROMPOSITION wParam: 0 lParam: rangeEnd] - rect.origin.y; + rect.size.height += [mOwner message: SCI_TEXTHEIGHT wParam: 0 lParam: 0]; + const NSRect rectInWindow = [[[self superview] superview] convertRect:rect toView:nil]; + const NSRect rectScreen = [self.window convertRectToScreen:rectInWindow]; + + return rectScreen; } //-------------------------------------------------------------------------------------------------- @@ -369,20 +435,32 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) */ - (void) insertText: (id) aString replacementRange: (NSRange) replacementRange { + if ((mMarkedTextRange.location != NSNotFound) && (replacementRange.location != NSNotFound)) + { + NSLog(@"Trying to insertText when there is both a marked range and a replacement range"); + } + // Remove any previously marked text first. - [self removeMarkedText]; + mOwner.backend->CompositionUndo(); + if (mMarkedTextRange.location != NSNotFound) + { + const NSRange posRangeMark = mOwner.backend->PositionsFromCharacters(mMarkedTextRange); + [mOwner message: SCI_SETEMPTYSELECTION wParam: posRangeMark.location]; + } + mMarkedTextRange = NSMakeRange(NSNotFound, 0); if (replacementRange.location == (NSNotFound-1)) // This occurs when the accent popup is visible and menu selected. - // Its replacing a non-existant position so do nothing. + // Its replacing a non-existent position so do nothing. return; - if (replacementRange.length > 0) + if (replacementRange.location != NSNotFound) { - [ScintillaView directCall: mOwner - message: SCI_DELETERANGE - wParam: replacementRange.location - lParam: replacementRange.length]; + const NSRange posRangeReplacement = mOwner.backend->PositionsFromCharacters(replacementRange); + [mOwner message: SCI_DELETERANGE + wParam: posRangeReplacement.location + lParam: posRangeReplacement.length]; + [mOwner message: SCI_SETEMPTYSELECTION wParam: posRangeReplacement.location]; } NSString* newText = @""; @@ -390,7 +468,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) newText = (NSString*) aString; else if ([aString isKindOfClass:[NSAttributedString class]]) newText = (NSString*) [aString string]; - + mOwner.backend->InsertText(newText); } @@ -405,9 +483,10 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) - (NSRange) selectedRange { - long begin = [mOwner getGeneralProperty: SCI_GETSELECTIONSTART parameter: 0]; - long end = [mOwner getGeneralProperty: SCI_GETSELECTIONEND parameter: 0]; - return NSMakeRange(begin, end - begin); + const long positionBegin = [mOwner message: SCI_GETSELECTIONSTART]; + const long positionEnd = [mOwner message: SCI_GETSELECTIONEND]; + NSRange posRangeSel = NSMakeRange(positionBegin, positionEnd-positionBegin); + return mOwner.backend->CharactersFromPositions(posRangeSel); } //-------------------------------------------------------------------------------------------------- @@ -429,72 +508,86 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) else if ([aString isKindOfClass:[NSAttributedString class]]) newText = (NSString*) [aString string]; - - long currentPosition = [mOwner getGeneralProperty: SCI_GETCURRENTPOS parameter: 0]; // Replace marked text if there is one. if (mMarkedTextRange.length > 0) { - [mOwner setGeneralProperty: SCI_SETSELECTIONSTART - value: mMarkedTextRange.location]; - [mOwner setGeneralProperty: SCI_SETSELECTIONEND - value: mMarkedTextRange.location + mMarkedTextRange.length]; - currentPosition = mMarkedTextRange.location; + mOwner.backend->CompositionUndo(); + if (replacementRange.location != NSNotFound) + { + // This situation makes no sense and has not occurred in practice. + NSLog(@"Can not handle a replacement range when there is also a marked range"); + } + else + { + replacementRange = mMarkedTextRange; + const NSRange posRangeMark = mOwner.backend->PositionsFromCharacters(mMarkedTextRange); + [mOwner message: SCI_SETEMPTYSELECTION wParam: posRangeMark.location]; + } } else { - // Switching into composition so remember if collecting undo. - undoCollectionWasActive = [mOwner getGeneralProperty: SCI_GETUNDOCOLLECTION] != 0; - - // Keep Scintilla from collecting undo actions for the composition task. - [mOwner setGeneralProperty: SCI_SETUNDOCOLLECTION value: 0]; - - // Ensure only a single selection - mOwner.backend->SelectOnlyMainSelection(); - } - - if (replacementRange.length > 0) - { - [ScintillaView directCall: mOwner - message: SCI_DELETERANGE - wParam: replacementRange.location - lParam: replacementRange.length]; - } - - // Note: Scintilla internally works almost always with bytes instead chars, so we need to take - // this into account when determining selection ranges and such. - std::string raw_text = [newText UTF8String]; - int lengthInserted = mOwner.backend->InsertText(newText); - - mMarkedTextRange.location = currentPosition; - mMarkedTextRange.length = lengthInserted; + // Must perform deletion before entering composition mode or else + // both document and undo history will not contain the deleted text + // leading to an inaccurate and unusable undo history. - if (lengthInserted > 0) + // Convert selection virtual space into real space + mOwner.backend->ConvertSelectionVirtualSpace(); + + if (replacementRange.location != NSNotFound) + { + const NSRange posRangeReplacement = mOwner.backend->PositionsFromCharacters(replacementRange); + [mOwner message: SCI_DELETERANGE + wParam: posRangeReplacement.location + lParam: posRangeReplacement.length]; + } + else // No marked or replacement range, so replace selection + { + if (!mOwner.backend->ScintillaCocoa::ClearAllSelections()) { + // Some of the selection is protected so can not perform composition here + return; + } + // Ensure only a single selection. + mOwner.backend->SelectOnlyMainSelection(); + replacementRange = [self selectedRange]; + } + } + + // To support IME input to multiple selections, the following code would + // need to insert newText at each selection, mark each piece of new text and then + // select range relative to each insertion. + + if ([newText length]) { + // Switching into composition. + mOwner.backend->CompositionStart(); + + NSRange posRangeCurrent = mOwner.backend->PositionsFromCharacters(NSMakeRange(replacementRange.location, 0)); + // Note: Scintilla internally works almost always with bytes instead chars, so we need to take + // this into account when determining selection ranges and such. + int lengthInserted = mOwner.backend->InsertText(newText); + posRangeCurrent.length = lengthInserted; + mMarkedTextRange = mOwner.backend->CharactersFromPositions(posRangeCurrent); // Mark the just inserted text. Keep the marked range for later reset. - [mOwner setGeneralProperty: SCI_SETINDICATORCURRENT value: INPUT_INDICATOR]; + [mOwner setGeneralProperty: SCI_SETINDICATORCURRENT value: INDIC_IME]; [mOwner setGeneralProperty: SCI_INDICATORFILLRANGE - parameter: mMarkedTextRange.location - value: mMarkedTextRange.length]; + parameter: posRangeCurrent.location + value: posRangeCurrent.length]; } else { + mMarkedTextRange = NSMakeRange(NSNotFound, 0); // Re-enable undo action collection if composition ended (indicated by an empty mark string). - if (undoCollectionWasActive) - [mOwner setGeneralProperty: SCI_SETUNDOCOLLECTION value: range.length == 0]; + mOwner.backend->CompositionCommit(); } // Select the part which is indicated in the given range. It does not scroll the caret into view. if (range.length > 0) { // range is in characters so convert to bytes for selection. - int rangeStart = currentPosition; - for (size_t characterInComposition=0; characterInCompositionPositionsFromCharacters(range); + [mOwner setGeneralProperty: SCI_SETSELECTION parameter: NSMaxRange(posRangeSelect) value: posRangeSelect.location]; } } @@ -504,38 +597,8 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) { if (mMarkedTextRange.length > 0) { - [mOwner setGeneralProperty: SCI_SETINDICATORCURRENT value: INPUT_INDICATOR]; - [mOwner setGeneralProperty: SCI_INDICATORCLEARRANGE - parameter: mMarkedTextRange.location - value: mMarkedTextRange.length]; + mOwner.backend->CompositionCommit(); mMarkedTextRange = NSMakeRange(NSNotFound, 0); - - // Reenable undo action collection, after we are done with text composition. - if (undoCollectionWasActive) - [mOwner setGeneralProperty: SCI_SETUNDOCOLLECTION value: 1]; - } -} - -//-------------------------------------------------------------------------------------------------- - -/** - * Removes any currently marked text. - */ -- (void) removeMarkedText -{ - if (mMarkedTextRange.length > 0) - { - // We have already marked text. Replace that. - [mOwner setGeneralProperty: SCI_SETSELECTIONSTART - value: mMarkedTextRange.location]; - [mOwner setGeneralProperty: SCI_SETSELECTIONEND - value: mMarkedTextRange.location + mMarkedTextRange.length]; - mOwner.backend->InsertText(@""); - mMarkedTextRange = NSMakeRange(NSNotFound, 0); - - // Reenable undo action collection, after we are done with text composition. - if (undoCollectionWasActive) - [mOwner setGeneralProperty: SCI_SETUNDOCOLLECTION value: 1]; } } @@ -565,7 +628,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) //-------------------------------------------------------------------------------------------------- -- (void) mouseDown: (NSEvent *) theEvent +- (void) mouseDown: (NSEvent *) theEvent { mOwner.backend->MouseDown(theEvent); } @@ -609,7 +672,11 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) /** * Mouse wheel with command key magnifies text. + * Enabling this code causes visual garbage to appear when scrolling + * horizontally on OS X 10.9 with a retina display. + * Pinch gestures and key commands can be used for magnification. */ +#ifdef SCROLL_WHEEL_MAGNIFICATION - (void) scrollWheel: (NSEvent *) theEvent { if (([theEvent modifierFlags] & NSCommandKeyMask) != 0) { @@ -618,6 +685,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) [super scrollWheel:theEvent]; } } +#endif //-------------------------------------------------------------------------------------------------- @@ -632,8 +700,8 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) if ((rc.origin.y > 0) && (NSMaxY(rc) < contentRect.size.height)) { // Only snap for positions inside the document - allow outside // for overshoot. - int lineHeight = mOwner.backend->WndProc(SCI_TEXTHEIGHT, 0, 0); - rc.origin.y = roundf(rc.origin.y / lineHeight) * lineHeight; + long lineHeight = mOwner.backend->WndProc(SCI_TEXTHEIGHT, 0, 0); + rc.origin.y = roundf(static_cast(rc.origin.y) / lineHeight) * lineHeight; } return rc; } @@ -663,7 +731,46 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) //-------------------------------------------------------------------------------------------------- /** - * Called when an external drag operation enters the view. + * Implement NSDraggingSource. + */ + +- (NSDragOperation)draggingSession: (NSDraggingSession *) session +sourceOperationMaskForDraggingContext: (NSDraggingContext) context +{ + switch(context) + { + case NSDraggingContextOutsideApplication: + return NSDragOperationCopy | NSDragOperationMove | NSDragOperationDelete; + + case NSDraggingContextWithinApplication: + default: + return NSDragOperationCopy | NSDragOperationMove | NSDragOperationDelete; + } +} + +- (void)draggingSession:(NSDraggingSession *)session + movedToPoint:(NSPoint)screenPoint +{ +} + +- (void)draggingSession:(NSDraggingSession *)session + endedAtPoint:(NSPoint)screenPoint + operation:(NSDragOperation)operation +{ + if (operation == NSDragOperationDelete) + { + mOwner.backend->WndProc(SCI_CLEAR, 0, 0); + } +} + +/** + * Implement NSDraggingDestination. + */ + +//-------------------------------------------------------------------------------------------------- + +/** + * Called when an external drag operation enters the view. */ - (NSDragOperation) draggingEntered: (id ) sender { @@ -702,29 +809,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) - (BOOL) performDragOperation: (id ) sender { - return mOwner.backend->PerformDragOperation(sender); -} - -//-------------------------------------------------------------------------------------------------- - -/** - * Returns operations we allow as drag source. - */ -- (NSDragOperation) draggingSourceOperationMaskForLocal: (BOOL) flag -{ - return NSDragOperationCopy | NSDragOperationMove | NSDragOperationDelete; -} - -//-------------------------------------------------------------------------------------------------- - -/** - * Finished a drag: may need to delete selection. - */ - -- (void)draggedImage:(NSImage *)image endedAt:(NSPoint)screenPoint operation:(NSDragOperation)operation { - if (operation == NSDragOperationDelete) { - mOwner.backend->WndProc(SCI_CLEAR, 0, 0); - } + return mOwner.backend->PerformDragOperation(sender); } //-------------------------------------------------------------------------------------------------- @@ -769,12 +854,24 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) - (void) paste: (id) sender { #pragma unused(sender) + if (mMarkedTextRange.location != NSNotFound) + { + [[NSTextInputContext currentInputContext] discardMarkedText]; + mOwner.backend->CompositionCommit(); + mMarkedTextRange = NSMakeRange(NSNotFound, 0); + } mOwner.backend->Paste(); } - (void) undo: (id) sender { #pragma unused(sender) + if (mMarkedTextRange.location != NSNotFound) + { + [[NSTextInputContext currentInputContext] discardMarkedText]; + mOwner.backend->CompositionCommit(); + mMarkedTextRange = NSMakeRange(NSNotFound, 0); + } mOwner.backend->Undo(); } @@ -786,7 +883,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) - (BOOL) canUndo { - return mOwner.backend->CanUndo(); + return mOwner.backend->CanUndo() && (mMarkedTextRange.location == NSNotFound); } - (BOOL) canRedo @@ -856,12 +953,12 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) if (self == [ScintillaView class]) { NSBundle* bundle = [NSBundle bundleForClass: [ScintillaView class]]; - - NSString* path = [bundle pathForResource: @"mac_cursor_busy" ofType: @"png" inDirectory: nil]; + + NSString* path = [bundle pathForResource: @"mac_cursor_busy" ofType: @"tiff" inDirectory: nil]; NSImage* image = [[[NSImage alloc] initWithContentsOfFile: path] autorelease]; waitCursor = [[NSCursor alloc] initWithImage: image hotSpot: NSMakePoint(2, 2)]; - - path = [bundle pathForResource: @"mac_cursor_flipped" ofType: @"png" inDirectory: nil]; + + path = [bundle pathForResource: @"mac_cursor_flipped" ofType: @"tiff" inDirectory: nil]; image = [[[NSImage alloc] initWithContentsOfFile: path] autorelease]; reverseArrowCursor = [[NSCursor alloc] initWithImage: image hotSpot: NSMakePoint(12, 2)]; } @@ -869,6 +966,17 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) //-------------------------------------------------------------------------------------------------- +/** + * Specify the SCIContentView class. Can be overridden in a subclass to provide an SCIContentView subclass. + */ + ++ (Class) contentViewClass +{ + return [SCIContentView class]; +} + +//-------------------------------------------------------------------------------------------------- + /** * Receives zoom messages, for example when a "pinch zoom" is performed on the trackpad. */ @@ -877,16 +985,18 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 zoomDelta += event.magnification * 10.0; - if (fabsf(zoomDelta)>=1.0) { - long zoomFactor = [self getGeneralProperty: SCI_GETZOOM] + zoomDelta; + if (fabs(zoomDelta)>=1.0) { + long zoomFactor = static_cast([self getGeneralProperty: SCI_GETZOOM] + zoomDelta); [self setGeneralProperty: SCI_SETZOOM parameter: zoomFactor value:0]; zoomDelta = 0.0; - } + } #endif } - (void) beginGestureWithEvent: (NSEvent *) event { +// Scintilla is only interested in this event as the starft of a zoom +#pragma unused(event) zoomDelta = 0.0; } @@ -909,11 +1019,14 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) * @param type The type of the notification. * @param message Carries the new status message if the type is a status message change. * @param location Carries the new location (e.g. caret) if the type is a caret change or similar type. - * @param location Carries the new zoom value if the type is a zoom change. + * @param value Carries the new zoom value if the type is a zoom change. */ - (void) notify: (NotificationType) type message: (NSString*) message location: (NSPoint) location value: (float) value { +// These parameters are just to conform to the protocol +#pragma unused(message) +#pragma unused(location) switch (type) { case IBNZoomChanged: @@ -933,7 +1046,8 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) - (void) setCallback: (id ) callback { - // Not used. Only here to satisfy protocol. +// Not used. Only here to satisfy protocol. +#pragma unused(callback) } //-------------------------------------------------------------------------------------------------- @@ -953,90 +1067,70 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) //-------------------------------------------------------------------------------------------------- /** - * Notification function used by Scintilla to call us back (e.g. for handling clicks on the + * Method receives notifications from Scintilla (e.g. for handling clicks on the * folder margin or changes in the editor). * A delegate can be set to receive all notifications. If set no handling takes place here, except * for action pertaining to internal stuff (like the info bar). */ -static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wParam, uintptr_t lParam) +- (void) notification: (Scintilla::SCNotification*)scn { - // WM_NOTIFY means we got a parent notification with a special notification structure. - // Here we don't really differentiate between parent and own notifications and handle both. - ScintillaView* editor; - switch (iMessage) - { - case WM_NOTIFY: - { - // Parent notification. Details are passed as SCNotification structure. - SCNotification* scn = reinterpret_cast(lParam); - ScintillaCocoa *psc = reinterpret_cast(scn->nmhdr.hwndFrom); - editor = reinterpret_cast(psc->ContentView()).owner; + // Parent notification. Details are passed as SCNotification structure. - if (editor.delegate != nil) - { - [editor.delegate notification: scn]; - if (scn->nmhdr.code != SCN_ZOOM && scn->nmhdr.code != SCN_UPDATEUI) - return; - } - - switch (scn->nmhdr.code) - { - case SCN_MARGINCLICK: - { - if (scn->margin == 2) - { - // Click on the folder margin. Toggle the current line if possible. - long line = [editor getGeneralProperty: SCI_LINEFROMPOSITION parameter: scn->position]; - [editor setGeneralProperty: SCI_TOGGLEFOLD value: line]; - } - break; - }; - case SCN_MODIFIED: - { - // Decide depending on the modification type what to do. - // There can be more than one modification carried by one notification. - if (scn->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) - [editor sendNotification: NSTextDidChangeNotification]; - break; - } - case SCN_ZOOM: - { - // A zoom change happend. Notify info bar if there is one. - float zoom = [editor getGeneralProperty: SCI_GETZOOM parameter: 0]; - long fontSize = [editor getGeneralProperty: SCI_STYLEGETSIZE parameter: STYLE_DEFAULT]; - float factor = (zoom / fontSize) + 1; - [editor->mInfoBar notify: IBNZoomChanged message: nil location: NSZeroPoint value: factor]; - break; - } - case SCN_UPDATEUI: - { - // Triggered whenever changes in the UI state need to be reflected. - // These can be: caret changes, selection changes etc. - NSPoint caretPosition = editor->mBackend->GetCaretPosition(); - [editor->mInfoBar notify: IBNCaretChanged message: nil location: caretPosition value: 0]; - [editor sendNotification: SCIUpdateUINotification]; - [editor sendNotification: NSTextViewDidChangeSelectionNotification]; - break; - } - } - break; - } - case WM_COMMAND: + if (mDelegate != nil) + { + [mDelegate notification: scn]; + if (scn->nmhdr.code != SCN_ZOOM && scn->nmhdr.code != SCN_UPDATEUI) + return; + } + + switch (scn->nmhdr.code) + { + case SCN_MARGINCLICK: { - // Notifications for the editor itself. - ScintillaCocoa* backend = reinterpret_cast(lParam); - editor = backend->TopContainer(); - switch (wParam >> 16) + if (scn->margin == 2) { - case SCEN_KILLFOCUS: - [editor sendNotification: NSTextDidEndEditingNotification]; - break; - case SCEN_SETFOCUS: // Nothing to do for now. - break; + // Click on the folder margin. Toggle the current line if possible. + long line = [self getGeneralProperty: SCI_LINEFROMPOSITION parameter: scn->position]; + [self setGeneralProperty: SCI_TOGGLEFOLD value: line]; + } + break; + }; + case SCN_MODIFIED: + { + // Decide depending on the modification type what to do. + // There can be more than one modification carried by one notification. + if (scn->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) + [self sendNotification: NSTextDidChangeNotification]; + break; + } + case SCN_ZOOM: + { + // A zoom change happened. Notify info bar if there is one. + float zoom = [self getGeneralProperty: SCI_GETZOOM parameter: 0]; + long fontSize = [self getGeneralProperty: SCI_STYLEGETSIZE parameter: STYLE_DEFAULT]; + float factor = (zoom / fontSize) + 1; + [mInfoBar notify: IBNZoomChanged message: nil location: NSZeroPoint value: factor]; + break; + } + case SCN_UPDATEUI: + { + // Triggered whenever changes in the UI state need to be reflected. + // These can be: caret changes, selection changes etc. + NSPoint caretPosition = mBackend->GetCaretPosition(); + [mInfoBar notify: IBNCaretChanged message: nil location: caretPosition value: 0]; + [self sendNotification: SCIUpdateUINotification]; + if (scn->updated & (SC_UPDATE_SELECTION | SC_UPDATE_CONTENT)) + { + [self sendNotification: NSTextViewDidChangeSelectionNotification]; } break; } - }; + case SCN_FOCUSOUT: + [self sendNotification: NSTextDidEndEditingNotification]; + break; + case SCN_FOCUSIN: // Nothing to do for now. + break; + } } //-------------------------------------------------------------------------------------------------- @@ -1049,7 +1143,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa self = [super initWithFrame:frame]; if (self) { - mContent = [[[InnerView alloc] init] autorelease]; + mContent = [[[[[self class] contentViewClass] alloc] initWithFrame:NSZeroRect] autorelease]; mContent.owner = self; // Initialize the scrollers but don't show them yet. @@ -1066,33 +1160,33 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa //[scrollView setHorizontalScrollElasticity:NSScrollElasticityNone]; [self addSubview: scrollView]; - marginView = [[MarginView alloc] initWithScrollView:scrollView]; + marginView = [[SCIMarginView alloc] initWithScrollView:scrollView]; marginView.owner = self; [marginView setRuleThickness:[marginView requiredThickness]]; [scrollView setVerticalRulerView:marginView]; [scrollView setHasHorizontalRuler:NO]; [scrollView setHasVerticalRuler:YES]; [scrollView setRulersVisible:YES]; - + mBackend = new ScintillaCocoa(mContent, marginView); // Establish a connection from the back end to this container so we can handle situations // which require our attention. - mBackend->RegisterNotifyCallback(nil, notification); - - // Setup a special indicator used in the editor to provide visual feedback for + mBackend->SetDelegate(self); + + // Setup a special indicator used in the editor to provide visual feedback for // input composition, depending on language, keyboard etc. - [self setColorProperty: SCI_INDICSETFORE parameter: INPUT_INDICATOR fromHTML: @"#FF0000"]; - [self setGeneralProperty: SCI_INDICSETUNDER parameter: INPUT_INDICATOR value: 1]; - [self setGeneralProperty: SCI_INDICSETSTYLE parameter: INPUT_INDICATOR value: INDIC_PLAIN]; - [self setGeneralProperty: SCI_INDICSETALPHA parameter: INPUT_INDICATOR value: 100]; - + [self setColorProperty: SCI_INDICSETFORE parameter: INDIC_IME fromHTML: @"#FF0000"]; + [self setGeneralProperty: SCI_INDICSETUNDER parameter: INDIC_IME value: 1]; + [self setGeneralProperty: SCI_INDICSETSTYLE parameter: INDIC_IME value: INDIC_PLAIN]; + [self setGeneralProperty: SCI_INDICSETALPHA parameter: INDIC_IME value: 100]; + NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; [center addObserver:self selector:@selector(applicationDidResignActive:) name:NSApplicationDidResignActiveNotification object:nil]; - + [center addObserver:self selector:@selector(applicationDidBecomeActive:) name:NSApplicationDidBecomeActiveNotification @@ -1113,6 +1207,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa { [[NSNotificationCenter defaultCenter] removeObserver:self]; delete mBackend; + [marginView release]; [super dealloc]; } @@ -1135,9 +1230,9 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa - (void) viewDidMoveToWindow { [super viewDidMoveToWindow]; - + [self positionSubViews]; - + // Enable also mouse move events for our window (and so this view). [[self window] setAcceptsMouseMovedEvents: YES]; } @@ -1149,16 +1244,17 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa */ - (void) positionSubViews { - int scrollerWidth = [NSScroller scrollerWidth]; + CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:NSRegularControlSize + scrollerStyle:NSScrollerStyleLegacy]; NSSize size = [self frame].size; - NSRect barFrame = {0, size.height - scrollerWidth, size.width, static_cast(scrollerWidth)}; + NSRect barFrame = {{0, size.height - scrollerWidth}, {size.width, scrollerWidth}}; BOOL infoBarVisible = mInfoBar != nil && ![mInfoBar isHidden]; // Horizontal offset of the content. Almost always 0 unless the vertical scroller // is on the left side. - int contentX = 0; - NSRect scrollRect = {contentX, 0, size.width, size.height}; + CGFloat contentX = 0; + NSRect scrollRect = {{contentX, 0}, {size.width, size.height}}; // Info bar frame. if (infoBarVisible) @@ -1229,7 +1325,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa - (NSString*) selectedString { NSString *result = @""; - + const long length = mBackend->WndProc(SCI_GETSELTEXT, 0, 0); if (length > 0) { @@ -1237,19 +1333,33 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa try { mBackend->WndProc(SCI_GETSELTEXT, length + 1, (sptr_t) &buffer[0]); - + result = [NSString stringWithUTF8String: buffer.c_str()]; } catch (...) { } } - + return result; } //-------------------------------------------------------------------------------------------------- +/** + * Delete a range from the document. + */ +- (void) deleteRange: (NSRange) aRange +{ + if (aRange.length > 0) + { + NSRange posRange = mBackend->PositionsFromCharacters(aRange); + [self message: SCI_DELETERANGE wParam: posRange.location lParam: posRange.length]; + } +} + +//-------------------------------------------------------------------------------------------------- + /** * Getter for the current text in raw form (no formatting information included). * If there is no text available an empty string is returned. @@ -1257,7 +1367,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa - (NSString*) string { NSString *result = @""; - + const long length = mBackend->WndProc(SCI_GETLENGTH, 0, 0); if (length > 0) { @@ -1265,14 +1375,14 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa try { mBackend->WndProc(SCI_GETTEXT, length + 1, (sptr_t) &buffer[0]); - + result = [NSString stringWithUTF8String: buffer.c_str()]; } catch (...) { } } - + return result; } @@ -1311,13 +1421,19 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa //-------------------------------------------------------------------------------------------------- -- (InnerView*) content +- (SCIContentView*) content { return mContent; } //-------------------------------------------------------------------------------------------------- +- (void) updateMarginCursors { + [[self window] invalidateCursorRectsForView: marginView]; +} + +//-------------------------------------------------------------------------------------------------- + /** * Direct call into the backend to allow uninterpreted access to it. The values to be passed in and * the result heavily depend on the message that is used for the call. Refer to the Scintilla @@ -1326,7 +1442,8 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa + (sptr_t) directCall: (ScintillaView*) sender message: (unsigned int) message wParam: (uptr_t) wParam lParam: (sptr_t) lParam { - return ScintillaCocoa::DirectFunction(sender->mBackend, message, wParam, lParam); + return ScintillaCocoa::DirectFunction( + reinterpret_cast(sender->mBackend), message, wParam, lParam); } - (sptr_t) message: (unsigned int) message wParam: (uptr_t) wParam lParam: (sptr_t) lParam @@ -1413,7 +1530,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa */ - (long) getGeneralProperty: (int) property ref: (const void*) ref { - return mBackend->WndProc(property, 0, (sptr_t) ref); + return mBackend->WndProc(property, 0, (sptr_t) ref); } //-------------------------------------------------------------------------------------------------- @@ -1425,10 +1542,10 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa { if ([value colorSpaceName] != NSDeviceRGBColorSpace) value = [value colorUsingColorSpaceName: NSDeviceRGBColorSpace]; - long red = [value redComponent] * 255; - long green = [value greenComponent] * 255; - long blue = [value blueComponent] * 255; - + long red = static_cast([value redComponent] * 255); + long green = static_cast([value greenComponent] * 255); + long blue = static_cast([value blueComponent] * 255); + long color = (blue << 16) + (green << 8) + red; mBackend->WndProc(property, parameter, color); } @@ -1445,32 +1562,32 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa { bool longVersion = [fromHTML length] > 6; int index = 1; - + char value[3] = {0, 0, 0}; - value[0] = [fromHTML characterAtIndex: index++]; + value[0] = static_cast([fromHTML characterAtIndex: index++]); if (longVersion) - value[1] = [fromHTML characterAtIndex: index++]; + value[1] = static_cast([fromHTML characterAtIndex: index++]); else value[1] = value[0]; unsigned rawRed; [[NSScanner scannerWithString: [NSString stringWithUTF8String: value]] scanHexInt: &rawRed]; - value[0] = [fromHTML characterAtIndex: index++]; + value[0] = static_cast([fromHTML characterAtIndex: index++]); if (longVersion) - value[1] = [fromHTML characterAtIndex: index++]; + value[1] = static_cast([fromHTML characterAtIndex: index++]); else value[1] = value[0]; - + unsigned rawGreen; [[NSScanner scannerWithString: [NSString stringWithUTF8String: value]] scanHexInt: &rawGreen]; - value[0] = [fromHTML characterAtIndex: index++]; + value[0] = static_cast([fromHTML characterAtIndex: index++]); if (longVersion) - value[1] = [fromHTML characterAtIndex: index++]; + value[1] = static_cast([fromHTML characterAtIndex: index++]); else value[1] = value[0]; - + unsigned rawBlue; [[NSScanner scannerWithString: [NSString stringWithUTF8String: value]] scanHexInt: &rawBlue]; @@ -1487,9 +1604,9 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa - (NSColor*) getColorProperty: (int) property parameter: (long) parameter { long color = mBackend->WndProc(property, parameter, 0); - float red = (color & 0xFF) / 255.0; - float green = ((color >> 8) & 0xFF) / 255.0; - float blue = ((color >> 16) & 0xFF) / 255.0; + CGFloat red = (color & 0xFF) / 255.0; + CGFloat green = ((color >> 8) & 0xFF) / 255.0; + CGFloat blue = ((color >> 16) & 0xFF) / 255.0; NSColor* result = [NSColor colorWithDeviceRed: red green: green blue: blue alpha: 1]; return result; } @@ -1577,9 +1694,6 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa /** * Sets the new control which is displayed as info bar at the top or bottom of the editor. * Set newBar to nil if you want to hide the bar again. - * When aligned to bottom position then the info bar and the horizontal scroller share the available - * space. The info bar will then only get the width it is currently set to less a minimal amount - * reserved for the scroller. At the top position it gets the full width of the control. * The info bar's height is set to the height of the scrollbar. */ - (void) setInfoBar: (NSView *) newBar top: (BOOL) top @@ -1587,18 +1701,15 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa if (mInfoBar != newBar) { [mInfoBar removeFromSuperview]; - + mInfoBar = newBar; mInfoBarAtTop = top; if (mInfoBar != nil) { [self addSubview: mInfoBar]; [mInfoBar setCallback: self]; - - // Keep the initial width as reference for layout changes. - mInitialInfoBarWidth = [mInfoBar frame].size.width; } - + [self positionSubViews]; } } @@ -1623,9 +1734,12 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa //-------------------------------------------------------------------------------------------------- -- (void)insertText: (NSString*)text +- (void)insertText: (id) aString { - mBackend->InsertText(text); + if ([aString isKindOfClass:[NSString class]]) + mBackend->InsertText(aString); + else if ([aString isKindOfClass:[NSAttributedString class]]) + mBackend->InsertText([aString string]); } //-------------------------------------------------------------------------------------------------- @@ -1650,7 +1764,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa //-------------------------------------------------------------------------------------------------- /** - * Searches and marks the first occurance of the given text and optionally scrolls it into view. + * Searches and marks the first occurrence of the given text and optionally scrolls it into view. * * @result YES if something was found, NO otherwise. */ @@ -1667,10 +1781,10 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa if (wholeWord) searchFlags |= SCFIND_WHOLEWORD; - int selectionStart = [self getGeneralProperty: SCI_GETSELECTIONSTART parameter: 0]; - int selectionEnd = [self getGeneralProperty: SCI_GETSELECTIONEND parameter: 0]; - - // Sets the start point for the comming search to the begin of the current selection. + long selectionStart = [self getGeneralProperty: SCI_GETSELECTIONSTART parameter: 0]; + long selectionEnd = [self getGeneralProperty: SCI_GETSELECTIONEND parameter: 0]; + + // Sets the start point for the coming search to the beginning of the current selection. // For forward searches we have therefore to set the selection start to the current selection end // for proper incremental search. This does not harm as we either get a new selection if something // is found or the previous selection is restored. @@ -1745,15 +1859,15 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa wholeWord: (BOOL) wholeWord doAll: (BOOL) doAll { - // The current position is where we start searching for single occurences. Otherwise we start at + // The current position is where we start searching for single occurrences. Otherwise we start at // the beginning of the document. - int startPosition; + long startPosition; if (doAll) startPosition = 0; // Start at the beginning of the text if we replace all occurrences. else - // For a signle replacement we start at the current caret position. + // For a single replacement we start at the current caret position. startPosition = [self getGeneralProperty: SCI_GETCURRENTPOS]; - int endPosition = [self getGeneralProperty: SCI_GETTEXTLENGTH]; + long endPosition = [self getGeneralProperty: SCI_GETTEXTLENGTH]; int searchFlags= 0; if (matchCase) @@ -1765,11 +1879,11 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa [self setGeneralProperty: SCI_SETTARGETEND value: endPosition]; const char* textToSearch = [searchText UTF8String]; - int sourceLength = strlen(textToSearch); // Length in bytes. + long sourceLength = strlen(textToSearch); // Length in bytes. const char* replacement = [newText UTF8String]; - int targetLength = strlen(replacement); // Length in bytes. + long targetLength = strlen(replacement); // Length in bytes. sptr_t result; - + int replaceCount = 0; if (doAll) { @@ -1788,7 +1902,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa wParam: targetLength lParam: (sptr_t) replacement]; - // The replacement changes the target range to the replaced text. Continue after that til the end. + // The replacement changes the target range to the replaced text. Continue after that till the end. // The text length might be changed by the replacement so make sure the target end is the actual // text end. [self setGeneralProperty: SCI_SETTARGETSTART value: [self getGeneralProperty: SCI_GETTARGETEND]]; @@ -1815,7 +1929,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa [self setGeneralProperty: SCI_SETSELECTIONEND value: [self getGeneralProperty: SCI_GETTARGETEND]]; } } - + return replaceCount; } diff --git a/scintilla/cocoa/checkbuildosx.sh b/scintilla/cocoa/checkbuildosx.sh index f6b56328..45f7ae43 100644 --- a/scintilla/cocoa/checkbuildosx.sh +++ b/scintilla/cocoa/checkbuildosx.sh @@ -4,56 +4,58 @@ cd ../.. # ************************************************************ -# Target 1: build framework and test app with Xcode targetting OS X 10.7 +# Target 1: Unit tests + +echo Unit tests + +cd scintilla/test/unit +make clean +make test +cd ../../.. + +# ************************************************************ +# Target 2: build framework and test app with Xcode targetting OS X 10.n with n from 9 to 5 +# Only SDK versions that are installed will be built # Clean both then build both -- if perform clean in ScintillaTest, also cleans ScintillaFramework # which can cause double build -cd scintilla/cocoa/ScintillaFramework -xcodebuild clean -cd ../ScintillaTest -xcodebuild clean -cd ../ScintillaFramework -xcodebuild -sdk macosx10.7 -cd ../ScintillaTest -xcodebuild -sdk macosx10.7 -cd ../../.. + +echo Building Cocoa-native ScintillaFramework and ScintillaTest +for sdk in macosx10.9 macosx10.8 macosx10.7 macosx10.6 macosx10.5 +do + xcodebuild -showsdks | grep $sdk + if [ "$(xcodebuild -showsdks | grep $sdk)" != "" ] + then + echo Building with $sdk + cd scintilla/cocoa/ScintillaFramework + xcodebuild clean + cd ../ScintillaTest + xcodebuild clean + cd ../ScintillaFramework + xcodebuild -sdk $sdk + cd ../ScintillaTest + xcodebuild -sdk $sdk + cd ../../.. + else + echo Warning $sdk not available + fi +done # ************************************************************ -# Target 2: build framework and test app with Xcode targetting OS X 10.6 -cd scintilla/cocoa/ScintillaFramework -xcodebuild clean -cd ../ScintillaTest -xcodebuild clean -cd ../ScintillaFramework -xcodebuild -sdk macosx10.6 -cd ../ScintillaTest -xcodebuild -sdk macosx10.6 -cd ../../.. - -# ************************************************************ -# Target 3: build framework and test app with Xcode targetting OS X 10.5 -cd scintilla/cocoa/ScintillaFramework -xcodebuild clean -cd ../ScintillaTest -xcodebuild clean -cd ../ScintillaFramework -xcodebuild -sdk macosx10.5 -cd ../ScintillaTest -xcodebuild -sdk macosx10.5 -cd ../../.. - -# ************************************************************ -# Target 4: Qt builds +# Target 3: Qt builds # Requires Qt development libraries and qmake to be installed + +echo Building Qt and PySide + cd scintilla/qt cd ScintillaEditBase -qmake +qmake -spec macx-xcode xcodebuild clean xcodebuild cd .. cd ScintillaEdit python WidgetGen.py -qmake +qmake -spec macx-xcode xcodebuild clean xcodebuild cd .. @@ -62,14 +64,3 @@ cd ScintillaEditPy python sepbuild.py cd .. cd ../.. - -# ************************************************************ -# Target 5: build framework and test app with make -cd scintilla/cocoa - -make -f Framework.mk clean -make -f Framework.mk all - -make -f SciTest.mk all - -cd ../.. diff --git a/scintilla/cocoa/common.mk b/scintilla/cocoa/common.mk deleted file mode 100644 index 600e3ada..00000000 --- a/scintilla/cocoa/common.mk +++ /dev/null @@ -1,57 +0,0 @@ -### shared variables and targets between Framework.mk and SciTest.mk ### - -# build directories -BLD=build -APP_BLD=$(BLD)/Application -FRM_BLD=$(BLD)/Framework - -ifdef DBG -CFLAGS=-g -O0 -else -CFLAGS=-Os -endif - -# compiler and compiler options -ARCH=-arch i386 $(CFLAGS) -CC=gcc -x c++ $(ARCH) -CO=gcc -x objective-c++ $(ARCH) -CCX=$(CC) $(gDEFs) $(INCS) -CCO=$(CO) $(gDEFs) $(INCS) - -# include directories and global #define -gDEFs=-DSCI_NAMESPACE -DSCI_LEXER - -# source directories -SRC_DIRS=../src ./ScintillaFramework ./ScintillaTest ./ \ - ../lexers ../lexlib - -INC_DIRS=$(SRC_DIRS) ../include - -INCS=$(addprefix -I,$(INC_DIRS)) - -vpath %.m $(SRC_DIRS) -vpath %.mm $(SRC_DIRS) -vpath %.cpp $(SRC_DIRS) -vpath %.cxx $(SRC_DIRS) -vpath %.c $(SRC_DIRS) -vpath %.h $(INC_DIRS) - -# clean everything -clean: - -rm -rf $(BLD) - -# build application objective-c++ files -$(APP_BLD)/%.o : %.mm - $(CCO) -c $< -o $@ - -# build application objective-c files -$(APP_BLD)/%.o : %.m - $(CCO) -c $< -o $@ - -# build framework c++ files -$(FRM_BLD)/%.o : %.cxx - $(CCX) -c $< -o $@ - -# build framework objective-c++ files -$(FRM_BLD)/%.o : %.mm - $(CCO) -c $< -o $@ \ No newline at end of file diff --git a/scintilla/cocoa/res/info_bar_bg@2x.png b/scintilla/cocoa/res/info_bar_bg@2x.png new file mode 100644 index 00000000..486646a8 Binary files /dev/null and b/scintilla/cocoa/res/info_bar_bg@2x.png differ diff --git a/scintilla/cocoa/res/mac_cursor_busy.png b/scintilla/cocoa/res/mac_cursor_busy.png index 9ac82769..93b2a496 100644 Binary files a/scintilla/cocoa/res/mac_cursor_busy.png and b/scintilla/cocoa/res/mac_cursor_busy.png differ diff --git a/scintilla/cocoa/res/mac_cursor_busy@2x.png b/scintilla/cocoa/res/mac_cursor_busy@2x.png new file mode 100644 index 00000000..7a0e12e8 Binary files /dev/null and b/scintilla/cocoa/res/mac_cursor_busy@2x.png differ diff --git a/scintilla/cocoa/res/mac_cursor_flipped.png b/scintilla/cocoa/res/mac_cursor_flipped.png index 2c984f24..e1ee6863 100644 Binary files a/scintilla/cocoa/res/mac_cursor_flipped.png and b/scintilla/cocoa/res/mac_cursor_flipped.png differ diff --git a/scintilla/cocoa/res/mac_cursor_flipped@2x.png b/scintilla/cocoa/res/mac_cursor_flipped@2x.png new file mode 100644 index 00000000..6fedb33d Binary files /dev/null and b/scintilla/cocoa/res/mac_cursor_flipped@2x.png differ diff --git a/scintilla/doc/Indicators.png b/scintilla/doc/Indicators.png new file mode 100644 index 00000000..33e31f87 Binary files /dev/null and b/scintilla/doc/Indicators.png differ diff --git a/scintilla/doc/Lexer.txt b/scintilla/doc/Lexer.txt index 5f118e73..a9b75a2b 100644 --- a/scintilla/doc/Lexer.txt +++ b/scintilla/doc/Lexer.txt @@ -34,7 +34,7 @@ newline terminates the initStyle state the lexer should enter its default state (or whatever state should follow initStyle). The keywordlists parameter specifies the keywords that the lexer must -recognize. A WordList class object contains methods that make simplify +recognize. A WordList class object contains methods that simplify the recognition of keywords. Present lexers use a helper function called classifyWordLLL to recognize keywords. These functions show how to use the keywordlists parameter to recognize keywords. This diff --git a/scintilla/doc/Markers.png b/scintilla/doc/Markers.png new file mode 100644 index 00000000..6eee926e Binary files /dev/null and b/scintilla/doc/Markers.png differ diff --git a/scintilla/doc/ScintillaDoc.html b/scintilla/doc/ScintillaDoc.html index 8c111b1b..31d45e96 100644 --- a/scintilla/doc/ScintillaDoc.html +++ b/scintilla/doc/ScintillaDoc.html @@ -82,7 +82,7 @@

Scintilla Documentation

-

Last edited 29/June/2013 NH

+

Last edited 22 February 2015 NH

There is an overview of the internal design of Scintilla.
@@ -100,6 +100,8 @@ How to implement a lexer in the container.
How to implement folding.
+ + Beginner's Guide to lexing and folding.
The coding style used in Scintilla and SciTE is worth following if you want to contribute code to Scintilla but is not compulsory.

@@ -115,7 +117,7 @@

The GTK+ version also uses messages in a similar way to the Windows version. This is different to normal GTK+ practice but made it easier to implement rapidly.

-

Scintilla also builds with Cocoa on OS X and with Qt, and follows the conventions of +

Scintilla also builds with Cocoa on OS X and with Qt, and follows the conventions of those platforms.

Scintilla does not properly support right-to-left languages like Arabic and Hebrew. @@ -167,7 +169,9 @@ Arguments point at text buffers that Scintilla will fill with text. In some cases, another argument will tell Scintilla the buffer size. In others, you must make sure that the buffer is big enough to hold the requested text. If a NULL pointer (0) is passed - then, for SCI_* calls, the length that should be allocated is returned. + then, for SCI_* calls, the length that should be allocated, not including any terminating + NUL, is returned. Some calls (marked "NUL-terminated") add a NUL character to the result but other calls do + not: to generically handle both types, allocate one more byte than indicated and set it to NUL. @@ -212,6 +216,7 @@ o Searching and replacing o Overtype + @@ -220,6 +225,7 @@ o Error handling o Undo and Redo + @@ -229,6 +235,7 @@ o Scrolling and automatic scrolling + @@ -237,6 +244,7 @@ o Cursor o Mouse capture + @@ -245,91 +253,103 @@ o Styling o Style definition + o Caret, selection, and hotspot styles + o Character representations + o Margins - o Annotations + o Annotations + o Other settings o Brace highlighting - o Tabs and Indentation - Guides + o Tabs and Indentation + Guides + o Markers o Indicators - o Autocompletion + o Autocompletion + o User lists o Call tips - o Keyboard commands + o Keyboard commands + o Key bindings o Popup edit menu - o Macro recording + o Macro recording + o Printing o Direct access - o Multiple views + o Multiple views + o Background loading and saving o Folding - o Line wrapping + o Line wrapping + o Zooming o Long lines - o Lexer + o Lexer + o Lexer objects o Notifications - o Images + o Images + o GTK+ o Provisional messages - o Deprecated messages - + o Deprecated messages + o Edit messages never supported by Scintilla @@ -346,20 +366,9 @@

Text retrieval and modification

-

Each byte in a Scintilla document is followed by an associated byte of styling +

Each byte in a Scintilla document is associated with a byte of styling information. The combination of a character byte and a style byte is called a cell. Style bytes - are interpreted an index into an array of styles. - Style bytes may be split into an index and a set of indicator bits - but this use is discouraged and indicators should now use - SCI_INDICATORFILLRANGE - and related calls. - The default split is with the index in the low 5 bits and 3 high bits as indicators. This allows 32 fundamental styles, which is enough for most - languages, and three independent indicators so that, for example, syntax errors, deprecated - names and bad indentation could all be displayed at once. The number of bits used for styles - can be altered with SCI_SETSTYLEBITS up to a maximum of 8 bits. - The remaining bits can be used for indicators.

+ are interpreted an index into an array of styles.

In this document, 'character' normally refers to a byte even when multi-byte characters are used. Lengths measure the numbers of bytes, not the amount of characters in those bytes.

@@ -395,6 +404,7 @@ SCI_ADDSTYLEDTEXT(int length, cell *s)
SCI_APPENDTEXT(int length, const char *s)
SCI_INSERTTEXT(int pos, const char *text)
+ SCI_CHANGEINSERTION(int length, const char *text)
SCI_CLEARALL
SCI_DELETERANGE(int pos, int deleteLength)
SCI_CLEARDOCUMENTSTYLE
@@ -402,8 +412,6 @@ SCI_GETSTYLEAT(int position)
SCI_GETSTYLEDTEXT(<unused>, Sci_TextRange *tr)
- SCI_SETSTYLEBITS(int bits)
- SCI_GETSTYLEBITS
SCI_RELEASEALLEXTENDEDSTYLES
SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles)
SCI_TARGETASUTF8(<unused>, char *s)
@@ -411,7 +419,7 @@ SCI_SETLENGTHFORENCODE(int bytes)
-

SCI_GETTEXT(int length, char *text)
+

SCI_GETTEXT(int length, char *text NUL-terminated)
This returns length-1 characters of text from the start of the document plus one terminating 0 character. To collect all the text in a document, use SCI_GETLENGTH to get the number of characters in the document (nLen), allocate a character @@ -528,6 +536,10 @@ the current position if pos is -1. If the current position is after the insertion point then it is moved along with its surrounding text but no scrolling is performed.

+

SCI_CHANGEINSERTION(int length, const char *text)
+ This may only be called from a SC_MOD_INSERTCHECK + notification handler and will change the text being inserted to that provided.

+

SCI_CLEARALL
Unless the document is read-only, this deletes all the text.

@@ -547,14 +559,6 @@ This returns the style at pos in the document, or 0 if pos is negative or past the end of the document.

-

SCI_SETSTYLEBITS(int bits)
- SCI_GETSTYLEBITS
- This pair of routines sets and reads back the number of bits in each cell to use for styling, - to a maximum of 8 style bits. The remaining bits can be used as indicators. The standard - setting is SCI_SETSTYLEBITS(5). - The number of styling bits needed by the current lexer can be found with - SCI_GETSTYLEBITSNEEDED.

-

SCI_RELEASEALLEXTENDEDSTYLES
SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles)
Extended styles are used for features like textual margins and annotations as well as internally by Scintilla. @@ -583,12 +587,14 @@ struct Sci_TextRange { }; -

GTK+-specific: Access to encoded text

+

Specific to GTK+, Cocoa and Windows only: Access to encoded text

SCI_TARGETASUTF8(<unused>, char *s)
This method retrieves the value of the target encoded as UTF-8 which is the default encoding of GTK+ so is useful for retrieving text for use in other parts of the user interface, such as find and replace dialogs. The length of the encoded text in bytes is returned. + Cocoa uses UTF-16 which is easily converted from UTF-8 so this method can be used to perform the + more complex work of transcoding from the various encodings supported.

SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded)
@@ -604,23 +610,104 @@ struct Sci_TextRange {

Searching

- There are methods to search for text and for regular expressions. The regular expression support - is limited and should only be used for simple cases and initial development. A different regular expression + There are methods to search for text and for regular expressions. + Most applications should use + SCI_SEARCHINTARGET + as the basis for their search implementations. + Other calls augment this or were implemented before SCI_SEARCHINTARGET. +

+

+ The base regular expression support + is limited and should only be used for simple cases and initial development. + When using a C++11 compliant compiler and runtime, it may be possible to use the + runtime's implementation of <regex> by compiling Scintilla with CXX11_REGEX defined. + A different regular expression library can be integrated into Scintilla or can be called from the container using direct access to the buffer contents through SCI_GETCHARACTERPOINTER.

- SCI_FINDTEXT(int flags, Sci_TextToFind - *ttf)
- SCI_SEARCHANCHOR
- SCI_SEARCHNEXT(int searchFlags, const char + +

Search and replace using the target

+ +

Searching can be performed within the target range with SCI_SEARCHINTARGET, + which uses a counted string to allow searching for null characters. It returns the + position of the start of the matching text range or -1 for failure, in which case the target is not moved. The flags used by + SCI_SEARCHINTARGET such as SCFIND_MATCHCASE, + SCFIND_WHOLEWORD, SCFIND_WORDSTART, and SCFIND_REGEXP + can be set with SCI_SETSEARCHFLAGS.

+
SCI_SETTARGETSTART(int pos)
+ SCI_GETTARGETSTART
+ SCI_SETTARGETEND(int pos)
+ SCI_GETTARGETEND
+ SCI_SETTARGETRANGE(int start, int end)
+ SCI_TARGETFROMSELECTION
+ SCI_SETSEARCHFLAGS(int searchFlags)
+ SCI_GETSEARCHFLAGS
+ SCI_SEARCHINTARGET(int length, const char *text)
- SCI_SEARCHPREV(int searchFlags, const char + SCI_GETTARGETTEXT(<unused>, + char *text)
+ SCI_REPLACETARGET(int length, const char *text)
- Search and replace using the - target
+ SCI_REPLACETARGETRE(int length, const char + *text)
+ SCI_GETTAG(int tagNumber, char *tagValue)
+

SCI_SETTARGETSTART(int pos)
+ SCI_GETTARGETSTART
+ SCI_SETTARGETEND(int pos)
+ SCI_GETTARGETEND
+ SCI_SETTARGETRANGE(int start, int end)
+ These functions set and return the start and end of the target. When searching + you can set start greater than end to find the last matching text in the + target rather than the first matching text. The target is also set by a successful + SCI_SEARCHINTARGET.

+ +

SCI_TARGETFROMSELECTION
+ Set the target start and end to the start and end positions of the selection.

+ +

SCI_SETSEARCHFLAGS(int searchFlags)
+ SCI_GETSEARCHFLAGS
+ These get and set the searchFlags used by + SCI_SEARCHINTARGET. There are several option flags including a simple regular + expression search.

+ +

SCI_SEARCHINTARGET(int length, const char *text)
+ This searches for the first occurrence of a text string in the target defined by + SCI_SETTARGETSTART and SCI_SETTARGETEND. The text string is not zero + terminated; the size is set by length. The search is modified by the search flags + set by SCI_SETSEARCHFLAGS. If the search succeeds, the target is set to the found + text and the return value is the position of the start of the matching text. If the search + fails, the result is -1.

+ +

SCI_GETTARGETTEXT(<unused>, char *text)
+ Retrieve the value in the target.

+ +

SCI_REPLACETARGET(int length, const char *text)
+ If length is -1, text is a zero terminated string, otherwise + length sets the number of character to replace the target with. + After replacement, the target range refers to the replacement text. + The return value + is the length of the replacement string.
+ Note that the recommended way to delete text in the document is to set the target to the text to be removed, + and to perform a replace target with an empty string.

+ +

SCI_REPLACETARGETRE(int length, const char *text)
+ This replaces the target using regular expressions. If length is -1, + text is a zero terminated string, otherwise length is the number of + characters to use. The replacement string is formed from the text string with any sequences of + \1 through \9 replaced by tagged matches from the most recent regular + expression search. \0 is replaced with all the matched text from the most recent search. + After replacement, the target range refers to the replacement text. + The return value is the length of the replacement string.

+ +

SCI_GETTAG(int tagNumber, char *tagValue NUL-terminated)
+ Discover what text was matched by tagged expressions in a regular expression search. + This is useful if the application wants to interpret the replacement string itself.

+ +

See also: SCI_FINDTEXT

+

searchFlags
Several of the search routines use flag options, which include a simple regular expression search. Combine the flag options by adding them:

@@ -656,13 +743,20 @@ struct Sci_TextRange { Treat regular expression in a more POSIX compatible manner by interpreting bare ( and ) for tagged sections rather than \( and \). + + SCFIND_CXX11REGEX + + When compiled with CXX11_REGEX this flag + may be set to use <regex> instead of Scintilla's basic regular expressions. + If the regular expression is invalid then -1 is returned and status is set to + SC_STATUS_WARN_REGEX. + The ECMAScript flag is set on the regex object and UTF-8 documents will exhibit Unicode-compliant + behaviour. For MSVC, where wchar_t is 16-bits, the reular expression ".." will match a single + astral-plane character. There may be other differences between compilers. + -

You can - search backwards to find the previous occurrence of a search string by setting the end of the - search range before the start.

-

In a regular expression, special characters interpreted are:

@@ -758,12 +852,25 @@ struct Sci_TextRange {

Regular expressions will only match ranges within a single line, never matching over multiple lines.

+ SCI_FINDTEXT(int flags, Sci_TextToFind + *ttf)
+ SCI_SEARCHANCHOR
+ SCI_SEARCHNEXT(int searchFlags, const char + *text)
+ SCI_SEARCHPREV(int searchFlags, const char + *text)
+
+

SCI_FINDTEXT(int searchFlags, Sci_TextToFind *ttf)
This message searches for text in the document. It does not use or move the current selection. The searchFlags argument controls the search type, which includes regular expression searches.

+

You can + search backwards to find the previous occurrence of a search string by setting the end of the + search range before the start.

+

The Sci_TextToFind structure is defined in Scintilla.h; set chrg.cpMin and chrg.cpMax with the range of positions in the document to search. You can search backwards by @@ -785,7 +892,7 @@ struct Sci_TextRange {

 struct Sci_TextToFind {
     struct Sci_CharacterRange chrg;     // range to search
-    char *lpstrText;                // the search pattern (zero terminated)
+    const char *lpstrText;                // the search pattern (zero terminated)
     struct Sci_CharacterRange chrgText; // returned as position of matching text
 };
 
@@ -816,89 +923,6 @@ struct Sci_TextToFind {

See also: SCI_SEARCHINTARGET, SCI_FINDTEXT

-

Search and replace using the target

- -

Using SCI_REPLACESEL, - modifications cause scrolling and other visible changes, which may take some time and cause - unwanted display updates. If performing many changes, such as a replace all command, the target - can be used instead. First, set the target, ie. the range to be replaced. Then call - SCI_REPLACETARGET or SCI_REPLACETARGETRE.

- -

Searching can be performed within the target range with SCI_SEARCHINTARGET, - which uses a counted string to allow searching for null characters. It returns the - position of the start of the matching text range or -1 for failure, in which case the target is not moved. The flags used by - SCI_SEARCHINTARGET such as SCFIND_MATCHCASE, - SCFIND_WHOLEWORD, SCFIND_WORDSTART, and SCFIND_REGEXP - can be set with SCI_SETSEARCHFLAGS. SCI_SEARCHINTARGET may be simpler - for some clients to use than SCI_FINDTEXT, as that requires using a pointer to a - structure.

- SCI_SETTARGETSTART(int pos)
- SCI_GETTARGETSTART
- SCI_SETTARGETEND(int pos)
- SCI_GETTARGETEND
- SCI_TARGETFROMSELECTION
- SCI_SETSEARCHFLAGS(int searchFlags)
- SCI_GETSEARCHFLAGS
- SCI_SEARCHINTARGET(int length, const char - *text)
- SCI_REPLACETARGET(int length, const char - *text)
- SCI_REPLACETARGETRE(int length, const char - *text)
- SCI_GETTAG(int tagNumber, char *tagValue)
-
- -

SCI_SETTARGETSTART(int pos)
- SCI_GETTARGETSTART
- SCI_SETTARGETEND(int pos)
- SCI_GETTARGETEND
- These functions set and return the start and end of the target. When searching in non-regular - expression mode, you can set start greater than end to find the last matching text in the - target rather than the first matching text. The target is also set by a successful - SCI_SEARCHINTARGET.

- -

SCI_TARGETFROMSELECTION
- Set the target start and end to the start and end positions of the selection.

- -

SCI_SETSEARCHFLAGS(int searchFlags)
- SCI_GETSEARCHFLAGS
- These get and set the searchFlags used by - SCI_SEARCHINTARGET. There are several option flags including a simple regular - expression search.

- -

SCI_SEARCHINTARGET(int length, const char *text)
- This searches for the first occurrence of a text string in the target defined by - SCI_SETTARGETSTART and SCI_SETTARGETEND. The text string is not zero - terminated; the size is set by length. The search is modified by the search flags - set by SCI_SETSEARCHFLAGS. If the search succeeds, the target is set to the found - text and the return value is the position of the start of the matching text. If the search - fails, the result is -1.

- -

SCI_REPLACETARGET(int length, const char *text)
- If length is -1, text is a zero terminated string, otherwise - length sets the number of character to replace the target with. - After replacement, the target range refers to the replacement text. - The return value - is the length of the replacement string.
- Note that the recommended way to delete text in the document is to set the target to the text to be removed, - and to perform a replace target with an empty string.

- -

SCI_REPLACETARGETRE(int length, const char *text)
- This replaces the target using regular expressions. If length is -1, - text is a zero terminated string, otherwise length is the number of - characters to use. The replacement string is formed from the text string with any sequences of - \1 through \9 replaced by tagged matches from the most recent regular - expression search. \0 is replaced with all the matched text from the most recent search. - After replacement, the target range refers to the replacement text. - The return value is the length of the replacement string.

- -

SCI_GETTAG(int tagNumber, char *tagValue)
- Discover what text was matched by tagged expressions in a regular expression search. - This is useful if the application wants to interpret the replacement string itself.

- -

See also: SCI_FINDTEXT

-

Overtype

SCI_SETOVERTYPE(bool overType)
@@ -960,7 +984,7 @@ struct Sci_TextToFind { If this property is set then when text is pasted any line ends are converted to match the document's end of line mode as set with SCI_SETEOLMODE. - Currently only changeable on Windows. On GTK+ pasted text is always converted.

+ Defaults to true.

Error handling

@@ -969,6 +993,8 @@ struct Sci_TextToFind { If an error occurs, Scintilla may set an internal error number that can be retrieved with SCI_GETSTATUS. To clear the error status call SCI_SETSTATUS(0). + Status values from 1 to 999 are errors and status SC_STATUS_WARN_START (1000) + and above are warnings. The currently defined statuses are:

@@ -986,12 +1012,18 @@ struct Sci_TextToFind { - + + + + + + +
Generic failure
SC_STATUS_BADALLOC 2 Memory is exhausted
SC_STATUS_WARN_REGEX1001Regular expression is invalid
@@ -1145,12 +1177,16 @@ struct Sci_TextToFind { onlyWordCharacters)
SCI_POSITIONBEFORE(int position)
SCI_POSITIONAFTER(int position)
+ SCI_POSITIONRELATIVE(int position, int relative)
SCI_COUNTCHARACTERS(int startPos, int endPos)
SCI_TEXTWIDTH(int styleNumber, const char *text)
SCI_TEXTHEIGHT(int line)
SCI_CHOOSECARETX
SCI_MOVESELECTEDLINESUP
SCI_MOVESELECTEDLINESDOWN
+ SCI_SETMOUSESELECTIONRECTANGULARSWITCH(bool + mouseSelectionRectangularSwitch)
+ SCI_GETMOUSESELECTIONRECTANGULARSWITCH

SCI_GETTEXTLENGTH
@@ -1286,9 +1322,9 @@ struct Sci_TextToFind {

SCI_GETLINEENDPOSITION(int line)
This returns the position at the end of the line, before any line end characters. If line - is the last line in the document (which does not have any end of line characters), the result is the size of the - document. If line is negative or line >= SCI_GETLINECOUNT(), the result is undefined.

+ is the last line in the document (which does not have any end of line characters) or greater, + the result is the size of the document. + If line is negative the result is undefined.

SCI_LINELENGTH(int line)
This returns the length of the line, including any line end characters. If line @@ -1297,7 +1333,7 @@ struct Sci_TextToFind { href="#SCI_GETLINEENDPOSITION">SCI_GETLINEENDPOSITION(line) - SCI_POSITIONFROMLINE(line).

-

SCI_GETSELTEXT(<unused>, char *text)
+

SCI_GETSELTEXT(<unused>, char *text NUL-terminated)
This copies the currently selected text and a terminating 0 byte to the text buffer. The buffer size should be determined by calling with a NULL pointer for the text argument SCI_GETSELTEXT(0,0). @@ -1312,7 +1348,7 @@ struct Sci_TextToFind { SCI_GETTEXTRANGE

-

SCI_GETCURLINE(int textLen, char *text)
+

SCI_GETCURLINE(int textLen, char *text NUL-terminated)
This retrieves the text of the line containing the caret and returns the position within the line of the caret. Pass in char* text pointing at a buffer large enough to hold the text you wish to retrieve and a terminating 0 character. @@ -1447,6 +1483,11 @@ struct Sci_TextToFind { If called with a position within a multi byte character will return the position of the start/end of that character.

+

SCI_POSITIONRELATIVE(int position, int relative)
+ Count a number of whole characters before or after the argument position and return that position. + The minimum position returned is 0 and the maximum is the last position in the document. +

+

SCI_COUNTCHARACTERS(int startPos, int endPos)
Returns the number of whole characters between two positions..

@@ -1503,14 +1544,23 @@ struct Sci_TextToFind {

SCI_MOVESELECTEDLINESUP
Move the selected lines up one line, shifting the line above after the selection. - The selection will be automatically extended to the beginning of the selection's first line and the end of the seletion's last line. + The selection will be automatically extended to the beginning of the selection's first line and the end of the selection's last line. If nothing was selected, the line the cursor is currently at will be selected.

SCI_MOVESELECTEDLINESDOWN
Move the selected lines down one line, shifting the line below before the selection. - The selection will be automatically extended to the beginning of the selection's first line and the end of the seletion's last line. + The selection will be automatically extended to the beginning of the selection's first line and the end of the selection's last line. If nothing was selected, the line the cursor is currently at will be selected.

+

SCI_SETMOUSESELECTIONRECTANGULARSWITCH(bool + mouseSelectionRectangularSwitch)
+ SCI_GETMOUSESELECTIONRECTANGULARSWITCH
+ Enable or disable the ability to switch to rectangular selection mode while making a selection with the mouse. + When this option is turned on, mouse selections in stream mode can be switched to rectangular mode by pressing + the corresponding modifier key. They then stick to rectangular mode even when the modifier key is released again. + When this option is turned off, mouse selections will always stick to the mode the selection was started in. It + is off by default.

+

Multiple Selection and Virtual Space

@@ -1531,6 +1581,7 @@ struct Sci_TextToFind { SCI_CLEARSELECTIONS
SCI_SETSELECTION(int caret, int anchor)
SCI_ADDSELECTION(int caret, int anchor)
+ SCI_DROPSELECTIONN(int selection)
SCI_SETMAINSELECTION(int selection)
SCI_GETMAINSELECTION

@@ -1657,6 +1708,12 @@ struct Sci_TextToFind { Since there is always at least one selection, to set a list of selections, the first selection should be added with SCI_SETSELECTION and later selections added with SCI_ADDSELECTION

+

+ SCI_DROPSELECTIONN(int selection)
+ If there are multiple selections, remove the indicated selection. + If this was the main selection then make the previous selection the main and if it was the first then the last selection becomes main. + If there is only one selection, or there is no selection selection, then there is no effect.

+

SCI_SETMAINSELECTION(int selection)
SCI_GETMAINSELECTION
@@ -1700,18 +1757,25 @@ struct Sci_TextToFind { SCI_GETADDITIONALSELALPHA
SCI_SETADDITIONALSELFORE(int colour)
SCI_SETADDITIONALSELBACK(int colour)
- Modify the appearence of additional selections so that they can be differentiated from the main selection which has its appearence set with + Modify the appearance of additional selections so that they can be differentiated from the main selection which has its appearance set with SCI_SETSELALPHA, SCI_GETSELALPHA, SCI_SETSELFORE, and - SCI_SETSELBACK.

- + SCI_SETSELBACK. + SCI_SETADDITIONALSELFORE and + SCI_SETADDITIONALSELBACK calls have no + effect until SCI_SETSELFORE + and SCI_SETSELBACK are + called with useSelection*Colour value set to true. Subsequent calls to + SCI_SETSELFORE, + and SCI_SETSELBACK will + overwrite the values set by SCI_SETADDITIONALSEL* functions.

SCI_SETADDITIONALCARETFORE(int colour)
SCI_GETADDITIONALCARETFORE
SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)
SCI_GETADDITIONALCARETSBLINK
- Modify the appearence of additional carets so that they can be differentiated from the main caret which has its appearence set with + Modify the appearance of additional carets so that they can be differentiated from the main caret which has its appearance set with SCI_SETCARETFORE, SCI_GETCARETFORE, SCI_SETCARETPERIOD, and @@ -2160,7 +2224,7 @@ struct Sci_TextToFind { baseline (its 'descent'). Space may be added to the maximum ascent (SCI_SETEXTRAASCENT) and the maximum descent (SCI_SETEXTRADESCENT) to allow for more space between lines. - This may done to make the text easier to read or to accomodate underlines or highlights. + This may done to make the text easier to read or to accommodate underlines or highlights.

Cursor

@@ -2203,13 +2267,13 @@ struct Sci_TextToFind {

SCI_SETMOUSEDOWNCAPTURES(bool captures)
SCI_GETMOUSEDOWNCAPTURES
When the mouse is pressed inside Scintilla, it is captured so future mouse movement events are - sent to Scintilla. This behavior may be turned off with + sent to Scintilla. This behaviour may be turned off with SCI_SETMOUSEDOWNCAPTURES(0).

Line endings

-

Scintilla can handle the major line end conventions and, depending on settings and - the current lexer also support additional Unicode line ends.

+

Scintilla can handle the major line end conventions and, depending on settings and + the current lexer also support additional Unicode line ends.

Scintilla can interpret any of the Macintosh (\r), Unix (\n) and Windows (\r\n) line ends. @@ -2219,26 +2283,21 @@ struct Sci_TextToFind { entire document to one of these line endings with SCI_CONVERTEOLS. Finally, you can choose to display the line endings with SCI_SETVIEWEOL.

-

For the UTF-8 encoding, three additional Unicode line ends, Next Line (NEL=U+0085), Line Separator (LS=U+2028), and Paragraph Separator (PS=U+2029) may optionally be interpreted when Unicode line ends is turned on and the current lexer also supports Unicode line ends.

-
- SCI_SETEOLMODE(int eolMode)
+ SCI_SETEOLMODE(int eolMode)
SCI_GETEOLMODE
SCI_CONVERTEOLS(int eolMode)
SCI_SETVIEWEOL(bool visible)
SCI_GETVIEWEOL
- -

SCI_SETEOLMODE(int eolMode)
SCI_GETEOLMODE
@@ -2260,9 +2319,6 @@ struct Sci_TextToFind { (CR), (LF), or (CR)(LF). SCI_GETVIEWEOL returns the current state.

-
- These features are provisional
-

SCI_GETLINEENDTYPESSUPPORTED
SCI_GETLINEENDTYPESSUPPORTED reports the different types of line ends supported by the current lexer. This is a bit set although there is currently only a single choice @@ -2279,16 +2335,10 @@ struct Sci_TextToFind {

SCI_GETLINEENDTYPESACTIVE
SCI_GETLINEENDTYPESACTIVE reports the set of line ends currently interpreted by Scintilla. It is SCI_GETLINEENDTYPESSUPPORTED & SCI_GETLINEENDTYPESALLOWED.

-

Styling

-

The styling messages allow you to assign styles to text. The standard Scintilla settings - divide the 8 style bits available for each character into 5 bits (0 to 4 = styles 0 to 31) that set a style and three bits (5 to 7) that - define indicators. You can change the balance between - styles and indicators with SCI_SETSTYLEBITS. If your styling needs can be met by +

The styling messages allow you to assign styles to text. If your styling needs can be met by one of the standard lexers, or if you can write your own, then a lexer is probably the easiest way to style your document. If you choose to use the container to do the styling you can use the SCI_SETLEXER command to select @@ -2299,7 +2349,7 @@ struct Sci_TextToFind { use the styling commands to mark errors detected by a compiler. The following commands can be used.

SCI_GETENDSTYLED
- SCI_STARTSTYLING(int position, int mask)
+ SCI_STARTSTYLING(int position, int unused)
SCI_SETSTYLING(int length, int style)
SCI_SETSTYLINGEX(int length, const char *styles)
@@ -2317,31 +2367,23 @@ struct Sci_TextToFind { container. The container can send SCI_GETENDSTYLED to work out where it needs to start styling. Scintilla will always ask to style whole lines.

-

SCI_STARTSTYLING(int pos, int mask)
- This prepares for styling by setting the styling position pos to start at and a - mask indicating which bits of the style bytes can be set. The mask allows styling - to occur over several passes, with, for example, basic styling done on an initial pass to - ensure that the text of the code is seen quickly and correctly, and then a second slower pass, - detecting syntax errors and using indicators to show where these are. For example, with the - standard settings of 5 style bits and 3 indicator bits, you would use a mask value - of 31 (0x1f) if you were setting text styles and did not want to change the indicators. After +

SCI_STARTSTYLING(int pos, int unused)
+ This prepares for styling by setting the styling position pos to start at. + The unused argument was used in earlier versions but is now ignored. + After SCI_STARTSTYLING, send multiple SCI_SETSTYLING messages for each lexical entity to style.

SCI_SETSTYLING(int length, int style)
This message sets the style of length characters starting at the styling position - and then increases the styling position by length, ready for the next call. If - sCell is the style byte, the operation is:
- if ((sCell & mask) != style) sCell = (sCell & ~mask) | (style & - mask);
+ and then increases the styling position by length, ready for the next call.

SCI_SETSTYLINGEX(int length, const char *styles)
As an alternative to SCI_SETSTYLING, which applies the same style to each byte, you can use this message which specifies the styles for each of length bytes from the styling position and then increases the styling position by length, ready for - the next call. The length styling bytes pointed at by styles should - not contain any bits not set in mask.

+ the next call.

SCI_SETLINESTATE(int line, int value)
SCI_GETLINESTATE(int line)
@@ -2359,9 +2401,8 @@ struct Sci_TextToFind {

While the style setting messages mentioned above change the style numbers associated with text, these messages define how those style numbers are interpreted visually. There are 256 - lexer styles that can be set, numbered 0 to STYLE_MAX (255). Unless you use SCI_SETSTYLEBITS to change the number - of style bits, styles 0 to 31 are used to set the text attributes. There are also some + lexer styles that can be set, numbered 0 to STYLE_MAX (255). + There are also some predefined numbered styles starting at 32, The following STYLE_* constants are defined.

@@ -2458,9 +2499,7 @@ struct Sci_TextToFind { 255 This is not a style but is the number of the maximum style that can be set. Styles - between STYLE_LASTPREDEFINED and STYLE_MAX would be appropriate - if you used SCI_SETSTYLEBITS - to set more than 5 style bits. + between STYLE_LASTPREDEFINED and STYLE_MAX may be used. @@ -2536,7 +2575,7 @@ struct Sci_TextToFind { 3. Set the style attributes that make your lexical styles different.

SCI_STYLESETFONT(int styleNumber, const char *fontName)
- SCI_STYLEGETFONT(int styleNumber, char *fontName)
+ SCI_STYLEGETFONT(int styleNumber, char *fontName NUL-terminated)
SCI_STYLESETSIZE(int styleNumber, int sizeInPoints)
SCI_STYLEGETSIZE(int styleNumber)
SCI_STYLESETSIZEFRACTIONAL(int styleNumber, int sizeInHundredthPoints)
@@ -2549,11 +2588,15 @@ struct Sci_TextToFind { SCI_STYLEGETITALIC(int styleNumber)
These messages (plus SCI_STYLESETCHARACTERSET) set the font - attributes that are used to match the fonts you request to those available. The + attributes that are used to match the fonts you request to those available.

+

The fontName is a zero terminated string holding the name of a font. Under Windows, - only the first 32 characters of the name are used and the name is not case sensitive. For + only the first 32 characters of the name are used, the name is decoded as UTF-8, and the name is not case sensitive. For internal caching, Scintilla tracks fonts by name and does care about the casing of font names, - so please be consistent. On GTK+, Pango is used to display text.

+ so please be consistent. + On GTK+, Pango is used to display text and the name is sent directly to Pango without transformation. + On Qt, the name is decoded as UTF-8. + On Cocoa, the name is decoded as MacRoman.

Sizes can be set to a whole number of points with SCI_STYLESETSIZE or to a fractional point size in hundredths of a point with SCI_STYLESETSIZEFRACTIONAL by multiplying the size by 100 (SC_FONT_SIZE_MULTIPLIER). @@ -2657,7 +2700,7 @@ struct Sci_TextToFind {

The selection is shown by changing the foreground and/or background colours. If one of these is not set then that attribute is not changed for the selection. The default is to show the - selection by changing the background to light gray and leaving the foreground the same as when + selection by changing the background to light grey and leaving the foreground the same as when it was not selected. When there is no selection, the current insertion point is marked by the text caret. This is a vertical line that is normally blinking on and off to attract the users attention.

@@ -2691,8 +2734,6 @@ struct Sci_TextToFind { SCI_GETHOTSPOTACTIVEUNDERLINE
SCI_SETHOTSPOTSINGLELINE(bool singleLine)
SCI_GETHOTSPOTSINGLELINE
- SCI_SETCONTROLCHARSYMBOL(int symbol)
- SCI_GETCONTROLCHARSYMBOL
SCI_SETCARETSTICKY(int useCaretStickyBehaviour)
SCI_GETCARETSTICKY
SCI_TOGGLECARETSTICKY
@@ -2771,7 +2812,7 @@ struct Sci_TextToFind { The width of the line caret can be set with SCI_SETCARETWIDTH to a value of 0, 1, 2 or 3 pixels. The default width is 1 pixel. You can read back the current width with SCI_GETCARETWIDTH. A width of 0 makes the caret invisible (added at version - 1.50), similar to setting the caret style to CARETSTYLE_INVISIBLE (though not interchangable). + 1.50), similar to setting the caret style to CARETSTYLE_INVISIBLE (though not interchangeable). This setting only affects the width of the cursor when the cursor style is set to line caret mode, it does not affect the width for a block caret.

@@ -2789,21 +2830,6 @@ struct Sci_TextToFind { the default colouring can be modified and an underline drawn with these settings. Single line mode stops a hotspot from wrapping onto next line.

-

SCI_SETCONTROLCHARSYMBOL(int symbol)
- SCI_GETCONTROLCHARSYMBOL
- By default, Scintilla displays control characters (characters with codes less than 32) in a - rounded rectangle as ASCII mnemonics: "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", - "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", - "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US". These mnemonics come from the - early days of signaling, though some are still used (LF = Line Feed, BS = Back Space, CR = - Carriage Return, for example).

- -

You can choose to replace these mnemonics by a nominated symbol with an ASCII code in the - range 32 to 255. If you set a symbol value less than 32, all control characters are displayed - as mnemonics. The symbol you set is rendered in the font of the style set for the character. - You can read back the current symbol with the SCI_GETCONTROLCHARSYMBOL message. - The default symbol value is 0.

-

SCI_SETCARETSTICKY(int useCaretStickyBehaviour)
SCI_GETCARETSTICKY
SCI_TOGGLECARETSTICKY
@@ -2819,11 +2845,64 @@ struct Sci_TextToFind {

When set to SC_CARETSTICKY_WHITESPACE (2), the caret acts like mode 0 (sticky off) except under one special case; when space or tab characters are inserted. (Including pasting only space/tabs -- undo, redo, - etc. do not exhibit this behavior..).

+ etc. do not exhibit this behaviour..).

SCI_TOGGLECARETSTICKY switches from SC_CARETSTICKY_ON and SC_CARETSTICKY_WHITESPACE to SC_CARETSTICKY_OFF and from SC_CARETSTICKY_OFF to SC_CARETSTICKY_ON.

+

Character representations

+ +

Some characters, such as control characters and invalid bytes, do not have a visual glyph or use a glyph that is hard to distinguish.

+ +

Control characters (characters with codes less than 32, or between 128 and 159 in some encodings) + are displayed by Scintilla using their mnemonics inverted in a rounded rectangle. These mnemonics come from the + early days of signalling, though some are still used (LF = Line Feed, BS = Back Space, CR = + Carriage Return, for example).

+ +

For the low 'C0' values: "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", + "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", + "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US".

+ +

For the high 'C1' values: + "PAD", "HOP", "BPH", "NBH", "IND", "NEL", "SSA", "ESA", + "HTS", "HTJ", "VTS", "PLD", "PLU", "RI", "SS2", "SS3", + "DCS", "PU1", "PU2", "STS", "CCH", "MW", "SPA", "EPA", + "SOS", "SGCI", "SCI", "CSI", "ST", "OSC", "PM", "APC".

+ +

Invalid bytes are shown in a similar way with an 'x' followed by their value in hexadecimal, like "xFE".

+ + + SCI_SETREPRESENTATION(const char *encodedCharacter, const char *representation)
+ SCI_GETREPRESENTATION(const char *encodedCharacter, char *representation)
+ SCI_CLEARREPRESENTATION(const char *encodedCharacter)
+ SCI_SETCONTROLCHARSYMBOL(int symbol)
+ SCI_GETCONTROLCHARSYMBOL
+
+ +

SCI_SETREPRESENTATION(const char *encodedCharacter, const char *representation)
+ SCI_GETREPRESENTATION(const char *encodedCharacter, char *representation NUL-terminated)
+ SCI_CLEARREPRESENTATION(const char *encodedCharacter)
+ Any character, including those normally displayed as mnemonics may be represented by a + string inverted in a rounded rectangle.

+ +

For example, the Ohm sign Ω U+2126 looks very similar to the Greek Omega character Ω U+03C9 so, + for the UTF-8 encoding, to distinguish the Ohm sign as "U+2126 Ω" this call could be made: + SCI_SETREPRESENTATION("\xe2\x84\xa6", "U+2126 \xe2\x84\xa6")

+ +

The encodedCharacter parameter is a NUL-terminated string of the bytes for one character in the + current encoding. This can not be used to set a representation for multiple-character strings.

+ +

The NUL (0) character is a special case since the encodedCharacter parameter is NUL terminated, the NUL + character is specified as an empty string.

+ +

SCI_SETCONTROLCHARSYMBOL(int symbol)
+ SCI_GETCONTROLCHARSYMBOL
+ The mnemonics may be replaced by a nominated symbol with an ASCII code in the + range 32 to 255. If you set a symbol value less than 32, all control characters are displayed + as mnemonics. The symbol you set is rendered in the font of the style set for the character. + You can read back the current symbol with the SCI_GETCONTROLCHARSYMBOL message. + The default symbol value is 0.

+

Margins

There may be up to five margins, numbered 0 to SC_MAX_MARGIN (4) @@ -2992,7 +3071,7 @@ struct Sci_TextToFind { SCI_MARGINGETSTYLEOFFSET
Margin styles may be completely separated from standard text styles by setting a style offset. For example, SCI_MARGINSETSTYLEOFFSET(256) would allow the margin styles to be numbered from - 256 upto 511 so they do not overlap styles set by lexers. Each style number set with SCI_MARGINSETSTYLE + 256 up to 511 so they do not overlap styles set by lexers. Each style number set with SCI_MARGINSETSTYLE or SCI_MARGINSETSTYLES has the offset added before looking up the style.

@@ -3096,6 +3175,14 @@ struct Sci_TextToFind { Annotations are indented to match the text and are surrounded by a box. + + + ANNOTATION_INDENTED + + 3 + + Annotations are indented to match the text. + @@ -3104,7 +3191,7 @@ struct Sci_TextToFind { SCI_ANNOTATIONGETSTYLEOFFSET
Annotation styles may be completely separated from standard text styles by setting a style offset. For example, SCI_ANNOTATIONSETSTYLEOFFSET(512) would allow the annotation styles to be numbered from - 512 upto 767 so they do not overlap styles set by lexers (or margins if margins offset is 256). + 512 up to 767 so they do not overlap styles set by lexers (or margins if margins offset is 256). Each style number set with SCI_ANNOTATIONSETSTYLE or SCI_ANNOTATIONSETSTYLES has the offset added before looking up the style.

@@ -3114,11 +3201,11 @@ struct Sci_TextToFind {

Other settings

- SCI_SETUSEPALETTE(bool - allowPaletteUse)
- SCI_GETUSEPALETTE
+ SCI_SETBUFFEREDDRAW(bool isBuffered)
SCI_GETBUFFEREDDRAW
+ SCI_SETPHASESDRAW(int phases)
+ SCI_GETPHASESDRAW
SCI_SETTWOPHASEDRAW(bool twoPhase)
SCI_GETTWOPHASEDRAW
SCI_SETTECHNOLOGY(int technology)
@@ -3127,8 +3214,8 @@ struct Sci_TextToFind { SCI_GETFONTQUALITY
SCI_SETCODEPAGE(int codePage)
SCI_GETCODEPAGE
- SCI_SETKEYSUNICODE(bool keysUnicode)
- SCI_GETKEYSUNICODE
+ SCI_SETIMEINTERACTION(int imeInteraction)
+ SCI_GETIMEINTERACTION
SCI_SETWORDCHARS(<unused>, const char *characters)
SCI_GETWORDCHARS(<unused>, char *characters)
SCI_SETWHITESPACECHARS(<unused>, const char *characters)
@@ -3157,26 +3244,59 @@ struct Sci_TextToFind { bitmap to the screen. This avoids flickering although it does take longer. The default is for drawing to be buffered.

-

SCI_SETTWOPHASEDRAW(bool twoPhase)
- SCI_GETTWOPHASEDRAW
- Two phase drawing is a better but slower way of drawing text. - In single phase drawing each run of characters in one style is drawn along with its background. +

SCI_SETPHASESDRAW(int phases)
+ SCI_GETPHASESDRAW
+ There are several orders in which the text area may be drawn offering a trade-off between speed + and allowing all pixels of text to be seen even when they overlap other elements.

+

In single phase drawing (SC_PHASES_ONE) each + run of characters in one style is drawn along with its background. If a character overhangs the end of a run, such as in "V_" where the "V" is in a different style from the "_", then this can cause the right hand side of the "V" to be overdrawn by the background of the "_" which - cuts it off. Two phase drawing - fixes this by drawing all the backgrounds first and then drawing the text in - transparent mode. Two phase drawing may flicker more than single phase - unless buffered drawing is on. The default is for drawing to be two phase.

+ cuts it off.

+

Two phase drawing (SC_PHASES_TWO) + fixes this by drawing all the backgrounds of a line first and then drawing the text + in transparent mode. Lines are drawn separately and no line will overlap another + so any pixels that overlap into another line such as extreme ascenders and + descenders on characters will be cut off. + Two phase drawing may flicker more than single phase + unless buffered drawing is on or the platform is naturally buffered. + The default is for drawing to be two phase.

+

Multiple phase drawing (SC_PHASES_MULTIPLE) + draws the whole area multiple times, once for each feature, building up the + the appearance in layers or phases. The coloured backgrounds for all lines are + drawn before any text and then all the text is drawn in transparent mode over this + combined background without clipping text to the line boundaries. This allows + extreme ascenders and descenders to overflow into the adjacent lines. + This mode is incompatible with buffered drawing and will act as SC_PHASES_TWO + if buffered drawing is turned on. + Multiple phase drawing is slower than two phase drawing. + Setting the layout cache to SC_CACHE_PAGE + or higher can ensure that multiple phase drawing is not significantly slower.

+ +

SCI_SETTWOPHASEDRAW(bool twoPhase)
+ SCI_GETTWOPHASEDRAW
+ This property has been replaced with the preceding PHASESDRAW property which is more general, + allowing multiple phase drawing as well as one and two phase drawing.

SCI_SETTECHNOLOGY(int technology)
SCI_GETTECHNOLOGY
The technology property allows choosing between different drawing APIs and options. On most platforms, the only choice is SC_TECHNOLOGY_DEFAULT (0). - On Windows Vista or later, SC_TECHNOLOGY_DIRECTWRITE (1) + On Windows Vista or later, SC_TECHNOLOGY_DIRECTWRITE (1), + SC_TECHNOLOGY_DIRECTWRITERETAIN (2), or + SC_TECHNOLOGY_DIRECTWRITEDC (3) can be chosen to use the Direct2D and DirectWrite APIs for higher quality antialiased drawing. + SC_TECHNOLOGY_DIRECTWRITERETAIN differs from + SC_TECHNOLOGY_DIRECTWRITE by requesting that the frame + is retained after being presented which may prevent drawing failures on some cards and drivers. + SC_TECHNOLOGY_DIRECTWRITEDC differs from + SC_TECHNOLOGY_DIRECTWRITE by using DirectWrite to draw into a GDI DC. Since Direct2D buffers drawing, Scintilla's buffering can be turned off with - SCI_SETBUFFEREDDRAW(0).

+ SCI_SETBUFFEREDDRAW(0). + Since SC_TECHNOLOGY_DIRECTWRITERETAIN and + SC_TECHNOLOGY_DIRECTWRITEDC + are provisional, they may be changed or removed in a future release if a better solution is found.

SCI_SETFONTQUALITY(int fontQuality)
SCI_GETFONTQUALITY
@@ -3210,11 +3330,18 @@ struct Sci_TextToFind { 949 (Korean Unified Hangul Code), 950 (Traditional Chinese Big5), or 1361 (Korean Johab) although these may require installation of language specific support.

-

SCI_SETKEYSUNICODE(bool keysUnicode)
- SCI_GETKEYSUNICODE
- On Windows, character keys are normally handled differently depending on whether Scintilla is a wide - or narrow character window with character messages treated as Unicode when wide and as 8 bit otherwise. - Set this property to always treat as Unicode. This option is needed for Delphi.

+

SCI_SETIMEINTERACTION(int imeInteraction)
+ SCI_GETIMEINTERACTION
+ When entering text in Chinese, Japanese, or Korean an Input Method Editor (IME) may be displayed. + The IME may be an extra window appearing above Scintilla or may be displayed by Scintilla itself + as text. On some platforms there is a choice between the two techniques. + A windowed IME SC_IME_WINDOWED (0) may be more similar in appearance and + behaviour to the IME in other applications. + An inline IME SC_IME_INLINE (1) may work better with some Scintilla features such as + rectangular and multiple selection.

+

The windowed behaviour can be chosen with SCI_SETIMEINTERACTION(SC_IME_WINDOWED) + and the inline behaviour with SCI_SETIMEINTERACTION(SC_IME_INLINE). + Scintilla may ignore this call in some cases. For example, the inline behaviour might only be supported for some languages.

SCI_SETWORDCHARS(<unused>, const char *characters)
Scintilla has several functions that operate on words, which are defined to be contiguous @@ -3287,10 +3414,10 @@ struct Sci_TextToFind { that is unmatched. Using a position of INVALID_POSITION (-1) removes the highlight.

-

SCI_BRACEHIGHLIGHTINDICATOR(bool useBraceHighlightIndicator, int indicatorNumber)
+

SCI_BRACEHIGHLIGHTINDICATOR(bool useBraceHighlightIndicator, int indicatorNumber)
Use specified indicator to highlight matching braces instead of changing their style.

-

SCI_BRACEBADLIGHTINDICATOR(bool useBraceBadLightIndicator, int indicatorNumber)
+

SCI_BRACEBADLIGHTINDICATOR(bool useBraceBadLightIndicator, int indicatorNumber)
Use specified indicator to highlight non matching brace instead of changing its style.

SCI_BRACEMATCH(int pos, int maxReStyle)
@@ -3313,6 +3440,10 @@ struct Sci_TextToFind { syntax. Tabs are normally used in editors to insert a tab character or to pad text with spaces up to the next tab.

+

When Scintilla is laying out a section of text, text after a tab character will usually be + displayed at the next multiple of TABWIDTH columns from the left. However, it is also possible + to explicitly set tabstops in pixels for each line.

+

Scintilla can be set to treat tab and backspace in the white space at the start of a line in a special way: inserting a tab indents the line to the next indent position rather than just inserting a tab at the current character position and backspace unindents the line rather than @@ -3320,6 +3451,9 @@ struct Sci_TextToFind { you to generate code.

SCI_SETTABWIDTH(int widthInChars)
SCI_GETTABWIDTH
+ SCI_CLEARTABSTOPS(int line)
+ SCI_ADDTABSTOP(int line, int x)
+ SCI_GETNEXTTABSTOP(int line, int x)
SCI_SETUSETABS(bool useTabs)
SCI_GETUSETABS
SCI_SETINDENT(int widthInChars)
@@ -3346,6 +3480,16 @@ struct Sci_TextToFind { character in STYLE_DEFAULT. The default tab width is 8 characters. There are no limits on tab sizes, but values less than 1 or large values may have undesirable effects.

+

SCI_CLEARTABSTOPS(int line)
+ SCI_ADDTABSTOP(int line, int x)
+ SCI_GETNEXTTABSTOP(int line, int x)
+ SCI_CLEARTABSTOPS clears explicit tabstops on a line. SCI_ADDTABSTOP + adds an explicit tabstop at the specified distance from the left (in pixels), and + SCI_GETNEXTTABSTOP gets the next explicit tabstop position set after the given x position, + or zero if there aren't any. + Changing tab stops produces a SC_MOD_CHANGETABSTOPS notification. +

+

SCI_SETUSETABS(bool useTabs)
SCI_GETUSETABS
SCI_SETUSETABS determines whether indentation should be created out of a mixture @@ -3450,7 +3594,7 @@ struct Sci_TextToFind {

The markers are drawn in the order of their numbers, so higher numbered markers appear on top of lower numbered ones. Markers try to move with their text by tracking where the start of their line moves. When a line is deleted, its markers are combined, by an OR - operation, with the markers of the previous line.

+ operation, with the markers of the next line.

SCI_MARKERDEFINE(int markerNumber, int markerSymbols)
SCI_MARKERDEFINEPIXMAP(int markerNumber, @@ -3489,12 +3633,23 @@ struct Sci_TextToFind {

SCI_MARKERDEFINE(int markerNumber, int markerSymbols)
This message associates a marker number in the range 0 to 31 with one of the marker symbols or an ASCII character. The general-purpose marker symbols currently available are:
- SC_MARK_CIRCLE, SC_MARK_ROUNDRECT, SC_MARK_ARROW, - SC_MARK_SMALLRECT, SC_MARK_SHORTARROW, SC_MARK_EMPTY, - SC_MARK_ARROWDOWN, SC_MARK_MINUS, SC_MARK_PLUS, - SC_MARK_ARROWS, SC_MARK_DOTDOTDOT, - SC_MARK_BACKGROUND, SC_MARK_LEFTRECT, - SC_MARK_FULLRECT, and SC_MARK_UNDERLINE.

+ SC_MARK_CIRCLE, + SC_MARK_ROUNDRECT, + SC_MARK_ARROW, + SC_MARK_SMALLRECT, + SC_MARK_SHORTARROW, + SC_MARK_EMPTY, + SC_MARK_ARROWDOWN, + SC_MARK_MINUS, + SC_MARK_PLUS, + SC_MARK_ARROWS, + SC_MARK_DOTDOTDOT, + SC_MARK_BACKGROUND, + SC_MARK_LEFTRECT, + SC_MARK_FULLRECT, + SC_MARK_BOOKMARK, and + SC_MARK_UNDERLINE. +

The SC_MARK_BACKGROUND marker changes the background colour of the line only. The SC_MARK_FULLRECT symbol mirrors this, changing only the margin background colour. @@ -3509,16 +3664,23 @@ struct Sci_TextToFind {

There are also marker symbols designed for use in the folding margin in a flattened tree style.
- SC_MARK_BOXMINUS, SC_MARK_BOXMINUSCONNECTED, - SC_MARK_BOXPLUS, SC_MARK_BOXPLUSCONNECTED, - SC_MARK_CIRCLEMINUS, SC_MARK_CIRCLEMINUSCONNECTED, - SC_MARK_CIRCLEPLUS, SC_MARK_CIRCLEPLUSCONNECTED, - SC_MARK_LCORNER, SC_MARK_LCORNERCURVE, SC_MARK_TCORNER, - SC_MARK_TCORNERCURVE, and SC_MARK_VLINE.

- Characters can be used as markers by adding the ASCII value of the character to + SC_MARK_BOXMINUS, + SC_MARK_BOXMINUSCONNECTED, + SC_MARK_BOXPLUS, + SC_MARK_BOXPLUSCONNECTED, + SC_MARK_CIRCLEMINUS, + SC_MARK_CIRCLEMINUSCONNECTED, + SC_MARK_CIRCLEPLUS, + SC_MARK_CIRCLEPLUSCONNECTED, + SC_MARK_LCORNER, + SC_MARK_LCORNERCURVE, + SC_MARK_TCORNER, + SC_MARK_TCORNERCURVE, and + SC_MARK_VLINE.

+ Characters can be used as markers by adding the ASCII value of the character to SC_MARK_CHARACTER (10000). For example, to use 'A' (ASCII code 65) as marker number 1 use:
- SCI_MARKERDEFINE(1, SC_MARK_CHARACTER+65).
+ SCI_MARKERDEFINE(1, SC_MARK_CHARACTER+65).

The marker numbers SC_MARKNUM_FOLDER and SC_MARKNUM_FOLDEROPEN are used for showing that a fold is present and open or closed. Any symbols may be assigned for @@ -3637,6 +3799,7 @@ struct Sci_TextToFind { +

Marker samples

SCI_MARKERDEFINEPIXMAP(int markerNumber, const char *xpm)
@@ -3654,7 +3817,7 @@ struct Sci_TextToFind { The width and height must previously been set with the SCI_RGBAIMAGESETWIDTH and SCI_RGBAIMAGESETHEIGHT messages.

A scale factor in percent may be set with SCI_RGBAIMAGESETSCALE. This is useful on OS X with - a retina display where each display unit is 2 pixels: use a factor of 200 so that each image pixel is dsplayed using a screen pixel. + a retina display where each display unit is 2 pixels: use a factor of 200 so that each image pixel is displayed using a screen pixel. The default scale, 100, will stretch each image pixel to cover 4 screen pixels on a retina display.

Pixmaps use the SC_MARK_RGBAIMAGE marker symbol.

@@ -3738,19 +3901,32 @@ struct Sci_TextToFind {

Indicators are used to display additional information over the top of styling. They can be used to show, for example, syntax errors, deprecated names and bad indentation - by drawing underlines under text or boxes around text. Originally, Scintilla stored indicator information in - the style bytes but this has proved limiting, so now up to 32 separately stored indicators may be used. - While style byte indicators currently still work, they will soon be removed so all the bits in each style - byte can be used for lexical states.

+ by drawing underlines under text or boxes around text.

+ +

Indicators may have a different "hover" colour and style when the mouse is over them or the caret is moved into them. + This may be used, for example, to indicate that a URL can be clicked.

Indicators may be displayed as simple underlines, squiggly underlines, a - line of small 'T' shapes, a line of diagonal hatching, a strike-out or a rectangle around the text.

+ line of small 'T' shapes, a line of diagonal hatching, a strike-out or a rectangle around the text. + They may also be invisible when used to track pieces of content for the application as INDIC_HIDDEN.

The SCI_INDIC* messages allow you to get and set the visual appearance of the - indicators. They all use an indicatorNumber argument in the range 0 to INDIC_MAX(31) + indicators. They all use an indicatorNumber argument in the range 0 to INDIC_MAX(35) to set the indicator to style. To prevent interference the set of indicators is divided up into a range for use - by lexers (0..7) and a range for use by containers - (8=INDIC_CONTAINER .. 31=INDIC_MAX).

+ by lexers (0..7) a range for use by containers + (8=INDIC_CONTAINER .. 31=INDIC_IME-1) + and a range for IME indicators (32=INDIC_IME .. 35=INDIC_IME_MAX).

+ +

Indicators are stored in a format similar to run length encoding which is efficient in both + speed and storage for sparse information.

+

An indicator may store different values for each range but currently all values are drawn the same. + In the future, it may be possible to draw different values in different styles.

+ +

Originally, Scintilla used a different technique for indicators but this + has been removed + and the APIs perform no action. + While both techniques were supported, the term "modern indicators" was used for the + newer implementation.

SCI_INDICSETSTYLE(int indicatorNumber, int indicatorStyle)
@@ -3764,6 +3940,15 @@ struct Sci_TextToFind { SCI_INDICGETOUTLINEALPHA(int indicatorNumber)
SCI_INDICSETUNDER(int indicatorNumber, bool under)
SCI_INDICGETUNDER(int indicatorNumber)
+ SCI_INDICSETHOVERSTYLE(int indicatorNumber, int + indicatorStyle)
+ SCI_INDICGETHOVERSTYLE(int indicatorNumber)
+ SCI_INDICSETHOVERFORE(int indicatorNumber, int + colour)
+ SCI_INDICGETHOVERFORE(int indicatorNumber)
+ SCI_INDICSETFLAGS(int indicatorNumber, int flags)
+ SCI_INDICGETFLAGS(int indicatorNumber)
+
SCI_SETINDICATORCURRENT(int indicator)
SCI_GETINDICATORCURRENT
@@ -3785,7 +3970,9 @@ struct Sci_TextToFind { indicatorStyle)
SCI_INDICGETSTYLE(int indicatorNumber)
These two messages set and get the style for a particular indicator. The indicator styles - currently available are:

+ currently available are:
+ + Indicator samples

@@ -3876,7 +4063,18 @@ struct Sci_TextToFind { interior usually more transparent than the border. You can use SCI_INDICSETALPHA and SCI_INDICSETOUTLINEALPHA - to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour. + to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour. + This indicator does not colour the top pixel of the line so that indicators on contiguous lines are visually distinct + and disconnected. + + + + + + + + @@ -3925,7 +4123,7 @@ struct Sci_TextToFind { + Appearance will not be as good as INDIC_SQUIGGLE on OS X in HiDPI mode. @@ -3935,7 +4133,25 @@ struct Sci_TextToFind { + This is similar to an appearance used for the target in Asian language input composition. + + + + + + + + + + + + + + + + @@ -3971,15 +4187,32 @@ struct Sci_TextToFind {

SCI_INDICSETUNDER(int indicatorNumber, bool under)
SCI_INDICGETUNDER(int indicatorNumber)
These two messages set and get whether an indicator is drawn under text or over(default). - Drawing under text works only for modern indicators when two phase drawing + Drawing under text works only for indicators when two phase drawing is enabled.

-

Modern Indicators

+

SCI_INDICSETHOVERSTYLE(int indicatorNumber, int + indicatorStyle)
+ SCI_INDICGETHOVERSTYLE(int indicatorNumber)
+ SCI_INDICSETHOVERFORE(int indicatorNumber, int colour)
+ SCI_INDICGETHOVERFORE(int indicatorNumber)
+ These messages set and get the colour and style used to draw indicators when the mouse is over them or the caret moved into them. + The mouse cursor also changes when an indicator is drawn in hover style. + The default is for the hover appearance to be the same as the normal appearance and calling + SCI_INDICSETFORE or + SCI_INDICSETSTYLE will + also reset the hover attribute.

+ +

SCI_INDICSETFLAGS(int indicatorNumber, int flags)
+ SCI_INDICGETFLAGS(int indicatorNumber)
+ These messages set and get the flags associated with an indicator. + There is currently one flag defined, SC_INDICFLAG_VALUEFORE: when this flag is set + the colour used by the indicator is not from the indicator's fore setting but instead from the value of the indicator at + that point in the file. This allows many colours to be displayed for a single indicator. The value is an RGB integer colour that has been ored with SC_INDICVALUEBIT(0x1000000) + when calling SCI_SETINDICATORVALUE. + To find the colour from the value, and the value with SC_INDICVALUEMASK(0xFFFFFF). +

-

Modern indicators are stored in a format similar to run length encoding which is efficient in both - speed and storage for sparse information.

-

An indicator may store different values for each range but currently all values are drawn the same. - In the future, it may be possible to draw different values in different styles.

SCI_SETINDICATORCURRENT(int indicator)
SCI_GETINDICATORCURRENT
@@ -4006,6 +4239,7 @@ struct Sci_TextToFind {

SCI_INDICATORALLONFOR(int position)
Retrieve a bitmap value representing which indicators are non-zero at a position. + Only the first 32 indicators are represented in the result so no IME indicators are included.

@@ -4043,32 +4277,8 @@ struct Sci_TextToFind { This message hides the find indicator.

-

Style Byte Indicators (deprecated)

-

By default, Scintilla organizes the style byte associated with each text byte as 5 bits of - style information (for 32 styles) and 3 bits of indicator information for 3 independent - indicators so that, for example, syntax errors, deprecated names and bad indentation could all - be displayed at once.

- -

The indicators are set using SCI_STARTSTYLING with a INDICS_MASK mask - and SCI_SETSTYLING with the values - INDIC0_MASK, INDIC1_MASK and INDIC2_MASK.

- -

If you are using indicators in a buffer that has a lexer active - (see SCI_SETLEXER), - you must save lexing state information before setting any indicators and restore it afterwards. - Use SCI_GETENDSTYLED - to retrieve the current "styled to" position and - SCI_STARTSTYLING - to reset the styling position and mask (0x1f in the default layout of 5 style bits and 3 indicator bits) - when you are done.

- -

The number of bits used for styles can be altered with SCI_SETSTYLEBITS from 0 to 8 bits. The remaining bits - can be used for indicators, so there can be from 1 to 8 indicators. However, the - INDIC*_MASK constants defined in Scintilla.h all assume 5 bits of - styling information and 3 indicators. If you use a different arrangement, you must define your - own constants.

+

Earlier versions of Scintilla allowed partitioning style bytes + between style numbers and indicators and provided APIs for setting and querying this.

Autocompletion

@@ -4118,10 +4328,12 @@ struct Sci_TextToFind { SCI_AUTOCSETIGNORECASE(bool ignoreCase)
SCI_AUTOCGETIGNORECASE
- SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)
- SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR
- SCI_AUTOCSETORDER(int order)
- SCI_AUTOCGETORDER
+ SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)
+ SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR
+ SCI_AUTOCSETMULTI(int multi)
+ SCI_AUTOCGETMULTI
+ SCI_AUTOCSETORDER(int order)
+ SCI_AUTOCGETORDER
SCI_AUTOCSETAUTOHIDE(bool autoHide)
SCI_AUTOCGETAUTOHIDE
SCI_AUTOCSETDROPRESTOFWORD(bool @@ -4195,7 +4407,7 @@ struct Sci_TextToFind { href="#SCI_AUTOCSETAUTOHIDE">SCI_AUTOCSETAUTOHIDE).
The current selection index can be retrieved with SCI_AUTOCGETCURRENT.

-

SCI_AUTOCGETCURRENTTEXT(<unused>, char *text)
+

SCI_AUTOCGETCURRENTTEXT(<unused>, char *text NUL-terminated)
This message retrieves the current selected text in the autocompletion list. Normally the SCN_AUTOCSELECTION notification is used instead.

@@ -4208,7 +4420,7 @@ struct Sci_TextToFind {

SCI_AUTOCSETCANCELATSTART(bool cancel)
SCI_AUTOCGETCANCELATSTART
- The default behavior is for the list to be cancelled if the caret moves to the location it + The default behaviour 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 at least one character before the word being completed.

@@ -4230,15 +4442,21 @@ 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
+

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
+

SCI_AUTOCSETMULTI(int multi)
+ SCI_AUTOCGETMULTI
+ When autocompleting with multiple selections present, the autocompleted text can go into just the main selection with + SC_MULTIAUTOC_ONCE (0) or into each selection with SC_MULTIAUTOC_EACH (1). + The default is SC_MULTIAUTOC_ONCE.

+ +

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). @@ -4339,6 +4557,8 @@ struct Sci_TextToFind { There is some interaction between call tips and autocompletion lists in that showing a call tip cancels any active autocompletion list, and vice versa.

+

Call tips are not implemented on Qt.

+

Call tips can highlight part of the text within them. You could use this to highlight the current argument to a function by counting the number of commas (or whatever separator your language uses). See SciTEBase::CharAdded() in SciTEBase.cxx for an @@ -4363,6 +4583,7 @@ struct Sci_TextToFind { SCI_CALLTIPCANCEL
SCI_CALLTIPACTIVE
SCI_CALLTIPPOSSTART
+ SCI_CALLTIPSETPOSSTART(int posStart)
SCI_CALLTIPSETHLT(int highlightStart, int highlightEnd)
SCI_CALLTIPSETBACK(int colour)
@@ -4384,18 +4605,22 @@ struct Sci_TextToFind { '\n' (Line Feed, ASCII code 10) characters. Do not include '\r' (Carriage Return, ASCII code 13), as this will most likely print as an empty box. '\t' (Tab, ASCII code 9) is supported if you set a tabsize with - SCI_CALLTIPUSESTYLE.

+ SCI_CALLTIPUSESTYLE.
+ The position of the caret is remembered here so that the call tip can be cancelled automatically if subsequent deletion + moves the caret before this position.

SCI_CALLTIPCANCEL
This message cancels any displayed call tip. Scintilla will also cancel call tips for you if you use any keyboard commands that are not compatible with editing the argument list of a - function.

+ function. + Call tips are cancelled if you delete back past the position where the caret was when the tip was triggered.

SCI_CALLTIPACTIVE
This returns 1 if a call tip is active and 0 if it is not active.

SCI_CALLTIPPOSSTART
- This message returns the value of the current position when SCI_CALLTIPSHOW + SCI_CALLTIPSETPOSSTART(int posStart)
+ This message returns or sets the value of the current position when SCI_CALLTIPSHOW started to display the tip.

SCI_CALLTIPSETHLT(int hlStart, int hlEnd)
@@ -4406,7 +4631,7 @@ struct Sci_TextToFind { number of characters to highlight. Highlights can extend over line ends if this is required.

-

Unhighlighted text is drawn in a mid gray. Selected text is drawn in a dark blue. The +

Unhighlighted text is drawn in a mid grey. Selected text is drawn in a dark blue. The background is white. These can be changed with SCI_CALLTIPSETBACK, SCI_CALLTIPSETFORE, and @@ -4416,11 +4641,11 @@ struct Sci_TextToFind {

SCI_CALLTIPSETBACK(int colour)
The background colour of call tips can be set with this message; the default colour is white. It is not a good idea to set a dark colour as the background as the default colour for normal - calltip text is mid gray and the defaultcolour for highlighted text is dark blue. This also + calltip text is mid grey and the default colour for highlighted text is dark blue. This also sets the background colour of STYLE_CALLTIP.

SCI_CALLTIPSETFORE(int colour)
- The colour of call tip text can be set with this message; the default colour is mid gray. + The colour of call tip text can be set with this message; the default colour is mid grey. This also sets the foreground colour of STYLE_CALLTIP.

SCI_CALLTIPSETFOREHLT(int colour)
@@ -4857,7 +5082,7 @@ struct Sci_RangeToFormat {

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 +

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.

When printing, the most tedious part is always working out what the margins should be to @@ -5103,7 +5328,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

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

+

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 @@ -5139,11 +5364,11 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ SCI_CREATEDOCUMENT. There is no need to call Release after ConvertToDocument.

-

Saving in the background

+

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. + 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 display hexadecimal fold levels in line margin to aid debugging of folding. The appearance of this feature may change in the future. + +

+ + + + +
INDIC_FULLBOX16A rectangle around the text using translucent drawing similar to INDIC_STRAIGHTBOX + but covering the entire character area.
A version of INDIC_SQUIGGLE that draws using a pixmap instead of as a series of line segments for performance. Measured to be between 3 and 6 times faster than INDIC_SQUIGGLE on GTK+. - Apperance will not be as good as INDIC_SQUIGGLE on OS X in HiDPI mode.
A 2-pixel thick underline located at the bottom of the line to try to avoid touching the character base. Each side is inset 1 pixel so that different indicators in this style covering a range appear isolated. - This is similar to an appearance used for Asian language input composition.
INDIC_COMPOSITIONTHIN15A 1-pixel thick underline located just before the bottom of the line. + Each side is inset 1 pixel so that different indicators in this style covering a range appear isolated. + This is similar to an appearance used for non-target ranges in Asian language input composition.
INDIC_TEXTFORE17Change the colour of the text to the indicator's fore colour.
SC_FOLDFLAG_LINESTATE128display hexadecimal line state in line margin to aid debugging of lexing and folding. + May not be used at the same time as SC_FOLDFLAG_LEVELNUMBERS.
@@ -5389,7 +5622,6 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ -

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, @@ -5405,7 +5637,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ 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. + flags unless they wish to implement quite different behaviour 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. @@ -5502,7 +5734,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ line.

Wrapping is not performed immediately there is a change but is delayed until the display - is redrawn. This delay improves peformance by allowing a set of changes to be performed + is redrawn. This delay improves performance by allowing a set of changes to be performed and then wrapped and displayed once. Because of this, some operations may not occur as expected. If a file is read and the scroll position moved to a particular line in the text, such as occurs when a container tries to restore a previous editing session, then @@ -5514,11 +5746,12 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

SCI_SETWRAPMODE(int wrapMode)
SCI_GETWRAPMODE
Set wrapMode to SC_WRAP_WORD (1) to enable wrapping - on word boundaries, SC_WRAP_CHAR (2) to enable wrapping - between any characters, and to SC_WRAP_NONE (0) to disable line - wrapping. SC_WRAP_CHAR is preferred to - SC_WRAP_WORD for Asian languages where there is no white space - between words.

+ on word or style boundaries, SC_WRAP_CHAR (2) to enable wrapping + between any characters, SC_WRAP_WHITESPACE (3) to enable + wrapping on whitespace, and SC_WRAP_NONE (0) to disable line + wrapping. SC_WRAP_CHAR is preferred for Asian languages where + there is no white space between words. +

SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)
@@ -5829,7 +6062,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

Scintilla also supports external lexers. These are DLLs (on Windows) or .so modules (on GTK+/Linux) that export three functions: GetLexerCount, GetLexerName, and GetLexerFactory. See externalLexer.cxx for more.

-
SCI_SETLEXER(int lexer)
+ SCI_SETLEXER(int lexer)
SCI_GETLEXER
SCI_SETLEXERLANGUAGE(<unused>, const char *name)
@@ -5849,19 +6082,16 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ SCI_DESCRIBEKEYWORDSETS(<unused>, char *descriptions)
SCI_SETKEYWORDS(int keyWordSet, const char *keyWordList)
- SCI_GETSTYLEBITSNEEDED
- - -

SCI_SETLEXER(int lexer)
SCI_GETLEXER
@@ -5874,7 +6104,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ assigns unused lexer numbers to.

SCI_SETLEXERLANGUAGE(<unused>, const char *name)
- SCI_GETLEXERLANGUAGE(<unused>, char *name)
+ SCI_GETLEXERLANGUAGE(<unused>, char *name NUL-terminated)
SCI_SETLEXERLANGUAGE lets you select a lexer by name, and is the only method if you are using an external lexer or if you have written a lexer module for a language of your own and do not wish to assign it an explicit lexer number. To select an existing lexer, set name to @@ -5905,9 +6135,9 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ Indicate that the internal state of a lexer has changed over a range and therefore there may be a need to redraw.

-

SCI_PROPERTYNAMES(<unused>, char *names)
+

SCI_PROPERTYNAMES(<unused>, char *names NUL-terminated)
SCI_PROPERTYTYPE(const char *name)
- SCI_DESCRIBEPROPERTY(const char *name, char *description)
+ SCI_DESCRIBEPROPERTY(const char *name, char *description NUL-terminated)
Information may be retrieved about the properties that can be set for the current lexer. This information is only available for newer lexers. SCI_PROPERTYNAMES returns a string with all of the valid properties separated by "\n". @@ -5942,11 +6172,11 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

Applications may discover the set of properties used by searching the source code of lexers for lines that contain GetProperty and a double quoted string and extract the value of the double quoted string as the property name. - The scintilla/src/LexGen.py script does this and can be used as an example. + The scintilla/scripts/LexGen.py script does this and can be used as an example. Documentation for the property may be located above the call as a multi-line comment starting with
// property <property-name>

-

SCI_GETPROPERTY(const char *key, char *value)
+

SCI_GETPROPERTY(const char *key, char *value NUL-terminated)
Lookup a keyword:value pair using the specified key; if found, copy the value to the user-supplied buffer and return the length (not including the terminating 0). If not found, copy an empty string to the buffer and return 0.

@@ -5977,8 +6207,8 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ SCI_SETPROPERTY will be performed before any numeric interpretation.

SCI_SETKEYWORDS(int keyWordSet, const char *keyWordList)
- You can set up to 9 lists of keywords for use by the current lexer. This was increased from 6 - at revision 1.50. keyWordSet can be 0 to 8 (actually 0 to KEYWORDSET_MAX) + You can set up to 9 lists of keywords for use by the current lexer. + keyWordSet can be 0 to 8 (actually 0 to KEYWORDSET_MAX) and selects which keyword list to replace. keyWordList is a list of keywords separated by spaces, tabs, "\n" or "\r" or any combination of these. It is expected that the keywords will be composed of standard ASCII printing characters, @@ -5998,17 +6228,10 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ There is nothing to stop you building your own keyword lists into the lexer, but this means that the lexer must be rebuilt if more keywords are added.

-

SCI_DESCRIBEKEYWORDSETS(<unused>, char *descriptions)
+

SCI_DESCRIBEKEYWORDSETS(<unused>, char *descriptions NUL-terminated)
A description of all of the keyword sets separated by "\n" is returned by SCI_DESCRIBEKEYWORDSETS.

-

SCI_GETSTYLEBITSNEEDED
- Retrieve the number of bits the current lexer needs for styling. This should normally be the argument - to SCI_SETSTYLEBITS. -

- -

Substyles

- These features are provisional

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. @@ -6016,7 +6239,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ each purpose. Lexers have to explicitly support this feature by implementing the methods in ILexerWithSubStyles.

-

SCI_GETSUBSTYLEBASES(<unused>, char *styles)
+

SCI_GETSUBSTYLEBASES(<unused>, char *styles NUL-terminated)
Fill styles with a byte for each style that can be split into substyles.

SCI_DISTANCETOSECONDARYSTYLES
@@ -6033,9 +6256,15 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ SCI_GETSUBSTYLESLENGTH(int styleBase)
Return the start and length of the substyles allocated for a base style.

+

SCI_GETSTYLEFROMSUBSTYLE(int subStyle)
+ For a sub style, return the base style, else return the argument.

+ +

SCI_GETPRIMARYSTYLEFROMSTYLE(int style)
+ For a secondary style, return the primary style, else return the argument.

+

SCI_SETIDENTIFIERS(int style, const char *identifiers)
- Similar to SCI_SETKEYWORDS but for substyles.

-
+ Similar to SCI_SETKEYWORDS but for substyles. + The prefix feature available with SCI_SETKEYWORDS is not implemented for SCI_SETIDENTIFIERS.

Lexer Objects

@@ -6135,6 +6364,9 @@ A simple approach is to return 0 if there is any possibility that a change requi optimisation could be to remember where a setting first affects the document and return that position.

+

Version returns an enumerated value specifying which version of the interface is implemented: +lvOriginal for ILexer and lvSubStyles for ILexerWithSubStyles.

+

Release is called to destroy the lexer object.

PrivateCall allows for direct communication between the @@ -6151,9 +6383,9 @@ 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

+

ILexerWithSubStyles

-

+

To allow lexers to report which line ends they support, and to support substyles, Ilexer is extended to ILexerWithSubStyles.

@@ -6165,6 +6397,8 @@ To allow lexers to report which line ends they support, and to support substyles         virtual int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) = 0;
        virtual int SCI_METHOD SubStylesStart(int styleBase) = 0;
        virtual int SCI_METHOD SubStylesLength(int styleBase) = 0;
+        virtual int SCI_METHOD StyleFromSubStyle(int subStyle) = 0;
+        virtual int SCI_METHOD PrimaryStyleFromStyle(int style) = 0;
        virtual void SCI_METHOD FreeSubStyles() = 0;
        virtual void SCI_METHOD SetIdentifiers(int style, const char *identifiers) = 0;
        virtual int SCI_METHOD DistanceToSecondaryStyles() = 0;
@@ -6315,6 +6549,8 @@ segments then changing the statement #define BEOS 0 to #defin document. The lexer can call ChangeLexerState to signal to the document that it should relex and display more.

+

For StartStyling the mask argument has no effect. It was used in version 3.4.2 and earlier.

+

SetErrorStatus is used to notify the document of exceptions. Exceptions should not be thrown over build boundaries as the two sides may be built with different compilers or incompatible @@ -6353,8 +6589,16 @@ implemented and thus which methods may be called.

Notifications

Notifications are sent (fired) from the Scintilla control to its container when an event has - occurred that may interest the container. Notifications are sent using the - WM_NOTIFY message on Windows and the "notify" signal on GTK+. The container is + occurred that may interest the container.

+

Notifications are sent using the + WM_NOTIFY message on Windows.

+

On GTK+, the "sci-notify" signal is sent and the signal handler should have the signature + handler(GtkWidget *, gint, SCNotification *notification, gpointer userData).

+

On Cocoa, a delegate implementing the ScintillaNotificationProtocol + may be set to receive notifications or the ScintillaView class may be subclassed and the + notification: method overridden. Overriding notification: allows the + subclass to control whether default handling is performed.

+

The container is passed a SCNotification structure containing information about the event.

 struct NotifyHeader {   // This matches the Win32 NMHDR structure
@@ -6428,6 +6672,8 @@ struct SCNotification {
      SCN_AUTOCSELECTION
SCN_AUTOCCANCELLED
SCN_AUTOCCHARDELETED
+ SCN_FOCUSIN
+ SCN_FOCUSOUT

The following SCI_* messages are associated with these notifications:

@@ -6439,9 +6685,14 @@ struct SCNotification { SCI_GETIDENTIFIER
-

The following additional notifications are sent using the WM_COMMAND message on - Windows and the "Command" signal on GTK+. This emulates the Windows Edit control. Only the lower +

The following additional notifications are sent using a secondary "command" method and should + be avoided in new code as the primary "notification" method provides all the same events with richer + information. + The WM_COMMAND message is used on Windows. + This emulates the Windows Edit control. Only the lower 16 bits of the control's ID is passed in these notifications.

+

On GTK+, the "command" signal is sent and the signal handler should have the signature + handler(GtkWidget *, gint wParam, gpointer lParam, gpointer userData).

SCEN_CHANGE
SCEN_SETFOCUS
SCEN_KILLFOCUS
@@ -6454,7 +6705,7 @@ struct SCNotification { 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. - The value should be small, preferrably less than 16 bits, + The value should be small, preferably less than 16 bits, rather than a pointer as some of the functions will only transmit 16 or 32 bits.

@@ -6663,7 +6914,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_MOD_INSERTTEXT - 0x01 + 0x01 Text has been inserted into the document. @@ -6673,7 +6924,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_MOD_DELETETEXT - 0x02 + 0x02 Text has been removed from the document. @@ -6683,7 +6934,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_MOD_CHANGESTYLE - 0x04 + 0x04 A style change has occurred. @@ -6693,7 +6944,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_MOD_CHANGEFOLD - 0x08 + 0x08 A folding change has occurred. @@ -6703,7 +6954,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_PERFORMED_USER - 0x10 + 0x10 Information: the operation was done by the user. @@ -6713,7 +6964,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_PERFORMED_UNDO - 0x20 + 0x20 Information: this was the result of an Undo. @@ -6723,7 +6974,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_PERFORMED_REDO - 0x40 + 0x40 Information: this was the result of a Redo. @@ -6733,7 +6984,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_MULTISTEPUNDOREDO - 0x80 + 0x80 This is part of a multi-step Undo or Redo transaction. @@ -6743,7 +6994,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_LASTSTEPINUNDOREDO - 0x100 + 0x100 This is the final step in an Undo or Redo transaction. @@ -6753,7 +7004,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_MOD_CHANGEMARKER - 0x200 + 0x200 One or more markers has changed in a line. @@ -6763,7 +7014,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_MOD_BEFOREINSERT - 0x400 + 0x400 Text is about to be inserted into the document. @@ -6773,7 +7024,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_MOD_BEFOREDELETE - 0x800 + 0x800 Text is about to be deleted from the document. @@ -6783,7 +7034,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_MOD_CHANGEINDICATOR - 0x4000 + 0x4000 An indicator has been added or removed from a range of text. @@ -6793,7 +7044,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_MOD_CHANGELINESTATE - 0x8000 + 0x8000 A line state has changed because SCI_SETLINESTATE was called. @@ -6801,10 +7052,21 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); line + + SC_MOD_CHANGETABSTOPS + + 0x200000 + + The explicit tab stops on a line have changed because SCI_CLEARTABSTOPS or + SCI_ADDTABSTOP was called. + + line + + SC_MOD_LEXERSTATE - 0x80000 + 0x80000 The internal state of a lexer has changed over a range. @@ -6814,7 +7076,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_MOD_CHANGEMARGIN - 0x10000 + 0x10000 A text margin has changed. @@ -6824,17 +7086,29 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_MOD_CHANGEANNOTATION - 0x20000 + 0x20000 An annotation has changed. line + + SC_MOD_INSERTCHECK + + 0x100000 + + Text is about to be inserted. The handler may change the text being inserted by calling + SCI_CHANGEINSERTION. + No other modifications may be made in this handler. + + position, length, text + + SC_MULTILINEUNDOREDO - 0x1000 + 0x1000 This is part of an Undo or Redo with multi-line changes. @@ -6844,7 +7118,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_STARTACTION - 0x2000 + 0x2000 This is set on a SC_PERFORMED_USER action when it is the first or only step in an undo transaction. This can be used to integrate the Scintilla @@ -6859,7 +7133,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_MOD_CONTAINER - 0x40000 + 0x40000 This is set on for actions that the container stored into the undo stack with SCI_ADDUNDOACTION. @@ -6871,7 +7145,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_MODEVENTMASKALL - 0x7FFFF + 0x1FFFFF This is a mask for all valid flags. This is the default mask state set by SCI_SETMODEVENTMASK. @@ -6884,7 +7158,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber);

SCEN_CHANGE
SCEN_CHANGE (768) is fired when the text (not the style) of the document changes. This notification is sent using the WM_COMMAND message on Windows and the - "Command" signal on GTK+ as this is the behavior of the standard Edit control + "command" signal on GTK+ as this is the behaviour of the standard Edit control (SCEN_CHANGE has the same value as the Windows Edit control EN_CHANGE). No other information is sent. If you need more detailed information use SCN_MODIFIED. You can filter the @@ -6913,8 +7187,8 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SCEN_KILLFOCUS
SCEN_SETFOCUS (512) is fired when Scintilla receives focus and SCEN_KILLFOCUS (256) when it loses focus. These notifications are sent using the - WM_COMMAND message on Windows and the "Command" signal on GTK+ as this is the - behavior of the standard Edit control. Unfortunately, these codes do not match the Windows Edit + WM_COMMAND message on Windows and the "command" signal on GTK+ as this is the + behaviour of the standard Edit control. Unfortunately, these codes do not match the Windows Edit notification codes EN_SETFOCUS (256) and EN_KILLFOCUS (512). It is now too late to change the Scintilla codes as clients depend on the current values.

@@ -7119,6 +7393,7 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next These notifications are generated when the user clicks or double clicks on text that is in a style with the hotspot attribute set. This notification can be used to link to variable definitions or web pages. + In the notification handler, you should avoid calling any function that modifies the current selection or caret position. The position field is set the text position of the click or double click and the modifiers field set to the key modifiers held down in a similar manner to SCN_KEY. @@ -7177,6 +7452,11 @@ 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.

+

SCN_FOCUSIN
+ SCN_FOCUSOUT
+ SCN_FOCUSIN (2028) is fired when Scintilla receives focus and + SCN_FOCUSOUT (2029) when it loses focus.

+

Images

Two formats are supported for images used in margin markers and autocompletion lists, RGBA and XPM.

@@ -7256,6 +7536,13 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next

Provisional features are displayed in this document with a distinctive background colour.

+

There are currently no provisional messages. + The SC_TECHNOLOGY_DIRECTWRITERETAIN and + SC_TECHNOLOGY_DIRECTWRITEDC values for + SCI_SETTECHNOLOGY are provisional.

+ +

Using C++11 <regex> is provisional.

+

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.

@@ -7321,6 +7608,22 @@ EM_FORMATRANGE 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.

+ +

SCI_SETKEYSUNICODE(bool keysUnicode) Deprecated
+ SCI_GETKEYSUNICODE Deprecated
+ On Windows, Scintilla no longer supports narrow character windows so input is always treated as Unicode.

+ +

The following are features that should be removed from calling code but are still + defined to avoid breaking callers.

+ +

SCI_SETSTYLEBITS(int bits) Deprecated
+ SCI_GETSTYLEBITS Deprecated
+ SCI_GETSTYLEBITSNEEDED Deprecated
+ INDIC0_MASK, INDIC1_MASK, INDIC2_MASK, INDICS_MASK Deprecated
+ Scintilla no longer supports style byte indicators. The last version to support style byte indicators was 3.4.2. + Any use of these symbols should be removed and replaced with standard indicators. + SCI_GETSTYLEBITS and SCI_GETSTYLEBITSNEEDED always return 8, + indicating that 8 bits are used for styling and there are 256 styles.

Edit messages never supported by Scintilla

@@ -7357,6 +7660,12 @@ EM_SETTARGETDEVICE
     that makes sense. As it is not intended for use in a word processor, some edit messages can not
     be sensibly handled. Unsupported messages have no effect.

+

Removed features

+ +

Previous versions of Scintilla allowed indicators to be stored in bits of each style byte. + This was deprecated in 2007 and removed in 2014 with release 3.4.3. + All uses of style byte indicators should be replaced with standard indicators.

+

Building Scintilla

To build Scintilla or SciTE, see the README file present in both the Scintilla and SciTE @@ -7385,10 +7694,10 @@ EM_SETTARGETDEVICE

Changing set of lexers

To change the set of lexers in Scintilla, add and remove lexer source files - (Lex*.cxx) from the scintilla/src directory and run the - src/LexGen.py script from the src directory to update the make files - and KeyWords.cxx. LexGen.py requires Python 2.1 or later. If you do - not have access to Python, you can hand edit KeyWords.cxx in a simple-minded way, + (Lex*.cxx) from the scintilla/lexers directory and run the + scripts/LexGen.py script from the scripts directory to update the make files + and Catalogue.cxx. LexGen.py requires Python 2.5 or later. If you do + not have access to Python, you can hand edit Catalogue.cxx in a simple-minded way, following the patterns of other lexers. The important thing is to include LINK_LEXER(lmMyLexer); to correspond with the LexerModule lmMyLexer(...); in your lexer source code.

diff --git a/scintilla/doc/ScintillaDownload.html b/scintilla/doc/ScintillaDownload.html index 17e30fb7..48b88dc4 100644 --- a/scintilla/doc/ScintillaDownload.html +++ b/scintilla/doc/ScintillaDownload.html @@ -25,9 +25,9 @@ @@ -41,7 +41,7 @@ containing very few restrictions.

- Release 3.3.4 + Release 3.5.6

Source Code @@ -49,8 +49,8 @@ The source code package contains all of the source code for Scintilla but no binary executable code and is available in
    -
  • zip format (1250K) commonly used on Windows
  • -
  • tgz format (1100K) commonly used on Linux and compatible operating systems
  • +
  • zip format (1450K) commonly used on Windows
  • +
  • tgz format (1300K) commonly used on Linux and compatible operating systems
Instructions for building on both Windows and Linux are included in the readme file.

diff --git a/scintilla/doc/ScintillaHistory.html b/scintilla/doc/ScintillaHistory.html index c7911bfd..87bf61d8 100644 --- a/scintilla/doc/ScintillaHistory.html +++ b/scintilla/doc/ScintillaHistory.html @@ -64,369 +64,414 @@

- + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + - + - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- + Windows   - + GTK+/Linux   John Ehresman Steffen Goeldner Deepak S.Yann GaillardDevelopMentor
Yann Gaillard Aubin Paul Jason Diamond Ahmad BaitalmalPaul Winwood
Paul Winwood Maxim Baranov Ragnar Højland Christian ObrechtAndreas Neukoetter
Andreas Neukoetter Adam Gates Steve Lhomme Ferdinand PrantlJan Dries
Jan Dries Markus Gritsch Tahir Karaca Ahmad ZawawiLaurent le Tynevez
Laurent le Tynevez Walter Braeu Ashley Cambrell Garrett SerackHolger Schmidt
Holger Schmidt ActiveState James Larcombe Alexey YutkinJan Hercek
Jan Hercek Richard Pecl Edward K. Ream Valery KondakoffSmári McCarthy
Smári McCarthy Clemens Wyss Simon Steele Serge A. BaranovXavier Nodet
Xavier Nodet Willy Devaux David Clain Brendon YensonVamsi Potluru
Vamsi Potluru Praveen Ambekar Alan Knowles Kengo JinnoValentin Valchev
Valentin Valchev Marcos E. Wurzius Martin Alderson Robert GustavssonJosé Fonseca
José Fonseca Holger Kiemes Francis Irving Scott KirkwoodBrian Quinlan
Brian Quinlan Ubi Michael R. Duerig Deepak TDon Paul Beletsky
Don Paul Beletsky Gerhard Kalab Olivier Dagenais Josh WingstromBruce Dodson
Bruce Dodson Sergey Koshcheyev Chuan-jian Shen Shane CaraveoAlexander Scripnik
Alexander Scripnik Ryan Christianson Martin Steffensen Jakub VránaThe Black Horus
The Black Horus Bernd Kreuss Thomas Lauer Mike LansdaalYukihiro Nakai
Yukihiro Nakai Jochen Tucht Greg Smith Steve SchoettlerMauritius Thinnes
Mauritius Thinnes Darren Schroeder Pedro GuerreiroSteven te Brinke
Dan Petitt Biswapesh Chattopadhyay
Kein-Hong Man Patrizio Bekerle
Nigel Hathaway Hrishikesh Desai
Sergey Puljajev Mathias RauenAngelo MandatoDenis Sureau
Angelo MandatoDenis Sureau Kaspar Schiess Christoph Hösler
João Paulo F Farias Ron Schofield
Stefan Wosnik Marius Gheorghe
Naba Kumar Sean O'Dell
Stefanos Togoulidis Hans Hagen
Jim Cape Roland Walter
Brian Mosher Nicholas Nemtsev
Roy Wood Peter-Henry Mander
Robert Boucher Christoph Dalitz
April White S. Umar
Trent Mick Filip Yaghob
Avi Yegudin Vivi Orunitia
Manfred Becker Dimitris Keletsekis
Yuiga Davide Scola
Jason Boggs Reinhold Niesner
Jos van der Zande Pescuma
Pavol Bosik Johannes Schmid
Blair McGlashan Mikael Hultgren
Florian Balmer Hadar Raz
Herr Pfarrer Ben Key
Gene Barry Niki Spahiev
Carsten Sperber Phil Reid
Iago Rubio Régis Vaquette
Massimo Corà Elias Pschernig
Chris Jones Josiah Reynolds
Robert Roessler rftp.com Steve Donovan
Jan Martin Pettersen Sergey Philippov
Borujoa Michael Owens
Franck Marcia Massimo Maria Ghisalberti
Frank Wunderlich Josepmaria Roca
Tobias Engvall Suzumizaki Kimitaka
Michael Cartmell Pascal Hurni
Andre Randy Butler
Georg Ritter Michael Goffioul
Ben Harper Adam Strzelecki
Kamen Stanev Steve Menard
Oliver Yeoh Eric Promislow
Joseph Galbraith Jeffrey Ren
Armel Asselin Jim Pattee
Friedrich Vedder Sebastian Pipping
Andre Arpin Stanislav Maslovski
Martin Stone Fabien Proriol
mimir Nicola Civran
Snow Mitchell Foral
Pieter Holtzhausen Waldemar Augustyn
Jason Haslam Sebastian Steinlechner
Chris Rickard Rob McMullen
Stefan Schwendeler Cristian Adam
Nicolas Chachereau Istvan Szollosi
Xie Renhui Enrico Tröger
Todd Whiteman Yuval Papish
instanton Sergio Lucato
VladVRO Dmitry Maslov
chupakabra Juan Carlos Arevalo Baeza
Nick Treleaven Stephen Stagg
Jean-Paul Iribarren Tim Gerundt
Sam Harwell Boris
Jason Oster Gertjan Kloosterman
alexbodn Sergiu Dotenco
Anders Karlsson ozlooper
Marko Njezic Eugen Bitter
Christoph Baumann Christopher Bean
Sergey Kishchenko Kai Liu
Andreas Rumpf James Moffatt
Yuzhou Xin Nic Jansma
Evan Jones Mike Lischke
Eric Kidd maXmo
David Severwright Jon Strait
Oliver Kiddle Etienne Girondel
Haimag Ren Andrey Moskalyov
Xavi Toby Inkster
Eric Forgeot Colomban Wendling
Neo Jordan Russell
Farshid Lashkari Sam Rawlins
Michael Mullin Carlos SS
vim Martial Demolins
Tino Weinkauf Jérôme Laforge
Udo Lechner Marco Falda
Dariusz Knociński Ben Fisher
Don Gobin John Yeung
Adobe Elizabeth A. Irizarry
Mike Schroeder Morten MacFly
Jaime Gimeno Thomas Linder Puls
Artyom Zuikov Gerrit
Occam's Razor Ben Bluemel
David Wolfendale Chris Angelico
Marat Dukhan Stefan Weil
Rex Conn Ross McKay
Bruno Barbieri Gordon Smith
dimitar Sébastien Granjoux
zeniko James Ribe
Markus Nißl Martin Panter
Mark Yen Philippe Elsass
Dimitar Zhekov Fan Yang
Denis Shelomovskij darmar
John Vella Chinh Nguyen
Sakshi Verma Joel B. Mohler
Isiledhel Vidya Wasi
G. Hu Byron Hawkins
Alpha John Donoghue
kudah Igor Shaula
Pavel Bulochkin Yosef Or Boczko
Brian GriffinÖzgür Emir
NeomiOmegaPhilSiegeLordErik
TJFMark RobinsonThomas Martitzfelix
Christian WaltherEbbenRobert GiesekeMike M
nkmathewAndreas TscharnerLee Wilmottjohnsonj
VicenteNick GravgaardIan GoldbyHolger Stenger
danselmiMat BerchtoldMichael StaszewskiBaurzhan Muftakhidinov
Erik AngelinYusuf Ramazan KaragözMarkus HeidelbergJoe Mueller
Mika AttilaJoMazMMarkus MoserStefan Küng
Jiří Techet

@@ -438,6 +483,1203 @@ Icons Copyright(C) 1998 by Dean S. Jones
+

+ Release 3.5.6 +

+
    +
  • + Released 26 May 2015. +
  • +
  • + On Qt, use fractional positioning calls and avoid rounding to ensure consistency. +
  • +
  • + SCI_TARGETASUTF8 and SCI_ENCODEDFROMUTF8 implemented on + Win32 as well as GTK+ and Cocoa. +
  • +
  • + C++ lexer fixes empty backquoted string. + Bug #1711. +
  • +
  • + C++ lexer fixes #undef directive. + Bug #1719. +
  • +
  • + Fortran folder fixes handling of "selecttype" and "selectcase". + Bug #1724. +
  • +
  • + Verilog folder folds interface definitions. +
  • +
  • + VHDL folder folds units declarations and fixes a case insensitivity bug with not treating "IS" the same as "is". +
  • +
  • + Fix bug when drawing text margins in buffered mode which would use default + encoding instead of chosen encoding. + Bug #1703. +
  • +
  • + Fix bug with Korean Hanja conversions in DBCS encoding on Windows. +
  • +
  • + Fix for reading a UTF-16 file in SciTE where a non-BMP character is split over a read buffer boundary. + Bug #1710. +
  • +
  • + Fix bug on GTK+ 2.x for Windows where there was an ABI difference between + compiler version. + Bug #1726. +
  • +
  • + Fix undo bug on Cocoa that could lose data.. +
  • +
  • + Fix link error on Windows when SCI_NAMESPACE used. +
  • +
  • + Fix exporting from SciTE when using Scintillua for lexing. +
  • +
  • + SciTE does not report twice that a search string can not be found when "Replace" pressed. + Bug #1716. +
  • +
  • + SciTE on GTK+ 3.x disables arrow in search combo when no entries. + Bug #1717. +
  • +
+

+ Release 3.5.5 +

+
    +
  • + Released 17 April 2015. +
  • +
  • + Scintilla on Windows is now always a wide character window so SCI_SETKEYSUNICODE has no effect + and SCI_GETKEYSUNICODE always returns true. These APIs are deprecated and should not be called. +
  • +
  • + The wxWidgets-specific ascent member of Font has been removed which breaks + compatibility with current wxStyledTextCtrl. + Bug #1682. +
  • +
  • + IME on Qt supports multiple carets and behaves more like other platforms. +
  • +
  • + Always use inline IME on GTK+ for Korean. +
  • +
  • + SQL lexer fixes handling of '+' and '-' in numbers so the '-' in '1-1' is seen as an operator and for + '1--comment' the comment is recognized. +
  • +
  • + TCL lexer reverts change to string handling. + Bug #1642. +
  • +
  • + Verilog lexer fixes bugs with macro styling. + Verilog folder fixes bugs with `end completing an `if* instead of `endif and fold.at.else, and implements + folding at preprocessor `else. +
  • +
  • + VHDL lexer supports extended identifiers. +
  • +
  • + Fix bug on Cocoa where the calltip would display incorrectly when + switching calltips and the new calltip required a taller window. +
  • +
  • + Fix leak on Cocoa with autocompletion lists. + Bug #1706. +
  • +
  • + Fix potential crash on Cocoa with drag and drop. + Bug #1709. +
  • +
  • + Fix bug on Windows when compiling with MinGW-w64 which caused text to not be drawn + when in wrap mode. + Bug #1705. +
  • +
  • + Fix SciTE bug with missing file open filters and add hex to excluded set of properties files so that its + settings don't appear. + Bug #1707. +
  • +
  • + Fix SciTE bug where files without extensions like "makefile" were not highlighted correctly. +
  • +
+

+ Release 3.5.4 +

+
    +
  • + Released 8 March 2015. +
  • +
  • + Indicators may have a different colour and style when the mouse is over them or the caret is moved into them. +
  • +
  • + An indicator may display in a large variety of colours with the SC_INDICFLAG_VALUEFORE + flag taking the colour from the indicator's value, which may differ for every character, instead of its + foreground colour attribute. +
  • +
  • + On Cocoa, additional IME methods implemented so that more commands are enabled. + For Japanese: Reverse Conversion, Convert to Related Character, and Search Similar Kanji + can now be performed. + The global definition hotkey Command+Control+D and the equivalent three finger tap gesture + can be used. +
  • +
  • + Minimum version of Qt supported is now 4.8 due to the use of QElapsedTimer::nsecsElapsed. +
  • +
  • + On Windows, for Korean, the VK_HANJA key is implemented to choose Hanja for Hangul and + to convert from Hanja to Hangul. +
  • +
  • + C++ lexer adds lexer.cpp.verbatim.strings.allow.escapes option that allows verbatim (@") strings + to contain escape sequences. This should remain off (0) for C# and be turned on (1) for Objective C. +
  • +
  • + Rust lexer accepts new 'is'/'us' integer suffixes instead of 'i'/'u'. + Bug #1098. +
  • +
  • + Ruby folder can fold multiline comments. + Bug #1697. +
  • +
  • + SQL lexer fixes a bug with the q-quote operator. +
  • +
  • + TCL lexer fixes a bug with some strings. + Bug #1642. +
  • +
  • + Verilog lexer handles escaped identifiers that begin with \ and end with space like \reset* . + Verilog folder fixes one bug with inconsistent folding when fold.comment is on and another + with typedef class statements creating a fold point, expecting an endclass statement. +
  • +
  • + VHDL folder fixes hang in folding when document starts with "entity". +
  • +
  • + Add new indicators INDIC_COMPOSITIONTHIN, INDIC_FULLBOX, and INDIC_TEXTFORE. + INDIC_COMPOSITIONTHIN is a thin underline that mimics the appearance of non-target segments in OS X IME. + INDIC_FULLBOX is similar to INDIC_STRAIGHTBOX but covers the entire character area which means that + indicators with this style on contiguous lines may touch. INDIC_TEXTFORE changes the text foreground colour. +
  • +
  • + Fix adaptive scrolling speed for GTK+ on OS X with GTK Quartz backend (as opposed to X11 backend). + Bug #1696. +
  • +
  • + Fix position of autocompletion and calltips on Cocoa when there were two screens stacked vertically. +
  • +
  • + Fix crash in SciTE when saving large files in background when closing application. + Bug #1691. +
  • +
  • + Fix decoding of MSVC warnings in SciTE so that files in the C:\Program Files (x86)\ directory can be opened. + This is a common location of system include files. +
  • +
  • + Fix compilation failure of C++11 <regex> on Windows using gcc. +
  • +
+

+ Release 3.5.3 +

+
    +
  • + Released 20 January 2015. +
  • +
  • + Support removed for Windows 95, 98, and ME. +
  • +
  • + Lexers added for Motorola S-Record files, Intel hex files, and Tektronix extended hex files with folding for Intel hex files. + Feature #1091. + Feature #1093. + Feature #1095. + Feature #1096. +
  • +
  • + C++ folder allows folding on square brackets '['. + Feature #1087. +
  • +
  • + Shell lexer fixes three issues with here-documents. + Bug #1672. +
  • +
  • + Verilog lexer highlights doc comment keywords; has separate styles for input, output, and inout ports + (lexer.verilog.portstyling); fixes a bug in highlighting numbers; can treat upper-case identifiers as + keywords (lexer.verilog.allupperkeywords); and can use different styles for code that is inactive due + to preprocessor commands (lexer.verilog.track.preprocessor, lexer.verilog.update.preprocessor). +
  • +
  • + When the calltip window is taller than the Scintilla window, leave it in a + position that avoids overlapping the Scintilla text. +
  • +
  • + When a text margin is displayed, for annotation lines, use the background colour of the base line. +
  • +
  • + On Windows GDI, assume font names are encoded in UTF-8. This matches the Direct2D code path. +
  • +
  • + Fix paste for GTK+ on OS X. + Bug #1677. +
  • +
  • + Reverted a fix on Qt where Qt 5.3 has returned to the behaviour of 4.x. + Bug #1575. +
  • +
  • + When the mouse is on the line between margin and text changed to treat as within text. + This makes the PLAT_CURSES character cell platform work better. +
  • +
  • + Fix a crash in SciTE when the command line is just "-close:". + Bug #1675. +
  • +
  • + Fix unexpected dialog in SciTE on Windows when the command line has a quoted filename then ends with a space. + Bug #1673. +
  • +
  • + On Windows and GTK+, use indicators for inline IME. +
  • +
  • + SciTE shuts down quicker when there is no user-written OnClose function and no directors are attached. +
  • +
+

+ Release 3.5.2 +

+
    +
  • + Released 2 December 2014. +
  • +
  • + For OS X Cocoa switch C++ runtime to libc++ to enable use of features that will never + be added to libstdc++ including those part of C++11. + Scintilla will now run only on OS X 10.7 or later and only in 64-bit mode. +
  • +
  • + Include support for using C++11 <regex> for regular expression searches. + Enabling this requires rebuilding Scintilla with a non-default option. + This is a provisional feature and may change API before being made permanent. +
  • +
  • + Allocate indicators used for Input Method Editors after 31 which was the previous limit of indicators to + ensure no clash between the use of indicators for IME and for the application. +
  • +
  • + ANNOTATION_INDENTED added which is similar to ANNOTATION_BOXED in terms of positioning + but does not show a border. + Feature #1086. +
  • +
  • + Allow platform overrides for drawing tab arrows, wrap markers, and line markers. + Size of double click detection area is a variable. + These enable better visuals and behaviour for PLAT_CURSES as it is character cell based. +
  • +
  • + CoffeeScript lexer fixes "/*" to not be a comment. + Bug #1420. +
  • +
  • + VHDL folder fixes "block" keyword. + Bug #1664. +
  • +
  • + Prevent caret blinking when holding down Delete key. + Bug #1657. +
  • +
  • + On Windows, allow right click selection in popup menu. + Feature #1080. +
  • +
  • + On Windows, only call ShowCaret in GDI mode as it interferes with caret drawing when using Direct2D. + Bug #1643. +
  • +
  • + On Windows, another DirectWrite mode SC_TECHNOLOGY_DIRECTWRITEDC added + which may avoid drawing failures in some circumstances by drawing into a GDI DC. + This feature is provisional and may be changed or removed if a better solution is found. +
  • +
  • + On Windows, avoid processing mouse move events where the mouse has not moved as these can + cause unexpected dwell start notifications. + Bug #1670. +
  • +
  • + For GTK+ on Windows, avoid extra space when pasting from external application. +
  • +
  • + On GTK+ 2.x allow Scintilla to be used inside tool tips by changing when preedit window created. + Bug #1662. +
  • +
  • + Support MinGW compilation under Linux. + Feature #1077. +
  • +
+

+ Release 3.5.1 +

+
    +
  • + Released 30 September 2014. +
  • +
  • + BibTeX lexer added. + Feature #1071. +
  • +
  • + SQL lexer supports the q-quote operator as SCE_SQL_QOPERATOR(24). +
  • +
  • + VHDL lexer supports block comments. + Bug #1527. +
  • +
  • + VHDL folder fixes case where "component" used before name. + Bug #613. +
  • +
  • + Restore fractional pixel tab positioning which was truncated to whole pixels in 3.5.0. + Bug #1652. +
  • +
  • + Allow choice between windowed and inline IME on some platforms. +
  • +
  • + On GTK+ cache autocomplete window to avoid platform bug where windows + were sometimes lost. + Bug #1649. +
  • +
  • + On GTK+ size autocomplete window more accurately. +
  • +
  • + On Windows only unregister windows classes registered. + Bug #1639. +
  • +
  • + On Windows another DirectWrite mode SC_TECHNOLOGY_DIRECTWRITERETAIN added + which may avoid drawing failures on some cards and drivers. + This feature is provisional and may be changed or removed if a better solution is found. +
  • +
  • + On Windows support the Visual Studio 2010+ clipboard format that indicates a line copy. + Bug #1636. +
  • +
  • + SciTE session files remember the scroll position. +
  • +
+

+ Release 3.5.0 +

+
    +
  • + Released 13 August 2014. +
  • +
  • + Text may share space vertically so that extreme ascenders and descenders are + not cut off by calling SCI_SETPHASESDRAW(SC_PHASES_MULTIPLE). +
  • +
  • + Separate timers are used for each type of periodic activity and they are turned on and off + as required. This saves power as there are fewer wake ups. + On recent releases of OS X Cocoa and Windows, coalescing timers are used to further + save power. + Bug #1086. + Bug #1532. +
  • +
  • + Explicit tab stops may be set for each line. +
  • +
  • + On Windows and GTK+, when using Korean input methods, IME composition is moved from a + separate window into the Scintilla window. +
  • +
  • + SciTE adds a "Clean" command to the "Tools" menu which is meant to be bound to a command like + "make clean". +
  • +
  • + Lexer added for Windows registry files. +
  • +
  • + HTML lexer fixes a crash with SGML after a Mako comment. + Bug #1622. +
  • +
  • + KiXtart lexer adds a block comment state. + Feature #1053. +
  • +
  • + Matlab lexer fixes transpose operations like "X{1}'". + Bug #1629. +
  • +
  • + Ruby lexer fixes bugs with the syntax of symbols including allowing a symbol to end with '?'. + Bug #1627. +
  • +
  • + Rust lexer supports byte string literals, naked CR can be escaped in strings, and files starting with + "#![" are not treated as starting with a hashbang comment. + Feature #1063. +
  • +
  • + Bug fixed where style data was stale when deleting a rectangular selection. +
  • +
  • + Bug fixed where annotations disappeared when SCI_CLEARDOCUMENTSTYLE called. +
  • +
  • + Bug fixed where selection not redrawn after SCI_DELWORDRIGHT. + Bug #1633. +
  • +
  • + Change the function prototypes to be complete for functions exported as "C". + Bug #1618. +
  • +
  • + Fix a memory leak on GTK+ with autocompletion lists. + Bug #1638. +
  • +
  • + On GTK+, use the full character width for the overstrike caret for multibyte characters. +
  • +
  • + On Qt, set list icon size to largest icon. Add padding on OS X. + Bug #1634. +
  • +
  • + On Qt, fix building on FreeBSD 9.2. + Bug #1635. +
  • +
  • + On Qt, add a get_character method on the document. + Feature #1064. +
  • +
  • + On Qt, add SCI_* for methods to ScintillaConstants.py. + Feature #1065. +
  • +
  • + SciTE on GTK+ crash fixed with Insert Abbreviation command. +
  • +
  • + For SciTE with read-only files and are.you.sure=0 reenable choice to save to another + location when using Save or Close commands. +
  • +
  • + Fix SciTE bug where toggle bookmark did not work after multiple lines with bookmarks merged. + Bug #1617. +
  • +
+

+ Release 3.4.4 +

+
    +
  • + Released 3 July 2014. +
  • +
  • + Style byte indicators removed. They were deprecated in 2007. Standard indicators should be used instead. + Some elements used by lexers no longer take number of bits or mask arguments so lexers may need to be + updated for LexAccessor::StartAt, LexAccessor::SetFlags (removed), LexerModule::LexerModule. +
  • +
  • + When multiple selections are active, autocompletion text may be inserted at each selection with new + SCI_AUTOCSETMULTI method. +
  • +
  • + C++ lexer fixes crash for "#define x(". + Bug #1614. +
  • +
  • + C++ lexer fixes raw string recognition so that R"xxx(blah)xxx" is styled as SCE_C_STRINGRAW. +
  • +
  • + The Postscript lexer no longer marks token edges with indicators as this used style byte indicators. +
  • +
  • + The Scriptol lexer no longer displays indicators for poor indentation as this used style byte indicators. +
  • +
  • + TCL lexer fixes names of keyword sets. + Bug #1615. +
  • +
  • + Shell lexer fixes fold matching problem caused by "<<<". + Bug #1605. +
  • +
  • + Fix bug where indicators were not removed when fold highlighting on. + Bug #1604. +
  • +
  • + Fix bug on Cocoa where emoji were treated as being zero width. +
  • +
  • + Fix crash on GTK+ with Ubuntu 12.04 and overlay scroll bars. +
  • +
  • + Avoid creating a Cairo context when measuring text on GTK+ as future versions of GTK+ + may prohibit calling gdk_cairo_create except inside drawing handlers. This prohibition may + be required on Wayland. +
  • +
  • + On Cocoa, the registerNotifyCallback method is now marked as deprecated so client code that + uses it will display an error message. + Client code should use the delegate mechanism or subclassing instead. + The method will be removed in the next version. +
  • +
  • + On Cocoa, package Scintilla more in compliance with platform conventions. + Only publish public headers in the framework headers directory. + Only define the Scintilla namespace in Scintilla.h when compiling as C++. + Use the Cocoa NS_ENUM and NS_OPTIONS macros for exposed enumerations. + Hide internal methods from public headers. + These changes are aimed towards publishing Scintilla as a module which will allow it to + be used from the Swift programming language, although more changes will be needed here. +
  • +
  • + Fix crash in SciTE when stream comment performed at line end. + Bug #1610. +
  • +
  • + For SciTE on Windows, display error message when common dialogs fail. + Bug #156. +
  • +
  • + For SciTE on GTK+ fix bug with initialisation of toggle buttons in find and replace strips. + Bug #1612. +
  • +
+

+ Release 3.4.3 +

+
    +
  • + Released 27 May 2014. +
  • +
  • + Fix hangs and crashes in DLL at shutdown on Windows when using Direct2D. +
  • +
+

+ Release 3.4.2 +

+
    +
  • + Released 22 May 2014. +
  • +
  • + Insertions can be filtered or modified by calling SCI_CHANGEINSERTION inside a handler for + SC_MOD_INSERTCHECK. +
  • +
  • + DMIS lexer added. DMIS is a language for coordinate measuring machines. + Feature #1049. +
  • +
  • + Line state may be displayed in the line number margin to aid in debugging lexing and folding with + SC_FOLDFLAG_LINESTATE (128). +
  • +
  • + C++ lexer understands more preprocessor statements. #if defined SYMBOL is understood. + Some macros with arguments can be understood and these may be predefined in keyword set 4 + (keywords5 for SciTE) + with syntax similar to CHECKVERSION(x)=(x<3). + Feature #1051. +
  • +
  • + C++ lexer can highlight task marker keywords in comments as SCE_C_TASKMARKER. +
  • +
  • + C++ lexer can optionally highlight escape sequences in strings as SCE_C_ESCAPESEQUENCE. +
  • +
  • + C++ lexer supports Go back quoted raw string literals with lexer.cpp.backquoted.strings option. + Feature #1047. +
  • +
  • + SciTE performs word and search match highlighting as an idle task to improve interactivity + and allow use of these features on large files. +
  • +
  • + Bug fixed on Cocoa where previous caret lines were visible. + Bug #1593. +
  • +
  • + Bug fixed where caret remained invisible when period set to 0. + Bug #1592. +
  • +
  • + Fixed display flashing when scrolling with GTK+ 3.10. + Bug #1567. +
  • +
  • + Fixed calls and constants deprecated in GTK+ 3.10. +
  • +
  • + Fixed bug on Windows where WM_GETTEXT did not provide data in UTF-16 for Unicode window. + Bug #685. +
  • +
  • + For SciTE, protect access to variables used by threads with a mutex to prevent data races. +
  • +
  • + For SciTE on GTK+ fix thread object leaks. + Display the version of GTK+ compiled against in the about box. +
  • +
  • + For SciTE on GTK+ 3.10, fix the size of the tab bar's content and use + freedesktop.org standard icon names where possible. +
  • +
  • + For SciTE on Windows, fix bug where invoking help resubmitted the + running program. + Bug #272. +
  • +
  • + SciTE's highlight current word feature no longer matches the selection when it contains space. +
  • +
  • + For building SciTE in Visual C++, the win\SciTE.vcxproj project file should be used. + The boundscheck directory and its project and solution files have been removed. +
  • +
+

+ Release 3.4.1 +

+
    +
  • + Released 1 April 2014. +
  • +
  • + Display Unicode line ends as [LS], [PS], and [NEL] blobs. +
  • +
  • + Bug fixed where cursor down failed on wrapped lines. + Bug #1585. +
  • +
  • + Caret positioning changed a little to appear inside characters less often by + rounding the caret position to the pixel grid instead of truncating. + Bug #1588. +
  • +
  • + Bug fixed where automatic indentation wrong when caret in virtual space. + Bug #1586. +
  • +
  • + Bug fixed on Windows where WM_LBUTTONDBLCLK was no longer sent to window. + Bug #1587. +
  • +
  • + Bug fixed with SciTE on Windows XP where black stripes appeared inside the find and + replace strips. +
  • +
  • + Crash fixed in SciTE with recursive properties files. + Bug #1507. +
  • +
  • + Bug fixed with SciTE where Ctrl+E before an unmatched end brace jumps to file start. + Bug #315. +
  • +
  • + Fixed scrolling on Cocoa to avoid display glitches and be smoother. +
  • +
  • + Fixed crash on Cocoa when character composition used when autocompletion list active. +
  • +
+

+ Release 3.4.0 +

+
    +
  • + Released 22 March 2014. +
  • +
  • + The Unicode line ends and substyles features added as provisional in 3.2.5 are now finalised. + There are now no provisional features. +
  • +
  • + Added wrap mode SC_WRAP_WHITESPACE which only wraps on whitespace, not on style changes. +
  • +
  • + SciTE find and replace strips can perform incremental searching and temporary highlighting of all + matches with the find.strip.incremental, replace.strip.incremental, and find.indicator.incremental settings. +
  • +
  • + SciTE default settings changed to use strips for find and replace and to draw with Direct2D and + DirectWrite on Windows. +
  • +
  • + SciTE on Windows scales image buttons on the find and replace strips to match the current system scale factor. +
  • +
  • + Additional assembler lexer variant As(SCLEX_AS) for Unix assembly code which uses '#' for comments and + ';' to separate statements. +
  • +
  • + Fix Coffeescript lexer for keyword style extending past end of word. + Also fixes styling 0...myArray.length all as a number. + Bug #1583. +
  • +
  • + Fix crashes and other bugs in Fortran folder by removing folding of do-label constructs. +
  • +
  • + Deleting a whole line deletes the annotations on that line instead of the annotations on the next line. + Bug #1577. +
  • +
  • + Changed position of tall calltips to prefer lower half of screen to cut off end instead of start. +
  • +
  • + Fix Qt bug where double click treated as triple click. + Bug #1575. +
  • +
  • + On Qt, selecting an item in an autocompletion list that is not currently visible positions it at the top. +
  • +
  • + Fix bug on Windows when resizing autocompletion list with only short strings caused the list to move. +
  • +
  • + On Cocoa reduce scrollable height by one line to fix bugs with moving caret + up or down. +
  • +
  • + On Cocoa fix calltips which did not appear when they were created in an off-screen position. +
  • +
+

+ Release 3.3.9 +

+
    +
  • + Released 31 January 2014. +
  • +
  • + Fix 3.3.8 bug where external lexers became inaccessible. + Bug #1574. +
  • +
+

+ Release 3.3.8 +

+
    +
  • + Released 28 January 2014. +
  • +
  • + DropSelectionN API added to drop a selection from a multiple selection. +
  • +
  • + CallTipSetPosStart API added to change the position at which backspacing removes the calltip. +
  • +
  • + SC_MARK_BOOKMARK marker symbol added which looks like bookmark ribbons used in + book reading applications. +
  • +
  • + Basic lexer highlights hex, octal, and binary numbers in FreeBASIC which use the prefixes + &h, &o and &b respectively. + Feature #1041. +
  • +
  • + C++ lexer fixes bug where keyword followed immediately by quoted string continued + keyword style. + Bug #1564. +
  • +
  • + Matlab lexer treats '!' differently for Matlab and Octave languages. + Bug #1571. +
  • +
  • + Rust lexer improved with nested comments, more compliant doc-comment detection, + octal literals, NUL characters treated as valid, and highlighting of raw string literals and float literals fixed. + Feature #1038. + Bug #1570. +
  • +
  • + On Qt expose the EOLMode on the document object. +
  • +
  • + Fix hotspot clicking where area was off by half a character width. + Bug #1562. +
  • +
  • + Tweaked scroll positioning by either 2 pixels or 1 pixel when caret is at left or right of view + to ensure caret is inside visible area. +
  • +
  • + Send SCN_UPDATEUI with SC_UPDATE_SELECTION for Shift+Tab inside text. +
  • +
  • + On Windows update the system caret position when scrolling to help screen readers + see the scroll quickly. +
  • +
  • + On Cocoa, GTK+, and Windows/Direct2D draw circles more accurately so that + circular folding margin markers appear circular, of consistent size, and centred. + Make SC_MARK_ARROWS drawing more even. + Fix corners of SC_MARK_ROUNDRECT with Direct2D to be similar to other platforms. +
  • +
  • + SciTE uses a bookmark ribbon symbol for bookmarks as it scales better to higher resolutions + than the previous blue gem bitmap. +
  • +
  • + SciTE will change the width of margins while running when the margin.width and fold.margin.width + properties are changed. +
  • +
  • + SciTE on Windows can display a larger tool bar with the toolbar.large property. +
  • +
  • + SciTE displays a warning message when asked to open a directory. + Bug #1568. +
  • +
+

+ Release 3.3.7 +

+
    +
  • + Released 12 December 2013. +
  • +
  • + Lexer added for DMAP language. + Feature #1026. +
  • +
  • + Basic lexer supports multiline comments in FreeBASIC. + Feature #1023. +
  • +
  • + Bash lexer allows '#' inside words.. + Bug #1553. +
  • +
  • + C++ lexer recognizes C++11 user-defined literals and applies lexical class SCE_C_USERLITERAL. +
  • +
  • + C++ lexer allows single quote characters as digit separators in numeric literals like 123'456 as this is + included in C++14. +
  • +
  • + C++ lexer fixes bug with #include statements without " or > terminating filename. + Bug #1538. +
  • +
  • + C++ lexer fixes split of Doxygen keywords @code{.fileExtension} and @param[in,out]. + Bug #1551. +
  • +
  • + C++ lexer styles Doxygen keywords at end of document. +
  • +
  • + Cmake lexer fixes bug with empty comments. + Bug #1550. +
  • +
  • + Fortran folder improved. Treats "else" as fold header. + Feature #962. +
  • +
  • + Fix bug with adjacent instances of the same indicator with different values where only the first was drawn. + Bug #1560. +
  • +
  • + For DirectWrite, use the GDI ClearType gamma value for SC_EFF_QUALITY_LCD_OPTIMIZED as + this results in text that is similar in colour intensity to GDI. + For the duller default DirectWrite ClearType text appearance, use SC_EFF_QUALITY_DEFAULT. + Feature #887. +
  • +
  • + Fix another problem with drawing on Windows with Direct2D when returning from lock screen. + The whole window is redrawn as just redrawing the initially required area left other areas black. +
  • +
  • + When scroll width is tracked, take width of annotation lines into account. +
  • +
  • + For Cocoa on OS X 10.9, responsive scrolling is supported. +
  • +
  • + On Cocoa, apply font quality setting to line numbers. + Bug #1544. +
  • +
  • + On Cocoa, clicking in margin now sets focus. + Bug #1542. +
  • +
  • + On Cocoa, correct cursor displayed in margin after showing dialog. +
  • +
  • + On Cocoa, multipaste mode now works. + Bug #1541. +
  • +
  • + On GTK+, chain up to superclass finalize so that all finalization is performed. + Bug #1549. +
  • +
  • + On GTK+, fix horizontal scroll bar range to not be double the needed width. + Bug #1546. +
  • +
  • + On OS X GTK+, report control key as SCI_META for mouse down events. +
  • +
  • + On Qt, bug fixed with drawing of scrollbars, where previous contents were not drawn over with some + themes. +
  • +
  • + On Qt, bug fixed with finding monitor rectangle which could lead to autocomplete showing at wrong location. +
  • +
  • + SciTE fix for multiple message boxes when failing to save a file with save.on.deactivate. + Bug #1540. +
  • +
  • + SciTE on GTK+ fixes SIGCHLD handling so that Lua scripts can determine the exit status of processes + they start. + Bug #1557. +
  • +
  • + SciTE on Windows XP fixes bad display of find and replace values when using strips. +
  • +
+

+ Release 3.3.6 +

+
    +
  • + Released 15 October 2013. +
  • +
  • + Added functions to help convert between substyles and base styles and between secondary and primary styles. + SCI_GETSTYLEFROMSUBSTYLE finds the base style of substyles. + Can be used to treat all substyles of a style equivalent to that style. + SCI_GETPRIMARYSTYLEFROMSTYLE finds the primary style of secondary styles. + StyleFromSubStyle and PrimaryStyleFromStyle methods were added to ILexerWithSubStyles so each lexer can implement these. +
  • +
  • + Lexer added for Rust language. + Feature #1024. +
  • +
  • + Avoid false matches in errorlist lexer which is used for the SciTE output pane + by stricter checking of ctags lines. +
  • +
  • + Perl lexer fixes bugs with multi-byte characters, including in HEREDOCs and PODs. + Bug #1528. +
  • +
  • + SQL folder folds 'create view' statements. + Feature #1020. +
  • +
  • + Visual Prolog lexer updated with better support for string literals and Unicode. + Feature #1025. +
  • +
  • + For SCI_SETIDENTIFIERS, \t, \r, and \n are allowed as well as space between identifiers. + Bug #1521. +
  • +
  • + Gaining and losing focus is now reported as a notification with the code set to SCN_FOCUSIN + or SCN_FOCUSOUT. + This allows clients to uniformly use notifications instead of commands. + Since there is no longer a need for commands they will be deprecated in a future version. + Clients should switch any code that currently uses SCEN_SETFOCUS or SCEN_KILLFOCUS. +
  • +
  • + On Cocoa, clients should use the delegate mechanism or subclass ScintillaView in preference + to registerNotifyCallback: which will be deprecated in the future. +
  • +
  • + On Cocoa, the ScintillaView.h header hides internal implementation details from Platform.h and ScintillaCocoa.h. + InnerView was renamed to SCIContentView and MarginView was renamed to SCIMarginView. + dealloc removed from @interface. +
  • +
  • + On Cocoa, clients may customize SCIContentView by subclassing both SCIContentView and ScintillaView + and implementing the contentViewClass class method on the ScintillaView subclass to return the class of + the SCIContentView subclass. +
  • +
  • + On Cocoa, fixed appearance of alpha rectangles to use specified alpha and colour for outline as well as corner size. + This makes INDIC_STRAIGHTBOX and INDIC_ROUNDBOX look correct. +
  • +
  • + On Cocoa, memory leak fixed for MarginView. +
  • +
  • + On Cocoa, make drag and drop work when destination view is empty. + Bug #1534. +
  • +
  • + On Cocoa, drag image fixed when view scrolled. +
  • +
  • + On Cocoa, SCI_POSITIONFROMPOINTCLOSE fixed when view scrolled. + Feature #1021. +
  • +
  • + On Cocoa, don't send selection change notification when scrolling. + Bug #1522. +
  • +
  • + On Qt, turn off idle events on destruction to prevent repeatedly calling idle. +
  • +
  • + Qt bindings in ScintillaEdit changed to use signed first parameter. +
  • +
  • + Compilation errors fixed on Windows and GTK+ with SCI_NAMESPACE. +
  • +
  • + On Windows, building with gcc will check if Direct2D headers are available and enable Direct2D if they are. +
  • +
  • + Avoid attempts to redraw empty areas when lexing beyond the currently visible lines. +
  • +
  • + Control more attributes of indicators in SciTE with find.mark.indicator and highlight.current.word.indicator + properties. +
  • +
  • + Fix SciTE bug with buffers becoming read-only. + Bug #1525. +
  • +
  • + Fix linking SciTE on non-Linux Unix systems with GNU toolchain by linking to libdl. + Bug #1523. +
  • +
  • + On Windows, SciTE's Incremental Search displays match failures by changing the background colour + instead of not adding the character that caused failure. +
  • +
  • + Fix SciTE on GTK+ 3.x incremental search to change foreground colour when no match as + changing background colour is difficult. +
  • +
+

+ Release 3.3.5 +

+
    +
  • + Released 31 August 2013. +
  • +
  • + Characters may be represented by strings. + In Unicode mode C1 control characters are represented by their mnemonics. +
  • +
  • + Added SCI_POSITIONRELATIVE to optimize navigation by character. +
  • +
  • + Option to allow mouse selection to switch to rectangular by pressing Alt after start of gesture. + Feature #1007. +
  • +
  • + Lexer added for KVIrc script. + Feature #1008. +
  • +
  • + Bash lexer fixed quoted HereDoc delimiters. + Bug #1500. +
  • +
  • + MS SQL lexer fixed ';' to appear as an operator. + Bug #1509. +
  • +
  • + Structured Text lexer fixed styling of enumeration members. + Bug #1508. +
  • +
  • + Fixed bug with horizontal caret position when margin changed. + Bug #1512. +
  • +
  • + Fixed bug on Cocoa where coordinates were relative to text subview instead of whole view. +
  • +
  • + Ensure selection redrawn correctly in two cases. + When switching from stream to rectangular selection with Alt+Shift+Up. + When reducing the range of an additional selection by moving mouse up. + Feature #1007. +
  • +
  • + Copy and paste of rectangular selections compatible with Borland Delphi IDE on Windows. + Feature #1002. + Bug #1513. +
  • +
  • + Initialize extended styles to the default style. +
  • +
  • + On Windows, fix painting on an explicit HDC when first paint attempt abandoned. +
  • +
  • + Qt bindings in ScintillaEdit made to work on 64-bit Unix systems. +
  • +
  • + Easier access to printing on Qt with formatRange method. +
  • +
  • + Fixed SciTE failure to save initial buffer in single buffer mode. + Bug #1339. +
  • +
  • + Fixed compilation problem with Visual C++ in non-English locales. + Bug #1506. +
  • +
  • + Disable Direct2D when compiling with MinGW gcc on Windows because of changes in the recent MinGW release. +
  • +
  • + SciTE crash fixed for negative line.margin.width. + Bug #1504. +
  • +
  • + SciTE fix for infinite dialog boxes when failing to automatically save a file. + Bug #1503. +
  • +
  • + SciTE settings buffered.draw, two.phase.draw, and technology are applied to the + output pane as well as the edit pane. +
  • +

Release 3.3.4

@@ -475,7 +1717,7 @@
  • CoffeeScript lexer fixes a bug with comment blocks. - Feature #1495. + Bug #1495
  • ECL lexer regular expression code fixed. @@ -980,7 +2222,7 @@ On Cocoa, remove incorrect setting of save point when reading information through 'string' and 'selectedString'.
  • - On Cocoa, fix incorrect memory managment of infoBar. + On Cocoa, fix incorrect memory management of infoBar.
  • On GTK+ 3 Ubuntu, fix crash when drawing margin. @@ -1263,7 +2505,7 @@ UTF-8 validity is checked more stringently and consistently. All 66 non-characters are now treated as invalid.
  • - HTML lexer bug fixed with inconsistant highlighting for PHP when attribute on separate line from tag. + HTML lexer bug fixed with inconsistent highlighting for PHP when attribute on separate line from tag. Bug #3520027.
  • @@ -3523,7 +4765,7 @@ SciTE retains selection range when performing a replace selection command. Feature #2339160.
  • - SciTE definition of word characters fixed to match documentaiton. Bug #2464531. + SciTE definition of word characters fixed to match documentation. Bug #2464531.
  • SciTE on GTK+ performing Search or Replace when dialog already shown now brings dialog to foreground. @@ -7276,7 +8518,7 @@
  • Experimental line wrapping. - Currently has performance and appearence problems. + Currently has performance and appearance problems.
  • @@ -9260,4 +10502,3 @@

    - diff --git a/scintilla/doc/index.html b/scintilla/doc/index.html index 357fc489..45a1e3c8 100644 --- a/scintilla/doc/index.html +++ b/scintilla/doc/index.html @@ -9,7 +9,7 @@ - +