mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 06:41:12 +00:00
Added a small hack to work around and Ibeam cursor image inserted in XIB files by Xcode, which would not be found in the project and therefore was substituted with the default arrow cursor.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@37189 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4d5c80b58c
commit
44c6dfb650
3 changed files with 47 additions and 2 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2013-04-03 Frank Le Grand <frank.legrand@testplant.com>
|
||||
|
||||
* Source\NSImage.m: Added a small hack to work around and Ibeam
|
||||
cursor image inserted in XIB files by Xcode, which would not be
|
||||
found in the project and therefore was substituted with the
|
||||
default arrow cursor.
|
||||
* Source\NSCursor.m: Added class method "stack" that is used
|
||||
by the backend to determine whether or not the cursor is in
|
||||
at least one cursor rectangle.
|
||||
|
||||
2013-09-11 Frank Le Grand <frank.legrand@testplant.com>
|
||||
|
||||
* Source\NSToolbar.m,
|
||||
|
|
|
@ -70,6 +70,11 @@ static NSMutableDictionary *cursorDict = nil;
|
|||
}
|
||||
}
|
||||
|
||||
+ (NSMutableArray *) stack
|
||||
{
|
||||
return gnustep_gui_cursor_stack;
|
||||
}
|
||||
|
||||
- (void *) _cid
|
||||
{
|
||||
return _cid;
|
||||
|
@ -658,8 +663,20 @@ backgroundColorHint:(NSColor *)bg
|
|||
image = [aDecoder decodeObjectForKey: @"NSImage"];
|
||||
}
|
||||
|
||||
self = [[NSCursor alloc] initWithImage: image
|
||||
hotSpot: hotSpot];
|
||||
|
||||
if ([[image name] isEqualToString:@"file://localhost/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Resources/DVTIbeamCursor.tiff"])
|
||||
{
|
||||
NSLog(@"An NSCursor object was encoded with the image "
|
||||
@"file://localhost/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Resources/DVTIbeamCursor.tiff. "
|
||||
@"This cursor was automatically substituted with [NSCursor IBeamCursor].");
|
||||
|
||||
self = [NSCursor IBeamCursor];
|
||||
}
|
||||
else
|
||||
{
|
||||
self = [[NSCursor alloc] initWithImage: image
|
||||
hotSpot: hotSpot];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1719,6 +1719,24 @@ static NSSize GSResolutionOfImageRep(NSImageRep *rep)
|
|||
NSString *fileName = [[tmp absoluteString] lastPathComponent];
|
||||
NSString *path = [[NSBundle mainBundle] pathForImageResource: fileName];
|
||||
rep = [NSImageRep imageRepWithContentsOfFile: path];
|
||||
|
||||
// This hack is a workaround on the issue where Xcode is including its cursor image
|
||||
// on NSTextView's scroll view: We set the name of the image so we can catch it
|
||||
// in the NSCursor's initWithCoder:
|
||||
if ([[tmp absoluteString] isEqualToString:@"file://localhost/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Resources/DVTIbeamCursor.tiff"])
|
||||
{
|
||||
[nameDict removeObjectForKey:[tmp absoluteString]];
|
||||
[self setName:[tmp absoluteString]];
|
||||
}
|
||||
else if ([[tmp absoluteString] rangeOfString:@"/Xcode.app/"].length > 0
|
||||
|| [[tmp absoluteString] rangeOfString:@"/DVTKit.framework/"].length > 0)
|
||||
{
|
||||
NSLog (@"WARNING: Decoding image with absolute path %@."
|
||||
@" Xcode may have inserted this in your XIB and the"
|
||||
@" image may not be available in the app's resources"
|
||||
, [tmp absoluteString]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If the representation was found, add it...
|
||||
|
|
Loading…
Reference in a new issue