More fixes, added NSAttributedString.m

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4649 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Michael Silva 1999-07-25 21:44:07 +00:00
parent f1001c574f
commit 038a487a24
4 changed files with 99 additions and 2 deletions

View file

@ -4,6 +4,8 @@
edited:range:changeInLength. Also changed on line 191 from > to
>=. Not sure the complete implications, but alas it now works
correctly.
* Source/NSAttributedString.m: new file with implementation of
some needed additions to NSMutableAttributedString.
Try gstextnetwork.app, you'll see a lot of debug information.
After that has cleared click twice in the textView and press a

View file

@ -40,6 +40,7 @@ libgnustep-gui_OBJC_FILES = Functions.m \
NSActionCell.m \
NSAffineTransform.m \
NSApplication.m \
NSAttributedString.m \
NSBitmapImageRep.m \
NSBox.m \
NSBrowser.m \

View file

@ -0,0 +1,95 @@
#include <AppKit/NSAttributedString.h>
//@implementation NSAttributedString (AppKit)
/*
* This is where the fun begins with RTF/RTFD/HTML
*/
//@end
@implementation NSMutableAttributedString (AppKit)
- (void)superscriptRange:(NSRange)range
{
id value;
int sValue;
value = [self attribute:NSSuperscriptAttributeName
atIndex:range.location effectiveRange:&range];
sValue = [value intValue];
sValue++;
[self addAttribute:NSSuperscriptAttributeName value:[[NSNumber alloc]
initWithInt:sValue] range:range];
}
- (void)subscriptRange:(NSRange)range
{
id value;
int sValue;
value = [self attribute:NSSuperscriptAttributeName
atIndex:range.location effectiveRange:&range];
sValue = [value intValue];
sValue--;
[self addAttribute:NSSuperscriptAttributeName value:[[NSNumber alloc]
initWithInt:sValue] range:range];
}
- (void)unscriptRange:(NSRange)range
{
[self addAttribute:NSSuperscriptAttributeName value:[[NSNumber alloc]
initWithInt:0] range:range];
}
- (void)applyFontTraits:(NSFontTraitMask)traitMask range:(NSRange)range
{
/* We don't use font traits yet, oops. */
/*
id value;
value = [self attribute:NSFontAttributeName
atIndex:range.location effectiveRange:range];
[value setFontTraits:traitMask];
[self addAttribute:NSFontAttributeName value:value range:range];
*/
}
- (void)setAlignment:(NSTextAlignment)alignment range:(NSRange)range
{
id value;
value = [self attribute:NSParagraphStyleAttributeName
atIndex:range.location effectiveRange:&range];
[value setAlignment:alignment];
[self addAttribute:NSParagraphStyleAttributeName value:value range:range];
}
- (void)fixAttributesInRange:(NSRange)range
{
[self fixFontAttributeInRange:range];
[self fixParagraphStyleAttributeInRange:range];
[self fixAttachmentAttributeInRange:range];
}
- (void)fixFontAttributeInRange:(NSRange)range
{
}
- (void)fixParagraphStyleAttributeInRange:(NSRange)range
{
}
- (void)fixAttachmentAttributeInRange:(NSRange)range
{
}
@end

View file

@ -197,8 +197,7 @@ changeInLength: [attributedString length] - aRange.length];
r = editedRange;
r.length += editedDelta;
// FIXME, Michael: yeah, this is needed.
// [self fixAttributesInRange: r];
[self fixAttributesInRange: r];
[nc postNotificationName: NSTextStorageDidProcessEditingNotification
object: self];