Tweaks to avoid new compiler warnings with gcc-4.1 and some 64bit issues.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23126 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2006-07-04 21:31:49 +00:00
parent e2530f9bc8
commit 2ed1c70692
30 changed files with 313 additions and 246 deletions

View file

@ -1,3 +1,37 @@
2006-07-04 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSSpellServer.m:
* Source/NSAlert.m:
* Source/NSWindowController.m:
* Source/GSDisplayServer.m:
* Source/NSWorkspace.m:
* Source/GSLayoutManager.m:
* Source/NSWindow.m:
* Source/NSLayoutManager.m:
* Source/GSStandardWindowDecorationView.m:
* Source/GSTextStorage.m:
* Source/GSHorizontalTypesetter.m:
* Source/NSColor.m:
* Source/NSPasteboard.m:
* Source/NSMenuItem.m:
* Source/NSPageLayout.m:
* Source/NSOutlineView.m:
* Source/NSTextView.m:
* Source/NSBitmapImageRep+JPEG.m:
* Source/NSComboBoxCell.m:
* Source/NSToolbarItem.m:
* Source/NSImage.m:
* Source/NSDataLink.m:
* Source/GSServicesManager.m:
* Source/NSPrintPanel.m:
* Source/NSEvent.m:
* Source/GSDragView.m:
* Model/GMArchiver.m:
* Model/IMConnectors.m:
* Tools/GSspell.m:
Tweaks to avoid spurious warnings in recent gcc-4.1 and a few casts
etc to deal with a few real issues when working on 64bit cpus.
2006-07-02 Fred Kiefer <FredKiefer@gmx.de> 2006-07-02 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView.m (-rulerView:didMoveMarker:, * Source/NSTextView.m (-rulerView:didMoveMarker:,

View file

@ -289,7 +289,7 @@
-encodeObject: withName: message, save its label into the -encodeObject: withName: message, save its label into the
topLevelObjects array. */ topLevelObjects array. */
if (!level) if (!level)
[topLevelObjects addObject: (name ? name : label)]; [topLevelObjects addObject: (name ? (id)name : (id)label)];
lastObjectRepresentation = objectPList; lastObjectRepresentation = objectPList;
@ -579,7 +579,7 @@
{ {
id inArchiveName = [(id)NSMapGet(classes, trueName) className]; id inArchiveName = [(id)NSMapGet(classes, trueName) className];
return inArchiveName ? inArchiveName : trueName; return inArchiveName ? (NSString*)inArchiveName : (NSString*)trueName;
} }
/* In the following method the version of class named trueName is written as /* In the following method the version of class named trueName is written as

View file

@ -76,7 +76,7 @@
{ {
const char *type; const char *type;
unsigned int size; unsigned int size;
unsigned int offset; int offset;
/* /*
* Use the GNUstep additional function to set the instance * Use the GNUstep additional function to set the instance
@ -100,7 +100,7 @@
{ {
const char *type; const char *type;
unsigned int size; unsigned int size;
unsigned int offset; int offset;
/* /*
* Use the GNUstep additional function to set the instance * Use the GNUstep additional function to set the instance
@ -158,7 +158,7 @@
const char *nam = [label cString]; const char *nam = [label cString];
const char *type; const char *type;
unsigned int size; unsigned int size;
unsigned int offset; int offset;
/* /*
* Use the GNUstep additional function to set the instance * Use the GNUstep additional function to set the instance

View file

@ -80,7 +80,7 @@ GSServerForWindow(NSWindow *window)
/* Backend window hasn't been initialized yet, assume current server. */ /* Backend window hasn't been initialized yet, assume current server. */
return GSCurrentServer(); return GSCurrentServer();
} }
return NSMapGet(windowmaps, (void *)num); return NSMapGet(windowmaps, (void *)(intptr_t)num);
} }
/** Returns the current GSDisplayServer */ /** Returns the current GSDisplayServer */
@ -511,7 +511,7 @@ GSCurrentServer(void)
for a window that has already been created */ for a window that has already been created */
- (void) _setWindowOwnedByServer: (int)win - (void) _setWindowOwnedByServer: (int)win
{ {
NSMapInsert (windowmaps, (void*)win, self); NSMapInsert (windowmaps, (void*)(intptr_t)win, self);
} }
/** Creates a window whose location and size is described by frame and /** Creates a window whose location and size is described by frame and

View file

@ -543,7 +543,7 @@ static GSDragView *sharedDragView = nil;
NSEvent *e; NSEvent *e;
NSGraphicsContext *context = GSCurrentContext(); NSGraphicsContext *context = GSCurrentContext();
// FIXME: Should store this once // FIXME: Should store this once
int dragWindowRef = (int)[GSServerForWindow(_window) windowDevice: [_window windowNumber]]; int dragWindowRef = (int)(intptr_t)[GSServerForWindow(_window) windowDevice: [_window windowNumber]];
eventLocation = [dWindow convertScreenToBase: eventLocation]; eventLocation = [dWindow convertScreenToBase: eventLocation];
e = [NSEvent otherEventWithType: NSAppKitDefined e = [NSEvent otherEventWithType: NSAppKitDefined

View file

@ -874,12 +874,14 @@ restart: ;
if (g->g == GSAttachmentGlyph) if (g->g == GSAttachmentGlyph)
{ {
NSTextAttachment *attach = [curTextStorage attribute: NSAttachmentAttributeName NSTextAttachment *attach;
atIndex: g->char_index NSTextAttachmentCell *cell;
effectiveRange: NULL];
NSTextAttachmentCell *cell = [attach attachmentCell];
NSRect r; NSRect r;
attach = [curTextStorage attribute: NSAttachmentAttributeName
atIndex: g->char_index
effectiveRange: NULL];
cell = (NSTextAttachmentCell*)[attach attachmentCell];
if (!cell) if (!cell)
{ {
g->pos = p; g->pos = p;

View file

@ -157,9 +157,9 @@ Private method used internally by GSLayoutManager for sanity checking.
h = (glyph_run_t *)(glyphs + SKIP_LIST_DEPTH - 1)->next; h = (glyph_run_t *)(glyphs + SKIP_LIST_DEPTH - 1)->next;
for (; h; h = (glyph_run_t *)h->head.next) for (; h; h = (glyph_run_t *)h->head.next)
{ {
printf("%08x %i chars, %i glyphs, %i complete, prev %08x next %08x\n", printf("%8p %i chars, %i glyphs, %i complete, prev %8p next %8p\n",
(int)h, h->head.char_length, h->head.glyph_length, h->head.complete, h, h->head.char_length, h->head.glyph_length, h->head.complete,
(int)h->prev, (int)h->head.next); h->prev, h->head.next);
printf(" level %i, continued %i\n", h->level, h->continued); printf(" level %i, continued %i\n", h->level, h->continued);
if (h->head.complete) if (h->head.complete)
{ {
@ -181,14 +181,14 @@ Private method used internally by GSLayoutManager for sanity checking.
printf(" head: "); printf(" head: ");
for (i = 0, h = glyphs + SKIP_LIST_DEPTH - 1; i < SKIP_LIST_DEPTH; i++, h--) for (i = 0, h = glyphs + SKIP_LIST_DEPTH - 1; i < SKIP_LIST_DEPTH; i++, h--)
printf("%8x %i %3i %3i|", (int)h->next, h->complete, h->char_length, h->glyph_length); printf("%8p %i %3i %3i|", h->next, h->complete, h->char_length, h->glyph_length);
printf("\n"); printf("\n");
h = (glyphs + SKIP_LIST_DEPTH - 1)->next; h = (glyphs + SKIP_LIST_DEPTH - 1)->next;
for (; h; h = h->next) for (; h; h = h->next)
{ {
printf("%8x: ", (int)h); printf("%8p: ", h);
for (g = h, i = ((glyph_run_t *)h)->level; i >= 0; i--, g--) for (g = h, i = ((glyph_run_t *)h)->level; i >= 0; i--, g--)
printf("%8x %i %3i %3i|", (int)g->next, g->complete, g->char_length, g->glyph_length); printf("%8p %i %3i %3i|", g->next, g->complete, g->char_length, g->glyph_length);
printf("\n"); printf("\n");
} }
} }

View file

@ -278,6 +278,7 @@ NSRegisterServicesProvider(id provider, NSString *name)
- (void) dealloc - (void) dealloc
{ {
GSNOSUPERDEALLOC;
} }
/** /**
@ -644,7 +645,7 @@ static NSString *disabledName = @".GNUstepDisabled";
unsigned i, j; unsigned i, j;
unsigned es = [sendTypes count]; unsigned es = [sendTypes count];
unsigned er = [returnTypes count]; unsigned er = [returnTypes count];
NSWindow *resp = [[_application keyWindow] firstResponder]; NSResponder *resp = [[_application keyWindow] firstResponder];
id obj = nil; id obj = nil;
for (i = 0; i <= es; i++) for (i = 0; i <= es; i++)
@ -1267,7 +1268,7 @@ static NSString *disabledName = @".GNUstepDisabled";
unsigned i, j; unsigned i, j;
unsigned es = [sendTypes count]; unsigned es = [sendTypes count];
unsigned er = [returnTypes count]; unsigned er = [returnTypes count];
NSWindow *resp = [[_application keyWindow] firstResponder]; NSResponder *resp = [[_application keyWindow] firstResponder];
/* /*
* If the menu item is not in our map, it must be the item containing * If the menu item is not in our map, it must be the item containing

View file

@ -120,7 +120,7 @@ static NSColor *titleColor[3];
{ {
NSMutableParagraphStyle *p; NSMutableParagraphStyle *p;
p = [NSMutableParagraphStyle defaultParagraphStyle]; p = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
[p setLineBreakMode: NSLineBreakByClipping]; [p setLineBreakMode: NSLineBreakByClipping];
titleTextAttributes[0] = [[NSMutableDictionary alloc] titleTextAttributes[0] = [[NSMutableDictionary alloc]
@ -142,6 +142,7 @@ static NSColor *titleColor[3];
p, NSParagraphStyleAttributeName, p, NSParagraphStyleAttributeName,
nil]; nil];
RELEASE(p);
titleColor[0] = RETAIN([NSColor windowFrameColor]); titleColor[0] = RETAIN([NSColor windowFrameColor]);
titleColor[1] = RETAIN([NSColor lightGrayColor]); titleColor[1] = RETAIN([NSColor lightGrayColor]);
titleColor[2] = RETAIN([NSColor darkGrayColor]); titleColor[2] = RETAIN([NSColor darkGrayColor]);

View file

@ -167,6 +167,7 @@ unCacheAttributes(NSDictionary *attrs)
{ {
[self gcFinalize]; [self gcFinalize];
NSDeallocateObject(self); NSDeallocateObject(self);
GSNOSUPERDEALLOC;
} }
- (NSString*) description - (NSString*) description

View file

@ -690,8 +690,7 @@ setControl(NSView* content, id control, NSString *title)
} }
else else
{ {
NSLog(@"alert panel buttonAction: from unknown sender - x%x\n", NSLog(@"alert panel buttonAction: from unknown sender - x%p\n", sender);
(unsigned)sender);
} }
[NSApp stopModalWithCode: result]; [NSApp stopModalWithCode: result];
} }

View file

@ -270,7 +270,7 @@ nil. */
{ {
/* assign the description of possible occured error to errorMsg */ /* assign the description of possible occured error to errorMsg */
if (errorMsg) if (errorMsg)
*errorMsg = (jerrMgr.error ? jerrMgr.error : nil); *errorMsg = (jerrMgr.error ? (id)jerrMgr.error : (id)nil);
gs_jpeg_memory_src_destroy(&cinfo); gs_jpeg_memory_src_destroy(&cinfo);
jpeg_destroy_decompress(&cinfo); jpeg_destroy_decompress(&cinfo);
if (imgbuffer) if (imgbuffer)

View file

@ -1673,7 +1673,7 @@ systemColorWithName(NSString *name)
} }
else else
{ {
GSNamedColor *aCopy = NSCopyObject(self, 0, aZone); GSNamedColor *aCopy = (GSNamedColor*)NSCopyObject(self, 0, aZone);
aCopy->_catalog_name = [_catalog_name copyWithZone: aZone]; aCopy->_catalog_name = [_catalog_name copyWithZone: aZone];
aCopy->_color_name = [_color_name copyWithZone: aZone]; aCopy->_color_name = [_color_name copyWithZone: aZone];
@ -2893,7 +2893,7 @@ systemColorWithName(NSString *name)
} }
else else
{ {
GSPatternColor *aCopy = NSCopyObject(self, 0, aZone); GSPatternColor *aCopy = (GSPatternColor*)NSCopyObject(self, 0, aZone);
aCopy->_pattern = [_pattern copyWithZone: aZone]; aCopy->_pattern = [_pattern copyWithZone: aZone];
return aCopy; return aCopy;

View file

@ -695,12 +695,12 @@ static GSComboWindow *gsWindow = nil;
{ {
if (_cell != nil) if (_cell != nil)
{ {
NSText *textObject = nil; NSText *textObject = nil;
NSControl *cv = [_cell controlView]; id cv = [_cell controlView];
if ([cv isKindOfClass: [NSControl class]]) if ([cv isKindOfClass: [NSControl class]])
{ {
textObject = [(NSControl *)cv currentEditor]; textObject = [(NSControl *)cv currentEditor];
} }
[_cell setStringValue: [_cell _stringValueAtIndex: [_cell setStringValue: [_cell _stringValueAtIndex:

View file

@ -341,7 +341,7 @@
{ {
id obj; id obj;
linkNumber = [aCoder decodeObjectForKey: @"GSLinkNumber"]; linkNumber = [aCoder decodeIntForKey: @"GSLinkNumber"];
disposition = [aCoder decodeIntForKey: @"GSDisposition"]; disposition = [aCoder decodeIntForKey: @"GSDisposition"];
updateMode = [aCoder decodeIntForKey: @"GSUpdateMode"]; updateMode = [aCoder decodeIntForKey: @"GSUpdateMode"];

View file

@ -510,6 +510,7 @@ static Class eventClass;
RELEASE((id)event_data.tracking.user_data); RELEASE((id)event_data.tracking.user_data);
} }
NSDeallocateObject(self); NSDeallocateObject(self);
GSNOSUPERDEALLOC;
} }
/** /**

View file

@ -127,6 +127,7 @@ BOOL NSImageForceCaching = NO; /* use on missmatch */
TEST_RELEASE(rep); TEST_RELEASE(rep);
TEST_RELEASE(bg); TEST_RELEASE(bg);
NSDeallocateObject(self); NSDeallocateObject(self);
GSNOSUPERDEALLOC;
} }
@end @end
@ -1781,7 +1782,7 @@ iterate_reps_for_types(NSArray* imageReps, SEL method)
rep = [self _cacheForRep: rep]; rep = [self _cacheForRep: rep];
repd = repd_for_rep(_reps, rep); repd = repd_for_rep(_reps, rep);
NSDebugLLog(@"NSImage", @"Cached image rep is %d", (int)rep); NSDebugLLog(@"NSImage", @"Cached image rep is %p", rep);
/* /*
* if the cache is not valid, it's background color will not exist * if the cache is not valid, it's background color will not exist
* and we must draw the background then render from the original * and we must draw the background then render from the original
@ -1811,8 +1812,8 @@ iterate_reps_for_types(NSArray* imageReps, SEL method)
{ {
[rep setOpaque: [repd->original isOpaque]]; [rep setOpaque: [repd->original isOpaque]];
} }
NSDebugLLog(@"NSImage", @"Rendered rep %d on background %@", NSDebugLLog(@"NSImage", @"Rendered rep %p on background %@",
(int)rep, repd->bg); rep, repd->bg);
} }
} }

View file

@ -1578,12 +1578,12 @@ dictionary.
-(BOOL) layoutManagerOwnsFirstResponderInWindow: (NSWindow *)window -(BOOL) layoutManagerOwnsFirstResponderInWindow: (NSWindow *)window
{ {
int i; int i;
NSView *tv; NSResponder *tv;
NSView *v = [window firstResponder]; NSResponder *v = [window firstResponder];
for (i = 0; i < num_textcontainers; i++) for (i = 0; i < num_textcontainers; i++)
{ {
tv = (NSView *)[textcontainers[i].textContainer textView]; tv = [textcontainers[i].textContainer textView];
if (tv == v) if (tv == v)
return YES; return YES;
} }

View file

@ -476,14 +476,22 @@ static Class imageClass;
{ {
if ([aDecoder allowsKeyedCoding]) if ([aDecoder allowsKeyedCoding])
{ {
NSString *title = [aDecoder decodeObjectForKey: @"NSTitle"]; NSString *title;
NSString *action = [aDecoder decodeObjectForKey: @"NSAction"]; NSString *action;
NSString *key = [aDecoder decodeObjectForKey: @"NSKeyEquiv"]; NSString *key;
NSImage *mixedImage = [aDecoder decodeObjectForKey: @"NSMixedImage"]; NSImage *mixedImage;
NSImage *onImage = [aDecoder decodeObjectForKey: @"NSOnImage"]; NSImage *onImage;
id target = [aDecoder decodeObjectForKey: @"NSTarget"]; id target;
NSMenu *menu = [aDecoder decodeObjectForKey: @"NSMenu"]; NSMenu *submenu;
NSMenu *submenu = [aDecoder decodeObjectForKey: @"NSSubmenu"];
title = [aDecoder decodeObjectForKey: @"NSTitle"];
action = [aDecoder decodeObjectForKey: @"NSAction"];
key = [aDecoder decodeObjectForKey: @"NSKeyEquiv"];
mixedImage = [aDecoder decodeObjectForKey: @"NSMixedImage"];
onImage = [aDecoder decodeObjectForKey: @"NSOnImage"];
target = [aDecoder decodeObjectForKey: @"NSTarget"];
[aDecoder decodeObjectForKey: @"NSMenu"];
submenu = [aDecoder decodeObjectForKey: @"NSSubmenu"];
self = [self initWithTitle: title self = [self initWithTitle: title
action: NSSelectorFromString(action) action: NSSelectorFromString(action)

View file

@ -2,8 +2,9 @@
<abstract> <abstract>
This class is a subclass of NSTableView which provides the user with a way This class is a subclass of NSTableView which provides the user with a way
to display tree structured data in an outline format. It is particularly useful for show to display tree structured data in an outline format.
hierarchical data such as a class inheritance tree or any other set of relationships. It is particularly useful for show hierarchical data such as a
class inheritance tree or any other set of relationships.
</abstract> </abstract>
Copyright (C) 2001 Free Software Foundation, Inc. Copyright (C) 2001 Free Software Foundation, Inc.
@ -263,7 +264,7 @@ static NSImage *unexpandable = nil;
NSMutableArray *allChildren = nil; NSMutableArray *allChildren = nil;
int numchild = 0; int numchild = 0;
int index = 0; int index = 0;
id sitem = (item == nil)?[NSNull null]:item; id sitem = (item == nil) ? (id)[NSNull null] : (id)item;
allChildren = NSMapGet(_itemDict, sitem); allChildren = NSMapGet(_itemDict, sitem);
numchild = [allChildren count]; numchild = [allChildren count];
@ -298,7 +299,7 @@ static NSImage *unexpandable = nil;
* expandable children of this item all also expanded in a recursive fashion (i.e. * expandable children of this item all also expanded in a recursive fashion (i.e.
* all children, grandchildren and etc). * all children, grandchildren and etc).
*/ */
- (void)expandItem:(id)item expandChildren:(BOOL)expandChildren - (void)expandItem: (id)item expandChildren: (BOOL)expandChildren
{ {
const SEL shouldExpandSelector = @selector(outlineView:shouldExpandItem:); const SEL shouldExpandSelector = @selector(outlineView:shouldExpandItem:);
BOOL canExpand = YES; BOOL canExpand = YES;
@ -354,7 +355,7 @@ static NSImage *unexpandable = nil;
NSMutableArray *allChildren = nil; NSMutableArray *allChildren = nil;
int numchild = 0; int numchild = 0;
int index = 0; int index = 0;
id sitem = (item == nil)?[NSNull null]:item; id sitem = (item == nil) ? (id)[NSNull null] : (id)item;
allChildren = NSMapGet(_itemDict, sitem); allChildren = NSMapGet(_itemDict, sitem);
numchild = [allChildren count]; numchild = [allChildren count];
@ -456,15 +457,15 @@ static NSImage *unexpandable = nil;
* Causes an item to be reloaded. This is the equivalent of calling * Causes an item to be reloaded. This is the equivalent of calling
* [NSOutlineView-reloadItem:reloadChildren:] with reloadChildren set to NO. * [NSOutlineView-reloadItem:reloadChildren:] with reloadChildren set to NO.
*/ */
- (void)reloadItem: (id)item - (void) reloadItem: (id)item
{ {
[self reloadItem: item reloadChildren: NO]; [self reloadItem: item reloadChildren: NO];
} }
/** /**
* Causes an item and all of it's children to be reloaded if reloadChildren is * Causes an item and all of it's children to be reloaded if reloadChildren is
* set to YES, if it's set to NO, then only the item itself is refreshed from the * set to YES, if it's set to NO, then only the item itself is refreshed
* datasource. * from the datasource.
*/ */
- (void)reloadItem: (id)item reloadChildren: (BOOL)reloadChildren - (void)reloadItem: (id)item reloadChildren: (BOOL)reloadChildren
{ {
@ -472,7 +473,7 @@ static NSImage *unexpandable = nil;
id parent; id parent;
BOOL expanded; BOOL expanded;
id dsobj = nil; id dsobj = nil;
id object = (item == nil)?([NSNull null]):item; id object = (item == nil) ? (id)[NSNull null] : (id)item;
NSArray *allKeys = NSAllMapTableKeys(_itemDict); NSArray *allKeys = NSAllMapTableKeys(_itemDict);
NSEnumerator *en = [allKeys objectEnumerator]; NSEnumerator *en = [allKeys objectEnumerator];
@ -485,7 +486,7 @@ static NSImage *unexpandable = nil;
if ((index = [childArray indexOfObject: object]) != NSNotFound) if ((index = [childArray indexOfObject: object]) != NSNotFound)
{ {
parent = (parent == [NSNull null])?nil:parent; parent = (parent == [NSNull null]) ? (id)nil : (id)parent;
dsobj = [_dataSource outlineView: self dsobj = [_dataSource outlineView: self
child: index child: index
ofItem: parent]; ofItem: parent];
@ -516,10 +517,10 @@ static NSImage *unexpandable = nil;
} }
/** /**
* Returns the corresponding row in the outline view for the given item. Returns * Returns the corresponding row in the outline view for the given item.
* -1 if item is nil or not found. * Returns -1 if item is nil or not found.
*/ */
- (int)rowForItem: (id)item - (int) rowForItem: (id)item
{ {
int row; int row;
if (item == nil) if (item == nil)
@ -534,7 +535,7 @@ static NSImage *unexpandable = nil;
* the expand/collapse gadget, to resize based on the amount of space * the expand/collapse gadget, to resize based on the amount of space
* needed by widest content. * needed by widest content.
*/ */
- (void)setAutoresizesOutlineColumn: (BOOL)resize - (void) setAutoresizesOutlineColumn: (BOOL)resize
{ {
_autoResizesOutlineColumn = resize; _autoResizesOutlineColumn = resize;
} }
@ -544,7 +545,7 @@ static NSImage *unexpandable = nil;
* collapsed items in the view to the users defaults for the application the * collapsed items in the view to the users defaults for the application the
* outline view is running in. * outline view is running in.
*/ */
- (void)setAutosaveExpandedItems: (BOOL)flag - (void) setAutosaveExpandedItems: (BOOL)flag
{ {
if (flag == _autosaveExpandedItems) if (flag == _autosaveExpandedItems)
{ {
@ -679,7 +680,7 @@ static NSImage *unexpandable = nil;
// Is the data source editable? // Is the data source editable?
_dataSource_editable = [anObject respondsToSelector: _dataSource_editable = [anObject respondsToSelector:
@selector(outlineView:setObjectValue:forTableColumn:byItem:)]; @selector(outlineView:setObjectValue:forTableColumn:byItem:)];
/* We do *not* retain the dataSource, it's like a delegate */ /* We do *not* retain the dataSource, it's like a delegate */
_dataSource = anObject; _dataSource = anObject;
@ -756,15 +757,19 @@ static NSImage *unexpandable = nil;
- (void) encodeWithCoder: (NSCoder*)aCoder - (void) encodeWithCoder: (NSCoder*)aCoder
{ {
[super encodeWithCoder: aCoder]; [super encodeWithCoder: aCoder];
if([aCoder allowsKeyedCoding]) if ([aCoder allowsKeyedCoding])
{ {
} }
else else
{ {
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_autoResizesOutlineColumn]; [aCoder encodeValueOfObjCType: @encode(BOOL)
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_indentationMarkerFollowsCell]; at: &_autoResizesOutlineColumn];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_autosaveExpandedItems]; [aCoder encodeValueOfObjCType: @encode(BOOL)
[aCoder encodeValueOfObjCType: @encode(float) at: &_indentationPerLevel]; at: &_indentationMarkerFollowsCell];
[aCoder encodeValueOfObjCType: @encode(BOOL)
at: &_autosaveExpandedItems];
[aCoder encodeValueOfObjCType: @encode(float)
at: &_indentationPerLevel];
[aCoder encodeConditionalObject: _outlineTableColumn]; [aCoder encodeConditionalObject: _outlineTableColumn];
} }
} }
@ -773,7 +778,7 @@ static NSImage *unexpandable = nil;
{ {
// Since we only have one version.... // Since we only have one version....
self = [super initWithCoder: aDecoder]; self = [super initWithCoder: aDecoder];
if([aDecoder allowsKeyedCoding]) if ([aDecoder allowsKeyedCoding])
{ {
_itemDict = NSCreateMapTable(NSObjectMapKeyCallBacks, _itemDict = NSCreateMapTable(NSObjectMapKeyCallBacks,
NSObjectMapValueCallBacks, NSObjectMapValueCallBacks,
@ -792,17 +797,21 @@ static NSImage *unexpandable = nil;
_autosaveExpandedItems = NO; _autosaveExpandedItems = NO;
// init the table column... (this can't be chosen on IB either)... // init the table column... (this can't be chosen on IB either)...
if([_tableColumns count] > 0) if ([_tableColumns count] > 0)
{ {
_outlineTableColumn = [_tableColumns objectAtIndex: 0]; _outlineTableColumn = [_tableColumns objectAtIndex: 0];
} }
} }
else else
{ {
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_autoResizesOutlineColumn]; [aDecoder decodeValueOfObjCType: @encode(BOOL)
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_indentationMarkerFollowsCell]; at: &_autoResizesOutlineColumn];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_autosaveExpandedItems]; [aDecoder decodeValueOfObjCType: @encode(BOOL)
[aDecoder decodeValueOfObjCType: @encode(float) at: &_indentationPerLevel]; at: &_indentationMarkerFollowsCell];
[aDecoder decodeValueOfObjCType: @encode(BOOL)
at: &_autosaveExpandedItems];
[aDecoder decodeValueOfObjCType: @encode(float)
at: &_indentationPerLevel];
_outlineTableColumn = [aDecoder decodeObject]; _outlineTableColumn = [aDecoder decodeObject];
_itemDict = NSCreateMapTable(NSObjectMapKeyCallBacks, _itemDict = NSCreateMapTable(NSObjectMapKeyCallBacks,
@ -987,8 +996,10 @@ static NSImage *unexpandable = nil;
imageRect.size.width = [image size].width; imageRect.size.width = [image size].width;
imageRect.size.height = [image size].height; imageRect.size.height = [image size].height;
[imageCell drawWithFrame: imageRect inView: self]; [imageCell drawWithFrame: imageRect inView: self];
drawingRect.origin.x += indentationFactor + [image size].width + 5; drawingRect.origin.x
drawingRect.size.width -= indentationFactor + [image size].width + 5; += indentationFactor + [image size].width + 5;
drawingRect.size.width
-= indentationFactor + [image size].width + 5;
} }
else else
{ {
@ -1554,9 +1565,10 @@ static NSImage *unexpandable = nil;
- (BOOL) _shouldSelectTableColumn: (NSTableColumn *)tableColumn - (BOOL) _shouldSelectTableColumn: (NSTableColumn *)tableColumn
{ {
if ([_delegate respondsToSelector: if ([_delegate respondsToSelector:
@selector (outlineView:shouldSelectTableColumn:)] == YES) @selector (outlineView:shouldSelectTableColumn:)] == YES)
{ {
if ([_delegate outlineView: self shouldSelectTableColumn: tableColumn] == NO) if ([_delegate outlineView: self shouldSelectTableColumn: tableColumn]
== NO)
{ {
return NO; return NO;
} }
@ -1570,7 +1582,7 @@ static NSImage *unexpandable = nil;
id item = [self itemAtRow: rowIndex]; id item = [self itemAtRow: rowIndex];
if ([_delegate respondsToSelector: if ([_delegate respondsToSelector:
@selector (outlineView:shouldSelectItem:)] == YES) @selector (outlineView:shouldSelectItem:)] == YES)
{ {
if ([_delegate outlineView: self shouldSelectItem: item] == NO) if ([_delegate outlineView: self shouldSelectItem: item] == NO)
{ {
@ -1584,7 +1596,7 @@ static NSImage *unexpandable = nil;
- (BOOL) _shouldSelectionChange - (BOOL) _shouldSelectionChange
{ {
if ([_delegate respondsToSelector: if ([_delegate respondsToSelector:
@selector (selectionShouldChangeInTableView:)] == YES) @selector (selectionShouldChangeInTableView:)] == YES)
{ {
if ([_delegate selectionShouldChangeInTableView: self] == NO) if ([_delegate selectionShouldChangeInTableView: self] == NO)
{ {
@ -1599,7 +1611,7 @@ static NSImage *unexpandable = nil;
row: (int) rowIndex row: (int) rowIndex
{ {
if ([_delegate respondsToSelector: if ([_delegate respondsToSelector:
@selector(outlineView:shouldEditTableColumn:item:)]) @selector(outlineView:shouldEditTableColumn:item:)])
{ {
id item = [self itemAtRow: rowIndex]; id item = [self itemAtRow: rowIndex];
@ -1633,14 +1645,12 @@ static NSImage *unexpandable = nil;
{ {
int count = [rows count]; int count = [rows count];
int i; int i;
NSMutableArray *itemArray = [NSMutableArray NSMutableArray *itemArray = [NSMutableArray arrayWithCapacity: count];
arrayWithCapacity: count];
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
[itemArray addObject: [itemArray addObject:
[self itemAtRow: [self itemAtRow: [[rows objectAtIndex: i] intValue]]];
[[rows objectAtIndex: i] intValue]]];
} }
if ([_dataSource respondsToSelector: if ([_dataSource respondsToSelector:
@ -1665,7 +1675,7 @@ static NSImage *unexpandable = nil;
id result = nil; id result = nil;
if ([_dataSource respondsToSelector: if ([_dataSource respondsToSelector:
@selector(outlineView:objectValueForTableColumn:byItem:)]) @selector(outlineView:objectValueForTableColumn:byItem:)])
{ {
id item = [self itemAtRow: index]; id item = [self itemAtRow: index];
@ -1682,7 +1692,7 @@ static NSImage *unexpandable = nil;
row: (int) index row: (int) index
{ {
if ([_dataSource respondsToSelector: if ([_dataSource respondsToSelector:
@selector(outlineView:setObjectValue:forTableColumn:byItem:)]) @selector(outlineView:setObjectValue:forTableColumn:byItem:)])
{ {
id item = [self itemAtRow: index]; id item = [self itemAtRow: index];
@ -1721,8 +1731,8 @@ static NSImage *unexpandable = nil;
NSString *tableKey; NSString *tableKey;
defaults = [NSUserDefaults standardUserDefaults]; defaults = [NSUserDefaults standardUserDefaults];
tableKey = [NSString stringWithFormat: @"NSOutlineView Expanded Items %@", tableKey = [NSString stringWithFormat: @"NSOutlineView Expanded Items %@",
_autosaveName]; _autosaveName];
config = [defaults objectForKey: tableKey]; config = [defaults objectForKey: tableKey];
if (config != nil) if (config != nil)
{ {
@ -1743,7 +1753,7 @@ static NSImage *unexpandable = nil;
{ {
int num; int num;
int i; int i;
id sitem = (startitem == nil)?[NSNull null]:startitem; id sitem = (startitem == nil) ? (id)[NSNull null] : (id)startitem;
NSMutableArray *anarray; NSMutableArray *anarray;
anarray = NSMapGet(_itemDict, sitem); anarray = NSMapGet(_itemDict, sitem);
@ -1769,7 +1779,7 @@ static NSImage *unexpandable = nil;
int num = [_dataSource outlineView: self int num = [_dataSource outlineView: self
numberOfChildrenOfItem: startitem]; numberOfChildrenOfItem: startitem];
int i = 0; int i = 0;
id sitem = (startitem == nil)?[NSNull null]:startitem; id sitem = (startitem == nil) ? (id)[NSNull null] : (id)startitem;
NSMutableArray *anarray = nil; NSMutableArray *anarray = nil;
if (num > 0) if (num > 0)
@ -1822,7 +1832,7 @@ static NSImage *unexpandable = nil;
int i = 0; int i = 0;
int insertionPoint = 0; int insertionPoint = 0;
id object = nil; id object = nil;
id sitem = (item == nil)?[NSNull null]:item; id sitem = (item == nil) ? (id)[NSNull null] : (id)item;
object = NSMapGet(_itemDict, sitem); object = NSMapGet(_itemDict, sitem);
numchildren = [object count]; numchildren = [object count];
@ -1872,7 +1882,7 @@ static NSImage *unexpandable = nil;
{ {
int numchildren = 0; int numchildren = 0;
int i = 0; int i = 0;
id sitem = (startitem == nil)?[NSNull null]:startitem; id sitem = (startitem == nil) ? (id)[NSNull null] : (id)startitem;
NSMutableArray *anarray; NSMutableArray *anarray;
anarray = NSMapGet(_itemDict, sitem); anarray = NSMapGet(_itemDict, sitem);

View file

@ -529,8 +529,7 @@ enum {
{ {
RELEASE(customPapers); RELEASE(customPapers);
RELEASE(measurementString); RELEASE(measurementString);
[super dealloc];
[super release];
} }

View file

@ -536,6 +536,7 @@
#include <Foundation/NSInvocation.h> #include <Foundation/NSInvocation.h>
#include <Foundation/NSLock.h> #include <Foundation/NSLock.h>
#include <Foundation/NSPathUtilities.h> #include <Foundation/NSPathUtilities.h>
#include <Foundation/NSPortCoder.h>
#include <Foundation/NSPortNameServer.h> #include <Foundation/NSPortNameServer.h>
#include <Foundation/NSProcessInfo.h> #include <Foundation/NSProcessInfo.h>
#include <Foundation/NSSerialization.h> #include <Foundation/NSSerialization.h>

View file

@ -306,8 +306,7 @@ static NSPrintPanel *shared_instance;
} }
else else
{ {
NSLog(@"Print panel buttonAction: from unknown sender - x%x\n", NSLog(@"Print panel buttonAction: from unknown sender - x%p\n", sender);
(unsigned)sender);
} }
[NSApp stopModalWithCode: _picked]; [NSApp stopModalWithCode: _picked];
} }

View file

@ -78,24 +78,23 @@ GSSpellServerName(NSString *vendor, NSString *language)
NSArray *userLanguages = [NSUserDefaults userLanguages]; NSArray *userLanguages = [NSUserDefaults userLanguages];
NSString *currentLanguage = [userLanguages objectAtIndex: 0]; NSString *currentLanguage = [userLanguages objectAtIndex: 0];
[super init]; if ((self = [super init]) != nil)
{
_delegate = nil; _delegate = nil;
_ignoredWords = nil; _ignoredWords = nil;
ASSIGN(_userDictionaries, [NSMutableDictionary dictionary]); ASSIGN(_userDictionaries, [NSMutableDictionary dictionary]);
ASSIGN(_currentLanguage, currentLanguage); ASSIGN(_currentLanguage, currentLanguage);
}
RETAIN(_userDictionaries);
RETAIN(_currentLanguage);
return self; return self;
} }
// Cleanup when deallocated // Cleanup when deallocated
- (void)dealloc - (void) dealloc
{ {
RELEASE(_userDictionaries); RELEASE(_userDictionaries);
RELEASE(_currentLanguage); RELEASE(_currentLanguage);
[super dealloc];
} }
// Checking in Your Service // Checking in Your Service

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
@ -151,13 +151,17 @@ Interface for a bunch of internal methods that need to be cleaned up.
{ {
if ([aDecoder allowsKeyedCoding]) if ([aDecoder allowsKeyedCoding])
{ {
ASSIGN(backgroundColor, [aDecoder decodeObjectForKey: @"NSBackgroundColor"]); ASSIGN(backgroundColor,
ASSIGN(paragraphStyle, [aDecoder decodeObjectForKey: @"NSDefaultParagraphStyle"]); [aDecoder decodeObjectForKey: @"NSBackgroundColor"]);
ASSIGN(paragraphStyle,
[aDecoder decodeObjectForKey: @"NSDefaultParagraphStyle"]);
flags = [aDecoder decodeIntForKey: @"NSFlags"]; flags = [aDecoder decodeIntForKey: @"NSFlags"];
ASSIGN(insertionColor, [aDecoder decodeObjectForKey: @"NSInsertionColor"]); ASSIGN(insertionColor,
[aDecoder decodeObjectForKey: @"NSInsertionColor"]);
ASSIGN(linkAttr, [aDecoder decodeObjectForKey: @"NSLinkAttributes"]); ASSIGN(linkAttr, [aDecoder decodeObjectForKey: @"NSLinkAttributes"]);
ASSIGN(markAttr, [aDecoder decodeObjectForKey: @"NSMarkedAttributes"]); ASSIGN(markAttr, [aDecoder decodeObjectForKey: @"NSMarkedAttributes"]);
ASSIGN(selectedAttr, [aDecoder decodeObjectForKey: @"NSSelectedAttributes"]); ASSIGN(selectedAttr,
[aDecoder decodeObjectForKey: @"NSSelectedAttributes"]);
} }
return self; return self;
@ -273,7 +277,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;
@ -334,7 +338,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;
@ -378,7 +382,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;
@ -408,7 +412,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 */
@ -418,7 +422,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
@ -532,7 +536,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;
@ -564,7 +568,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];
@ -611,7 +615,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;
@ -641,7 +645,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];
@ -689,7 +693,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];
if ([aDecoder allowsKeyedCoding]) if ([aDecoder allowsKeyedCoding])
@ -718,9 +722,10 @@ that makes decoding and encoding compatible with the old code.
if ([aDecoder containsValueForKey: @"NSSharedData"]) if ([aDecoder containsValueForKey: @"NSSharedData"])
{ {
NSTextViewSharedData *shared = [aDecoder decodeObjectForKey: @"NSSharedData"]; NSTextViewSharedData *shared;
unsigned int flags = [shared flags]; unsigned int flags = [shared flags];
shared = [aDecoder decodeObjectForKey: @"NSSharedData"];
ASSIGN(_insertionPointColor, [shared insertionColor]); ASSIGN(_insertionPointColor, [shared insertionColor]);
ASSIGN(_backgroundColor, [shared backgroundColor]); ASSIGN(_backgroundColor, [shared backgroundColor]);
@ -763,8 +768,7 @@ that makes decoding and encoding compatible with the old code.
if ([aDecoder containsValueForKey: @"NSTVFlags"]) if ([aDecoder containsValueForKey: @"NSTVFlags"])
{ {
//int vFlags = [aDecoder decodeIntForKey: @"NSTVFlags"]; [aDecoder decodeIntForKey: @"NSTVFlags"];
// these flags are not used...
} }
// register for services and subscribe to notifications. // register for services and subscribe to notifications.
@ -864,7 +868,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)
{ {
@ -911,7 +915,6 @@ that makes decoding and encoding compatible with the old code.
[super dealloc]; [super dealloc];
} }
/**** Managing the text network ****/ /**** Managing the text network ****/
/* This should only be called by [NSTextContainer -setTextView:]. If the /* This should only be called by [NSTextContainer -setTextView:]. If the
@ -926,7 +929,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;
@ -990,22 +993,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;
} }
@ -1046,12 +1049,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))
@ -1105,12 +1108,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;
} }
-(void) setEditable: (BOOL)flag - (void) setEditable: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
_tf.is_editable = flag; _tf.is_editable = flag;
@ -1132,12 +1135,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;
} }
-(void) setSelectable: (BOOL)flag - (void) setSelectable: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
_tf.is_selectable = flag; _tf.is_selectable = flag;
@ -1151,12 +1154,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;
} }
-(void) setFieldEditor: (BOOL)flag - (void) setFieldEditor: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
[self setHorizontallyResizable: NO]; /* TODO: why? */ [self setHorizontallyResizable: NO]; /* TODO: why? */
@ -1168,12 +1171,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;
} }
-(void) setRichText: (BOOL)flag - (void) setRichText: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
_tf.is_rich_text = flag; _tf.is_rich_text = flag;
@ -1189,12 +1192,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;
} }
-(void) setImportsGraphics: (BOOL)flag - (void) setImportsGraphics: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
_tf.imports_graphics = flag; _tf.imports_graphics = flag;
@ -1208,13 +1211,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;
} }
/* 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;
@ -1223,12 +1226,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;
} }
-(void) setRulerVisible: (BOOL)flag - (void) setRulerVisible: (BOOL)flag
{ {
NSScrollView *sv; NSScrollView *sv;
@ -1245,12 +1248,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;
} }
-(void) setUsesFontPanel: (BOOL)flag - (void) setUsesFontPanel: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
_tf.uses_font_panel = flag; _tf.uses_font_panel = flag;
@ -1259,12 +1262,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;
} }
-(void) setSmartInsertDeleteEnabled: (BOOL)flag - (void) setSmartInsertDeleteEnabled: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
_tf.smart_insert_delete = flag; _tf.smart_insert_delete = flag;
@ -1273,12 +1276,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;
} }
-(void) setAllowsUndo: (BOOL)flag - (void) setAllowsUndo: (BOOL)flag
{ {
NSTEXTVIEW_SYNC; NSTEXTVIEW_SYNC;
_tf.allows_undo = flag; _tf.allows_undo = flag;
@ -1288,14 +1291,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");
@ -1309,12 +1312,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
@ -1324,12 +1327,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;
} }
-(BOOL) acceptsFirstResponder - (BOOL) acceptsFirstResponder
{ {
if (_tf.is_selectable) if (_tf.is_selectable)
{ {
@ -1341,7 +1344,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
@ -1413,7 +1416,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)
{ {
@ -1432,7 +1435,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])
{ {
@ -1440,7 +1443,7 @@ started (in another text view attached to the same layout manager). */
} }
} }
-(void) becomeKeyWindow - (void) becomeKeyWindow
{ {
if ([self shouldDrawInsertionPoint]) if ([self shouldDrawInsertionPoint])
{ {
@ -1451,17 +1454,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;
} }
-(void) setBackgroundColor: (NSColor *)color - (void) setBackgroundColor: (NSColor *)color
{ {
if (![_backgroundColor isEqual: color]) if (![_backgroundColor isEqual: color])
{ {
@ -1470,7 +1473,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)
{ {
@ -1480,34 +1483,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;
} }
@ -1539,49 +1542,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;
} }
-(BOOL) isVerticallyResizable - (BOOL) isVerticallyResizable
{ {
return _tf.is_vertically_resizable; return _tf.is_vertically_resizable;
} }
-(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;
@ -1619,7 +1622,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;
@ -1670,7 +1673,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];
@ -1680,12 +1683,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;
} }
@ -1696,7 +1699,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;
@ -1715,7 +1718,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;
@ -1728,7 +1731,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;
@ -1750,35 +1753,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: (id)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
@ -1795,7 +1798,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)
{ {
@ -1826,7 +1829,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;
@ -1950,7 +1953,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? */
@ -1981,7 +1984,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;
@ -1993,7 +1996,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;
@ -2004,7 +2007,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;
@ -2025,7 +2028,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)
@ -2076,28 +2079,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)
{ {
@ -2118,13 +2121,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)
{ {
@ -2145,7 +2148,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];
@ -2162,7 +2165,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];
@ -2171,7 +2174,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];
@ -2180,12 +2183,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];
@ -2193,7 +2196,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];
@ -2201,13 +2204,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];
@ -2270,7 +2273,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)
@ -2307,7 +2310,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
@ -2334,7 +2337,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)
{ {
@ -2351,7 +2354,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)
{ {
@ -2369,7 +2372,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)
{ {
@ -2386,7 +2389,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;
@ -2531,10 +2534,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
{ {
} }
@ -2761,27 +2764,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
@ -3360,7 +3363,7 @@ Figure out how the additional layout stuff is supposed to work.
- (void) rulerView: (NSRulerView *)ruler - (void) rulerView: (NSRulerView *)ruler
didMoveMarker: (NSRulerMarker *)marker didMoveMarker: (NSRulerMarker *)marker
{ {
NSTextTab *old_tab = (NSTextTab *)[marker representedObject]; NSTextTab *old_tab = (NSTextTab*)[marker representedObject];
NSTextTab *new_tab = [[NSTextTab alloc] initWithType: [old_tab tabStopType] NSTextTab *new_tab = [[NSTextTab alloc] initWithType: [old_tab tabStopType]
location: [marker markerLocation]]; location: [marker markerLocation]];
NSRange range = [self rangeForUserParagraphAttributeChange]; NSRange range = [self rangeForUserParagraphAttributeChange];
@ -3721,7 +3724,7 @@ shouldRemoveMarker: (NSRulerMarker *)marker
} }
-(int) spellCheckerDocumentTag - (int) spellCheckerDocumentTag
{ {
if (!_spellCheckerDocumentTag) if (!_spellCheckerDocumentTag)
_spellCheckerDocumentTag = [NSSpellChecker uniqueSpellDocumentTag]; _spellCheckerDocumentTag = [NSSpellChecker uniqueSpellDocumentTag];
@ -4290,7 +4293,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;
@ -4544,7 +4547,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)
@ -4559,7 +4562,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

@ -536,7 +536,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
NSAttributedString *attrString; NSAttributedString *attrString;
NSDictionary *attr; NSDictionary *attr;
NSColor *color; NSColor *color;
NSMutableParagraphStyle *pStyle = [NSMutableParagraphStyle defaultParagraphStyle]; NSMutableParagraphStyle *pStyle;
NSRect titleRect; NSRect titleRect;
NSRect viewBounds = [self bounds]; NSRect viewBounds = [self bounds];
@ -549,12 +549,15 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
color = [NSColor disabledControlTextColor]; color = [NSColor disabledControlTextColor];
} }
pStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
[pStyle setAlignment: NSCenterTextAlignment]; [pStyle setAlignment: NSCenterTextAlignment];
// We draw the label // We draw the label
attr = [NSDictionary dictionaryWithObjectsAndKeys: _font, attr = [NSDictionary dictionaryWithObjectsAndKeys: _font,
NSFontAttributeName, color, NSForegroundColorAttributeName, pStyle, NSFontAttributeName, color, NSForegroundColorAttributeName, pStyle,
NSParagraphStyleAttributeName, nil]; NSParagraphStyleAttributeName, nil];
RELEASE(pStyle);
attrString = [[NSAttributedString alloc] attrString = [[NSAttributedString alloc]
initWithString: [_toolbarItem label] attributes: attr]; initWithString: [_toolbarItem label] attributes: attr];

View file

@ -1236,9 +1236,11 @@ many times.
ASSIGN(_miniaturizedImage, image); ASSIGN(_miniaturizedImage, image);
if (_counterpart != 0 && (_styleMask & NSMiniWindowMask) == 0) if (_counterpart != 0 && (_styleMask & NSMiniWindowMask) == 0)
{ {
NSMiniWindow *mini = [NSApp windowWithWindowNumber: _counterpart]; NSMiniWindow *mini;
id v = [mini contentView]; id v;
mini = (NSMiniWindow*)[NSApp windowWithWindowNumber: _counterpart];
v = [mini contentView];
if ([v respondsToSelector: @selector(setImage:)]) if ([v respondsToSelector: @selector(setImage:)])
{ {
[v setImage: [self miniwindowImage]]; [v setImage: [self miniwindowImage]];
@ -1251,9 +1253,11 @@ many times.
ASSIGN(_miniaturizedTitle, title); ASSIGN(_miniaturizedTitle, title);
if (_counterpart != 0 && (_styleMask & NSMiniWindowMask) == 0) if (_counterpart != 0 && (_styleMask & NSMiniWindowMask) == 0)
{ {
NSMiniWindow *mini = [NSApp windowWithWindowNumber: _counterpart]; NSMiniWindow *mini;
id v = [mini contentView]; id v;
mini = (NSMiniWindow*)[NSApp windowWithWindowNumber: _counterpart];
v = [mini contentView];
if ([v respondsToSelector: @selector(setTitle:)]) if ([v respondsToSelector: @selector(setTitle:)])
{ {
[v setTitle: [self miniwindowTitle]]; [v setTitle: [self miniwindowTitle]];

View file

@ -191,7 +191,7 @@
if ([self isWindowLoaded]) if ([self isWindowLoaded])
{ {
[[self window] setFrameAutosaveName: name ? name : @""]; [[self window] setFrameAutosaveName: name ? (id)name : (id)@""];
} }
} }

View file

@ -607,6 +607,7 @@ static NSString *_rootPath = @"/";
{ {
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"Attempt to call dealloc for shared worksapace"]; format: @"Attempt to call dealloc for shared worksapace"];
GSNOSUPERDEALLOC;
} }
- (id) init - (id) init
@ -1938,7 +1939,7 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
} }
else else
{ {
[inf setObject: appName forKey: (role ? role : @"Editor")]; [inf setObject: appName forKey: (role ? (id)role : (id)@"Editor")];
} }
[map setObject: inf forKey: ext]; [map setObject: inf forKey: ext];
RELEASE(inf); RELEASE(inf);

View file

@ -99,12 +99,12 @@ findMisspelledWordInString:(NSString *)stringToCheck
inLanguage:(NSString *)language inLanguage:(NSString *)language
{ {
NSMutableArray *array = [NSMutableArray array]; NSMutableArray *array = [NSMutableArray array];
const char *p = [word UTF8String];
int len = strlen(p);
int words = 0;
#ifdef HAVE_ASPELL_H #ifdef HAVE_ASPELL_H
{ {
const char *p = [word UTF8String];
int len = strlen(p);
int words = 0;
const struct AspellWordList *list = aspell_speller_suggest(speller, p, len); const struct AspellWordList *list = aspell_speller_suggest(speller, p, len);
AspellStringEnumeration *en; AspellStringEnumeration *en;