Complete merge with GUI main branch revision 38613

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38772 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2015-07-08 22:21:16 +00:00
parent 05b324b8fd
commit de5f907dca
46 changed files with 2687 additions and 1534 deletions

View file

@ -77,5 +77,6 @@ endif
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/aggregate.make
include $(GNUSTEP_MAKEFILES)/Master/deb.make
include GNUmakefile.postamble

View file

@ -256,6 +256,12 @@ typedef NSUInteger NSControlSize;
+ (NSColor*) windowBackgroundColor;
+ (NSColor*) windowFrameColor;
+ (NSColor*) windowFrameTextColor;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
+ (NSColor*) labelColor;
+ (NSColor*) secondaryLabelColor;
+ (NSColor*) tertiaryLabelColor;
+ (NSColor*) quaternaryLabelColor;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
+ (NSArray*) controlAlternatingRowBackgroundColors;

View file

@ -117,10 +117,13 @@
#endif
@end
// Declare the protocol (with no mandatory methods) to support cross compiling
@protocol NSComboBoxCellDataSource;
@protocol NSComboBoxCellDataSource <NSObject>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) && GS_PROTOCOLS_HAVE_OPTIONAL
@optional
#else
@end
@interface NSObject (NSComboBoxCellDataSource)
#endif
- (NSInteger)numberOfItemsInComboBoxCell:(NSComboBoxCell *)comboBoxCell;
- (id)comboBoxCell:(NSComboBoxCell *)aComboBoxCell
objectValueForItemAtIndex:(NSInteger)index;

View file

@ -201,7 +201,7 @@ APPKIT_EXPORT NSString *NSControlTextDidChangeNotification;
// Methods Implemented by the Delegate
//
@protocol NSControlTextEditingDelegate <NSObject>
#ifdef __OBJC2__
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) && GS_PROTOCOLS_HAVE_OPTIONAL
@optional
#else
@end

View file

@ -51,6 +51,11 @@
void *_cid;
}
// Method needed on Windows to handle the cursor.
#ifdef WIN32
+ (NSUInteger) count;
#endif
/*
* Initializing a New NSCursor Object
*/

View file

@ -684,6 +684,7 @@
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
- (NSSize) size;
- (void) removeAllItems;
#endif
- (void) sizeToFit;

View file

@ -33,6 +33,7 @@
#import <AppKit/NSNibDeclarations.h>
#import <AppKit/NSResponder.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
/* Keys */
APPKIT_EXPORT NSString *NSPopoverCloseReasonKey;
APPKIT_EXPORT NSString *NSPopoverCloseReasonStandard;
@ -104,7 +105,7 @@ typedef NSInteger NSPopoverBehavior;
/* Delegate */
@protocol NSPopoverDelegate
#ifdef __OBJC2__
#if GS_PROTOCOLS_HAVE_OPTIONAL
@optional
#else
@end
@ -119,3 +120,4 @@ typedef NSInteger NSPopoverBehavior;
@end
#endif
#endif

View file

@ -34,6 +34,7 @@
#ifndef _GNUstep_H_NSSavePanel
#define _GNUstep_H_NSSavePanel
#import <GNUstepBase/GSVersionMacros.h>
#import <GNUstepBase/GSBlocks.h>
#import <AppKit/NSPanel.h>
@ -58,7 +59,7 @@ enum {
};
@protocol NSOpenSavePanelDelegate <NSObject>
#ifdef __OBJC2__
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) && GS_PROTOCOLS_HAVE_OPTIONAL
@optional
#else
@end
@ -81,6 +82,7 @@ enum {
- (BOOL)panel:(id)sender shouldShowFilename:(NSString*)filename;
@end
DEFINE_BLOCK_TYPE(GSSavePanelCompletionHandler, void, NSInteger);
@interface NSSavePanel : NSPanel
{
@ -117,6 +119,7 @@ enum {
BOOL _OKButtonPressed;
NSMenu *_showsHiddenFilesMenu;
GSSavePanelCompletionHandler _completionHandler;
}
/*
@ -206,6 +209,12 @@ enum {
contextInfo: (void *)contextInfo;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
- (void) beginSheetModalForWindow:(NSWindow *)window
completionHandler:(GSSavePanelCompletionHandler)handler;
- (void) beginWithCompletionHandler:(GSSavePanelCompletionHandler)handler;
#endif
/*
* Reading Save Information
*/

View file

@ -72,10 +72,10 @@ enum {
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
- (void)drawWithFrame:(NSRect)cellFrame
inView:(NSView *)controlView
characterIndex:(unsigned)charIndex;
characterIndex:(NSUInteger)charIndex;
- (void)drawWithFrame:(NSRect)cellFrame
inView:(NSView *)controlView
characterIndex:(unsigned)charIndex
characterIndex:(NSUInteger)charIndex
layoutManager:(NSLayoutManager *)layoutManager;
- (void)highlight:(BOOL)flag
withFrame:(NSRect)cellFrame
@ -117,14 +117,14 @@ The class uses -cellSize and -cellBaselineOffset to return a rect.
-(NSRect) cellFrameForTextContainer: (NSTextContainer *)textContainer
proposedLineFragment: (NSRect)lineFrag
glyphPosition: (NSPoint)position
characterIndex: (unsigned int)charIndex;
characterIndex: (NSUInteger)charIndex;
- (BOOL)wantsToTrackMouse;
- (BOOL)wantsToTrackMouseForEvent:(NSEvent *)theEvent
inRect:(NSRect)cellFrame
ofView:(NSView *)controlView
atCharacterIndex:(unsigned)charIndex;
atCharacterIndex:(NSUInteger)charIndex;
- (BOOL)trackMouse:(NSEvent *)theEvent
inRect:(NSRect)cellFrame
ofView:(NSView *)controlView
@ -132,7 +132,7 @@ The class uses -cellSize and -cellBaselineOffset to return a rect.
- (BOOL)trackMouse:(NSEvent *)theEvent
inRect:(NSRect)cellFrame
ofView:(NSView *)controlView
atCharacterIndex:(unsigned)charIndex
atCharacterIndex:(NSUInteger)charIndex
untilMouseUp:(BOOL)flag;
- (void)setAttachment:(NSTextAttachment *)anObject;
- (NSTextAttachment *)attachment;
@ -153,6 +153,11 @@ The class uses -cellSize and -cellBaselineOffset to return a rect.
@interface NSTextAttachment : NSObject <NSCoding> {
NSFileWrapper *_fileWrapper;
id <NSTextAttachmentCell>_cell;
struct GSTextAttachmentFlagsType {
// total 32 bits. 31 bits left.
unsigned cell_explicitly_set: 1;
unsigned unused:31;
} _taflags;
}
/*

View file

@ -656,7 +656,7 @@ layout manager. */
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
@protocol NSTextViewDelegate <NSObject>
#ifdef __OBJC2__
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) && GS_PROTOCOLS_HAVE_OPTIONAL
@optional
#else
@end

View file

@ -1,7 +1,7 @@
/*
NSTreeController.h
Main include file for GNUstep GUI Library
The tree controller class.
Copyright (C) 2012 Free Software Foundation, Inc.
@ -27,16 +27,31 @@
Boston, MA 02110-1301, USA.
*/
#import <AppKit/NSController.h>
#ifndef _GNUstep_H_NSTreeController
#define _GNUstep_H_NSTreeController
@interface NSTreeController : NSController <NSCoding, NSCopying>
#import <GNUstepBase/GSVersionMacros.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
#import <AppKit/NSObjectController.h>
@class NSString;
@class NSArray;
@class NSIndexPath;
@class NSTreeNode;
@interface NSTreeController : NSObjectController <NSCoding, NSCopying>
{
NSString *_childrenKeyPath;
NSString *_countKeyPath;
NSString *_leafKeyPath;
NSArray *_sortDescriptors;
BOOL _alwaysUsesMultipleValuesMarker;
BOOL _avoidsEmptySelection;
BOOL _preservesSelection;
BOOL _selectsInsertedObjects;
}
#if 0 // compile this out for now....
- (BOOL) addSelectionIndexPaths:(NSArray *)indexPaths;
- (BOOL) alwaysUsesMultipleValuesMarker;
- (BOOL) avoidsEmptySelection;
@ -50,9 +65,9 @@
- (id) arrangedObjects;
- (id) content;
- (NSArray *) selectedObjects;
- (NSIndexPath*) selectionIndexPath;
- (NSArray *) selectionIndexPaths;
- (NSArray *) sortDescriptors;
- (NSIndexPath *) selectionIndexPath;
- (NSString *) childrenKeyPath;
- (NSString *) countKeyPath;
- (NSString *) leafKeyPath;
@ -61,7 +76,7 @@
- (void) insertChild: (id)sender;
- (void) insertObject: (id)object atArrangedObjectIndexPath:(NSIndexPath *)indexPath;
- (void) insertObjects: (NSArray *)objects atArrangedObjectIndexPaths: (NSArray *)indexPaths;
- (void) insert:sender;
- (void) insert: (id)sender;
- (void) rearrangeObjects;
- (void) removeObjectAtArrangedObjectIndexPath: (NSIndexPath *)indexPath;
- (void) removeObjectsAtArrangedObjectIndexPaths: (NSArray *)indexPaths;
@ -76,8 +91,16 @@
- (void) setPreservesSelection: (BOOL)flag;
- (void) setSelectsInsertedObjects: (BOOL)flag;
- (void) setSortDescriptors: (NSArray *)descriptors;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
- (NSString*) childrenKeyPathForNode: (NSTreeNode*)node;
- (NSString*) countKeyPathForNode: (NSTreeNode*)node;
- (NSString*) leafKeyPathForNode: (NSTreeNode*)node;
- (void) moveNode: (NSTreeNode*)node toIndexPath: (NSIndexPath*)indexPath;
- (void) moveNodes: (NSArray*)nodes toIndexPath: (NSIndexPath*)startingIndexPath;
- (NSArray*) selectedNodes;
#endif
@end
#endif
#endif /* _GNUstep_H_NSTreeController */

View file

@ -824,8 +824,15 @@ PACKAGE_SCOPE
* Implemented by the delegate
*/
#ifdef GNUSTEP
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
@protocol NSWindowDelegate <NSObject>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) && GS_PROTOCOLS_HAVE_OPTIONAL
@optional
#else
@end
@interface NSObject (NSWindowDelegate)
#endif
- (BOOL) windowShouldClose: (id)sender;
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
- (void) windowWillBeginSheet: (NSNotification*)aNotification;
@ -841,9 +848,6 @@ PACKAGE_SCOPE
willPositionSheet: (NSWindow *)sheet
usingRect: (NSRect)rect;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_1, GS_API_LATEST)
- (NSWindow *) attachedSheet;
#endif
- (NSSize) windowWillResize: (NSWindow*)sender
toSize: (NSSize)frameSize;
- (id) windowWillReturnFieldEditor: (NSWindow*)sender
@ -868,6 +872,12 @@ willPositionSheet: (NSWindow *)sheet
@end
#endif
@interface NSObject (NSWindowDelegateAdditions) <NSWindowDelegate>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_1, GS_API_LATEST)
- (NSWindow *) attachedSheet;
#endif
@end
/* Notifications */
APPKIT_EXPORT NSString *NSWindowDidBecomeKeyNotification;
APPKIT_EXPORT NSString *NSWindowDidBecomeMainNotification;

View file

@ -29,7 +29,6 @@
#import "AppKit/NSApplication.h"
#import "AppKit/NSBox.h"
#import "AppKit/NSEvent.h"
#import "AppKit/NSLayoutManager.h"
#import "AppKit/NSScreen.h"
#import "AppKit/NSScrollView.h"
#import "AppKit/NSTableView.h"

View file

