Small theme update, plus documentation fixes and tweaks to avoid warnings.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28538 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-08-25 07:46:37 +00:00
parent d82dad9351
commit 452ffee567
22 changed files with 235 additions and 158 deletions

View file

@ -609,9 +609,9 @@ GSCurrentServer(void)
typically by calling [NSGraphicsContext-GSSetDevice:::],
although depending on the concrete implmentation, more information
than this may need to be exchanged. */
- (void) windowdevice: (int) win
- (void) windowdevice: (int)winNum
{
[self setWindowdevice: win forContext: GSCurrentContext()];
[self setWindowdevice: winNum forContext: GSCurrentContext()];
}
/** Sets the window device information for the NSGraphicsContext,
@ -899,7 +899,7 @@ GSCurrentServer(void)
[self subclassResponsibility: _cmd];
}
- (void) setParentWindow: (int)partentWin
- (void) setParentWindow: (int)parentWin
forChildWindow: (int)childWin
{
[self subclassResponsibility: _cmd];

View file

@ -100,6 +100,8 @@ typedef struct {
NSMutableSet *owned;
NSImage *icon;
NSString *name;
Class colorClass;
Class imageClass;
} internal;
#define _internal ((internal*)_reserved)
@ -111,6 +113,8 @@ typedef struct {
#define _owned _internal->owned
#define _icon _internal->icon
#define _name _internal->name
#define _colorClass _internal->colorClass
#define _imageClass _internal->imageClass
+ (void) defaultsDidChange: (NSNotification*)n
{
@ -298,7 +302,7 @@ typedef struct {
* to memory, setting their names so that they are visible to
* [NSImage+imageNamed:] and storing them in our local array.
*/
imageTypes = [NSImage imageFileTypes];
imageTypes = [_imageClass imageFileTypes];
imagePaths = [_bundle pathsForResourcesOfType: nil
inDirectory: @"ThemeImages"];
enumerator = [imagePaths objectEnumerator];
@ -317,7 +321,7 @@ typedef struct {
image = [_images objectForKey: imageName];
if (image == nil)
{
image = [[NSImage alloc] initWithContentsOfFile: imagePath];
image = [[_imageClass alloc] initWithContentsOfFile: imagePath];
if (image != nil)
{
[_images setObject: image forKey: imageName];
@ -337,7 +341,7 @@ typedef struct {
* in use ... so we remove the name from the old
* image and try again.
*/
old = [NSImage imageNamed: imageName];
old = [_imageClass imageNamed: imageName];
[old setName: nil];
[image setName: imageName];
}
@ -436,6 +440,11 @@ typedef struct {
return _bundle;
}
- (Class) colorClass
{
return [NSColorList class];
}
- (NSColor*) colorNamed: (NSString*)aName
state: (GSThemeControlState)elementState
cache: (BOOL)useCache
@ -478,7 +487,7 @@ typedef struct {
if (colorsPath != nil)
{
_extraColors[elementState]
= [[NSColorList alloc] initWithName: listName
= [[_colorClass alloc] initWithName: listName
fromFile: colorsPath];
/* If the list is actually empty, we get rid of it to avoid
* unnecessary lookups.
@ -515,7 +524,7 @@ typedef struct {
}
else
{
_colors = [[NSColorList alloc] initWithName: @"System"
_colors = [[_colorClass alloc] initWithName: @"System"
fromFile: colorsPath];
}
}
@ -598,12 +607,12 @@ typedef struct {
path = [_bundle pathForResource: path ofType: ext];
if (path != nil)
{
_icon = [[NSImage alloc] initWithContentsOfFile: path];
_icon = [[_imageClass alloc] initWithContentsOfFile: path];
}
}
if (_icon == nil)
{
_icon = RETAIN([NSImage imageNamed: @"GNUstep"]);
_icon = RETAIN([_imageClass imageNamed: @"GNUstep"]);
}
else
{
@ -626,6 +635,11 @@ typedef struct {
return _icon;
}
- (Class) imageClass
{
return [NSImage class];
}
- (id) initWithBundle: (NSBundle*)bundle
{
GSThemeControlState state;
@ -643,6 +657,8 @@ typedef struct {
ASSIGN(_name,
[[[_bundle bundlePath] lastPathComponent] stringByDeletingPathExtension]);
_colorClass = [self colorClass];
_imageClass = [self imageClass];
return self;
}
@ -781,7 +797,7 @@ typedef struct {
}
else
{
image = [[NSImage alloc] initWithContentsOfFile: path];
image = [[_imageClass alloc] initWithContentsOfFile: path];
if (image != nil)
{
tiles = [[GSDrawTiles alloc] initWithImage: image
@ -797,7 +813,7 @@ typedef struct {
NSString *imagePath;
unsigned count;
imageTypes = [NSImage imageFileTypes];
imageTypes = [_imageClass imageFileTypes];
for (count = 0; count < [imageTypes count]; count++)
{
NSString *ext = [imageTypes objectAtIndex: count];
@ -807,7 +823,8 @@ typedef struct {
inDirectory: @"ThemeTiles"];
if (imagePath != nil)
{
image = [[NSImage alloc] initWithContentsOfFile: imagePath];
image
= [[_imageClass alloc] initWithContentsOfFile: imagePath];
if (image != nil)
{
tiles = [[GSDrawTiles alloc] initWithImage: image];

View file

@ -400,7 +400,7 @@ create_error(int code, NSString* desc)
{
// FIXME
return [self lineBreakBeforeIndex: location
withinRange: aRange];
withinRange: aRange];
}
- (NSUInteger) lineBreakBeforeIndex: (NSUInteger)location

View file

@ -1342,11 +1342,11 @@ static NSTextFieldCell *titleCell;
return browserColumn->_width;
}
- (void) setWidth: (float)columnWidth ofColumn: (int)column
- (void) setWidth: (float)columnWidth ofColumn: (int)columnIndex
{
NSBrowserColumn *browserColumn;
browserColumn = [_browserColumns objectAtIndex: column];
browserColumn = [_browserColumns objectAtIndex: columnIndex];
browserColumn->_width = columnWidth;
// FIXME: Send a notifiaction

View file

@ -893,19 +893,19 @@ typedef struct _GSButtonCellFlags
state: buttonState];
}
- (void) drawImage: (NSImage*)anImage
withFrame: (NSRect)aRect
- (void) drawImage: (NSImage*)imageToDisplay
withFrame: (NSRect)cellFrame
inView: (NSView*)controlView
{
// Draw image
if (anImage != nil)
if (imageToDisplay != nil)
{
NSSize size;
NSPoint position;
size = [anImage size];
position.x = MAX(NSMidX(aRect) - (size.width / 2.), 0.);
position.y = MAX(NSMidY(aRect) - (size.height / 2.), 0.);
size = [imageToDisplay size];
position.x = MAX(NSMidX(cellFrame) - (size.width / 2.), 0.);
position.y = MAX(NSMidY(cellFrame) - (size.height / 2.), 0.);
/*
* Images are always drawn with their bottom-left corner at the origin
@ -916,19 +916,19 @@ typedef struct _GSButtonCellFlags
position.y += size.height;
}
[[GSTheme theme] drawImage: anImage
inButtonCell: self
withFrame: aRect
position: position];
[[GSTheme theme] drawImage: imageToDisplay
inButtonCell: self
withFrame: cellFrame
position: position];
}
}
- (void) drawTitle: (NSAttributedString*)titleToDisplay
withFrame: (NSRect)frame
inView: (NSView*)control
withFrame: (NSRect)cellFrame
inView: (NSView*)controlView
{
[self _drawAttributedText: titleToDisplay
inFrame: frame];
inFrame: cellFrame];
}
// Private helper method overridden in subclasses

View file

@ -502,7 +502,7 @@ systemColorWithName(NSString *name)
}
}
+ (NSControlTint) currentControlTint;
+ (NSControlTint) currentControlTint
{
// FIXME: should be made a system setting
return NSBlueControlTint;

View file

@ -858,7 +858,7 @@ withContentsOfURL: (NSURL *)url
- (BOOL) writeSafelyToURL: (NSURL *)url
ofType: (NSString *)type
forSaveOperation: (NSSaveOperationType)saveOp
forSaveOperation: (NSSaveOperationType)op
error: (NSError **)error
{
NSURL *original = [self fileURL];
@ -868,15 +868,15 @@ withContentsOfURL: (NSURL *)url
if (OVERRIDDEN(writeWithBackupToFile:ofType:saveOperation:))
{
if (saveOp == NSAutosaveOperation)
if (op == NSAutosaveOperation)
{
saveOp = NSSaveToOperation;
op = NSSaveToOperation;
}
*error = nil;
return [self writeWithBackupToFile: [url path]
ofType: type
saveOperation: saveOp];
saveOperation: op];
}
if (!isNativeType || (url == nil))
@ -886,7 +886,7 @@ withContentsOfURL: (NSURL *)url
return NO;
}
if (saveOp == NSSaveOperation)
if (op == NSSaveOperation)
{
if ([url isFileURL])
{
@ -910,7 +910,7 @@ withContentsOfURL: (NSURL *)url
if (![self writeToURL: url
ofType: type
forSaveOperation: saveOp
forSaveOperation: op
originalContentsURL: original
error: error])
{
@ -923,18 +923,18 @@ withContentsOfURL: (NSURL *)url
attrs = [self fileAttributesToWriteToURL: url
ofType: type
forSaveOperation: saveOp
forSaveOperation: op
originalContentsURL: original
error: error];
[fileManager changeFileAttributes: attrs atPath: [url path]];
}
if (saveOp == NSAutosaveOperation)
if (op == NSAutosaveOperation)
{
[self setAutosavedContentsFileURL: url];
[self updateChangeCount: NSChangeAutosaved];
}
else if (saveOp != NSSaveToOperation)
else if (op != NSSaveToOperation)
{
[self _removeAutosavedContentsFile];
[self setFileURL: url];
@ -989,22 +989,22 @@ withContentsOfURL: (NSURL *)url
- (BOOL) writeToURL: (NSURL *)url
ofType: (NSString *)type
forSaveOperation: (NSSaveOperationType)saveOp
forSaveOperation: (NSSaveOperationType)op
originalContentsURL: (NSURL *)orig
error: (NSError **)error
{
if (OVERRIDDEN(writeToFile:ofType:originalFile:saveOperation:))
{
if (saveOp == NSAutosaveOperation)
if (op == NSAutosaveOperation)
{
saveOp = NSSaveToOperation;
op = NSSaveToOperation;
}
*error = nil;
return [self writeToFile: [url path]
ofType: type
originalFile: [orig path]
saveOperation: saveOp];
saveOperation: op];
}
return [self writeToURL: url
@ -1240,11 +1240,11 @@ originalContentsURL: (NSURL *)orig
return NO;
}
- (NSString *) fileNameExtensionForType: (NSString *)type
- (NSString *) fileNameExtensionForType: (NSString *)typeName
saveOperation: (NSSaveOperationType)saveOperation
{
NSArray *exts = [[NSDocumentController sharedDocumentController]
fileExtensionsFromType: type];
fileExtensionsFromType: typeName];
if ([exts count])
return (NSString *)[exts objectAtIndex: 0];
@ -1312,7 +1312,7 @@ originalContentsURL: (NSURL *)orig
contextInfo: printInfo];
}
- (void) runModalPageLayoutWithPrintInfo: (NSPrintInfo *)printInfo
- (void) runModalPageLayoutWithPrintInfo: (NSPrintInfo *)info
delegate: (id)delegate
didRunSelector: (SEL)sel
contextInfo: (void *)context
@ -1322,7 +1322,7 @@ originalContentsURL: (NSURL *)orig
pageLayout = [NSPageLayout pageLayout];
if ([self preparePageLayout: pageLayout])
{
[pageLayout beginSheetWithPrintInfo: printInfo
[pageLayout beginSheetWithPrintInfo: info
modalForWindow: [self windowForSheet]
delegate: delegate
didEndSelector: sel

View file

@ -385,29 +385,29 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
}
}
- (BOOL) presentError: (NSError *)error
- (BOOL) presentError: (NSError *)err
{
error = [self willPresentError: error];
return [NSApp presentError: error];
err = [self willPresentError: err];
return [NSApp presentError: err];
}
- (void) presentError: (NSError *)error
modalForWindow: (NSWindow *)window
- (void) presentError: (NSError *)err
modalForWindow: (NSWindow *)win
delegate: (id)delegate
didPresentSelector: (SEL)sel
contextInfo: (void *)context
{
error = [self willPresentError: error];
[NSApp presentError: error
modalForWindow: window
err = [self willPresentError: err];
[NSApp presentError: err
modalForWindow: win
delegate: delegate
didPresentSelector: sel
contextInfo: context];
}
- (NSError *) willPresentError: (NSError *)error
- (NSError *) willPresentError: (NSError *)err
{
return error;
return err;
}
- (NSString*) defaultType
@ -551,7 +551,7 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
return document;
}
- (id) openUntitledDocumentAndDisplay: (BOOL)display
- (id) openUntitledDocumentAndDisplay: (BOOL)flag
error: (NSError **)err
{
NSString *type;
@ -560,7 +560,7 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
if (OVERRIDDEN(openUntitledDocumentOfType:display:))
{
return [self openUntitledDocumentOfType: type display: display];
return [self openUntitledDocumentOfType: type display: flag];
}
else
{
@ -576,7 +576,7 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
if ([self shouldCreateUI])
{
[document makeWindowControllers];
if (display)
if (flag)
{
[document showWindows];
}
@ -587,13 +587,13 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
}
- (id) openDocumentWithContentsOfURL: (NSURL *)url
display: (BOOL)display
display: (BOOL)flag
error: (NSError **)err
{
if (OVERRIDDEN(openDocumentWithContentsOfFile:display:) && [url isFileURL])
{
return [self openDocumentWithContentsOfFile: [url path]
display: display];
display: flag];
}
else
{
@ -628,7 +628,7 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
// remember this document as opened
[self noteNewRecentDocumentURL: url];
if (display && [self shouldCreateUI])
if (flag && [self shouldCreateUI])
{
[document showWindows];
}

View file

@ -988,14 +988,15 @@ static BOOL flip_hack;
[self setInContext: GSCurrentContext()];
}
- (void) setInContext: (NSGraphicsContext*)ctxt
- (void) setInContext: (NSGraphicsContext*)context
{
if (matrixExplicitlySet == NO && ([[NSView focusView] isFlipped] || flip_hack))
[ctxt GSSetFont: [[self _flippedViewFont] fontRef]];
if (matrixExplicitlySet == NO
&& ([[NSView focusView] isFlipped] || flip_hack))
[context GSSetFont: [[self _flippedViewFont] fontRef]];
else
[ctxt GSSetFont: [self fontRef]];
[context GSSetFont: [self fontRef]];
[ctxt useFont: fontName];
[context useFont: fontName];
}
//

View file

@ -1035,7 +1035,7 @@ static Class fontPanelClass = Nil;
return YES;
}
- (BOOL) removeCollection:(NSString *) collection;
- (BOOL) removeCollection:(NSString *) collection
{
if ([_collections objectForKey: collection])
{

View file

@ -66,48 +66,48 @@
location: (float)loc
options: (NSDictionary *)options
{
NSTextTabType type;
NSTextTabType type;
switch (align)
{
default:
case NSLeftTextAlignment:
type = NSLeftTabStopType;
break;
case NSRightTextAlignment:
if ([options objectForKey: NSTabColumnTerminatorsAttributeName] != nil)
{
type = NSDecimalTabStopType;
}
else
{
type = NSRightTabStopType;
}
break;
case NSCenterTextAlignment:
type = NSCenterTabStopType;
break;
case NSJustifiedTextAlignment:
type = NSLeftTabStopType;
break;
case NSNaturalTextAlignment:
// FIXME: Get from language user setting
type = YES ? NSLeftTabStopType : NSRightTabStopType;
break;
default:
case NSLeftTextAlignment:
type = NSLeftTabStopType;
break;
case NSRightTextAlignment:
if ([options objectForKey: NSTabColumnTerminatorsAttributeName] != nil)
{
type = NSDecimalTabStopType;
}
else
{
type = NSRightTabStopType;
}
break;
case NSCenterTextAlignment:
type = NSCenterTabStopType;
break;
case NSJustifiedTextAlignment:
type = NSLeftTabStopType;
break;
case NSNaturalTextAlignment:
// FIXME: Get from language user setting
type = YES ? NSLeftTabStopType : NSRightTabStopType;
break;
}
if ((self = [self initWithType: type location: loc]))
{
if ((self = [self initWithType: type location: loc]))
{
_alignment = align;
ASSIGN(_options, options);
}
return self;
}
return self;
}
- (void) dealloc;
- (void) dealloc
{
RELEASE(_options);
[super dealloc];
RELEASE(_options);
[super dealloc];
}
- (id) copyWithZone: (NSZone*)aZone
@ -414,27 +414,27 @@ static NSParagraphStyle *defaultStyle = nil;
return _paragraphSpacingBefore;
}
- (int) headerLevel;
- (int) headerLevel
{
return _headerLevel;
}
- (float) hyphenationFactor;
- (float) hyphenationFactor
{
return _hyphenationFactor;
}
- (NSArray *) textBlocks;
- (NSArray *) textBlocks
{
return _textBlocks;
}
- (NSArray *) textLists;
- (NSArray *) textLists
{
return _textLists;
}
- (float) tighteningFactorForTruncation;
- (float) tighteningFactorForTruncation
{
return _tighteningFactorForTruncation;
}

View file

@ -272,7 +272,7 @@ static inline void _loadNSSoundPlugIns (void)
return [self initWithData: [NSData dataWithContentsOfURL: url]];
}
- (id) initWithData: (NSData *)data;
- (id) initWithData: (NSData *)data
{
NSEnumerator *enumerator;
Class sourceClass,
@ -444,7 +444,7 @@ static inline void _loadNSSoundPlugIns (void)
[_playbackLock unlock];
}
- (NSTimeInterval) currentTime;
- (NSTimeInterval) currentTime
{
return [_source currentTime];
}
@ -456,7 +456,7 @@ static inline void _loadNSSoundPlugIns (void)
[_readLock unlock];
}
- (BOOL) loops;
- (BOOL) loops
{
return _shouldLoop;
}

View file

@ -58,7 +58,7 @@
[super dealloc];
}
- (NSString*) description;
- (NSString*) description
{
return [NSString stringWithFormat: @"%@: %@ (ident: %@)",
NSStringFromClass([self class]), _label, _ident];

View file

@ -5532,7 +5532,7 @@ static BOOL selectContiguousRegion(NSTableView *self,
- (NSImage *) dragImageForRowsWithIndexes: (NSIndexSet*)rows
tableColumns: (NSArray*)cols
event: (NSEvent*)event
offset: (NSPoint*)offset;
offset: (NSPoint*)offset
{
// FIXME
NSArray *rowArray;

View file

@ -775,7 +775,7 @@ static GSValidationCenter *vc = nil;
[self _build];
}
- (void) setSelectedItemIdentifier: (NSString *)itemIdentifier
- (void) setSelectedItemIdentifier: (NSString *)identifier
{
NSArray *selectedItems;
NSArray *itemsToSelect;
@ -815,7 +815,7 @@ static GSValidationCenter *vc = nil;
return;
}
itemsToSelect = [_items objectsWithValue: itemIdentifier
itemsToSelect = [_items objectsWithValue: identifier
forKey: @"_itemIdentifier"];
e = [itemsToSelect objectEnumerator];
while ((item = [e nextObject]) != nil)
@ -830,7 +830,7 @@ static GSValidationCenter *vc = nil;
if (updated)
{
ASSIGN(_selectedItemIdentifier, itemIdentifier);
ASSIGN(_selectedItemIdentifier, identifier);
}
else
{

View file

@ -2197,7 +2197,7 @@ convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matrix1,
return [self lockFocusIfCanDrawInContext: nil];
}
- (BOOL) lockFocusIfCanDrawInContext: (NSGraphicsContext *)context;
- (BOOL) lockFocusIfCanDrawInContext: (NSGraphicsContext *)context
{
if ([self canDraw])
{