Merge GUI with trunk revision 40072

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@40119 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2016-10-04 22:11:05 +00:00
parent 3b3388e8ad
commit a1d62943a6
15 changed files with 508 additions and 180 deletions

View file

@ -179,6 +179,7 @@ APPKIT_EXPORT NSString *GSScreenNumber;
@end
// Testplant-MAL-10042016: support for checking running services i.e. bonjour
/* ----------------------------------------------------------------------- */
/* GNUstep Window operations */
/* ----------------------------------------------------------------------- */

View file

@ -341,4 +341,31 @@ typedef struct _GSWindowTemplateFlags
- (void) setKeyPath: (NSString *)keyPath;
- (void) setOptions: (NSDictionary *)options;
@end
@interface NSIBUserDefinedRuntimeAttributesConnector : NSObject <NSCoding>
{
id _object;
NSArray *_keyPaths;
NSArray *_values;
}
- (void) instantiateWithObjectInstantiator: (id)instantiator;
- (void) establishConnection;
/*
- (void) replaceObject: (id)anObject withObject: (id)anotherObject;
- (void) setLabel: (id)label;
- (id) label;
- (void) setDestination: (id)destination;
- (id) destination;
- (void) setSource: (id)source;
- (id) source;
*/
- (void) setObject: (id)object;
- (id) object;
- (void) setValues: (id)values;
- (id) values;
- (void) setKeyPaths: (id)keyPaths;
- (id) keyPaths;
@end
#endif /* _GNUstep_H_GSNibCompatibility */

View file

@ -1057,8 +1057,10 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
*
* <p>The title color is mapped to the theme state as described below:</p>
* <deflist>
* <item>GSThemeSelectedState</item><desc>[NSColor+selectedMenuItemTextColor]</desc>
* <item>GSThemeDisabledState</item><desc>[NSColor+controlTextColor] or
* <term>GSThemeSelectedState</term>
* <desc>[NSColor+selectedMenuItemTextColor]</desc>
* <term>GSThemeDisabledState</term>
* <desc>[NSColor+controlTextColor] or
* [NSColor+disabledControlTextColor]</desc>
* </deflist>
*/
@ -1080,7 +1082,8 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
*/
- (NSColor *) menuSeparatorColor;
/**
* <p>Returns the left and right inset used to draw a separator line in a menu.</p>
* <p>Returns the left and right inset used to draw a separator line in a
* menu.</p>
*
* <p>By default, returns 3.0.</p>
*
@ -1113,7 +1116,7 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
* -isSeparatorItem</p>
*
* <p>You can provide an image tile named <em>GSMenuSeparatorItem</em> to
* draw the separator.</br>
* draw the separator.<br />
* Can be overridden in subclasses to customize the drawing.</p>
*
* <p>See also -menuSeparatorColor and -menuSeparatorInset</p>

View file

@ -27,7 +27,7 @@
/* Define to 1 if you have the `GifQuantizeBuffer' function. */
#undef HAVE_GIFQUANTIZEBUFFER
/* Have ImageMagick */
/* Don't have ImageMagick */
#undef HAVE_IMAGEMAGICK
/* Define to 1 if you have the <inttypes.h> header file. */
@ -84,6 +84,12 @@
/* Define to 1 if you have the <sndfile.h> header file. */
#undef HAVE_SNDFILE_H
/* Define to 1 if you have the `statfs' function. */
#undef HAVE_STATFS
/* Define to 1 if you have the `statvfs' function. */
#undef HAVE_STATVFS
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
@ -96,6 +102,18 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if `f_flags' is a member of `struct statfs'. */
#undef HAVE_STRUCT_STATFS_F_FLAGS
/* Define to 1 if `f_owner' is a member of `struct statfs'. */
#undef HAVE_STRUCT_STATFS_F_OWNER
/* Define to 1 if `f_flag' is a member of `struct statvfs'. */
#undef HAVE_STRUCT_STATVFS_F_FLAG
/* Define to 1 if `f_owner' is a member of `struct statvfs'. */
#undef HAVE_STRUCT_STATVFS_F_OWNER
/* Define to 1 if you have the <sys/mntent.h> header file. */
#undef HAVE_SYS_MNTENT_H

View file

@ -67,8 +67,8 @@ enum {
id _delegate;
NSAlertStyle _style;
BOOL _shows_help;
BOOL _shows_suppression_button;
NSButton *_suppression_button;
BOOL _shows_suppression_button; // Testplant-MAL-10042016
NSButton *_suppression_button; // Testplant-MAL-10042016
id _modalDelegate;
SEL _didEndSelector;
NSInteger _result;
@ -108,6 +108,7 @@ enum {
- (id) window;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
// Testplant-MAL-10042016
- (BOOL)showsSuppressionButton;
- (void)setShowsSuppressionButton:(BOOL)showsSuppressionButton;
- (NSButton*)suppressionButton;

View file

@ -447,6 +447,13 @@ typedef NSInteger NSBackgroundStyle;
inRect:(NSRect)cellFrame
ofView:(NSView *)controlView
untilMouseUp:(BOOL)flag;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
- (NSBackgroundStyle)backgroundStyle;
- (void)setBackgroundStyle:(NSBackgroundStyle)backgroundStyle;
- (NSUInteger)hitTestForEvent:(NSEvent *)event
inRect:(NSRect)cellFrame
ofView:(NSView *)controlView;
#endif
//
// Managing the Cursor
@ -521,12 +528,6 @@ typedef NSInteger NSBackgroundStyle;
- (void)setAllowsUndo:(BOOL)flag;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
- (NSBackgroundStyle)backgroundStyle;
- (void)setBackgroundStyle:(NSBackgroundStyle)backgroundStyle;
- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)controlView;
#endif
@end
//

View file

@ -124,8 +124,8 @@ backgroundColorHint:(NSColor *)bg
+ (NSCursor*) resizeRightCursor;
+ (NSCursor*) resizeUpCursor;
+ (NSCursor*) resizeUpDownCursor;
+ (NSCursor*) resizeNWSECursor;
+ (NSCursor*) resizeNESWCursor;
+ (NSCursor*) resizeNWSECursor; // Testplant-MAL-10042016
+ (NSCursor*) resizeNESWCursor; // Testplant-MAL-10042016
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
@ -157,9 +157,9 @@ typedef enum {
GSResizeDownCursor,
GSResizeUpDownCursor,
GSContextualMenuCursor,
GSDisappearingItemCursor,
GSResizeNWSECursor,
GSResizeNESWCursor
GSDisappearingItemCursor, // Testplant-MAL-10042016
GSResizeNWSECursor, // Testplant-MAL-10042016
GSResizeNESWCursor // Testplant-MAL-10042016
} GSCursorTypes;
#endif /* _GNUstep_H_NSCursor */

View file

@ -106,6 +106,31 @@
contextInfo: (void*)context;
- (NSError*) willPresentError: (NSError*)err;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
DEFINE_BLOCK_TYPE(GSCompletionBlock1, void, NSDocument*, BOOL, NSError*);
DEFINE_BLOCK_TYPE(GSCompletionBlock2, void, NSArray*);
- (id) duplicateDocumentWithContentsOfURL: (NSURL*)url
copying: (BOOL)duplicateByCopying
displayName: (NSString*)displayNameOrNil
error: (NSError**)outError;
- (void) openDocumentWithContentsOfURL: (NSURL*)url
display: (BOOL)displayDocument
completionHandler: (GSCompletionBlock1)completionHandler;
- (void) reopenDocumentForURL: (NSURL*)urlOrNil
withContentsOfURL: (NSURL*)contentsURL
display: (BOOL)displayDocument
completionHandler: (GSCompletionBlock1)completionHandler;
- (void) beginOpenPanelWithCompletionHandler: (GSCompletionBlock2)completionHandler;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST)
DEFINE_BLOCK_TYPE(GSCompletionBlock3, void, NSInteger);
- (void) beginOpenPanel: (NSOpenPanel*)openPanel
forTypes: (NSArray*)inTypes
completionHandler: (GSCompletionBlock3)completionHandler;
#endif
/*" With or without UI "*/
- (BOOL) shouldCreateUI;

View file

@ -48,9 +48,20 @@
/* Named images */
APPKIT_EXPORT NSString *NSImageNameMultipleDocuments;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
APPKIT_EXPORT NSString *NSImageNameUserAccounts;
APPKIT_EXPORT NSString *NSImageNamePreferencesGeneral;
APPKIT_EXPORT NSString *NSImageNameAdvanced;
APPKIT_EXPORT NSString *NSImageNameInfo;
APPKIT_EXPORT NSString *NSImageNameFontPanel;
APPKIT_EXPORT NSString *NSImageNameColorPanel;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
APPKIT_EXPORT NSString *NSImageNameTrashEmpty;
APPKIT_EXPORT NSString *NSImageNameTrashFull;
APPKIT_EXPORT NSString *NSImageNameColorPanel;
APPKIT_EXPORT NSString *NSImageNameCaution;
#endif
/** Defines how an NSImage is to be cached. Possible values are:
* <list>

View file

@ -1,7 +1,7 @@
/*
NSMatrix.h
Copyright (C) 1996,1997,1999 Free Software Foundation, Inc.
Copyright (C) 1996-2015 Free Software Foundation, Inc.
Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: March 1997
@ -49,14 +49,17 @@ typedef enum _NSMatrixMode {
NSTrackModeMatrix
} NSMatrixMode;
@protocol NSMatrixDelegate <NSControlTextEditingDelegate>
@end
@interface NSMatrix : NSControl <NSCoding>
{
__strong id **_cells;
BOOL **_selectedCells;
int _maxRows;
int _maxCols;
int _numRows;
int _numCols;
NSInteger _maxRows;
NSInteger _maxCols;
NSInteger _numRows;
NSInteger _numCols;
NSZone *_myZone;
Class _cellClass;
id _cellPrototype;
@ -75,8 +78,8 @@ typedef enum _NSMatrixMode {
SEL _doubleAction;
SEL _errorAction;
id _selectedCell;
int _selectedRow;
int _selectedColumn;
NSInteger _selectedRow;
NSInteger _selectedColumn;
BOOL _allowsEmptySelection;
BOOL _selectionByRect;
BOOL _drawsBackground;
@ -84,8 +87,8 @@ typedef enum _NSMatrixMode {
BOOL _autosizesCells;
BOOL _autoscroll;
id _reserved1;
int _dottedRow;
int _dottedColumn;
NSInteger _dottedRow;
NSInteger _dottedColumn;
}
/*
@ -304,6 +307,12 @@ typedef enum _NSMatrixMode {
*/
- (void) resetCursorRects;
/*
* Handling tool tips
*/
- (NSString *) toolTipForCell: (NSCell *)cell;
- (void) setToolTip: (NSString *)toolTipString forCell: (NSCell *)cell;
@end
#endif /* _GNUstep_H_NSMatrix */

View file

@ -825,5 +825,7 @@ APPKIT_EXPORT NSString* const NSMenuWillSendActionNotification;
APPKIT_EXPORT NSString* const NSMenuDidAddItemNotification;
APPKIT_EXPORT NSString* const NSMenuDidRemoveItemNotification;
APPKIT_EXPORT NSString* const NSMenuDidChangeItemNotification;
APPKIT_EXPORT NSString* const NSMenuDidBeginTrackingNotification;
APPKIT_EXPORT NSString* const NSMenuDidEndTrackingNotification;
#endif // _GNUstep_H_NSMenu

View file

@ -505,14 +505,11 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
}
[self addDocument: document];
if ([self shouldCreateUI])
if (display)
{
[document makeWindowControllers];
if (display)
{
[document showWindows];
}
}
return document;
}
@ -520,7 +517,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
/**
* Creates an [NSDocument] object from the data at the absolute path
* given in fileName. Causes the document to be displayed if display
* is YES, unless the -shouldCreateUI method returns NO.
* is YES.
*/
- (id) openDocumentWithContentsOfFile: (NSString*)fileName
display: (BOOL)display
@ -540,7 +537,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
[self addDocument: document];
if ([self shouldCreateUI])
if (display)
{
[document makeWindowControllers];
}
@ -549,7 +546,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
// remember this document as opened
[self noteNewRecentDocument: document];
if (display && [self shouldCreateUI])
if (display)
{
[document showWindows];
}
@ -560,7 +557,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
/**
* Creates an [NSDocument] object from the data at the supplied url.<br />
* Causes the document to be displayed if display
* is YES, unless the -shouldCreateUI method returns NO.
* is YES.
*/
- (id) openDocumentWithContentsOfURL: (NSURL *)url display: (BOOL)display
{
@ -579,7 +576,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
[self addDocument: document];
if ([self shouldCreateUI])
if (display)
{
[document makeWindowControllers];
}
@ -588,7 +585,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
// remember this document as opened
[self noteNewRecentDocument: document];
if (display && [self shouldCreateUI])
if (display)
{
[document showWindows];
}
@ -596,7 +593,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
return document;
}
- (id) openUntitledDocumentAndDisplay: (BOOL)flag
- (id) openUntitledDocumentAndDisplay: (BOOL)display
error: (NSError **)err
{
NSString *type;
@ -605,7 +602,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
if (OVERRIDDEN(openUntitledDocumentOfType:display:))
{
return [self openUntitledDocumentOfType: type display: flag];
return [self openUntitledDocumentOfType: type display: display];
}
else
{
@ -618,27 +615,24 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
}
[self addDocument: document];
if ([self shouldCreateUI])
if (display)
{
[document makeWindowControllers];
if (flag)
{
[document showWindows];
}
}
return document;
}
}
- (id) openDocumentWithContentsOfURL: (NSURL *)url
display: (BOOL)flag
display: (BOOL)display
error: (NSError **)err
{
if (OVERRIDDEN(openDocumentWithContentsOfFile:display:) && [url isFileURL])
{
return [self openDocumentWithContentsOfFile: [url path]
display: flag];
display: display];
}
else
{
@ -664,7 +658,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
[self addDocument: document];
if ([self shouldCreateUI])
if (display)
{
[document makeWindowControllers];
}
@ -673,7 +667,7 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
// remember this document as opened
[self noteNewRecentDocument: document];
if (flag && [self shouldCreateUI])
if (display)
{
[document showWindows];
}
@ -682,6 +676,77 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
}
}
- (void) openDocumentWithContentsOfURL: (NSURL*)url
display: (BOOL)display
completionHandler: (GSCompletionBlock1)completionHandler
{
NSError *err = nil;
BOOL existing = NO;
if (OVERRIDDEN(openDocumentWithContentsOfURL:display:error:))
{
NSDocument *document = [self openDocumentWithContentsOfURL: url
display: display
error: &err];
CALL_BLOCK(completionHandler, document, existing, err);
}
else
{
if (OVERRIDDEN(openDocumentWithContentsOfFile:display:) && [url isFileURL])
{
NSDocument *document = [self openDocumentWithContentsOfFile: [url path]
display: display];
CALL_BLOCK(completionHandler, document, existing, err);
}
else
{
NSDocument *document = [self documentForURL: url];
if (document == nil)
{
NSString *type = [self typeForContentsOfURL: url error: &err];
if (type == nil)
{
CALL_BLOCK(completionHandler, document, existing, err);
return;
}
document = [self makeDocumentWithContentsOfURL: url
ofType: type
error: &err];
if (document == nil)
{
CALL_BLOCK(completionHandler, document, existing, err);
return;
}
[self addDocument: document];
if (display)
{
[document makeWindowControllers];
}
}
else
{
existing = YES;
}
// remember this document as opened
[self noteNewRecentDocument: document];
if (display)
{
[document showWindows];
}
CALL_BLOCK(completionHandler, document, existing, err);
}
}
}
- (BOOL) reopenDocumentForURL: (NSURL *)url
withContentsOfURL: (NSURL *)contents
error: (NSError **)err
@ -712,6 +777,53 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
return NO;
}
- (void) reopenDocumentForURL: (NSURL*)url
withContentsOfURL: (NSURL*)contents
display: (BOOL)display
completionHandler: (GSCompletionBlock1)completionHandler
{
NSError *err = nil;
BOOL existing = NO;
if (OVERRIDDEN(reopenDocumentForURL:withContentsOfURL:error:))
{
[self reopenDocumentForURL: url
withContentsOfURL: contents
error: &err];
}
else
{
NSDocument *document = nil;
NSString *type = [self typeForContentsOfURL: contents error: &err];
if (type == nil)
{
CALL_BLOCK(completionHandler, document, existing, err);
return;
}
document = [self makeDocumentForURL: url
withContentsOfURL: contents
ofType: type
error: &err];
if (document)
{
[self addDocument:document];
// remember this document as opened
[self noteNewRecentDocument: document];
if ([self shouldCreateUI])
{
[document makeWindowControllers];
[document showWindows];
}
}
CALL_BLOCK(completionHandler, document, existing, err);
}
}
- (NSOpenPanel *) _setupOpenPanel
{
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
@ -783,6 +895,50 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
return nil;
}
- (void) beginOpenPanelWithCompletionHandler: (GSCompletionBlock2)completionHandler
{
if (OVERRIDDEN(URLsFromRunningOpenPanel) || OVERRIDDEN(runModalOpenPanel:forTypes:))
{
NSArray *urls = [self URLsFromRunningOpenPanel];
CALL_BLOCK(completionHandler, urls);
return;
}
else
{
#if __has_feature(blocks)
NSArray *types = [self _openableFileExtensions];
__block NSOpenPanel *openPanel = [self _setupOpenPanel];
__block GSCompletionBlock2 ch = completionHandler;
GSCompletionBlock3 block =
^(NSInteger result)
{
if (result == NSOKButton)
{
CALL_BLOCK(ch, [openPanel URLs]);
}
else
{
CALL_BLOCK(ch, nil);
}
};
[self beginOpenPanel: openPanel forTypes: types completionHandler: block];
#else
NSArray *urls = [self URLsFromRunningOpenPanel];
CALL_BLOCK(completionHandler, urls);
#endif
}
}
- (void) beginOpenPanel: (NSOpenPanel*)openPanel
forTypes: (NSArray*)types
completionHandler: (GSCompletionBlock3)completionHandler
{
// FIXME
NSInteger result = [self runModalOpenPanel: openPanel forTypes: types];
CALL_BLOCK(completionHandler, result);
}
- (IBAction) saveAllDocuments: (id)sender
{
NSDocument *document;
@ -806,11 +962,25 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
urlEnum = [[self URLsFromRunningOpenPanel] objectEnumerator];
while ((url = [urlEnum nextObject]))
{
#if __has_feature(blocks)
GSCompletionBlock1 block =
^(NSDocument *document, BOOL existing, NSError *err)
{
if (err)
{
[self presentError: err];
}
};
[self openDocumentWithContentsOfURL: url display: YES completionHandler: block];
#else
// FIXME: Should be calling openDocumentWithContentsOfURL:display:completionHandler:
// but this requires Block support
[self openDocumentWithContentsOfURL: url display: YES error: &err];
if (err && ![self presentError: err])
{
break;
}
#endif
}
}
@ -980,6 +1150,14 @@ static BOOL _shouldClose = YES;
nil);
}
- (id) duplicateDocumentWithContentsOfURL: (NSURL*)url
copying: (BOOL)duplicateByCopying
displayName: (NSString*)displayNameOrNil
error: (NSError**)outError
{
// FIXME: Implementation missing
return nil;
}
#ifdef OPENSTEP_ONLY
/*
@ -1727,11 +1905,8 @@ static NSString *processName = nil;
[self openDocumentWithContentsOfURL: url display: YES error: &err];
if (err)
{
[self presentError: err];
[self _updateRecentDocumentsMenu];
}
}
- (void) _saveRecentDocuments
{

View file

@ -1641,7 +1641,7 @@ static NSSize GSResolutionOfImageRep(NSImageRep *rep)
count = [_reps count];
if (count == 0)
{
return [NSArray array];
return [NSMutableArray array];
}
else
{
@ -1658,7 +1658,7 @@ static NSSize GSResolutionOfImageRep(NSImageRep *rep)
j++;
}
}
return [NSArray arrayWithObjects: repList count: j];
return [NSMutableArray arrayWithObjects: repList count: j];
}
}
@ -2024,6 +2024,7 @@ static NSSize GSResolutionOfImageRep(NSImageRep *rep)
*/
if (rep == nil)
{
// Testplant-MAL-10042016: keeping branch code...
NSString *fileName = [[tmp absoluteString] lastPathComponent];
NSString *path = [[NSBundle mainBundle] pathForImageResource: fileName];
rep = [NSImageRep imageRepWithContentsOfFile: path];

View file

@ -2,7 +2,7 @@
<abstract>Matrix class for grouping controls</abstract>
Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
Copyright (C) 1996-2015 Free Software Foundation, Inc.
Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: March 1997
@ -118,15 +118,15 @@ static NSNotificationCenter *nc;
/* Some stuff needed to compute the selection in the list mode. */
typedef struct {
int x;
int y;
NSInteger x;
NSInteger y;
} MPoint;
typedef struct {
int x;
int y;
int width;
int height;
NSInteger x;
NSInteger y;
NSInteger width;
NSInteger height;
} MRect;
typedef struct _GSMatrixFlags {
@ -163,27 +163,27 @@ typedef struct _GSMatrixFlags {
#endif
} GSMatrixFlags;
static inline MPoint MakePoint (int x, int y)
static inline MPoint MakePoint (NSInteger x, NSInteger y)
{
MPoint point = { x, y };
return point;
}
@interface NSMatrix (PrivateMethods)
- (void) _renewRows: (int)row
columns: (int)col
rowSpace: (int)rowSpace
colSpace: (int)colSpace;
- (void) _setState: (int)state
- (void) _renewRows: (NSInteger)row
columns: (NSInteger)col
rowSpace: (NSInteger)rowSpace
colSpace: (NSInteger)colSpace;
- (void) _setState: (NSInteger)state
highlight: (BOOL)highlight
startIndex: (int)start
endIndex: (int)end;
- (BOOL) _selectNextSelectableCellAfterRow: (int)row
column: (int)column;
- (BOOL) _selectPreviousSelectableCellBeforeRow: (int)row
column: (int)column;
- (void) _setKeyRow: (int) row
column: (int) column;
startIndex: (NSInteger)start
endIndex: (NSInteger)end;
- (BOOL) _selectNextSelectableCellAfterRow: (NSInteger)row
column: (NSInteger)column;
- (BOOL) _selectPreviousSelectableCellBeforeRow: (NSInteger)row
column: (NSInteger)column;
- (void) _setKeyRow: (NSInteger)row
column: (NSInteger)column;
@end
enum {
@ -348,7 +348,9 @@ static SEL getSel;
numberOfColumns: (NSInteger)colsWide
{
if ( ! ( self = [super initWithFrame: frameRect] ) )
{
return nil;
}
[self setCellClass: classId];
[self _privateFrame: frameRect
@ -371,7 +373,9 @@ static SEL getSel;
numberOfColumns: (NSInteger)colsWide
{
if (! ( self = [super initWithFrame: frameRect] ) )
{
return nil;
}
[self setPrototype: aCell];
[self _privateFrame: frameRect
@ -400,11 +404,7 @@ static SEL getSel;
[_cells[i][j] release];
}
NSZoneFree(_myZone, _cells[i]);
#if GS_WITH_GC
_selectedCells[i] = 0;
#else
NSZoneFree(_myZone, _selectedCells[i]);
#endif
}
NSZoneFree(_myZone, _cells);
NSZoneFree(_myZone, _selectedCells);
@ -469,8 +469,8 @@ static SEL getSel;
*/
- (void) insertColumn: (NSInteger)column withCells: (NSArray*)cellArray
{
int count = [cellArray count];
int i = _numCols + 1;
NSInteger count = [cellArray count];
NSInteger i = _numCols + 1;
if (column < 0)
{
@ -483,6 +483,16 @@ static SEL getSel;
#endif
}
if ((cellArray != nil) && (count != _numRows))
{
#if NSMATRIX_STRICT_CHECKING == 0
NSLog(@"Wrong number of cells (%d) in column insert in matrix", (int)count);
#else
[NSException raise: NSRangeException
format: @"Wrong number of cells (%d) in column insert in matrix", (int)count];
#endif
}
if (column >= i)
{
i = column + 1;
@ -548,7 +558,11 @@ static SEL getSel;
if (_mode == NSRadioModeMatrix && _allowsEmptySelection == NO
&& _selectedCell == nil)
[self selectCellAtRow: 0 column: 0];
{
[self selectCellAtRow: 0 column: 0];
}
[self setNeedsDisplay: YES];
}
/**<p>Inserts a new row at index <var>row</var>.</p>
@ -566,8 +580,8 @@ static SEL getSel;
*/
- (void) insertRow: (NSInteger)row withCells: (NSArray*)cellArray
{
int count = [cellArray count];
int i = _numRows + 1;
NSInteger count = [cellArray count];
NSInteger i = _numRows + 1;
if (row < 0)
{
@ -580,6 +594,16 @@ static SEL getSel;
#endif
}
if ((cellArray != nil) && (count != _numCols))
{
#if NSMATRIX_STRICT_CHECKING == 0
NSLog(@"Wrong number of cells (%d) in row insert in matrix", (int)count);
#else
[NSException raise: NSRangeException
format: @"Wrong number of cells (%d) in row insert in matrix", (int)count];
#endif
}
if (row >= i)
{
i = row + 1;
@ -642,6 +666,8 @@ static SEL getSel;
{
[self selectCellAtRow: 0 column: 0];
}
[self setNeedsDisplay: YES];
}
/**<p>Makes and returns new cell at row <var>row</var> and
@ -731,11 +757,11 @@ static SEL getSel;
{
if (column >= 0 && column < _numCols)
{
int i;
NSInteger i;
for (i = 0; i < _maxRows; i++)
{
int j;
NSInteger j;
AUTORELEASE(_cells[i][column]);
for (j = column + 1; j < _maxCols; j++)
@ -784,15 +810,13 @@ static SEL getSel;
{
if (row >= 0 && row < _numRows)
{
int i;
NSInteger i;
#if GS_WITH_GC == 0
for (i = 0; i < _maxCols; i++)
{
[_cells[row][i] autorelease];
AUTORELEASE(_cells[row][i]);
}
NSZoneFree(_myZone, _selectedCells[row]);
#endif
NSZoneFree(_myZone, _cells[row]);
for (i = row + 1; i < _maxRows; i++)
{
@ -860,7 +884,7 @@ static SEL getSel;
NSMutableArray *sorted;
IMP add;
IMP get;
int i, j, index = 0;
NSInteger i, j, index = 0;
sorted = [NSMutableArray arrayWithCapacity: _numRows * _numCols];
add = [sorted methodForSelector: @selector(addObject:)];
@ -890,7 +914,7 @@ static SEL getSel;
NSMutableArray *sorted;
IMP add;
IMP get;
int i, j, index = 0;
NSInteger i, j, index = 0;
sorted = [NSMutableArray arrayWithCapacity: _numRows * _numCols];
add = [sorted methodForSelector: @selector(addObject:)];
@ -1000,11 +1024,11 @@ static SEL getSel;
column: (NSInteger*)column
ofCell: (NSCell*)aCell
{
int i;
NSInteger i;
for (i = 0; i < _numRows; i++)
{
int j;
NSInteger j;
for (j = 0; j < _numCols; j++)
{
@ -1038,7 +1062,9 @@ static SEL getSel;
NSCell *aCell = [self cellAtRow: row column: column];
if (!aCell)
{
return;
}
if (_mode == NSRadioModeMatrix)
{
@ -1082,15 +1108,17 @@ static SEL getSel;
*/
- (void) deselectAllCells
{
int i;
NSInteger i;
if (_numRows > 0 && _numCols > 0 &&
!_allowsEmptySelection && _mode == NSRadioModeMatrix)
{
return;
}
for (i = 0; i < _numRows; i++)
{
int j;
NSInteger j;
for (j = 0; j < _numCols; j++)
{
@ -1125,7 +1153,7 @@ static SEL getSel;
*/
- (void) deselectSelectedCell
{
int i,j;
NSInteger i,j;
if (!_selectedCell
|| (!_allowsEmptySelection && (_mode == NSRadioModeMatrix)))
@ -1157,7 +1185,7 @@ static SEL getSel;
*/
- (void) selectAll: (id)sender
{
int i, j;
NSInteger i, j;
/* Can't select all if only one can be selected. */
if (_mode == NSRadioModeMatrix)
@ -1194,7 +1222,7 @@ static SEL getSel;
[self setNeedsDisplay: YES];
}
- (void) _selectCell: (NSCell *)aCell atRow: (int)row column: (int)column
- (void) _selectCell: (NSCell *)aCell atRow: (NSInteger)row column: (NSInteger)column
{
if (aCell)
{
@ -1291,11 +1319,11 @@ static SEL getSel;
- (BOOL) selectCellWithTag: (NSInteger)anInt
{
id aCell;
int i = _numRows;
NSInteger i = _numRows;
while (i-- > 0)
{
int j = _numCols;
NSInteger j = _numCols;
while (j-- > 0)
{
@ -1316,11 +1344,11 @@ static SEL getSel;
- (NSArray*) selectedCells
{
NSMutableArray *array = [NSMutableArray array];
int i;
NSInteger i;
for (i = 0; i < _numRows; i++)
{
int j;
NSInteger j;
for (j = 0; j < _numCols; j++)
{
@ -1367,8 +1395,8 @@ static SEL getSel;
* So, cells from A to E are selected and, if S is outside the
* range from A to E, cells from S to its closest point are unselected
*/
int selStart = MIN(anchorPos, endPos);
int selEnd = MAX(anchorPos, endPos);
NSInteger selStart = MIN(anchorPos, endPos);
NSInteger selEnd = MAX(anchorPos, endPos);
[self _setState: flag ? NSOnState : NSOffState
highlight: flag
startIndex: selStart
@ -1414,14 +1442,14 @@ static SEL getSel;
MPoint anchorPoint = POINT_FROM_INDEX(anchorPos);
MPoint endPoint = POINT_FROM_INDEX(endPos);
MPoint startPoint = POINT_FROM_INDEX(startPos);
int minx_AE = MIN(anchorPoint.x, endPoint.x);
int miny_AE = MIN(anchorPoint.y, endPoint.y);
int maxx_AE = MAX(anchorPoint.x, endPoint.x);
int maxy_AE = MAX(anchorPoint.y, endPoint.y);
int minx_AS = MIN(anchorPoint.x, startPoint.x);
int miny_AS = MIN(anchorPoint.y, startPoint.y);
int maxx_AS = MAX(anchorPoint.x, startPoint.x);
int maxy_AS = MAX(anchorPoint.y, startPoint.y);
NSInteger minx_AE = MIN(anchorPoint.x, endPoint.x);
NSInteger miny_AE = MIN(anchorPoint.y, endPoint.y);
NSInteger maxx_AE = MAX(anchorPoint.x, endPoint.x);
NSInteger maxy_AE = MAX(anchorPoint.y, endPoint.y);
NSInteger minx_AS = MIN(anchorPoint.x, startPoint.x);
NSInteger miny_AS = MIN(anchorPoint.y, startPoint.y);
NSInteger maxx_AS = MAX(anchorPoint.x, startPoint.x);
NSInteger maxy_AS = MAX(anchorPoint.y, startPoint.y);
[self _setState: flag ? NSOnState : NSOffState
highlight: flag
@ -1463,7 +1491,7 @@ static SEL getSel;
and being correct comes first.
*/
{
int i, j;
NSInteger i, j;
for (i = _numRows - 1; i >= 0; i--)
{
for (j = _numCols - 1; j >= 0; j--)
@ -1500,11 +1528,11 @@ static SEL getSel;
*/
- (id) cellWithTag: (NSInteger)anInt
{
int i = _numRows;
NSInteger i = _numRows;
while (i-- > 0)
{
int j = _numCols;
NSInteger j = _numCols;
while (j-- > 0)
{
@ -1525,13 +1553,13 @@ static SEL getSel;
{
NSMutableArray *c;
IMP add;
int i;
NSInteger i;
c = [NSMutableArray arrayWithCapacity: _numRows * _numCols];
add = [c methodForSelector: @selector(addObject:)];
for (i = 0; i < _numRows; i++)
{
int j;
NSInteger j;
for (j = 0; j < _numCols; j++)
{
@ -1541,8 +1569,6 @@ static SEL getSel;
return c;
}
- (void) selectText: (id)sender
{
// Attention, we are *not* doing what MacOS-X does.
@ -1599,7 +1625,9 @@ static SEL getSel;
// more appropriate. This is going to start editing if and only if
// the cell is also 'editable'.
if ([_cells[row][column] isSelectable] == NO)
{
return nil;
}
if (_textObject)
{
@ -1619,11 +1647,12 @@ static SEL getSel;
{
NSText *text = [_window fieldEditor: YES
forObject: self];
int length;
NSUInteger length;
if ([text superview] != nil)
if ([text resignFirstResponder] == NO)
if (([text superview] != nil) && ([text resignFirstResponder] == NO))
{
return nil;
}
[self _selectCell: _cells[row][column] atRow: row column: column];
@ -1706,7 +1735,9 @@ static SEL getSel;
// MacOS-X asks us to inform the cell if possible.
if ((_selectedCell != nil) && [_selectedCell respondsToSelector:
@selector(textDidChange:)])
{
[_selectedCell textDidChange: aNotification];
}
[super textDidChange: aNotification];
@ -1882,9 +1913,11 @@ static SEL getSel;
{
if ([_delegate control: self
isValidObject: newObjectValue] == NO)
{
return NO;
}
}
}
// In all other cases
return YES;
@ -1924,8 +1957,8 @@ static SEL getSel;
- (void) sizeToCells
{
NSSize newSize;
int nc = _numCols;
int nr = _numRows;
NSInteger nc = _numCols;
NSInteger nr = _numRows;
if (!nc)
nc = 1;
@ -1961,8 +1994,7 @@ static SEL getSel;
* cellSizes. We resize the matrix to have that cellSize, and
* that's it. */
NSSize newSize = NSZeroSize;
int i, j;
NSInteger i, j;
for (i = 0; i < _numRows; i++)
{
@ -2002,11 +2034,11 @@ static SEL getSel;
- (void) setScrollable: (BOOL)flag
{
int i;
NSInteger i;
for (i = 0; i < _numRows; i++)
{
int j;
NSInteger j;
for (j = 0; j < _numCols; j++)
{
@ -2018,9 +2050,9 @@ static SEL getSel;
- (void) drawRect: (NSRect)rect
{
int i, j;
int row1, col1; // The cell at the upper left corner
int row2, col2; // The cell at the lower right corner
NSInteger i, j;
NSInteger row1, col1; // The cell at the upper left corner
NSInteger row2, col2; // The cell at the lower right corner
if (_drawsBackground)
{
@ -2037,32 +2069,50 @@ static SEL getSel;
col2 = NSMaxX(rect) / (_cellSize.width + _intercell.width);
if (row1 < 0)
{
row1 = 0;
}
else if (row1 >= _numRows)
{
row1 = _numRows - 1;
}
if (col1 < 0)
{
col1 = 0;
}
else if (col1 >= _numCols)
{
col1 = _numCols - 1;
}
if (row2 < 0)
{
row2 = 0;
}
else if (row2 >= _numRows)
{
row2 = _numRows - 1;
}
if (col2 < 0)
{
col2 = 0;
}
else if (col2 >= _numCols)
{
col2 = _numCols - 1;
}
/* Draw the cells within the drawing rectangle. */
for (i = row1; i <= row2 && i < _numRows; i++)
{
for (j = col1; j <= col2 && j < _numCols; j++)
{
[self drawCellAtRow: i column: j];
}
}
}
- (BOOL) isOpaque
{
@ -2141,7 +2191,9 @@ static SEL getSel;
if (_selectedCell)
{
if ([_selectedCell isEnabled] == NO)
{
return NO;
}
return [self sendAction: [_selectedCell action]
to: [_selectedCell target]];
@ -2175,13 +2227,13 @@ static SEL getSel;
to: (id)anObject
forAllCells: (BOOL)flag
{
int i;
NSInteger i;
if (flag)
{
for (i = 0; i < _numRows; i++)
{
int j;
NSInteger j;
for (j = 0; j < _numCols; j++)
{
@ -2197,7 +2249,7 @@ static SEL getSel;
{
for (i = 0; i < _numRows; i++)
{
int j;
NSInteger j;
for (j = 0; j < _numCols; j++)
{
@ -2490,7 +2542,7 @@ static SEL getSel;
{
NSInteger row, column;
NSPoint lastLocation = [theEvent locationInWindow];
int clickCount;
NSInteger clickCount;
/*
* Pathological case -- ignore mouse down
@ -2580,7 +2632,9 @@ static SEL getSel;
NSRect rect;
if ([self getRow: &row column: &col ofCell: aCell] == NO)
{
return; // Not a cell in this matrix - we can't update it.
}
rect = [self cellFrameAtRow: row column: col];
[self setNeedsDisplayInRect: rect];
@ -2647,11 +2701,11 @@ static SEL getSel;
- (void) resetCursorRects
{
int i;
NSInteger i;
for (i = 0; i < _numRows; i++)
{
int j;
NSInteger j;
for (j = 0; j < _numCols; j++)
{
@ -2663,6 +2717,17 @@ static SEL getSel;
}
}
- (NSString*) toolTipForCell: (NSCell*)cell
{
// FIXME
return @"";
}
- (void) setToolTip: (NSString*)toolTipString forCell: (NSCell*)cell
{
// FIXME
}
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
@ -2745,7 +2810,7 @@ static SEL getSel;
id cell;
int rows = 0, columns = 0;
NSArray *array;
int i = 0, count = 0;
NSInteger i = 0, count = 0;
self = [super initWithCoder: aDecoder];
if (!self)
@ -2836,7 +2901,7 @@ static SEL getSel;
for (i = 0; i < count; i++)
{
int row, column;
NSInteger row, column;
cell = [array objectAtIndex: i];
row = i / columns;
@ -2916,7 +2981,7 @@ static SEL getSel;
for (i = 0; i < count; i++)
{
int row, column;
NSInteger row, column;
cell = [array objectAtIndex: i];
row = i / columns;
@ -3173,7 +3238,7 @@ static SEL getSel;
*/
- (void) setEnabled: (BOOL)flag
{
int i, j;
NSInteger i, j;
for (i = 0; i < _numRows; i++)
{
@ -3368,7 +3433,7 @@ static SEL getSel;
- (void) _move: (unichar)pos
{
BOOL selectCell = NO;
int h, i, lastDottedRow, lastDottedColumn;
NSInteger h, i, lastDottedRow, lastDottedColumn;
if (_mode == NSRadioModeMatrix || _mode == NSListModeMatrix)
selectCell = YES;
@ -3928,14 +3993,14 @@ static SEL getSel;
* NB. new spaces in the matrix are pre-initialised with nil values so
* that replacing them doesn't cause attempts to release random memory.
*/
- (void) _renewRows: (int)row
columns: (int)col
rowSpace: (int)rowSpace
colSpace: (int)colSpace
- (void) _renewRows: (NSInteger)row
columns: (NSInteger)col
rowSpace: (NSInteger)rowSpace
colSpace: (NSInteger)colSpace
{
int i, j;
int oldMaxC;
int oldMaxR;
NSInteger i, j;
NSInteger oldMaxC;
NSInteger oldMaxR;
SEL mkSel = @selector(makeCellAtRow:column:);
IMP mkImp = [self methodForSelector: mkSel];
@ -3963,7 +4028,7 @@ static SEL getSel;
/*
* Update matrix dimension before we actually change it - so that
* makeCellAtRow:column: diesn't think we are trying to make a cell
* makeCellAtRow:column: doesn't think we are trying to make a cell
* outside the array bounds.
* Our implementation doesn't care, but a subclass might use
* putCell:atRow:column: to implement it, and that checks bounds.
@ -3979,18 +4044,13 @@ static SEL getSel;
if (col > oldMaxC)
{
int end = col - 1;
NSInteger end = col - 1;
for (i = 0; i < oldMaxR; i++)
{
_cells[i] = NSZoneRealloc(_myZone, _cells[i], col * sizeof(id));
#if GS_WITH_GC
_selectedCells[i] = NSReallocateCollectable(
_selectedCells[i], col * sizeof(BOOL), 0);
#else
_selectedCells[i] = NSZoneRealloc(_myZone,
_selectedCells[i], col * sizeof(BOOL));
#endif
_selectedCells[i] = NSZoneRealloc(_myZone, _selectedCells[i],
col * sizeof(BOOL));
for (j = oldMaxC; j < col; j++)
{
@ -4010,7 +4070,7 @@ static SEL getSel;
if (row > oldMaxR)
{
int end = row - 1;
NSInteger end = row - 1;
_cells = NSZoneRealloc(_myZone, _cells, row * sizeof(id*));
_selectedCells
@ -4020,11 +4080,8 @@ static SEL getSel;
for (i = oldMaxR; i < row; i++)
{
_cells[i] = NSZoneMalloc(_myZone, _maxCols * sizeof(id));
#if GS_WITH_GC
_selectedCells[i] = NSAllocateCollectable(_maxCols * sizeof(BOOL), 0);
#else
_selectedCells[i] = NSZoneMalloc(_myZone, _maxCols * sizeof(BOOL));
#endif
if (i == end)
{
for (j = 0; j < _maxCols; j++)
@ -4057,19 +4114,19 @@ static SEL getSel;
//NSLog(@"%x - end mr: %d mc:%d nr:%d nc:%d r:%d c:%d", (unsigned)self, _maxRows, _maxCols, _numRows, _numCols, row, col);
}
- (void) _setState: (int)state
- (void) _setState: (NSInteger)state
highlight: (BOOL)highlight
startIndex: (int)start
endIndex: (int)end
startIndex: (NSInteger)start
endIndex: (NSInteger)end
{
int i;
NSInteger i;
MPoint startPoint = POINT_FROM_INDEX(start);
MPoint endPoint = POINT_FROM_INDEX(end);
for (i = startPoint.y; i <= endPoint.y; i++)
{
int j;
int colLimit;
NSInteger j;
NSInteger colLimit;
if (_selectionByRect || i == startPoint.y)
{
@ -4109,10 +4166,10 @@ static SEL getSel;
}
// Return YES on success; NO if no selectable cell found.
-(BOOL) _selectNextSelectableCellAfterRow: (int)row
column: (int)column
-(BOOL) _selectNextSelectableCellAfterRow: (NSInteger)row
column: (NSInteger)column
{
int i,j;
NSInteger i, j;
if (row > -1)
{
@ -4147,10 +4204,10 @@ static SEL getSel;
return NO;
}
-(BOOL) _selectPreviousSelectableCellBeforeRow: (int)row
column: (int)column
-(BOOL) _selectPreviousSelectableCellBeforeRow: (NSInteger)row
column: (NSInteger)column
{
int i,j;
NSInteger i,j;
if (row < _numRows)
{
@ -4185,7 +4242,7 @@ static SEL getSel;
return NO;
}
- (void) _setKeyRow: (int)row column: (int)column
- (void) _setKeyRow: (NSInteger)row column: (NSInteger)column
{
if (_dottedRow == row && _dottedColumn == column)
{
@ -4204,4 +4261,5 @@ static SEL getSel;
column: _dottedColumn]];
}
}
@end

View file

@ -1595,10 +1595,6 @@ static BOOL menuBarVisible = YES;
forView: (NSView *)view
withFont: (NSFont *)font
{
// Testplant-MAL-2015-07-01: Using tetplant branch code...
NSPoint point = [view frame].origin;
point = [[view superview] convertPoint:point toView:nil];
point = [[view window] convertBaseToScreen: point];
[menu _rightMouseDisplay: event];
}