/* * Name: OgreTextViewGraphicAllowedAdapter.m * Project: OgreKit * * Creation Date: May 20 2004 * Author: Isao Sonobe * Copyright: Copyright (c) 2003 Isao Sonobe, All rights reserved. * License: OgreKit License * * Encoding: UTF8 * Tabsize: 4 */ #import #import #import #import #import @implementation OgreTextViewGraphicAllowedAdapter /* Accessor methods */ - (NSObject*)ogString { return [[[OGAttributedString alloc] initWithAttributedString:[self textStorage]] autorelease]; } - (void)setOGString:(NSObject*)aString { [_textStorage setAttributedString:[aString attributedString]]; } - (void)replaceCharactersInRange:(NSRange)aRange withOGString:(NSObject*)aString { // Undo操作の登録 if (_allowsUndo) { //[_textView setSelectedRange:aRange]; [_undoer addRange:NSMakeRange(aRange.location, [aString length]) attributedString:[[[NSAttributedString alloc] initWithAttributedString:[[self textStorage] attributedSubstringFromRange:aRange]] autorelease]]; //NSLog(@"(%d, %d), %@", aRange.location, aRange.length, [[_textStorage attributedSubstringFromRange:aRange] string]); } // 置換 [[self textStorage] replaceCharactersInRange:aRange withAttributedString:[aString attributedString]]; } @end