diff --git a/ChangeLog b/ChangeLog index a36027958..c6e4fc1ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,55 @@ +2010-05-24 Fred Kiefer + + * Source/GSSimpleLayoutManager.m: Remove obsolete file. + * Source/NSBitmapImageRep+PNG.m, + * Source/NSBitmapImageRep+JPEG.m, + * Source/NSColorPicker.m, + * Source/NSMenu.m, + * Source/NSScreen.m: Remove gcc 2.95 warnings reported by + Riccardo Mottola . + + * Source/externs.m + * Source/Functions.m + * Source/GSAnimator.m + * Source/GSHelpManagerPanel.m + * Source/GSEPSPrintOperation.m + * Source/GSFusedSilica.m + * Source/GSFusedSilicaContext.h + * Source/GSFusedSilicaContext.m + * Source/GSLayoutManager.m + * Source/GSPrinting.m + * Source/GSPrintOperation.m + * Source/GSInfoPanel.m + * Source/GSKeyBindingAction.h + * Source/GSKeyBindingAction.m + * Source/GSKeyBindingTable.h + * Source/GSKeyBindingTable.m + * Source/GSServicesManager.m + * Source/NSColorList.m + * Source/NSBox.m + * Source/NSAttributedString.m + * Source/NSWorkspace.m + * Source/NSBitmapImageRep+PNG.h + * Source/NSWindow.m + * Source/NSClipView.m + * Source/NSBitmapImageRep.m + * Source/NSApplication.m + * Source/NSCachedImageRep.m + * Source/NSButtonImageSource.h + * Source/NSButtonImageSource.m + * Source/NSBitmapImageRep+GIF.h + * Source/NSBitmapImageRep+GIF.m + * Source/NSTabViewItem.m + * Source/NSBitmapImageRep+JPEG.h + * Source/NSBitmapImageRep+PNM.h + * Source/NSBitmapImageRep+PNM.m + * Source/NSTabView.m + * Source/NSArrayController.m + * Source/NSBrowserCell.m + * Source/NSBitmapImageRep+ICNS.h + * Source/NSBitmapImageRep+ICNS.m + * Source/NSView.m: Replace #include -> #import + 2010-05-21 Doug Simons * Source/GSToolbarView.m: diff --git a/Source/Functions.m b/Source/Functions.m index 850abe5ab..ffa11475e 100644 --- a/Source/Functions.m +++ b/Source/Functions.m @@ -27,20 +27,20 @@ Boston, MA 02110-1301, USA. */ -#include -#include -#include +#import +#import +#import -#include "AppKit/NSApplication.h" -#include "AppKit/NSBitmapImageRep.h" -#include "AppKit/NSNibLoading.h" -#include "AppKit/NSEvent.h" -#include "AppKit/NSGraphicsContext.h" -#include "AppKit/NSGraphics.h" -#include "AppKit/NSColor.h" -#include "AppKit/NSView.h" -#include "AppKit/NSWindow.h" -#include "AppKit/DPSOperators.h" +#import "AppKit/NSApplication.h" +#import "AppKit/NSBitmapImageRep.h" +#import "AppKit/NSNibLoading.h" +#import "AppKit/NSEvent.h" +#import "AppKit/NSGraphicsContext.h" +#import "AppKit/NSGraphics.h" +#import "AppKit/NSColor.h" +#import "AppKit/NSView.h" +#import "AppKit/NSWindow.h" +#import "AppKit/DPSOperators.h" char **NSArgv = NULL; diff --git a/Source/GSAnimator.m b/Source/GSAnimator.m index c08a4dd2e..437effb78 100644 --- a/Source/GSAnimator.m +++ b/Source/GSAnimator.m @@ -25,14 +25,14 @@ Boston, MA 02110-1301, USA. */ -#include -#include -#include -#include -#include +#import +#import +#import +#import +#import -#include -#include +#import "AppKit/NSEvent.h" +#import "GNUstepGUI/GSAnimator.h" @interface GSAnimator (private) - (void) _animationBegin; diff --git a/Source/GSEPSPrintOperation.m b/Source/GSEPSPrintOperation.m index fbceaaaf9..9cbc60753 100644 --- a/Source/GSEPSPrintOperation.m +++ b/Source/GSEPSPrintOperation.m @@ -33,16 +33,16 @@ Boston, MA 02110-1301, USA. */ -#include -#include -#include -#include -#include -#include -#include "AppKit/NSView.h" -#include "AppKit/NSPrintInfo.h" -#include "AppKit/NSPrintOperation.h" -#include "GNUstepGUI/GSEPSPrintOperation.h" +#import +#import +#import +#import +#import +#import +#import "AppKit/NSView.h" +#import "AppKit/NSPrintInfo.h" +#import "AppKit/NSPrintOperation.h" +#import "GNUstepGUI/GSEPSPrintOperation.h" /** diff --git a/Source/GSFusedSilica.m b/Source/GSFusedSilica.m index 8e31d2414..f01a6e098 100644 --- a/Source/GSFusedSilica.m +++ b/Source/GSFusedSilica.m @@ -26,9 +26,9 @@ Boston, MA 02110-1301, USA. */ -#include "GSFusedSilicaContext.h" -#include "AppKit/NSAffineTransform.h" -#include +#import +#import "AppKit/NSAffineTransform.h" +#import "GSFusedSilicaContext.h" /* Managing Graphics Contexts */ diff --git a/Source/GSFusedSilicaContext.h b/Source/GSFusedSilicaContext.h index 056ca6e6c..f211508ac 100644 --- a/Source/GSFusedSilicaContext.h +++ b/Source/GSFusedSilicaContext.h @@ -29,8 +29,8 @@ #ifndef _GSFusedSilicaContext_h_INCLUDE #define _GSFusedSilicaContext_h_INCLUDE -#include -#include +#import "AppKit/NSGraphicsContext.h" +#import "GNUstepGUI/GSFusedSilica.h" @interface NSGraphicsContext (FusedSilica) diff --git a/Source/GSFusedSilicaContext.m b/Source/GSFusedSilicaContext.m index 4852300df..e91f82027 100644 --- a/Source/GSFusedSilicaContext.m +++ b/Source/GSFusedSilicaContext.m @@ -26,12 +26,12 @@ Boston, MA 02110-1301, USA. */ -#include "GSFusedSilicaContext.h" -#include "GNUstepGUI/GSFontInfo.h" -#include "AppKit/NSGraphics.h" -#include -#include -#include +#import +#import +#import +#import "AppKit/NSGraphics.h" +#import "GNUstepGUI/GSFontInfo.h" +#import "GSFusedSilicaContext.h" #define NUMBER(num) \ [NSNumber numberWithInt: num] diff --git a/Source/GSHelpManagerPanel.m b/Source/GSHelpManagerPanel.m index 1e0fbbace..296608018 100644 --- a/Source/GSHelpManagerPanel.m +++ b/Source/GSHelpManagerPanel.m @@ -26,18 +26,18 @@ Boston, MA 02110-1301, USA. */ -#include "AppKit/NSApplication.h" -#include "AppKit/NSAttributedString.h" -#include "AppKit/NSTextView.h" -#include "AppKit/NSTextContainer.h" -#include "AppKit/NSTextStorage.h" -#include "AppKit/NSScrollView.h" -#include "AppKit/NSButton.h" -#include "AppKit/NSClipView.h" -#include "AppKit/NSColor.h" -#include "AppKit/NSImage.h" -#include "GNUstepGUI/GSHelpManagerPanel.h" -#include "GSGuiPrivate.h" +#import "AppKit/NSApplication.h" +#import "AppKit/NSAttributedString.h" +#import "AppKit/NSTextView.h" +#import "AppKit/NSTextContainer.h" +#import "AppKit/NSTextStorage.h" +#import "AppKit/NSScrollView.h" +#import "AppKit/NSButton.h" +#import "AppKit/NSClipView.h" +#import "AppKit/NSColor.h" +#import "AppKit/NSImage.h" +#import "GNUstepGUI/GSHelpManagerPanel.h" +#import "GSGuiPrivate.h" @implementation GSHelpManagerPanel diff --git a/Source/GSInfoPanel.m b/Source/GSInfoPanel.m index d727900e4..9f0c50af8 100644 --- a/Source/GSInfoPanel.m +++ b/Source/GSInfoPanel.m @@ -26,24 +26,24 @@ Boston, MA 02110-1301, USA. */ -#include -#include -#include -#include -#include -#include +#import +#import +#import +#import +#import +#import -#include "AppKit/NSApplication.h" -#include "AppKit/NSButton.h" -#include "AppKit/NSEvent.h" -#include "AppKit/NSFont.h" -#include "AppKit/NSImage.h" -#include "AppKit/NSImageView.h" -#include "AppKit/NSPasteboard.h" -#include "AppKit/NSTextField.h" -#include "GNUstepGUI/GSInfoPanel.h" -#include "GNUstepGUI/GSTheme.h" -#include "GSGuiPrivate.h" +#import "AppKit/NSApplication.h" +#import "AppKit/NSButton.h" +#import "AppKit/NSEvent.h" +#import "AppKit/NSFont.h" +#import "AppKit/NSImage.h" +#import "AppKit/NSImageView.h" +#import "AppKit/NSPasteboard.h" +#import "AppKit/NSTextField.h" +#import "GNUstepGUI/GSInfoPanel.h" +#import "GNUstepGUI/GSTheme.h" +#import "GSGuiPrivate.h" static id value_from_info_plist_for_key (NSString *key) diff --git a/Source/GSKeyBindingAction.h b/Source/GSKeyBindingAction.h index c783ce397..2b9e940cb 100644 --- a/Source/GSKeyBindingAction.h +++ b/Source/GSKeyBindingAction.h @@ -27,7 +27,7 @@ #ifndef _GS_KEYBINDING_ACTION_H #define _GS_KEYBINDING_ACTION_H -#include +#import @class NSInputManager; diff --git a/Source/GSKeyBindingAction.m b/Source/GSKeyBindingAction.m index 47e9098dd..5a093eeab 100644 --- a/Source/GSKeyBindingAction.m +++ b/Source/GSKeyBindingAction.m @@ -24,8 +24,8 @@ Boston, MA 02110-1301, USA. */ -#include "GSKeyBindingAction.h" -#include "AppKit/NSInputManager.h" +#import "AppKit/NSInputManager.h" +#import "GSKeyBindingAction.h" @implementation GSKeyBindingAction - (void) performActionWithInputManager: (NSInputManager *)manager diff --git a/Source/GSKeyBindingTable.h b/Source/GSKeyBindingTable.h index b08fdf575..ba7c1a2eb 100644 --- a/Source/GSKeyBindingTable.h +++ b/Source/GSKeyBindingTable.h @@ -27,7 +27,7 @@ #ifndef _GS_KEYBINDING_TABLE_H #define _GS_KEYBINDING_TABLE_H -#include "GSKeyBindingAction.h" +#import "GSKeyBindingAction.h" @class GSKeyBindingTable; diff --git a/Source/GSKeyBindingTable.m b/Source/GSKeyBindingTable.m index cd5193620..40c98a6cc 100644 --- a/Source/GSKeyBindingTable.m +++ b/Source/GSKeyBindingTable.m @@ -24,10 +24,10 @@ Boston, MA 02110-1301, USA. */ -#include "GSKeyBindingAction.h" -#include "GSKeyBindingTable.h" -#include "AppKit/NSInputManager.h" -#include "AppKit/NSEvent.h" +#import "AppKit/NSEvent.h" +#import "AppKit/NSInputManager.h" +#import "GSKeyBindingAction.h" +#import "GSKeyBindingTable.h" @implementation GSKeyBindingTable : NSObject diff --git a/Source/GSLayoutManager.m b/Source/GSLayoutManager.m index b97754e6f..519ef2881 100644 --- a/Source/GSLayoutManager.m +++ b/Source/GSLayoutManager.m @@ -25,24 +25,22 @@ Boston, MA 02110-1301, USA. */ -#include -#include -#include -#include -#include -#include +#import +#import +#import +#import +#import - -#include "AppKit/NSAttributedString.h" -#include "AppKit/NSTextStorage.h" -#include "AppKit/NSTextContainer.h" +#import "AppKit/NSAttributedString.h" +#import "AppKit/NSTextStorage.h" +#import "AppKit/NSTextContainer.h" /* just for NSAttachmentCharacter */ -#include "AppKit/NSTextAttachment.h" +#import "AppKit/NSTextAttachment.h" -#include "GNUstepGUI/GSFontInfo.h" -#include "GNUstepGUI/GSTypesetter.h" -#include "GNUstepGUI/GSLayoutManager_internal.h" +#import "GNUstepGUI/GSFontInfo.h" +#import "GNUstepGUI/GSTypesetter.h" +#import "GNUstepGUI/GSLayoutManager_internal.h" /* TODO: is using rand() here ok? */ static int random_level(void) diff --git a/Source/GSPrintOperation.m b/Source/GSPrintOperation.m index 9581617a4..28488c6fd 100644 --- a/Source/GSPrintOperation.m +++ b/Source/GSPrintOperation.m @@ -33,17 +33,17 @@ Boston, MA 02110-1301, USA. */ -#include -#include -#include -#include -#include "AppKit/NSView.h" -#include "AppKit/NSPrintPanel.h" -#include "AppKit/NSPrintInfo.h" -#include "AppKit/NSWorkspace.h" -#include "GNUstepGUI/GSPrinting.h" -#include "GNUstepGUI/GSPrintOperation.h" -#include "GSGuiPrivate.h" +#import +#import +#import +#import +#import "AppKit/NSPrintPanel.h" +#import "AppKit/NSPrintInfo.h" +#import "AppKit/NSView.h" +#import "AppKit/NSWorkspace.h" +#import "GNUstepGUI/GSPrinting.h" +#import "GNUstepGUI/GSPrintOperation.h" +#import "GSGuiPrivate.h" diff --git a/Source/GSPrinting.m b/Source/GSPrinting.m index 5df967d10..d60a5a3b7 100644 --- a/Source/GSPrinting.m +++ b/Source/GSPrinting.m @@ -26,15 +26,15 @@ Boston, MA 02110-1301, USA. */ -#include "GNUstepGUI/GSPrinting.h" -#include -#include -#include -#include -#include -#include -#include -#include "AppKit/NSPanel.h" +#import +#import +#import +#import +#import +#import +#import +#import "AppKit/NSPanel.h" +#import "GNUstepGUI/GSPrinting.h" static NSBundle *printingBundle = nil; diff --git a/Source/GSServicesManager.m b/Source/GSServicesManager.m index e6d717224..7d4cbdc66 100644 --- a/Source/GSServicesManager.m +++ b/Source/GSServicesManager.m @@ -25,41 +25,41 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" +#import "config.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import -#include "AppKit/NSApplication.h" -#include "AppKit/NSPasteboard.h" -#include "AppKit/NSMenu.h" -#include "AppKit/NSPanel.h" -#include "AppKit/NSWindow.h" -#include "AppKit/NSWorkspace.h" -#include "AppKit/NSDocumentController.h" +#import "AppKit/NSApplication.h" +#import "AppKit/NSPasteboard.h" +#import "AppKit/NSMenu.h" +#import "AppKit/NSPanel.h" +#import "AppKit/NSWindow.h" +#import "AppKit/NSWorkspace.h" +#import "AppKit/NSDocumentController.h" -#include "GNUstepGUI/GSServicesManager.h" -#include "GSGuiPrivate.h" +#import "GNUstepGUI/GSServicesManager.h" +#import "GSGuiPrivate.h" static GSServicesManager *manager = nil; diff --git a/Source/GSSimpleLayoutManager.m b/Source/GSSimpleLayoutManager.m deleted file mode 100644 index fa01fedb9..000000000 --- a/Source/GSSimpleLayoutManager.m +++ /dev/null @@ -1,1515 +0,0 @@ -/* - GSSimpleLayoutManager.m - - First GNUstep layout manager, extracted from NSText - - Copyright (C) 2000 Free Software Foundation, Inc. - - Author: Scott Christley - Date: 1996 - Author: Felipe A. Rodriguez - Date: July 1998 - Author: Daniel Böhringer - Date: August 1998 - Author: Fred Kiefer - Date: September 2000 - Extracted from NSText, reorganised to specification - - Author: Pierre-Yves Rivaille - Date: September 2002 - - This file is part of the GNUstep GUI Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; see the file COPYING.LIB. - If not, see or write to the - Free Software Foundation, 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include -#include -#include -#include - -#include "AppKit/NSGraphics.h" -#include "AppKit/NSColor.h" -#include "AppKit/NSText.h" -#include "AppKit/NSTextView.h" -#include "AppKit/NSTextStorage.h" -#include "AppKit/NSTextContainer.h" -#include "AppKit/NSStringDrawing.h" -#include "AppKit/NSParagraphStyle.h" - -#include "GNUstepGUI/GSSimpleLayoutManager.h" - -#define HUGE 1e7 - -static NSCharacterSet *newlines; -static NSCharacterSet *selectionWordGranularitySet; -static NSCharacterSet *invSelectionWordGranularitySet; - -@interface _GNULineLayoutInfo: NSObject -{ -@public - NSRange glyphRange; - NSRect lineFragmentRect; - NSRect usedRect; -} - - -+ (id) lineLayoutWithRange: (NSRange)aRange - rect: (NSRect)aRect - usedRect: (NSRect)charRect; - - -- (NSRange) glyphRange; -- (NSRect) lineFragmentRect; - -- (NSString*) description; -@end - -@implementation _GNULineLayoutInfo - -+ (_GNULineLayoutInfo *) lineLayoutWithRange: (NSRange)aRange - rect: (NSRect)aRect - usedRect: (NSRect)charRect -{ - _GNULineLayoutInfo *ret = AUTORELEASE([_GNULineLayoutInfo new]); - - ret->glyphRange = aRange; - ret->lineFragmentRect = aRect; - ret->usedRect = charRect; - return ret; -} - -- (NSRange) glyphRange -{ - return glyphRange; -} - -- (NSRect) lineFragmentRect -{ - return lineFragmentRect; -} - -- (NSString*) description -{ - return [NSString stringWithFormat: @"_GNULineLayoutInfo with glyphRange: %@, lineFragmentRect: %@, usedRect: %@", - NSStringFromRange (glyphRange), - NSStringFromRect (lineFragmentRect), - NSStringFromRect (usedRect)]; -} - -@end -// end: _GNULineLayoutInfo------------------------------------------------------ - -/* This is the height of the line/insertion point of the default font - * - used when there is no text/font in the textview. FIXME - in many - * cases we use this, but it's inappropriate - consider if there is - * not a way to get a more appropriate font (eg, the last font the - * user was typing in if we're after a newline etc). Anyway, better - * using this function than hardcoding '12' :-) - */ -static inline float defaultFontHeight () -{ - NSFont *userFont; - NSRect fontRect; - - userFont = [NSFont userFontOfSize: 0]; - fontRect = [userFont boundingRectForFont]; - - return fontRect.size.height; -} - - -@interface GSSimpleLayoutManager (Private) - -- (NSRect) rectForCharacterIndex: (unsigned) index; -- (NSRange) lineRangeForRect: (NSRect) aRect; -- (NSSize) _sizeOfRange: (NSRange) range; - -// return value is identical to the real line number -- (int) lineLayoutIndexForGlyphIndex: (unsigned) anIndex; -// returns the full glyph range for a line range -- (NSRange) glyphRangeForLineLayoutRange: (NSRange) aRange; -- (unsigned) lineLayoutIndexForPoint: (NSPoint)point; - -- (void) setNeedsDisplayForLineRange: (NSRange) redrawLineRange - inTextContainer:(NSTextContainer *)aTextContainer; -// override for special layout of text -- (NSRange) rebuildForRange: (NSRange)aRange - delta: (int)insertionDelta - inTextContainer:(NSTextContainer *)aTextContainer; -// low level, override but never invoke (use setNeedsDisplayForLineRange:) -- (void) drawLinesInLineRange: (NSRange)aRange - atPoint: (NSPoint)containerOrigin; -- (void) drawSelectionAsRangeNoCaret: (NSRange)aRange - atPoint: (NSPoint)containerOrigin; -@end - -@implementation GSSimpleLayoutManager - -+ (void) initialize -{ - if (self == [GSSimpleLayoutManager class]) - { - NSMutableCharacterSet *ms; - - ASSIGN (selectionWordGranularitySet, - [NSCharacterSet whitespaceCharacterSet]); - ASSIGN (invSelectionWordGranularitySet, - [selectionWordGranularitySet invertedSet]); - - ms = [[NSCharacterSet whitespaceAndNewlineCharacterSet] mutableCopy]; - [ms formIntersectionWithCharacterSet: invSelectionWordGranularitySet]; - newlines = [ms copy]; - RELEASE(ms); - } -} - -- (id) init -{ - self = [super init]; - - _lineLayoutInfo = [[NSMutableArray alloc] init]; - return self; -} - -- (void) dealloc -{ - RELEASE(_lineLayoutInfo); - - [super dealloc]; -} - -- (void) setTextStorage: (NSTextStorage*)aTextStorage -{ - [_lineLayoutInfo removeAllObjects]; - - [super setTextStorage: aTextStorage]; -} - -// Returns the currently used bounds for all the text -- (NSRect)usedRectForTextContainer:(NSTextContainer *)aTextContainer -{ - if ([_lineLayoutInfo count]) - { - NSEnumerator *lineEnum; - _GNULineLayoutInfo *currentInfo; - NSRect retRect = NSMakeRect (0, 0, 0, 0); - - for ((lineEnum = [_lineLayoutInfo objectEnumerator]); - (currentInfo = [lineEnum nextObject]);) - { - retRect = NSUnionRect (retRect, currentInfo->usedRect); - } - return retRect; - } - else - return NSZeroRect; -} - -- (unsigned) glyphIndexForPoint: (NSPoint)point - inTextContainer: (NSTextContainer*)aTextContainer - fractionOfDistanceThroughGlyph: (float*)partialFraction -{ - unsigned index = [self lineLayoutIndexForPoint: point]; - _GNULineLayoutInfo *currentInfo = [_lineLayoutInfo objectAtIndex: index]; - NSRect rect = currentInfo->usedRect; - NSRange range = currentInfo->glyphRange; - int i; - int min = range.location; - int max = NSMaxRange(range); - float x = point.x; - float fmin = rect.origin.x; - float fmax = NSMaxX(rect); - float w1, w2; - - if (partialFraction != NULL) - { - *partialFraction = 0.0; - } - - /* Make sure min is >= 0. */ - min = MAX(0, min); - - /* The point is before the beginning of the line. Return the first - location on the line (or 0). */ - if (x <= fmin) - { - return min; - } - /* The point is after the end of the line. */ - if (x >= fmax) - { - if (max == 0) - { - return 0; - } - else if ((max == [_textStorage length]) - && (index == [_lineLayoutInfo count] - 1)) - { - /* We are on the very last line and we are asked for the - glyph index on a point after the end of the line. Return - end of text then. */ - return MAX(0, [_textStorage length]); - } - else - { - /* In all other cases, this is a normal line (== any line - but the very last one); a newline or space is ending it, - and when you click after the end of the line, we don't - want to go to the next line: return the position just - before the newline or space (that is, return the position - just after the last displayed glyph on that line). */ - return MAX(0, max - 1); - } - } - if (range.length == 1) - { - return min; - } - - // this should give a good starting index for binary search - i = (int)((max - min) * (x - fmin) / (fmax - fmin)) + min; - while (min < max) - { - w1 = [self _sizeOfRange: - NSMakeRange (range.location, - i - range.location)].width + fmin; - if (i > range.location) - w2 = [self _sizeOfRange: - NSMakeRange (range.location, - i-1 - range.location)].width + fmin; - else - w2 = fmin; - - if (w1 < x) - { - min = i + 1; - i = (max + min) / 2; - continue; - } - if (w2 > x) - { - max = i - 1; - i = (max + min) / 2; - continue; - } - if (w1 > x) - { - if (partialFraction != NULL) - { - *partialFraction = 1.0 - (w1 - x)/(w1 - w2); - } - } - return MAX(0, i - 1); - } - return MAX(0, min - 1); -} - -- (NSRect)lineFragmentRectForGlyphAtIndex: (unsigned)index - effectiveRange: (NSRange *)lineFragmentRange -{ - _GNULineLayoutInfo *currentInfo; - - if (![_textStorage length] || ![_lineLayoutInfo count]) - { - return NSMakeRect (0, 0, 0, defaultFontHeight ()); - } - - currentInfo = [_lineLayoutInfo objectAtIndex: - [self lineLayoutIndexForGlyphIndex: index]]; - - if (lineFragmentRange) - { - *lineFragmentRange = currentInfo->glyphRange; - } - - return currentInfo->lineFragmentRect; -} - -- (NSRect)lineFragmentUsedRectForGlyphAtIndex: (unsigned)index - effectiveRange: (NSRange *)lineFragmentRange -{ - _GNULineLayoutInfo *currentInfo; - - if (![_textStorage length] || ![_lineLayoutInfo count]) - { - // we return the line fragment from the virtual newline - // that we added at the end of the empty text - if (lineFragmentRange) - { - lineFragmentRange->location=0; - lineFragmentRange->length=0; - } - return ((_GNULineLayoutInfo *)[_lineLayoutInfo lastObject])->usedRect; - } - - currentInfo = [_lineLayoutInfo objectAtIndex: - [self lineLayoutIndexForGlyphIndex: index]]; - - if (lineFragmentRange) - { - *lineFragmentRange = currentInfo->glyphRange; - } - - return currentInfo->usedRect; -} - -- (NSPoint)locationForGlyphAtIndex:(unsigned)index -{ - float x; - unsigned start; - _GNULineLayoutInfo *currentInfo; - - if (![_textStorage length] || ![_lineLayoutInfo count]) - { - return NSMakePoint(0, 0); - } - - currentInfo = [_lineLayoutInfo objectAtIndex: - [self lineLayoutIndexForGlyphIndex: index]]; - if (index >= NSMaxRange (currentInfo->glyphRange)) - { - x = [self _sizeOfRange: currentInfo->glyphRange].width; - return NSMakePoint (x, 0); - } - - start = currentInfo->glyphRange.location; - x = [self _sizeOfRange: (NSMakeRange (start, index - start))].width; - - /* NB: As per specs, we return the location relative to the glyph's - line fragment rectangle */ - return NSMakePoint(x, 0); -} - -- (NSRect)boundingRectForGlyphRange:(NSRange)aRange - inTextContainer:(NSTextContainer *)aTextContainer; -{ - _GNULineLayoutInfo *currentInfo; - unsigned i1, i2; - NSRect rect1, rect2; - NSSize size; - NSRect rect; - - if (![_textStorage length] || ![_lineLayoutInfo count]) - { - return NSMakeRect (0, 0, 0, defaultFontHeight ()); - } - - i1 = [self lineLayoutIndexForGlyphIndex: aRange.location]; - i2 = [self lineLayoutIndexForGlyphIndex: NSMaxRange(aRange)]; - - - if (i1 == i2) - { - // the range is not multiline. - - currentInfo = [_lineLayoutInfo objectAtIndex: i1]; - rect1 = currentInfo->usedRect; - size = [self _sizeOfRange: - NSMakeRange - (currentInfo->glyphRange.location, - aRange.location - - currentInfo->glyphRange.location)]; - rect1.origin.x += size.width; - rect1.size.width = [self _sizeOfRange: - NSMakeRange - (aRange.location - - currentInfo->glyphRange.location, 1)].width; - // rect1 is the rect for the first glyph in the range - - currentInfo = [_lineLayoutInfo objectAtIndex: i2]; - rect2 = currentInfo->usedRect; - size = [self _sizeOfRange: - NSMakeRange - (currentInfo->glyphRange.location, - NSMaxRange(aRange) - - currentInfo->glyphRange.location)]; - rect2.origin.x += size.width; - rect2.size.width = [self _sizeOfRange: - NSMakeRange - (NSMaxRange(aRange) - - currentInfo->glyphRange.location, 1)].width; - // rect2 is the rect for the last glyph in the range - - // TODO: it might not work if some glyph draw out of the usedRect. - // (is this really possible ?) - } - else - { - // this is a multiline range, therefore the bounding rect goes - // from the beginning of a line till the end - // getting the lineFragmentRects will give the correct result - currentInfo = [_lineLayoutInfo objectAtIndex: i1]; - rect1 = currentInfo->lineFragmentRect; - - currentInfo = [_lineLayoutInfo objectAtIndex: i2]; - rect2 = currentInfo->lineFragmentRect; - } - - - - - // this does compute the smallest rect enclosing - // rect1 (or rect1.origin if rect1 is empty) - // and rect2 (or rect2.origin if rect1 is empty) - - rect = NSMakeRect(MIN(NSMinX(rect1), NSMinX(rect2)), - MIN(NSMinY(rect1), NSMinY(rect2)), 0, 0); - - rect = NSMakeRect(NSMinX(rect), - NSMinY(rect), - MAX(NSMaxX(rect1), NSMaxX(rect2)) - NSMinX(rect), - MAX(NSMaxY(rect1), NSMaxY(rect2)) - NSMinY(rect)); - - - return rect; - -} - -- (NSRange)glyphRangeForBoundingRect:(NSRect)aRect - inTextContainer:(NSTextContainer *)aTextContainer -{ - NSRange aRange = [self lineRangeForRect: aRect]; - - return [self glyphRangeForLineLayoutRange: aRange]; -} - -- (NSRect*) rectArrayForCharacterRange:(NSRange)aRange - withinSelectedCharacterRange:(NSRange)selCharRange - inTextContainer:(NSTextContainer *)aTextContainer - rectCount:(unsigned *)rectCount; -{ - //FIXME: This currently ignores most of its arguments - - if (!rectCount) - return _rects; - - if (aRange.length) - { - NSRect startRect = [self rectForCharacterIndex: aRange.location]; - NSRect endRect = [self rectForCharacterIndex: NSMaxRange (aRange)]; - float width = 0; - if (aTextContainer) - width = [aTextContainer containerSize].width; - - if (startRect.origin.y == endRect.origin.y) - { - // single line selection - _rects[0] = NSMakeRect (startRect.origin.x, startRect.origin.y, - endRect.origin.x - startRect.origin.x, - startRect.size.height); - *rectCount = 1; - } - else if (startRect.origin.y == endRect.origin.y - endRect.size.height) - { - // two line selection - - // first line - _rects[0] = NSMakeRect (startRect.origin.x, startRect.origin.y, - width - startRect.origin.x, - startRect.size.height); - // second line - _rects[1] = NSMakeRect (0, endRect.origin.y, endRect.origin.x, - endRect.size.height); - *rectCount = 2; - } - else - { - // 3 Rects: multiline selection - - // first line - _rects[0] = NSMakeRect (startRect.origin.x, startRect.origin.y, - width - startRect.origin.x, - startRect.size.height); - // intermediate lines - _rects[1] = NSMakeRect (0, NSMaxY(startRect), - width, - endRect.origin.y - NSMaxY (startRect)); - // last line - _rects[2] = NSMakeRect (0, endRect.origin.y, endRect.origin.x, - endRect.size.height); - *rectCount = 3; - } - } - else - *rectCount = 0; - - return _rects; -} - -- (NSRange)glyphRangeForTextContainer: (NSTextContainer*)aContainer -{ - return NSMakeRange(0, [_textStorage length]); -} - -- (void) setTextContainer: (NSTextContainer*)aTextContainer - forGlyphRange: (NSRange)glyphRange -{ -} - -- (void) invalidateLayoutForCharacterRange: (NSRange)aRange - isSoft: (BOOL)flag - actualCharacterRange: (NSRange*)actualRange -{ - NSRange lineRange; - NSTextContainer *aTextContainer = [self textContainerForGlyphAtIndex: aRange.location - effectiveRange: NULL]; - - lineRange = [self rebuildForRange: aRange - delta: 0 - inTextContainer: aTextContainer]; - [[aTextContainer textView] sizeToFit]; - [[aTextContainer textView] invalidateTextContainerOrigin]; - - if (actualRange) - *actualRange = [self glyphRangeForLineLayoutRange: lineRange]; -} - -- (void)textStorage:(NSTextStorage *)aTextStorage - edited:(unsigned int)mask - range:(NSRange)aRange - changeInLength:(int)delta - invalidatedRange:(NSRange)invalidatedCharRange; -{ - NSRange lineRange; - NSTextContainer *aTextContainer; - - // No editing - if (!mask) - { - return; - } - - [self invalidateGlyphsForCharacterRange: invalidatedCharRange - changeInLength: delta - actualCharacterRange: NULL]; - - aTextContainer = [self textContainerForGlyphAtIndex: aRange.location - effectiveRange: NULL]; - lineRange = [self rebuildForRange: aRange - delta: delta - inTextContainer: aTextContainer]; - - [[aTextContainer textView] sizeToFit]; - [[aTextContainer textView] invalidateTextContainerOrigin]; - - if ([aTextContainer textView]) - { - NSRange sr = [[aTextContainer textView] selectedRange]; - if (sr.length == 0 - && aRange.location <= sr.location - && aRange.location + aRange.length >= sr.location) - { - [[aTextContainer textView] - updateInsertionPointStateAndRestartTimer: YES]; - } - } - - /* FIXME - it was reported that at this point lineRange is no longer - * correct ... looks like sizeToFit / invalidateTextContainerOrigin - * migth cause additional relayout. */ - [self setNeedsDisplayForLineRange: lineRange - inTextContainer: aTextContainer]; -} - -- (void)drawGlyphsForGlyphRange: (NSRange)glyphRange - atPoint: (NSPoint)containerOrigin -{ - NSRange newRange; - NSRange selectedRange = [[self firstTextView] selectedRange]; - unsigned start = [self lineLayoutIndexForGlyphIndex: glyphRange.location]; - unsigned end = [self lineLayoutIndexForGlyphIndex: NSMaxRange(glyphRange)]; - NSRange lineRange = NSMakeRange(start, end + 1 - start); - - [self drawLinesInLineRange: lineRange - atPoint: containerOrigin]; - - // We have to redraw the part of the selection that is inside - // the redrawn lines - newRange = NSIntersectionRange(selectedRange, glyphRange); - // Was there any overlapping with the selection? - if ((selectedRange.length && - NSLocationInRange(newRange.location, selectedRange))) - { - [self drawSelectionAsRangeNoCaret: newRange - atPoint: containerOrigin]; - } -} - -- (void) setLineFragmentRect: (NSRect)fragmentRect - forGlyphRange: (NSRange)glyphRange - usedRect: (NSRect)usedRect -{ - [_lineLayoutInfo addObject: [_GNULineLayoutInfo - lineLayoutWithRange: glyphRange - rect: fragmentRect - usedRect: usedRect]]; -} - -- (void) setLocation: (NSPoint)aPoint -forStartOfGlyphRange: (NSRange)glyphRange -{ -} - -@end - -@implementation GSSimpleLayoutManager (Private) - -- (NSSize) _sizeOfRange: (NSRange)aRange -{ - if (aRange.length == 0 - || _textStorage == nil - || NSMaxRange(aRange) > [_textStorage length]) - { - return NSZeroSize; - } - - return [_textStorage sizeRange: aRange]; -} - -- (unsigned) lineLayoutIndexForPoint: (NSPoint)point -{ - int i; - int min = 0; - int max = MAX(0, (int)[_lineLayoutInfo count] - 1); - float y = point.y; - float fmin; - float fmax; - NSRect rect; - - if (max == 0) - { - return 0; - } - - fmin = NSMinY([[_lineLayoutInfo objectAtIndex: 0] lineFragmentRect]); - fmax = NSMaxY([[_lineLayoutInfo lastObject] lineFragmentRect]); - - if (y >= fmax) - return max; - - if (y <= fmin) - return min; - - // this should give a good starting index for binary search - i = (int)((max - min) * (y - fmin) / (fmax - fmin)) + min; - while (min < max) - { - _GNULineLayoutInfo *ci = [_lineLayoutInfo objectAtIndex: i]; - - rect = ci->lineFragmentRect; - - if (NSMaxY(rect) < y) - { - min = i + 1; - i = (max + min) / 2; - continue; - } - if (NSMinY(rect) > y) - { - max = i - 1; - i = (max + min) / 2; - continue; - } - - return i; - } - return min; -} - -- (int) lineLayoutIndexForGlyphIndex: (unsigned)anIndex -{ - int i; - int min = 0; - int max = MAX(0, (int)[_lineLayoutInfo count] - 1); - unsigned y = anIndex; - unsigned fmin; - unsigned fmax; - NSRange range; - - if (max == 0) - { - return 0; - } - - fmin = [[_lineLayoutInfo objectAtIndex: 0] glyphRange].location; - fmax = NSMaxRange([[_lineLayoutInfo lastObject] glyphRange]); - - if (y >= fmax) - return max; - - if (y <= fmin) - return min; - - // this should give a good starting index for binary search - i = (int)((max - min) * (y - fmin) / (fmax - fmin)) + min; - while (min < max) - { - _GNULineLayoutInfo *ci = [_lineLayoutInfo objectAtIndex: i]; - - range = ci->glyphRange; - - if (NSMaxRange(range) <= y) - { - min = i + 1; - i = (max + min) / 2; - continue; - } - if (range.location > y) - { - max = i - 1; - i = (max + min) / 2; - continue; - } - // Do we need a special treatment for paragraph infos? - return i; - } - return min; -} - -- (NSRange) glyphRangeForLineLayoutRange: (NSRange)aRange; -{ - _GNULineLayoutInfo *currentInfo; - unsigned startLine = aRange.location; - unsigned endLine = NSMaxRange(aRange); - unsigned startIndex; - unsigned endIndex; - - if ([_lineLayoutInfo count] == 0) - { - return NSMakeRange (0, 0); - } - - if (startLine >= [_lineLayoutInfo count]) - currentInfo = [_lineLayoutInfo lastObject]; - else - currentInfo = [_lineLayoutInfo objectAtIndex: startLine]; - startIndex = currentInfo->glyphRange.location; - - if (endLine >= [_lineLayoutInfo count]) - currentInfo = [_lineLayoutInfo lastObject]; - else - currentInfo = [_lineLayoutInfo objectAtIndex: endLine]; - endIndex = NSMaxRange(currentInfo->glyphRange); - - return NSMakeRange(startIndex, endIndex - startIndex); -} - -// rect to the end of line -- (NSRect) rectForCharacterIndex: (unsigned)index -{ - float width = 0; - id container; - _GNULineLayoutInfo *currentInfo; - unsigned start; - NSRect rect; - float x; - - container = [self textContainerForGlyphAtIndex: index effectiveRange: NULL]; - if (container) - width = [container containerSize].width; - if (![_textStorage length] || ![_lineLayoutInfo count]) - { - return NSMakeRect(0, 0, width, defaultFontHeight ()); - } - - currentInfo = [_lineLayoutInfo lastObject]; - if (index >= NSMaxRange(currentInfo->glyphRange)) - { - NSRect rect = currentInfo->usedRect; - - return NSMakeRect(NSMaxX (rect), rect.origin.y, - width - NSMaxX (rect), - rect.size.height); - } - - - currentInfo = [_lineLayoutInfo objectAtIndex: - [self lineLayoutIndexForGlyphIndex: index]]; - start = currentInfo->glyphRange.location; - rect = currentInfo->usedRect; - x = rect.origin.x + [self _sizeOfRange: NSMakeRange(start, index-start)].width; - - return NSMakeRect(x, rect.origin.y, NSMaxX (rect) - x, - rect.size.height); -} - -- (void) drawSelectionAsRangeNoCaret: (NSRange)aRange - atPoint: (NSPoint)containerOrigin -{ - unsigned i, count; - NSTextContainer *aTextContainer; - NSRect *rects; - - aTextContainer = [self textContainerForGlyphAtIndex: aRange.location - effectiveRange: NULL]; - rects = [self rectArrayForCharacterRange: aRange - withinSelectedCharacterRange: aRange - inTextContainer: aTextContainer - rectCount: &count]; - - for (i = 0; i < count; i++) - { - rects[i].origin.x += containerOrigin.x; - rects[i].origin.y += containerOrigin.y; - NSHighlightRect (rects[i]); - } -} - -- (NSRange) lineRangeForRect: (NSRect)rect -{ - NSPoint upperLeftPoint = rect.origin; - NSPoint lowerRightPoint = NSMakePoint (NSMaxX (rect), NSMaxY (rect)); - unsigned startLine, endLine; - - startLine = [self lineLayoutIndexForPoint: upperLeftPoint]; - endLine = [self lineLayoutIndexForPoint: lowerRightPoint]; - if (++endLine > [_lineLayoutInfo count]) - endLine = [_lineLayoutInfo count]; - - return NSMakeRange(startLine, endLine - startLine); -} - -// relies on _lineLayoutInfo -- (void) drawLinesInLineRange: (NSRange)aRange - atPoint: (NSPoint)containerOrigin -{ - NSArray *linesToDraw; - NSEnumerator *lineEnum; - _GNULineLayoutInfo *currentInfo; - - if ([_lineLayoutInfo count] == 0) - { - return; - } - - linesToDraw = [_lineLayoutInfo subarrayWithRange: aRange]; - - for ((lineEnum = [linesToDraw objectEnumerator]); - (currentInfo = [lineEnum nextObject]);) - { - NSRect rect; - rect = currentInfo->lineFragmentRect; - rect.origin.x += containerOrigin.x; - rect.origin.y += containerOrigin.y; - [_textStorage drawRange: currentInfo->glyphRange - inRect: rect]; - } -} - -- (void) setNeedsDisplayForLineRange: (NSRange)redrawLineRange - inTextContainer: (NSTextContainer *)aTextContainer -{ - if ([_lineLayoutInfo count] - && NSMaxRange (redrawLineRange) <= [_lineLayoutInfo count] - && redrawLineRange.length) - { - _GNULineLayoutInfo *firstInfo - = [_lineLayoutInfo objectAtIndex: redrawLineRange.location]; - NSRect displayRect = firstInfo->lineFragmentRect; - float width = 0; - if (aTextContainer) - width = [aTextContainer containerSize].width; - if (redrawLineRange.length > 1) - displayRect = NSUnionRect(displayRect, - [[_lineLayoutInfo - objectAtIndex: - (int)NSMaxRange(redrawLineRange) - - 1] lineFragmentRect]); - - displayRect.size.width = width; - if ([aTextContainer textView]) - { - displayRect.origin.x += - [[aTextContainer textView] textContainerInset].width; - displayRect.origin.y += - [[aTextContainer textView] textContainerInset].height; - [[aTextContainer textView] setNeedsDisplayInRect: displayRect]; - } - } -} - -- (BOOL) _relocLayoutArray: (NSMutableArray*)ghostArray - offset: (int)relocOffset - floatTrift: (float*)yDisplacement -{ - _GNULineLayoutInfo *lastInfo = [_lineLayoutInfo lastObject]; - // The start character in the ghostArray - unsigned nextChar = NSMaxRange(lastInfo->glyphRange) - relocOffset; - NSEnumerator *relocEnum; - _GNULineLayoutInfo *currReloc = nil; - float yReloc; - - while ([ghostArray count]) - { - unsigned firstChar; - - currReloc = [ghostArray objectAtIndex: 0]; - firstChar = currReloc->glyphRange.location; -NSDebugLog(@"Reloc %@ to %d", NSStringFromRange(currReloc->glyphRange), nextChar); - if (firstChar == nextChar) - break; - else if (firstChar > nextChar) - return NO; - else - [ghostArray removeObjectAtIndex: 0]; - } - - if (![ghostArray count]) - return NO; - - relocEnum = [ghostArray objectEnumerator]; - yReloc = NSMaxY(lastInfo->lineFragmentRect) - currReloc->lineFragmentRect.origin.y; - if (yDisplacement) - *yDisplacement = yReloc; - - while ((currReloc = [relocEnum nextObject]) != nil) - { - currReloc->glyphRange.location += relocOffset; - if (yReloc) - { - currReloc->lineFragmentRect.origin.y += yReloc; - currReloc->usedRect.origin.y += yReloc; - } - [_lineLayoutInfo addObject: currReloc]; - } - - return YES; -} - -/* - * A little utility function to determine the range of characters in a scanner - * that are present in a specified character set. - */ -static inline NSRange -scanRange(NSScanner *scanner, NSCharacterSet* aSet) -{ - unsigned start = [scanner scanLocation]; - unsigned end = start; - - if ([scanner scanCharactersFromSet: aSet intoString: 0] == YES) - { - end = [scanner scanLocation]; - } - return NSMakeRange(start, end - start); -} - -// returns range of lines actually updated -- (NSRange) rebuildForRange: (NSRange)aRange - delta: (int)insertionDelta - inTextContainer:(NSTextContainer *)aTextContainer -{ - NSPoint drawingPoint = NSZeroPoint; - float padding = [aTextContainer lineFragmentPadding]; - unsigned startingIndex = 0; - unsigned currentLineIndex; - NSString *allText = [_textStorage string]; - unsigned length = [allText length]; - unsigned paraPos; - int maxLines = [_lineLayoutInfo count]; - int aLine = 0; - // for optimization detection - NSMutableArray *ghostArray = nil; - - if (maxLines) - { - int insertionLineIndex = [self lineLayoutIndexForGlyphIndex: - aRange.location]; - int nextLine = [self lineLayoutIndexForGlyphIndex: - NSMaxRange(aRange) - insertionDelta] + 1; - - if (nextLine < maxLines) - { - // remember old array for optimization purposes - ghostArray = AUTORELEASE([[_lineLayoutInfo - subarrayWithRange: - NSMakeRange (nextLine, - maxLines - nextLine)] - mutableCopy]); - } - - aLine = MAX(0, insertionLineIndex - 1); - if (aLine) - { - _GNULineLayoutInfo *lastValidLineInfo = [_lineLayoutInfo - objectAtIndex: aLine - 1]; - NSRect aRect = lastValidLineInfo->usedRect; - - startingIndex = NSMaxRange(lastValidLineInfo->glyphRange); - drawingPoint.x = 0; - drawingPoint.y = aRect.origin.y; - drawingPoint.y += aRect.size.height; - } - - [_lineLayoutInfo removeObjectsInRange: - NSMakeRange (aLine, maxLines - aLine)]; - } - - if (!length) - { - float width = 0; - if (aTextContainer) - width = [aTextContainer containerSize].width; - - // FIXME: This should be done via extra line fragment - // If there is no text add one empty box - { - NSParagraphStyle *style = - (NSParagraphStyle*)[_textStorage - attribute: NSParagraphStyleAttributeName - atIndex: 0 - effectiveRange: NULL]; - - if ([style alignment] == NSRightTextAlignment) - { - [_lineLayoutInfo - addObject: [_GNULineLayoutInfo - lineLayoutWithRange: NSMakeRange (0, 0) - rect: NSMakeRect (0, 0, width, defaultFontHeight ()) - usedRect: NSMakeRect (width-1, 0, 1, defaultFontHeight ())]]; - } - else if ([style alignment] == NSCenterTextAlignment) - { - [_lineLayoutInfo - addObject: [_GNULineLayoutInfo - lineLayoutWithRange: NSMakeRange (0, 0) - rect: NSMakeRect (0, 0, width, defaultFontHeight ()) - usedRect: NSMakeRect ((int) width/2, 0, 1, defaultFontHeight ())]]; - } - else - { - [_lineLayoutInfo - addObject: [_GNULineLayoutInfo - lineLayoutWithRange: NSMakeRange (0, 0) - rect: NSMakeRect (0, 0, width, defaultFontHeight ()) - usedRect: NSMakeRect (0, 0, 1, defaultFontHeight ())]]; - } - } - - return NSMakeRange(0,1); - } - - currentLineIndex = aLine; - paraPos = startingIndex; - - while (paraPos < length) - { - NSRange para; // Range of current paragraph. - NSRange eol; // Range of newline character. - NSScanner *lScanner; - unsigned startingLineCharIndex = paraPos; - BOOL isBuckled = NO; - NSString *paragraph; - unsigned position; // Position in NSString. - NSRect remainingRect = NSZeroRect; - - /* Determine the range of the next paragraph of text (in 'para') - and set 'paraPos' to point after the terminating newline - character (if any). */ - para = NSMakeRange (paraPos, length - paraPos); - eol = [allText rangeOfCharacterFromSet: newlines - options: NSLiteralSearch - range: para]; - - if (eol.location == NSNotFound) - { - eol.location = length; - eol.length = 0; - } - else - { - para.length = eol.location - para.location; - } - paraPos = NSMaxRange(eol); - position = para.location; - - paragraph = [allText substringWithRange: para]; - - lScanner = [NSScanner scannerWithString: paragraph]; - [lScanner setCharactersToBeSkipped: nil]; - - // Process a paragraph - do - { - // Temporary added a autorelease pool, as the current layout - // mechanism uses up much memory space, that should be freed - // as soon as possible. - CREATE_AUTORELEASE_POOL(pool); - NSRect fragmentRect; - NSRect usedLineRect; - float width; - NSRange lineGlyphRange; - // starts with zero, do not confuse with startingLineCharIndex - unsigned localLineStartIndex = [lScanner scanLocation]; - unsigned scannerPosition = localLineStartIndex; - - if (NSIsEmptyRect(remainingRect)) - { - fragmentRect = NSMakeRect (0, drawingPoint.y, HUGE, HUGE); - } - else - { - fragmentRect = remainingRect; - } - - fragmentRect = [aTextContainer - lineFragmentRectForProposedRect: fragmentRect - sweepDirection: NSLineSweepRight - movementDirection: NSLineMoveDown - remainingRect: &remainingRect]; - if (NSIsEmptyRect(fragmentRect)) - { - // No more space in the text container, give up doing the layout - int a = MAX (1, [_lineLayoutInfo count] - aLine); - return NSMakeRange(aLine, a); - } - - width = fragmentRect.size.width - 2 * padding; - usedLineRect = fragmentRect; - // usedLineRect.origin.x += padding; - usedLineRect.size = NSZeroSize; - - // scan the individual words to the end of the line - while (![lScanner isAtEnd]) - { - NSRange currentStringRange, trailingSpacesRange; - NSRange leadingSpacesRange; - NSSize advanceSize; - - // snack next word - // leading spaces: only first time - leadingSpacesRange - = scanRange(lScanner, selectionWordGranularitySet); - currentStringRange - = scanRange(lScanner, invSelectionWordGranularitySet); - trailingSpacesRange - = scanRange(lScanner, selectionWordGranularitySet); - - if (leadingSpacesRange.length) - { - currentStringRange = NSUnionRange(leadingSpacesRange, - currentStringRange); - } - if (trailingSpacesRange.length) - { - currentStringRange = NSUnionRange(trailingSpacesRange, - currentStringRange); - } - - // evaluate size of current word - advanceSize = [self _sizeOfRange: - NSMakeRange (currentStringRange.location + position, - currentStringRange.length)]; - - // handle case where single word is broader than width - // (buckle word) - if (advanceSize.width > width) - { - if (isBuckled) - { - NSSize currentSize = NSMakeSize (HUGE, 0); - unsigned lastVisibleCharIndex; - - for (lastVisibleCharIndex = currentStringRange.length; - currentSize.width >= width && lastVisibleCharIndex; - lastVisibleCharIndex--) - { - currentSize = [self _sizeOfRange: NSMakeRange( - startingLineCharIndex, lastVisibleCharIndex)]; - } - isBuckled = NO; - usedLineRect.size = currentSize; - scannerPosition = localLineStartIndex + lastVisibleCharIndex +1; - [lScanner setScanLocation: scannerPosition]; - break; - } - else - { - // undo layout of extralarge word - // (will be done on the next line [see above]) - isBuckled = YES; - } - } - else - { - isBuckled = NO; - } - - // line to long - if (usedLineRect.size.width + advanceSize.width > width - || isBuckled) - { - // end of line -> word wrap - // undo layout of last word - [lScanner setScanLocation: scannerPosition]; - break; - } - - // Add next word - usedLineRect = NSUnionRect (usedLineRect, - NSMakeRect (drawingPoint.x, - drawingPoint.y, - advanceSize.width, - advanceSize.height)); - scannerPosition = [lScanner scanLocation]; - drawingPoint.x += advanceSize.width; - } - - if ([lScanner isAtEnd]) - { - // newline - induced premature lineending: flush - if (eol.length) - { - // Add information for the line break - scannerPosition += eol.length; - usedLineRect.size.width += 1; - // FIXME: This should use the real font size!! not - // the default one !! - // This should be fixed (04-07-02) - if (usedLineRect.size.height == 0) - { - // usedLineRect.size.height = defaultFontHeight (); - usedLineRect.size.height = - [self _sizeOfRange: NSMakeRange(startingLineCharIndex, - eol.length)].height; - - } - } - } - - lineGlyphRange = NSMakeRange (startingLineCharIndex, - scannerPosition - localLineStartIndex); - // Adjust the height of the line fragment rect, as this will - // the to big - fragmentRect.size.height = usedLineRect.size.height; - - // adjust the usedLineRect depending on the justification - { - NSParagraphStyle *style = - (NSParagraphStyle*)[_textStorage - attribute: NSParagraphStyleAttributeName - atIndex: startingLineCharIndex - effectiveRange: NULL]; - - if ([style alignment] == NSLeftTextAlignment) - { - } - else if ([style alignment] == NSRightTextAlignment) - { - usedLineRect.origin.x += - fragmentRect.size.width - usedLineRect.size.width - padding; - } - else if ([style alignment] == NSCenterTextAlignment) - { - usedLineRect.origin.x += - (int) (fragmentRect.size.width - usedLineRect.size.width) / 2; - } - } - - // This range is to small, as there are more lines that fit - // into the container - [self setTextContainer: aTextContainer - forGlyphRange: lineGlyphRange]; - - [self setLineFragmentRect: fragmentRect - forGlyphRange: lineGlyphRange - usedRect: usedLineRect]; - - // This range is too big, as there are different runs in the - // glyph range - [self setLocation: NSMakePoint(0.0, 0.0) - forStartOfGlyphRange: lineGlyphRange]; - - currentLineIndex++; - startingLineCharIndex = NSMaxRange(lineGlyphRange); - drawingPoint.y += usedLineRect.size.height; - drawingPoint.x = 0; - - RELEASE(pool); - - if (ghostArray != nil) - { - float yDisplacement = 0; - - // is it possible to simply patch layout changes into - // layout array instead of doing a time consuming re - - // layout of the whole doc? - if ([self _relocLayoutArray: ghostArray - offset: insertionDelta - floatTrift: &yDisplacement]) - { - unsigned erg; - - // y displacement: redisplay all remaining lines - if (yDisplacement) - { - erg = [_lineLayoutInfo count] - aLine; - } - else - { - // return 2: redisplay only this and previous line - erg = currentLineIndex - aLine; - } - - return NSMakeRange(aLine, MAX(1, erg)); - } - } - } - while ([lScanner isAtEnd] == NO); - } - - /* Now test for the special case - there is a newline at the end of - the text? The last newline is not displayed by the previous - engine, so we do it manually. */ - if ([newlines characterIsMember: [allText characterAtIndex: (length - 1)]]) - { - float width = 0; - if (aTextContainer) - width = [aTextContainer containerSize].width; - - { - NSParagraphStyle *style = - (NSParagraphStyle*)[_textStorage - attribute: NSParagraphStyleAttributeName - atIndex: length - 1 - effectiveRange: NULL]; - - if ([style alignment] == NSRightTextAlignment) - { - [_lineLayoutInfo - addObject: [_GNULineLayoutInfo - lineLayoutWithRange: NSMakeRange (length, 0) - rect: - NSMakeRect (drawingPoint.x - + (width - drawingPoint.x), - drawingPoint.y, - 1, defaultFontHeight ()) - usedRect: - NSMakeRect (drawingPoint.x - + (width - drawingPoint.x), - drawingPoint.y, - 1, defaultFontHeight ())]]; - } - else if ([style alignment] == NSCenterTextAlignment) - { - [_lineLayoutInfo - addObject: [_GNULineLayoutInfo - lineLayoutWithRange: NSMakeRange (length, 0) - rect: - NSMakeRect (drawingPoint.x - + (int)(width - drawingPoint.x) / 2, - drawingPoint.y, - 1, defaultFontHeight ()) - usedRect: - NSMakeRect (drawingPoint.x - + (int)(width - drawingPoint.x) / 2, - drawingPoint.y, - 1, defaultFontHeight ())]]; - } - else - { - [_lineLayoutInfo - addObject: [_GNULineLayoutInfo - lineLayoutWithRange: NSMakeRange (length, 0) - rect: NSMakeRect (drawingPoint.x, drawingPoint.y, - width, defaultFontHeight ()) - usedRect: NSMakeRect (drawingPoint.x, drawingPoint.y, - 1, defaultFontHeight ())]]; - } - } - } - - // lines actually updated (optimized drawing) - return NSMakeRange(aLine, MAX(1, [_lineLayoutInfo count] - aLine)); -} - - -/* Computing where the insertion point should be moved when the user - * presses 'Up' or 'Down' is a task for the layout manager. */ - -/* Insertion point has y coordinate `position'. We'd like to put it - one line up/down (up if upFlag == YES, down if upFlag == NO), - horizontally at `wanted', or the nearest available place. Return - the char index for the new insertion point position. */ -- (unsigned) _charIndexForInsertionPointMovingFromY: (float)position - bestX: (float)wanted - up: (BOOL)upFlag - textContainer: (NSTextContainer *)tc -{ - NSPoint point; - unsigned line; - _GNULineLayoutInfo *lineInfo; - NSRect rect; - NSRange range; - unsigned glyphIndex; - - /* Compute the line we were on */ - point.x = 0; - point.y = position; - - line = [self lineLayoutIndexForPoint: point]; - - if (upFlag == YES && line == 0) - { - return 0; - } - else if (upFlag == NO && line == ([_lineLayoutInfo count] - 1)) - { - return [_textStorage length]; - } - - /* Get line info for previous/following line */ - if (upFlag) - { - line -= 1; - } - else - { - line += 1; - } - - lineInfo = [_lineLayoutInfo objectAtIndex: line]; - - rect = lineInfo->usedRect; - range = lineInfo->glyphRange; - - /* Check if we are outside the rect */ - if (wanted <= rect.origin.x) - { - glyphIndex = [self characterIndexForGlyphAtIndex: range.location]; - } - - else if (wanted >= NSMaxX (rect)) - { - glyphIndex = [self characterIndexForGlyphAtIndex: - (NSMaxRange (range) - 1)]; - } - else - { - /* Else, we can simply move there ! */ - glyphIndex = [self glyphIndexForPoint: NSMakePoint (wanted, - NSMidY (rect)) - inTextContainer: tc - fractionOfDistanceThroughGlyph: NULL]; - } - return [self characterIndexForGlyphAtIndex: glyphIndex]; -} - -@end - diff --git a/Source/NSApplication.m b/Source/NSApplication.m index 22d4a3e11..482a777a1 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -30,64 +30,64 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" +#import "config.h" #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import #ifndef LIB_FOUNDATION_LIBRARY -# include +#include #endif -#include "AppKit/AppKitExceptions.h" -#include "AppKit/NSAlert.h" -#include "AppKit/NSApplication.h" -#include "AppKit/NSCell.h" -#include "AppKit/NSCursor.h" -#include "AppKit/NSDocumentController.h" -#include "AppKit/NSEvent.h" -#include "AppKit/NSFontManager.h" -#include "AppKit/NSImage.h" -#include "AppKit/NSMenu.h" -#include "AppKit/NSMenuItem.h" -#include "AppKit/NSNibLoading.h" -#include "AppKit/NSPageLayout.h" -#include "AppKit/NSPanel.h" -#include "AppKit/NSPasteboard.h" -#include "AppKit/NSToolbarItem.h" -#include "AppKit/NSWorkspace.h" -#include "AppKit/NSScreen.h" -#include "AppKit/PSOperators.h" +#import "AppKit/AppKitExceptions.h" +#import "AppKit/NSAlert.h" +#import "AppKit/NSApplication.h" +#import "AppKit/NSCell.h" +#import "AppKit/NSCursor.h" +#import "AppKit/NSDocumentController.h" +#import "AppKit/NSEvent.h" +#import "AppKit/NSFontManager.h" +#import "AppKit/NSImage.h" +#import "AppKit/NSMenu.h" +#import "AppKit/NSMenuItem.h" +#import "AppKit/NSNibLoading.h" +#import "AppKit/NSPageLayout.h" +#import "AppKit/NSPanel.h" +#import "AppKit/NSPasteboard.h" +#import "AppKit/NSToolbarItem.h" +#import "AppKit/NSWorkspace.h" +#import "AppKit/NSScreen.h" +#import "AppKit/PSOperators.h" -#include "GSIconManager.h" -#include "GNUstepGUI/GSDisplayServer.h" -#include "GNUstepGUI/GSServicesManager.h" -#include "GSGuiPrivate.h" -#include "GNUstepGUI/GSInfoPanel.h" -#include "GNUstepGUI/GSVersion.h" -#include "NSDocumentFrameworkPrivate.h" -#include "NSToolbarFrameworkPrivate.h" +#import "GSIconManager.h" +#import "GNUstepGUI/GSDisplayServer.h" +#import "GNUstepGUI/GSServicesManager.h" +#import "GSGuiPrivate.h" +#import "GNUstepGUI/GSInfoPanel.h" +#import "GNUstepGUI/GSVersion.h" +#import "NSDocumentFrameworkPrivate.h" +#import "NSToolbarFrameworkPrivate.h" // minimize icon when suppressed? #define MINI_ICON 0 diff --git a/Source/NSArrayController.m b/Source/NSArrayController.m index af9ff6b2d..0ac5da9be 100644 --- a/Source/NSArrayController.m +++ b/Source/NSArrayController.m @@ -27,10 +27,10 @@ */ -#include -#include -#include -#include +#import +#import +#import +#import "AppKit/NSArrayController.h" @implementation NSArrayController diff --git a/Source/NSAttributedString.m b/Source/NSAttributedString.m index bbb9fb13f..70935b662 100644 --- a/Source/NSAttributedString.m +++ b/Source/NSAttributedString.m @@ -28,34 +28,34 @@ Boston, MA 02110-1301, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import -#include "AppKit/NSAttributedString.h" -#include "AppKit/NSDocumentController.h" -#include "AppKit/NSParagraphStyle.h" -#include "AppKit/NSPasteboard.h" -#include "AppKit/NSTextAttachment.h" -#include "AppKit/NSColor.h" -#include "AppKit/NSFileWrapper.h" -#include "AppKit/NSFont.h" -#include "AppKit/NSFontManager.h" +#import "AppKit/NSAttributedString.h" +#import "AppKit/NSDocumentController.h" +#import "AppKit/NSParagraphStyle.h" +#import "AppKit/NSPasteboard.h" +#import "AppKit/NSTextAttachment.h" +#import "AppKit/NSColor.h" +#import "AppKit/NSFileWrapper.h" +#import "AppKit/NSFont.h" +#import "AppKit/NSFontManager.h" // For the colour name spaces -#include "AppKit/NSGraphics.h" +#import "AppKit/NSGraphics.h" #import "AppKit/NSTextTable.h" -#include "GNUstepGUI/GSTextConverter.h" -#include "GSGuiPrivate.h" +#import "GNUstepGUI/GSTextConverter.h" +#import "GSGuiPrivate.h" /* Cache class pointers to avoid the expensive lookup by string. */ static Class dictionaryClass = nil; diff --git a/Source/NSBitmapImageRep+GIF.h b/Source/NSBitmapImageRep+GIF.h index c5943c25e..9f3f69e4b 100644 --- a/Source/NSBitmapImageRep+GIF.h +++ b/Source/NSBitmapImageRep+GIF.h @@ -29,7 +29,7 @@ #ifndef _NSBitmapImageRep_GIF_H_include #define _NSBitmapImageRep_GIF_H_include -#include "AppKit/NSBitmapImageRep.h" +#import "AppKit/NSBitmapImageRep.h" @interface NSBitmapImageRep (GIFReading) diff --git a/Source/NSBitmapImageRep+GIF.m b/Source/NSBitmapImageRep+GIF.m index 3a3a534ed..dd429f6a8 100644 --- a/Source/NSBitmapImageRep+GIF.m +++ b/Source/NSBitmapImageRep+GIF.m @@ -29,9 +29,7 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" -#include "NSBitmapImageRep+GIF.h" -#include "GSGuiPrivate.h" +#import "config.h" #if HAVE_LIBUNGIF || HAVE_LIBGIF @@ -44,12 +42,14 @@ objective-c headers. #include #undef Object -#include -#include -#include -#include -#include "AppKit/NSGraphics.h" - +#import +#import +#import +#import +#import +#import "AppKit/NSGraphics.h" +#import "NSBitmapImageRep+GIF.h" +#import "GSGuiPrivate.h" /* ----------------------------------------------------------- The following types and functions are for interacting with diff --git a/Source/NSBitmapImageRep+ICNS.h b/Source/NSBitmapImageRep+ICNS.h index dbac85302..0e2a77c09 100644 --- a/Source/NSBitmapImageRep+ICNS.h +++ b/Source/NSBitmapImageRep+ICNS.h @@ -30,7 +30,7 @@ #ifndef _NSBitmapImageRep_ICNS_H_include #define _NSBitmapImageRep_ICNS_H_include -#include "AppKit/NSBitmapImageRep.h" +#import "AppKit/NSBitmapImageRep.h" @interface NSBitmapImageRep (ICNS) + (BOOL) _bitmapIsICNS: (NSData *)imageData; diff --git a/Source/NSBitmapImageRep+ICNS.m b/Source/NSBitmapImageRep+ICNS.m index 679562197..cdbd3c04d 100644 --- a/Source/NSBitmapImageRep+ICNS.m +++ b/Source/NSBitmapImageRep+ICNS.m @@ -30,14 +30,14 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" -#include "NSBitmapImageRep+ICNS.h" -#include -#include -#include -#include -#include "AppKit/NSGraphics.h" -#include "GSGuiPrivate.h" +#import "config.h" +#import "NSBitmapImageRep+ICNS.h" +#import +#import +#import +#import +#import "AppKit/NSGraphics.h" +#import "GSGuiPrivate.h" #define ICNS_HEADER "icns" diff --git a/Source/NSBitmapImageRep+JPEG.h b/Source/NSBitmapImageRep+JPEG.h index 598236a1e..12e89d370 100644 --- a/Source/NSBitmapImageRep+JPEG.h +++ b/Source/NSBitmapImageRep+JPEG.h @@ -29,7 +29,7 @@ #ifndef _NSBitmapImageRep_JPEG_H_include #define _NSBitmapImageRep_JPEG_H_include -#include "AppKit/NSBitmapImageRep.h" +#import "AppKit/NSBitmapImageRep.h" @interface NSBitmapImageRep (JPEGReading) diff --git a/Source/NSBitmapImageRep+JPEG.m b/Source/NSBitmapImageRep+JPEG.m index 9caec3253..a31385477 100644 --- a/Source/NSBitmapImageRep+JPEG.m +++ b/Source/NSBitmapImageRep+JPEG.m @@ -26,17 +26,18 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" -#include "NSBitmapImageRep+JPEG.h" +#import "config.h" #if HAVE_LIBJPEG -#include -#include -#include -#include -#include "AppKit/NSGraphics.h" -#include "GSGuiPrivate.h" +#import +#import +#import +#import +#import +#import "AppKit/NSGraphics.h" +#import "NSBitmapImageRep+JPEG.h" +#import "GSGuiPrivate.h" #include #if defined(__MINGW32__) @@ -52,7 +53,7 @@ typedef int jpeg_boolean; #define boolean jpeg_boolean #endif -#endif +#endif // __MINGW32__ #include #if defined(__CYGWIN__) /* Cygwin uses a patched jpeg */ diff --git a/Source/NSBitmapImageRep+PNG.h b/Source/NSBitmapImageRep+PNG.h index 1db6280bd..f9deaf683 100644 --- a/Source/NSBitmapImageRep+PNG.h +++ b/Source/NSBitmapImageRep+PNG.h @@ -30,7 +30,7 @@ #ifndef _NSBitmapImageRep_PNG_H_include #define _NSBitmapImageRep_PNG_H_include -#include "AppKit/NSBitmapImageRep.h" +#import "AppKit/NSBitmapImageRep.h" @interface NSBitmapImageRep (PNG) + (BOOL) _bitmapIsPNG: (NSData *)imageData; diff --git a/Source/NSBitmapImageRep+PNG.m b/Source/NSBitmapImageRep+PNG.m index c8b42ac9c..5c99b8711 100644 --- a/Source/NSBitmapImageRep+PNG.m +++ b/Source/NSBitmapImageRep+PNG.m @@ -27,8 +27,7 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" -#include "NSBitmapImageRep+PNG.h" +#import "config.h" #if HAVE_LIBPNG @@ -38,10 +37,13 @@ #include #endif -#include -#include -#include -#include "AppKit/NSGraphics.h" +#import +#import +#import +#import +#import +#import "AppKit/NSGraphics.h" +#import "NSBitmapImageRep+PNG.h" #if defined(PNG_FLOATING_POINT_SUPPORT) # define PNG_FLOATING_POINT 1 diff --git a/Source/NSBitmapImageRep+PNM.h b/Source/NSBitmapImageRep+PNM.h index 05d7f0ee1..05377dfe0 100644 --- a/Source/NSBitmapImageRep+PNM.h +++ b/Source/NSBitmapImageRep+PNM.h @@ -29,7 +29,7 @@ #ifndef _NSBitmapImageRep_PNM_H_include #define _NSBitmapImageRep_PNM_H_include -#include "AppKit/NSBitmapImageRep.h" +#import "AppKit/NSBitmapImageRep.h" @interface NSBitmapImageRep (PNM) diff --git a/Source/NSBitmapImageRep+PNM.m b/Source/NSBitmapImageRep+PNM.m index a4285a5d6..9e4708f42 100644 --- a/Source/NSBitmapImageRep+PNM.m +++ b/Source/NSBitmapImageRep+PNM.m @@ -26,10 +26,10 @@ Boston, MA 02110-1301, USA. */ -#include "NSBitmapImageRep+PNM.h" - -#include -#include "AppKit/NSGraphics.h" +#import +#import +#import "AppKit/NSGraphics.h" +#import "NSBitmapImageRep+PNM.h" @implementation NSBitmapImageRep (PNM) diff --git a/Source/NSBitmapImageRep.m b/Source/NSBitmapImageRep.m index 49ab821e7..f32446e33 100644 --- a/Source/NSBitmapImageRep.m +++ b/Source/NSBitmapImageRep.m @@ -26,32 +26,32 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" +#import "config.h" + #include #include #include -#include "AppKit/NSBitmapImageRep.h" +#import +#import +#import +#import +#import +#import +#import +#import "AppKit/AppKitExceptions.h" +#import "AppKit/NSGraphics.h" +#import "AppKit/NSGraphicsContext.h" +#import "AppKit/NSPasteboard.h" +#import "AppKit/NSView.h" +#import "AppKit/NSBitmapImageRep.h" -#include "NSBitmapImageRep+GIF.h" -#include "NSBitmapImageRep+JPEG.h" -#include "NSBitmapImageRep+PNG.h" -#include "NSBitmapImageRep+PNM.h" -#include "NSBitmapImageRep+ICNS.h" - -#include -#include -#include -#include -#include -#include -#include -#include "AppKit/AppKitExceptions.h" -#include "AppKit/NSGraphics.h" -#include "AppKit/NSGraphicsContext.h" -#include "AppKit/NSPasteboard.h" -#include "AppKit/NSView.h" -#include "GSGuiPrivate.h" +#import "NSBitmapImageRep+GIF.h" +#import "NSBitmapImageRep+JPEG.h" +#import "NSBitmapImageRep+PNG.h" +#import "NSBitmapImageRep+PNM.h" +#import "NSBitmapImageRep+ICNS.h" +#import "GSGuiPrivate.h" #include "nsimage-tiff.h" diff --git a/Source/NSBox.m b/Source/NSBox.m index 30528f920..175ca8886 100644 --- a/Source/NSBox.m +++ b/Source/NSBox.m @@ -27,20 +27,20 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" -#include -#include -#include -#include -#include -#include +#import "config.h" +#import +#import +#import +#import +#import +#import -#include "AppKit/NSBox.h" -#include "AppKit/NSColor.h" -#include "AppKit/NSGraphics.h" -#include "AppKit/NSTextFieldCell.h" -#include "AppKit/NSWindow.h" -#include "GNUstepGUI/GSTheme.h" +#import "AppKit/NSBox.h" +#import "AppKit/NSColor.h" +#import "AppKit/NSGraphics.h" +#import "AppKit/NSTextFieldCell.h" +#import "AppKit/NSWindow.h" +#import "GNUstepGUI/GSTheme.h" #include diff --git a/Source/NSBrowserCell.m b/Source/NSBrowserCell.m index f6248abae..852a70e49 100644 --- a/Source/NSBrowserCell.m +++ b/Source/NSBrowserCell.m @@ -28,18 +28,18 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" +#import "config.h" -#include +#import -#include "AppKit/NSBrowserCell.h" -#include "AppKit/NSColor.h" -#include "AppKit/NSFont.h" -#include "AppKit/NSImage.h" -#include "AppKit/NSGraphics.h" -#include "AppKit/NSEvent.h" -#include "AppKit/NSWindow.h" -#include "GSGuiPrivate.h" +#import "AppKit/NSBrowserCell.h" +#import "AppKit/NSColor.h" +#import "AppKit/NSFont.h" +#import "AppKit/NSImage.h" +#import "AppKit/NSGraphics.h" +#import "AppKit/NSEvent.h" +#import "AppKit/NSWindow.h" +#import "GSGuiPrivate.h" /* * Class variables diff --git a/Source/NSButtonImageSource.h b/Source/NSButtonImageSource.h index 093c47565..3112deb53 100644 --- a/Source/NSButtonImageSource.h +++ b/Source/NSButtonImageSource.h @@ -28,10 +28,10 @@ #ifndef _GNUstep_H_NSImageSource #define _GNUstep_H_NSImageSource -#include -#include -#include -#include +#import +#import +#import +#import /** * Handle images for button cell theming. diff --git a/Source/NSButtonImageSource.m b/Source/NSButtonImageSource.m index 48719e52a..246d80466 100644 --- a/Source/NSButtonImageSource.m +++ b/Source/NSButtonImageSource.m @@ -25,7 +25,7 @@ Boston, MA 02110-1301, USA. */ -#include "NSButtonImageSource.h" +#import "NSButtonImageSource.h" @implementation NSButtonImageSource diff --git a/Source/NSCachedImageRep.m b/Source/NSCachedImageRep.m index b4e250595..3f55b74ae 100644 --- a/Source/NSCachedImageRep.m +++ b/Source/NSCachedImageRep.m @@ -35,17 +35,17 @@ // for fabs() #include -#include "config.h" -#include -#include -#include +#import "config.h" +#import +#import +#import -#include "AppKit/NSAffineTransform.h" -#include "AppKit/NSBitmapImageRep.h" -#include "AppKit/NSCachedImageRep.h" -#include "AppKit/NSView.h" -#include "AppKit/NSWindow.h" -#include "AppKit/PSOperators.h" +#import "AppKit/NSAffineTransform.h" +#import "AppKit/NSBitmapImageRep.h" +#import "AppKit/NSCachedImageRep.h" +#import "AppKit/NSView.h" +#import "AppKit/NSWindow.h" +#import "AppKit/PSOperators.h" @interface GSCacheW : NSWindow @end diff --git a/Source/NSClipView.m b/Source/NSClipView.m index 32f28af52..6126e82a6 100644 --- a/Source/NSClipView.m +++ b/Source/NSClipView.m @@ -26,21 +26,21 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" -#include -#include +#import "config.h" +#import +#import -#include "AppKit/NSClipView.h" -#include "AppKit/NSCursor.h" -#include "AppKit/NSColor.h" -#include "AppKit/NSEvent.h" -#include "AppKit/NSGraphics.h" -#include "AppKit/NSTableView.h" -#include "AppKit/NSWindow.h" -#include "AppKit/PSOperators.h" +#import "AppKit/NSClipView.h" +#import "AppKit/NSCursor.h" +#import "AppKit/NSColor.h" +#import "AppKit/NSEvent.h" +#import "AppKit/NSGraphics.h" +#import "AppKit/NSTableView.h" +#import "AppKit/NSWindow.h" +#import "AppKit/PSOperators.h" -#include -#include "GSGuiPrivate.h" +#import +#import "GSGuiPrivate.h" #include diff --git a/Source/NSColorList.m b/Source/NSColorList.m index 5aea20e0c..8e5cd1884 100644 --- a/Source/NSColorList.m +++ b/Source/NSColorList.m @@ -28,22 +28,22 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#import "config.h" +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import -#include "AppKit/NSColorList.h" -#include "AppKit/NSColor.h" -#include "AppKit/AppKitExceptions.h" +#import "AppKit/NSColorList.h" +#import "AppKit/NSColor.h" +#import "AppKit/AppKitExceptions.h" // The list of available color lists is cached and re-loaded only // after a time. diff --git a/Source/NSColorPicker.m b/Source/NSColorPicker.m index 24d4380d0..4d53537ef 100644 --- a/Source/NSColorPicker.m +++ b/Source/NSColorPicker.m @@ -28,11 +28,14 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" -#include -#include "AppKit/NSButtonCell.h" -#include "AppKit/NSColorPicker.h" -#include "AppKit/NSImage.h" +#import "config.h" +#import +#import +#import "AppKit/NSButtonCell.h" +#import "AppKit/NSColorList.h" +#import "AppKit/NSColorPanel.h" +#import "AppKit/NSColorPicker.h" +#import "AppKit/NSImage.h" @implementation NSColorPicker diff --git a/Source/NSMenu.m b/Source/NSMenu.m index 0683dff04..e1c5c3750 100644 --- a/Source/NSMenu.m +++ b/Source/NSMenu.m @@ -118,6 +118,7 @@ { NSMenu *_the_menu; } +- (void) _setmenu: (NSMenu *)menu; @end @interface NSMenuView (GNUstepPrivate) @@ -140,6 +141,7 @@ static BOOL menuBarVisible = YES; - (void) _rightMouseDisplay: (NSEvent*)theEvent; - (void) _setGeometry; - (void) _updateUserDefaults: (id) notification; +- (void) _organizeMenu; @end diff --git a/Source/NSScreen.m b/Source/NSScreen.m index 3b7f2a5d5..877a01398 100644 --- a/Source/NSScreen.m +++ b/Source/NSScreen.m @@ -27,15 +27,22 @@ Boston, MA 02110-1301, USA. */ -#include -#include "AppKit/AppKitExceptions.h" -#include "AppKit/NSApplication.h" -#include "AppKit/NSInterfaceStyle.h" -#include "AppKit/NSMenu.h" -#include "AppKit/NSMenuView.h" -#include "AppKit/NSScreen.h" -#include "AppKit/NSWindow.h" -#include "GNUstepGUI/GSDisplayServer.h" +#import +#import +#import +#import +#import +#import +#import +#import +#import "AppKit/AppKitExceptions.h" +#import "AppKit/NSApplication.h" +#import "AppKit/NSInterfaceStyle.h" +#import "AppKit/NSMenu.h" +#import "AppKit/NSMenuView.h" +#import "AppKit/NSScreen.h" +#import "AppKit/NSWindow.h" +#import "GNUstepGUI/GSDisplayServer.h" @interface NSScreen (Private) - (id) _initWithScreenNumber: (int)screen; diff --git a/Source/NSTabView.m b/Source/NSTabView.m index b12f4a8dd..ec09bf424 100644 --- a/Source/NSTabView.m +++ b/Source/NSTabView.m @@ -26,18 +26,18 @@ Boston, MA 02110-1301, USA. */ -#include "AppKit/NSColor.h" -#include "AppKit/NSEvent.h" -#include "AppKit/NSFont.h" -#include "AppKit/NSForm.h" -#include "AppKit/NSGraphics.h" -#include "AppKit/NSImage.h" -#include "AppKit/NSMatrix.h" -#include "AppKit/NSTabView.h" -#include "AppKit/NSTabViewItem.h" -#include "AppKit/NSWindow.h" -#include "AppKit/PSOperators.h" -#include "GNUstepGUI/GSTheme.h" +#import "AppKit/NSColor.h" +#import "AppKit/NSEvent.h" +#import "AppKit/NSFont.h" +#import "AppKit/NSForm.h" +#import "AppKit/NSGraphics.h" +#import "AppKit/NSImage.h" +#import "AppKit/NSMatrix.h" +#import "AppKit/NSTabView.h" +#import "AppKit/NSTabViewItem.h" +#import "AppKit/NSWindow.h" +#import "AppKit/PSOperators.h" +#import "GNUstepGUI/GSTheme.h" @implementation NSTabView diff --git a/Source/NSTabViewItem.m b/Source/NSTabViewItem.m index cd820dccc..4d1845afa 100644 --- a/Source/NSTabViewItem.m +++ b/Source/NSTabViewItem.m @@ -30,6 +30,7 @@ #import "AppKit/NSGraphics.h" #import "AppKit/NSImage.h" #import "AppKit/NSStringDrawing.h" +#import "AppKit/NSTabView.h" #import "AppKit/NSTabViewItem.h" #import "AppKit/PSOperators.h" diff --git a/Source/NSView.m b/Source/NSView.m index e55aa31f6..1a553b1f9 100644 --- a/Source/NSView.m +++ b/Source/NSView.m @@ -32,52 +32,52 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" +#import "config.h" #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import -#include "AppKit/NSAffineTransform.h" -#include "AppKit/NSApplication.h" -#include "AppKit/NSBezierPath.h" -#include "AppKit/NSBitmapImageRep.h" -#include "AppKit/NSCursor.h" -#include "AppKit/NSDocumentController.h" -#include "AppKit/NSDocument.h" -#include "AppKit/NSClipView.h" -#include "AppKit/NSFont.h" -#include "AppKit/NSGraphics.h" -#include "AppKit/NSKeyValueBinding.h" -#include "AppKit/NSMenu.h" -#include "AppKit/NSPasteboard.h" -#include "AppKit/NSPrintInfo.h" -#include "AppKit/NSPrintOperation.h" -#include "AppKit/NSScrollView.h" -#include "AppKit/NSView.h" -#include "AppKit/NSWindow.h" -#include "AppKit/NSWorkspace.h" -#include "AppKit/PSOperators.h" -#include "GNUstepGUI/GSDisplayServer.h" -#include "GNUstepGUI/GSTrackingRect.h" -#include "GNUstepGUI/GSNibLoading.h" -#include "GSToolTips.h" -#include "GSBindingHelpers.h" -#include "GSGuiPrivate.h" +#import "AppKit/NSAffineTransform.h" +#import "AppKit/NSApplication.h" +#import "AppKit/NSBezierPath.h" +#import "AppKit/NSBitmapImageRep.h" +#import "AppKit/NSCursor.h" +#import "AppKit/NSDocumentController.h" +#import "AppKit/NSDocument.h" +#import "AppKit/NSClipView.h" +#import "AppKit/NSFont.h" +#import "AppKit/NSGraphics.h" +#import "AppKit/NSKeyValueBinding.h" +#import "AppKit/NSMenu.h" +#import "AppKit/NSPasteboard.h" +#import "AppKit/NSPrintInfo.h" +#import "AppKit/NSPrintOperation.h" +#import "AppKit/NSScrollView.h" +#import "AppKit/NSView.h" +#import "AppKit/NSWindow.h" +#import "AppKit/NSWorkspace.h" +#import "AppKit/PSOperators.h" +#import "GNUstepGUI/GSDisplayServer.h" +#import "GNUstepGUI/GSTrackingRect.h" +#import "GNUstepGUI/GSNibLoading.h" +#import "GSToolTips.h" +#import "GSBindingHelpers.h" +#import "GSGuiPrivate.h" /* * We need a fast array that can store objects without retain/release ... diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 46abb9c7f..334ce44d2 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -31,62 +31,62 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" +#import "config.h" #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import -#include "AppKit/NSApplication.h" -#include "AppKit/NSButton.h" -#include "AppKit/NSButtonCell.h" -#include "AppKit/NSCachedImageRep.h" -#include "AppKit/NSColor.h" -#include "AppKit/NSColorList.h" -#include "AppKit/NSCursor.h" -#include "AppKit/NSDocumentController.h" -#include "AppKit/NSDocument.h" -#include "AppKit/NSDragging.h" -#include "AppKit/NSEvent.h" -#include "AppKit/NSFont.h" -#include "AppKit/NSGraphics.h" -#include "AppKit/NSHelpManager.h" -#include "AppKit/NSKeyValueBinding.h" -#include "AppKit/NSImage.h" -#include "AppKit/NSMenu.h" -#include "AppKit/NSPasteboard.h" -#include "AppKit/NSScreen.h" -#include "AppKit/NSTextField.h" -#include "AppKit/NSTextFieldCell.h" -#include "AppKit/NSView.h" -#include "AppKit/NSWindow.h" -#include "AppKit/NSWindowController.h" -#include "GSBindingHelpers.h" -#include "AppKit/PSOperators.h" -#include "GNUstepGUI/GSTheme.h" -#include "GNUstepGUI/GSTrackingRect.h" -#include "GNUstepGUI/GSDisplayServer.h" -#include "GSGuiPrivate.h" -#include "GSToolTips.h" -#include "GSIconManager.h" -#include "NSToolbarFrameworkPrivate.h" +#import "AppKit/NSApplication.h" +#import "AppKit/NSButton.h" +#import "AppKit/NSButtonCell.h" +#import "AppKit/NSCachedImageRep.h" +#import "AppKit/NSColor.h" +#import "AppKit/NSColorList.h" +#import "AppKit/NSCursor.h" +#import "AppKit/NSDocumentController.h" +#import "AppKit/NSDocument.h" +#import "AppKit/NSDragging.h" +#import "AppKit/NSEvent.h" +#import "AppKit/NSFont.h" +#import "AppKit/NSGraphics.h" +#import "AppKit/NSHelpManager.h" +#import "AppKit/NSKeyValueBinding.h" +#import "AppKit/NSImage.h" +#import "AppKit/NSMenu.h" +#import "AppKit/NSPasteboard.h" +#import "AppKit/NSScreen.h" +#import "AppKit/NSTextField.h" +#import "AppKit/NSTextFieldCell.h" +#import "AppKit/NSView.h" +#import "AppKit/NSWindow.h" +#import "AppKit/NSWindowController.h" +#import "GSBindingHelpers.h" +#import "AppKit/PSOperators.h" +#import "GNUstepGUI/GSTheme.h" +#import "GNUstepGUI/GSTrackingRect.h" +#import "GNUstepGUI/GSDisplayServer.h" +#import "GSGuiPrivate.h" +#import "GSToolTips.h" +#import "GSIconManager.h" +#import "NSToolbarFrameworkPrivate.h" -#include +#import #define GSI_ARRAY_TYPES 0 #define GSI_ARRAY_TYPE NSWindow * diff --git a/Source/NSWorkspace.m b/Source/NSWorkspace.m index 46b28dbe2..43c0adad8 100644 --- a/Source/NSWorkspace.m +++ b/Source/NSWorkspace.m @@ -30,7 +30,7 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" +#import "config.h" #if defined(HAVE_GETMNTENT) && defined (MNT_MEMB) #if defined(HAVE_MNTENT_H) @@ -42,37 +42,37 @@ #endif #endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "AppKit/NSWorkspace.h" -#include "AppKit/NSApplication.h" -#include "AppKit/NSImage.h" -#include "AppKit/NSPasteboard.h" -#include "AppKit/NSView.h" -#include "AppKit/NSPanel.h" -#include "AppKit/NSWindow.h" -#include "AppKit/NSScreen.h" -#include "GNUstepGUI/GSServicesManager.h" -#include "GNUstepGUI/GSDisplayServer.h" -#include "GSGuiPrivate.h" +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import "AppKit/NSWorkspace.h" +#import "AppKit/NSApplication.h" +#import "AppKit/NSImage.h" +#import "AppKit/NSPasteboard.h" +#import "AppKit/NSView.h" +#import "AppKit/NSPanel.h" +#import "AppKit/NSWindow.h" +#import "AppKit/NSScreen.h" +#import "GNUstepGUI/GSServicesManager.h" +#import "GNUstepGUI/GSDisplayServer.h" +#import "GSGuiPrivate.h" /* Informal protocol for method to ask an app to open a URL. */ diff --git a/Source/externs.m b/Source/externs.m index 3f261c6c9..de2456cee 100644 --- a/Source/externs.m +++ b/Source/externs.m @@ -27,9 +27,9 @@ Boston, MA 02110-1301, USA. */ -#include "config.h" -#include -#include "AppKit/NSEvent.h" +#import "config.h" +#import +#import "AppKit/NSEvent.h" // Global strings NSString *NSModalPanelRunLoopMode = @"ModalPanelMode";