synchronise with trunk ot get bugfixes and cleanups etc

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/themes@23923 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-10-20 13:08:20 +00:00
parent a43f1d0c71
commit b6a0cb6acf
76 changed files with 1037 additions and 353 deletions

157
ChangeLog
View file

@ -1,3 +1,160 @@
2006-10-19 21:17-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSMenuItemCell.m: Correct menu highlighting issue
found by applying changes suggested by Jeff Teunissen. This
change causes the menu to use the correct text color when
highlighted.
2006-10-19 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Additions/GNUstepGUI/GSTheme.h:
* Source/GSTheme.m:
Have tile filling method return rect of central tile area.
* Source/NSView.m: Fixup indentation problems.
2006-10-19 01:45-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSView.m: Applied patch from Banlu Kemiyatorn. Corrects
issue with detection of events in a rotated view.
2006-10-16 20:53-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSFont.m: Apply slightly modified version of patch
from Jeff Teunissen deek@d2dc.net to setNSFont(). Setting
a font should set its size.
* Source/NSImage.m: Set the alpha on the background when printing.
2006-10-15 11:23-EDT Mark Tracy <tracy454 at concentric dot net>
* Source/NSPageLayout.m: NSPageLayout was setting a default page
scale of 100 cause: pageScale factor is displayed as percentage fix:
pageScale*100 sent to textfield and textfield/100 stored in pageScale.
NSPageLayout had different limits on scaling than NSPrintPanel fix:
adjust formatter max.
* Source/NSPrintOperation.m: NSPrintOperation would loop randomly
if a custom view replies YES to -knowsPageRange cause:
-_printPaginateWithInfo did not initialize info->pageScale,
info->xpages, info->ypages fix: in -_printPaginateWithInfo
set default pageScale=1.0 outside conditional fix: in -_print
set xpages and ypages from viewPageRange as reported by custom view.
* Source/NSView.m: -beginDocument was misplacing subviews when
generating PostScript for printing fix: force regeneration of
coordinates.
Patch Applied by Gregory Casamento
2006-10-15 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSBrowser.m:
* Source/NSSound.m:
* Source/NSTextAttachment.m:
* Source/NSPopUpButtonCell.m:
* Source/NSPanel.m:
* Source/NSImageCell.m:
* Source/NSSliderCell.m:
* Source/GSGormLoader.m:
* Source/NSParagraphStyle.m:
* Source/NSFormCell.m:
* Source/NSMenu.m:
* Source/NSWindow.m:
* Source/NSButtonCell.m:
* Source/NSImageView.m:
* Source/NSActionCell.m:
* Source/NSDataLinkManager.m:
* Source/NSClipView.m:
* Source/NSBitmapImageRep.m:
* Source/NSTextFieldCell.m:
* Source/NSColorWell.m:
* Source/GSTextStorage.m:
* Source/NSApplication.m:
* Source/NSTableColumn.m:
* Source/GSVbox.m:
* Source/NSNib.m:
* Source/NSCachedImageRep.m:
* Source/NSPrinter.m:
* Source/NSTextContainer.m:
* Source/GSNibLoader.m:
* Source/GSNibCompatibility.m:
* Source/GSTrackingRect.m:
* Source/NSSearchFieldCell.m:
* Source/NSControl.m:
* Source/GSHbox.m:
* Source/NSProgressIndicator.m:
* Source/GSModelLoaderFactory.m:
* Source/NSTextStorage.m:
* Source/NSTextView.m:
* Source/NSDocumentController.m:
* Source/NSMenuView.m:
* Source/NSSecureTextField.m:
* Source/NSComboBoxCell.m:
* Source/NSImage.m:
* Source/NSStepperCell.m:
* Source/NSDataLink.m:
* Source/NSScrollView.m:
* Source/NSBundleAdditions.m:
* Source/NSCell.m:
* Source/GSTable.m:
* Source/NSTableView.m:
* Source/NSBrowserCell.m:
* Source/NSSelection.m:
* Source/NSTextField.m:
* Source/NSView.m:
* Source/NSDocument.m:
Fixup some minor coding standard violations ... add white space.
* Headers/Additions/GNUstepGUI/GSTheme.h:
* Source/GSTheme.m:
Add control for caching of tiles. Add another fill style for tiling.
Make fill style names avoid possible name clashes by using GS prefix.
2006-10-12 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSImageView.m: Fix error in initial drag position.
* Source/GSTheme.m: Improve display of current theme information.
2006-10-11 Nicola Pero <nicola.pero@meta-innovation.com>
* GNUmakefile (GNUSTEP_INSTALLATION_DOMAIN):
Use GNUSTEP_INSTALLATION_DOMAIN
instead of GNUSTEP_INSTALLATION_DIR.
2006-10-09 Richard Frith-Macdonald <rfm@gnu.org>
* Documentation/GuiAdditions.gsdoc:
* Documentation/Gui.gsdoc:
* Documentation/GuiUser/KeyboardSetup.gsdoc:
* Documentation/GuiUser/LanguageSetup.gsdoc:
* Documentation/GuiUser/DefaultsSummary.gsdoc:
* Documentation/ReleaseNotes.gsdoc:
* Documentation/General/OpenStepCompliance.gsdoc:
Update dtd version
2006-10-08 23:47-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Images/GNUmakefile: Copy GSStop.tiff and GSSearch.tiff to the
installation directory. They were previously missing.
2006-10-07 10:20-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibCompatibility.m: Implement init in NSIBHelpConnector.
2006-10-07 10:13-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibCompatibility.m: Implement establishConnection in
NSIBHelpConnector.
2006-10-07 10:02-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Declaration
for NSIBHelpConnector ivars and methods.
* Source/GSNibCompatibility.m: Implemented NSIBHelpConnector.
* Source/NSBundleAdditions.m: Added check to initWithCoder so that
values aren't decoded, if there's no value in the coder.
2006-10-06 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSTrackingRect.m: Allow reset rect to another value.
* Source/GSToolTips.m: Improve handling of tips in rects other than
the main one.
2006-10-06 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSToolTips.h: Remove some ivars

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.1//EN" "http://www.gnustep.org/gsdoc-1_0_1.xml">
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.3//EN" "http://www.gnustep.org/gsdoc-1_0_3.xml">
<gsdoc base="OpenStepCompliance" up="Base">
<head>
<title>OpenStep Compliance</title>

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.1//EN" "http://www.gnustep.org/gsdoc-1_0_1.xml">
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.3//EN" "http://www.gnustep.org/gsdoc-1_0_3.xml">
<gsdoc base="Gui">
<head>
<title>Gui</title>

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.7//EN" "http://www.gnustep.org/gsdoc-0_6_7.xml">
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.3//EN" "http://www.gnustep.org/gsdoc-1_0_3.xml">
<gsdoc base="Gui">
<head>
<title>GuiAdditions</title>

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.7//EN" "/usr/GNUstep/System/Libraries/Resources/DTDs/gsdoc-0_6_6.dtd" >
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.3//EN" "/usr/GNUstep/System/Libraries/Resources/DTDs/gsdoc-1_0_3.dtd" >
<gsdoc base="DefaultsSummary">
<head>
<title>User Defaults Summary for GNUstep Libraries</title>

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.7//EN" "/usr/GNUstep/System/Libraries/Resources/DTDs/gsdoc-0_6_6.dtd" >
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.3//EN" "/usr/GNUstep/System/Libraries/Resources/DTDs/gsdoc-1_0_3.dtd" >
<gsdoc base="KeyboardSetup">
<head>
<title>User Keyboard Setup for GNUstep Libraries</title>

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.0//EN" "http://www.gnustep.org/gsdoc-1_0_0.xml" >
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.3//EN" "http://www.gnustep.org/gsdoc-1_0_3.xml" >
<gsdoc base="LanguageSetup">
<head>
<title>How to Set Up GNUstep for the East Asian Languages</title>

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.1//EN" "http://www.gnustep.org/gsdoc-1_0_1.xml">
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.3//EN" "http://www.gnustep.org/gsdoc-1_0_3.xml">
<gsdoc base="ReleaseNotes">
<head>
<title>GNUstep Gui Release Notes</title>

View file

@ -26,7 +26,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Install into the system root by default
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
GNUSTEP_INSTALLATION_DOMAIN = SYSTEM
RPM_DISABLE_RELOCATABLE=YES
PACKAGE_NEEDS_CONFIGURE = YES

View file

@ -80,8 +80,15 @@ typedef struct _GSWindowTemplateFlags
// help connector class...
@interface NSIBHelpConnector : NSNibConnector
{
id _marker;
id _file;
}
- (void) setFile: (id)file;
- (id) file;
- (void) setMarker: (id)file;
- (id) marker;
@end
/**
* Button image source class.
*/

View file

@ -147,14 +147,18 @@
@class GSDrawTiles;
/**
* This defines how the center middle image in a tile array should be
* used when drawing a rectangle.
* This defines how the values in a tile array should be used when
* drawing a rectangle. Mostly this just effects the center, middle
* image of the rectangle.<br />
* FillStyleMatrix is provided for the use of theme editors wishing
* to display the tile.
*/
typedef enum {
FillStyleNone, /** The image is not drawn */
FillStyleScale, /** The image is scaled to fit */
FillStyleRepeat, /** The image is tiled from bottom left */
FillStyleCenter /** The image is tiled from the center */
GSThemeFillStyleNone, /** CM image is not drawn */
GSThemeFillStyleScale, /** CM image is scaled to fit */
GSThemeFillStyleRepeat, /** CM image is tiled from bottom left */
GSThemeFillStyleCenter, /** CM image is tiled from the center */
GSThemeFillStyleMatrix /** a matrix of nine separated images */
} GSThemeFillStyle;
@ -349,9 +353,11 @@ APPKIT_EXPORT NSString *GSThemeDidDeactivateNotification;
* The GUI library uses this internally to handling tiling of image
* information to draw user interface elements. The tile information
* returned by this method can be passed to the
* -fillRect:withTiles:background:fillStyle: method.
* -fillRect:withTiles:background:fillStyle: method.<br />
* The useCache argument controls whether the information is retrieved
* from cache or regenerated from information in the theme bundle.
*/
- (GSDrawTiles*) tilesNamed: (NSString*)aName;
- (GSDrawTiles*) tilesNamed: (NSString*)aName cache: (BOOL)useCache;
@end
/**
@ -424,7 +430,12 @@ APPKIT_EXPORT NSString *GSThemeDidDeactivateNotification;
*/
@interface GSTheme (LowLevelDrawing)
/**
* Method to tile the supplied image to fill the horizontal rectangle.
* Method to tile the supplied image to fill the horizontal rectangle.<br />
* The rect argument is the rectangle to be filled.<br />
* The image argument is the data to fill with.<br />
* The source argument is the rectangle within the image which is used.<br />
* The flipped argument specifies what sort of coordinate system is in
* use in the view where we are drawing.
*/
- (void) fillHorizontalRect: (NSRect)rect
withImage: (NSImage*)image
@ -443,20 +454,29 @@ withRepeatedImage: (NSImage*)image
center: (BOOL)center;
/**
* Method to tile a rectangle given an array of nine tile images.<br />
* Method to tile a rectangle given a group of up to nine tile images.<br />
* The GSDrawTiles object encapsulates the tile images and information
* about what parts of each image are used for tiling.<br />
* This draws the left, right, top and bottom borders by tiling the
* images at TileCL, TileCR, TileTM and TileBM respectively. It then
* draws the four corner images and finally deals with the remaining
* space in the middle according to the specified style.<br />
* The background color specified is used where style is FillStyleNone.
* images at left, right, top and bottom. It then draws the four corner
* images and finally deals with the remaining space in the middle according
* to the specified style.<br />
* The background color specified is used to fill the center where
* style is FillStyleNone.<br />
* The return value is the central rectangle (inside the border images).
*/
- (void) fillRect: (NSRect)rect
withTiles: (GSDrawTiles*)tiles
background: (NSColor*)color
fillStyle: (GSThemeFillStyle)style;
- (NSRect) fillRect: (NSRect)rect
withTiles: (GSDrawTiles*)tiles
background: (NSColor*)color
fillStyle: (GSThemeFillStyle)style;
/**
* Method to tile the supplied image to fill the vertical rectangle.
* Method to tile the supplied image to fill the vertical rectangle.<br />
* The rect argument is the rectangle to be filled.<br />
* The image argument is the data to fill with.<br />
* The source argument is the rectangle within the image which is used.<br />
* The flipped argument specifies what sort of coordinate system is in
* use in the view where we are drawing.
*/
- (void) fillVerticalRect: (NSRect)rect
withImage: (NSImage*)image

View file

@ -54,6 +54,7 @@
inside: (BOOL)flag;
- (NSRect) rectangle;
- (void) reset: (NSRect)aRect inside: (BOOL)flag;
- (NSTrackingRectTag) tag;
- (id) owner;
- (void*) userData;

View file

@ -123,7 +123,9 @@ common_ClosedHandCursor.tiff \
common_OpenHandCursor.tiff \
page_landscape.tiff \
page_portrait.tiff \
MagnifyGlass.tiff
MagnifyGlass.tiff \
GSSearch.tiff \
GSStop.tiff
-include GNUmakefile.preamble

View file

@ -537,7 +537,7 @@ void __dummy_GMAppKit_functionForLinking() {}
[archiver encodeObject:[self documentView] withName:@"documentView"];
[archiver encodeBOOL:[self copiesOnScroll] withName:@"copiesOnScroll"];
if([self respondsToSelector: @selector(drawsBackground)])
if ([self respondsToSelector: @selector(drawsBackground)])
[archiver encodeBOOL:[self drawsBackground] withName:@"drawsBackground"];
[archiver encodeObject:[self backgroundColor] withName:@"backgroundColor"];
}
@ -548,7 +548,7 @@ void __dummy_GMAppKit_functionForLinking() {}
[self setDocumentView:[unarchiver decodeObjectWithName:@"documentView"]];
[self setCopiesOnScroll:[unarchiver decodeBOOLWithName:@"copiesOnScroll"]];
if([self respondsToSelector: @selector(setDrawsBackground:)])
if ([self respondsToSelector: @selector(setDrawsBackground:)])
[self setDrawsBackground:[unarchiver decodeBOOLWithName:@"drawsBackground"]];
[self setBackgroundColor:[unarchiver decodeObjectWithName:@"backgroundColor"]];
return self;
@ -1100,14 +1100,14 @@ void __dummy_GMAppKit_functionForLinking() {}
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
{
[super encodeWithModelArchiver:archiver];
if([self respondsToSelector: @selector(echosBullets)])
if ([self respondsToSelector: @selector(echosBullets)])
[archiver encodeBOOL:[self echosBullets] withName:@"echosBullets"];
}
- (id)initWithModelUnarchiver:(GMUnarchiver*)unarchiver
{
self = [super initWithModelUnarchiver:unarchiver];
if([self respondsToSelector: @selector(setEchosBullets:)])
if ([self respondsToSelector: @selector(setEchosBullets:)])
[self setEchosBullets:[unarchiver decodeBOOLWithName:@"echosBullets"]];
return self;

View file

@ -135,7 +135,7 @@
withZone: zone];
// report a problem if there is one.
if(loaded == NO)
if (loaded == NO)
{
NSLog(@"Could not load Gorm file: %@",fileName);
}

View file

