Fix BOOL accessors to return a genuine boolean (YES or NO)

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22413 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-02-02 21:16:55 +00:00
parent 98bc434e88
commit 34d79dd427
8 changed files with 163 additions and 156 deletions

View file

@ -9,6 +9,13 @@
Honor the NSWindow-canHide method when deactivating apps. Honor the NSWindow-canHide method when deactivating apps.
* Source/NSWindow.m: Fix accessor methods which return a BOOL to * Source/NSWindow.m: Fix accessor methods which return a BOOL to
do the right thing when they are accessing a bit in a bitfield. do the right thing when they are accessing a bit in a bitfield.
* Source/NSWindowController.m: ditto
* Source/NSDataLinkManager.m: ditto
* Source/NSTextView.m: ditto
* Source/NSDocumentController.m: ditto
* Source/NSDataLink.m: ditto
* Source/NSView.m: ditto
* Source/NSDocument.m: ditto
2006-02-01 Richard Frith-Macdonald <rfm@gnu.org> 2006-02-01 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -288,15 +288,15 @@
[aCoder encodeValueOfObjCType: @encode(id) at: &types]; [aCoder encodeValueOfObjCType: @encode(id) at: &types];
// flags... // flags...
flag = _flags.appVerifies; flag = (_flags.appVerifies ? YES : NO);
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
flag = _flags.canUpdateContinuously; flag = (_flags.canUpdateContinuously ? YES : NO);
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
flag = _flags.isDirty; flag = (_flags.isDirty ? YES : NO);
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
flag = _flags.willOpenSource; flag = (_flags.willOpenSource ? YES : NO);
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
flag = _flags.willUpdate; flag = (_flags.willUpdate ? YES : NO);
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
} }

View file

@ -259,7 +259,7 @@
- (BOOL)delegateVerifiesLinks - (BOOL)delegateVerifiesLinks
{ {
return _flags.delegateVerifiesLinks; return (_flags.delegateVerifiesLinks ? YES : NO);
} }
- (NSString *)filename - (NSString *)filename
@ -269,12 +269,12 @@
- (BOOL)interactsWithUser - (BOOL)interactsWithUser
{ {
return _flags.interactsWithUser; return (_flags.interactsWithUser ? YES : NO);
} }
- (BOOL)isEdited - (BOOL)isEdited
{ {
return _flags.isEdited; return (_flags.isEdited ? YES : NO);
} }
- (void)setDelegateVerifiesLinks:(BOOL)flag - (void)setDelegateVerifiesLinks:(BOOL)flag
@ -292,7 +292,7 @@
// //
- (BOOL)areLinkOutlinesVisible - (BOOL)areLinkOutlinesVisible
{ {
return _flags.areLinkOutlinesVisible; return (_flags.areLinkOutlinesVisible ? YES : NO);
} }
- (NSEnumerator *)destinationLinkEnumerator - (NSEnumerator *)destinationLinkEnumerator
@ -337,13 +337,13 @@
[aCoder encodeValueOfObjCType: @encode(id) at: &sourceLinks]; [aCoder encodeValueOfObjCType: @encode(id) at: &sourceLinks];
[aCoder encodeValueOfObjCType: @encode(id) at: &destinationLinks]; [aCoder encodeValueOfObjCType: @encode(id) at: &destinationLinks];
flag = _flags.areLinkOutlinesVisible; flag = (_flags.areLinkOutlinesVisible ? YES : NO);
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
flag = _flags.delegateVerifiesLinks; flag = (_flags.delegateVerifiesLinks ? YES : NO);
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
flag = _flags.interactsWithUser; flag = (_flags.interactsWithUser ? YES : NO);
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
flag = _flags.isEdited; flag = (_flags.isEdited ? YES : NO);
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
} }

View file

@ -916,7 +916,7 @@
- (BOOL)hasUndoManager - (BOOL)hasUndoManager
{ {
return _docFlags.hasUndoManager; return (_docFlags.hasUndoManager ? YES : NO);
} }
- (void)setHasUndoManager: (BOOL)flag - (void)setHasUndoManager: (BOOL)flag

View file

@ -188,7 +188,7 @@ static NSDictionary *TypeInfoForName (NSArray *types, NSString *typeName)
- (BOOL) shouldCreateUI - (BOOL) shouldCreateUI
{ {
return _controllerFlags.shouldCreateUI; return (_controllerFlags.shouldCreateUI ? YES : NO);
} }
- (void) setShouldCreateUI: (BOOL)flag - (void) setShouldCreateUI: (BOOL)flag

View file

