mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 13:20: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
aa3258aa39
commit
efcfcbe8cc
3 changed files with 43 additions and 2 deletions
|
@ -5,6 +5,10 @@
|
||||||
* Source/GSServicesManager.m: minor temp debug NSlog.
|
* Source/GSServicesManager.m: minor temp debug NSlog.
|
||||||
* Source/NSMenuView.m: debug logs.
|
* Source/NSMenuView.m: debug logs.
|
||||||
* Source/NSText.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
|
Look at core/Testing/gstextnetwork.app. That is the text
|
||||||
application for NSTextView/TextNetwork. Edit.app has been
|
application for NSTextView/TextNetwork. Edit.app has been
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include <Foundation/Foundation.h>
|
#include <Foundation/Foundation.h>
|
||||||
#include <AppKit/NSAttributedString.h>
|
#include <AppKit/NSAttributedString.h>
|
||||||
|
#include <Foundation/NSGAttributedString.h>
|
||||||
#include <AppKit/NSTextStorage.h>
|
#include <AppKit/NSTextStorage.h>
|
||||||
|
|
||||||
@implementation NSTextStorage
|
@implementation NSTextStorage
|
||||||
|
@ -68,6 +69,16 @@ static Class concrete;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return a string
|
||||||
|
*/
|
||||||
|
|
||||||
|
- (NSString*) string
|
||||||
|
{
|
||||||
|
[self subclassResponsibility: _cmd];
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Managing NSLayoutManagers
|
* Managing NSLayoutManagers
|
||||||
*/
|
*/
|
||||||
|
@ -159,6 +170,7 @@ static Class concrete;
|
||||||
- (void) processEditing
|
- (void) processEditing
|
||||||
{
|
{
|
||||||
NSRange r;
|
NSRange r;
|
||||||
|
int i;
|
||||||
|
|
||||||
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
||||||
|
|
||||||
|
@ -171,6 +183,26 @@ static Class concrete;
|
||||||
|
|
||||||
[nc postNotificationName: NSTextStorageDidProcessEditingNotification
|
[nc postNotificationName: NSTextStorageDidProcessEditingNotification
|
||||||
object: self];
|
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);
|
editedRange = NSMakeRange(0, 0);
|
||||||
editedDelta = 0;
|
editedDelta = 0;
|
||||||
editedMask = 0;
|
editedMask = 0;
|
||||||
|
|
|
@ -146,12 +146,10 @@
|
||||||
|
|
||||||
/* We override NSView's setNeedsDisplayInRect: */
|
/* We override NSView's setNeedsDisplayInRect: */
|
||||||
|
|
||||||
/*
|
|
||||||
- (void)setNeedsDisplayInRect:(NSRect)aRect
|
- (void)setNeedsDisplayInRect:(NSRect)aRect
|
||||||
{
|
{
|
||||||
[self setNeedsDisplayInRect:aRect avoidAdditionalLayout:NO];
|
[self setNeedsDisplayInRect:aRect avoidAdditionalLayout:NO];
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
- (BOOL)shouldDrawInsertionPoint
|
- (BOOL)shouldDrawInsertionPoint
|
||||||
{
|
{
|
||||||
|
@ -915,12 +913,19 @@ container, returning the modified location. */
|
||||||
|
|
||||||
- (void)insertText:(NSString *)aString
|
- (void)insertText:(NSString *)aString
|
||||||
{
|
{
|
||||||
|
NSLog(@"%@", aString);
|
||||||
|
|
||||||
if (![aString isKindOfClass:[NSAttributedString class]])
|
if (![aString isKindOfClass:[NSAttributedString class]])
|
||||||
aString = [[[NSAttributedString alloc] initWithString:aString
|
aString = [[[NSAttributedString alloc] initWithString:aString
|
||||||
attributes:[self typingAttributes]] autorelease];
|
attributes:[self typingAttributes]] autorelease];
|
||||||
|
|
||||||
[textStorage replaceCharactersInRange:[self selectedRange]
|
[textStorage replaceCharactersInRange:[self selectedRange]
|
||||||
withAttributedString:(NSAttributedString *)aString];
|
withAttributedString:(NSAttributedString *)aString];
|
||||||
|
|
||||||
|
[self setSelectedRange:NSMakeRange([self
|
||||||
|
selectedRange].location+[aString length],0)];
|
||||||
|
|
||||||
|
NSLog(@"%@", [textStorage string]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)drawRect:(NSRect)aRect
|
- (void)drawRect:(NSRect)aRect
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue