NSCursor and NSDocument merges

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38709 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2015-06-26 19:19:59 +00:00
parent 05113ee81c
commit cc49e3937f
2 changed files with 54 additions and 13 deletions

View file

@ -70,11 +70,20 @@ static NSMutableDictionary *cursorDict = nil;
}
}
#ifdef WIN32
+ (NSUInteger) count
{
return [gnustep_gui_cursor_stack count];
}
#endif
// Testplant-MAL-2015-06-26: Keeping testplant fixes...
+ (NSMutableArray *) stack
{
return gnustep_gui_cursor_stack;
}
// Testplant-MAL-2015-06-26: Keeping testplant fixes...
+ (void) resetStack
{
[gnustep_gui_cursor_stack removeAllObjects];
@ -287,6 +296,7 @@ NSCursor *getStandardCursor(NSString *name, int style)
return getStandardCursor(@"GSResizeUpDownCursor", GSResizeUpDownCursor);
}
// Testplant-MAL-2015-06-26: Keeping testplant fixes...
+ (NSCursor*) resizeNWSECursor
{
return getStandardCursor(@"GSResizeNWSECursor", GSResizeNWSECursor);
@ -454,6 +464,8 @@ backgroundColorHint:(NSColor *)bg
*/
- (void) mouseEntered: (NSEvent*)theEvent
{
NSDebugLLog(@"NSCursor", @"Cursor mouseEntered:enter %d exit %d",
_cursor_flags.is_set_on_mouse_entered, _cursor_flags.is_set_on_mouse_exited);
if (_cursor_flags.is_set_on_mouse_entered == YES)
{
[self set];
@ -474,7 +486,8 @@ backgroundColorHint:(NSColor *)bg
*/
- (void) mouseExited: (NSEvent*)theEvent
{
NSDebugLLog(@"NSCursor", @"Cursor mouseExited:");
NSDebugLLog(@"NSCursor", @"Cursor mouseExited: enter %d exit %d",
_cursor_flags.is_set_on_mouse_entered, _cursor_flags.is_set_on_mouse_exited);
if (_cursor_flags.is_set_on_mouse_exited == YES)
{
[self set];
@ -668,7 +681,7 @@ backgroundColorHint:(NSColor *)bg
image = [aDecoder decodeObjectForKey: @"NSImage"];
}
// Testplant-MAL-2015-06-26: Keeping testplant fixes...
if ([[image name] isEqualToString:@"file://localhost/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Resources/DVTIbeamCursor.tiff"])
{
NSDebugLog(@"An NSCursor object was encoded with the image "

View file

@ -29,6 +29,7 @@
*/
#import <Foundation/NSData.h>
#import <Foundation/NSError.h>
#import <Foundation/NSException.h>
#import <Foundation/NSFileManager.h>
#import <Foundation/NSNotification.h>
@ -48,6 +49,16 @@
#import "GSGuiPrivate.h"
static inline NSError*
create_error(int code, NSString* desc)
{
return [NSError errorWithDomain: @"NSDocument"
code: code
userInfo: [NSDictionary
dictionaryWithObjectsAndKeys: desc,
NSLocalizedDescriptionKey, nil]];
}
@implementation NSDocument
+ (NSArray *) readableTypes
@ -629,8 +640,12 @@ withContentsOfURL: (NSURL *)url
data = [self dataOfType: type error: error];
if (data == nil)
return nil;
{
if (error && !(*error))
*error = create_error(0, NSLocalizedString(@"Could not create data for type.",
@"Error description"));
return nil;
}
return AUTORELEASE([[NSFileWrapper alloc] initRegularFileWithContents: data]);
}
@ -730,9 +745,11 @@ withContentsOfURL: (NSURL *)url
error: error];
}
// FIXME: Set error
if (error)
*error = nil;
{
*error = create_error(0, NSLocalizedString(@"File wrapper is no file.",
@"Error description"));
}
return NO;
}
@ -894,6 +911,11 @@ withContentsOfURL: (NSURL *)url
ofType: type
saveOperation: op])
{
if (error)
{
*error = create_error(0, NSLocalizedString(@"Could not write backup file.",
@"Error description"));
}
return NO;
}
@ -907,9 +929,11 @@ withContentsOfURL: (NSURL *)url
if (!isNativeType || (url == nil))
{
// FIXME: Set error
if (error)
*error = nil;
{
*error = create_error(0, NSLocalizedString(@"Not a writable type or no URL given.",
@"Error description"));
}
return NO;
}
@ -927,9 +951,11 @@ withContentsOfURL: (NSURL *)url
if (![self _writeBackupForFile: fileName
toFile: backupFilename])
{
// FIXME: Set error.
if (error)
*error = nil;
{
*error = create_error(0, NSLocalizedString(@"Could not write backup file.",
@"Error description"));
}
return NO;
}
}
@ -997,9 +1023,11 @@ withContentsOfURL: (NSURL *)url
error: error];
if (wrapper == nil)
{
// FIXME: Set error
if (error)
*error = nil;
if (error && !(*error))
{
*error = create_error(0, NSLocalizedString(@"Could not write file wrapper.",
@"Error description"));
}
return NO;
}