@ -108,18 +108,18 @@ Interface for a bunch of internal methods that need to be cleaned up.
/* /*
* Used to implement the blinking insertion point * Used to implement the blinking insertion point
*/ */
-(void) _blink: (NSTimer *)t; - (void) _blink: (NSTimer *)t;
/* /*
* these NSLayoutManager- like method is here only informally * these NSLayoutManager- like method is here only informally
*/ */
-(NSRect) rectForCharacterRange: (NSRange)aRange; - (NSRect) rectForCharacterRange: (NSRange)aRange;
// //
// GNU utility methods // GNU utility methods
// //
-(void) copySelection; - (void) copySelection;
-(void) pasteSelection; - (void) pasteSelection;
@end @end
// This class is a helper for keyed unarchiving only // This class is a helper for keyed unarchiving only
@ -227,7 +227,7 @@ of the removed text view. It is also sent by -setTextContainer:.
This will be sent several times to the same text view for one change in This will be sent several times to the same text view for one change in
some cases, so it needs to be safe wrt. that. some cases, so it needs to be safe wrt. that.
*/ */
-(void) _updateMultipleTextViews - (void) _updateMultipleTextViews
{ {
id oldNotifObject = _notifObject; id oldNotifObject = _notifObject;
@ -288,7 +288,7 @@ directly from one textview to another - to allow subclasses to
override eg. -setEditable: to take some particular action when override eg. -setEditable: to take some particular action when
editing is turned on or off. editing is turned on or off.
*/ */
-(void) _syncTextViewsByCalling: (SEL)action - (void) _syncTextViewsByCalling: (SEL)action
withFlag: (BOOL)flag withFlag: (BOOL)flag
{ {
NSArray *array; NSArray *array;
@ -332,7 +332,7 @@ This must be called whenever the delegate changes (directly, through calls
to -setDelegate:, or indirectly due to changes in the text system, or being to -setDelegate:, or indirectly due to changes in the text system, or being
decoded. decoded.
*/ */
-(void) _recacheDelegateResponses - (void) _recacheDelegateResponses
{ {
SEL selector; SEL selector;
@ -362,7 +362,7 @@ decoded.
Called when our state needs updating due to external changes. Currently, Called when our state needs updating due to external changes. Currently,
this happens when layout has been invalidated, and when we are resized. this happens when layout has been invalidated, and when we are resized.
*/ */
-(void) _updateState: (id)sender - (void) _updateState: (id)sender
{ {
[self sizeToFit]; [self sizeToFit];
/* TODO: we don't have to redisplay the entire view */ /* TODO: we don't have to redisplay the entire view */
@ -372,7 +372,7 @@ this happens when layout has been invalidated, and when we are resized.
[self _updateInputMethodState]; [self _updateInputMethodState];
} }
-(void) _layoutManagerDidInvalidateLayout - (void) _layoutManagerDidInvalidateLayout
{ {
/* /*
We don't want to do the update right away, since the invalidation might We don't want to do the update right away, since the invalidation might
@ -486,7 +486,7 @@ If a text view is added to an empty text network, it keeps its attributes.
*/ */
-(NSTextContainer *) buildUpTextNetwork: (NSSize)aSize - (NSTextContainer *) buildUpTextNetwork: (NSSize)aSize
{ {
NSTextContainer *textContainer; NSTextContainer *textContainer;
NSLayoutManager *layoutManager; NSLayoutManager *layoutManager;
@ -518,7 +518,7 @@ If a text view is added to an empty text network, it keeps its attributes.
/* Designated initializer. */ /* Designated initializer. */
-(id) initWithFrame: (NSRect)frameRect - (id) initWithFrame: (NSRect)frameRect
textContainer: (NSTextContainer *)container textContainer: (NSTextContainer *)container
{ {
self = [super initWithFrame: frameRect]; self = [super initWithFrame: frameRect];
@ -565,7 +565,7 @@ If a text view is added to an empty text network, it keeps its attributes.
} }
-(id) initWithFrame: (NSRect)frameRect - (id) initWithFrame: (NSRect)frameRect
{ {
NSTextContainer *aTextContainer; NSTextContainer *aTextContainer;
@ -595,7 +595,7 @@ NSTextView, and parts of their handling (including encoding and decoding)
were there. This has been fixed and the ivar:s moved here, but in a way were there. This has been fixed and the ivar:s moved here, but in a way
that makes decoding and encoding compatible with the old code. that makes decoding and encoding compatible with the old code.
*/ */
-(void) encodeWithCoder: (NSCoder *)aCoder - (void) encodeWithCoder: (NSCoder *)aCoder
{ {
BOOL flag; BOOL flag;
NSSize containerSize = [_textContainer containerSize]; NSSize containerSize = [_textContainer containerSize];
@ -643,7 +643,7 @@ that makes decoding and encoding compatible with the old code.
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
} }
-(id) initWithCoder: (NSCoder *)aDecoder - (id) initWithCoder: (NSCoder *)aDecoder
{ {
self = [super initWithCoder: aDecoder]; self = [super initWithCoder: aDecoder];
@ -768,7 +768,7 @@ that makes decoding and encoding compatible with the old code.
return self; return self;
} }
-(void) dealloc - (void) dealloc
{ {
if (_tf.owns_text_network == YES) if (_tf.owns_text_network == YES)
{ {
@ -830,7 +830,7 @@ is hairy, and this is the only place where it happens.
TODO: Make sure the assumption holds; might need to add more dummy calls TODO: Make sure the assumption holds; might need to add more dummy calls
to this method from the text container or layout manager. to this method from the text container or layout manager.
*/ */
-(void) setTextContainer: (NSTextContainer *)container - (void) setTextContainer: (NSTextContainer *)container
{ {
unsigned int i, c; unsigned int i, c;
NSArray *tcs; NSArray *tcs;
@ -894,22 +894,22 @@ to this method from the text container or layout manager.
-(void) replaceTextContainer: (NSTextContainer *)newContainer - (void) replaceTextContainer: (NSTextContainer *)newContainer
{ {
NSLog(@"TODO! [NSTextView -replaceTextContainer:] isn't implemented"); NSLog(@"TODO! [NSTextView -replaceTextContainer:] isn't implemented");
} }
-(NSTextContainer *) textContainer - (NSTextContainer *) textContainer
{ {
return _textContainer; return _textContainer;
} }
-(NSLayoutManager *) layoutManager - (NSLayoutManager *) layoutManager
{ {
return _layoutManager; return _layoutManager;
} }
-(NSTextStorage *) textStorage - (NSTextStorage *) textStorage
{ {
return _textStorage; return _textStorage;
} }
@ -950,12 +950,12 @@ to make sure syncing is handled properly in all cases.
/* Delegate */ /* Delegate */
-(id) delegate - (id) delegate
{ {
return _delegate; return _delegate;
} }
-(void) setDelegate: (id)anObject - (void) setDelegate: (id)anObject
{ {
/* Code to allow sharing the delegate */ /* Code to allow sharing the delegate */
if (_tf.multiple_textviews && (IS_SYNCHRONIZING_DELEGATES == NO)) if (_tf.multiple_textviews && (IS_SYNCHRONIZING_DELEGATES == NO))
@ -1009,12 +1009,12 @@ to make sure syncing is handled properly in all cases.
/* Editable */ /* Editable */
-(BOOL) isEditable - (BOOL) isEditable
{ {
return _tf.is_editable; return (_tf.is_editable ? YES : NO);
} }
-(void) setEditable: (BOOL)flag - (void) setEditable: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
_tf.is_editable = flag; _tf.is_editable = flag;
@ -1036,12 +1036,12 @@ to make sure syncing is handled properly in all cases.
/* Selectable */ /* Selectable */
-(BOOL) isSelectable - (BOOL) isSelectable
{ {
return _tf.is_selectable; return (_tf.is_selectable ? YES : NO);
} }
-(void) setSelectable: (BOOL)flag - (void) setSelectable: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
_tf.is_selectable = flag; _tf.is_selectable = flag;
@ -1055,12 +1055,12 @@ to make sure syncing is handled properly in all cases.
/* Field editor */ /* Field editor */
-(BOOL) isFieldEditor - (BOOL) isFieldEditor
{ {
return _tf.is_field_editor; return (_tf.is_field_editor ? YES : NO);
} }
-(void) setFieldEditor: (BOOL)flag - (void) setFieldEditor: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
[self setHorizontallyResizable: NO]; /* TODO: why? */ [self setHorizontallyResizable: NO]; /* TODO: why? */
@ -1072,12 +1072,12 @@ to make sure syncing is handled properly in all cases.
/* Rich-text */ /* Rich-text */
-(BOOL) isRichText - (BOOL) isRichText
{ {
return _tf.is_rich_text; return (_tf.is_rich_text ? YES : NO);
} }
-(void) setRichText: (BOOL)flag - (void) setRichText: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
_tf.is_rich_text = flag; _tf.is_rich_text = flag;
@ -1093,12 +1093,12 @@ to make sure syncing is handled properly in all cases.
/* Imports graphics */ /* Imports graphics */
-(BOOL) importsGraphics - (BOOL) importsGraphics
{ {
return _tf.imports_graphics; return (_tf.imports_graphics ? YES : NO);
} }
-(void) setImportsGraphics: (BOOL)flag - (void) setImportsGraphics: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
_tf.imports_graphics = flag; _tf.imports_graphics = flag;
@ -1112,13 +1112,13 @@ to make sure syncing is handled properly in all cases.
/* Uses ruler */ /* Uses ruler */
-(BOOL) usesRuler - (BOOL) usesRuler
{ {
return _tf.uses_ruler; return (_tf.uses_ruler ? YES : NO);
} }
/* TODO: set ruler visible to NO if flag==NO? */ /* TODO: set ruler visible to NO if flag==NO? */
-(void) setUsesRuler: (BOOL)flag - (void) setUsesRuler: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
_tf.uses_ruler = flag; _tf.uses_ruler = flag;
@ -1127,12 +1127,12 @@ to make sure syncing is handled properly in all cases.
/* Ruler visible (TODO: is this really supposed to be shared??) */ /* Ruler visible (TODO: is this really supposed to be shared??) */
-(BOOL) isRulerVisible - (BOOL) isRulerVisible
{ {
return _tf.is_ruler_visible; return (_tf.is_ruler_visible ? YES : NO);
} }
-(void) setRulerVisible: (BOOL)flag - (void) setRulerVisible: (BOOL)flag
{ {
NSScrollView *sv; NSScrollView *sv;
@ -1149,12 +1149,12 @@ to make sure syncing is handled properly in all cases.
/* Uses font panel */ /* Uses font panel */
-(BOOL) usesFontPanel - (BOOL) usesFontPanel
{ {
return _tf.uses_font_panel; return (_tf.uses_font_panel ? YES : NO);
} }
-(void) setUsesFontPanel: (BOOL)flag - (void) setUsesFontPanel: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
_tf.uses_font_panel = flag; _tf.uses_font_panel = flag;
@ -1163,12 +1163,12 @@ to make sure syncing is handled properly in all cases.
/* Smart insert/delete */ /* Smart insert/delete */
-(BOOL) smartInsertDeleteEnabled - (BOOL) smartInsertDeleteEnabled
{ {
return _tf.smart_insert_delete; return (_tf.smart_insert_delete ? YES : NO);
} }
-(void) setSmartInsertDeleteEnabled: (BOOL)flag - (void) setSmartInsertDeleteEnabled: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
_tf.smart_insert_delete = flag; _tf.smart_insert_delete = flag;
@ -1177,12 +1177,12 @@ to make sure syncing is handled properly in all cases.
/* Undo */ /* Undo */
-(BOOL) allowsUndo - (BOOL) allowsUndo
{ {
return _tf.allows_undo; return (_tf.allows_undo ? YES : NO);
} }
-(void) setAllowsUndo: (BOOL)flag - (void) setAllowsUndo: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
_tf.allows_undo = flag; _tf.allows_undo = flag;
@ -1192,14 +1192,14 @@ to make sure syncing is handled properly in all cases.
/* Continuous spell checking */ /* Continuous spell checking */
/* TODO */ /* TODO */
-(BOOL) isContinuousSpellCheckingEnabled - (BOOL) isContinuousSpellCheckingEnabled
{ {
NSLog(@"Method %s is not implemented for class %s", NSLog(@"Method %s is not implemented for class %s",
__PRETTY_FUNCTION__, "NSTextView"); __PRETTY_FUNCTION__, "NSTextView");
return NO; return NO;
} }
-(void) setContinuousSpellCheckingEnabled: (BOOL)flag - (void) setContinuousSpellCheckingEnabled: (BOOL)flag
{ {
NSLog(@"Method %s is not implemented for class %s", NSLog(@"Method %s is not implemented for class %s",
__PRETTY_FUNCTION__, "NSTextView"); __PRETTY_FUNCTION__, "NSTextView");
@ -1213,12 +1213,12 @@ to make sure syncing is handled properly in all cases.
/**** Basic view stuff ****/ /**** Basic view stuff ****/
-(BOOL) isFlipped - (BOOL) isFlipped
{ {
return YES; return YES;
} }
-(BOOL) isOpaque - (BOOL) isOpaque
{ {
if (_tf.draws_background == NO if (_tf.draws_background == NO
|| _backgroundColor == nil || _backgroundColor == nil
@ -1228,12 +1228,12 @@ to make sure syncing is handled properly in all cases.
return YES; return YES;
} }
-(BOOL) needsPanelToBecomeKey - (BOOL) needsPanelToBecomeKey
{ {
return _tf.is_editable; return (_tf.is_editable ? YES : NO);
} }
-(BOOL) acceptsFirstResponder - (BOOL) acceptsFirstResponder
{ {
if (_tf.is_selectable) if (_tf.is_selectable)
{ {
@ -1245,7 +1245,7 @@ to make sure syncing is handled properly in all cases.
} }
} }
-(BOOL) resignFirstResponder - (BOOL) resignFirstResponder
{ {
/* Check if another text view attached to the same layout manager is the /* Check if another text view attached to the same layout manager is the
new first responder. If so, we always let it become first responder, and new first responder. If so, we always let it become first responder, and
@ -1317,7 +1317,7 @@ to make sure syncing is handled properly in all cases.
/* Note that when this method is called, editing might already have /* Note that when this method is called, editing might already have
started (in another text view attached to the same layout manager). */ started (in another text view attached to the same layout manager). */
-(BOOL) becomeFirstResponder - (BOOL) becomeFirstResponder
{ {
if (_tf.is_selectable == NO) if (_tf.is_selectable == NO)
{ {
@ -1336,7 +1336,7 @@ started (in another text view attached to the same layout manager). */
return YES; return YES;
} }
-(void) resignKeyWindow - (void) resignKeyWindow
{ {
if ([self shouldDrawInsertionPoint]) if ([self shouldDrawInsertionPoint])
{ {
@ -1344,7 +1344,7 @@ started (in another text view attached to the same layout manager). */
} }
} }
-(void) becomeKeyWindow - (void) becomeKeyWindow
{ {
if ([self shouldDrawInsertionPoint]) if ([self shouldDrawInsertionPoint])
{ {
@ -1355,17 +1355,17 @@ started (in another text view attached to the same layout manager). */
/**** Unshared attributes ****/ /**** Unshared attributes ****/
-(NSColor *) backgroundColor - (NSColor *) backgroundColor
{ {
return _backgroundColor; return _backgroundColor;
} }
-(BOOL) drawsBackground - (BOOL) drawsBackground
{ {
return _tf.draws_background; return (_tf.draws_background ? YES : NO);
} }
-(void) setBackgroundColor: (NSColor *)color - (void) setBackgroundColor: (NSColor *)color
{ {
if (![_backgroundColor isEqual: color]) if (![_backgroundColor isEqual: color])
{ {
@ -1374,7 +1374,7 @@ started (in another text view attached to the same layout manager). */
} }
} }
-(void) setDrawsBackground: (BOOL)flag - (void) setDrawsBackground: (BOOL)flag
{ {
if (_tf.draws_background != flag) if (_tf.draws_background != flag)
{ {
@ -1384,34 +1384,34 @@ started (in another text view attached to the same layout manager). */
} }
-(void) setInsertionPointColor: (NSColor *)color - (void) setInsertionPointColor: (NSColor *)color
{ {
ASSIGN(_insertionPointColor, color); ASSIGN(_insertionPointColor, color);
} }
-(NSColor *) insertionPointColor - (NSColor *) insertionPointColor
{ {
return _insertionPointColor; return _insertionPointColor;
} }
-(void) setSelectedTextAttributes: (NSDictionary *)attributeDictionary - (void) setSelectedTextAttributes: (NSDictionary *)attributeDictionary
{ {
ASSIGN(_selectedTextAttributes, attributeDictionary); ASSIGN(_selectedTextAttributes, attributeDictionary);
} }
-(NSDictionary *) selectedTextAttributes - (NSDictionary *) selectedTextAttributes
{ {
return _selectedTextAttributes; return _selectedTextAttributes;
} }
-(void) setMarkedTextAttributes: (NSDictionary *)attributeDictionary - (void) setMarkedTextAttributes: (NSDictionary *)attributeDictionary
{ {
ASSIGN(_markedTextAttributes, attributeDictionary); ASSIGN(_markedTextAttributes, attributeDictionary);
} }
-(NSDictionary *) markedTextAttributes - (NSDictionary *) markedTextAttributes
{ {
return _markedTextAttributes; return _markedTextAttributes;
} }
@ -1443,49 +1443,49 @@ TODO: Check and fix bounds vs. frame issues.
would be very tricky), so is it worth having them there at all? The docs are would be very tricky), so is it worth having them there at all? The docs are
pretty clear about what happens (ie. breakage) if you set the flags pretty clear about what happens (ie. breakage) if you set the flags
incorrectly. */ incorrectly. */
-(void) setHorizontallyResizable: (BOOL)flag - (void) setHorizontallyResizable: (BOOL)flag
{ {
/* Safety call */ /* Safety call */
[_textContainer setWidthTracksTextView: !flag]; [_textContainer setWidthTracksTextView: !flag];
_tf.is_horizontally_resizable = flag; _tf.is_horizontally_resizable = flag;
} }
-(void) setVerticallyResizable: (BOOL)flag - (void) setVerticallyResizable: (BOOL)flag
{ {
/* Safety call */ /* Safety call */
[_textContainer setHeightTracksTextView: !flag]; [_textContainer setHeightTracksTextView: !flag];
_tf.is_vertically_resizable = flag; _tf.is_vertically_resizable = flag;
} }
-(BOOL) isHorizontallyResizable - (BOOL) isHorizontallyResizable
{ {
return _tf.is_horizontally_resizable; return (_tf.is_horizontally_resizable ? YES : NO);
} }
-(BOOL) isVerticallyResizable - (BOOL) isVerticallyResizable
{ {
return _tf.is_vertically_resizable; return (_tf.is_vertically_resizable ? YES : NO);
} }
-(NSSize) maxSize - (NSSize) maxSize
{ {
return _maxSize; return _maxSize;
} }
-(NSSize) minSize - (NSSize) minSize
{ {
return _minSize; return _minSize;
} }
-(void) setMaxSize: (NSSize)newMaxSize - (void) setMaxSize: (NSSize)newMaxSize
{ {
_maxSize = newMaxSize; _maxSize = newMaxSize;
} }
-(void) setMinSize: (NSSize)newMinSize - (void) setMinSize: (NSSize)newMinSize
{ {
_minSize = newMinSize; _minSize = newMinSize;
} }
-(void) sizeToFit - (void) sizeToFit
{ {
NSSize size; NSSize size;
@ -1524,7 +1524,7 @@ used instead. Should test on OS to find out what the proper behavior is.
UPDATE: current behavior is correct, but must be documented properly UPDATE: current behavior is correct, but must be documented properly
before this TODO can be removed before this TODO can be removed
*/ */
-(void) setConstrainedFrameSize: (NSSize)desiredSize - (void) setConstrainedFrameSize: (NSSize)desiredSize
{ {
NSSize newSize; NSSize newSize;
NSSize effectiveMinSize = _minSize; NSSize effectiveMinSize = _minSize;
@ -1575,7 +1575,7 @@ The text container origin is the origin of the text container's coordinate
system in our coordinate system. system in our coordinate system.
*/ */
-(void) setTextContainerInset: (NSSize)inset - (void) setTextContainerInset: (NSSize)inset
{ {
_textContainerInset = inset; _textContainerInset = inset;
[self invalidateTextContainerOrigin]; [self invalidateTextContainerOrigin];
@ -1585,12 +1585,12 @@ system in our coordinate system.
object: self]; object: self];
} }
-(NSSize) textContainerInset - (NSSize) textContainerInset
{ {
return _textContainerInset; return _textContainerInset;
} }
-(NSPoint) textContainerOrigin - (NSPoint) textContainerOrigin
{ {
return _textContainerOrigin; return _textContainerOrigin;
} }
@ -1601,7 +1601,7 @@ really see what it did, and I didn't see anything in the docs that imply
that anything complex needs to be done, so I removed it. Should double-check that anything complex needs to be done, so I removed it. Should double-check
and bring it back if necessary. and bring it back if necessary.
*/ */
-(void) invalidateTextContainerOrigin - (void) invalidateTextContainerOrigin
{ {
_textContainerOrigin.x = NSMinX(_bounds); _textContainerOrigin.x = NSMinX(_bounds);
_textContainerOrigin.x += _textContainerInset.width; _textContainerOrigin.x += _textContainerInset.width;
@ -1620,7 +1620,7 @@ here. */
/* TODO: currently no support for marked text */ /* TODO: currently no support for marked text */
-(NSAttributedString *) attributedSubstringFromRange: (NSRange)theRange - (NSAttributedString *) attributedSubstringFromRange: (NSRange)theRange
{ {
if (theRange.location >= [_textStorage length]) if (theRange.location >= [_textStorage length])
return nil; return nil;
@ -1633,7 +1633,7 @@ here. */
TODO: make sure this is only called when _layoutManager is known non-nil, TODO: make sure this is only called when _layoutManager is known non-nil,
or add guards or add guards
*/ */
-(unsigned int) characterIndexForPoint: (NSPoint)point - (unsigned int) characterIndexForPoint: (NSPoint)point
{ {
unsigned index; unsigned index;
float fraction; float fraction;
@ -1655,35 +1655,35 @@ or add guards
return index; return index;
} }
-(NSRange) markedRange - (NSRange) markedRange
{ {
return NSMakeRange(NSNotFound, 0); return NSMakeRange(NSNotFound, 0);
} }
-(void) setMarkedText: (NSString *)aString selectedRange: (NSRange)selRange - (void) setMarkedText: (NSString *)aString selectedRange: (NSRange)selRange
{ {
} }
-(BOOL) hasMarkedText - (BOOL) hasMarkedText
{ {
return NO; return NO;
} }
-(void) unmarkText - (void) unmarkText
{ {
} }
-(NSArray *) validAttributesForMarkedText - (NSArray *) validAttributesForMarkedText
{ {
return nil; return nil;
} }
-(long int) conversationIdentifier - (long int) conversationIdentifier
{ {
return (long int)_textStorage; return (long int)_textStorage;
} }
-(NSRect) firstRectForCharacterRange: (NSRange)theRange - (NSRect) firstRectForCharacterRange: (NSRange)theRange
{ {
unsigned int rectCount = 0; /* If there's no layout manager, it'll be 0 after the call too. */ unsigned int rectCount = 0; /* If there's no layout manager, it'll be 0 after the call too. */
NSRect *rects = [_layoutManager NSRect *rects = [_layoutManager
@ -1700,7 +1700,7 @@ or add guards
/* Unlike NSResponder, we should _not_ send the selector down the responder /* Unlike NSResponder, we should _not_ send the selector down the responder
chain if we can't handle it. */ chain if we can't handle it. */
-(void) doCommandBySelector: (SEL)aSelector - (void) doCommandBySelector: (SEL)aSelector
{ {
if (!_layoutManager) if (!_layoutManager)
{ {
@ -1731,7 +1731,7 @@ attributes.
This method is for user changes; see NSTextView_actions.m. This method is for user changes; see NSTextView_actions.m.
*/ */
-(void) insertText: (id)insertString - (void) insertText: (id)insertString
{ {
NSRange insertRange = [self rangeForUserTextChange]; NSRange insertRange = [self rangeForUserTextChange];
NSString *string; NSString *string;
@ -1855,7 +1855,7 @@ GNUstep extension. Like the above, but uses the attributes from the
string if the text view is rich-text, and otherwise the typing string if the text view is rich-text, and otherwise the typing
attributes. attributes.
*/ */
-(void) replaceCharactersInRange: (NSRange)aRange - (void) replaceCharactersInRange: (NSRange)aRange
withAttributedString: (NSAttributedString *)aString withAttributedString: (NSAttributedString *)aString
{ {
if (aRange.location == NSNotFound) /* TODO: throw exception instead? */ if (aRange.location == NSNotFound) /* TODO: throw exception instead? */
@ -1886,7 +1886,7 @@ the attributes for the range, and do not update the typing attributes.
*/ */
-(void) setFont: (NSFont *)font - (void) setFont: (NSFont *)font
{ {
if (!font) if (!font)
return; return;
@ -1898,7 +1898,7 @@ the attributes for the range, and do not update the typing attributes.
forKey: NSFontAttributeName]; forKey: NSFontAttributeName];
} }
-(void) setFont: (NSFont *)font range: (NSRange)aRange - (void) setFont: (NSFont *)font range: (NSRange)aRange
{ {
if (!_tf.is_rich_text || !font) if (!_tf.is_rich_text || !font)
return; return;
@ -1909,7 +1909,7 @@ the attributes for the range, and do not update the typing attributes.
} }
-(void) setAlignment: (NSTextAlignment)alignment - (void) setAlignment: (NSTextAlignment)alignment
{ {
NSParagraphStyle *style; NSParagraphStyle *style;
NSMutableParagraphStyle *mstyle; NSMutableParagraphStyle *mstyle;
@ -1930,7 +1930,7 @@ the attributes for the range, and do not update the typing attributes.
DESTROY(mstyle); DESTROY(mstyle);
} }
-(void) setAlignment: (NSTextAlignment)alignment - (void) setAlignment: (NSTextAlignment)alignment
range: (NSRange)range range: (NSRange)range
{ {
if (!_tf.is_rich_text) if (!_tf.is_rich_text)
@ -1981,28 +1981,28 @@ the attributes for the range, and do not update the typing attributes.
/**** Text access methods ****/ /**** Text access methods ****/
-(NSData *) RTFDFromRange: (NSRange)aRange - (NSData *) RTFDFromRange: (NSRange)aRange
{ {
return [_textStorage RTFDFromRange: aRange documentAttributes: nil]; return [_textStorage RTFDFromRange: aRange documentAttributes: nil];
} }
-(NSData *) RTFFromRange: (NSRange)aRange - (NSData *) RTFFromRange: (NSRange)aRange
{ {
return [_textStorage RTFFromRange: aRange documentAttributes: nil]; return [_textStorage RTFFromRange: aRange documentAttributes: nil];
} }
-(NSString *) string - (NSString *) string
{ {
return [_textStorage string]; return [_textStorage string];
} }
-(unsigned) textLength - (unsigned) textLength
{ {
return [_textStorage length]; return [_textStorage length];
} }
-(NSFont *) font - (NSFont *) font
{ {
if ([_textStorage length] > 0) if ([_textStorage length] > 0)
{ {
@ -2023,13 +2023,13 @@ Since the alignment of the typing attributes will always be the same as the
alignment of the first selected paragraph, we can simply return the typing alignment of the first selected paragraph, we can simply return the typing
attributes' alignment. (TODO: double-check this assumption) attributes' alignment. (TODO: double-check this assumption)
*/ */
-(NSTextAlignment) alignment - (NSTextAlignment) alignment
{ {
return [[_layoutManager->_typingAttributes objectForKey: NSParagraphStyleAttributeName] return [[_layoutManager->_typingAttributes objectForKey: NSParagraphStyleAttributeName]
alignment]; alignment];
} }
-(NSColor *) textColor - (NSColor *) textColor
{ {
if ([_textStorage length] > 0) if ([_textStorage length] > 0)
{ {
@ -2050,7 +2050,7 @@ TODO:
Move to NSTextView_actions.m? Move to NSTextView_actions.m?
*/ */
-(void) copy: (id)sender - (void) copy: (id)sender
{ {
NSMutableArray *types = [NSMutableArray array]; NSMutableArray *types = [NSMutableArray array];
@ -2067,7 +2067,7 @@ Move to NSTextView_actions.m?
} }
/* Copy the current font to the font pasteboard */ /* Copy the current font to the font pasteboard */
-(void) copyFont: (id)sender - (void) copyFont: (id)sender
{ {
NSPasteboard *pb = [NSPasteboard pasteboardWithName: NSFontPboard]; NSPasteboard *pb = [NSPasteboard pasteboardWithName: NSFontPboard];
@ -2076,7 +2076,7 @@ Move to NSTextView_actions.m?
} }
/* Copy the current ruler settings to the ruler pasteboard */ /* Copy the current ruler settings to the ruler pasteboard */
-(void) copyRuler: (id)sender - (void) copyRuler: (id)sender
{ {
NSPasteboard *pb = [NSPasteboard pasteboardWithName: NSRulerPboard]; NSPasteboard *pb = [NSPasteboard pasteboardWithName: NSRulerPboard];
@ -2085,12 +2085,12 @@ Move to NSTextView_actions.m?
} }
-(void) paste: (id)sender - (void) paste: (id)sender
{ {
[self readSelectionFromPasteboard: [NSPasteboard generalPasteboard]]; [self readSelectionFromPasteboard: [NSPasteboard generalPasteboard]];
} }
-(void) pasteFont: (id)sender - (void) pasteFont: (id)sender
{ {
NSPasteboard *pb = [NSPasteboard pasteboardWithName: NSFontPboard]; NSPasteboard *pb = [NSPasteboard pasteboardWithName: NSFontPboard];
@ -2098,7 +2098,7 @@ Move to NSTextView_actions.m?
type: NSFontPboardType]; type: NSFontPboardType];
} }
-(void) pasteRuler: (id)sender - (void) pasteRuler: (id)sender
{ {
NSPasteboard *pb = [NSPasteboard pasteboardWithName: NSRulerPboard]; NSPasteboard *pb = [NSPasteboard pasteboardWithName: NSRulerPboard];
@ -2106,13 +2106,13 @@ Move to NSTextView_actions.m?
type: NSRulerPboardType]; type: NSRulerPboardType];
} }
-(void) pasteAsPlainText: (id)sender - (void) pasteAsPlainText: (id)sender
{ {
[self readSelectionFromPasteboard: [NSPasteboard generalPasteboard] [self readSelectionFromPasteboard: [NSPasteboard generalPasteboard]
type: NSStringPboardType]; type: NSStringPboardType];
} }
-(void) pasteAsRichText: (id)sender - (void) pasteAsRichText: (id)sender
{ {
[self readSelectionFromPasteboard: [NSPasteboard generalPasteboard] [self readSelectionFromPasteboard: [NSPasteboard generalPasteboard]
type: NSRTFPboardType]; type: NSRTFPboardType];
@ -2175,7 +2175,7 @@ In -didChangeText, if we still aren't the first responder, we send the
TextDidEndEditing notification _without_ asking the delegate TextDidEndEditing notification _without_ asking the delegate
(-; since we can't handle a NO return). (-; since we can't handle a NO return).
*/ */
-(BOOL) shouldChangeTextInRange: (NSRange)affectedCharRange - (BOOL) shouldChangeTextInRange: (NSRange)affectedCharRange
replacementString: (NSString *)replacementString replacementString: (NSString *)replacementString
{ {
if (_tf.is_editable == NO) if (_tf.is_editable == NO)
@ -2212,7 +2212,7 @@ TextDidEndEditing notification _without_ asking the delegate
/* /*
After each user-induced change, this method should be called. After each user-induced change, this method should be called.
*/ */
-(void) didChangeText - (void) didChangeText
{ {
[self scrollRangeToVisible: [self selectedRange]]; [self scrollRangeToVisible: [self selectedRange]];
[notificationCenter postNotificationName: NSTextDidChangeNotification [notificationCenter postNotificationName: NSTextDidChangeNotification
@ -2239,7 +2239,7 @@ After each user-induced change, this method should be called.
Returns the ranges to which various kinds of user changes should apply. Returns the ranges to which various kinds of user changes should apply.
*/ */
-(NSRange) rangeForUserCharacterAttributeChange - (NSRange) rangeForUserCharacterAttributeChange
{ {
if (!_tf.is_editable || !_tf.uses_font_panel || !_layoutManager) if (!_tf.is_editable || !_tf.uses_font_panel || !_layoutManager)
{ {
@ -2256,7 +2256,7 @@ Returns the ranges to which various kinds of user changes should apply.
} }
} }
-(NSRange) rangeForUserParagraphAttributeChange - (NSRange) rangeForUserParagraphAttributeChange
{ {
if (!_tf.is_editable || !_tf.uses_ruler || !_layoutManager) if (!_tf.is_editable || !_tf.uses_ruler || !_layoutManager)
{ {
@ -2274,7 +2274,7 @@ Returns the ranges to which various kinds of user changes should apply.
} }
} }
-(NSRange) rangeForUserTextChange - (NSRange) rangeForUserTextChange
{ {
if (!_tf.is_editable || !_layoutManager) if (!_tf.is_editable || !_layoutManager)
{ {
@ -2291,7 +2291,7 @@ Returns the ranges to which various kinds of user changes should apply.
/* /*
Scroll so that the beginning of the range is visible. Scroll so that the beginning of the range is visible.
*/ */
-(void) scrollRangeToVisible: (NSRange)aRange - (void) scrollRangeToVisible: (NSRange)aRange
{ {
NSRect rect, r; NSRect rect, r;
NSView *cv; NSView *cv;
@ -2436,10 +2436,10 @@ Scroll so that the beginning of the range is visible.
(XIM, currently). Backends may override these in categories with the real (XIM, currently). Backends may override these in categories with the real
(backend-specific) handling. */ (backend-specific) handling. */
-(void) _updateInputMethodState - (void) _updateInputMethodState
{ {
} }
-(void) _updateInputMethodWithInsertionPoint: (NSPoint)insertionPoint - (void) _updateInputMethodWithInsertionPoint: (NSPoint)insertionPoint
{ {
} }
@ -2666,27 +2666,27 @@ This method is for user changes; see NSTextView_actions.m.
/**** Smart insert/delete ****/ /**** Smart insert/delete ****/
-(NSRange) smartDeleteRangeForProposedRange: (NSRange)proposedCharRange - (NSRange) smartDeleteRangeForProposedRange: (NSRange)proposedCharRange
{ {
/* TODO */ /* TODO */
return proposedCharRange; return proposedCharRange;
} }
-(NSString *)smartInsertAfterStringForString: (NSString *)aString - (NSString *)smartInsertAfterStringForString: (NSString *)aString
replacingRange: (NSRange)charRange replacingRange: (NSRange)charRange
{ {
/* TODO */ /* TODO */
return nil; return nil;
} }
-(NSString *)smartInsertBeforeStringForString: (NSString *)aString - (NSString *)smartInsertBeforeStringForString: (NSString *)aString
replacingRange: (NSRange)charRange replacingRange: (NSRange)charRange
{ {
/* TODO */ /* TODO */
return nil; return nil;
} }
-(void) smartInsertForString: (NSString *)aString - (void) smartInsertForString: (NSString *)aString
replacingRange: (NSRange)charRange replacingRange: (NSRange)charRange
beforeString: (NSString **)beforeString beforeString: (NSString **)beforeString
afterString: (NSString **)afterString afterString: (NSString **)afterString
@ -3626,7 +3626,7 @@ shouldRemoveMarker: (NSRulerMarker *)marker
} }
-(int) spellCheckerDocumentTag - (int) spellCheckerDocumentTag
{ {
if (!_spellCheckerDocumentTag) if (!_spellCheckerDocumentTag)
_spellCheckerDocumentTag = [NSSpellChecker uniqueSpellDocumentTag]; _spellCheckerDocumentTag = [NSSpellChecker uniqueSpellDocumentTag];
@ -4195,7 +4195,7 @@ other than copy/paste or dragging. */
/**** Event handling ****/ /**** Event handling ****/
-(void) mouseDown: (NSEvent *)theEvent - (void) mouseDown: (NSEvent *)theEvent
{ {
NSSelectionAffinity affinity = [self selectionAffinity]; NSSelectionAffinity affinity = [self selectionAffinity];
NSSelectionGranularity granularity = NSSelectByCharacter; NSSelectionGranularity granularity = NSSelectByCharacter;
@ -4449,7 +4449,7 @@ other than copy/paste or dragging. */
[self setSelectionGranularity: granularity]; [self setSelectionGranularity: granularity];
} }
-(void) keyDown: (NSEvent *)theEvent - (void) keyDown: (NSEvent *)theEvent
{ {
// If not editable, don't recognize the key down // If not editable, don't recognize the key down
if (_tf.is_editable == NO) if (_tf.is_editable == NO)
@ -4464,7 +4464,7 @@ other than copy/paste or dragging. */
/* Bind other mouse up to pasteSelection. This should be done via /* Bind other mouse up to pasteSelection. This should be done via
configuation! */ configuation! */
-(void) otherMouseUp: (NSEvent *)theEvent - (void) otherMouseUp: (NSEvent *)theEvent
{ {
// TODO: Should we change the insertion point, based on the event position? // TODO: Should we change the insertion point, based on the event position?
[self pasteSelection]; [self pasteSelection];

View file

@ -4108,7 +4108,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
- (BOOL) needsDisplay - (BOOL) needsDisplay
{ {
return _rFlags.needs_display; return (_rFlags.needs_display ? YES : NO);
} }
- (int) tag - (int) tag

View file

@ -207,7 +207,7 @@
- (BOOL) shouldCloseDocument - (BOOL) shouldCloseDocument
{ {
return _wcFlags.shouldCloseDocument; return (_wcFlags.shouldCloseDocument ? YES : NO);
} }
- (void) setShouldCascadeWindows: (BOOL)flag - (void) setShouldCascadeWindows: (BOOL)flag
@ -217,7 +217,7 @@
- (BOOL) shouldCascadeWindows - (BOOL) shouldCascadeWindows
{ {
return _wcFlags.shouldCascade; return (_wcFlags.shouldCascade ? YES : NO);
} }
- (void) close - (void) close
@ -375,7 +375,7 @@
- (BOOL) isWindowLoaded - (BOOL) isWindowLoaded
{ {
return _wcFlags.nibIsLoaded; return (_wcFlags.nibIsLoaded ? YES : NO);
} }
- (void) windowDidLoad - (void) windowDidLoad