mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 02:30:37 +00:00
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:
parent
f1001c574f
commit
038a487a24
4 changed files with 99 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -40,6 +40,7 @@ libgnustep-gui_OBJC_FILES = Functions.m \
|
|||
NSActionCell.m \
|
||||
NSAffineTransform.m \
|
||||
NSApplication.m \
|
||||
NSAttributedString.m \
|
||||
NSBitmapImageRep.m \
|
||||
NSBox.m \
|
||||
NSBrowser.m \
|
||||
|
|
95
Source/NSAttributedString.m
Normal file
95
Source/NSAttributedString.m
Normal 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
|
|
@ -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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue