mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-26 01:11:09 +00:00
Fixed problems galore. :-)
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4599 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9edbf40969
commit
34b2d4f4e1
8 changed files with 593 additions and 57 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
1999-07-15 Michael Hanni <mhanni@sprintmail.com>
|
||||||
|
|
||||||
|
* Source/NSLayoutManager.m: new file from
|
||||||
|
jagapen@whitewater.chem.wisc.edu
|
||||||
|
* Source/NSTextView.m: initWithFrame: now creates a proper NSText
|
||||||
|
network.
|
||||||
|
|
||||||
Thu Jul 15 18:00:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
Thu Jul 15 18:00:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
* Source/NSView.m: Make sure cursor and tracking rects are converted
|
* Source/NSView.m: Make sure cursor and tracking rects are converted
|
||||||
|
|
|
@ -37,10 +37,11 @@
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <AppKit/NSFont.h>
|
#import <AppKit/NSFont.h>
|
||||||
|
|
||||||
@class NSTextStorage;
|
#import <AppKit/NSTextStorage.h>
|
||||||
|
#import <AppKit/NSTextContainer.h>
|
||||||
|
|
||||||
@class NSTypesetter;
|
@class NSTypesetter;
|
||||||
@class NSGlyphGenerator;
|
@class NSGlyphGenerator;
|
||||||
@class NSTextContainer;
|
|
||||||
@class NSTextView;
|
@class NSTextView;
|
||||||
@class NSWindow;
|
@class NSWindow;
|
||||||
@class NSColor;
|
@class NSColor;
|
||||||
|
@ -77,69 +78,77 @@ typedef enum {
|
||||||
} NSGlyphInscription;
|
} NSGlyphInscription;
|
||||||
|
|
||||||
@interface NSLayoutManager : NSObject
|
@interface NSLayoutManager : NSObject
|
||||||
{ NSTextStorage *textStorage;
|
{
|
||||||
NSGlyphGenerator *glyphGenerator;
|
NSTextStorage *_textStorage;
|
||||||
NSTypesetter *typesetter;
|
NSGlyphGenerator *_glyphGenerator;
|
||||||
|
NSTypesetter *_typesetter;
|
||||||
|
|
||||||
NSMutableArray *textContainers;
|
NSMutableArray *_textContainers;
|
||||||
NSStorage *containerUsedRects;
|
NSStorage *_containerUsedRects;
|
||||||
|
|
||||||
NSStorage *glyphs;
|
NSStorage *_glyphs;
|
||||||
NSRunStorage *containerRuns;
|
NSRunStorage *_containerRuns;
|
||||||
NSRunStorage *fragmentRuns;
|
NSRunStorage *_fragmentRuns;
|
||||||
NSRunStorage *glyphLocations;
|
NSRunStorage *_glyphLocations;
|
||||||
NSRunStorage *glyphRotationRuns;
|
NSRunStorage *_glyphRotationRuns;
|
||||||
|
|
||||||
NSRect extraLineFragmentRect;
|
NSRect _extraLineFragmentRect;
|
||||||
NSRect extraLineFragmentUsedRect;
|
NSRect _extraLineFragmentUsedRect;
|
||||||
NSTextContainer *extraLineFragmentContainer;
|
NSTextContainer *_extraLineFragmentContainer;
|
||||||
|
|
||||||
NSSortedArray *glyphHoles;
|
NSSortedArray *_glyphHoles;
|
||||||
NSSortedArray *layoutHoles;
|
NSSortedArray *_layoutHoles;
|
||||||
|
|
||||||
id delegate;
|
id _delegate;
|
||||||
|
|
||||||
// Enable/disable stacks
|
// Enable/disable stacks
|
||||||
unsigned short textViewResizeDisableStack;
|
unsigned short _textViewResizeDisableStack;
|
||||||
unsigned short displayInvalidationDisableStack;
|
unsigned short _displayInvalidationDisableStack;
|
||||||
NSRange deferredDisplayCharRange;
|
NSRange _deferredDisplayCharRange;
|
||||||
|
|
||||||
// Cache for first text view (that is text view of the first text container which has one) (Cost: 4 bytes)
|
// Cache for first text view (that is text view of the first text container which has one) (Cost: 4 bytes)
|
||||||
NSTextView *firstTextView;
|
NSTextView *_firstTextView;
|
||||||
|
|
||||||
// Cache for rectangle arrays (Cost: 8 bytes + malloced 16 * <max number of rects returned in an array> bytes)
|
// Cache for rectangle arrays (Cost: 8 bytes + malloced 16 * <max number of rects returned in an array> bytes)
|
||||||
NSRect *cachedRectArray;
|
NSRect *_cachedRectArray;
|
||||||
unsigned cachedRectArrayCapacity;
|
unsigned _cachedRectArrayCapacity;
|
||||||
|
|
||||||
// Cache for glyph strings (used when drawing) (Cost: 8 bytes + malloced glyph buffer size)
|
// Cache for glyph strings (used when drawing) (Cost: 8 bytes + malloced glyph buffer size)
|
||||||
char *glyphBuffer;
|
char *_glyphBuffer;
|
||||||
unsigned glyphBufferSize;
|
unsigned _glyphBufferSize;
|
||||||
|
|
||||||
// Cache for faster glyph location lookup (Cost: 20 bytes)
|
// Cache for faster glyph location lookup (Cost: 20 bytes)
|
||||||
NSRange cachedLocationNominalGlyphRange;
|
NSRange _cachedLocationNominalGlyphRange;
|
||||||
unsigned cachedLocationGlyphIndex;
|
unsigned _cachedLocationGlyphIndex;
|
||||||
NSPoint cachedLocation;
|
NSPoint _cachedLocation;
|
||||||
|
|
||||||
// Cache for faster glyph location lookup (Cost: 12 bytes)
|
// Cache for faster glyph location lookup (Cost: 12 bytes)
|
||||||
NSRange cachedFontCharRange;
|
NSRange _cachedFontCharRange;
|
||||||
NSFont *cachedFont;
|
NSFont *_cachedFont;
|
||||||
|
|
||||||
// Cache for first unlaid glypha and character (Cost: 8 bytes)
|
// Cache for first unlaid glypha and character (Cost: 8 bytes)
|
||||||
unsigned firstUnlaidGlyphIndex;
|
unsigned _firstUnlaidGlyphIndex;
|
||||||
unsigned firstUnlaidCharIndex;
|
unsigned _firstUnlaidCharIndex;
|
||||||
|
|
||||||
// Outlets for ruler accessory view.
|
// Outlets for ruler accessory view.
|
||||||
NSBox *rulerAccView;
|
NSBox *_rulerAccView;
|
||||||
NSMatrix *rulerAccViewAlignmentButtons;
|
NSMatrix *_rulerAccViewAlignmentButtons;
|
||||||
NSTextField *rulerAccViewLeadingField;
|
NSTextField *_rulerAccViewLeadingField;
|
||||||
NSTabWell *rulerAccViewLeftTabWell;
|
NSTabWell *_rulerAccViewLeftTabWell;
|
||||||
NSTabWell *rulerAccViewRightTabWell;
|
NSTabWell *_rulerAccViewRightTabWell;
|
||||||
NSTabWell *rulerAccViewCenterTabWell;
|
NSTabWell *_rulerAccViewCenterTabWell;
|
||||||
NSTabWell *rulerAccViewDecimalTabWell;
|
NSTabWell *_rulerAccViewDecimalTabWell;
|
||||||
NSMatrix *rulerAccViewIncrementLineHeightButtons;
|
NSMatrix *_rulerAccViewIncrementLineHeightButtons;
|
||||||
NSMatrix *rulerAccViewFixedLineHeightButtons;
|
NSMatrix *_rulerAccViewFixedLineHeightButtons;
|
||||||
|
|
||||||
NSRange newlyFilledGlyphRange;
|
NSRange _newlyFilledGlyphRange;
|
||||||
|
|
||||||
|
// Michael additions.
|
||||||
|
BOOL _backgroundLayout;
|
||||||
|
BOOL _showsInvisibleChars;
|
||||||
|
BOOL _showsControlChars;
|
||||||
|
float _hyphenationFactor;
|
||||||
|
BOOL _usesScreenFonts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************** Initialization ****************************/
|
/**************************** Initialization ****************************/
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <AppKit/NSTextView.h>
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NSLineSweepLeft,
|
NSLineSweepLeft,
|
||||||
|
|
Binary file not shown.
|
@ -77,6 +77,7 @@ NSImageCell.m \
|
||||||
NSImageRep.m \
|
NSImageRep.m \
|
||||||
NSImageView.m \
|
NSImageView.m \
|
||||||
NSInterfaceStyle.m \
|
NSInterfaceStyle.m \
|
||||||
|
NSLayoutManager.m \
|
||||||
NSMatrix.m \
|
NSMatrix.m \
|
||||||
NSMenu.m \
|
NSMenu.m \
|
||||||
NSMenuView.m \
|
NSMenuView.m \
|
||||||
|
|
519
Source/NSLayoutManager.m
Normal file
519
Source/NSLayoutManager.m
Normal file
|
@ -0,0 +1,519 @@
|
||||||
|
/*
|
||||||
|
NSLayoutManager.m
|
||||||
|
|
||||||
|
The text layout manager class
|
||||||
|
|
||||||
|
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Author: Jonathan Gapen <jagapen@smithlab.chem.wisc.edu>
|
||||||
|
Date: July 1999
|
||||||
|
|
||||||
|
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 Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this library; see the file COPYING.LIB.
|
||||||
|
If not, write to the Free Software Foundation,
|
||||||
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
#include <AppKit/NSLayoutManager.h>
|
||||||
|
|
||||||
|
@implementation NSLayoutManager
|
||||||
|
|
||||||
|
- (id) init
|
||||||
|
{
|
||||||
|
[super init];
|
||||||
|
_backgroundLayout = YES;
|
||||||
|
_delegate = nil;
|
||||||
|
_textContainers = [[NSMutableArray alloc] initWithCapacity: 2];
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setting the text storage
|
||||||
|
//
|
||||||
|
- (void)setTextStorage: (NSTextStorage *)aTextStorage
|
||||||
|
{
|
||||||
|
ASSIGN(_textStorage, aTextStorage);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSTextStorage *)textStorage
|
||||||
|
{
|
||||||
|
return _textStorage;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)replaceTextStorage: (NSTextStorage *)newTextStorage
|
||||||
|
{
|
||||||
|
NSArray *layoutManagers = [_textStorage layoutManagers];
|
||||||
|
NSEnumerator *enumerator = [layoutManagers objectEnumerator];
|
||||||
|
NSLayoutManager *object;
|
||||||
|
|
||||||
|
// Remove layout managers from old NSTextStorage object and add them to the
|
||||||
|
// new one. NSTextStorage's addLayoutManager invokes NSLayoutManager's
|
||||||
|
// setTextStorage method automatically, and that includes self.
|
||||||
|
|
||||||
|
while( (object = (NSLayoutManager *)[enumerator nextObject]) )
|
||||||
|
{
|
||||||
|
[_textStorage removeLayoutManager: object];
|
||||||
|
[newTextStorage addLayoutManager: object];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setting text containers
|
||||||
|
//
|
||||||
|
- (NSArray *)textContainers
|
||||||
|
{
|
||||||
|
return _textContainers;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)addTextContainer: (NSTextContainer *)obj
|
||||||
|
{
|
||||||
|
if( [_textContainers indexOfObjectIdenticalTo: obj] == NSNotFound )
|
||||||
|
{
|
||||||
|
[_textContainers addObject: obj];
|
||||||
|
[obj setLayoutManager: self];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)insertTextContainer: (NSTextContainer *)aTextContainer
|
||||||
|
atIndex: (unsigned)index
|
||||||
|
{
|
||||||
|
[_textContainers insertObject: aTextContainer atIndex: index];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)removeTextContainerAtIndex: (unsigned)index
|
||||||
|
{
|
||||||
|
[_textContainers removeObjectAtIndex: index];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Invalidating glyphs and layout
|
||||||
|
//
|
||||||
|
- (void)invalidateGlyphsForCharacterRange: (NSRange)aRange
|
||||||
|
changeInLength: (int)lengthChange
|
||||||
|
actualCharacterRange: (NSRange *)actualRange
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)invalidateLayoutForCharacterRange: (NSRange)aRange
|
||||||
|
isSoft: (BOOL)flag
|
||||||
|
actualCharacterRange: (NSRange *)actualRange
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)invalidateDisplayForCharacterRange: (NSRange)aRange
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)invalidateDisplayForGlyphRange: (NSRange)aRange
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)textContainerChangedGeometry: (NSTextContainer *)aContainer
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)textContainerChangedTextView: (NSTextContainer *)aContainer
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)textStorage: (NSTextStorage *)aTextStorage
|
||||||
|
edited: (unsigned)mask
|
||||||
|
range: (NSRange)range
|
||||||
|
changeInLength: (int)lengthChange
|
||||||
|
invalidatedRange: (NSRange)invalidatedRange
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Turning on/off background layout
|
||||||
|
//
|
||||||
|
|
||||||
|
- (void)setBackgroundLayoutEnabled: (BOOL)flag
|
||||||
|
{
|
||||||
|
_backgroundLayout = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)backgroundLayoutEnabled
|
||||||
|
{
|
||||||
|
return _backgroundLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Accessing glyphs
|
||||||
|
//
|
||||||
|
- (void)insertGlyph: (NSGlyph)aGlyph
|
||||||
|
atGlyphIndex: (unsigned)glyphIndex
|
||||||
|
characterIndex: (unsigned)charIndex
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSGlyph)glyphAtIndex: (unsigned)index
|
||||||
|
{
|
||||||
|
return NSNullGlyph;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSGlyph)glyphAtIndex: (unsigned)index
|
||||||
|
isValidIndex: (BOOL *)flag
|
||||||
|
{
|
||||||
|
*flag = NO;
|
||||||
|
return NSNullGlyph;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)replaceGlyphAtIndex: (unsigned)index
|
||||||
|
withGlyph: (NSGlyph)newGlyph
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (unsigned)getGlyphs: (NSGlyph *)glyphArray
|
||||||
|
range: (NSRange)glyphRange
|
||||||
|
{
|
||||||
|
return (unsigned)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)deleteGlyphsInRange: (NSRange)aRange
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (unsigned)numberOfGlyphs
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Mapping characters to glyphs
|
||||||
|
//
|
||||||
|
- (void)setCharacterIndex: (unsigned)charIndex
|
||||||
|
forGlyphAtIndex: (unsigned)glyphIndex
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (unsigned)characterIndexForGlyphAtIndex: (unsigned)glyphIndex
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRange)characterRangeForGlyphRange: (NSRange)glyphRange
|
||||||
|
actualGlyphRange: (NSRange *)actualGlyphRange
|
||||||
|
{
|
||||||
|
return NSMakeRange(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRange)glyphRangeForCharacterRange: (NSRange)charRange
|
||||||
|
actualCharacterRange: (NSRange *)actualCharRange
|
||||||
|
{
|
||||||
|
return NSMakeRange(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setting glyph attributes
|
||||||
|
//
|
||||||
|
- (void)setIntAttribute: (int)attribute
|
||||||
|
value: (int)anInt
|
||||||
|
forGlyphAtIndex: (unsigned)glyphIndex
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int)intAttribute: (int)attribute
|
||||||
|
forGlyphAtIndex: (unsigned)glyphIndex
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handling layout for text containers
|
||||||
|
//
|
||||||
|
- (void)setTextContainer: (NSTextContainer *)aTextContainer
|
||||||
|
forGlyphRange: (NSRange)glyphRange
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRange)glyphRangeForTextContainer: (NSTextContainer *)aTextContainer
|
||||||
|
{
|
||||||
|
return NSMakeRange(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSTextContainer *)textContainerForGlyphAtIndex: (unsigned)glyphIndex
|
||||||
|
effectiveRange: (NSRange *)effectiveRange
|
||||||
|
{
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRect)usedRectForTextContainer: (NSTextContainer *)aTextContainer
|
||||||
|
{
|
||||||
|
return NSZeroRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handling line fragment rectangles
|
||||||
|
//
|
||||||
|
- (void)setLineFragmentRect: (NSRect)fragmentRect
|
||||||
|
forGlyphRange: (NSRange)glyphRange
|
||||||
|
usedRect: (NSRect)usedRect
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRect)lineFragmentRectForGlyphAtIndex: (unsigned)glyphIndex
|
||||||
|
effectiveRange: (NSRange *)lineFragmentRange
|
||||||
|
{
|
||||||
|
return NSZeroRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRect)lineFragmentUsedRectForGlyphAtIndex: (unsigned)glyphIndex
|
||||||
|
effectiveRange: (NSRange *)lineFragmentRange
|
||||||
|
{
|
||||||
|
return NSZeroRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setExtraLineFragmentRect: (NSRect)aRect
|
||||||
|
usedRect: (NSRect)usedRect
|
||||||
|
textContainer: (NSTextContainer *)aTextContainer
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRect)extraLineFragmentRect
|
||||||
|
{
|
||||||
|
return NSZeroRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRect)extraLineFragmentUsedRect
|
||||||
|
{
|
||||||
|
return NSZeroRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSTextContainer *)extraLineFragmentTextContainer
|
||||||
|
{
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setDrawsOutsideLineFragment: (BOOL)flag
|
||||||
|
forGlyphAtIndex: (unsigned)glyphIndex
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)drawsOutsideLineFragmentForGlyphAtIndex: (unsigned)glyphIndex
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Layout of glyphs
|
||||||
|
//
|
||||||
|
- (void)setLocation: (NSPoint)aPoint
|
||||||
|
forStartOfGlyphRange: (NSRange)glyphRange
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSPoint)locationForGlyphAtIndex: (unsigned)glyphIndex
|
||||||
|
{
|
||||||
|
return NSZeroPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRange)rangeOfNominallySpacedGlyphsContainingIndex: (unsigned)glyphIndex
|
||||||
|
{
|
||||||
|
return NSMakeRange(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRect *)rectArrayForCharacterRange: (NSRange)charRange
|
||||||
|
withinSelectedCharacterRange: (NSRange)selChareRange
|
||||||
|
inTextContainer: (NSTextContainer *)aTextContainer
|
||||||
|
rectCount: (unsigned *)rectCount
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRect *)rectArrayForGlyphRange: (NSRange)glyphRange
|
||||||
|
withinSelectedGlyphRange: (NSRange)selectedGlyphRange
|
||||||
|
inTextContainer: (NSTextContainer *)aTextContainer
|
||||||
|
rectCount: (unsigned *)rectCount
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRect)boundingRectForGlyphRange: (NSRange)glyphRange
|
||||||
|
inTextContainer: (NSTextContainer *)aTextContainer
|
||||||
|
{
|
||||||
|
return NSZeroRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRange)glyphRangeForBoundingRect: (NSRect)aRect
|
||||||
|
inTextContainer: (NSTextContainer *)aTextContainer
|
||||||
|
{
|
||||||
|
return NSMakeRange(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRange)glyphRangeForBoundingRectWithoutAdditionalLayout: (NSRect)bounds
|
||||||
|
inTextContainer: (NSTextContainer *)aTextContainer
|
||||||
|
{
|
||||||
|
return NSMakeRange(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (unsigned)glyphIndexForPoint: (NSPoint)aPoint
|
||||||
|
inTextContainer: (NSTextContainer *)aTextContainer
|
||||||
|
fractionOfDistanceThroughGlyph: (float *)partialFraction
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Display of special glyphs
|
||||||
|
//
|
||||||
|
- (void)setNotShownAttribute: (BOOL)flag
|
||||||
|
forGlyphAtIndex: (unsigned)glyphIndex
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)notShownAttributeForGlyphAtIndex: (unsigned)glyphIndex
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setShowsInvisibleCharacters: (BOOL)flag
|
||||||
|
{
|
||||||
|
_showsInvisibleChars = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)showsInvisibleCharacters
|
||||||
|
{
|
||||||
|
return _showsInvisibleChars;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setShowsControlCharacters: (BOOL)flag
|
||||||
|
{
|
||||||
|
_showsControlChars = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)showsControlCharacters
|
||||||
|
{
|
||||||
|
return _showsControlChars;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Controlling hyphenation
|
||||||
|
//
|
||||||
|
- (void)setHyphenationFactor: (float)factor
|
||||||
|
{
|
||||||
|
_hyphenationFactor = factor;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (float)hyphenationFactor
|
||||||
|
{
|
||||||
|
return _hyphenationFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Finding unlaid characters/glyphs
|
||||||
|
//
|
||||||
|
- (void)getFirstUnlaidCharacterIndex: (unsigned *)charIndex
|
||||||
|
glyphIndex: (unsigned *)glyphIndex
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Using screen fonts
|
||||||
|
//
|
||||||
|
- (void)setUsesScreenFonts: (BOOL)flag
|
||||||
|
{
|
||||||
|
_usesScreenFonts = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)usesScreenFonts
|
||||||
|
{
|
||||||
|
return _usesScreenFonts;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSFont *)substituteFontForFont: (NSFont *)originalFont
|
||||||
|
{
|
||||||
|
return originalFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handling rulers
|
||||||
|
//
|
||||||
|
- (NSView *)rulerAccessoryViewForTextView: (NSTextView *)aTextView
|
||||||
|
paragraphStyle: (NSParagraphStyle *)paragraphStyle
|
||||||
|
ruler: (NSRulerView *)aRulerView
|
||||||
|
enabled: (BOOL)flag
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray *)rulerMarkersForTextView: (NSTextView *)aTextView
|
||||||
|
paragraphStyle: (NSParagraphStyle *)paragraphStyle
|
||||||
|
ruler: (NSRulerView *)aRulerView
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Managing the responder chain
|
||||||
|
//
|
||||||
|
- (BOOL)layoutManagerOwnsFirstResponderInWindow: (NSWindow *)aWindow
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSTextView *)firstTextView
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSTextView *)textViewForBeginningOfSelection
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Drawing
|
||||||
|
//
|
||||||
|
- (void)drawBackgroundForGlyphRange: (NSRange)glyphRange
|
||||||
|
atPoint: (NSPoint)containerOrigin
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)drawGlyphsForGlyphRange: (NSRange)glyphRange
|
||||||
|
atPoint: (NSPoint)containerOrigin
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)drawUnderlineForGlyphRange: (NSRange)glyphRange
|
||||||
|
underlineType: (int)underlineType
|
||||||
|
baselineOffset: (float)baselineOffset
|
||||||
|
lineFragmentRect: (NSRect)lineRect
|
||||||
|
lineFragmentGlyphRange: (NSRange)lineGlyphRange
|
||||||
|
containerOrigin: (NSPoint)containerOrigin
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)underlineGlyphRange: (NSRange)glyphRange
|
||||||
|
underlineType: (int)underlineType
|
||||||
|
lineFragmentRect: (NSRect)lineRect
|
||||||
|
lineFragmentGlyphRange: (NSRange)lineGlyphRange
|
||||||
|
containerOrigin: (NSPoint)containerOrigin
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setting the delegate
|
||||||
|
//
|
||||||
|
- (void)setDelegate: (id)aDelegate
|
||||||
|
{
|
||||||
|
_delegate = aDelegate;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)delegate
|
||||||
|
{
|
||||||
|
return _delegate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end /* NSLayoutManager */
|
|
@ -582,6 +582,9 @@ static NSFont* menuFont = nil;
|
||||||
{
|
{
|
||||||
id aCell;
|
id aCell;
|
||||||
|
|
||||||
|
if ([[list_items itemArray] count] == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!pulls_down)
|
if (!pulls_down)
|
||||||
aCell = [[list_items itemArray] objectAtIndex:selected_item];
|
aCell = [[list_items itemArray] objectAtIndex:selected_item];
|
||||||
else
|
else
|
||||||
|
|
|
@ -43,26 +43,22 @@
|
||||||
|
|
||||||
// This variant will create the text network (textStorage, layoutManager, and a container).
|
// This variant will create the text network (textStorage, layoutManager, and a container).
|
||||||
- initWithFrame:(NSRect)frameRect
|
- initWithFrame:(NSRect)frameRect
|
||||||
{ return [self initWithFrame:frameRect textContainer:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef 0
|
|
||||||
- initWithFrame:(NSRect)frameRect
|
|
||||||
{
|
{
|
||||||
|
textStorage = [[NSTextStorage alloc] init];
|
||||||
|
|
||||||
textStorage = [NSTextStorage new];
|
if (![textStorage delegate])
|
||||||
// layoutManager = [NSLayoutManager new];
|
NSLog(@"No delegate set.");
|
||||||
// [textStorage addLayoutManager:layoutManager];
|
|
||||||
// [layoutManager release];
|
|
||||||
|
|
||||||
textContainer = [[NSTextContainer alloc]
|
layoutManager = [[NSLayoutManager alloc] init];
|
||||||
initWithContainerSize:frameRect];
|
[textStorage addLayoutManager:layoutManager];
|
||||||
// [layoutManager addTextContainer:textContainer];
|
[layoutManager release];
|
||||||
|
|
||||||
|
textContainer = [[NSTextContainer alloc] initWithContainerSize:frameRect.size];
|
||||||
|
[layoutManager addTextContainer:textContainer];
|
||||||
[textContainer release];
|
[textContainer release];
|
||||||
|
|
||||||
return [self initWithFrame:frameRect textContainer:textContainer];
|
return [self initWithFrame:frameRect textContainer:textContainer];
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/***************** Get/Set the container and other stuff *****************/
|
/***************** Get/Set the container and other stuff *****************/
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue