diff --git a/ChangeLog b/ChangeLog index 65847f84a..cbdb0d291 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-02-16 15:51 Alexander Malmberg + + * Source/NSLayoutManager.m: Bring back the old implementation of + -rulerMarkersForTextView:paragraphStyle:ruler:. + Sun Feb 16 14:54:50 2003 Nicola Pero * Source/NSSplitView.m ([-mouseDown:]): Corrected offset used in diff --git a/Source/NSLayoutManager.m b/Source/NSLayoutManager.m index 93d8ac71c..456cde34f 100644 --- a/Source/NSLayoutManager.m +++ b/Source/NSLayoutManager.m @@ -1,10 +1,18 @@ /* NSLayoutManager.m - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. Author: Alexander Malmberg - Date: 2002 + Date: November 2002 - February 2003 + + Parts based on the old NSLayoutManager.m: + Author: Jonathan Gapen + Date: July 1999 + Author: Michael Hanni + Date: August 1999 + Author: Richard Frith-Macdonald + Date: January 2001 This file is part of the GNUstep GUI Library. @@ -50,6 +58,9 @@ Need to figure out how to handle it. #include #include +#include +#include +#include #include #include #include @@ -1435,11 +1446,46 @@ for (i = 0; i < gbuf_len; i++) printf(" %3i : %04x\n", i, gbuf[i]); */ -(NSArray *) rulerMarkersForTextView: (NSTextView *)textView - paragraphStyle: (NSParagraphStyle *)style - ruler: (NSRulerView *)ruler + paragraphStyle: (NSParagraphStyle *)paragraphStyle + ruler: (NSRulerView *)aRulerView { - /* TODO */ - return nil; + NSRulerMarker *marker; + NSTextTab *tab; + NSImage *image; + NSArray *tabs = [paragraphStyle tabStops]; + NSEnumerator *enumerator = [tabs objectEnumerator]; + NSMutableArray *markers = [NSMutableArray arrayWithCapacity: [tabs count]]; + + while ((tab = [enumerator nextObject]) != nil) + { + switch ([tab tabStopType]) + { + case NSLeftTabStopType: + image = [NSImage imageNamed: @"common_LeftTabStop"]; + break; + case NSRightTabStopType: + image = [NSImage imageNamed: @"common_RightTabStop"]; + break; + case NSCenterTabStopType: + image = [NSImage imageNamed: @"common_CenterTabStop"]; + break; + case NSDecimalTabStopType: + image = [NSImage imageNamed: @"common_DecimalTabStop"]; + break; + default: + image = nil; + break; + } + marker = [[NSRulerMarker alloc] + initWithRulerView: aRulerView + markerLocation: [tab location] + image: image + imageOrigin: NSMakePoint(0, 0)]; + [marker setRepresentedObject: tab]; + [markers addObject: marker]; + } + + return markers; } -(NSView *) rulerAccessoryViewForTextView: (NSTextView *)textView