mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
More text fixes.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4642 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a7f52772bc
commit
f7184fd337
3 changed files with 43 additions and 2 deletions
|
@ -5,6 +5,10 @@
|
|||
* Source/GSServicesManager.m: minor temp debug NSlog.
|
||||
* Source/NSMenuView.m: debug logs.
|
||||
* Source/NSText.m: debug logs.
|
||||
* Source/NSTextStorage.m: in processEditing: add code to notify
|
||||
every layoutManager of editing done in textStorage.
|
||||
Also fixed code to return the string. This makes debugging ohh so
|
||||
much easier. ;-)
|
||||
|
||||
Look at core/Testing/gstextnetwork.app. That is the text
|
||||
application for NSTextView/TextNetwork. Edit.app has been
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <AppKit/NSAttributedString.h>
|
||||
#include <Foundation/NSGAttributedString.h>
|
||||
#include <AppKit/NSTextStorage.h>
|
||||
|
||||
@implementation NSTextStorage
|
||||
|
@ -68,6 +69,16 @@ static Class concrete;
|
|||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a string
|
||||
*/
|
||||
|
||||
- (NSString*) string
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
/*
|
||||
* Managing NSLayoutManagers
|
||||
*/
|
||||
|
@ -159,6 +170,7 @@ static Class concrete;
|
|||
- (void) processEditing
|
||||
{
|
||||
NSRange r;
|
||||
int i;
|
||||
|
||||
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
|
@ -171,6 +183,26 @@ static Class concrete;
|
|||
|
||||
[nc postNotificationName: NSTextStorageDidProcessEditingNotification
|
||||
object: self];
|
||||
|
||||
/*
|
||||
* Calls textStorage:edited:range:changeInLength:invalidatedRange: for
|
||||
* every layoutManager.
|
||||
*
|
||||
* FIXME, Michael: are the ranges used correct?
|
||||
*/
|
||||
|
||||
for (i=0;i<[layoutManagers count];i++)
|
||||
{
|
||||
id lManager = [layoutManagers objectAtIndex:i];
|
||||
|
||||
[lManager textStorage:self edited:editedMask range:editedRange
|
||||
changeInLength:editedDelta invalidatedRange:r];
|
||||
}
|
||||
|
||||
/*
|
||||
* Why are we resetting the values?
|
||||
*/
|
||||
|
||||
editedRange = NSMakeRange(0, 0);
|
||||
editedDelta = 0;
|
||||
editedMask = 0;
|
||||
|
|
|
@ -146,12 +146,10 @@
|
|||
|
||||
/* We override NSView's setNeedsDisplayInRect: */
|
||||
|
||||
/*
|
||||
- (void)setNeedsDisplayInRect:(NSRect)aRect
|
||||
{
|
||||
[self setNeedsDisplayInRect:aRect avoidAdditionalLayout:NO];
|
||||
}
|
||||
*/
|
||||
|
||||
- (BOOL)shouldDrawInsertionPoint
|
||||
{
|
||||
|
@ -915,12 +913,19 @@ container, returning the modified location. */
|
|||
|
||||
- (void)insertText:(NSString *)aString
|
||||
{
|
||||
NSLog(@"%@", aString);
|
||||
|
||||
if (![aString isKindOfClass:[NSAttributedString class]])
|
||||
aString = [[[NSAttributedString alloc] initWithString:aString
|
||||
attributes:[self typingAttributes]] autorelease];
|
||||
|
||||
[textStorage replaceCharactersInRange:[self selectedRange]
|
||||
withAttributedString:(NSAttributedString *)aString];
|
||||
|
||||
[self setSelectedRange:NSMakeRange([self
|
||||
selectedRange].location+[aString length],0)];
|
||||
|
||||
NSLog(@"%@", [textStorage string]);
|
||||
}
|
||||
|
||||
- (void)drawRect:(NSRect)aRect
|
||||
|
|
Loading…
Reference in a new issue