@ -55,6 +55,7 @@
#import "AppKit/NSDragging.h"
#import "AppKit/NSSavePanel.h"
#import "AppKit/NSTextField.h"
#import "AppKit/NSWindowController.h"
#import "AppKit/NSWorkspace.h"
#import "GSGuiPrivate.h"
@ -858,8 +859,9 @@ selectCellWithString: (NSString*)title
*/
- (void) setTitle: (NSString*)title
{
// keep the window title in sync with the title field
[super setTitle:title];
[_titleField setStringValue: title];
[super setTitle:title]; // keep the window title in sync with the title field
// TODO: Improve the following by managing
// vertical alignment better.
@ -1108,7 +1110,22 @@ selectCellWithString: (NSString*)title
*/
- (NSInteger) runModal
{
return [self runModalForDirectory: [self directory] file: [self filename]];
return [self runModalForDirectory: [self directory]
file: [[self filename] lastPathComponent]];
}
- (void) beginSheetModalForWindow:(NSWindow *)window
completionHandler:(GSSavePanelCompletionHandler)handler
{
NSInteger result = [NSApp runModalForWindow: self
relativeToWindow: window];
CALL_BLOCK(handler, result);
}
- (void) beginWithCompletionHandler:(GSSavePanelCompletionHandler)handler
{
self->_completionHandler = Block_copy(handler);
[self makeKeyAndOrderFront: self];
}
/**<p> Initializes the panel to the directory specified by path and,
@ -1187,7 +1204,7 @@ selectCellWithString: (NSString*)title
if (_allowedFileTypes == nil ||
[_allowedFileTypes indexOfObject: @""] != NSNotFound)
return _fullFileName;
return AUTORELEASE([_fullFileName copy]);
/* add file type extension if the file name does not have an extension or
the file name's extension is not one of the allowed extensions and the
@ -1202,7 +1219,7 @@ selectCellWithString: (NSString*)title
}
else
{
return _fullFileName;
return AUTORELEASE([_fullFileName copy]);
}
}
@ -1219,7 +1236,16 @@ selectCellWithString: (NSString*)title
{
ASSIGN(_directory, pathToColumn(_browser, [_browser lastColumn]));
[self _updateDefaultDirectory];
[NSApp stopModalWithCode: NSCancelButton];
if (self->_completionHandler == NULL)
[NSApp stopModalWithCode: NSCancelButton];
else
{
CALL_BLOCK(self->_completionHandler, NSCancelButton);
Block_release(self->_completionHandler);
self->_completionHandler = NULL;
}
[_okButton setEnabled: NO];
[self close];
}
@ -1390,7 +1416,16 @@ selectCellWithString: (NSString*)title
return;
[self _updateDefaultDirectory];
[NSApp stopModalWithCode: NSOKButton];
if (self->_completionHandler == NULL)
[NSApp stopModalWithCode: NSOKButton];
else
{
CALL_BLOCK(self->_completionHandler, NSOKButton);
Block_release(self->_completionHandler);
self->_completionHandler = NULL;
}
[_okButton setEnabled: NO];
[self close];
}

View file

@ -132,6 +132,7 @@ static NSMutableArray *screenArray = nil;
NSWindow *keyWindow;
keyWindow = [NSApp keyWindow];
// Testplant-MAL-2015-07-08: keeping testplant branch code...
if ((keyWindow != nil) && ([keyWindow screen] != nil))
{
return [keyWindow screen];

View file

@ -827,6 +827,7 @@ static CGFloat scrollerWidth;
documentFrame = [documentView frame];
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
if (_reflectScrolledClipView_VRecursionCnt == 0)
{
_reflectScrolledClipView_VRecursionCnt++;
@ -868,9 +869,11 @@ static CGFloat scrollerWidth;
knobProportion: knobProportion];
}
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
_reflectScrolledClipView_VRecursionCnt--;
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
if (_reflectScrolledClipView_HRecursionCnt == 0)
{
_reflectScrolledClipView_HRecursionCnt++;
@ -907,6 +910,7 @@ static CGFloat scrollerWidth;
knobProportion: knobProportion];
}
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
_reflectScrolledClipView_HRecursionCnt--;
}
@ -921,6 +925,7 @@ static CGFloat scrollerWidth;
{
headerClipViewOrigin.x = clipViewBounds.origin.x;
[_headerClipView scrollToPoint: headerClipViewOrigin];
// Testplant-MAL-2015-07-08: keeping testplant branch code...
[[_headerClipView documentView] setNeedsDisplayInRect:clipViewBounds];
}
}
@ -1075,6 +1080,12 @@ static CGFloat scrollerWidth;
[self tile];
}
static NSRectEdge
GSOppositeEdge(NSRectEdge edge)
{
return (edge == NSMinXEdge) ? NSMaxXEdge : NSMinXEdge;
}
- (void) tile
{
NSRect headerRect, contentRect;
@ -1086,6 +1097,9 @@ static CGFloat scrollerWidth;
CGFloat innerBorderWidth = [[NSUserDefaults standardUserDefaults]
boolForKey: @"GSScrollViewNoInnerBorder"] ? 0.0 : 1.0;
const BOOL useBottomCorner = [[GSTheme theme] scrollViewUseBottomCorner];
const BOOL overlapBorders = [[GSTheme theme] scrollViewScrollersOverlapBorders];
style = NSInterfaceStyleForKey(@"NSScrollViewInterfaceStyle", nil);
if (style == NSMacintoshInterfaceStyle
@ -1107,7 +1121,11 @@ static CGFloat scrollerWidth;
}
/* Prepare the contentRect by insetting the borders. */
contentRect = NSInsetRect(_bounds, border.width, border.height);
contentRect = _bounds;
if (!overlapBorders)
contentRect = NSInsetRect(contentRect, border.width, border.height);
if (contentRect.size.width < 0 || contentRect.size.height < 0)
{
/* FIXME ... should we do something else when given
@ -1117,6 +1135,32 @@ static CGFloat scrollerWidth;
[self _synchronizeHeaderAndCornerView];
if (overlapBorders)
{
if (_borderType != NSNoBorder)
{
if (!(_hasHeaderView || _hasCornerView))
{
// Inset 1px on the top
NSDivideRect(contentRect, NULL, &contentRect, 1, topEdge);
}
if (!_hasVertScroller)
{
// Inset 1px on the edge where the vertical scroller would be
NSDivideRect(contentRect, NULL, &contentRect, 1, verticalScrollerEdge);
}
if (!_hasHorizScroller)
{
NSDivideRect(contentRect, NULL, &contentRect, 1, bottomEdge);
}
// The vertical edge without a scroller
{
NSDivideRect(contentRect, NULL, &contentRect, 1,
GSOppositeEdge(verticalScrollerEdge));
}
}
}
/* First, allocate vertical space for the headerView / cornerView
(but - NB - the headerView needs to be placed above the clipview
later on, we can't place it now). */
@ -1151,6 +1195,22 @@ static CGFloat scrollerWidth;
NSDivideRect (contentRect, &vertScrollerRect, &contentRect,
scrollerWidth, verticalScrollerEdge);
/* If the theme requests it, leave a square gap in the bottom-
* left (or bottom-right) corner where the horizontal and vertical
* scrollers meet. */
if (_hasHorizScroller && !useBottomCorner)
{
NSDivideRect (vertScrollerRect, NULL, &vertScrollerRect,
scrollerWidth, bottomEdge);
}
/** Vertically expand the scroller by 1pt on each end */
if (overlapBorders)
{
vertScrollerRect.origin.y -= 1;
vertScrollerRect.size.height += 2;
}
[_vertScroller setFrame: vertScrollerRect];
/* Substract 1 for the line that separates the vertical scroller
@ -1167,6 +1227,13 @@ static CGFloat scrollerWidth;
NSDivideRect (contentRect, &horizScrollerRect, &contentRect,
scrollerWidth, bottomEdge);
/** Horizontall expand the scroller by 1pt on each end */
if (overlapBorders)
{
horizScrollerRect.origin.x -= 1;
horizScrollerRect.size.width += 2;
}
[_horizScroller setFrame: horizScrollerRect];
/* Substract 1 for the width for the line that separates the
@ -1299,7 +1366,17 @@ static CGFloat scrollerWidth;
- (BOOL) isOpaque
{
#if 0
// FIXME: Only needs to be NO in a corner case,
// when [[GSTheme theme] scrollViewUseBottomCorner] is NO
// and the theme tile for the bottom corner is transparent.
// So maybe cache the value of
// [[GSTheme theme] scrollViewUseBottomCorner] and check it here.
return NO;
#else
// Testplant-MAL-2015-07-08: keeping testplant branch code...
return [_contentView isOpaque];
#endif
}
- (NSBorderType) borderType
@ -1734,6 +1811,13 @@ static CGFloat scrollerWidth;
- (void) _themeDidActivate: (NSNotification*)notification
{
// N.B. Reload cached [NSScroller scrollerWidth] since the
// new theme may have a different scroller width.
//
// Since scrollerWidth is a static, it will get overwritten
// several times; doesn't matter though.
scrollerWidth = [NSScroller scrollerWidth];
[self tile];
}

View file

@ -67,6 +67,14 @@ static NSCell *verticalKnobCell = nil;
static NSCell *horizontalKnobSlotCell = nil;
static NSCell *verticalKnobSlotCell = nil;
static CGFloat scrollerWidth = 0.0;
/**
* This is the amount (in userspace points) by which the knob slides over the
* button ends of the track. Typical use would be to set it to 1 when both
* the knob and the buttons have a 1-point border, so that when the knob is
* at its maximum, it overlaps the button by 1 point giving a resulting
* 1-point wide border.
*/
static CGFloat scrollerKnobOvershoot = 0.0;
/* This is the distance by which buttons are offset inside the scroller slot.
*/
@ -418,6 +426,14 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
{
buttonsOffset = 1.0;
}
if ([defs objectForKey: @"GSScrollerKnobOvershoot"] != nil)
{
scrollerKnobOvershoot = [defs floatForKey: @"GSScrollerKnobOvershoot"];
}
else
{
scrollerKnobOvershoot = 0.0;
}
upCell
= [theme cellForScrollerArrow: NSScrollerDecrementArrow horizontal:NO];
@ -769,6 +785,12 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
- (void) mouseDown: (NSEvent*)theEvent
{
if (!_scFlags.isEnabled)
{
[super mouseDown: theEvent];
return;
}
NSPoint location = [theEvent locationInWindow];
_hitPart = [self testPart: location];
[self _setTargetAndActionToCells];
@ -793,14 +815,10 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
fromView: nil]];
if (doubleValue != _doubleValue)
{
NSInterfaceStyle interfaceStyle;
const BOOL scrollsToPoint =
![[GSTheme theme] scrollerScrollsByPageForScroller: self];
interfaceStyle
= NSInterfaceStyleForKey(@"NSScrollerInterfaceStyle", self);
if (interfaceStyle == NSNextStepInterfaceStyle
|| interfaceStyle == NSMacintoshInterfaceStyle
|| interfaceStyle == GSWindowMakerInterfaceStyle)
if (scrollsToPoint)
{
/* NeXTstep style is to scroll to point.
*/
@ -1033,11 +1051,21 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
*/
- (void) drawRect: (NSRect)rect
{
if (!_scFlags.isEnabled)
{
NSRect rect1 = NSIntersectionRect(rect, NSInsetRect(_bounds,
buttonsOffset, buttonsOffset));
[self drawKnobSlotInRect: rect1
highlight: NO];
}
else
{
[[GSTheme theme] drawScrollerRect: rect
inView: self
hitPart: _hitPart
isHorizontal: _scFlags.isHorizontal];
}
}
/**<p>(Un)Highlight the button specified by <var>whichButton</var>.
<var>whichButton</var> should be <ref type="type" id="NSScrollerArrow">
@ -1078,6 +1106,11 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
*/
- (void) drawKnob
{
if (!_scFlags.isEnabled)
{
return;
}
if (upCell == nil)
{
[self drawParts];
@ -1149,16 +1182,7 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
CGFloat width, height;
CGFloat buttonsWidth;
CGFloat buttonsSize;
NSUsableScrollerParts usableParts;
NSInterfaceStyle interfaceStyle;
BOOL arrowsSameEnd = NO;
interfaceStyle = NSInterfaceStyleForKey(@"NSScrollerInterfaceStyle", self);
if ((interfaceStyle == NSNextStepInterfaceStyle
|| interfaceStyle == NSMacintoshInterfaceStyle
|| interfaceStyle == GSWindowMakerInterfaceStyle))
arrowsSameEnd = YES;
BOOL arrowsSameEnd = [[GSTheme theme] scrollerArrowsSameEndForScroller: self];
if (upCell == nil)
{
@ -1169,19 +1193,6 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
x = y = buttonsOffset;
buttonsSize = 2 * buttonsWidth + 2 * buttonsOffset;
/*
* If the scroller is disabled then the scroller buttons and the
* knob are not displayed at all.
*/
if (!_scFlags.isEnabled)
{
usableParts = NSNoScrollerParts;
}
else
{
usableParts = _usableParts;
}
/*
* Assign to `width' and `height' values describing
* the width and height of the scroller regardless
@ -1210,8 +1221,8 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
{
CGFloat knobHeight, knobPosition, slotHeight;
if (usableParts == NSNoScrollerParts
|| usableParts == NSOnlyScrollerArrows)
if (_usableParts == NSNoScrollerParts
|| _usableParts == NSOnlyScrollerArrows)
{
return NSZeroRect;
}
@ -1225,7 +1236,29 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
knobHeight = buttonsWidth;
/* calc knob's position */
knobPosition = floor((float)_doubleValue * (slotHeight - knobHeight));
{
CGFloat knobOvershootAbove = scrollerKnobOvershoot;
CGFloat knobOvershootBelow = scrollerKnobOvershoot;
if (arrowsSameEnd
&& _arrowsPosition == NSScrollerArrowsMinEnd)
{
knobOvershootBelow = 0;
}
else if (arrowsSameEnd
&& _arrowsPosition == NSScrollerArrowsMaxEnd)
{
knobOvershootAbove = 0;
}
else if (_arrowsPosition == NSScrollerArrowsNone)
{
knobOvershootAbove = 0;
knobOvershootBelow = 0;
}
knobPosition = floor((float)_doubleValue * (slotHeight - knobHeight + knobOvershootAbove + knobOvershootBelow))
- knobOvershootAbove;
}
if (arrowsSameEnd)
{
@ -1249,7 +1282,7 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
* if the scroller does not have buttons the slot completely
* fills the scroller.
*/
if (usableParts == NSNoScrollerParts
if (_usableParts == NSNoScrollerParts
|| _arrowsPosition == NSScrollerArrowsNone)
{
break;
@ -1271,7 +1304,7 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
case NSScrollerDecrementLine:
case NSScrollerDecrementPage:
if (usableParts == NSNoScrollerParts
if (_usableParts == NSNoScrollerParts
|| _arrowsPosition == NSScrollerArrowsNone)
{
return NSZeroRect;
@ -1286,7 +1319,7 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
case NSScrollerIncrementLine:
case NSScrollerIncrementPage:
if (usableParts == NSNoScrollerParts
if (_usableParts == NSNoScrollerParts
|| _arrowsPosition == NSScrollerArrowsNone)
{
return NSZeroRect;

View file

@ -224,6 +224,25 @@ float _floatValueForMousePoint (NSPoint point, NSRect knobRect,
}
}
- (void) _drawBorderAndBackgroundWithFrame: (NSRect)cellFrame
inView: (NSView*)controlView
{
NSBorderType aType;
if (_cell.is_bordered)
aType = NSLineBorder;
else if (_cell.is_bezeled)
aType = NSBezelBorder;
else
aType = NSNoBorder;
[[GSTheme theme] drawSliderBorderAndBackground: aType
frame: cellFrame
inCell: self
isHorizontal: ![self isVertical]];
}
/** <p>Draws the slider's track, not including the bezel, in <var>aRect</var>
<var>flipped</var> indicates whether the control view has a flipped
coordinate system.</p>
@ -274,15 +293,26 @@ float _floatValueForMousePoint (NSPoint point, NSRect knobRect,
if (_isVertical == YES)
{
origin = _trackRect.origin;
origin.x += (_trackRect.size.width - size.width) / 2.0; // center horizontally
origin.y += (_trackRect.size.height - size.height) * floatValue;
}
else
{
origin = _trackRect.origin;
origin.x += (_trackRect.size.width - size.width) * floatValue;
origin.y += (_trackRect.size.height - size.height) / 2.0; // center vertically
}
return NSMakeRect (origin.x, origin.y, size.width, size.height);
{
NSRect result = NSMakeRect (origin.x, origin.y, size.width, size.height);
if ([self controlView])
{
result = [[self controlView] centerScanRect: result];
}
return result;
}
}
/** <p>Calculates the rect in which to draw the knob, then calls
@ -307,10 +337,6 @@ float _floatValueForMousePoint (NSPoint point, NSRect knobRect,
*/
- (void) drawKnob: (NSRect)knobRect
{
NSColor* knobBackgroundColor = [NSColor controlBackgroundColor];
[knobBackgroundColor set];
NSRectFill (knobRect);
[_knobCell drawInteriorWithFrame: knobRect inView: _control_view];
}
@ -326,6 +352,7 @@ float _floatValueForMousePoint (NSPoint point, NSRect knobRect,
NSPoint point;
NSRect knobRect;
float fraction, angle, radius;
NSImage *image;
if (cellFrame.size.width > cellFrame.size.height)
{
@ -343,54 +370,73 @@ float _floatValueForMousePoint (NSPoint point, NSRect knobRect,
cellFrame.size.width,
cellFrame.size.width);
}
knobCenter = NSMakePoint(NSMidX(knobRect), NSMidY(knobRect));
if ([self controlView])
knobRect = [[self controlView] centerScanRect: knobRect];
image = [NSImage imageNamed: @"common_CircularSlider"];
if (image != nil)
{
[image drawInRect: knobRect
fromRect: NSZeroRect
operation: NSCompositeSourceOver
fraction: 1.0
respectFlipped: YES
hints: nil];
}
else
{
knobRect = NSInsetRect(knobRect, 1, 1);
circle = [NSBezierPath bezierPathWithOvalInRect: knobRect];
[[NSColor controlBackgroundColor] set];
[circle fill];
[[NSColor blackColor] set];
[circle stroke];
}
knobCenter = NSMakePoint(NSMidX(knobRect), NSMidY(knobRect));
fraction = ([self floatValue] - [self minValue]) /
([self maxValue] - [self minValue]);
angle = (fraction * (2.0 * M_PI)) - (M_PI / 2.0);
radius = (knobRect.size.height / 2) - 4;
radius = (knobRect.size.height / 2) - 6;
point = NSMakePoint((radius * cos(angle)) + knobCenter.x,
(radius * sin(angle)) + knobCenter.y);
[[NSBezierPath bezierPathWithOvalInRect: NSMakeRect(point.x - 2,
point.y - 2,
4,
4)] stroke];
image = [NSImage imageNamed: @"common_Dimple"];
{
NSSize size = [image size];
NSRect dimpleRect = NSMakeRect(point.x - (size.width / 2.0),
point.y - (size.height / 2.0),
size.width,
size.height);
if ([self controlView])
dimpleRect = [[self controlView] centerScanRect: dimpleRect];
[image drawInRect: dimpleRect
fromRect: NSZeroRect
operation: NSCompositeSourceOver
fraction: 1.0
respectFlipped: YES
hints: nil];
}
}
else if (_type == NSLinearSlider)
{
BOOL vertical = (cellFrame.size.height > cellFrame.size.width);
NSImage *image;
NSSize size;
if (vertical != _isVertical)
{
NSImage *image;
if (vertical == YES)
{
image = [NSImage imageNamed: @"common_SliderVert"];
if (image != nil)
{
size = [image size];
[image setScalesWhenResized: YES];
[image setSize: NSMakeSize(cellFrame.size.width, size.height)];
}
}
else
{
image = [NSImage imageNamed: @"common_SliderHoriz"];
if (image != nil)
{
size = [image size];
[image setScalesWhenResized: YES];
[image setSize: NSMakeSize(size.width, cellFrame.size.height)];
}
}
[_knobCell setImage: image];
}
_isVertical = vertical;

View file

@ -62,7 +62,7 @@
#import "GNUstepGUI/GSServicesManager.h"
// prototype for function to create name for server
NSString *GSSpellServerName(NSString *checkerDictionary, NSString *language);
extern NSString *GSSpellServerName(NSString *checkerDictionary, NSString *language);
// These are methods which we only want the NSSpellChecker to call.
// The protocol is defined here so that the outside world does not
@ -686,35 +686,35 @@ inSpellDocumentWithTag:(int)tag
@end
@interface NSSpellChecker(SpellBrowserDelegate)
- (BOOL) browser: (NSBrowser*)sender selectRow: (int)row inColumn: (int)column;
- (BOOL) browser: (NSBrowser*)sender selectRow: (NSInteger)row inColumn: (NSInteger)column;
- (void) browser: (NSBrowser *)sender createRowsForColumn: (int)column
- (void) browser: (NSBrowser *)sender createRowsForColumn: (NSInteger)column
inMatrix: (NSMatrix *)matrix;
- (NSString*) browser: (NSBrowser*)sender titleOfColumn: (int)column;
- (NSString*) browser: (NSBrowser*)sender titleOfColumn: (NSInteger)column;
- (void) browser: (NSBrowser *)sender
willDisplayCell: (id)cell
atRow: (int)row
column: (int)column;
atRow: (NSInteger)row
column: (NSInteger)column;
- (BOOL) browser: (NSBrowser *)sender isColumnValid: (int)column;
- (BOOL) browser: (NSBrowser *)sender isColumnValid: (NSInteger)column;
@end
@implementation NSSpellChecker(SpellBrowserDelegate)
- (BOOL) browser: (NSBrowser*)sender selectRow: (int)row inColumn: (int)column
- (BOOL) browser: (NSBrowser*)sender selectRow: (NSInteger)row inColumn: (NSInteger)column
{
return YES;
}
- (void) browser: (NSBrowser *)sender createRowsForColumn: (int)column
- (void) browser: (NSBrowser *)sender createRowsForColumn: (NSInteger)column
inMatrix: (NSMatrix *)matrix
{
NSArray *guesses = [self guessesForWord: [_wordField stringValue]];
NSEnumerator *e = [guesses objectEnumerator];
NSString *word = nil;
NSBrowserCell *cell= nil;
int i = 0;
NSInteger i = 0;
while ((word = [e nextObject]) != nil)
{
@ -726,19 +726,19 @@ inSpellDocumentWithTag:(int)tag
}
}
- (NSString*) browser: (NSBrowser*)sender titleOfColumn: (int)column
- (NSString*) browser: (NSBrowser*)sender titleOfColumn: (NSInteger)column
{
return _(@"Guess");
}
- (void) browser: (NSBrowser *)sender
willDisplayCell: (id)cell
atRow: (int)row
column: (int)column
atRow: (NSInteger)row
column: (NSInteger)column
{
}
- (BOOL) browser: (NSBrowser *)sender isColumnValid: (int)column
- (BOOL) browser: (NSBrowser *)sender isColumnValid: (NSInteger)column
{
return NO;
}

View file

@ -150,7 +150,7 @@ static NSNotificationCenter *nc = nil;
{
proportion = (NSWidth(frames[i]))/oldTotal;
}
key = [NSString stringWithFormat: @"%u", i];
key = [NSString stringWithFormat: @"%lu", (unsigned long) i];
[config setObject: [NSNumber numberWithDouble: proportion]
forKey: key];
}
@ -432,6 +432,7 @@ static NSNotificationCenter *nc = nil;
}
/* Silence compiler warnings. */
r = NSZeroRect;
r1 = NSZeroRect;
bigRect = NSZeroRect;
@ -828,7 +829,7 @@ static NSNotificationCenter *nc = nil;
NSNumber *proportion;
NSString *key;
key = [NSString stringWithFormat: @"%u", i];
key = [NSString stringWithFormat: @"%lu", (unsigned long) i];
proportion = [config objectForKey: key];
if (proportion == nil)
{
@ -1123,6 +1124,7 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
{
return;
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
if (_never_displayed_before == YES) // be sure to adjust subviews before repositioning the divider
{
_never_displayed_before = NO;

View file

@ -143,6 +143,7 @@ static void init_string_drawing(void)
}
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
static int lockedCacheEntries[NUM_CACHE_ENTRIES];
static unsigned int numLockedCacheEntries = 0;
#define DEBUG_CACHE_RECURSION_COUNT 0
@ -194,6 +195,7 @@ static inline void cache_lock()
static inline void cache_unlock()
{
// Testplant-MAL-2015-07-08: keeping testplant branch code...
unlock_top_entry();
[cacheLock unlock];
}
@ -245,6 +247,7 @@ static int cache_match(int hasSize, NSSize size, int useScreenFonts, int *matche
c = cache + j;
if (least_used == -1 || c->used < least_used)
{
// Testplant-MAL-2015-07-08: keeping testplant branch code...
// Avoid replacing items that are currently being modified by other stack frames...
if (!is_entry_locked(j))
{
@ -340,6 +343,7 @@ static int cache_lookup(int hasSize, NSSize size, int useScreenFonts)
NSTextContainer *textContainer;
ci = cache_match(hasSize, size, useScreenFonts, &hit);
// Testplant-MAL-2015-07-08: keeping testplant branch code...
lock_entry(ci);
if (hit)
{

View file

@ -40,7 +40,7 @@
return nil;
[self setAlignment: NSCenterTextAlignment];
[self setTextColor: [NSColor windowFrameTextColor]];
[self setTextColor: [[GSTheme theme] tableHeaderTextColorForState: GSThemeNormalState]];
[self setBackgroundColor: [NSColor controlShadowColor]];
[self setDrawsBackground: YES];
[self setFont: [NSFont titleBarFontOfSize: 0]];
@ -113,12 +113,12 @@
if (flag == YES)
{
[self setBackgroundColor: [NSColor controlHighlightColor]];
[self setTextColor: [NSColor controlTextColor]];
[self setTextColor: [[GSTheme theme] tableHeaderTextColorForState: GSThemeHighlightedState]];
}
else
{
[self setBackgroundColor: [NSColor controlShadowColor]];
[self setTextColor: [NSColor windowFrameTextColor]];
[self setTextColor: [[GSTheme theme] tableHeaderTextColorForState: GSThemeNormalState]];
}
}

View file

@ -49,15 +49,16 @@
- (void)drawWithFrame: (NSRect)cellFrame
inView: (NSView *)controlView
characterIndex: (unsigned)charIndex
characterIndex: (NSUInteger)charIndex
{
// cellFrame.origin.y -= cellFrame.size.height;
[self drawWithFrame: cellFrame
inView: controlView];
}
- (void)drawWithFrame: (NSRect)cellFrame
inView: (NSView *)controlView
characterIndex: (unsigned)charIndex
characterIndex: (NSUInteger)charIndex
layoutManager: (NSLayoutManager *)layoutManager
{
[self drawWithFrame: cellFrame
@ -73,7 +74,7 @@
- (NSRect)cellFrameForTextContainer: (NSTextContainer *)textContainer
proposedLineFragment: (NSRect)lineFrag
glyphPosition: (NSPoint)position
characterIndex: (unsigned)charIndex
characterIndex: (NSUInteger)charIndex
{
NSRect aRect;
@ -90,7 +91,7 @@
- (BOOL)wantsToTrackMouseForEvent: (NSEvent *)theEvent
inRect: (NSRect)cellFrame
ofView: (NSView *)controlView
atCharacterIndex: (unsigned)charIndex
atCharacterIndex: (NSUInteger)charIndex
{
return [self wantsToTrackMouse];
}
@ -154,7 +155,7 @@
- (BOOL)trackMouse: (NSEvent *)theEvent
inRect: (NSRect)cellFrame
ofView: (NSView *)controlView
atCharacterIndex: (unsigned)charIndex
atCharacterIndex: (NSUInteger)charIndex
untilMouseUp: (BOOL)flag
{
if ([controlView respondsToSelector: @selector(delegate)])
@ -235,6 +236,7 @@
- (void)setAttachment: (NSTextAttachment *)anObject
{
// Testplant-MAL-2015-07-08: keeping testplant branch code...
NSFileWrapper *fileWrap = [anObject fileWrapper];
// Do not retain the attachment
@ -307,6 +309,7 @@
self = [super init];
if (self != nil)
{
// Testplant-MAL-2015-07-08: keeping testplant branch code...
ASSIGN(_fileWrapper, fileWrapper);
_cell = [[NSTextAttachmentCell alloc ] init];
[_cell setAttachment: self];
@ -322,6 +325,25 @@
{
[_cell setAttachment: self];
}
if (_taflags.cell_explicitly_set == 0)
{
if (fileWrapper != nil)
{
NSImage *icon = nil;
NSString *fileName = [fileWrapper filename];
if (fileName != nil)
{
// Try to set the image to the file wrapper content
icon = [[NSImage alloc] initByReferencingFile: fileName];
}
if (icon == nil)
icon = RETAIN([fileWrapper icon]);
[(NSTextAttachmentCell*)_cell setImage: icon];
RELEASE(icon);
}
}
}
- (NSFileWrapper *)fileWrapper
@ -337,6 +359,7 @@
- (void)setAttachmentCell: (id <NSTextAttachmentCell>)cell
{
ASSIGN(_cell, cell);
_taflags.cell_explicitly_set = 1;
if ([_cell respondsToSelector: @selector(setAttachment:)] == YES)
{
[_cell setAttachment: self];
@ -350,7 +373,11 @@
{
if ([aCoder allowsKeyedCoding])
{
// TODO_NIB: Determine keys for NSTextAttachment.
[aCoder encodeObject: [self fileWrapper] forKey: @"NSFileWrapper"];
if (_cell != nil)
{
[aCoder encodeObject: _cell forKey: @"NSCell"];
}
}
else
{
@ -363,7 +390,8 @@
{
if ([aDecoder allowsKeyedCoding])
{
// TODO_NIB: Determine keys for NSTextAttachment.
[self setFileWrapper: [aDecoder decodeObjectForKey: @"NSFileWrapper"]];
[self setAttachmentCell: [aDecoder decodeObjectForKey: @"NSCell"]];
}
else
{

View file

@ -72,7 +72,7 @@
{
if (edge >= sizeof(_borderColorForEdge) / sizeof(_borderColorForEdge[0]))
[NSException raise: NSInvalidArgumentException
format: @"invalid edge %d", edge];
format: @"invalid edge %lu", (unsigned long) edge];
ASSIGN(_borderColorForEdge[edge], color);
}
@ -167,7 +167,7 @@
format: @"invalid layer %d", layer];
if (edge >= sizeof(_width[0]) / sizeof(_width[0][0]))
[NSException raise: NSInvalidArgumentException
format: @"invalid edge %d", edge];
format: @"invalid edge %lu", (unsigned long) edge];
return _width[layer][edge];
}
@ -179,7 +179,7 @@
format: @"invalid layer %d", layer];
if (edge >= sizeof(_width[0]) / sizeof(_width[0][0]))
[NSException raise: NSInvalidArgumentException
format: @"invalid edge %d", edge];
format: @"invalid edge %lu", (unsigned long) edge];
return _widthType[layer][edge];
}
@ -193,7 +193,7 @@
format: @"invalid layer %d", layer];
if (edge >= sizeof(_width[0]) / sizeof(_width[0][0]))
[NSException raise: NSInvalidArgumentException
format: @"invalid edge %d", edge];
format: @"invalid edge %lu", (unsigned long) edge];
_width[layer][edge] = val;
_widthType[layer][edge] = type;
}

View file

@ -96,12 +96,12 @@ use bounds rectangle instead of frame? */
NSDebugLLog(@"NSText", @"NSTextContainer initWithContainerSize");
if (aSize.width < 0)
{
NSWarnMLog(@"given negative width", 0);
NSWarnMLog(@"given negative width");
aSize.width = 0;
}
if (aSize.height < 0)
{
NSWarnMLog(@"given negative height", 0);
NSWarnMLog(@"given negative height");
aSize.height = 0;
}
_layoutManager = nil;
@ -246,12 +246,12 @@ framework intact.
if (aSize.width < 0)
{
NSWarnMLog(@"given negative width", 0);
NSWarnMLog(@"given negative width");
aSize.width = 0;
}
if (aSize.height < 0)
{
NSWarnMLog(@"given negative height", 0);
NSWarnMLog(@"given negative height");
aSize.height = 0;
}

View file

@ -238,6 +238,8 @@
well). */
_cell.type = NSTextCellType;
titleRect = [self titleRectForBounds: cellFrame];
// Testplant-MAL-2015-07-08: keeping testplant branch code...
NSAttributedString *string = [self _drawAttributedString];
NSSize size = [string size];
if (size.width > titleRect.size.width && [string length] > 4)

View file

@ -161,9 +161,12 @@
- (void) encodeWithCoder: (NSCoder*)aCoder
{
// FIXME
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeObject: _markerFormat
forKey: @"NSMarkerFormat"];
[aCoder encodeInt: _listOptions
forKey: @"NSOptions"];
}
else
{
@ -172,9 +175,10 @@
- (id) initWithCoder: (NSCoder*)aDecoder
{
// FIXME
if ([aDecoder allowsKeyedCoding])
{
ASSIGN(_markerFormat, [aDecoder decodeObjectForKey: @"NSMarkerFormat"]);
_listOptions = [aDecoder decodeIntForKey: @"NSOptions"];
}
else
{

View file

@ -148,6 +148,7 @@ static NSNotificationCenter *nc = nil;
/*
* Extend edited range to encompass the latest edit.
*/
// Testplant-MAL-2015-07-08: keeping testplant branch code...
if (_editedMask == 0)
{
_editedRange = old; // First edit.
@ -157,6 +158,7 @@ static NSNotificationCenter *nc = nil;
_editedRange = NSUnionRange (_editedRange, old);
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
/*
* Add in any new flags for this edit.
*/

View file

@ -311,6 +311,7 @@ Interface for a bunch of internal methods that need to be cleaned up.
}
@end
@interface NSTextStorage(NSTextViewUndoSupport)
- (void) _undoTextChange: (NSTextViewUndoObject *)anObject;
- (BOOL) _isEditing;
@ -2168,7 +2169,7 @@ chain if we can't handle it. */
}
if ([self respondsToSelector: aSelector])
{
[self performSelector: aSelector];
[self performSelector: aSelector withObject: nil];
}
else
{
@ -2194,6 +2195,11 @@ This method is for user changes; see NSTextView_actions.m.
return;
}
if (insertString == nil)
{
return;
}
isAttributed = [insertString isKindOfClass: [NSAttributedString class]];
if (isAttributed)
@ -2728,6 +2734,8 @@ TextDidEndEditing notification _without_ asking the delegate
immediately. We never coalesce actions when the current selection is
not empty. */
event = [NSApp currentEvent];
// Testplant-MAL-2015-07-08: keeping testplant branch code...
isTyping = (([event type] == NSKeyDown) &&
([[event characters] isEqualToString: replacementString]));
if (undoManagerCanCoalesce && _undoObject)
@ -2772,10 +2780,12 @@ TextDidEndEditing notification _without_ asking the delegate
[undo registerUndoWithTarget: _textStorage
selector: @selector(_undoTextChange:)
object: undoObject];
// Testplant-MAL-2015-07-08: keeping testplant branch code...
if (isTyping) // || _tf.isAutoCompleting)
_undoObject = undoObject;
else
RELEASE(undoObject);
// Testplant-MAL-2015-07-08: keeping testplant branch code...
if (_tf.isAutoCompleting == 1)
_tf.isAutoCompleting = 2;
}
@ -2799,6 +2809,7 @@ After each user-induced change, this method should be called.
*/
- (void) didChangeText
{
// Testplant-MAL-2015-07-08: keeping testplant branch code...
if ([_textStorage _isEditing])
return;
@ -2872,6 +2883,7 @@ Returns the ranges to which various kinds of user changes should apply.
return _layoutManager->_selected_range;
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
- (NSRange) rangeForUserCompletion
{
static NSCharacterSet *TheAplhaSet = nil; // ONLY ALPHA CHARACTERS
@ -4280,6 +4292,7 @@ Figure out how the additional layout stuff is supposed to work.
method or during the previous call to this method) */
if (_tf.drag_target_hijacks_insertion_point)
{
// Testplant-MAL-2015-07-08: keeping testplant branch code...
// Erase previous insertion point line...
_drawInsertionPointNow = NO;
[self setNeedsDisplayInRect: _insertionPointRect avoidAdditionalLayout: YES];
@ -5609,6 +5622,7 @@ other than copy/paste or dragging. */
{
NSRect cellFrame = NSZeroRect;
// Testplant-MAL-2015-07-08: keeping testplant branch code...
if (startIndex >= [_textStorage length])
{
NSUInteger glyphIndex = [_textStorage length]-1;
@ -5625,6 +5639,7 @@ other than copy/paste or dragging. */
NSRect lfRect;
NSUInteger glyphIndex;
// Testplant-MAL-2015-07-08: keeping testplant branch code...
glyphIndex = [_layoutManager glyphRangeForCharacterRange: NSMakeRange(startIndex, 1)
actualCharacterRange: NULL].location;
lfRect = [_layoutManager lineFragmentRectForGlyphAtIndex: glyphIndex
@ -6073,6 +6088,7 @@ configuation! */
range.location != NSNotFound && range.length != 0)
{
GSAutocompleteWindow *window = [GSAutocompleteWindow defaultWindow];
// Testplant-MAL-2015-07-08: keeping testplant branch code...
_tf.isAutoCompleting = 1;
[window displayForTextView: self];
_tf.isAutoCompleting = 0;
@ -6330,6 +6346,11 @@ or add guards
// nearest word boundary
NSString *substring = [[self string] substringWithRange: aRange];
if (sp == nil)
{
return;
}
do {
NSRange errorRange = [sp checkSpellingOfString: substring
startingAt: start
@ -6630,6 +6651,7 @@ or add guards
[anObject performUndo: self];
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
- (BOOL) _isEditing
{
return (_editCount != 0);

View file

@ -1556,6 +1556,7 @@ static GSValidationCenter *vc = nil;
[self validateVisibleItems];
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
- (void) _resetToolbarUpdates: (NSWindow *)window
{
GSValidationCenter *validationCenter = [GSValidationCenter sharedValidationCenter];

View file

@ -287,7 +287,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
index = [toolbar _indexOfItem: _toolbarItem];
}
[GSToolbarView setDraggedItemIndex:index];
[pboard setString: [NSString stringWithFormat:@"%d", index]
[pboard setString: [NSString stringWithFormat:@"%ld", (long) index]
forType: GSMovableToolbarItemPboardType];
[self dragImage: image
@ -777,7 +777,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
index = [toolbar _indexOfItem: _toolbarItem];
}
[GSToolbarView setDraggedItemIndex:index];
[pboard setString: [NSString stringWithFormat:@"%d", index]
[pboard setString: [NSString stringWithFormat:@"%ld", (long) index]
forType: GSMovableToolbarItemPboardType];
[self dragImage: image
@ -1382,13 +1382,18 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
[(NSButton *)_backView setTarget: target];
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
- (void) setToolTip: (NSString *)toolTip
{
ASSIGN(_toolTip, toolTip);
if (_view)
[_view setToolTip: _toolTip];
{
[_view setToolTip: _toolTip];
}
else if (_backView && [_backView isMemberOfClass:[GSToolbarButton class]])
[_backView setToolTip: _toolTip];
{
[_backView setToolTip: _toolTip];
}
}
- (void) setView: (NSView *)view

View file

@ -1,7 +1,331 @@
/*
NSTreeController.h
The tree controller class.
Copyright (C) 2012 Free Software Foundation, Inc.
Author: Gregory Casamento <greg.casamento@gmail.com>
Date: 2012
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/*
NSTreeController.h
The tree controller class.
Copyright (C) 2012 Free Software Foundation, Inc.
Author: Gregory Casamento <greg.casamento@gmail.com>
Date: 2012
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSIndexPath.h>
#import <Foundation/NSString.h>
#import <Foundation/NSSortDescriptor.h>
#import <AppKit/NSTreeController.h>
#import <AppKit/NSTreeNode.h>
@implementation NSTreeController
- (id) initWithContent: (id)content
{
if ((self = [super initWithContent: content]) != nil)
{
}
return self;
}
- (void) dealloc
{
RELEASE(_childrenKeyPath);
RELEASE(_countKeyPath);
RELEASE(_leafKeyPath);
RELEASE(_sortDescriptors);
[super dealloc];
}
- (BOOL) addSelectionIndexPaths: (NSArray*)indexPaths
{
// FIXME
return NO;
}
- (BOOL) alwaysUsesMultipleValuesMarker
{
return _alwaysUsesMultipleValuesMarker;
}
- (BOOL) avoidsEmptySelection
{
return _avoidsEmptySelection;
}
- (BOOL) canAddChid
{
// FIXME
return NO;
}
- (BOOL) canInsert
{
// FIXME
return NO;
}
- (BOOL) canInsertChild
{
// FIXME
return NO;
}
- (BOOL) preservesSelection
{
return _preservesSelection;
}
- (BOOL) selectsInsertedObjects
{
return _selectsInsertedObjects;
}
- (BOOL) setSelectionIndexPath: (NSIndexPath*)indexPath
{
// FIXME
return NO;
}
- (BOOL) setSelectionIndexPaths: (NSArray*)indexPaths
{
// FIXME
return NO;
}
- (id) arrangedObjects
{
// FIXME
return nil;
}
- (id) content
{
// FIXME
return [super content];
}
- (NSArray*) selectedObjects
{
// FIXME
return [super selectedObjects];
}
- (NSIndexPath*) selectionIndexPath
{
// FIXME
return nil;
}
- (NSArray*) selectionIndexPaths
{
// FIXME
return nil;
}
- (NSArray*) sortDescriptors
{
return _sortDescriptors;
}
- (NSString*) childrenKeyPath
{
return _childrenKeyPath;
}
- (NSString*) countKeyPath
{
return _countKeyPath;;
}
- (NSString*) leafKeyPath
{
return _leafKeyPath;
}
- (void) addChild: (id)sender
{
// FIXME
}
- (void) add: (id)sender
{
// FIXME
[super add: sender];
}
- (void) insertChild: (id)sender
{
// FIXME
}
- (void) insertObject: (id)object atArrangedObjectIndexPath: (NSIndexPath*)indexPath
{
// FIXME
}
- (void) insertObjects: (NSArray*)objects atArrangedObjectIndexPaths: (NSArray*)indexPaths
{
// FIXME
}
- (void) insert: (id)sender
{
// FIXME
}
- (void) rearrangeObjects
{
// FIXME
}
- (void) removeObjectAtArrangedObjectIndexPath: (NSIndexPath*)indexPath
{
// FIXME
}
- (void) removeObjectsAtArrangedObjectIndexPaths: (NSArray*)indexPaths
{
// FIXME
}
- (void) removeSelectionIndexPaths: (NSArray*)indexPaths
{
// FIXME
}
- (void) remove: (id)sender
{
// FIXME
[super remove: sender];
}
- (void) setAlwaysUsesMultipleValuesMarker: (BOOL)flag
{
_alwaysUsesMultipleValuesMarker = flag;
}
- (void) setAvoidsEmptySelection: (BOOL)flag
{
_avoidsEmptySelection = flag;
}
- (void) setChildrenKeyPath: (NSString*)path
{
ASSIGN(_childrenKeyPath, path);
}
- (void) setContent: (id)content
{
// FIXME
[super setContent: content];
}
- (void) setCountKeyPath: (NSString*)path
{
ASSIGN(_countKeyPath, path);
}
- (void) setLeafPathKey: (NSString*)key
{
ASSIGN(_leafKeyPath, key);
}
- (void) setPreservesSelection: (BOOL)flag
{
_preservesSelection = flag;
}
- (void) setSelectsInsertedObjects: (BOOL)flag
{
_selectsInsertedObjects = flag;
}
- (void) setSortDescriptors: (NSArray*)descriptors
{
ASSIGN(_sortDescriptors, descriptors);
}
- (NSString*) childrenKeyPathForNode: (NSTreeNode*)node
{
// FIXME
return nil;
}
- (NSString*) countKeyPathForNode: (NSTreeNode*)node
{
// FIXME
return nil;
}
- (NSString*) leafKeyPathForNode: (NSTreeNode*)node
{
// FIXME
return nil;
}
- (void) moveNode: (NSTreeNode*)node toIndexPath: (NSIndexPath*)indexPath
{
// FIXME
}
- (void) moveNodes: (NSArray*)nodes toIndexPath: (NSIndexPath*)startingIndexPath
{
// FIXME
}
- (NSArray*) selectedNodes
{
// FIXME
return nil;
}
- (id) initWithCoder: (NSCoder *)coder
{
return self;

View file

@ -595,12 +595,12 @@ GSSetDragTypes(NSView* obj, NSArray *types)
if (frameRect.size.width < 0)
{
NSWarnMLog(@"given negative width", 0);
NSWarnMLog(@"given negative width");
frameRect.size.width = 0;
}
if (frameRect.size.height < 0)
{
NSWarnMLog(@"given negative height", 0);
NSWarnMLog(@"given negative height");
frameRect.size.height = 0;
}
_frame = frameRect; // Set frame rectangle
@ -1178,12 +1178,12 @@ static NSSize _computeScale(NSSize fs, NSSize bs)
if (frameRect.size.width < 0)
{
NSWarnMLog(@"given negative width", 0);
NSWarnMLog(@"given negative width");
frameRect.size.width = 0;
}
if (frameRect.size.height < 0)
{
NSWarnMLog(@"given negative height", 0);
NSWarnMLog(@"given negative height");
frameRect.size.height = 0;
}
@ -1259,12 +1259,12 @@ static NSSize _computeScale(NSSize fs, NSSize bs)
NSRect newFrame = _frame;
if (newSize.width < 0)
{
NSWarnMLog(@"given negative width", 0);
NSWarnMLog(@"given negative width");
newSize.width = 0;
}
if (newSize.height < 0)
{
NSWarnMLog(@"given negative height", 0);
NSWarnMLog(@"given negative height");
newSize.height = 0;
}
if (NSEqualSizes(_frame.size, newSize) == NO)
@ -1385,12 +1385,12 @@ static NSSize _computeScale(NSSize fs, NSSize bs)
NSDebugLLog(@"NSView", @"setBounds %@", NSStringFromRect(aRect));
if (aRect.size.width < 0)
{
NSWarnMLog(@"given negative width", 0);
NSWarnMLog(@"given negative width");
aRect.size.width = 0;
}
if (aRect.size.height < 0)
{
NSWarnMLog(@"given negative height", 0);
NSWarnMLog(@"given negative height");
aRect.size.height = 0;
}
@ -1479,12 +1479,12 @@ static NSSize _computeScale(NSSize fs, NSSize bs)
if (newSize.width < 0)
{
NSWarnMLog(@"given negative width", 0);
NSWarnMLog(@"given negative width");
newSize.width = 0;
}
if (newSize.height < 0)
{
NSWarnMLog(@"given negative height", 0);
NSWarnMLog(@"given negative height");
newSize.height = 0;
}
@ -1570,12 +1570,12 @@ static NSSize _computeScale(NSSize fs, NSSize bs)
{
if (newSize.width < 0)
{
NSWarnMLog(@"given negative width", 0);
NSWarnMLog(@"given negative width");
newSize.width = 0;
}
if (newSize.height < 0)
{
NSWarnMLog(@"given negative height", 0);
NSWarnMLog(@"given negative height");
newSize.height = 0;
}
@ -2559,6 +2559,7 @@ static void autoresize(CGFloat oldContainerSize,
_invalidRect = NSZeroRect;
_rFlags.needs_display = NO;
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
else
{
NSRectEdge sliceEdge = NSNotFound;

View file

@ -108,7 +108,7 @@
{
NSNib *nib;
if (_vcFlags.nib_is_loaded)
if (_vcFlags.nib_is_loaded || ([self nibName] == nil))
{
return;
}

View file

@ -390,7 +390,7 @@ has blocked and waited for events.
*/
- (NSScreen *) _screenForFrame: (NSRect)frame
{
NSInteger largest = 0;
CGFloat largest = 0.0;
NSArray *screens = [NSScreen screens];
NSInteger index = 0;
NSScreen *theScreen = nil;
@ -400,7 +400,8 @@ has blocked and waited for events.
NSScreen *screen = [screens objectAtIndex: index];
NSRect sframe = [screen frame];
NSRect iframe = NSIntersectionRect(frame, sframe);
NSInteger isize = NSWidth(iframe) * NSHeight(iframe);
CGFloat isize = NSWidth(iframe) * NSHeight(iframe);
if (isize > largest)
{
largest = isize;
@ -693,7 +694,7 @@ static NSNotificationCenter *nc = nil;
{
if (self == [NSWindow class])
{
[self setVersion: 2];
[self setVersion: 3];
ccSel = @selector(_checkCursorRectangles:forEvent:);
ctSel = @selector(_checkTrackingRectangles:forEvent:);
ccImp = [self instanceMethodForSelector: ccSel];
@ -899,8 +900,8 @@ many times.
- (NSString*) description
{
return [[super description] stringByAppendingFormat: @"Number: %d Title: %@",
[self windowNumber], [self title]];
return [[super description] stringByAppendingFormat: @"Number: %ld Title: %@",
(long) [self windowNumber], [self title]];
}
- (void) _startBackendWindow
@ -1039,8 +1040,10 @@ many times.
defer: (BOOL)flag
{
NSRect cframe;
#if 0
NSInterfaceStyle style =
NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil);
#endif
NSAssert(NSApp,
@"The shared NSApplication instance must be created before windows "
@ -1112,6 +1115,7 @@ many times.
name: NSColorListDidChangeNotification
object: nil];
#if 0
if (style == NSWindows95InterfaceStyle)
{
if([self canBecomeMainWindow])
@ -1119,6 +1123,7 @@ many times.
[self setMenu: [NSApp mainMenu]];
}
}
#endif
NSDebugLLog(@"NSWindow", @"NSWindow end of init\n");
return self;
@ -1582,6 +1587,7 @@ titleWithRepresentedFilename(NSString *representedFilename)
[_wv setInputState: GSTitleBarKey];
[GSServerForWindow(self) setinputfocus: _windowNum];
// Testplant-MAL-2015-07-08: keeping testplant branch code...
[self _resetToolbarUpdates];
[self resetCursorRects];
[nc postNotificationName: NSWindowDidBecomeKeyNotification object: self];
@ -1877,6 +1883,7 @@ titleWithRepresentedFilename(NSString *representedFilename)
[srv setinputfocus: _windowNum];
}
_f.visible = YES;
// Testplant-MAL-2015-07-08: keeping testplant branch code...
[self displayIfNeeded];
}
else if ([self isOneShot])
@ -1973,6 +1980,7 @@ titleWithRepresentedFilename(NSString *representedFilename)
{
NSRect cRect;
// Testplant-MAL-2015-07-08: keeping testplant branch code...
// Adjust top left point if not on a screen...
CGFloat yValue = topLeftPoint.y - _frame.size.height;
NSRect frame = NSMakeRect(topLeftPoint.x, yValue, _frame.size.width, _frame.size.height);
@ -1994,6 +2002,7 @@ titleWithRepresentedFilename(NSString *representedFilename)
topLeftPoint.x = NSMinX(cRect);
topLeftPoint.y = NSMaxY(cRect);
// Testplant-MAL-2015-07-08: keeping testplant branch code...
/* make sure the new point is inside the screen */
NSScreen *screen = [self screen];
if (screen == nil)
@ -2013,6 +2022,7 @@ titleWithRepresentedFilename(NSString *representedFilename)
- (BOOL) showsResizeIndicator
{
// Testplant-MAL-2015-07-08: keeping testplant branch code...
return ([self styleMask] & NSResizableWindowMask) ? YES : NO;
}
@ -2089,14 +2099,15 @@ titleWithRepresentedFilename(NSString *representedFilename)
}
// Find the biggest difference
maxDiff = abs(newFrame.origin.x - _frame.origin.x);
maxDiff = MAX(maxDiff, abs(newFrame.origin.y - _frame.origin.y));
maxDiff = MAX(maxDiff, abs(newFrame.size.width - _frame.size.width));
maxDiff = MAX(maxDiff, abs(newFrame.size.height - _frame.size.height));
maxDiff = fabs(newFrame.origin.x - _frame.origin.x);
maxDiff = MAX(maxDiff, fabs(newFrame.origin.y - _frame.origin.y));
maxDiff = MAX(maxDiff, fabs(newFrame.size.width - _frame.size.width));
maxDiff = MAX(maxDiff, fabs(newFrame.size.height - _frame.size.height));
return (maxDiff * resizeTime) / 150;
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
- (NSRect) _centerFrame: (NSRect)frame onScreen: (NSScreen*)theScreen
{
NSRect centeredFrame = frame;
@ -2115,11 +2126,13 @@ titleWithRepresentedFilename(NSString *representedFilename)
return centeredFrame;
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
- (NSRect) _centerFrame: (NSRect)frame
{
return [self _centerFrame:frame onScreen:[NSScreen mainScreen]];
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
- (void) center
{
NSRect frame = [self _centerFrame: _frame onScreen: [self screen]];
@ -2143,13 +2156,20 @@ titleWithRepresentedFilename(NSString *representedFilename)
frameRect.origin.y -= difference;
}
/* Adjust X origin, if needed */
difference = NSMaxX (frameRect) - NSMaxX (screenRect);
if (difference > 0)
{
frameRect.origin.x -= difference;
}
/* If the window is resizable, resize it (if needed) so that the
bottom edge is on the screen or can be on the screen when the user moves
the window */
difference = NSMaxY (screenRect) - NSMaxY (frameRect);
if (_styleMask & NSResizableWindowMask)
{
float difference2;
CGFloat difference2;
difference2 = screenRect.origin.y - frameRect.origin.y;
difference2 -= difference;
@ -2793,6 +2813,164 @@ resetCursorRectsForView(NSView *theView)
}
}
static void
checkCursorRectanglesEntered(NSView *theView, NSEvent *theEvent, NSPoint lastPoint)
{
/*
* Check cursor rectangles for the subviews
*/
if (theView->_rFlags.has_subviews)
{
NSArray *sb = theView->_sub_views;
NSUInteger count = [sb count];
if (count > 0)
{
NSView *subs[count];
NSUInteger i;
[sb getObjects: subs];
for (i = 0; i < count; ++i)
{
if (![subs[i] isHidden])
{
checkCursorRectanglesEntered(subs[i], theEvent, lastPoint);
}
}
}
}
if (theView->_rFlags.valid_rects)
{
NSArray *tr = theView->_cursor_rects;
NSUInteger count = [tr count];
// Loop through cursor rectangles
if (count > 0)
{
GSTrackingRect *rects[count];
NSPoint loc = [theEvent locationInWindow];
NSUInteger i;
[tr getObjects: rects];
for (i = 0; i < count; ++i)
{
GSTrackingRect *r = rects[i];
BOOL last;
BOOL now;
if ([r isValid] == NO)
continue;
/*
* Check for presence of point in rectangle.
*/
last = NSMouseInRect(lastPoint, r->rectangle, NO);
now = NSMouseInRect(loc, r->rectangle, NO);
// Mouse entered
if ((!last) && (now))
{
NSEvent *e;
e = [NSEvent enterExitEventWithType: NSCursorUpdate
location: loc
modifierFlags: [theEvent modifierFlags]
timestamp: 0
windowNumber: [theEvent windowNumber]
context: [theEvent context]
eventNumber: 0
trackingNumber: (int)YES
userData: (void*)r];
[NSApp postEvent: e atStart: YES];
//NSLog(@"Add enter event %@ for view %@ rect %@", e, theView, NSStringFromRect(r->rectangle));
}
}
}
}
}
static void
checkCursorRectanglesExited(NSView *theView, NSEvent *theEvent, NSPoint lastPoint)
{
if (theView->_rFlags.valid_rects)
{
NSArray *tr = theView->_cursor_rects;
NSUInteger count = [tr count];
// Loop through cursor rectangles
if (count > 0)
{
GSTrackingRect *rects[count];
NSPoint loc = [theEvent locationInWindow];
NSUInteger i;
[tr getObjects: rects];
for (i = 0; i < count; ++i)
{
GSTrackingRect *r = rects[i];
BOOL last;
BOOL now;
if ([r isValid] == NO)
continue;
/*
* Check for presence of point in rectangle.
*/
last = NSMouseInRect(lastPoint, r->rectangle, NO);
now = NSMouseInRect(loc, r->rectangle, NO);
// Mouse exited
if ((last) && (!now))
{
NSEvent *e;
e = [NSEvent enterExitEventWithType: NSCursorUpdate
location: loc
modifierFlags: [theEvent modifierFlags]
timestamp: 0
windowNumber: [theEvent windowNumber]
context: [theEvent context]
eventNumber: 0
trackingNumber: (int)NO
userData: (void*)r];
[NSApp postEvent: e atStart: YES];
//[NSApp postEvent: e atStart: NO];
//NSLog(@"Add exit event %@ for view %@ rect %@", e, theView, NSStringFromRect(r->rectangle));
}
}
}
}
/*
* Check cursor rectangles for the subviews
*/
if (theView->_rFlags.has_subviews)
{
NSArray *sb = theView->_sub_views;
NSUInteger count = [sb count];
if (count > 0)
{
NSView *subs[count];
NSUInteger i;
[sb getObjects: subs];
for (i = 0; i < count; ++i)
{
if (![subs[i] isHidden])
{
checkCursorRectanglesExited(subs[i], theEvent, lastPoint);
}
}
}
}
}
- (void) resetCursorRects
{
[self discardCursorRects];
@ -2814,7 +2992,7 @@ resetCursorRectsForView(NSView *theView)
clickCount: 0
pressure: 0];
_lastPoint = NSMakePoint(-1,-1);
(*ccImp)(self, ccSel, _wv, e);
checkCursorRectanglesEntered(_wv, e, _lastPoint);
_lastPoint = loc;
}
}
@ -3525,6 +3703,7 @@ resetCursorRectsForView(NSView *theView)
GSTrackingRect *rects[count];
NSPoint loc = [theEvent locationInWindow];
NSPoint lastPoint = _lastPoint;
NSRect vr = [theView visibleRect];
NSUInteger i;
lastPoint = [theView convertPoint: lastPoint fromView: nil];
@ -3536,13 +3715,14 @@ resetCursorRectsForView(NSView *theView)
BOOL last;
BOOL now;
GSTrackingRect *r = rects[i];
NSRect tr = NSIntersectionRect(vr, r->rectangle);
if ([r isValid] == NO)
continue;
/* Check mouse at last point */
last = NSMouseInRect(lastPoint, r->rectangle, isFlipped);
last = NSMouseInRect(lastPoint, tr, isFlipped);
/* Check mouse at current point */
now = NSMouseInRect(loc, r->rectangle, isFlipped);
now = NSMouseInRect(loc, tr, isFlipped);
if ((!last) && (now)) // Mouse entered event
{
@ -3630,92 +3810,12 @@ resetCursorRectsForView(NSView *theView)
- (void) _checkCursorRectangles: (NSView*)theView forEvent: (NSEvent*)theEvent
{
if (theView->_rFlags.valid_rects)
{
NSArray *tr = theView->_cursor_rects;
NSUInteger count = [tr count];
// Loop through cursor rectangles
if (count > 0)
{
GSTrackingRect *rects[count];
NSPoint loc = [theEvent locationInWindow];
NSUInteger i;
[tr getObjects: rects];
for (i = 0; i < count; ++i)
{
GSTrackingRect *r = rects[i];
BOOL last;
BOOL now;
if ([r isValid] == NO)
continue;
/*
* Check for presence of point in rectangle.
*/
last = NSMouseInRect(_lastPoint, r->rectangle, NO);
now = NSMouseInRect(loc, r->rectangle, NO);
// Mouse entered
if ((!last) && (now))
{
NSEvent *e;
e = [NSEvent enterExitEventWithType: NSCursorUpdate
location: loc
modifierFlags: [theEvent modifierFlags]
timestamp: 0
windowNumber: [theEvent windowNumber]
context: [theEvent context]
eventNumber: 0
trackingNumber: (int)YES
userData: (void*)r];
[self postEvent: e atStart: YES];
}
// Mouse exited
if ((last) && (!now))
{
NSEvent *e;
e = [NSEvent enterExitEventWithType: NSCursorUpdate
location: loc
modifierFlags: [theEvent modifierFlags]
timestamp: 0
windowNumber: [theEvent windowNumber]
context: [theEvent context]
eventNumber: 0
trackingNumber: (int)NO
userData: (void*)r];
[self postEvent: e atStart: YES];
}
}
}
}
/*
* Check cursor rectangles for the subviews
*/
if (theView->_rFlags.has_subviews)
{
NSArray *sb = theView->_sub_views;
NSUInteger count = [sb count];
if (count > 0)
{
NSView *subs[count];
NSUInteger i;
[sb getObjects: subs];
for (i = 0; i < count; ++i)
{
if (![subs[i] isHidden])
(*ccImp)(self, ccSel, subs[i], theEvent);
}
}
}
// As we add the events to the front of the queue, we need to add the last
// events first. That is, first the enter evnts from inner to outer and
// then the exit events
checkCursorRectanglesEntered(theView, theEvent, _lastPoint);
checkCursorRectanglesExited(theView, theEvent, _lastPoint);
//[GSServerForWindow(self) _printEventQueue];
}
- (void) _processResizeEvent
@ -3831,6 +3931,7 @@ resetCursorRectsForView(NSView *theView)
return;
}
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
if (wasKey == YES || [v acceptsFirstMouse: theEvent] == YES || ![self canBecomeKeyWindow])
{
if ([NSHelpManager isContextHelpModeActive])
@ -3911,6 +4012,7 @@ resetCursorRectsForView(NSView *theView)
switch (type)
{
case NSLeftMouseDragged:
// Testplant-MAL-2015-07-08: keeping testplant branch code...
if (_lastLeftMouseDownView)
[_lastLeftMouseDownView mouseDragged: theEvent];
else
@ -3962,7 +4064,9 @@ resetCursorRectsForView(NSView *theView)
* cursor update event.
*/
if (_f.cursor_rects_enabled)
{
(*ccImp)(self, ccSel, _wv, theEvent);
}
}
_lastPoint = [theEvent locationInWindow];
@ -4005,13 +4109,25 @@ resetCursorRectsForView(NSView *theView)
GSTrackingRect *r =(GSTrackingRect*)[theEvent userData];
NSCursor *c = (NSCursor*)[r owner];
// Don't update the cursor if the window isn't the key window.
if (!_f.is_key)
break;
// Don't update the cursor if the window isn't the key window.
if (!_f.is_key)
{
break;
}
if ([theEvent trackingNumber]) // It's a mouse entered
{
[c mouseEntered: theEvent];
/* Only send the event mouse entered if the
* cursor rectangle is valid. */
if ([r isValid])
{
[c mouseEntered: theEvent];
/* This could seems redundant, but ensure the correct
* value to use in events mouse moved. And avoids strange
* issues with cursor. */
_lastPoint = [theEvent locationInWindow];
}
}
else // it is a mouse exited
{
@ -4186,7 +4302,9 @@ resetCursorRectsForView(NSView *theView)
* to determine if we should send a cursor update
* event. */
if (_f.cursor_rects_enabled)
(*ccImp)(self, ccSel, _wv, theEvent);
{
checkCursorRectanglesExited(_wv, theEvent, _lastPoint);
}
}
_lastPoint = NSMakePoint(-1, -1);
@ -4356,6 +4474,7 @@ resetCursorRectsForView(NSView *theView)
@selector(concludeDragOperation:), dragInfo);
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
// Check for specific cleanup after drag methods...
if ([_lastDragView respondsToSelector: @selector(cleanUpAfterDragOperation)])
{
@ -4823,6 +4942,7 @@ current key view.<br />
}
sRect.size.height = value;
// Testplant-MAL-2015-07-08: keeping testplant branch code...
#if defined(__MINGW__)
// Finally, this is for handling possible frame errors due to MSWindows sending
// x/y frame position of -32000/32893 on a minimize. These are now ignored in the
@ -4895,6 +5015,7 @@ current key view.<br />
fRect.origin.x = nRect.origin.x + (fRect.origin.x - nRect.origin.x)
* (nRect.size.width / sRect.size.width);
// Testplant-MAL-2015-07-08: keeping testplant branch code...
/*
* If width of the window goes beyond the screen width, then adjust the window over.
*/
@ -4917,6 +5038,7 @@ current key view.<br />
}
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
// Another sanity check...
// Check again whether new window frame shows up on ANY screen...
if ([self _screenForFrame: fRect] == nil)
@ -4998,6 +5120,7 @@ current key view.<br />
fRect.origin.y += menuBarHeight;
}
// Testplant-MAL-2015-07-08: keeping testplant branch code...
// If window doesn't show up on any screen then just include main screen frame...
NSScreen *myScreen = [self _screen];
/*
@ -5113,10 +5236,10 @@ current key view.<br />
maxRect = [self constrainFrameRect: maxRect toScreen: [self _screen]];
// Compare the new frame with the current one
if ((abs(NSMaxX(maxRect) - NSMaxX(_frame)) < DIST)
&& (abs(NSMaxY(maxRect) - NSMaxY(_frame)) < DIST)
&& (abs(NSMinX(maxRect) - NSMinX(_frame)) < DIST)
&& (abs(NSMinY(maxRect) - NSMinY(_frame)) < DIST))
if ((fabs(NSMaxX(maxRect) - NSMaxX(_frame)) < DIST)
&& (fabs(NSMaxY(maxRect) - NSMaxY(_frame)) < DIST)
&& (fabs(NSMinX(maxRect) - NSMinX(_frame)) < DIST)
&& (fabs(NSMinY(maxRect) - NSMinY(_frame)) < DIST))
{
// Already in zoomed mode, reset user frame, if stored
if (_autosaveName != nil)
@ -5428,8 +5551,10 @@ current key view.<br />
[aCoder encodeObject: _miniaturizedTitle];
[aCoder encodeObject: _windowTitle];
[aCoder encodeSize: _minimumSize];
[aCoder encodeSize: _maximumSize];
// [aCoder encodeSize: _minimumSize];
// [aCoder encodeSize: _maximumSize];
[aCoder encodeSize: [self contentMinSize]];
[aCoder encodeSize: [self contentMaxSize]];
[aCoder encodeValueOfObjCType: @encode(NSInteger) at: &_windowLevel];
@ -5482,6 +5607,7 @@ current key view.<br />
NSBackingStoreType aBacking;
NSInteger level;
id obj;
int version = [aDecoder versionForClassName: @"NSWindow"];
aRect = [aDecoder decodeRect];
[aDecoder decodeValueOfObjCType: @encode(NSUInteger)
@ -5508,10 +5634,20 @@ current key view.<br />
obj = [aDecoder decodeObject];
[self setTitle: obj];
if (version < 3)
{
aSize = [aDecoder decodeSize];
[self setMinSize: aSize];
aSize = [aDecoder decodeSize];
[self setMaxSize: aSize];
}
else
{
aSize = [aDecoder decodeSize];
[self setContentMinSize: aSize];
aSize = [aDecoder decodeSize];
[self setContentMaxSize: aSize];
}
[aDecoder decodeValueOfObjCType: @encode(NSInteger)
at: &level];

View file

@ -28,7 +28,6 @@
#import <Foundation/NSArray.h>
#import <Foundation/NSBundle.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSException.h>
@ -356,6 +355,12 @@
}
[responder setNextResponder: [self nextResponder]];
[_window setWindowController: nil];
// Remove the delegate as well if set to the owner in the NIB file
if ([_window delegate] == _owner)
{
[_window setDelegate: nil];
}
}
ASSIGN(_window, aWindow);

View file

@ -73,6 +73,11 @@
#include <unistd.h> /* for L_SET, etc definitions */
#endif /* !__WIN32__ */
#if !defined(TIFF_VERSION_CLASSIC)
// This only got added in version 4 of libtiff, but TIFFLIB_VERSION is unusable to differentiate here
typedef tsize_t tmsize_t;
#endif
typedef struct {
char* data;
long size;
@ -104,8 +109,8 @@ NSTiffWarning(const char *func, const char *msg, va_list ap)
}
/* Client functions that provide reading/writing of data for libtiff */
static tsize_t
TiffHandleRead(thandle_t handle, tdata_t buf, tsize_t count)
static tmsize_t
TiffHandleRead(thandle_t handle, void* buf, tmsize_t count)
{
chandle_t* chand = (chandle_t *)handle;
if (chand->position >= chand->size)
@ -116,8 +121,8 @@ TiffHandleRead(thandle_t handle, tdata_t buf, tsize_t count)
return count;
}
static tsize_t
TiffHandleWrite(thandle_t handle, tdata_t buf, tsize_t count)
static tmsize_t
TiffHandleWrite(thandle_t handle, void* buf, tmsize_t count)
{
chandle_t* chand = (chandle_t *)handle;
if (chand->mode == 'r')
@ -173,7 +178,7 @@ TiffHandleSize(thandle_t handle)
}
static int
TiffHandleMap(thandle_t handle, tdata_t* data, toff_t* size)
TiffHandleMap(thandle_t handle, void** data, toff_t* size)
{
chandle_t* chand = (chandle_t *)handle;
@ -184,7 +189,7 @@ TiffHandleMap(thandle_t handle, tdata_t* data, toff_t* size)
}
static void
TiffHandleUnmap(thandle_t handle, tdata_t data, toff_t size)
TiffHandleUnmap(thandle_t handle, void* data, toff_t size)
{
/* Nothing to unmap. */
}
@ -366,7 +371,7 @@ NSTiffRead(TIFF *image, NSTiffInfo *info, unsigned char *data)
uint8* buf;
uint8* raster;
NSTiffColormap* map;
int scan_line_size;
tmsize_t scan_line_size;
if (data == NULL)
return -1;
@ -466,12 +471,12 @@ NSTiffRead(TIFF *image, NSTiffInfo *info, unsigned char *data)
int
NSTiffWrite(TIFF *image, NSTiffInfo *info, unsigned char *data)
{
tdata_t buf = (tdata_t)data;
void* buf = (void*)data;
uint16 sample_info[2];
int i;
unsigned int row;
int error = 0;
int scan_line_size;
tmsize_t scan_line_size;
TIFFSetField(image, TIFFTAG_IMAGEWIDTH, info->width);
TIFFSetField(image, TIFFTAG_IMAGELENGTH, info->height);

View file

@ -49,6 +49,6 @@ check::
gnustep-tests gui
clean::
gnustep-tests --clean
-gnustep-tests --clean
include $(GNUSTEP_MAKEFILES)/rules.make

View file

View file

@ -0,0 +1,37 @@
#import "ObjectTesting.h"
#import <Foundation/NSArray.h>
#import <Foundation/NSAutoreleasePool.h>
#import <AppKit/NSApplication.h>
#import <AppKit/NSBitmapImageRep.h>
#import <AppKit/NSGraphics.h>
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSBitmapImageRep *origBitmap, *copy1Bitmap, *copy2Bitmap;
origBitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL
pixelsWide: 4
pixelsHigh: 4
bitsPerSample: 8
samplesPerPixel: 4
hasAlpha: YES
isPlanar: NO
colorSpaceName: NSCalibratedRGBColorSpace
bytesPerRow: 0
bitsPerPixel: 0];
copy1Bitmap = [origBitmap copy];
// Copying immutable NSData reuses the data pointer instead of allocating new memory, so
// copying a bitmap with immutable _imageData causes both bitmaps to point to the same memory;
// Writing to either copy's pixels will overwrite both, corrupting the image data
copy2Bitmap = [copy1Bitmap copy];
pass([copy1Bitmap bitmapData] != [copy2Bitmap bitmapData],
"Copied bitmaps have a different image data pointer - could cause image data corruption.");
[arp release];
return 0;
}

View file

@ -284,6 +284,9 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
- (void) appendString: (NSString*)string;
- (void) appendHelpLink: (NSString*)fileName marker: (NSString *)markerName;
- (void) appendHelpMarker: (NSString*)markerName;
- (void) appendField: (int)start
instruction: (NSString*)instruction;
- (void) appendImage: (NSString*) string;
- (void) reset;
@end
@ -407,12 +410,6 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
@end
@interface RTFDConsumer (Private)
- (void) appendImage: (NSString*) string;
@end
@implementation RTFDConsumer
- (id) init
@ -778,6 +775,43 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
}
}
- (void) appendField: (int)start
instruction: (NSString*)instruction
{
if (!ignore)
{
int oldPosition = start;
int textlen = [result length] - start;
NSRange insertionRange = NSMakeRange(oldPosition, textlen);
if ([instruction hasPrefix: @"HYPERLINK "])
{
NSDictionary *attributes;
NSString *link = [instruction substringFromIndex: 10];
if ([link characterAtIndex: 0] == (unichar)'\"')
{
link = [link substringWithRange: NSMakeRange(1, [link length] - 2)];
}
attributes = [[NSDictionary alloc]
initWithObjectsAndKeys:
link, NSLinkAttributeName,
[NSNumber numberWithInt : 1], NSUnderlineStyleAttributeName,
[NSColor blueColor], NSForegroundColorAttributeName,
nil];
[result addAttributes: attributes
range: insertionRange];
DESTROY(attributes);
}
}
}
- (void) appendImage: (NSString*)string
{
// Do nothing for RTF
}
@end
#undef IGNORE
@ -843,6 +877,11 @@ void GSRTFstop (void *ctxt)
NSDebugLLog(@"RTFParser", @"End RTF parsing");
}
int GSRTFgetPosition(void *ctxt)
{
return [((RTFConsumer *)ctxt)->result length];
}
void GSRTFopenBlock (void *ctxt, BOOL ignore)
{
if (!IGNORE)
@ -902,8 +941,8 @@ void GSRTFregisterFont (void *ctxt, const char *fontName,
if (!fontName || !*fontName)
{
[NSException raise: NSInvalidArgumentException
format: @"Error in RTF (font omitted?), position:%d",
TEXTPOSITION];
format: @"Error in RTF (font omitted?), position:%lu",
(unsigned long) TEXTPOSITION];
}
// exclude trailing ';' from fontName
if (';' == fontName[strlen(fontName)-1])
@ -928,9 +967,9 @@ void GSRTFfontNumber (void *ctxt, int fontNumber)
{
/* we're about to set an unknown font */
[NSException raise: NSInvalidArgumentException
format: @"Error in RTF (referring to undefined font \\f%d), position:%d",
format: @"Error in RTF (referring to undefined font \\f%d), position:%lu",
fontNumber,
TEXTPOSITION];
(unsigned long) TEXTPOSITION];
}
else
{
@ -1349,3 +1388,18 @@ void GSRTFNeXTHelpMarker (void *ctxt, int num, const char *markername)
[(RTFDConsumer *)ctxt appendHelpMarker: markerName];
}
void GSRTFaddField (void *ctxt, int start, const char *inst)
{
NSString *fieldInstruction;
// Ignore leading blanks
while (inst[0] == ' ')
{
inst++;
}
fieldInstruction = [[NSString alloc] initWithCString: inst
encoding: ENCODING];
[(RTFDConsumer *)ctxt appendField: start instruction: fieldInstruction];
DESTROY(fieldInstruction);
}

View file

@ -46,6 +46,9 @@ void GSRTFstart(void *ctxt);
/* seal the parsing process, the context or whatever you want */
void GSRTFstop(void *ctxt);
/* */
int GSRTFgetPosition(void *ctxt);
/*
* those pairing functions enclose RTFBlocks. Use it to capture the
* hierarchical attribute changes of blocks. i.e. attributes of a
@ -147,5 +150,7 @@ void GSRTFNeXTHelpLink(void *ctxt, int num, const char *markername,
/* NeXTHelpMarker */
void GSRTFNeXTHelpMarker(void *ctxt, int num, const char *markername);
void GSRTFaddField (void *ctxt, int start, const char *inst);
#endif

View file

@ -1,10 +1,8 @@
/* A Bison parser, made by GNU Bison 2.7. */
/* A Bison parser, made by GNU Bison 2.4.1. */
/* Bison interface for Yacc-like parsers in C
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -32,6 +30,15 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_GSRTF_RTFGRAMMAR_TAB_H_INCLUDED
# define YY_GSRTF_RTFGRAMMAR_TAB_H_INCLUDED
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int GSRTFdebug;
#endif
/* Tokens. */
#ifndef YYTOKENTYPE
@ -63,97 +70,104 @@
RTFemspace = 279,
RTFenspace = 280,
RTFbullet = 281,
RTFlquote = 282,
RTFrquote = 283,
RTFldblquote = 284,
RTFrdblquote = 285,
RTFred = 286,
RTFgreen = 287,
RTFblue = 288,
RTFcolorbg = 289,
RTFcolorfg = 290,
RTFunderlinecolor = 291,
RTFcolortable = 292,
RTFfont = 293,
RTFfontSize = 294,
RTFNeXTGraphic = 295,
RTFNeXTGraphicWidth = 296,
RTFNeXTGraphicHeight = 297,
RTFNeXTHelpLink = 298,
RTFNeXTHelpMarker = 299,
RTFNeXTfilename = 300,
RTFNeXTmarkername = 301,
RTFNeXTlinkFilename = 302,
RTFNeXTlinkMarkername = 303,
RTFpaperWidth = 304,
RTFpaperHeight = 305,
RTFmarginLeft = 306,
RTFmarginRight = 307,
RTFmarginTop = 308,
RTFmarginButtom = 309,
RTFfirstLineIndent = 310,
RTFleftIndent = 311,
RTFrightIndent = 312,
RTFalignCenter = 313,
RTFalignJustified = 314,
RTFalignLeft = 315,
RTFalignRight = 316,
RTFlineSpace = 317,
RTFspaceAbove = 318,
RTFstyle = 319,
RTFbold = 320,
RTFitalic = 321,
RTFunderline = 322,
RTFunderlineDot = 323,
RTFunderlineDash = 324,
RTFunderlineDashDot = 325,
RTFunderlineDashDotDot = 326,
RTFunderlineDouble = 327,
RTFunderlineStop = 328,
RTFunderlineThick = 329,
RTFunderlineThickDot = 330,
RTFunderlineThickDash = 331,
RTFunderlineThickDashDot = 332,
RTFunderlineThickDashDotDot = 333,
RTFunderlineWord = 334,
RTFstrikethrough = 335,
RTFstrikethroughDouble = 336,
RTFunichar = 337,
RTFsubscript = 338,
RTFsuperscript = 339,
RTFtabstop = 340,
RTFfcharset = 341,
RTFfprq = 342,
RTFcpg = 343,
RTFOtherStatement = 344,
RTFfontListStart = 345,
RTFfamilyNil = 346,
RTFfamilyRoman = 347,
RTFfamilySwiss = 348,
RTFfamilyModern = 349,
RTFfamilyScript = 350,
RTFfamilyDecor = 351,
RTFfamilyTech = 352
RTFfield = 282,
RTFfldinst = 283,
RTFfldalt = 284,
RTFfldrslt = 285,
RTFflddirty = 286,
RTFfldedit = 287,
RTFfldlock = 288,
RTFfldpriv = 289,
RTFfttruetype = 290,
RTFlquote = 291,
RTFrquote = 292,
RTFldblquote = 293,
RTFrdblquote = 294,
RTFred = 295,
RTFgreen = 296,
RTFblue = 297,
RTFcolorbg = 298,
RTFcolorfg = 299,
RTFunderlinecolor = 300,
RTFcolortable = 301,
RTFfont = 302,
RTFfontSize = 303,
RTFNeXTGraphic = 304,
RTFNeXTGraphicWidth = 305,
RTFNeXTGraphicHeight = 306,
RTFNeXTHelpLink = 307,
RTFNeXTHelpMarker = 308,
RTFNeXTfilename = 309,
RTFNeXTmarkername = 310,
RTFNeXTlinkFilename = 311,
RTFNeXTlinkMarkername = 312,
RTFpaperWidth = 313,
RTFpaperHeight = 314,
RTFmarginLeft = 315,
RTFmarginRight = 316,
RTFmarginTop = 317,
RTFmarginButtom = 318,
RTFfirstLineIndent = 319,
RTFleftIndent = 320,
RTFrightIndent = 321,
RTFalignCenter = 322,
RTFalignJustified = 323,
RTFalignLeft = 324,
RTFalignRight = 325,
RTFlineSpace = 326,
RTFspaceAbove = 327,
RTFstyle = 328,
RTFbold = 329,
RTFitalic = 330,
RTFunderline = 331,
RTFunderlineDot = 332,
RTFunderlineDash = 333,
RTFunderlineDashDot = 334,
RTFunderlineDashDotDot = 335,
RTFunderlineDouble = 336,
RTFunderlineStop = 337,
RTFunderlineThick = 338,
RTFunderlineThickDot = 339,
RTFunderlineThickDash = 340,
RTFunderlineThickDashDot = 341,
RTFunderlineThickDashDotDot = 342,
RTFunderlineWord = 343,
RTFstrikethrough = 344,
RTFstrikethroughDouble = 345,
RTFunichar = 346,
RTFsubscript = 347,
RTFsuperscript = 348,
RTFtabstop = 349,
RTFfcharset = 350,
RTFfprq = 351,
RTFcpg = 352,
RTFOtherStatement = 353,
RTFfontListStart = 354,
RTFfamilyNil = 355,
RTFfamilyRoman = 356,
RTFfamilySwiss = 357,
RTFfamilyModern = 358,
RTFfamilyScript = 359,
RTFfamilyDecor = 360,
RTFfamilyTech = 361,
RTFfamilyBiDi = 362
};
#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 1676 of yacc.c */
#line 82 "rtfGrammar.y"
/* Line 2058 of yacc.c */
#line 85 "rtfGrammar.y"
int number;
const char *text;
RTFcmd cmd;
/* Line 1676 of yacc.c */
#line 157 "rtfGrammar.tab.h"
/* Line 2058 of yacc.c */
#line 171 "rtfGrammar.tab.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@ -161,5 +175,18 @@ typedef union YYSTYPE
#endif
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int GSRTFparse (void *YYPARSE_PARAM);
#else
int GSRTFparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int GSRTFparse (void *ctxt, void *lctxt);
#else
int GSRTFparse ();
#endif
#endif /* ! YYPARSE_PARAM */
#endif /* !YY_GSRTF_RTFGRAMMAR_TAB_H_INCLUDED */

File diff suppressed because it is too large Load diff

View file

@ -68,12 +68,15 @@ typedef void *GSRTFctxt;
#define CTXT ctxt
#define YYERROR_VERBOSE
#define YYDEBUG 0
#define YYDEBUG 1
#include "RTFConsumerFunctions.h"
/*int GSRTFlex (YYSTYPE *lvalp, RTFscannerCtxt *lctxt); */
int GSRTFlex(void *lvalp, void *lctxt);
/* */
int fieldStart = 0;
%}
%parse-param {void *ctxt}
@ -110,6 +113,15 @@ int GSRTFlex(void *lvalp, void *lctxt);
%token RTFemspace
%token RTFenspace
%token RTFbullet
%token RTFfield
%token RTFfldinst
%token RTFfldalt
%token RTFfldrslt
%token RTFflddirty
%token RTFfldedit
%token RTFfldlock
%token RTFfldpriv
%token RTFfttruetype
%token RTFlquote
%token RTFrquote
%token RTFldblquote
@ -185,25 +197,27 @@ int GSRTFlex(void *lvalp, void *lctxt);
%token RTFfamilyScript
%token RTFfamilyDecor
%token RTFfamilyTech
%token RTFfamilyBiDi
%type <number> rtfFontFamily rtfCharset rtfFontStatement
%type <text> rtfFieldinst
/* let's go */
%%
rtfFile: '{' { GSRTFstart(CTXT); } RTFstart rtfCharset rtfIngredients { GSRTFstop(CTXT); } '}'
rtfFile: '{' { GSRTFstart(CTXT); } RTFstart rtfIngredients { GSRTFstop(CTXT); } '}'
;
/* FIXME: This should change the used encoding */
rtfCharset: RTFansi { $$ = 1; }
| RTFmac { $$ = 2; }
| RTFpc { $$ = 3; }
| RTFpca { $$ = 4; }
/* If it's an unknown character set, assume ansi. */
| RTFOtherStatement { $$ = 1; free((void*)$1.name); }
;
rtfIngredients: /* empty */
| rtfIngredients rtfCharset
| rtfIngredients rtfFontList
| rtfIngredients rtfColorDef
| rtfIngredients rtfStatement
@ -220,10 +234,44 @@ rtfBlock: '{' { GSRTFopenBlock(CTXT, NO); } rtfIngredients rtfNeXTstuff '}' { GS
| '{' { GSRTFopenBlock(CTXT, YES); } RTFheader rtfIngredients '}' { GSRTFcloseBlock(CTXT, YES); }
| '{' { GSRTFopenBlock(CTXT, YES); } RTFfooter rtfIngredients '}' { GSRTFcloseBlock(CTXT, YES); }
| '{' { GSRTFopenBlock(CTXT, YES); } RTFpict rtfIngredients '}' { GSRTFcloseBlock(CTXT, YES); }
| '{' { GSRTFopenBlock(CTXT, NO); } RTFfield rtfField '}' { GSRTFcloseBlock(CTXT, NO); }
| '{' error '}'
;
rtfField: { fieldStart = GSRTFgetPosition(CTXT);} rtfFieldMod rtfFieldinst rtfFieldrslt { GSRTFaddField(CTXT, fieldStart, $3); free((void *)$3); }
| error
;
rtfFieldMod: /* empty */
| rtfFieldMod RTFflddirty
| rtfFieldMod RTFfldedit
| rtfFieldMod RTFfldlock
| rtfFieldMod RTFfldpriv
;
rtfIgnore: /* empty */
| RTFignore
;
rtfFieldinst: '{' rtfIgnore RTFfldinst RTFtext rtfFieldalt '}' { $$ = $4;}
| '{' rtfIgnore RTFfldinst '{' { GSRTFopenBlock(CTXT, YES); } rtfStatementList RTFtext rtfFieldalt '}' { GSRTFcloseBlock(CTXT, YES); } '}' { $$ = $7;}
| '{' error '}' { $$ = NULL;}
;
rtfFieldalt: /* empty */
| RTFfldalt
;
rtfFieldrslt: '{' rtfIgnore RTFfldrslt rtfIngredients '}'
| '{' error '}'
;
rtfStatementList: /* empty */
| rtfStatementList rtfStatement
| rtfStatementList rtfBlock
;
/*
RTF statements start with a '\', have a alpha name and a number argument
*/
@ -542,12 +590,19 @@ rtfFonts:
/* RTFtext introduces the fontName */
rtfFontStatement: RTFfont rtfFontFamily rtfFontAttrs RTFtext { GSRTFregisterFont(CTXT, $4, $2, $1.parameter);
free((void *)$4); }
/* fbidi should be a font family, but it seems to be used differently */
| RTFfont RTFfamilyBiDi rtfFontFamily rtfFontAttrs RTFtext { GSRTFregisterFont(CTXT, $5, $3, $1.parameter);
free((void *)$5); }
/* Theme fonts */
| RTFOtherStatement RTFfont RTFfamilyBiDi rtfFontFamily rtfFontAttrs RTFtext { GSRTFregisterFont(CTXT, $6, $4, $2.parameter);
free((void *)$6); }
;
rtfFontAttrs: /* empty */
| rtfFontAttrs RTFfcharset
| rtfFontAttrs RTFfprq
| rtfFontAttrs RTFcpg
| rtfFontAttrs RTFfttruetype
| rtfFontAttrs rtfBlock
;

View file

@ -177,10 +177,19 @@ LexKeyword RTFcommands[] =
{"endash", token(RTFendash)},
{"enspace", token(RTFenspace)},
{"f", token(RTFfont)},
{"fbidi", token(RTFfamilyBiDi)},
{"fcharset", token(RTFfcharset)},
{"fdecor", token(RTFfamilyDecor)},
{"fi", token(RTFfirstLineIndent)},
{"field", token(RTFfield)},
{"filename", token(RTFNeXTfilename)},
{"fldalt", token(RTFfldalt)},
{"flddirty", token(RTFflddirty)},
{"fldedit", token(RTFfldedit)},
{"fldinst", token(RTFfldinst)},
{"fldlock", token(RTFfldlock)},
{"fldpriv", token(RTFfldpriv)},
{"fldrslt", token(RTFfldrslt)},
{"fmodern", token(RTFfamilyModern)},
{"fnil", token(RTFfamilyNil)},
{"fonttbl", token(RTFfontListStart)},
@ -196,6 +205,7 @@ LexKeyword RTFcommands[] =
{"fscript", token(RTFfamilyScript)},
{"fswiss", token(RTFfamilySwiss)},
{"ftech", token(RTFfamilyTech)},
{"fttruetype", token(RTFfttruetype)},
{"green", token(RTFgreen)},
/* All headers are mapped on one entry */
{"header", token(RTFheader)},