From 8b0730a3035e86af8d812efb99b2998c12db3b7d Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 21 Jan 2005 20:39:18 +0000 Subject: [PATCH] 2005-01-21 21:43 Alexander Malmberg Various whitespace cleanups, comment type fixes, and changes to avoid warnings from recent versions of gcc. * Headers/Additions/GNUstepGUI/GSToolbar.h (-_toolbars): Declare. * Source/NSWindow+Toolbar.m: Remove conflicting declaration of [NSToolbar -_toolbars]. * Headers/Additions/GNUstepGUI/GSServicesManager.h, Source/GSServicesMananger.m (-item2title:, -validateMenuItem:): Adjust argument types. * Headers/AppKit/NSMenu.h (-validateMenuItem:): Adjust argument type. * Source/NSTextView.m (-sizeToFit): Don't use size uninitialized if neither resizable flags is set. (-insertText:): Adjust argument type. * Headers/AppKit/NSResponder.h, Source/NSResponder.m (-insertText:): Adjust argument type. Document. * Headers/AppKit/NSView.h: Change type of ivar _window to NSWindow *. * Source/GSTitleView.m (-mouseDown:): Always initialize startWindowOrigin. * Source/NSApplication.m (-setApplicationIconImage:): Add casts to avoid warnings. * Source/NSCell.m (-cellSize): Add default: case. * Source/NSPasteboard.m ([GSFiltered -pasteboard:provideDataForType:]): Detect and warn if we can't find a filter that will get us the desired type. * Source/NSProgressIndicator.m: Comment out unused variable 'images'. * Source/NSBezierPath.m: Declare GSBezierPath fully before using it. (-bezierPathByFlatteningPath, -bezierPathByReversingPath): Make sure variables are always initialized. * Source/NSMenuView.m, * Source/NSPrintOperation.m, * Source/NSSplitView.m, * Source/NSTableHeaderView.m: Make sure variables are always initialized. * Source/NSBox.m, * Source/NSImageview.m, * Source/NSText.m, * Source/NSTextStorage.m: Add missing includes. * Source/GSKeyBindingTable.m, * Source/GSLayoutManager.m, * Source/NSBitmapImageRep+PNM.m, * Source/NSBundleAdditions.m, * Source/NSLayoutManager.m, * Source/nsimage-tiff.h, * Source/tiff.m, * Headers/Additions/GNUstepGUI/GSDisplayServer.h, * Source/GSDisplayServer.m: Change signedness of various variables. * Source/NSPanel.m (-sendEvent:): Remove. * Source/NSWindow.m (-becomesKeyOnlyIfNeeded): New method. (-_sendEvent:becomesKeyOnlyIfNeeded:): Remove. Move code ... (-sendEvent:): ... here. Use -becomesKeyOnlyIfNeeded instead of the argument. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20590 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 63 ++++++++++++++++++ .../Additions/GNUstepGUI/GSDisplayServer.h | 3 +- .../Additions/GNUstepGUI/GSServicesManager.h | 5 +- Headers/Additions/GNUstepGUI/GSToolbar.h | 5 ++ Headers/AppKit/NSEvent.h | 10 +-- Headers/AppKit/NSMenu.h | 2 +- Headers/AppKit/NSResponder.h | 15 ++++- Headers/AppKit/NSView.h | 2 +- Source/GSDisplayServer.m | 2 +- Source/GSKeyBindingTable.m | 2 +- Source/GSLayoutManager.m | 6 +- Source/GSServicesManager.m | 4 +- Source/GSTitleView.m | 5 +- Source/NSApplication.m | 2 +- Source/NSBezierPath.m | 66 ++++++++++--------- Source/NSBitmapImageRep+PNM.m | 3 +- Source/NSBox.m | 1 + Source/NSBundleAdditions.m | 2 +- Source/NSCell.m | 1 + Source/NSImageView.m | 1 + Source/NSLayoutManager.m | 8 +-- Source/NSMenuView.m | 2 +- Source/NSPanel.m | 8 +-- Source/NSPasteboard.m | 6 ++ Source/NSPrintOperation.m | 6 +- Source/NSProgressIndicator.m | 2 +- Source/NSResponder.m | 2 +- Source/NSSlider.m | 2 +- Source/NSSpellChecker.m | 2 +- Source/NSSplitView.m | 4 ++ Source/NSTableHeaderView.m | 2 +- Source/NSText.m | 6 +- Source/NSTextStorage.m | 3 +- Source/NSTextView.m | 27 ++++---- Source/NSWindow+Toolbar.m | 1 - Source/NSWindow.m | 26 ++++---- Source/nsimage-tiff.h | 4 +- Source/tiff.m | 4 +- 38 files changed, 199 insertions(+), 116 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4a3b63f63..81a84fd06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,66 @@ +2005-01-21 21:43 Alexander Malmberg + + Various whitespace cleanups, comment type fixes, and changes + to avoid warnings from recent versions of gcc. + + * Headers/Additions/GNUstepGUI/GSToolbar.h (-_toolbars): Declare. + * Source/NSWindow+Toolbar.m: Remove conflicting declaration of + [NSToolbar -_toolbars]. + + * Headers/Additions/GNUstepGUI/GSServicesManager.h, + Source/GSServicesMananger.m (-item2title:, -validateMenuItem:): + Adjust argument types. + * Headers/AppKit/NSMenu.h (-validateMenuItem:): Adjust argument + type. + + * Source/NSTextView.m (-sizeToFit): Don't use size uninitialized + if neither resizable flags is set. + (-insertText:): Adjust argument type. + * Headers/AppKit/NSResponder.h, Source/NSResponder.m (-insertText:): + Adjust argument type. Document. + + * Headers/AppKit/NSView.h: Change type of ivar _window to NSWindow *. + + * Source/GSTitleView.m (-mouseDown:): Always initialize + startWindowOrigin. + * Source/NSApplication.m (-setApplicationIconImage:): Add casts + to avoid warnings. + * Source/NSCell.m (-cellSize): Add default: case. + * Source/NSPasteboard.m + ([GSFiltered -pasteboard:provideDataForType:]): Detect and warn if we + can't find a filter that will get us the desired type. + * Source/NSProgressIndicator.m: Comment out unused variable 'images'. + * Source/NSBezierPath.m: Declare GSBezierPath fully before using it. + (-bezierPathByFlatteningPath, -bezierPathByReversingPath): Make sure + variables are always initialized. + + * Source/NSMenuView.m, + * Source/NSPrintOperation.m, + * Source/NSSplitView.m, + * Source/NSTableHeaderView.m: Make sure variables are always + initialized. + + * Source/NSBox.m, + * Source/NSImageview.m, + * Source/NSText.m, + * Source/NSTextStorage.m: Add missing includes. + + * Source/GSKeyBindingTable.m, + * Source/GSLayoutManager.m, + * Source/NSBitmapImageRep+PNM.m, + * Source/NSBundleAdditions.m, + * Source/NSLayoutManager.m, + * Source/nsimage-tiff.h, + * Source/tiff.m, + * Headers/Additions/GNUstepGUI/GSDisplayServer.h, + * Source/GSDisplayServer.m: Change signedness of various variables. + + * Source/NSPanel.m (-sendEvent:): Remove. + * Source/NSWindow.m (-becomesKeyOnlyIfNeeded): New method. + (-_sendEvent:becomesKeyOnlyIfNeeded:): Remove. Move code ... + (-sendEvent:): ... here. Use -becomesKeyOnlyIfNeeded instead + of the argument. + 2005-01-21 Quentin Mathe * Source/GSToolbarView.m: diff --git a/Headers/Additions/GNUstepGUI/GSDisplayServer.h b/Headers/Additions/GNUstepGUI/GSDisplayServer.h index 1eafeea4b..46e92cf32 100644 --- a/Headers/Additions/GNUstepGUI/GSDisplayServer.h +++ b/Headers/Additions/GNUstepGUI/GSDisplayServer.h @@ -150,7 +150,8 @@ APPKIT_EXPORT NSString * GSScreenNumber; - (void) hidecursor; - (void) showcursor; - (void) standardcursor: (int) style : (void**) cid; -- (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int) colors : (const char*) image : (void**) cid; +- (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int) colors + : (const unsigned char *) image : (void**) cid; - (void) setcursorcolor: (NSColor *)fg : (NSColor *)bg : (void*) cid; @end diff --git a/Headers/Additions/GNUstepGUI/GSServicesManager.h b/Headers/Additions/GNUstepGUI/GSServicesManager.h index 80ee68c2e..d755fbaa0 100644 --- a/Headers/Additions/GNUstepGUI/GSServicesManager.h +++ b/Headers/Additions/GNUstepGUI/GSServicesManager.h @@ -39,6 +39,7 @@ @class NSMutableSet; @class NSString; @class NSTimer; +@protocol NSMenuItem; @interface GSServicesManager : NSObject { @@ -70,7 +71,7 @@ - (void) doService: (NSMenuItem*)item; - (NSArray*) filters; - (BOOL) hasRegisteredTypes: (NSDictionary*)service; -- (NSString*) item2title: (NSMenuItem*)item; +- (NSString*) item2title: (id)item; - (void) loadServices; - (NSDictionary*) menuServices; - (void) rebuildServices; @@ -84,7 +85,7 @@ - (void) setServicesProvider: (id)anObject; - (int) setShowsServicesMenuItem: (NSString*)item to: (BOOL)enable; - (BOOL) showsServicesMenuItem: (NSString*)item; -- (BOOL) validateMenuItem: (NSMenuItem*)item; +- (BOOL) validateMenuItem: (id)item; - (void) updateServicesMenu; @end diff --git a/Headers/Additions/GNUstepGUI/GSToolbar.h b/Headers/Additions/GNUstepGUI/GSToolbar.h index 55525676b..dfc07d581 100644 --- a/Headers/Additions/GNUstepGUI/GSToolbar.h +++ b/Headers/Additions/GNUstepGUI/GSToolbar.h @@ -112,6 +112,11 @@ APPKIT_EXPORT NSString *NSToolbarWillAddItemNotification; - (void) setUsesStandardBackgroundColor: (BOOL)standard; - (NSToolbarSizeMode) sizeMode; + +// Private class method + ++ (NSMutableArray *) _toolbars; + @end /* interface of NSToolbar */ /* diff --git a/Headers/AppKit/NSEvent.h b/Headers/AppKit/NSEvent.h index f60c507e7..e665dcfb7 100644 --- a/Headers/AppKit/NSEvent.h +++ b/Headers/AppKit/NSEvent.h @@ -192,14 +192,14 @@ enum { + (NSPoint)mouseLocation; -+ (NSEvent*) otherEventWithType: (NSEventType)type ++ (NSEvent*) otherEventWithType: (NSEventType)type location: (NSPoint)location modifierFlags: (unsigned int)flags timestamp: (NSTimeInterval)time - windowNumber: (int)windowNum - context: (NSGraphicsContext*)context - subtype: (short)subType - data1: (int)data1 + windowNumber: (int)windowNum + context: (NSGraphicsContext*)context + subtype: (short)subType + data1: (int)data1 data2: (int)data2; + (void) startPeriodicEventsAfterDelay: (NSTimeInterval)delaySeconds diff --git a/Headers/AppKit/NSMenu.h b/Headers/AppKit/NSMenu.h index 9304638b2..f01b2d985 100644 --- a/Headers/AppKit/NSMenu.h +++ b/Headers/AppKit/NSMenu.h @@ -564,7 +564,7 @@ The displayed menus on the screen have the following structure: #ifndef NO_GNUSTEP @interface NSObject (NSMenuActionResponder) -- (BOOL) validateMenuItem: (NSMenuItem*)aMenuItem; +- (BOOL) validateMenuItem: (id)aMenuItem; @end /** diff --git a/Headers/AppKit/NSResponder.h b/Headers/AppKit/NSResponder.h index 48d9fd3cb..948a7a75a 100644 --- a/Headers/AppKit/NSResponder.h +++ b/Headers/AppKit/NSResponder.h @@ -49,7 +49,7 @@ NSResponder *_next_responder; /* - Due to interface brain-damage, but NSResponder and NSMenuView have -menu + Due to interface brain-damage, both NSResponder and NSMenuView have -menu and -setMenu: methods, but for different menus. Thus, to prevent (future, there have already been some) problems and confusion, this ivar is private (iow, it can't be accidentally used in NSMenuView). @@ -144,7 +144,18 @@ - (BOOL) performMnemonic: (NSString*)aString; - (void) flushBufferedKeyEvents; - (void) doCommandBySelector: (SEL)aSelector; -- (void) insertText: (NSString*)aString; + +/**

Tells the receiver to insert the given string. In a text view + the text is typically inserted at the insertion point, and replaces + any selection. +

+ Subclasses should override this method. The implementation in + NSResponder just sends the message on to the next responder. +

+ Normally, aString will be an NSString, but in some cases, it might + be an NSAttributedString. +

*/ +- (void) insertText: (id)aString; - (NSUndoManager*) undoManager; /* diff --git a/Headers/AppKit/NSView.h b/Headers/AppKit/NSView.h index 468ce5563..c9778abd6 100644 --- a/Headers/AppKit/NSView.h +++ b/Headers/AppKit/NSView.h @@ -98,7 +98,7 @@ typedef enum _NSFocusRingType { NSView* _super_view; NSMutableArray *_sub_views; - id _window; + NSWindow *_window; NSMutableArray *_tracking_rects; NSMutableArray *_cursor_rects; NSRect _invalidRect; diff --git a/Source/GSDisplayServer.m b/Source/GSDisplayServer.m index 849e4462f..4d2112a16 100644 --- a/Source/GSDisplayServer.m +++ b/Source/GSDisplayServer.m @@ -767,7 +767,7 @@ GSCurrentServer(void) device representation that can be used later to make this cursor the current one */ - (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int) colors - : (const char*) image : (void**) cid + : (const unsigned char *) image : (void**) cid { [self subclassResponsibility: _cmd]; } diff --git a/Source/GSKeyBindingTable.m b/Source/GSKeyBindingTable.m index 7a49f4546..8158dbd2b 100644 --- a/Source/GSKeyBindingTable.m +++ b/Source/GSKeyBindingTable.m @@ -45,7 +45,7 @@ - (void) bindKey: (id)key toAction: (id)action { unichar character; - int modifiers; + unsigned int modifiers; GSKeyBindingAction *a = nil; GSKeyBindingTable *t = nil; BOOL isTable = NO; diff --git a/Source/GSLayoutManager.m b/Source/GSLayoutManager.m index f5d4442c9..6d92d4f07 100644 --- a/Source/GSLayoutManager.m +++ b/Source/GSLayoutManager.m @@ -691,7 +691,7 @@ not completely accurate). isValidIndex: (BOOL *)isValidIndex { glyph_run_t *r; - int pos; + unsigned int pos; *isValidIndex = NO; @@ -803,7 +803,7 @@ not completely accurate). - (unsigned int) characterIndexForGlyphAtIndex: (unsigned int)glyphIndex { glyph_run_t *r; - int pos, cpos; + unsigned int pos, cpos; if (glyphs->glyph_length <= glyphIndex) { @@ -1421,7 +1421,7 @@ places where we switch. #define GET_GLYPH \ glyph_run_t *r; \ - int pos, cpos; \ + unsigned int pos, cpos; \ \ if (glyphs->glyph_length <= idx) \ { \ diff --git a/Source/GSServicesManager.m b/Source/GSServicesManager.m index 918c6ae92..4fe26f265 100644 --- a/Source/GSServicesManager.m +++ b/Source/GSServicesManager.m @@ -672,7 +672,7 @@ static NSString *disabledName = @".GNUstepDisabled"; * contains the full title of the service. * Return nil if this is not one of our service menu items. */ -- (NSString*) item2title: (NSMenuItem*)item +- (NSString*) item2title: (id)item { unsigned pos; @@ -1132,7 +1132,7 @@ static NSString *disabledName = @".GNUstepDisabled"; return NO; } -- (BOOL) validateMenuItem: (NSMenuItem*)item +- (BOOL) validateMenuItem: (id)item { NSString *title = [self item2title: item]; NSDictionary *info = [_title2info objectForKey: title]; diff --git a/Source/GSTitleView.m b/Source/GSTitleView.m index 543061e27..02bd1d95f 100644 --- a/Source/GSTitleView.m +++ b/Source/GSTitleView.m @@ -281,10 +281,7 @@ NSDebugLLog (@"NSMenu", @"Mouse down in title!"); // Remember start position of window - if (_ownedByMenu) - { - startWindowOrigin = [_window frame].origin; - } + startWindowOrigin = [_window frame].origin; // Remember start location of cursor in window lastLocation = [theEvent locationInWindow]; diff --git a/Source/NSApplication.m b/Source/NSApplication.m index 88ad2d0aa..6ac6db686 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -1870,7 +1870,7 @@ image. if (_app_icon_window != nil) { - [[_app_icon_window contentView] setImage: anImage]; + [(NSAppIconView *)[_app_icon_window contentView] setImage: anImage]; } // Swap the old image for the new one wherever it's used diff --git a/Source/NSBezierPath.m b/Source/NSBezierPath.m index f0c6b4515..d8caefa6f 100644 --- a/Source/NSBezierPath.m +++ b/Source/NSBezierPath.m @@ -56,13 +56,36 @@ static NSLineCapStyle default_line_cap_style = NSButtLineCapStyle; static float default_miter_limit = 10.0; @interface NSBezierPath (PrivateMethods) - - (void)_invalidateCache; - (void)_recalculateBounds; - @end -@class GSBezierPath; + +typedef struct _PathElement +{ + NSBezierPathElement type; + NSPoint points[3]; +} PathElement; + +//#define GSUNION_TYPES GSUNION_OBJ +#define GSI_ARRAY_TYPES 0 +#define GSI_ARRAY_TYPE PathElement + +#define GSI_ARRAY_NO_RETAIN +#define GSI_ARRAY_NO_RELEASE + +#ifdef GSIArray +#undef GSIArray +#endif +#include + +@interface GSBezierPath : NSBezierPath +{ + GSIArray pathElements; + BOOL flat; +} +@end + @implementation NSBezierPath @@ -541,6 +564,10 @@ static float default_miter_limit = 10.0; int i, count; BOOL first = YES; + /* Silence compiler warnings. */ + p = NSZeroPoint; + last_p = NSZeroPoint; + count = [self elementCount]; for(i = 0; i < count; i++) { @@ -566,10 +593,10 @@ static float default_miter_limit = 10.0; coeff[1] = pts[0]; coeff[2] = pts[1]; coeff[3] = pts[2]; - flatten(coeff, [self flatness], path); + flatten(coeff, [self flatness], path); p = pts[2]; if (first) - { + { last_p = pts[2]; first = NO; } @@ -595,6 +622,9 @@ static float default_miter_limit = 10.0; int i, j, count; BOOL closed = NO; + /* Silence compiler warnings. */ + p = NSZeroPoint; + last_type = NSMoveToBezierPathElement; count = [self elementCount]; for(i = count - 1; i >= 0; i--) @@ -1778,32 +1808,6 @@ static NSPoint point_on_curve(double t, NSPoint a, NSPoint b, NSPoint c, @end -typedef struct _PathElement -{ - NSBezierPathElement type; - NSPoint points[3]; -} PathElement; - -//#define GSUNION_TYPES GSUNION_OBJ -#define GSI_ARRAY_TYPES 0 -#define GSI_ARRAY_TYPE PathElement - -#define GSI_ARRAY_NO_RETAIN -#define GSI_ARRAY_NO_RELEASE - -#ifdef GSIArray -#undef GSIArray -#endif -#include - -@interface GSBezierPath : NSBezierPath -{ - GSIArray pathElements; - BOOL flat; -} - -@end - @implementation GSBezierPath - (id)init diff --git a/Source/NSBitmapImageRep+PNM.m b/Source/NSBitmapImageRep+PNM.m index 36772bb8a..a9d178659 100644 --- a/Source/NSBitmapImageRep+PNM.m +++ b/Source/NSBitmapImageRep+PNM.m @@ -76,7 +76,8 @@ { int num, xsize, ysize, levels; char ptype; - char buffer[256], *pchar; + char buffer[256]; + unsigned char *pchar; unsigned length; id colorspace; const char *ptr; diff --git a/Source/NSBox.m b/Source/NSBox.m index ea5c6dcb7..9ee9dca64 100644 --- a/Source/NSBox.m +++ b/Source/NSBox.m @@ -36,6 +36,7 @@ #include "AppKit/NSColor.h" #include "AppKit/NSGraphics.h" #include "AppKit/NSTextFieldCell.h" +#include "AppKit/NSWindow.h" #include "GNUstepGUI/GSDrawFunctions.h" #include diff --git a/Source/NSBundleAdditions.m b/Source/NSBundleAdditions.m index 8ff99ebb5..e8c220b29 100644 --- a/Source/NSBundleAdditions.m +++ b/Source/NSBundleAdditions.m @@ -168,7 +168,7 @@ const char *nam = [_tag cString]; const char *type; unsigned int size; - unsigned int offset; + int offset; /* * Use the GNUstep additional function to set the instance diff --git a/Source/NSCell.m b/Source/NSCell.m index 31a812d3e..28ce1ea21 100644 --- a/Source/NSCell.m +++ b/Source/NSCell.m @@ -1556,6 +1556,7 @@ static NSColor *shadowCol; } break; + default: case NSNullCellType: // macosx instead returns a 'very big size' here; we return NSZeroSize s = NSZeroSize; diff --git a/Source/NSImageView.m b/Source/NSImageView.m index a26262917..2760c4ec7 100644 --- a/Source/NSImageView.m +++ b/Source/NSImageView.m @@ -30,6 +30,7 @@ #include "AppKit/NSImageCell.h" #include "AppKit/NSImageView.h" #include "AppKit/NSPasteboard.h" +#include "AppKit/NSWindow.h" /* * Class variables diff --git a/Source/NSLayoutManager.m b/Source/NSLayoutManager.m index ccea78c9d..a1411b9bd 100644 --- a/Source/NSLayoutManager.m +++ b/Source/NSLayoutManager.m @@ -419,7 +419,7 @@ container? necessary? */ { NSRect *r; NSRect result; - int i, c; + unsigned int i, c; /* TODO: This isn't correct. Need to handle glyphs that extend outside the line frag rect. */ @@ -1139,7 +1139,7 @@ container unsigned int glyph_pos, char_pos, first_char_pos; int i, j; NSRect *rects; - int count; + unsigned int count; NSColor *color, *last_color; NSGraphicsContext *ctxt = GSCurrentContext(); @@ -1303,7 +1303,7 @@ container #define GBUF_SIZE 16 /* TODO: tweak */ NSGlyph gbuf[GBUF_SIZE]; int gbuf_len, gbuf_size; - NSPoint gbuf_point; + NSPoint gbuf_point = NSZeroPoint; NSView *controlView = nil; @@ -2158,7 +2158,7 @@ no_soft_invalidation: { /* before before */ } - /* If there are text views attached to use, let them handle the + /* If there are text views attached to us, let them handle the change. */ if ([self firstTextView]) [[self firstTextView] setSelectedRange: newRange]; diff --git a/Source/NSMenuView.m b/Source/NSMenuView.m index c6058f8d8..5d3e57f64 100644 --- a/Source/NSMenuView.m +++ b/Source/NSMenuView.m @@ -1284,7 +1284,7 @@ _addLeftBorderOffsetToRect(NSRect aRect) NSRect currentFrame; NSRect originalFrame; NSPoint currentTopLeft; - NSPoint originalTopLeft; + NSPoint originalTopLeft = NSZeroPoint; /* Silence compiler. */ BOOL restorePosition; /* * Only for non transient menus do we want diff --git a/Source/NSPanel.m b/Source/NSPanel.m index 689fb4713..efcc2f1e3 100644 --- a/Source/NSPanel.m +++ b/Source/NSPanel.m @@ -164,11 +164,5 @@ return self; } - -- (void) sendEvent: (NSEvent*)theEvent -{ - [self _sendEvent: theEvent - becomesKeyOnlyIfNeeded: _becomesKeyOnlyIfNeeded]; -} - @end /* NSPanel */ + diff --git a/Source/NSPasteboard.m b/Source/NSPasteboard.m index f6ead75e5..a612eac9e 100644 --- a/Source/NSPasteboard.m +++ b/Source/NSPasteboard.m @@ -688,6 +688,7 @@ static NSString *namePrefix = @"NSTypedFilenamesPboardType:"; * Locate the filter information needed, including the type we are * converting from and the name of the filter to use. */ + info = nil; filters = [[GSServicesManager manager] filters]; count = [filters count]; while (fromType == nil && filterNumber < count) @@ -713,6 +714,11 @@ static NSString *namePrefix = @"NSTypedFilenamesPboardType:"; } } } + if (!info) + { + NSWarnMLog(@"Unable to provide data of type '%@'.", type); + return; + } } mechanism = [info objectForKey: @"NSInputMechanism"]; diff --git a/Source/NSPrintOperation.m b/Source/NSPrintOperation.m index 273a2eea9..6cca45904 100644 --- a/Source/NSPrintOperation.m +++ b/Source/NSPrintOperation.m @@ -94,8 +94,8 @@ typedef struct _page_info_t { xpage: (int *)xptr ypage: (int *)yptr; - (NSRect) _adjustPagesFirst: (int)first - last: (int)last - info: (page_info_t *)info; + last: (int)last + info: (page_info_t *)info; - (void) _print; @end @@ -832,7 +832,7 @@ scaleRect(NSRect rect, double scale) { int i, xpage, ypage; double hlimit, wlimit; - NSRect pageRect; + NSRect pageRect = NSZeroRect; /* Silence compiler warning. */ hlimit = [_view heightAdjustLimit]; wlimit = [_view widthAdjustLimit]; for (i = first; i <= last; i++) diff --git a/Source/NSProgressIndicator.m b/Source/NSProgressIndicator.m index 5b84290ca..c28631873 100644 --- a/Source/NSProgressIndicator.m +++ b/Source/NSProgressIndicator.m @@ -33,7 +33,7 @@ static NSColor *fillColour = nil; #define maxCount 1 -static NSImage *images[maxCount]; +//static NSImage *images[maxCount]; + (void) initialize { diff --git a/Source/NSResponder.m b/Source/NSResponder.m index 66a751e56..08517f4e9 100644 --- a/Source/NSResponder.m +++ b/Source/NSResponder.m @@ -156,7 +156,7 @@ } } -- (void) insertText: (NSString*)aString +- (void) insertText: (id)aString { if (_next_responder) [_next_responder insertText: aString]; diff --git a/Source/NSSlider.m b/Source/NSSlider.m index 5e6abea3a..70fe6e62e 100644 --- a/Source/NSSlider.m +++ b/Source/NSSlider.m @@ -32,7 +32,7 @@ #include "AppKit/NSWindow.h" #include "AppKit/NSApplication.h" -static inline +static inline float _floatValueForMousePoint (NSPoint point, NSRect knobRect, NSRect slotRect, BOOL isVertical, float minValue, float maxValue, diff --git a/Source/NSSpellChecker.m b/Source/NSSpellChecker.m index 211b952f4..b95017146 100644 --- a/Source/NSSpellChecker.m +++ b/Source/NSSpellChecker.m @@ -325,7 +325,7 @@ static int __documentTag = 0; ignoredWords: nil wordCount: &count countOnly: YES]; - + return count; } diff --git a/Source/NSSplitView.m b/Source/NSSplitView.m index eb8e7f9e7..770e9fc66 100644 --- a/Source/NSSplitView.m +++ b/Source/NSSplitView.m @@ -126,6 +126,10 @@ static NSNotificationCenter *nc = nil; return; } + /* Silence compiler warnings. */ + r1 = NSZeroRect; + bigRect = NSZeroRect; + vis = [self visibleRect]; /* find out which divider it is */ diff --git a/Source/NSTableHeaderView.m b/Source/NSTableHeaderView.m index 8b673b60e..829aeb891 100644 --- a/Source/NSTableHeaderView.m +++ b/Source/NSTableHeaderView.m @@ -547,7 +547,7 @@ NSDate *distantFuture = [NSDate distantFuture]; NSRect visibleRect = [self visibleRect]; NSRect tvRect; - NSRect highlightRect, oldRect; + NSRect highlightRect = NSZeroRect, oldRect = NSZeroRect; BOOL outside = NO; BOOL lit = NO; diff --git a/Source/NSText.m b/Source/NSText.m index 70fd70a1c..c384c0718 100644 --- a/Source/NSText.m +++ b/Source/NSText.m @@ -36,10 +36,10 @@ */ #include "AppKit/NSText.h" -//#include "AppKit/NSTextView.h" -@class NSTextView; -#include "AppKit/NSSpellChecker.h" + #include "AppKit/NSPanel.h" +#include "AppKit/NSSpellChecker.h" +#include "AppKit/NSTextView.h" static Class abstract; diff --git a/Source/NSTextStorage.m b/Source/NSTextStorage.m index 4bf6a7c14..d4311718c 100644 --- a/Source/NSTextStorage.m +++ b/Source/NSTextStorage.m @@ -29,11 +29,10 @@ #include "AppKit/NSAttributedString.h" #include "AppKit/NSTextStorage.h" #include "GNUstepGUI/GSLayoutManager.h" +#include "GSTextStorage.h" @implementation NSTextStorage -@class GSTextStorage; - static Class abstract; static Class concrete; diff --git a/Source/NSTextView.m b/Source/NSTextView.m index 00e5f5405..f17486044 100644 --- a/Source/NSTextView.m +++ b/Source/NSTextView.m @@ -674,7 +674,7 @@ that makes decoding and encoding compatible with the old code. if ([aDecoder containsValueForKey: @"NSTVFlags"]) { - int vFlags = [aDecoder decodeIntForKey: @"NSTVFlags"]; + //int vFlags = [aDecoder decodeIntForKey: @"NSTVFlags"]; // FIXME set the flags } if ([aDecoder containsValueForKey: @"NSSharedData"]) @@ -1492,26 +1492,25 @@ incorrectly. */ if (!_layoutManager) return; + size = _bounds.size; + if (_tf.is_horizontally_resizable || _tf.is_vertically_resizable) { NSRect r = [_layoutManager usedRectForTextContainer: _textContainer]; + NSSize s2; if (_textContainer == [_layoutManager extraLineFragmentTextContainer]) { r = NSUnionRect(r, [_layoutManager extraLineFragmentUsedRect]); } - size = NSMakeSize(NSMaxX(r), NSMaxY(r)); - } - - if (!_tf.is_horizontally_resizable) - size.width = _bounds.size.width; - else - size.width += 2 * _textContainerInset.width; + s2 = NSMakeSize(NSMaxX(r), NSMaxY(r)); - if (!_tf.is_vertically_resizable) - size.height = _bounds.size.height; - else - size.height += 2 * _textContainerInset.height; + if (_tf.is_horizontally_resizable) + size.width = s2.width + 2 * _textContainerInset.width; + + if (_tf.is_vertically_resizable) + size.height = s2.height + 2 * _textContainerInset.height; + } [self setConstrainedFrameSize: size]; } @@ -1728,11 +1727,11 @@ chain if we can't handle it. */ /* insertString may actually be an NSAttributedString. If it is, and the text view isn't rich-text, we ignore the attributes and use the typing -attributed. +attributes. This method is for user changes; see NSTextView_actions.m. */ --(void) insertText: (NSString *)insertString +-(void) insertText: (id)insertString { NSRange insertRange = [self rangeForUserTextChange]; NSString *string; diff --git a/Source/NSWindow+Toolbar.m b/Source/NSWindow+Toolbar.m index 6b84683f7..a7d94933c 100644 --- a/Source/NSWindow+Toolbar.m +++ b/Source/NSWindow+Toolbar.m @@ -35,7 +35,6 @@ @interface NSToolbar (GNUstepPrivate) -+ (NSArray *) _toolbars; - (GSToolbarView *) _toolbarView; - (void) _setWindow: (NSWindow *)window; - (NSWindow *) _window; diff --git a/Source/NSWindow.m b/Source/NSWindow.m index a75957ab5..654475c87 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -2915,11 +2915,15 @@ resetCursorRectsForView(NSView *theView) // Quietly discard an unused mouse down. } +- (BOOL) becomesKeyOnlyIfNeeded +{ + return NO; +} + /** Handles mouse and other events sent to the receiver by NSApplication. Do not invoke this method directly. */ -- (void) _sendEvent: (NSEvent*)theEvent - becomesKeyOnlyIfNeeded: (BOOL)becomesKeyOnlyIfNeeded +- (void) sendEvent: (NSEvent*)theEvent { NSView *v; NSEventType type; @@ -2955,7 +2959,8 @@ resetCursorRectsForView(NSView *theView) if (_f.is_key == NO && _windowLevel != NSDesktopWindowLevel) { /* NSPanel modification: check becomesKeyOnlyIfNeeded. */ - if (!becomesKeyOnlyIfNeeded || [v needsPanelToBecomeKey]) + if (![self becomesKeyOnlyIfNeeded] + || [v needsPanelToBecomeKey]) [self makeKeyAndOrderFront: self]; } /* Activate the app *after* making the receiver key, as app @@ -3035,13 +3040,13 @@ resetCursorRectsForView(NSView *theView) switch (type) { case NSLeftMouseDragged: - [_lastView mouseDragged: theEvent]; + [_lastView mouseDragged: theEvent]; break; case NSOtherMouseDragged: - [_lastView otherMouseDragged: theEvent]; + [_lastView otherMouseDragged: theEvent]; break; case NSRightMouseDragged: - [_lastView rightMouseDragged: theEvent]; + [_lastView rightMouseDragged: theEvent]; break; default: if (_f.accepts_mouse_moved) @@ -3417,15 +3422,6 @@ resetCursorRectsForView(NSView *theView) } } -/** Handles mouse and other events sent to the receiver by NSApplication. - Do not invoke this method directly. -*/ -- (void) sendEvent: (NSEvent*)theEvent -{ - [self _sendEvent: theEvent - becomesKeyOnlyIfNeeded: NO]; -} - - (BOOL) tryToPerform: (SEL)anAction with: (id)anObject { diff --git a/Source/nsimage-tiff.h b/Source/nsimage-tiff.h index 0258d200e..a39c924d8 100644 --- a/Source/nsimage-tiff.h +++ b/Source/nsimage-tiff.h @@ -69,8 +69,8 @@ extern TIFF* NSTiffOpenDataWrite(char **data, long *size); extern int NSTiffClose(TIFF* image); extern int NSTiffGetImageCount(TIFF* image); -extern int NSTiffWrite(TIFF* image, NSTiffInfo* info, char* data); -extern int NSTiffRead(TIFF* image, NSTiffInfo* info, char* data); +extern int NSTiffWrite(TIFF *image, NSTiffInfo *info, unsigned char *data); +extern int NSTiffRead(TIFF *image, NSTiffInfo *info, unsigned char *data); extern NSTiffInfo* NSTiffGetInfo(int imageNumber, TIFF* image); extern NSTiffColormap* NSTiffGetColormap(TIFF* image); diff --git a/Source/tiff.m b/Source/tiff.m index 6d5b1c2cd..646ebf530 100644 --- a/Source/tiff.m +++ b/Source/tiff.m @@ -334,7 +334,7 @@ NSTiffGetInfo(int imageNumber, TIFF* image) direct color images. Thus the data array should be large enough to hold this information. */ int -NSTiffRead(TIFF* image, NSTiffInfo* info, char* data) +NSTiffRead(TIFF *image, NSTiffInfo *info, unsigned char *data) { int i; unsigned int row, col; @@ -443,7 +443,7 @@ NSTiffRead(TIFF* image, NSTiffInfo* info, char* data) } int -NSTiffWrite(TIFF* image, NSTiffInfo* info, char* data) +NSTiffWrite(TIFF *image, NSTiffInfo *info, unsigned char *data) { tdata_t buf = (tdata_t)data; uint16 sample_info[2];