@ -160,7 +160,7 @@ enablingXResizing: (BOOL)aFlag
-(void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeBool: _haveViews forKey: @"GSHaveViews"];
[aCoder encodeFloat: _defaultMinXMargin forKey: @"GSDefaultMinXMargin"];
@ -175,7 +175,7 @@ enablingXResizing: (BOOL)aFlag
-(id) initWithCoder: (NSCoder*)aDecoder
{
[super initWithCoder: aDecoder];
if([aDecoder allowsKeyedCoding])
if ([aDecoder allowsKeyedCoding])
{
_haveViews = [aDecoder decodeBoolForKey: @"GSHaveViews"];
_defaultMinXMargin = [aDecoder decodeFloatForKey: @"GSDefaultMinXMargin"];

View file

@ -63,11 +63,11 @@
{
NSComparisonResult result = NSOrderedSame;
if([self priority] < [loader priority])
if ([self priority] < [loader priority])
{
result = NSOrderedAscending;
}
if([self priority] > [loader priority])
if ([self priority] > [loader priority])
{
result = NSOrderedDescending;
}
@ -85,7 +85,7 @@ static NSMutableDictionary *_modelMap = nil;
NSEnumerator *en = [classes objectEnumerator];
Class cls = nil;
while((cls = [en nextObject]) != nil)
while ((cls = [en nextObject]) != nil)
{
[self registerModelLoaderClass: cls];
}
@ -93,7 +93,7 @@ static NSMutableDictionary *_modelMap = nil;
+ (void) registerModelLoaderClass: (Class)aClass
{
if(_modelMap == nil)
if (_modelMap == nil)
{
_modelMap = [[NSMutableDictionary alloc] initWithCapacity: 5];
}
@ -112,7 +112,7 @@ static NSMutableDictionary *_modelMap = nil;
NSFileManager *mgr = [NSFileManager defaultManager];
NSString *ext = [modelPath pathExtension];
if([ext isEqual: @""])
if ([ext isEqual: @""])
{
NSArray *objectArray = [_modelMap allValues];
NSArray *sortedArray = [objectArray sortedArrayUsingSelector:
@ -120,11 +120,11 @@ static NSMutableDictionary *_modelMap = nil;
NSEnumerator *oen = [sortedArray objectEnumerator];
Class cls = nil;
while((cls = [oen nextObject]) != nil && result == NO)
while ((cls = [oen nextObject]) != nil && result == NO)
{
NSString *path = [modelPath stringByAppendingPathExtension:
(NSString *)[cls type]];
if([mgr isReadableFileAtPath: path])
if ([mgr isReadableFileAtPath: path])
{
result = path;
}
@ -132,9 +132,9 @@ static NSMutableDictionary *_modelMap = nil;
}
else
{
if([_modelMap objectForKey: ext] != nil)
if ([_modelMap objectForKey: ext] != nil)
{
if([mgr isReadableFileAtPath: modelPath])
if ([mgr isReadableFileAtPath: modelPath])
{
result = modelPath;
}
@ -149,7 +149,7 @@ static NSMutableDictionary *_modelMap = nil;
Class aClass = [GSModelLoaderFactory classForType: type];
GSModelLoader *loader = nil;
if(aClass != nil)
if (aClass != nil)
{
loader = AUTORELEASE([[aClass alloc] init]);
}
@ -167,7 +167,7 @@ static NSMutableDictionary *_modelMap = nil;
NSString *path = [GSModelLoaderFactory supportedModelFileAtPath: modelPath];
GSModelLoader *result = nil;
if(path != nil)
if (path != nil)
{
NSString *ext = [path pathExtension];
result = [self modelLoaderForFileType: ext];

View file

@ -70,9 +70,9 @@ static BOOL _isInInterfaceBuilder = NO;
{
NSEnumerator *en = [[self subviews] objectEnumerator];
id v = nil;
while((v = [en nextObject]) != nil)
while ((v = [en nextObject]) != nil)
{
if([v window] != [self window] ||
if ([v window] != [self window] ||
[v superview] != self)
{
[v _setWindow: [self window]];
@ -113,9 +113,9 @@ static BOOL _isInInterfaceBuilder = NO;
wantsToBeColor: (BOOL) wantsToBeColor
autoPositionMask: (int) autoPositionMask
{
if((self = [super init]) != nil)
if ((self = [super init]) != nil)
{
if(window != nil)
if (window != nil)
{
// object members
ASSIGN(_title, [window title]);
@ -163,7 +163,7 @@ static BOOL _isInInterfaceBuilder = NO;
{
_windowStyle = [coder decodeIntForKey: @"NSWindowStyleMask"];
}
if([coder containsValueForKey: @"NSWindowBacking"])
if ([coder containsValueForKey: @"NSWindowBacking"])
{
_backingStoreType = [coder decodeIntForKey: @"NSWindowBacking"];
}
@ -234,13 +234,13 @@ static BOOL _isInInterfaceBuilder = NO;
- (id) nibInstantiate
{
if(_realObject == nil)
if (_realObject == nil)
{
Class aClass;
NSEnumerator *en;
id v = nil;
if([NSClassSwapper isInInterfaceBuilder])
if ([NSClassSwapper isInInterfaceBuilder])
{
aClass = [self baseWindowClass];
}
@ -290,9 +290,9 @@ static BOOL _isInInterfaceBuilder = NO;
// swap out any views which need to be swapped...
en = [[[_realObject contentView] subviews] objectEnumerator];
while((v = [en nextObject]) != nil)
while ((v = [en nextObject]) != nil)
{
if([v respondsToSelector: @selector(nibInstantiate)])
if ([v respondsToSelector: @selector(nibInstantiate)])
{
[v nibInstantiate];
}
@ -436,9 +436,9 @@ static BOOL _isInInterfaceBuilder = NO;
- (id) initWithCoder: (NSCoder *)coder
{
self = [super initWithCoder: coder];
if(self != nil)
if (self != nil)
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
_className = [coder decodeObjectForKey: @"NSClassName"];
}
@ -454,7 +454,7 @@ static BOOL _isInInterfaceBuilder = NO;
- (void) encodeWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
[coder encodeObject: (id)_className forKey: @"NSClassName"];
}
@ -462,10 +462,10 @@ static BOOL _isInInterfaceBuilder = NO;
- (id) nibInstantiate
{
if(_realObject == nil)
if (_realObject == nil)
{
Class aClass = NSClassFromString(_className);
if(aClass == nil)
if (aClass == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"Unable to find class '%@'", _className];
@ -520,10 +520,10 @@ static BOOL _isInInterfaceBuilder = NO;
- (id)nibInstantiate
{
if(_realObject == nil)
if (_realObject == nil)
{
Class aClass = NSClassFromString(_className);
if(aClass == nil)
if (aClass == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"Unable to find class '%@'", _className];
@ -612,7 +612,7 @@ static BOOL _isInInterfaceBuilder = NO;
- (id) initWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
ASSIGN(_className, [coder decodeObjectForKey: @"NSClassName"]);
ASSIGN(_extension, [coder decodeObjectForKey: @"NSExtension"]);
@ -628,7 +628,7 @@ static BOOL _isInInterfaceBuilder = NO;
- (void) encodeWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
[coder encodeObject: (id)_className forKey: @"NSClassName"];
[coder encodeConditionalObject: (id)_extension forKey: @"NSExtension"];
@ -644,11 +644,11 @@ static BOOL _isInInterfaceBuilder = NO;
- (id) nibInstantiate
{
if(_object == nil)
if (_object == nil)
{
Class aClass;
if([NSClassSwapper isInInterfaceBuilder])
if ([NSClassSwapper isInInterfaceBuilder])
{
aClass = [self class];
}
@ -657,7 +657,7 @@ static BOOL _isInInterfaceBuilder = NO;
aClass = NSClassFromString(_className);
}
if(aClass == nil)
if (aClass == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"Unable to find class '%@'", _className];
@ -698,11 +698,11 @@ static BOOL _isInInterfaceBuilder = NO;
- (id) nibInstantiate
{
if(_view == nil)
if (_view == nil)
{
Class aClass;
if([NSClassSwapper isInInterfaceBuilder])
if ([NSClassSwapper isInInterfaceBuilder])
{
aClass = [self class];
}
@ -711,7 +711,7 @@ static BOOL _isInInterfaceBuilder = NO;
aClass = NSClassFromString(_className);
}
if(aClass == nil)
if (aClass == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"Unable to find class '%@'", _className];
@ -731,9 +731,9 @@ static BOOL _isInInterfaceBuilder = NO;
- (id) initWithCoder: (NSCoder *)coder
{
self = [super initWithCoder: coder];
if(self != nil)
if (self != nil)
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
ASSIGN(_className, [coder decodeObjectForKey: @"NSClassName"]);
ASSIGN(_extension, [coder decodeObjectForKey: @"NSExtension"]);
@ -751,7 +751,7 @@ static BOOL _isInInterfaceBuilder = NO;
- (void) encodeWithCoder: (NSCoder *)coder
{
[super encodeWithCoder: coder];
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
[coder encodeObject: _className forKey: @"NSClassName"];
[coder encodeObject: _extension forKey: @"NSExtension"];
@ -794,23 +794,23 @@ static BOOL _isInInterfaceBuilder = NO;
- (id) initWithCoder: (NSCoder *)coder
{
id realObject = nil;
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
ASSIGN(_className, [coder decodeObjectForKey: @"NSClassName"]);
ASSIGN(_resourceName, [coder decodeObjectForKey: @"NSResourceName"]);
// this is a hack, but for now it should do.
if([_className isEqual: @"NSSound"])
if ([_className isEqual: @"NSSound"])
{
realObject = RETAIN([NSSound soundNamed: _resourceName]);
}
else if([_className isEqual: @"NSImage"])
else if ([_className isEqual: @"NSImage"])
{
realObject = RETAIN([NSImage imageNamed: _resourceName]);
}
// if an object has been substituted, then release the placeholder.
if(realObject != nil)
if (realObject != nil)
{
RELEASE(self);
}
@ -827,7 +827,7 @@ static BOOL _isInInterfaceBuilder = NO;
- (void) encodeWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
[coder encodeObject: (id)_className forKey: @"NSClassName"];
[coder encodeObject: (id)_resourceName forKey: @"NSResourceName"];
@ -845,14 +845,14 @@ static BOOL _isInInterfaceBuilder = NO;
{
unsigned int i = 0;
unsigned int count = GSIArrayCount(_objMap);
for(i = 0; i < count; i++)
for (i = 0; i < count; i++)
{
id obj = GSIArrayItemAtIndex(_objMap, i).obj;
if(obj == oldObj)
if (obj == oldObj)
break;
}
if(i < count)
if (i < count)
{
GSIArraySetItemAtIndex(_objMap, (GSIArrayItem)newObj, i);
return YES;
@ -872,7 +872,7 @@ static BOOL _isInInterfaceBuilder = NO;
withClassName: (NSString *)className
originalClassName: (NSString *)origClassName
{
if((self = [super init]) != nil)
if ((self = [super init]) != nil)
{
[self setTemplate: object];
[self setClassName: className];
@ -930,12 +930,12 @@ static BOOL _isInInterfaceBuilder = NO;
Class origCellClass = nil;
// if there is a replacement class, use it, otherwise, use the one specified.
if((aClass = [(NSKeyedUnarchiver *)coder classForClassName: className]) == nil)
if ((aClass = [(NSKeyedUnarchiver *)coder classForClassName: className]) == nil)
{
aClass = NSClassFromString(className);
}
if(aClass == nil)
if (aClass == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"NSClassSwapper unable to find class '%@'", className];
@ -943,7 +943,7 @@ static BOOL _isInInterfaceBuilder = NO;
// if this is a class which uses cells, override with the new cellClass, if the
// subclass responds to cellClass.
if([aClass respondsToSelector: @selector(cellClass)] &&
if ([aClass respondsToSelector: @selector(cellClass)] &&
[className isEqualToString: _originalClassName] == NO)
{
Class origClass = NSClassFromString(_originalClassName);
@ -958,12 +958,12 @@ static BOOL _isInInterfaceBuilder = NO;
object = [aClass allocWithZone: NSDefaultMallocZone()];
[(NSKeyedUnarchiver *)coder replaceObject: self withObject: object];
[self setTemplate: [object initWithCoder: coder]];
if(object != _template)
if (object != _template)
{
[(NSKeyedUnarchiver *)coder replaceObject: object withObject: _template];
}
if(newCellClass != nil && origCellClass != nil)
if (newCellClass != nil && origCellClass != nil)
{
[(NSKeyedUnarchiver *)coder setClass: origCellClass forClassName: nil];
}
@ -971,13 +971,13 @@ static BOOL _isInInterfaceBuilder = NO;
- (id) initWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
ASSIGN(_className, [coder decodeObjectForKey: @"NSClassName"]);
ASSIGN(_originalClassName, [coder decodeObjectForKey: @"NSOriginalClassName"]);
// build the real object...
if([NSClassSwapper isInInterfaceBuilder] == YES)
if ([NSClassSwapper isInInterfaceBuilder] == YES)
{
[self instantiateRealObject: coder withClassName: _originalClassName];
}
@ -998,7 +998,7 @@ static BOOL _isInInterfaceBuilder = NO;
- (void) encodeWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
[coder encodeObject: _originalClassName forKey: @"NSOriginalClassName"];
[coder encodeObject: _className forKey: @"NSClassName"];
@ -1032,7 +1032,7 @@ static BOOL _isInInterfaceBuilder = NO;
NSRange colonRange = [_tag rangeOfString: @":"];
unsigned int location = colonRange.location;
if(location == NSNotFound)
if (location == NSNotFound)
{
NSString *newTag = [NSString stringWithFormat: @"%@:",_tag];
[self setLabel: (id)newTag];
@ -1046,10 +1046,10 @@ static BOOL _isInInterfaceBuilder = NO;
- (id)instantiateObject: (id)obj
{
id newObject = obj;
if([obj respondsToSelector: @selector(nibInstantiate)])
if ([obj respondsToSelector: @selector(nibInstantiate)])
{
newObject = [obj nibInstantiate];
if([newObject respondsToSelector: @selector(awakeFromNib)])
if ([newObject respondsToSelector: @selector(awakeFromNib)])
{
// awaken the object.
[newObject awakeFromNib];
@ -1074,9 +1074,9 @@ static BOOL _isInInterfaceBuilder = NO;
[_root setObject: owner];
// iterate over connections, instantiate, and then establish them.
while((obj = [en nextObject]) != nil)
while ((obj = [en nextObject]) != nil)
{
if([obj respondsToSelector: @selector(instantiateWithInstantiator:)])
if ([obj respondsToSelector: @selector(instantiateWithInstantiator:)])
{
[obj instantiateWithInstantiator: self];
[obj establishConnection];
@ -1085,11 +1085,11 @@ static BOOL _isInInterfaceBuilder = NO;
// instantiate all windows and fill in the top level array.
en = [objs objectEnumerator];
while((obj = [en nextObject]) != nil)
while ((obj = [en nextObject]) != nil)
{
if([obj isKindOfClass: [NSWindowTemplate class]])
if ([obj isKindOfClass: [NSWindowTemplate class]])
{
if([obj realObject] == nil)
if ([obj realObject] == nil)
{
id o = [self instantiateObject: obj];
[topLevelObjects addObject: o];
@ -1098,7 +1098,7 @@ static BOOL _isInInterfaceBuilder = NO;
else
{
id v = NSMapGet(_objects, obj);
if(v == nil || v == owner)
if (v == nil || v == owner)
{
[topLevelObjects addObject: obj];
}
@ -1107,7 +1107,7 @@ static BOOL _isInInterfaceBuilder = NO;
// bring visible windows to front...
en = [_visibleWindows objectEnumerator];
while((obj = [en nextObject]) != nil)
while ((obj = [en nextObject]) != nil)
{
id w = [obj realObject];
[w orderFront: self];
@ -1115,7 +1115,7 @@ static BOOL _isInInterfaceBuilder = NO;
// add the menu...
menu = [self objectForName: @"MainMenu"];
if(menu != nil)
if (menu != nil)
{
menu = [self instantiateObject: menu];
[NSApp setMainMenu: menu];
@ -1176,7 +1176,7 @@ static BOOL _isInInterfaceBuilder = NO;
int i = [nameValues indexOfObject: name];
id result = nil;
if(i != NSNotFound)
if (i != NSNotFound)
{
result = [nameKeys objectAtIndex: i];
}
@ -1201,7 +1201,7 @@ static BOOL _isInInterfaceBuilder = NO;
NSMutableArray *result = [NSMutableArray array];
NSEnumerator *en = [keys objectEnumerator];
id key = nil;
while((key = [en nextObject]) != nil)
while ((key = [en nextObject]) != nil)
{
id value = (id)NSMapGet(map,key);
[result addObject: value];
@ -1211,7 +1211,7 @@ static BOOL _isInInterfaceBuilder = NO;
- (void) encodeWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
NSArray *accessibilityOidsKeys = (NSArray *)NSAllMapTableKeys(_accessibilityOids);
NSArray *accessibilityOidsValues = [self _valuesForKeys: accessibilityOidsKeys inMap: _accessibilityOids];
@ -1261,7 +1261,7 @@ static BOOL _isInInterfaceBuilder = NO;
id key = nil;
id value = nil;
while((key = [ken nextObject]) != nil && (value = [ven nextObject]) != nil)
while ((key = [ken nextObject]) != nil && (value = [ven nextObject]) != nil)
{
NSMapInsert(mapTable, key, value);
}
@ -1269,7 +1269,7 @@ static BOOL _isInInterfaceBuilder = NO;
- (id) initWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
ASSIGN(_root, [coder decodeObjectForKey: @"NSRoot"]);
ASSIGN(_visibleWindows, (NSMutableArray *)[coder decodeObjectForKey: @"NSVisibleWindows"]);
@ -1347,7 +1347,7 @@ static BOOL _isInInterfaceBuilder = NO;
- (id) init
{
if((self = [super init]) != nil)
if ((self = [super init]) != nil)
{
// instantiate the maps..
_objects = NSCreateMapTable(NSObjectMapKeyCallBacks,
@ -1417,7 +1417,7 @@ static BOOL _isInInterfaceBuilder = NO;
@implementation NSButtonImageSource
- (id) initWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
ASSIGN(imageName, [coder decodeObjectForKey: @"NSImageName"]);
}
@ -1434,7 +1434,7 @@ static BOOL _isInInterfaceBuilder = NO;
- (void) encodeWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
[coder encodeObject: imageName forKey: @"NSImageName"];
}
@ -1448,7 +1448,7 @@ static BOOL _isInInterfaceBuilder = NO;
- (id) initWithImageNamed: (NSString *)name
{
if((self = [super init]) != nil)
if ((self = [super init]) != nil)
{
ASSIGN(imageName,name);
}
@ -1467,16 +1467,86 @@ static BOOL _isInInterfaceBuilder = NO;
}
@end
// ...dummy/placeholder classes...
// overridden in NSTableView to be GSTableCornerView,
// but the class needs to be present to be overridden.
@interface _NSCornerView : NSView
@end
@implementation _NSCornerView
@end
@implementation NSIBHelpConnector
- (id) init
{
if ((self = [super init]) != nil)
{
_file = nil;
_marker = @"NSToolTipHelpKey";
}
return self;
}
- (id) initWithCoder: (NSCoder *)coder
{
if ((self = [super initWithCoder: coder]) != nil)
{
if ([coder allowsKeyedCoding])
{
if ([coder containsValueForKey: @"NSFile"])
{
_file = RETAIN([coder decodeObjectForKey: @"NSFile"]);
}
if ([coder containsValueForKey: @"NSMarker"])
{
_marker = RETAIN([coder decodeObjectForKey: @"NSMarker"]);
}
}
else
{
_file = RETAIN([coder decodeObject]);
_marker = RETAIN([coder decodeObject]);
}
}
return self;
}
- (void) encodeWithCoder: (NSCoder *)coder
{
[super encodeWithCoder: coder];
if ([coder allowsKeyedCoding])
{
if (_file != nil)
{
[coder encodeObject: _file forKey: @"NSFile"];
}
if (_marker != nil)
{
[coder encodeObject: _file forKey: @"NSMarker"];
}
}
else
{
[coder encodeObject: _file];
[coder encodeObject: _marker];
}
}
- (void) establishConnection
{
[_dst setToolTip: _marker];
}
- (void) setFile: (id)file
{
ASSIGN(_file, file);
}
- (id) file
{
return _file;
}
- (void) setMarker: (id)marker
{
ASSIGN(_marker, marker);
}
- (id) marker
{
return _marker;
}
@end
@interface NSDecimalNumberPlaceholder : NSObject
@ -1486,7 +1556,7 @@ static BOOL _isInInterfaceBuilder = NO;
- (id) initWithCoder: (NSCoder *)coder
{
NSDecimalNumber *dn = nil;
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
unsigned int len = 0;
short exponent = (short)[coder decodeIntForKey: @"NS.exponent"];
@ -1522,6 +1592,15 @@ static BOOL _isInInterfaceBuilder = NO;
@end
// ...dummy/placeholder classes...
// overridden in NSTableView to be GSTableCornerView,
// but the class needs to be present to be overridden.
@interface _NSCornerView : NSView
@end
@implementation _NSCornerView
@end
// class needed for nib encoding/decoding by
@implementation NSPSMatrix
- (void) encodeWithCoder: (NSCoder *)coder

View file

@ -134,7 +134,7 @@
withZone: zone];
// report a problem if there is one.
if(loaded == NO)
if (loaded == NO)
{
NSLog(@"Could not load Gorm file: %@",fileName);
}

View file

@ -722,7 +722,7 @@
int i;
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeInt: _numberOfRows forKey: @"GSNumberOfRows"];
[aCoder encodeInt: _numberOfColumns forKey: @"GSNumberOfColumns"];
@ -792,7 +792,7 @@
[super initWithCoder: aDecoder];
[super setAutoresizesSubviews: NO];
if([aDecoder allowsKeyedCoding])
if ([aDecoder allowsKeyedCoding])
{
_numberOfRows = [aDecoder decodeIntForKey: @"GSNumberOfRows"];
_numberOfColumns = [aDecoder decodeIntForKey: @"GSNumberOfColumns"];

View file

@ -178,7 +178,7 @@ unCacheAttributes(NSDictionary *attrs)
- (void) encodeWithCoder: (NSCoder*)aCoder
{
if([aCoder allowsKeyedCoding] == NO)
if ([aCoder allowsKeyedCoding] == NO)
{
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &loc];
[aCoder encodeValueOfObjCType: @encode(id) at: &attrs];
@ -193,7 +193,7 @@ unCacheAttributes(NSDictionary *attrs)
- (id) initWithCoder: (NSCoder*)aCoder
{
if([aCoder allowsKeyedCoding] == NO)
if ([aCoder allowsKeyedCoding] == NO)
{
NSDictionary *a;
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &loc];

View file

@ -40,11 +40,15 @@
#include "AppKit/NSColorList.h"
#include "AppKit/NSGraphics.h"
#include "AppKit/NSImage.h"
#include "AppKit/NSImageView.h"
#include "AppKit/NSMatrix.h"
#include "AppKit/NSMenu.h"
#include "AppKit/NSPanel.h"
#include "AppKit/NSScrollView.h"
#include "AppKit/NSTextContainer.h"
#include "AppKit/NSTextField.h"
#include "AppKit/NSTextView.h"
#include "AppKit/NSScrollView.h"
#include "AppKit/NSView.h"
#include "AppKit/NSWindow.h"
#include "AppKit/NSBezierPath.h"
@ -81,8 +85,10 @@ typedef enum {
NSImage *images[9]; /** The tile images */
NSRect rects[9]; /** The rectangles to use when drawing */
}
- (id) copyWithZone: (NSZone*)zone;
- (id) initWithImage: (NSImage*)image;
- (id) initWithImage: (NSImage*)image horizontal: (float)x vertical: (float)y;
- (void) scaleUp: (int)multiple;
@end
@ -393,8 +399,8 @@ static NSNull *null = nil;
}
/*
* We could cache tile info here, but it's probabaly better for the
* tilesNamed: method to do it lazily.
* We could cache tile info here, but it's probably better for the
* tilesNamed:cache: method to do it lazily.
*/
/*
@ -562,10 +568,11 @@ static NSNull *null = nil;
return [GSThemeInspector sharedThemeInspector];
}
- (GSDrawTiles*) tilesNamed: (NSString*)aName
- (GSDrawTiles*) tilesNamed: (NSString*)aName cache: (BOOL)useCache
{
GSDrawTiles *tiles = [_tiles objectForKey: aName];
GSDrawTiles *tiles;
tiles = (useCache == YES) ? [_tiles objectForKey: aName] : nil;
if (tiles == nil)
{
NSDictionary *info;
@ -646,7 +653,7 @@ static NSNull *null = nil;
else
{
[_tiles setObject: tiles forKey: aName];
RELEASE(_tiles);
RELEASE(tiles);
}
}
if (tiles == (id)null)
@ -1043,10 +1050,10 @@ withRepeatedImage: (NSImage*)image
DPSgrestore (ctxt);
}
- (void) fillRect: (NSRect)rect
withTiles: (GSDrawTiles*)tiles
background: (NSColor*)color
fillStyle: (GSThemeFillStyle)style
- (NSRect) fillRect: (NSRect)rect
withTiles: (GSDrawTiles*)tiles
background: (NSColor*)color
fillStyle: (GSThemeFillStyle)style
{
NSGraphicsContext *ctxt = GSCurrentContext();
NSSize tls = tiles->rects[TileTL].size;
@ -1070,7 +1077,164 @@ withRepeatedImage: (NSImage*)image
}
NSRectFill(rect);
if (flipped)
if (style == GSThemeFillStyleMatrix)
{
NSRect grid;
float x;
float y;
float space = 3.0;
float scale;
inFill = NSZeroRect;
if (tiles->images[TileTM] == nil)
{
grid.size.width = (tiles->rects[TileTL].size.width
+ tiles->rects[TileTR].size.width
+ space * 3.0);
}
else
{
grid.size.width = (tiles->rects[TileTL].size.width
+ tiles->rects[TileTM].size.width
+ tiles->rects[TileTR].size.width
+ space * 4.0);
}
scale = floor(rect.size.width / grid.size.width);
if (tiles->images[TileCL] == nil)
{
grid.size.height = (tiles->rects[TileTL].size.height
+ tiles->rects[TileBL].size.height
+ space * 3.0);
}
else
{
grid.size.height = (tiles->rects[TileTL].size.height
+ tiles->rects[TileCL].size.height
+ tiles->rects[TileBL].size.height
+ space * 4.0);
}
if ((rect.size.height / grid.size.height) < scale)
{
scale = floor(rect.size.height / grid.size.height);
}
if (scale > 1)
{
/* We can scale up by an integer number of pixels and still
* fit in the rectangle.
*/
grid.size.width *= scale;
grid.size.height *= scale;
space *= scale;
tiles = AUTORELEASE([tiles copy]);
[tiles scaleUp: (int)scale];
}
grid.origin.x = rect.origin.x + (rect.size.width - grid.size.width) / 2;
x = grid.origin.x;
if (flipped)
{
grid.origin.y
= NSMaxY(rect) - (rect.size.height - grid.size.height) / 2;
y = NSMaxY(grid);
}
else
{
grid.origin.y
= rect.origin.y + (rect.size.height - grid.size.height) / 2;
y = grid.origin.y;
}
/* Draw bottom row
*/
if (flipped)
{
y -= (tiles->rects[TileBL].size.height + space);
}
else
{
y += space;
}
[tiles->images[TileBL] compositeToPoint: NSMakePoint(x, y)
fromRect: tiles->rects[TileBL]
operation: NSCompositeSourceOver];
x += tiles->rects[TileBL].size.width + space;
if (tiles->images[TileBM] != nil)
{
[tiles->images[TileBM] compositeToPoint: NSMakePoint(x, y)
fromRect: tiles->rects[TileBM]
operation: NSCompositeSourceOver];
x += tiles->rects[TileBM].size.width + space;
}
[tiles->images[TileBR] compositeToPoint: NSMakePoint(x, y)
fromRect: tiles->rects[TileBR]
operation: NSCompositeSourceOver];
if (!flipped)
{
y += tiles->rects[TileBL].size.height;
}
if (tiles->images[TileCL] != nil)
{
/* Draw middle row
*/
x = grid.origin.x;
if (flipped)
{
y -= (tiles->rects[TileCL].size.height + space);
}
else
{
y += space;
}
[tiles->images[TileCL] compositeToPoint: NSMakePoint(x, y)
fromRect: tiles->rects[TileCL]
operation: NSCompositeSourceOver];
x += tiles->rects[TileCL].size.width + space;
if (tiles->images[TileCM] != nil)
{
[tiles->images[TileCM] compositeToPoint: NSMakePoint(x, y)
fromRect: tiles->rects[TileCM]
operation: NSCompositeSourceOver];
x += tiles->rects[TileCM].size.width + space;
}
[tiles->images[TileCR] compositeToPoint: NSMakePoint(x, y)
fromRect: tiles->rects[TileCR]
operation: NSCompositeSourceOver];
if (!flipped)
{
y += tiles->rects[TileCL].size.height;
}
}
/* Draw top row
*/
x = grid.origin.x;
if (flipped)
{
y -= (tiles->rects[TileTL].size.height + space);
}
else
{
y += space;
}
[tiles->images[TileTL] compositeToPoint: NSMakePoint(x, y)
fromRect: tiles->rects[TileTL]
operation: NSCompositeSourceOver];
x += tiles->rects[TileTL].size.width + space;
if (tiles->images[TileTM] != nil)
{
[tiles->images[TileTM] compositeToPoint: NSMakePoint(x, y)
fromRect: tiles->rects[TileTM]
operation: NSCompositeSourceOver];
x += tiles->rects[TileTM].size.width + space;
}
[tiles->images[TileTR] compositeToPoint: NSMakePoint(x, y)
fromRect: tiles->rects[TileTR]
operation: NSCompositeSourceOver];
}
else if (flipped)
{
[self fillHorizontalRect:
NSMakeRect (rect.origin.x + bls.width,
@ -1126,32 +1290,54 @@ withRepeatedImage: (NSImage*)image
fromRect: tiles->rects[TileBR]
operation: NSCompositeSourceOver];
inFill = NSMakeRect (rect.origin.x +cls.width,
rect.origin.y + bms.height,
inFill = NSMakeRect (rect.origin.x + cls.width,
rect.origin.y + bms.height,
rect.size.width - cls.width - crs.width,
rect.size.height - bms.height - tms.height);
if (style == FillStyleCenter)
if (style == GSThemeFillStyleCenter)
{
[self fillRect: inFill
withRepeatedImage: tiles->images[TileCM]
fromRect: tiles->rects[TileCM]
center: NO];
}
else if (style == FillStyleRepeat)
{
[self fillRect: inFill
withRepeatedImage: tiles->images[TileCM]
fromRect: tiles->rects[TileCM]
center: NO];
}
else if (style == FillStyleScale)
{
[tiles->images[TileCM] setScalesWhenResized: YES];
[tiles->images[TileCM] setSize: inFill.size];
[tiles->images[TileCM] compositeToPoint: inFill.origin
NSRect r = tiles->rects[TileCM];
r.origin.x
= inFill.origin.x + (inFill.size.width - r.size.width) / 2;
r.origin.y
= inFill.origin.y + (inFill.size.height - r.size.height) / 2;
r.origin.y += r.size.height; // Allow for flip of image rectangle
[tiles->images[TileCM] compositeToPoint: r.origin
fromRect: tiles->rects[TileCM]
operation: NSCompositeSourceOver];
}
else if (style == GSThemeFillStyleRepeat)
{
[self fillRect: inFill
withRepeatedImage: tiles->images[TileCM]
fromRect: tiles->rects[TileCM]
center: NO];
}
else if (style == GSThemeFillStyleScale)
{
NSImage *im = [tiles->images[TileCM] copy];
NSRect r = tiles->rects[TileCM];
NSSize s = [tiles->images[TileCM] size];
NSPoint p = inFill.origin;
float sx = inFill.size.width / r.size.width;
float sy = inFill.size.height / r.size.height;
r.size.width = inFill.size.width;
r.size.height = inFill.size.height;
r.origin.x *= sx;
r.origin.y *= sy;
s.width *= sx;
s.height *= sy;
p.y += inFill.size.height; // In flipped view
[im setScalesWhenResized: YES];
[im setSize: s];
[im compositeToPoint: p
fromRect: r
operation: NSCompositeSourceOver];
RELEASE(im);
}
}
else
{
@ -1218,33 +1404,55 @@ withRepeatedImage: (NSImage*)image
operation: NSCompositeSourceOver];
inFill = NSMakeRect (rect.origin.x +cls.width,
rect.origin.y + bms.height,
rect.origin.y + bms.height,
rect.size.width - cls.width - crs.width,
rect.size.height - bms.height - tms.height);
if (style == FillStyleCenter)
if (style == GSThemeFillStyleCenter)
{
[self fillRect: inFill
withRepeatedImage: tiles->images[TileCM]
fromRect: tiles->rects[TileCM]
center: NO];
NSRect r = tiles->rects[TileCM];
r.origin.x
= inFill.origin.x + (inFill.size.width - r.size.width) / 2;
r.origin.y
= inFill.origin.y + (inFill.size.height - r.size.height) / 2;
[tiles->images[TileCM] compositeToPoint: r.origin
fromRect: tiles->rects[TileCM]
operation: NSCompositeSourceOver];
}
else if (style == FillStyleRepeat)
else if (style == GSThemeFillStyleRepeat)
{
[self fillRect: inFill
withRepeatedImage: tiles->images[TileCM]
fromRect: tiles->rects[TileCM]
center: YES];
}
else if (style == FillStyleScale)
else if (style == GSThemeFillStyleScale)
{
[tiles->images[TileCM] setScalesWhenResized: YES];
[tiles->images[TileCM] setSize: inFill.size];
[tiles->images[TileCM] compositeToPoint: inFill.origin
fromRect: tiles->rects[TileCM]
operation: NSCompositeSourceOver];
NSImage *im = [tiles->images[TileCM] copy];
NSRect r = tiles->rects[TileCM];
NSSize s = [tiles->images[TileCM] size];
NSPoint p = inFill.origin;
float sx = inFill.size.width / r.size.width;
float sy = inFill.size.height / r.size.height;
r.size.width = inFill.size.width;
r.size.height = inFill.size.height;
r.origin.x *= sx;
r.origin.y *= sy;
s.width *= sx;
s.height *= sy;
[im setScalesWhenResized: YES];
[im setSize: s];
[im compositeToPoint: p
fromRect: r
operation: NSCompositeSourceOver];
RELEASE(im);
}
}
return inFill;
}
- (void) fillVerticalRect: (NSRect)rect
@ -1293,6 +1501,35 @@ withRepeatedImage: (NSImage*)image
@implementation GSDrawTiles
- (id) copyWithZone: (NSZone*)zone
{
GSDrawTiles *c = (GSDrawTiles*)NSCopyObject(self, 0, zone);
unsigned i;
c->images[0] = [images[0] copy];
for (i = 1; i < 9; i++)
{
unsigned j;
for (j = 0; j < i; j++)
{
if (images[i] == images[j])
{
break;
}
}
if (j < i)
{
c->images[i] = RETAIN(c->images[j]);
}
else
{
c->images[i] = [images[i] copy];
}
}
return c;
}
- (void) dealloc
{
unsigned i;
@ -1352,6 +1589,49 @@ withRepeatedImage: (NSImage*)image
return self;
}
- (void) scaleUp: (int)multiple
{
if (multiple > 1)
{
unsigned i;
NSSize s;
[images[0] setScalesWhenResized: YES];
s = [images[0] size];
s.width *= multiple;
s.height *= multiple;
[images[0] setSize: s];
rects[0].size.height *= multiple;
rects[0].size.width *= multiple;
rects[0].origin.x *= multiple;
rects[0].origin.y *= multiple;
for (i = 1; i < 9; i++)
{
unsigned j;
for (j = 0; j < i; j++)
{
if (images[i] == images[j])
{
break;
}
}
if (j == i)
{
[images[i] setScalesWhenResized: YES];
s = [images[i] size];
s.width *= multiple;
s.height *= multiple;
[images[i] setSize: s];
}
rects[i].size.height *= multiple;
rects[i].size.width *= multiple;
rects[i].origin.x *= multiple;
rects[i].origin.y *= multiple;
}
}
}
@end
@ -1728,10 +2008,12 @@ static GSThemeInspector *sharedInspector = nil;
- (void) update: (id)sender
{
GSTheme *theme = [GSTheme theme];
NSString *details;
NSArray *authors;
NSView *content = [self contentView];
NSRect cFrame = [content frame];
NSView *view;
NSImageView *iv;
NSTextField *tf;
NSRect nameFrame;
NSRect frame;
@ -1740,11 +2022,17 @@ static GSThemeInspector *sharedInspector = nil;
{
[view removeFromSuperview];
}
frame = NSMakeRect(cFrame.size.width - 58, cFrame.size.height - 58, 48, 48);
iv = [[NSImageView alloc] initWithFrame: frame];
[iv setImage: [[GSTheme theme] icon]];
[content addSubview: iv];
tf = new_label([theme name]);
[tf setFont: [NSFont boldSystemFontOfSize: 32]];
[tf sizeToFit];
nameFrame = [tf frame];
nameFrame.origin.x = (cFrame.size.width - nameFrame.size.width) / 2;
nameFrame.origin.x
= (cFrame.size.width - frame.size.width - nameFrame.size.width) / 2;
nameFrame.origin.y = cFrame.size.height - nameFrame.size.height - 25;
[tf setFrame: nameFrame];
[content addSubview: tf];
@ -1761,6 +2049,40 @@ static GSThemeInspector *sharedInspector = nil;
[content addSubview: view];
}
details = [[theme infoDictionary] objectForKey: @"GSThemeDetails"];
if ([details length] > 0)
{
NSScrollView *s;
NSTextView *v;
NSRect r;
r = NSMakeRect(10, 10, cFrame.size.width - 20, frame.origin.y - 20);
s = [[NSScrollView alloc] initWithFrame: r];
[s setHasHorizontalScroller: NO];
[s setHasVerticalScroller: YES];
[s setBorderType: NSBezelBorder];
[s setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)];
[content addSubview: s];
RELEASE(s);
r = [[s documentView] frame];
v = [[NSTextView alloc] initWithFrame: r];
[v setBackgroundColor: [self backgroundColor]];
[v setHorizontallyResizable: YES];
[v setVerticallyResizable: YES];
[v setEditable: NO];
[v setRichText: YES];
[v setMinSize: NSMakeSize (0, 0)];
[v setMaxSize: NSMakeSize (1E7, 1E7)];
[v setAutoresizingMask: NSViewHeightSizable | NSViewWidthSizable];
[[v textContainer] setContainerSize:
NSMakeSize (r.size.width, 1e7)];
[[v textContainer] setWidthTracksTextView: YES];
[v setString: details];
[s setDocumentView: v];
RELEASE(v);
}
[content setNeedsDisplay: YES];
}

View file

@ -52,13 +52,15 @@
*/
@interface GSTTProvider : NSObject
{
id object;
void *data;
id object;
void *data;
NSRect viewRect;
}
- (void*) data;
- (id) initWithObject: (id)o userData: (void*)d;
- (id) initWithObject: (id)o userData: (void*)d rect: (NSRect)r;
- (id) object;
- (void) setObject: (id)o;
- (NSRect) viewRect;
@end
@implementation GSTTProvider
@ -66,10 +68,11 @@
{
return data;
}
- (id) initWithObject: (id)o userData: (void*)d
- (id) initWithObject: (id)o userData: (void*)d rect: (NSRect)r
{
data = d;
object = o;
viewRect = r;
return self;
}
- (id) object
@ -80,6 +83,10 @@
{
object = o;
}
- (NSRect) viewRect
{
return viewRect;
}
@end
@interface GSToolTips (Private)
@ -144,6 +151,7 @@ static BOOL restoreMouseMoved;
{
return -1; // A tip is already in progress.
}
aRect = NSIntersectionRect(aRect, [view bounds]);
if (NSEqualRects(aRect, NSZeroRect))
{
return -1; // No rectangle.
@ -153,7 +161,9 @@ static BOOL restoreMouseMoved;
return -1; // No provider object.
}
provider = [[GSTTProvider alloc] initWithObject: anObject userData: data];
provider = [[GSTTProvider alloc] initWithObject: anObject
userData: data
rect: aRect];
tag = [view addTrackingRect: aRect
owner: self
userData: provider
@ -277,23 +287,20 @@ static BOOL restoreMouseMoved;
if (rect->owner == self)
{
GSTTProvider *provider = (GSTTProvider *)rect->user_data;
NSRect frame;
// FIXME can we do anything with tooltips other than the main one?
if (rect->tag == toolTipTag)
{
NSTrackingRectTag tag;
NSRect frame;
[view removeTrackingRect: rect->tag];
frame = [view frame];
frame.origin.x = 0;
frame.origin.y = 0;
tag = [view addTrackingRect: frame
owner: self
userData: provider
assumeInside: NO];
toolTipTag = tag;
frame = [view bounds];
}
else
{
// FIXME is this the thing to do with tooltips other than
// the main one (which we know should cover the whole view)?
frame = [provider viewRect];
}
frame = [view convertRect: frame toView: nil];
[rect reset: frame inside: NO];
}
}
}
@ -352,16 +359,14 @@ static BOOL restoreMouseMoved;
{
NSRect rect;
rect = [view frame];
rect.origin.x = 0;
rect.origin.y = 0;
rect = [view bounds];
provider = [[GSTTProvider alloc] initWithObject: string
userData: nil];
userData: nil
rect: rect];
toolTipTag = [view addTrackingRect: rect
owner: self
userData: provider
assumeInside: NO];
owner: self
userData: provider
assumeInside: NO];
}
else
{

View file

@ -67,6 +67,14 @@
return rectangle;
}
- (void) reset: (NSRect)aRect inside: (BOOL)flag
{
rectangle = aRect;
flags.inside = flag;
flags.isValid = YES;
flags.checked = NO;
}
- (NSTrackingRectTag) tag
{
return tag;
@ -106,7 +114,7 @@
*/
- (void) encodeWithCoder: (NSCoder*)aCoder
{
if([aCoder allowsKeyedCoding] == NO)
if ([aCoder allowsKeyedCoding] == NO)
{
BOOL inside = flags.inside;
@ -119,7 +127,7 @@
- (id) initWithCoder: (NSCoder*)aDecoder
{
if([aDecoder allowsKeyedCoding] == NO)
if ([aDecoder allowsKeyedCoding] == NO)
{
BOOL inside;

View file

@ -163,7 +163,7 @@ enablingYResizing: (BOOL)aFlag
-(void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeBool: _haveViews forKey: @"GSHaveViews"];
[aCoder encodeFloat: _defaultMinYMargin forKey: @"GSDefaultMinYMargin"];
@ -178,7 +178,7 @@ enablingYResizing: (BOOL)aFlag
-(id) initWithCoder: (NSCoder*)aDecoder
{
[super initWithCoder: aDecoder];
if([aDecoder allowsKeyedCoding])
if ([aDecoder allowsKeyedCoding])
{
_haveViews = [aDecoder decodeBoolForKey: @"GSHaveViews"];
_defaultMinYMargin = [aDecoder decodeFloatForKey: @"GSDefaultMinYMargin"];

View file

@ -285,7 +285,7 @@ static Class controlClass;
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeInt: [self tag] forKey: @"NSTag"];
[aCoder encodeObject: [self target] forKey: @"NSTarget"];

View file

@ -3292,10 +3292,10 @@ image.</p><p>See Also: -applicationIconImage</p>
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
/*
if(_delegate != nil)
if (_delegate != nil)
{
[aCoder encodeObject: _delegate forKey: @"NSDelegate"];
}
@ -3316,10 +3316,10 @@ image.</p><p>See Also: -applicationIconImage</p>
id obj;
[super initWithCoder: aDecoder];
if([aDecoder allowsKeyedCoding])
if ([aDecoder allowsKeyedCoding])
{
/*
if([aDecoder containsValueForKey: @"NSDelegate"])
if ([aDecoder containsValueForKey: @"NSDelegate"])
{
obj = [aDecoder decodeObjectForKey: @"NSDelegate"];
[self setDelegate: obj];

View file

@ -948,7 +948,7 @@ static BOOL supports_lzw_compression = NO;
NSData *data = [self TIFFRepresentation];
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeObject: data forKey: @"NSTIFFRepresentation"];
}

View file

@ -152,7 +152,7 @@ static NSTextFieldCell *titleCell;
- (void) encodeWithCoder: (NSCoder *)aCoder
{
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
}
else
@ -169,7 +169,7 @@ static NSTextFieldCell *titleCell;
- (id) initWithCoder: (NSCoder *)aDecoder
{
if([aDecoder allowsKeyedCoding])
if ([aDecoder allowsKeyedCoding])
{
}
@ -2501,7 +2501,7 @@ static NSTextFieldCell *titleCell;
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
long flags = 0;

View file

@ -339,7 +339,7 @@ static NSFont *_leafFont;
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
// simply encodes prescence...
}

View file

@ -72,9 +72,18 @@
{
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeObject: _src forKey: @"NSSource"];
[aCoder encodeObject: _dst forKey: @"NSDestination"];
[aCoder encodeObject: _tag forKey: @"NSLabel"];
if (_src != nil)
{
[aCoder encodeObject: _src forKey: @"NSSource"];
}
if (_dst != nil)
{
[aCoder encodeObject: _dst forKey: @"NSDestination"];
}
if (_tag != nil)
{
[aCoder encodeObject: _tag forKey: @"NSLabel"];
}
}
else
{
@ -92,9 +101,18 @@
{
if ([aDecoder allowsKeyedCoding])
{
ASSIGN(_dst, [aDecoder decodeObjectForKey: @"NSDestination"]);
ASSIGN(_src, [aDecoder decodeObjectForKey: @"NSSource"]);
ASSIGN(_tag, [aDecoder decodeObjectForKey: @"NSLabel"]);
if ([aDecoder containsValueForKey: @"NSDestination"])
{
ASSIGN(_dst, [aDecoder decodeObjectForKey: @"NSDestination"]);
}
if ([aDecoder containsValueForKey: @"NSSource"])
{
ASSIGN(_src, [aDecoder decodeObjectForKey: @"NSSource"]);
}
if ([aDecoder containsValueForKey: @"NSLabel"])
{
ASSIGN(_tag, [aDecoder decodeObjectForKey: @"NSLabel"]);
}
}
else
{
@ -305,7 +323,7 @@
NSString *modelPath = [rootPath stringByAppendingPathComponent: fileName];
NSString *path = [GSModelLoaderFactory supportedModelFileAtPath: modelPath];
if(path != nil)
if (path != nil)
{
return path;
}

View file

@ -1448,7 +1448,7 @@ typedef struct _GSButtonCellFlags
BOOL tmp;
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
GSButtonCellFlags buttonCellFlags;
unsigned int bFlags = 0;
@ -1456,15 +1456,15 @@ typedef struct _GSButtonCellFlags
NSImage *image = [self image];
NSButtonImageSource *bi = nil;
if([self keyEquivalent] != nil)
if ([self keyEquivalent] != nil)
{
[aCoder encodeObject: [self keyEquivalent] forKey: @"NSKeyEquivalent"];
}
if([self image] != nil)
if ([self image] != nil)
{
[aCoder encodeObject: [self image] forKey: @"NSNormalImage"];
}
if([self alternateTitle] != nil)
if ([self alternateTitle] != nil)
{
[aCoder encodeObject: [self alternateTitle] forKey: @"NSAlternateContents"];
}
@ -1503,15 +1503,15 @@ typedef struct _GSButtonCellFlags
[aCoder encodeInt: bFlags2 forKey: @"NSButtonFlags2"];
// alternate image encoding...
if(image != nil)
if (image != nil)
{
if ([image isKindOfClass: [NSImage class]] && buttonCellFlags.useButtonImageSource)
{
if([NSImage imageNamed: @"NSSwitch"] == image)
if ([NSImage imageNamed: @"NSSwitch"] == image)
{
bi = [[NSButtonImageSource alloc] initWithImageNamed: @"NSHighlightedSwitch"];
}
else if([NSImage imageNamed: @"NSRadioButton"] == image)
else if ([NSImage imageNamed: @"NSRadioButton"] == image)
{
bi = [[NSButtonImageSource alloc] initWithImageNamed: @"NSHighlightedRadioButton"];
}
@ -1519,11 +1519,11 @@ typedef struct _GSButtonCellFlags
}
// encode button image source, if it exists...
if(bi != nil)
if (bi != nil)
{
[aCoder encodeObject: bi forKey: @"NSAlternateImage"];
}
else if(_altImage != nil)
else if (_altImage != nil)
{
[aCoder encodeObject: _altImage forKey: @"NSAlternateImage"];
}
@ -1657,18 +1657,18 @@ typedef struct _GSButtonCellFlags
image = [aDecoder decodeObjectForKey: @"NSAlternateImage"];
if ([image isKindOfClass: [NSImage class]])
{
if([NSImage imageNamed: @"NSSwitch"] == image)
if ([NSImage imageNamed: @"NSSwitch"] == image)
{
image = [NSImage imageNamed: @"NSHighlightedSwitch"];
if([self image] == nil)
if ([self image] == nil)
{
[self setImage: [NSImage imageNamed: @"NSSwitch"]];
}
}
else if([NSImage imageNamed: @"NSRadioButton"] == image)
else if ([NSImage imageNamed: @"NSRadioButton"] == image)
{
image = [NSImage imageNamed: @"NSHighlightedRadioButton"];
if([self image] == nil)
if ([self image] == nil)
{
[self setImage: [NSImage imageNamed: @"NSRadioButton"]];
}

View file

@ -167,7 +167,7 @@
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding] == NO)
if ([aCoder allowsKeyedCoding] == NO)
{
[aCoder encodeObject: _window];
[aCoder encodeRect: _rect];
@ -177,7 +177,7 @@
- (id) initWithCoder: (NSCoder*)aDecoder
{
self = [super initWithCoder: aDecoder];
if([aDecoder allowsKeyedCoding] == NO)
if ([aDecoder allowsKeyedCoding] == NO)
{
[aDecoder decodeValueOfObjCType: @encode(id) at: &_window];
_rect = [aDecoder decodeRect];

View file

@ -2179,7 +2179,7 @@ static NSColor *shadowCol;
*/
- (void) encodeWithCoder: (NSCoder*)aCoder
{
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
unsigned long cFlags = 0;
unsigned int cFlags2 = 0;
@ -2216,7 +2216,7 @@ static NSColor *shadowCol;
// font and formatter.
[aCoder encodeObject: [self font] forKey: @"NSSupport"];
if([self formatter])
if ([self formatter])
{
[aCoder encodeObject: [self formatter] forKey: @"NSFormatter"];
}
@ -2292,11 +2292,11 @@ static NSColor *shadowCol;
id contents = [aDecoder decodeObjectForKey: @"NSContents"];
// initialize based on content...
if([contents isKindOfClass: [NSString class]])
if ([contents isKindOfClass: [NSString class]])
{
self = [self initTextCell: contents];
}
else if([contents isKindOfClass: [NSImage class]])
else if ([contents isKindOfClass: [NSImage class]])
{
self = [self initImageCell: contents];
}

View file

@ -753,16 +753,16 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
unsigned int flags = 0;
[aCoder encodeObject: [self backgroundColor] forKey: @"NSBGColor"];
[aCoder encodeObject: [self documentCursor] forKey: @"NSCursor"];
[aCoder encodeObject: [self documentView] forKey: @"NSDocView"];
if([self drawsBackground])
if ([self drawsBackground])
flags |= 4;
if([self copiesOnScroll] == NO)
if ([self copiesOnScroll] == NO)
flags |= 2;
[aCoder encodeInt: flags forKey: @"NScvFlags"];

View file

@ -235,7 +235,7 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeObject: _the_color forKey: @"NSColor"];
// [aCoder encodeBool: _is_active forKey: @"NSEnabled"];
@ -258,7 +258,7 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
self = [super initWithCoder: aDecoder];
if (self != nil)
{
if([aDecoder allowsKeyedCoding])
if ([aDecoder allowsKeyedCoding])
{
NSString *action;

View file

@ -1654,7 +1654,7 @@ static inline NSRect buttonCellFrameFromRect(NSRect cellRect)
{
[super encodeWithCoder: coder];
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
[coder encodeBool: [self hasVerticalScroller] forKey: @"NSHasVerticalScroller"];
[coder encodeInt: [self numberOfVisibleItems] forKey: @"NSVisibleItemCount"];

View file

@ -833,7 +833,7 @@ static Class actionCellClass;
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeObject: [self cell] forKey: @"NSCell"];
[aCoder encodeBool: [self isEnabled] forKey: @"NSEnabled"];

View file

@ -270,7 +270,7 @@
{
BOOL flag = NO;
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeInt: linkNumber forKey: @"GSLinkNumber"];
[aCoder encodeInt: disposition forKey: @"GSUpdateMode"];
@ -337,7 +337,7 @@
- (id) initWithCoder: (NSCoder*)aCoder
{
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
id obj;

View file

@ -333,7 +333,7 @@
{
BOOL flag = NO;
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeObject: filename forKey: @"GSFilename"];
[aCoder encodeObject: sourceLinks forKey: @"GSSourceLinks"];
@ -367,7 +367,7 @@
- (id) initWithCoder: (NSCoder*)aCoder
{
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
BOOL flag = NO;
id obj;

View file

@ -464,7 +464,7 @@
ASSIGN(_saveType, [controller _nameForHumanReadableType:
[sender titleOfSelectedItem]]);
extensions = [controller fileExtensionsFromType: _saveType];
if([extensions count] > 0)
if ([extensions count] > 0)
{
[(NSSavePanel *)[sender window] setRequiredFileType: [extensions objectAtIndex:0]];
}
@ -484,7 +484,7 @@
- (void) _createPanelAccessory
{
if(savePanelAccessory == nil)
if (savePanelAccessory == nil)
{
NSRect accessoryFrame = NSMakeRect(0,0,380,70);
NSRect spaFrame = NSMakeRect(115,14,150,22);
@ -507,7 +507,7 @@
NSString *title = nil;
int i = 0;
while((title = [en nextObject]) != nil)
while ((title = [en nextObject]) != nil)
{
[spaButton addItemWithTitle: title];
i++;
@ -517,11 +517,11 @@
[spaButton setEnabled: (i > 0)];
// if we have some items, select the current filetype.
if(i > 0)
if (i > 0)
{
NSString *title = [[NSDocumentController sharedDocumentController]
displayNameForType: [self fileType]];
if([spaButton itemWithTitle: title] != nil)
if ([spaButton itemWithTitle: title] != nil)
{
[spaButton selectItemWithTitle: title];
}
@ -558,7 +558,7 @@
{
NSArray *extensions = [[NSDocumentController sharedDocumentController]
fileExtensionsFromType: [self fileTypeFromLastRunSavePanel]];
if([extensions count] > 0)
if ([extensions count] > 0)
{
[savePanel setRequiredFileType:[extensions objectAtIndex:0]];
}
@ -736,7 +736,7 @@
NSArray *extensions = [[NSDocumentController sharedDocumentController]
fileExtensionsFromType: fileType];
if([extensions count] > 0)
if ([extensions count] > 0)
{
NSString *extension = [extensions objectAtIndex: 0];
NSString *newFileName = [[fileName stringByDeletingPathExtension]

View file

@ -873,7 +873,7 @@ static NSString *NSViewerRole = @"Viewer";
NSEnumerator *en = [types objectEnumerator];
NSString *type = nil;
NSMutableArray *result = [NSMutableArray arrayWithCapacity: 10];
while((type = (NSString *)[en nextObject]) != nil)
while ((type = (NSString *)[en nextObject]) != nil)
{
NSString *name = [self displayNameForType: type];
[result addObject: name];

View file

@ -33,6 +33,7 @@
#include <Foundation/NSMapTable.h>
#include <Foundation/NSException.h>
#include <Foundation/NSDebug.h>
#include <Foundation/NSValue.h>
#include "AppKit/NSGraphicsContext.h"
#include "AppKit/NSFont.h"
@ -408,8 +409,11 @@ static NSFont *getNSFont(float fontSize, int role)
static void setNSFont(NSString *key, NSFont *font)
{
int i;
[defaults setObject: [font fontName] forKey: key];
[defaults setObject: [font fontName] forKey: key];
[defaults setObject: [NSNumber numberWithFloat: [font pointSize]]
forKey: [NSString stringWithFormat: @"%@Size",key]];
for (i = 1; i < RoleMax; i++)
{
DESTROY(font_roles[i].cachedFont);

View file

@ -395,10 +395,10 @@ static NSColor *shadowCol;
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
/*
if([self stringValue] != nil)
if ([self stringValue] != nil)
{
[aCoder encodeObject: [self stringValue] forKey: @"NSContents"];
}

View file

@ -966,7 +966,7 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
if ([GSCurrentContext() isDrawingToScreen] == NO)
{
/* Reset alpha for image drawing. */
[[NSColor whiteColor] set];
[[NSColor colorWithCalibratedWhite: 1.0 alpha: 1.0] set];
}
}
@ -1479,11 +1479,11 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
{
BOOL flag;
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
// FIXME: Not sure this is the way it goes...
/*
if(_flags.archiveByName == NO)
if (_flags.archiveByName == NO)
{
NSMutableArray *container = [NSMutableArray array];
NSMutableArray *reps = [NSMutableArray array];
@ -1492,7 +1492,7 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
// add the reps to the container...
[container addObject: reps];
while((rd = [en nextObject]) != nil)
while ((rd = [en nextObject]) != nil)
{
[reps addObject: rd->rep];
}

View file

@ -369,7 +369,7 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
- (void) encodeWithCoder: (NSCoder *)aCoder
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeInt: _imageAlignment forKey: @"NSAlign"];
[aCoder encodeInt: _imageScaling forKey: @"NSScale"];
@ -387,7 +387,7 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
- (id) initWithCoder: (NSCoder *)aDecoder
{
if((self = [super initWithCoder: aDecoder]) != nil)
if ((self = [super initWithCoder: aDecoder]) != nil)
{
if ([aDecoder allowsKeyedCoding])
{

View file

@ -153,8 +153,8 @@ static Class imageCellClass;
- (NSDragOperation) draggingEntered: (id <NSDraggingInfo>)sender
{
if (([sender draggingSource] != self) && ([self isEditable]) &&
([NSImage canInitWithPasteboard: [sender draggingPasteboard]]))
if (([sender draggingSource] != self) && ([self isEditable])
&& ([NSImage canInitWithPasteboard: [sender draggingPasteboard]]))
{
[_cell setHighlighted: YES];
return NSDragOperationCopy;
@ -226,7 +226,6 @@ static Class imageCellClass;
// Center the image on the mouse position ... is this right?
s = [anImage size];
p = [theEvent locationInWindow];
p = [self convertPoint: p fromView: nil];
p.x -= s.width/2;
p.y -= s.width/2;
[_window dragImage: anImage
@ -279,7 +278,7 @@ static Class imageCellClass;
- (void) encodeWithCoder: (NSCoder *)aCoder
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeBool: [self isEditable] forKey: @"NSEditable"];
}

View file

@ -1277,13 +1277,13 @@ static NSNotificationCenter *nc;
*/
- (void) encodeWithCoder: (NSCoder*)encoder
{
if([encoder allowsKeyedCoding])
if ([encoder allowsKeyedCoding])
{
[encoder encodeObject: _title forKey: @"NSTitle"];
[encoder encodeObject: _items forKey: @"NSMenuItems"];
// if there is no supermenu, make it the main menu.
if([self supermenu] == nil)
if ([self supermenu] == nil)
{
[encoder encodeObject: @"_NSMainMenu" forKey: @"NSName"];
}

View file

@ -89,6 +89,16 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
return _cell.is_highlighted;
}
- (NSColor *)textColor
{
if(_cell.is_highlighted && [self isEnabled])
{
return [NSColor selectedMenuItemTextColor];
}
return [super textColor];
}
- (void) setMenuItem: (NSMenuItem *)item
{
ASSIGN (_menuItem, item);

View file

@ -1592,7 +1592,7 @@ _addLeftBorderOffsetToRect(NSRect aRect)
- (void) encodeWithCoder: (NSCoder*)encoder
{
[super encodeWithCoder: encoder];
if([encoder allowsKeyedCoding] == NO)
if ([encoder allowsKeyedCoding] == NO)
{
[encoder encodeObject: _itemCells];
[encoder encodeObject: _font];
@ -1605,7 +1605,7 @@ _addLeftBorderOffsetToRect(NSRect aRect)
- (id) initWithCoder: (NSCoder*)decoder
{
self = [super initWithCoder: decoder];
if([decoder allowsKeyedCoding] == NO)
if ([decoder allowsKeyedCoding] == NO)
{
[decoder decodeValueOfObjCType: @encode(id) at: &_itemCells];

View file

@ -206,7 +206,7 @@
// objects and is going to be deprecated in the future. There just so
// happens to be a one to one correspondence here.
//
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
// TODO_NIB: Need to verify this key...
ASSIGN(_nibData, [coder decodeObjectForKey: @"NSData"]);
@ -225,7 +225,7 @@
- (void) encodeWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
// TODO_NIB: Need to verify this key...
[coder encodeObject: _nibData

View file

@ -451,7 +451,7 @@ enum {
[NSDecimalNumber decimalNumberWithString: @"1.0"]];
[scaleFormatter setMaximum:
[NSDecimalNumber decimalNumberWithString: @"100000.0"]];
[NSDecimalNumber decimalNumberWithString: @"1000.0"]];
[scaleFormatter setHasThousandSeparators: NO];
[scaleTextField setFormatter: scaleFormatter];
@ -836,6 +836,10 @@ enum {
NSLog(@"NSPrintScalingFactor was nil in NSPrintInfo");
scaleNumber = [NSNumber numberWithFloat: 100.0];
}
else
{
scaleNumber = [NSNumber numberWithDouble: (100.0*[scaleNumber doubleValue])];
}
[scaleTextField setObjectValue: scaleNumber];
@ -909,8 +913,8 @@ enum {
[_printInfo setOrientation: NSLandscapeOrientation];
}
//Write scaling
scaleNumber = [NSNumber numberWithFloat: [scaleTextField floatValue]];
//Write scaling and don't forget to convert from percent
scaleNumber = [NSNumber numberWithDouble: [scaleTextField doubleValue]/100.0];
[[_printInfo dictionary] setObject: scaleNumber
forKey: NSPrintScalingFactor];

View file

@ -163,7 +163,7 @@
BOOL flag;
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
// Nothing to do here, for keyed coding this is handled by NSWindowTemplate.
// Calling the above method should throw an NSInvalidArgumentException.
@ -184,7 +184,7 @@
BOOL flag;
[super initWithCoder: aDecoder];
if([aDecoder allowsKeyedCoding])
if ([aDecoder allowsKeyedCoding])
{
// Nothing to do here, for keyed coding this is handled by NSWindowTemplate.
// Calling the above method should throw an NSInvalidArgumentException.

View file

@ -314,7 +314,7 @@ static NSParagraphStyle *defaultStyle = nil;
- (id) initWithCoder: (NSCoder*)aCoder
{
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
// TODO_NIB: Determine keys for NSParagraphStyle, if there are any.
}
@ -371,7 +371,7 @@ static NSParagraphStyle *defaultStyle = nil;
- (void) encodeWithCoder: (NSCoder*)aCoder
{
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
// TODO_NIB: Determine keys for NSParagraphStyle, if there are any.
}

View file

@ -959,7 +959,7 @@ static NSImage *_pbc_image[2];
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeBool: [self altersStateOfSelectedItem] forKey: @"NSAltersState"];
[aCoder encodeBool: [self usesItemFromMenu] forKey: @"NSUsesItemFromMenu"];
@ -967,7 +967,7 @@ static NSImage *_pbc_image[2];
[aCoder encodeInt: [self preferredEdge] forKey: @"NSPreferredEdge"];
// encode the menu, if present.
if(_menu != nil)
if (_menu != nil)
{
[aCoder encodeObject: _menu forKey: @"NSMenu"];
}

View file

@ -734,11 +734,11 @@ scaleRect(NSRect rect, double scale)
/* Scale bounds by the user specified scaling */
info->scaledBounds = scaleRect(_rect, info->printScale);
info->pageScale = 1; // default
if (knowsRange == NO)
{
/* Now calculate page fitting to get page scale */
info->pageScale = 1;
if ([_printInfo horizontalPagination] == NSFitPagination)
info->pageScale = info->paperBounds.size.width
/ NSWidth(info->scaledBounds);
@ -879,6 +879,12 @@ scaleRect(NSRect rect, double scale)
{
viewPageRange = NSMakeRange(1, (info.xpages * info.ypages));
}
else
{
info.xpages = 1;
info.ypages = viewPageRange.length;
}
[dict setObject: NSNUMBER(NSMaxRange(viewPageRange))
forKey: @"NSPrintTotalPages"];
if (allPages == YES)

View file

@ -646,7 +646,7 @@ static NSMutableDictionary* printerCache;
//
- (void) encodeWithCoder: (NSCoder*)aCoder
{
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
// TODO: Determine keys for NSPrinter.
}
@ -662,7 +662,7 @@ static NSMutableDictionary* printerCache;
- (id) initWithCoder: (NSCoder*)aDecoder
{
if([aDecoder allowsKeyedCoding])
if ([aDecoder allowsKeyedCoding])
{
// TODO: Determine keys for NSPrinter.
}

View file

@ -290,7 +290,7 @@ static NSColor *fillColour = nil;
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[super encodeWithCoder:aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
unsigned long flags = 0;
id matrix = AUTORELEASE([[NSPSMatrix alloc] init]);

View file

@ -1218,7 +1218,7 @@ static float scrollerWidth;
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
unsigned long flags = 0;
GSScrollViewFlags scrollViewFlags;
@ -1228,7 +1228,7 @@ static float scrollerWidth;
[aCoder encodeObject: _contentView forKey: @"NSContentView"];
// only encode this, if it's not null...
if(_headerClipView != nil)
if (_headerClipView != nil)
{
[aCoder encodeObject: _headerClipView forKey: @"NSHeaderClipView"];
}
@ -1316,7 +1316,7 @@ static float scrollerWidth;
NSRect frame = [content frame];
float w = [vScroller frame].size.width;
if(_hasVertScroller)
if (_hasVertScroller)
{
//
// Slide the content view over, since on Mac OS X the scroller is on the

View file

@ -284,7 +284,7 @@
NSDivideRect(rect, &search, &part, ICON_WIDTH, NSMinXEdge);
}
if(!_cancel_button_cell)
if (!_cancel_button_cell)
{
// nothing to split off
text = part;

View file

@ -135,7 +135,7 @@
- (id) initWithCoder: (NSCoder *)decoder
{
self = [super initWithCoder: decoder];
if([decoder allowsKeyedCoding])
if ([decoder allowsKeyedCoding])
{
// do nothing for now...
}

View file

@ -211,7 +211,7 @@ typedef enum
//
- (void) encodeWithCoder: (NSCoder*)aCoder
{
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeBool: _isWellKnownSelection
forKey: @"GSIsWellKnownSelection"];
@ -234,7 +234,7 @@ typedef enum
- (id) initWithCoder: (NSCoder*)aDecoder
{
[super init];
if([aDecoder allowsKeyedCoding])
if ([aDecoder allowsKeyedCoding])
{
_isWellKnownSelection = [aDecoder decodeBoolForKey: @"GSIsWellKnownSelection"];
_selectionType = [aDecoder decodeIntForKey: @"GSSelectionType"];

View file

@ -727,7 +727,7 @@ float _floatValueForMousePoint (NSPoint point, NSRect knobRect,
- (id) initWithCoder: (NSCoder*)decoder
{
self = [super initWithCoder: decoder];
if([decoder allowsKeyedCoding])
if ([decoder allowsKeyedCoding])
{
_allowsTickMarkValuesOnly = [decoder decodeBoolForKey: @"NSAllowsTickMarkValuesOnly"];
_numberOfTickMarks = [decoder decodeIntForKey: @"NSNumberOfTickMarks"];
@ -769,7 +769,7 @@ float _floatValueForMousePoint (NSPoint point, NSRect knobRect,
- (void) encodeWithCoder: (NSCoder*)coder
{
[super encodeWithCoder: coder];
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
[coder encodeBool: _allowsTickMarkValuesOnly forKey: @"NSAllowsTickMarkValuesOnly"];
[coder encodeInt: _numberOfTickMarks forKey: @"NSNumberOfTickMarks"];

View file

@ -667,7 +667,7 @@ return NO; \
//
- (void) encodeWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
// TODO_NIB: Determine keys for NSSound.
}
@ -701,7 +701,7 @@ return NO; \
- (id) initWithCoder: (NSCoder*)decoder
{
if([decoder allowsKeyedCoding])
if ([decoder allowsKeyedCoding])
{
// TODO_NIB: Determine keys for NSSound.
}

View file

@ -449,7 +449,7 @@ static inline void HighlightDownButton(NSRect aRect)
{
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeDouble: [self increment] forKey: @"NSIncrement"];
[aCoder encodeDouble: [self maxValue] forKey: @"NSMaxValue"];
@ -481,13 +481,13 @@ static inline void HighlightDownButton(NSRect aRect)
{
[super initWithCoder: aDecoder];
if([aDecoder allowsKeyedCoding])
if ([aDecoder allowsKeyedCoding])
{
_autorepeat = [aDecoder decodeBoolForKey: @"NSAutorepeat"];
_valueWraps = [aDecoder decodeBoolForKey: @"NSValueWraps"];
_increment = [aDecoder decodeDoubleForKey: @"NSIncrement"];
_maxValue = [aDecoder decodeDoubleForKey: @"NSMaxValue"];
if([aDecoder containsValueForKey: @"NSMinValue"])
if ([aDecoder containsValueForKey: @"NSMinValue"])
{
_minValue = [aDecoder decodeDoubleForKey: @"NSMinValue"];
}

View file

@ -370,7 +370,7 @@
- (void) encodeWithCoder: (NSCoder*)aCoder
{
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeObject: _identifier forKey: @"NSIdentifier"];
[aCoder encodeObject: _dataCell forKey: @"NSDataCell"];

View file

@ -5120,19 +5120,19 @@ static inline float computePeriod(NSPoint mouseLocationWin,
// make sure the corner view is properly encoded...
[super encodeWithCoder: aCoder];
if([self dataSource])
if ([self dataSource])
{
[aCoder encodeObject: [self dataSource] forKey: @"NSDataSource"];
}
if([self delegate])
if ([self delegate])
{
[aCoder encodeObject: [self delegate] forKey: @"NSDelegate"];
}
if([self target])
if ([self target])
{
[aCoder encodeObject: [self target] forKey: @"NSTarget"];
}
if([self action])
if ([self action])
{
[aCoder encodeObject: NSStringFromSelector([self action]) forKey: @"NSAction"];
}
@ -5144,11 +5144,11 @@ static inline float computePeriod(NSPoint mouseLocationWin,
[aCoder encodeFloat: [self rowHeight] forKey: @"NSRowHeight"];
[aCoder encodeObject: [self tableColumns] forKey: @"NSTableColumns"];
if(_headerView)
if (_headerView)
{
[aCoder encodeObject: _headerView forKey: @"NSHeaderView"];
}
if(_cornerView)
if (_cornerView)
{
[aCoder encodeObject: _cornerView forKey: @"NSCornerView"];
}

View file

@ -323,7 +323,7 @@
*/
- (void) encodeWithCoder: (NSCoder*)aCoder
{
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
// TODO_NIB: Determine keys for NSTextAttachment.
}
@ -336,7 +336,7 @@
- (id) initWithCoder: (NSCoder*)aDecoder
{
if([aDecoder allowsKeyedCoding])
if ([aDecoder allowsKeyedCoding])
{
// TODO_NIB: Determine keys for NSTextAttachment.
}

View file

@ -464,7 +464,7 @@ framework intact.
- (void) encodeWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
NSSize size = _containerRect.size;
int flags = ((_widthTracksTextView)?1:0) |

View file

@ -709,7 +709,7 @@ static Class textFieldCellClass;
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
if(![aCoder allowsKeyedCoding])
if (![aCoder allowsKeyedCoding])
{
[aCoder encodeConditionalObject: _delegate];
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_error_action];
@ -719,7 +719,7 @@ static Class textFieldCellClass;
- (id) initWithCoder: (NSCoder*)aDecoder
{
self = [super initWithCoder: aDecoder];
if([aDecoder allowsKeyedCoding])
if ([aDecoder allowsKeyedCoding])
{
// do nothing for now...
}

View file

@ -208,7 +208,7 @@ static NSColor *txtCol;
BOOL tmp;
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
[aCoder encodeObject: [self backgroundColor] forKey: @"NSBackgroundColor"];
[aCoder encodeObject: [self textColor] forKey: @"NSTextColor"];

View file

@ -355,7 +355,7 @@ static NSNotificationCenter *nc = nil;
- (void) encodeWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
[coder encodeObject: [self delegate] forKey: @"NSDelegate"];
[coder encodeObject: [self string] forKey: @"NSString"];

View file

@ -149,7 +149,7 @@ Interface for a bunch of internal methods that need to be cleaned up.
- (id) initWithTextView: (NSTextView *)tv
{
if((self = [super init]) != nil)
if ((self = [super init]) != nil)
{
flags = (([tv isEditable]?0x01:0) |
([tv isSelectable]?0x02:0) |
@ -198,7 +198,7 @@ Interface for a bunch of internal methods that need to be cleaned up.
- (void) encodeWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
if ([coder allowsKeyedCoding])
{
[coder encodeObject: backgroundColor forKey: @"NSBackgroundColor"];
[coder encodeObject: paragraphStyle forKey: @"NSDefaultParagraphStyle"];
@ -696,7 +696,7 @@ that makes decoding and encoding compatible with the old code.
[super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
NSTextViewSharedData *tvsd = [[NSTextViewSharedData alloc] initWithTextView: self];

View file

@ -302,12 +302,26 @@ GSSetDragTypes(NSView* obj, NSArray *types)
}
else
{
NSRect superviewsVisibleRect;
BOOL wasFlipped = _super_view->_rFlags.flipped_view;
NSRect superviewsVisibleRect;
BOOL wasFlipped = _super_view->_rFlags.flipped_view;
NSAffineTransform *pMatrix = [_super_view _matrixToWindow];
NSAffineTransform *tMatrix = nil;
[_matrixToWindow takeMatrixFromTransform: pMatrix];
(*preImp)(_matrixToWindow, preSel, _frameMatrix);
/* prepend translation */
tMatrix = _matrixToWindow;
tMatrix->matrix.tX = NSMinX(_frame) * tMatrix->matrix.m11 +
NSMinY(_frame) * tMatrix->matrix.m21 + tMatrix->matrix.tX;
tMatrix->matrix.tY = NSMinX(_frame) * tMatrix->matrix.m12 +
NSMinY(_frame) * tMatrix->matrix.m22 + tMatrix->matrix.tY;
/* prepend rotation */
if (_frameMatrix != nil)
{
(*preImp)(_matrixToWindow, preSel, _frameMatrix);
}
if (_rFlags.flipped_view != wasFlipped)
{
/*
@ -428,11 +442,9 @@ GSSetDragTypes(NSView* obj, NSArray *types)
_bounds.origin = NSZeroPoint; // Set bounds rectangle
_bounds.size = _frame.size;
_frameMatrix = [NSAffineTransform new]; // Map fromsuperview to frame
_boundsMatrix = [NSAffineTransform new]; // Map fromsuperview to bounds
_matrixToWindow = [NSAffineTransform new]; // Map to window coordinates
_matrixFromWindow = [NSAffineTransform new]; // Map from window coordinates
[_frameMatrix setFrameOrigin: _frame.origin];
_sub_views = [NSMutableArray new];
_tracking_rects = [NSMutableArray new];
@ -559,7 +571,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
RELEASE(_matrixToWindow);
RELEASE(_matrixFromWindow);
RELEASE(_frameMatrix);
TEST_RELEASE(_frameMatrix);
RELEASE(_boundsMatrix);
TEST_RELEASE(_sub_views);
if (_rFlags.has_tooltips != 0)
@ -1050,11 +1062,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
_bounds.size = frameRect.size;
if (changedOrigin)
{
[_frameMatrix setFrameOrigin: _frame.origin];
}
if (changedSize && _is_rotated_or_scaled_from_base)
{
[self _updateBoundsMatrix];
@ -1082,7 +1089,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
(*invalidateImp)(self, invalidateSel);
}
_frame.origin = newOrigin;
[_frameMatrix setFrameOrigin: _frame.origin];
if (_post_frame_changes)
{
@ -1134,10 +1140,17 @@ GSSetDragTypes(NSView* obj, NSArray *types)
- (void) setFrameRotation: (float)angle
{
/* no frame matrix, create one since it is needed for rotation */
if (_frameMatrix == nil)
{
_frameMatrix = [NSAffineTransform new]; // Map fromsuperview to frame
}
if (_coordinates_valid)
{
(*invalidateImp)(self, invalidateSel);
}
[_frameMatrix setFrameRotation: angle];
_is_rotated_from_base = _is_rotated_or_scaled_from_base = YES;
@ -2072,10 +2085,15 @@ static NSRect convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matri
NSRect subviewFrame = subview->_frame;
BOOL intersectCalculated = NO;
if ([subview->_frameMatrix isRotated])
if (subview->_frameMatrix) // assume rotation
{
[subview->_frameMatrix boundingRectFor: subviewFrame
result: &subviewFrame];
NSRect r;
r.origin = NSZeroPoint;
r.size = subviewFrame.size;
[subview->_frameMatrix boundingRectFor: r result: &r];
subviewFrame = NSOffsetRect(r, NSMinX(subviewFrame),
NSMinY(subviewFrame));
}
/*
@ -2201,9 +2219,16 @@ static NSRect convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matri
NSRect isect;
BOOL intersectCalculated = NO;
if ([subview->_frameMatrix isRotated] == YES)
[subview->_frameMatrix boundingRectFor: subviewFrame
result: &subviewFrame];
if (subview->_frameMatrix != nil)
{
NSRect r;
r.origin = NSZeroPoint;
r.size = subviewFrame.size;
[subview->_frameMatrix boundingRectFor: r result: &r];
subviewFrame = NSOffsetRect(r, NSMinX(subviewFrame),
NSMinY(subviewFrame));
}
/*
* Having drawn ourself into the rect, we must make sure that
@ -2220,7 +2245,7 @@ static NSRect convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matri
*/
subview->_rFlags.needs_display = YES;
subview->_invalidRect = NSUnionRect(subview->_invalidRect,
isect);
isect);
}
if (subview->_rFlags.needs_display == YES)
@ -2829,16 +2854,28 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
unsigned count;
NSView *v = nil, *w;
/*
If not within our frame then it can't be a hit.
/* If not within our frame then it can't be a hit.
As a special case, always assume that it's a hit if our _super_view is nil,
ie. if we're the top-level view in a window.
*/
if (_super_view && ![_super_view mouse: aPoint inRect: _frame])
return nil;
p = [self convertPoint: aPoint fromView: _super_view];
if (_is_rotated_or_scaled_from_base)
{
p = [self convertPoint: aPoint fromView: _super_view];
if (!NSPointInRect (p, _bounds))
{
return nil;
}
}
else if (_super_view && ![_super_view mouse: aPoint inRect: _frame])
{
return nil;
}
else
{
p = [self convertPoint: aPoint fromView: _super_view];
}
if (_rFlags.has_subviews)
{
@ -3826,7 +3863,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
[ctxt resetUsedFonts];
/* Make sure we set the visible rect so everything is printed. */
[self _rebuildCoordinates];
[self _invalidateCoordinates];
_visibleRect = _bounds;
}
@ -3964,7 +4001,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
// Don't attempt to archive the superview of a view which is the
// content view for a window.
//
if(([[self window] contentView] != self) && _super_view != nil)
if (([[self window] contentView] != self) && _super_view != nil)
{
[aCoder encodeObject: _super_view forKey: @"NSSuperview"];
}
@ -3999,7 +4036,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
[super initWithCoder: aDecoder];
// initialize these here, since they're needed in either case.
_frameMatrix = [NSAffineTransform new]; // Map fromsuperview to frame
//_frameMatrix = [NSAffineTransform new]; // Map fromsuperview to frame
_boundsMatrix = [NSAffineTransform new]; // Map fromsuperview to bounds
_matrixToWindow = [NSAffineTransform new]; // Map to window coordinates
_matrixFromWindow = [NSAffineTransform new];// Map from window coordinates
@ -4095,7 +4132,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
_bounds.origin = NSZeroPoint;
_bounds.size = _frame.size;
[_frameMatrix setFrameOrigin: _frame.origin];
// [_frameMatrix setFrameOrigin: _frame.origin];
rect = [aDecoder decodeRect];
[self setBounds: rect];
@ -4237,7 +4274,12 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
- (float) frameRotation
{
return [_frameMatrix rotationAngle];
if (_frameMatrix != nil)
{
return [_frameMatrix rotationAngle];
}
return 0.0;
}
- (BOOL) postsFrameChangedNotifications

View file

@ -4343,7 +4343,7 @@ resetCursorRectsForView(NSView *theView)
// If were're being initialized from a keyed coder...
if([aCoder allowsKeyedCoding])
if ([aCoder allowsKeyedCoding])
{
// The docs indicate that there should be an error when directly encoding with
// a keyed coding archiver. We should only encode NSWindow and subclasses
@ -4402,7 +4402,7 @@ resetCursorRectsForView(NSView *theView)
// If were're being initialized from a keyed coder...
if([aDecoder allowsKeyedCoding])
if ([aDecoder allowsKeyedCoding])
{
// The docs indicate that there should be an error when directly encoding with
// a keyed coding archiver. We should only encode NSWindow and subclasses

View file

@ -66,11 +66,11 @@ findMisspelledWordInString:(NSString *)stringToCheck
NSRange r = NSMakeRange(0,0);
#ifdef HAVE_ASPELL_H
if(countOnly)
if (countOnly)
{
NSScanner *inputScanner = [NSScanner scannerWithString: stringToCheck];
[inputScanner setCharactersToBeSkipped: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
while(![inputScanner isAtEnd])
while (![inputScanner isAtEnd])
{
[inputScanner scanUpToCharactersFromSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]
intoString: NULL];
@ -112,7 +112,7 @@ findMisspelledWordInString:(NSString *)stringToCheck
en = aspell_word_list_elements(list);
// add them to the array.
while(!aspell_string_enumeration_at_end(en))
while (!aspell_string_enumeration_at_end(en))
{
const char *string = aspell_string_enumeration_next(en);
NSString *word = [NSString stringWithUTF8String: string];
@ -158,7 +158,7 @@ findMisspelledWordInString:(NSString *)stringToCheck
- init
{
self = [super init];
if(self != nil)
if (self != nil)
{
#ifdef HAVE_ASPELL_H
// initialization...