2001-12-17 16:51:51 +00:00
|
|
|
/** <title>NSText</title>
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2001-12-17 16:51:51 +00:00
|
|
|
<abstract>The RTFD text class</abstract>
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
|
|
|
|
2001-12-17 16:51:51 +00:00
|
|
|
Author: Scott Christley <scottc@net-community.com>
|
1996-05-30 20:03:15 +00:00
|
|
|
Date: 1996
|
2001-12-17 16:51:51 +00:00
|
|
|
Author: Felipe A. Rodriguez <far@ix.netcom.com>
|
1998-08-01 15:41:49 +00:00
|
|
|
Date: July 1998
|
2007-10-29 21:16:17 +00:00
|
|
|
Author: Daniel Boehringer <boehring@biomed.ruhr-uni-bochum.de>
|
1998-08-20 09:56:26 +00:00
|
|
|
Date: August 1998
|
2000-03-16 14:16:46 +00:00
|
|
|
Author: Fred Kiefer <FredKiefer@gmx.de>
|
|
|
|
Date: March 2000
|
|
|
|
Reorganised and cleaned up code, added some action methods
|
2000-12-20 17:00:32 +00:00
|
|
|
Author: Nicola Pero <n.pero@mi.flashnet.it>
|
|
|
|
Date: December 2000
|
|
|
|
Made class abstract, moved most code to NSTextView.
|
2000-03-16 14:16:46 +00:00
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
This file is part of the GNUstep GUI Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2007-10-29 21:16:17 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
1996-05-30 20:03:15 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2008-06-10 04:01:49 +00:00
|
|
|
version 2 of the License, or (at your option) any later version.
|
2000-03-16 14:16:46 +00:00
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-10-29 21:16:17 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2007-10-29 21:16:17 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
1996-10-18 17:14:13 +00:00
|
|
|
License along with this library; see the file COPYING.LIB.
|
2007-10-29 21:16:17 +00:00
|
|
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
|
|
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA.
|
1999-06-22 23:37:24 +00:00
|
|
|
*/
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2011-03-04 11:33:22 +00:00
|
|
|
#import "AppKit/NSText.h"
|
2005-01-21 21:43 Alexander Malmberg <alexander@malmberg.org>
Various whitespace cleanups, comment type fixes, and changes
to avoid warnings from recent versions of gcc.
* Headers/Additions/GNUstepGUI/GSToolbar.h (-_toolbars): Declare.
* Source/NSWindow+Toolbar.m: Remove conflicting declaration of
[NSToolbar -_toolbars].
* Headers/Additions/GNUstepGUI/GSServicesManager.h,
Source/GSServicesMananger.m (-item2title:, -validateMenuItem:):
Adjust argument types.
* Headers/AppKit/NSMenu.h (-validateMenuItem:): Adjust argument
type.
* Source/NSTextView.m (-sizeToFit): Don't use size uninitialized
if neither resizable flags is set.
(-insertText:): Adjust argument type.
* Headers/AppKit/NSResponder.h, Source/NSResponder.m (-insertText:):
Adjust argument type. Document.
* Headers/AppKit/NSView.h: Change type of ivar _window to NSWindow *.
* Source/GSTitleView.m (-mouseDown:): Always initialize
startWindowOrigin.
* Source/NSApplication.m (-setApplicationIconImage:): Add casts
to avoid warnings.
* Source/NSCell.m (-cellSize): Add default: case.
* Source/NSPasteboard.m
([GSFiltered -pasteboard:provideDataForType:]): Detect and warn if we
can't find a filter that will get us the desired type.
* Source/NSProgressIndicator.m: Comment out unused variable 'images'.
* Source/NSBezierPath.m: Declare GSBezierPath fully before using it.
(-bezierPathByFlatteningPath, -bezierPathByReversingPath): Make sure
variables are always initialized.
* Source/NSMenuView.m,
* Source/NSPrintOperation.m,
* Source/NSSplitView.m,
* Source/NSTableHeaderView.m: Make sure variables are always
initialized.
* Source/NSBox.m,
* Source/NSImageview.m,
* Source/NSText.m,
* Source/NSTextStorage.m: Add missing includes.
* Source/GSKeyBindingTable.m,
* Source/GSLayoutManager.m,
* Source/NSBitmapImageRep+PNM.m,
* Source/NSBundleAdditions.m,
* Source/NSLayoutManager.m,
* Source/nsimage-tiff.h,
* Source/tiff.m,
* Headers/Additions/GNUstepGUI/GSDisplayServer.h,
* Source/GSDisplayServer.m: Change signedness of various variables.
* Source/NSPanel.m (-sendEvent:): Remove.
* Source/NSWindow.m (-becomesKeyOnlyIfNeeded): New method.
(-_sendEvent:becomesKeyOnlyIfNeeded:): Remove. Move code ...
(-sendEvent:): ... here. Use -becomesKeyOnlyIfNeeded instead
of the argument.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20590 72102866-910b-0410-8b05-ffd578937521
2005-01-21 20:39:18 +00:00
|
|
|
|
2011-03-04 11:33:22 +00:00
|
|
|
#import "AppKit/NSAttributedString.h"
|
|
|
|
#import "AppKit/NSPanel.h"
|
|
|
|
#import "AppKit/NSSpellChecker.h"
|
|
|
|
#import "AppKit/NSTextView.h"
|
1999-06-22 23:37:24 +00:00
|
|
|
|
1998-09-02 15:05:13 +00:00
|
|
|
|
2000-12-18 22:06:53 +00:00
|
|
|
static Class abstract;
|
|
|
|
static Class concrete;
|
1999-06-22 23:37:24 +00:00
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
@implementation NSText
|
2000-09-30 23:11:15 +00:00
|
|
|
|
2000-03-16 14:16:46 +00:00
|
|
|
/*
|
2000-12-20 17:00:32 +00:00
|
|
|
* Class methods
|
2000-03-16 14:16:46 +00:00
|
|
|
*/
|
|
|
|
+ (void)initialize
|
|
|
|
{
|
|
|
|
if (self == [NSText class])
|
|
|
|
{
|
2000-10-12 23:02:25 +00:00
|
|
|
[self setVersion: 1];
|
2000-03-16 14:16:46 +00:00
|
|
|
|
2000-12-18 22:06:53 +00:00
|
|
|
abstract = self;
|
|
|
|
concrete = [NSTextView class];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2000-12-18 22:06:53 +00:00
|
|
|
+ (id) allocWithZone: (NSZone*)zone
|
|
|
|
{
|
|
|
|
if (self == abstract)
|
|
|
|
return NSAllocateObject (concrete, 0, zone);
|
|
|
|
else
|
|
|
|
return NSAllocateObject (self, 0, zone);
|
|
|
|
}
|
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
/*
|
|
|
|
* Instance methods
|
|
|
|
*/
|
2000-12-19 18:45:52 +00:00
|
|
|
|
2000-03-16 14:16:46 +00:00
|
|
|
/*
|
|
|
|
* Getting and Setting Contents
|
|
|
|
*/
|
2013-02-16 21:37:29 +00:00
|
|
|
- (void) replaceCharactersInRange: (NSRange)aRange
|
|
|
|
withRTF: (NSData *)rtfData
|
2000-03-08 08:43:15 +00:00
|
|
|
{
|
2000-12-18 22:06:53 +00:00
|
|
|
NSAttributedString *attr;
|
|
|
|
|
|
|
|
attr = [[NSAttributedString alloc] initWithRTF: rtfData
|
|
|
|
documentAttributes: NULL];
|
|
|
|
AUTORELEASE (attr);
|
2003-01-26 19:21:40 +00:00
|
|
|
[self replaceCharactersInRange: aRange withAttributedString: attr];
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2000-12-18 22:06:53 +00:00
|
|
|
- (void) replaceCharactersInRange: (NSRange)aRange
|
|
|
|
withRTFD: (NSData *)rtfdData
|
2000-03-08 08:43:15 +00:00
|
|
|
{
|
2000-12-18 22:06:53 +00:00
|
|
|
NSAttributedString *attr;
|
|
|
|
|
|
|
|
attr = [[NSAttributedString alloc] initWithRTFD: rtfdData
|
|
|
|
documentAttributes: NULL];
|
|
|
|
AUTORELEASE (attr);
|
2003-01-26 19:21:40 +00:00
|
|
|
[self replaceCharactersInRange: aRange withAttributedString: attr];
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) replaceCharactersInRange: (NSRange)aRange
|
|
|
|
withString: (NSString*)aString
|
2000-03-08 08:43:15 +00:00
|
|
|
{
|
2000-12-18 22:06:53 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
|
|
|
- (void) replaceCharactersInRange: (NSRange)aRange
|
|
|
|
withAttributedString: (NSAttributedString*)attrString
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* PRIMITIVE */
|
2000-12-20 17:00:32 +00:00
|
|
|
- (NSData*) RTFDFromRange: (NSRange)aRange
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-20 17:00:32 +00:00
|
|
|
- (NSData*) RTFFromRange: (NSRange)aRange
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* TODO: is this correct? seems that this would use the attributes of the
|
|
|
|
old text. */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) setString: (NSString*)aString
|
2000-03-08 08:43:15 +00:00
|
|
|
{
|
2000-12-19 22:37:28 +00:00
|
|
|
[self replaceCharactersInRange: NSMakeRange (0, [self textLength])
|
2000-09-18 23:33:30 +00:00
|
|
|
withString: aString];
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (NSString*) string
|
2000-03-08 08:43:15 +00:00
|
|
|
{
|
2000-12-19 18:45:52 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return nil;
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
/*
|
|
|
|
* old OpenStep methods doing the same
|
|
|
|
*/
|
2013-02-16 21:37:29 +00:00
|
|
|
- (void) replaceRange: (NSRange)aRange withRTFD: (NSData*)rtfdData
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2013-02-16 21:37:29 +00:00
|
|
|
[self replaceCharactersInRange: aRange withRTFD: rtfdData];
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2013-02-16 21:37:29 +00:00
|
|
|
- (void) replaceRange: (NSRange)aRange withRTF: (NSData*)rtfData
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2013-02-16 21:37:29 +00:00
|
|
|
[self replaceCharactersInRange: aRange withRTF: rtfData];
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2013-02-16 21:37:29 +00:00
|
|
|
- (void) replaceRange: (NSRange)aRange withString: (NSString*)aString
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2013-02-16 21:37:29 +00:00
|
|
|
[self replaceCharactersInRange: aRange withString: aString];
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2013-02-16 21:37:29 +00:00
|
|
|
- (void) setText: (NSString*)aString range: (NSRange)aRange
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2013-02-16 21:37:29 +00:00
|
|
|
[self replaceCharactersInRange: aRange withString: aString];
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2002-04-03 16:59:43 +00:00
|
|
|
- (void) setText: (NSString*)aString
|
2000-03-08 08:43:15 +00:00
|
|
|
{
|
2002-04-03 16:59:43 +00:00
|
|
|
[self setString: aString];
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2000-03-16 14:16:46 +00:00
|
|
|
- (NSString*) text
|
|
|
|
{
|
|
|
|
return [self string];
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
/*
|
|
|
|
* Graphic attributes
|
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
|
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (NSColor*) backgroundColor
|
2000-03-08 08:43:15 +00:00
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return nil;
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
2000-03-08 08:43:15 +00:00
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (BOOL) drawsBackground
|
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NO;
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) setBackgroundColor: (NSColor*)color
|
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-19 15:33:34 +00:00
|
|
|
- (void) setDrawsBackground: (BOOL)flag
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
2000-03-08 08:43:15 +00:00
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
/*
|
|
|
|
* Managing Global Characteristics
|
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (BOOL) importsGraphics
|
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NO;
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (BOOL) isEditable
|
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NO;
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (BOOL) isFieldEditor
|
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NO;
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (BOOL) isRichText
|
2000-03-08 08:43:15 +00:00
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NO;
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (BOOL) isSelectable
|
2000-03-08 08:43:15 +00:00
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NO;
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-19 15:33:34 +00:00
|
|
|
- (void) setEditable: (BOOL)flag
|
2000-03-08 08:43:15 +00:00
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) setFieldEditor: (BOOL)flag
|
2000-03-08 08:43:15 +00:00
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-19 15:33:34 +00:00
|
|
|
- (void) setImportsGraphics: (BOOL)flag
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
2000-03-08 08:43:15 +00:00
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) setRichText: (BOOL)flag
|
2000-03-08 08:43:15 +00:00
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void)setSelectable: (BOOL)flag
|
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
/*
|
|
|
|
* Using the font panel
|
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (BOOL) usesFontPanel
|
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NO;
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-19 15:33:34 +00:00
|
|
|
- (void) setUsesFontPanel: (BOOL)flag
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
/*
|
|
|
|
* Managing the Ruler
|
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (BOOL) isRulerVisible
|
1999-11-11 17:17:14 +00:00
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NO;
|
1999-06-22 23:37:24 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) toggleRuler: (id)sender
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
/*
|
|
|
|
* Managing the Selection
|
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-19 15:33:34 +00:00
|
|
|
- (NSRange) selectedRange
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2000-12-19 22:37:28 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NSMakeRange (NSNotFound, 0);
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
1998-10-15 12:04:53 +00:00
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) setSelectedRange: (NSRange)range
|
1999-11-11 17:17:14 +00:00
|
|
|
{
|
2000-12-19 22:37:28 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
1999-11-11 17:17:14 +00:00
|
|
|
|
2000-03-16 14:16:46 +00:00
|
|
|
/*
|
|
|
|
* Copy and paste
|
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) copy: (id)sender
|
2000-12-20 17:00:32 +00:00
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
1998-09-02 15:05:13 +00:00
|
|
|
}
|
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
/* Copy the current font to the font pasteboard */
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) copyFont: (id)sender
|
2000-03-08 08:43:15 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
1998-09-02 15:05:13 +00:00
|
|
|
}
|
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
/* Copy the current ruler settings to the ruler pasteboard */
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) copyRuler: (id)sender
|
2000-03-08 08:43:15 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
1999-02-10 15:09:51 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) delete: (id)sender
|
1999-08-22 04:04:38 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
2000-03-08 08:43:15 +00:00
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) cut: (id)sender
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self copy: sender];
|
|
|
|
[self delete: sender];
|
1998-08-20 09:56:26 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) paste: (id)sender
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
1999-08-31 09:19:39 +00:00
|
|
|
}
|
1999-02-17 09:13:43 +00:00
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) pasteFont: (id)sender
|
1999-02-17 09:13:43 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
1998-08-20 09:56:26 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) pasteRuler: (id)sender
|
1999-11-11 17:17:14 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) selectAll: (id)sender
|
1999-11-11 17:17:14 +00:00
|
|
|
{
|
2000-12-19 22:37:28 +00:00
|
|
|
[self setSelectedRange: NSMakeRange (0, [self textLength])];
|
1999-11-11 17:17:14 +00:00
|
|
|
}
|
1998-09-02 15:05:13 +00:00
|
|
|
|
2000-03-16 14:16:46 +00:00
|
|
|
/*
|
2000-05-20 16:55:08 +00:00
|
|
|
* Managing Font
|
2000-03-16 14:16:46 +00:00
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (NSFont*) font
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return nil;
|
2000-03-08 08:43:15 +00:00
|
|
|
}
|
|
|
|
|
2000-03-16 14:16:46 +00:00
|
|
|
/*
|
2000-12-19 22:37:28 +00:00
|
|
|
* This action method changes the font of the selection for a rich
|
|
|
|
* text object, or of all text for a plain text object. If the
|
|
|
|
* receiver doesn't use the Font Panel, however, this method does
|
|
|
|
* nothing. */
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) changeFont: (id)sender
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) setFont: (NSFont*)font
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2002-12-25 16:58:02 +00:00
|
|
|
- (void) setFont: (NSFont*)font range: (NSRange)aRange
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
1998-10-15 12:04:53 +00:00
|
|
|
}
|
|
|
|
|
2002-12-25 16:58:02 +00:00
|
|
|
- (void) setFont: (NSFont*)font ofRange: (NSRange)aRange
|
|
|
|
{
|
|
|
|
[self setFont: font range: aRange];
|
|
|
|
}
|
|
|
|
|
2000-03-16 14:16:46 +00:00
|
|
|
/*
|
|
|
|
* Managing Alingment
|
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (NSTextAlignment) alignment
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return 0;
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-20 17:00:32 +00:00
|
|
|
- (void) setAlignment: (NSTextAlignment)mode
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-20 17:00:32 +00:00
|
|
|
- (void) alignCenter: (id)sender
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
1998-10-15 12:04:53 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-20 17:00:32 +00:00
|
|
|
- (void) alignLeft: (id)sender
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-20 17:00:32 +00:00
|
|
|
- (void) alignRight: (id)sender
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2000-03-16 14:16:46 +00:00
|
|
|
/*
|
|
|
|
* Text colour
|
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (NSColor*) textColor
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return nil;
|
|
|
|
}
|
2000-05-20 16:55:08 +00:00
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-20 17:00:32 +00:00
|
|
|
- (void) setTextColor: (NSColor*)color
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
1998-10-15 12:04:53 +00:00
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-20 12:50:37 +00:00
|
|
|
- (void) setTextColor: (NSColor*)color range: (NSRange)aRange
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
1998-09-02 15:05:13 +00:00
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
/* Old OpenStep method to do the same */
|
2000-12-20 12:50:37 +00:00
|
|
|
- (void) setColor: (NSColor*)color ofRange: (NSRange)aRange
|
1999-11-11 17:17:14 +00:00
|
|
|
{
|
2000-12-19 22:37:28 +00:00
|
|
|
[self setTextColor: color range: aRange];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
1999-11-11 17:17:14 +00:00
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
/*
|
|
|
|
* Text attributes
|
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) subscript: (id)sender
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) superscript: (id)sender
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) unscript: (id)sender
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) underline: (id)sender
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
2000-03-08 08:43:15 +00:00
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
/*
|
|
|
|
* Reading and Writing RTFD Files
|
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (BOOL) readRTFDFromFile: (NSString*)path
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
return NO;
|
|
|
|
}
|
2000-02-19 00:40:47 +00:00
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-19 22:37:28 +00:00
|
|
|
- (BOOL) writeRTFDToFile: (NSString*)path atomically: (BOOL)flag
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NO;
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
2000-02-19 00:40:47 +00:00
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
/*
|
|
|
|
* Sizing the Frame Rectangle
|
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (BOOL) isHorizontallyResizable
|
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NO;
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (BOOL) isVerticallyResizable
|
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NO;
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (NSSize) maxSize
|
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NSMakeSize(0,0);
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (NSSize) minSize
|
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NSMakeSize(0,0);
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-20 17:00:32 +00:00
|
|
|
- (void) setHorizontallyResizable: (BOOL)flag
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-11-03 00:22:15 +00:00
|
|
|
- (void) setVerticallyResizable: (BOOL)flag
|
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-11-03 00:22:15 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-20 17:00:32 +00:00
|
|
|
- (void) setMaxSize: (NSSize)newMaxSize
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-20 17:00:32 +00:00
|
|
|
- (void) setMinSize: (NSSize)newMinSize
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) sizeToFit
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
/*
|
|
|
|
* Spelling
|
|
|
|
*/
|
2000-03-16 14:16:46 +00:00
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (void) checkSpelling: (id)sender
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) showGuessPanel: (id)sender
|
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
NSSpellChecker *sp = [NSSpellChecker sharedSpellChecker];
|
2000-03-16 14:16:46 +00:00
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
[[sp spellingPanel] orderFront: self];
|
|
|
|
}
|
2000-03-16 14:16:46 +00:00
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
/*
|
|
|
|
* Scrolling
|
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-20 17:00:32 +00:00
|
|
|
- (void) scrollRangeToVisible: (NSRange)aRange
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Managing the Delegate
|
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-03-16 14:16:46 +00:00
|
|
|
- (id) delegate
|
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return nil;
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-20 12:50:37 +00:00
|
|
|
- (void) setDelegate: (id)anObject
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2003-01-26 19:21:40 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2002-09-21 23:33:37 +00:00
|
|
|
}
|
|
|
|
|
2000-03-16 14:16:46 +00:00
|
|
|
|
2000-05-23 22:58:24 +00:00
|
|
|
/*
|
2000-12-20 17:00:32 +00:00
|
|
|
* NSChangeSpelling protocol
|
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-20 17:00:32 +00:00
|
|
|
- (void) changeSpelling: (id)sender
|
2000-03-16 14:16:46 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-05-23 22:58:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2000-12-20 17:00:32 +00:00
|
|
|
* NSIgnoreMisspelledWords protocol
|
|
|
|
*/
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2000-12-20 17:00:32 +00:00
|
|
|
- (void) ignoreSpelling: (id)sender
|
2000-05-23 22:58:24 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
2000-03-16 14:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2000-12-20 17:00:32 +00:00
|
|
|
@implementation NSText (GNUstepExtensions)
|
2000-03-19 07:33:26 +00:00
|
|
|
|
2003-01-26 19:21:40 +00:00
|
|
|
/* PRIMITIVE */
|
2013-02-16 21:37:29 +00:00
|
|
|
- (NSUInteger) textLength
|
2000-03-08 08:43:15 +00:00
|
|
|
{
|
2000-12-20 17:00:32 +00:00
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return 0;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|