mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 13:00:37 +00:00
Various text/font fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6291 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b5be67ab7d
commit
be2b1ba87b
6 changed files with 3091 additions and 3159 deletions
|
@ -1,3 +1,9 @@
|
|||
Thu Mar 16 13:15:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSText.m: Fixes by Fred Kiefer for rich text display.
|
||||
* Source/NSTextView.m: ditto
|
||||
* Source/NSFontManager.m: bugfixes - check for nil fonts.
|
||||
|
||||
Wed Mar 15 02:41:04 2000 Nicola Pero <n.pero@mi.flashnet.it>
|
||||
|
||||
* Source/GSUtil.m: Removed file; it was duplicating
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
/*
|
||||
NSText.h
|
||||
NSText.h
|
||||
|
||||
The text object
|
||||
The text object
|
||||
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
Date: 1996
|
||||
Author: Felipe A. Rodriguez <far@ix.netcom.com>
|
||||
Date: July 1998
|
||||
Author: Daniel Bðhringer <boehring@biomed.ruhr-uni-bochum.de>
|
||||
Date: August 1998
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
Date: 1996
|
||||
Author: Felipe A. Rodriguez <far@ix.netcom.com>
|
||||
Date: July 1998
|
||||
Author: Daniel Bðhringer <boehring@biomed.ruhr-uni-bochum.de>
|
||||
Date: August 1998
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNUstep_H_NSText
|
||||
|
@ -44,285 +44,288 @@
|
|||
@class NSFont;
|
||||
|
||||
typedef enum _NSTextAlignment {
|
||||
NSLeftTextAlignment = 0,
|
||||
NSRightTextAlignment,
|
||||
NSCenterTextAlignment,
|
||||
NSJustifiedTextAlignment,
|
||||
NSNaturalTextAlignment
|
||||
NSLeftTextAlignment = 0,
|
||||
NSRightTextAlignment,
|
||||
NSCenterTextAlignment,
|
||||
NSJustifiedTextAlignment,
|
||||
NSNaturalTextAlignment
|
||||
} NSTextAlignment;
|
||||
|
||||
enum {
|
||||
NSIllegalTextMovement = 0,
|
||||
NSReturnTextMovement = 0x10,
|
||||
NSTabTextMovement = 0x11,
|
||||
NSBacktabTextMovement = 0x12,
|
||||
NSLeftTextMovement = 0x13,
|
||||
NSRightTextMovement = 0x14,
|
||||
NSUpTextMovement = 0x15,
|
||||
NSDownTextMovement = 0x16
|
||||
NSIllegalTextMovement = 0,
|
||||
NSReturnTextMovement = 0x10,
|
||||
NSTabTextMovement = 0x11,
|
||||
NSBacktabTextMovement = 0x12,
|
||||
NSLeftTextMovement = 0x13,
|
||||
NSRightTextMovement = 0x14,
|
||||
NSUpTextMovement = 0x15,
|
||||
NSDownTextMovement = 0x16
|
||||
};
|
||||
|
||||
enum {
|
||||
NSParagraphSeparatorCharacter = 0x2029,
|
||||
NSLineSeparatorCharacter = 0x2028,
|
||||
NSTabCharacter = 0x0009,
|
||||
NSFormFeedCharacter = 0x000c,
|
||||
NSNewlineCharacter = 0x000a,
|
||||
NSCarriageReturnCharacter = 0x000d,
|
||||
NSEnterCharacter = 0x0003,
|
||||
NSBackspaceCharacter = 0x0008,
|
||||
NSBackTabCharacter = 0x0019,
|
||||
NSDeleteCharacter = 0x007f,
|
||||
NSParagraphSeparatorCharacter = 0x2029,
|
||||
NSLineSeparatorCharacter = 0x2028,
|
||||
NSTabCharacter = 0x0009,
|
||||
NSFormFeedCharacter = 0x000c,
|
||||
NSNewlineCharacter = 0x000a,
|
||||
NSCarriageReturnCharacter = 0x000d,
|
||||
NSEnterCharacter = 0x0003,
|
||||
NSBackspaceCharacter = 0x0008,
|
||||
NSBackTabCharacter = 0x0019,
|
||||
NSDeleteCharacter = 0x007f,
|
||||
};
|
||||
|
||||
#include <AppKit/NSStringDrawing.h>
|
||||
|
||||
// these definitions should migrate to NSTextView when implemented
|
||||
typedef enum _NSSelectionGranularity {
|
||||
NSSelectByCharacter = 0,
|
||||
NSSelectByWord = 1,
|
||||
NSSelectByParagraph = 2,
|
||||
NSSelectByCharacter = 0,
|
||||
NSSelectByWord = 1,
|
||||
NSSelectByParagraph = 2,
|
||||
} NSSelectionGranularity;
|
||||
|
||||
#if GNUSTEP
|
||||
#ifndef NO_GNUSTEP
|
||||
typedef enum _NSSelectionAffinity {
|
||||
NSSelectionAffinityUpstream = 0,
|
||||
NSSelectionAffinityDownstream = 1,
|
||||
NSSelectionAffinityUpstream = 0,
|
||||
NSSelectionAffinityDownstream = 1,
|
||||
} NSSelectionAffinity;
|
||||
#endif
|
||||
|
||||
@interface NSText : NSView <NSChangeSpelling,NSIgnoreMisspelledWords,NSCoding>
|
||||
{ // Attributes
|
||||
id delegate;
|
||||
unsigned int alignment; //NSTextAlignment
|
||||
BOOL is_editable;
|
||||
BOOL is_rich_text;
|
||||
BOOL is_selectable;
|
||||
BOOL imports_graphics;
|
||||
BOOL uses_font_panel;
|
||||
BOOL is_horizontally_resizable;
|
||||
BOOL is_vertically_resizable;
|
||||
BOOL is_ruler_visible;
|
||||
BOOL is_field_editor;
|
||||
BOOL draws_background;
|
||||
NSColor *background_color;
|
||||
NSColor *text_color;
|
||||
NSFont *default_font;
|
||||
NSRange selected_range;
|
||||
{
|
||||
// Attributes
|
||||
id _delegate;
|
||||
struct GSTextFlagsType {
|
||||
unsigned is_editable: 1;
|
||||
unsigned is_rich_text: 1;
|
||||
unsigned is_selectable: 1;
|
||||
unsigned imports_graphics: 1;
|
||||
unsigned uses_font_panel: 1;
|
||||
unsigned is_horizontally_resizable: 1;
|
||||
unsigned is_vertically_resizable: 1;
|
||||
unsigned is_ruler_visible: 1;
|
||||
unsigned is_field_editor: 1;
|
||||
unsigned draws_background: 1;
|
||||
} _tf;
|
||||
NSTextAlignment _alignment;
|
||||
NSColor *_background_color;
|
||||
NSColor *_text_color;
|
||||
NSFont *_default_font;
|
||||
NSRange _selected_range;
|
||||
NSSize _minSize;
|
||||
NSSize _maxSize;
|
||||
NSMutableDictionary *_typingAttributes;
|
||||
|
||||
// content
|
||||
NSMutableAttributedString *_textStorage;
|
||||
|
||||
int _spellCheckerDocumentTag;
|
||||
|
||||
// column-stable cursor up/down
|
||||
NSPoint _currentCursor;
|
||||
|
||||
// added by Daniel Bðhringer
|
||||
|
||||
NSSize minSize,maxSize;
|
||||
NSMutableDictionary *typingAttributes;
|
||||
|
||||
// content
|
||||
NSMutableString *plainContent;
|
||||
NSMutableAttributedString *rtfContent;
|
||||
|
||||
// internal stuff
|
||||
|
||||
// contains private _GNULineLayoutInfo objects
|
||||
NSMutableArray *lineLayoutInformation;
|
||||
|
||||
int spellCheckerDocumentTag;
|
||||
NSCharacterSet *selectionWordGranularitySet;
|
||||
NSCharacterSet *selectionParagraphGranularitySet;
|
||||
BOOL displayDisabled;
|
||||
float currentCursorX; // column-stable cursor up/down
|
||||
float currentCursorY; // column-stable cursor up/down
|
||||
// contains private _GNULineLayoutInfo objects
|
||||
id _layoutManager;
|
||||
}
|
||||
|
||||
//
|
||||
// Getting and Setting Contents (low level: no selection handling,
|
||||
// relayout or display)
|
||||
//
|
||||
- (void)replaceCharactersInRange:(NSRange)aRange withRTF:(NSData *)rtfData;
|
||||
- (void)replaceCharactersInRange:(NSRange)aRange withRTFD:(NSData *)rtfdData;
|
||||
- (void)replaceCharactersInRange:(NSRange)aRange withString:(NSString *)aString;
|
||||
-(void) setString:(NSString *)string;
|
||||
-(NSString*) string;
|
||||
/*
|
||||
* Getting and Setting Contents
|
||||
*/
|
||||
- (void) replaceCharactersInRange: (NSRange)aRange
|
||||
withRTF: (NSData*)rtfData;
|
||||
- (void) replaceCharactersInRange: (NSRange)aRange
|
||||
withRTFD: (NSData*)rtfdData;
|
||||
- (void) replaceCharactersInRange: (NSRange)aRange
|
||||
withString: (NSString*)aString;
|
||||
- (void) setString: (NSString*)string;
|
||||
- (NSString*) string;
|
||||
|
||||
// old fashioned
|
||||
-(void) replaceRange:(NSRange)range withString:(NSString*) aString;
|
||||
-(void) replaceRange:(NSRange)range withRTF:(NSData *)rtfData;
|
||||
-(void) replaceRange:(NSRange)range withRTFD:(NSData *)rtfdData;
|
||||
-(void) setText:(NSString *)string;
|
||||
-(void) setText:(NSString*) aString
|
||||
range:(NSRange) aRange;
|
||||
-(NSString*) text;
|
||||
- (void) replaceRange: (NSRange)range withString: (NSString*)aString;
|
||||
- (void) replaceRange: (NSRange)range withRTF: (NSData*)rtfData;
|
||||
- (void) replaceRange: (NSRange)range withRTFD: (NSData*)rtfdData;
|
||||
- (void) setText: (NSString*)string;
|
||||
- (void) setText: (NSString*)aString
|
||||
range: (NSRange)aRange;
|
||||
- (NSString*) text;
|
||||
|
||||
//
|
||||
// Graphic attributes
|
||||
//
|
||||
- (NSColor *) backgroundColor;
|
||||
/*
|
||||
* Graphic attributes
|
||||
*/
|
||||
- (NSColor*) backgroundColor;
|
||||
- (BOOL) drawsBackground;
|
||||
- (void) setBackgroundColor:(NSColor *)color;
|
||||
- (void) setDrawsBackground:(BOOL)flag;
|
||||
- (void) setBackgroundColor: (NSColor*)color;
|
||||
- (void) setDrawsBackground: (BOOL)flag;
|
||||
|
||||
|
||||
//
|
||||
// Managing Global Characteristics
|
||||
//
|
||||
- (BOOL)importsGraphics;
|
||||
- (BOOL)isEditable;
|
||||
- (BOOL)isFieldEditor;
|
||||
- (BOOL)isRichText;
|
||||
- (BOOL)isSelectable;
|
||||
- (void)setEditable:(BOOL)flag;
|
||||
- (void)setFieldEditor:(BOOL)flag;
|
||||
- (void)setImportsGraphics:(BOOL)flag;
|
||||
- (void)setRichText:(BOOL)flag;
|
||||
- (void)setSelectable:(BOOL)flag;
|
||||
/*
|
||||
* Managing Global Characteristics
|
||||
*/
|
||||
- (BOOL) importsGraphics;
|
||||
- (BOOL) isEditable;
|
||||
- (BOOL) isFieldEditor;
|
||||
- (BOOL) isRichText;
|
||||
- (BOOL) isSelectable;
|
||||
- (void) setEditable: (BOOL)flag;
|
||||
- (void) setFieldEditor: (BOOL)flag;
|
||||
- (void) setImportsGraphics: (BOOL)flag;
|
||||
- (void) setRichText: (BOOL)flag;
|
||||
- (void) setSelectable: (BOOL)flag;
|
||||
|
||||
//
|
||||
// Using the font panel
|
||||
//
|
||||
- (void) setUsesFontPanel: (BOOL) flag;
|
||||
/*
|
||||
* Using the font panel
|
||||
*/
|
||||
- (void) setUsesFontPanel: (BOOL)flag;
|
||||
- (BOOL) usesFontPanel;
|
||||
|
||||
//
|
||||
// Managing the Ruler
|
||||
//
|
||||
- (BOOL)isRulerVisible;
|
||||
- (void)toggleRuler:(id)sender;
|
||||
/*
|
||||
* Managing the Ruler
|
||||
*/
|
||||
- (BOOL) isRulerVisible;
|
||||
- (void) toggleRuler: (id)sender;
|
||||
|
||||
//
|
||||
// Managing the Selection
|
||||
//
|
||||
- (NSRange)selectedRange;
|
||||
- (void)setSelectedRange:(NSRange)range;
|
||||
/*
|
||||
* Managing the Selection
|
||||
*/
|
||||
- (NSRange) selectedRange;
|
||||
- (void) setSelectedRange: (NSRange)range;
|
||||
|
||||
//
|
||||
// Responding to Editing Commands
|
||||
//
|
||||
- (void)copy:(id)sender;
|
||||
- (void)copyFont:(id)sender;
|
||||
- (void)copyRuler:(id)sender;
|
||||
- (void)cut:(id)sender;
|
||||
- (void)delete:(id)sender;
|
||||
- (void)paste:(id)sender;
|
||||
- (void)pasteFont:(id)sender;
|
||||
- (void)pasteRuler:(id)sender;
|
||||
- (void)selectAll:(id)sender;
|
||||
/*
|
||||
* Responding to Editing Commands
|
||||
*/
|
||||
- (void) copy: (id)sender;
|
||||
- (void) copyFont: (id)sender;
|
||||
- (void) copyRuler: (id)sender;
|
||||
- (void) cut: (id)sender;
|
||||
- (void) delete: (id)sender;
|
||||
- (void) paste: (id)sender;
|
||||
- (void) pasteFont: (id)sender;
|
||||
- (void) pasteRuler: (id)sender;
|
||||
- (void) selectAll: (id)sender;
|
||||
|
||||
//
|
||||
// Managing Font
|
||||
//
|
||||
- (void)changeFont:(id)sender;
|
||||
- (NSFont *)font;
|
||||
- (void)setFont:(NSFont *)obj;
|
||||
- (void)setFont:(NSFont *)font ofRange:(NSRange)range;
|
||||
/*
|
||||
* Managing Font
|
||||
*/
|
||||
- (void) changeFont: (id)sender;
|
||||
- (NSFont*) font;
|
||||
- (void) setFont: (NSFont*)obj;
|
||||
- (void) setFont: (NSFont*)font ofRange: (NSRange)range;
|
||||
|
||||
//
|
||||
// Managing Alingment
|
||||
//
|
||||
/*
|
||||
* Managing Alignment
|
||||
*/
|
||||
- (NSTextAlignment) alignment;
|
||||
- (void) setAlignment: (NSTextAlignment) mode;
|
||||
- (void)alignCenter:(id)sender;
|
||||
- (void)alignLeft:(id)sender;
|
||||
- (void)alignRight:(id)sender;
|
||||
- (void) setAlignment: (NSTextAlignment)mode;
|
||||
- (void) alignCenter: (id)sender;
|
||||
- (void) alignLeft: (id)sender;
|
||||
- (void) alignRight: (id)sender;
|
||||
|
||||
//
|
||||
// Text colour
|
||||
//
|
||||
- (void) setTextColor:(NSColor *)color range:(NSRange)range;
|
||||
- (void) setColor:(NSColor *)color ofRange:(NSRange)range;
|
||||
- (void) setTextColor:(NSColor *)color;
|
||||
- (NSColor *)textColor;
|
||||
/*
|
||||
* Text colour
|
||||
*/
|
||||
- (void) setTextColor: (NSColor*)color range: (NSRange)range;
|
||||
- (void) setColor: (NSColor*)color ofRange: (NSRange)range;
|
||||
- (void) setTextColor: (NSColor*)color;
|
||||
- (NSColor*) textColor;
|
||||
|
||||
//
|
||||
// Text attributes
|
||||
//
|
||||
- (void)subscript:(id)sender;
|
||||
- (void)superscript:(id)sender;
|
||||
- (void)underline:(id)sender;
|
||||
- (void)unscript:(id)sender;
|
||||
/*
|
||||
* Text attributes
|
||||
*/
|
||||
- (void) subscript: (id)sender;
|
||||
- (void) superscript: (id)sender;
|
||||
- (void) underline: (id)sender;
|
||||
- (void) unscript: (id)sender;
|
||||
|
||||
//
|
||||
// Reading and Writing RTFD Files
|
||||
//
|
||||
-(BOOL) readRTFDFromFile:(NSString *)path;
|
||||
-(BOOL) writeRTFDToFile:(NSString *)path atomically:(BOOL)flag;
|
||||
-(NSData*) RTFDFromRange:(NSRange)range;
|
||||
-(NSData*) RTFFromRange:(NSRange)range;
|
||||
/*
|
||||
* Reading and Writing RTFD Files
|
||||
*/
|
||||
-(BOOL) readRTFDFromFile: (NSString*)path;
|
||||
-(BOOL) writeRTFDToFile: (NSString*)path atomically: (BOOL)flag;
|
||||
-(NSData*) RTFDFromRange: (NSRange)range;
|
||||
-(NSData*) RTFFromRange: (NSRange)range;
|
||||
|
||||
//
|
||||
// Sizing the Frame Rectangle
|
||||
//
|
||||
- (BOOL)isHorizontallyResizable;
|
||||
- (BOOL)isVerticallyResizable;
|
||||
- (NSSize)maxSize;
|
||||
- (NSSize)minSize;
|
||||
- (void)setHorizontallyResizable:(BOOL)flag;
|
||||
- (void)setMaxSize:(NSSize)newMaxSize;
|
||||
- (void)setMinSize:(NSSize)newMinSize;
|
||||
- (void)setVerticallyResizable:(BOOL)flag;
|
||||
- (void)sizeToFit;
|
||||
/*
|
||||
* Sizing the Frame Rectangle
|
||||
*/
|
||||
- (BOOL) isHorizontallyResizable;
|
||||
- (BOOL) isVerticallyResizable;
|
||||
- (NSSize) maxSize;
|
||||
- (NSSize) minSize;
|
||||
- (void) setHorizontallyResizable: (BOOL)flag;
|
||||
- (void) setMaxSize: (NSSize)newMaxSize;
|
||||
- (void) setMinSize: (NSSize)newMinSize;
|
||||
- (void) setVerticallyResizable: (BOOL)flag;
|
||||
- (void) sizeToFit;
|
||||
|
||||
//
|
||||
// Spelling
|
||||
//
|
||||
-(void) checkSpelling:(id)sender;
|
||||
-(void) showGuessPanel:(id)sender;
|
||||
/*
|
||||
* Spelling
|
||||
*/
|
||||
- (void) checkSpelling: (id)sender;
|
||||
- (void) showGuessPanel: (id)sender;
|
||||
|
||||
//
|
||||
// Scrolling
|
||||
//
|
||||
- (void)scrollRangeToVisible:(NSRange)range;
|
||||
/*
|
||||
* Scrolling
|
||||
*/
|
||||
- (void) scrollRangeToVisible: (NSRange)range;
|
||||
|
||||
//
|
||||
// Managing the Delegate
|
||||
//
|
||||
- delegate;
|
||||
-(void) setDelegate:anObject;
|
||||
/*
|
||||
* Managing the Delegate
|
||||
*/
|
||||
- (id) delegate;
|
||||
- (void) setDelegate: (id)anObject;
|
||||
|
||||
/*
|
||||
* NSCoding protocol
|
||||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder;
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder;
|
||||
|
||||
//
|
||||
// NSCoding protocol
|
||||
//
|
||||
- (void)encodeWithCoder:aCoder;
|
||||
- initWithCoder:aDecoder;
|
||||
/*
|
||||
* NSChangeSpelling protocol
|
||||
*/
|
||||
- (void) changeSpelling: (id)sender;
|
||||
|
||||
//
|
||||
// NSChangeSpelling protocol
|
||||
//
|
||||
- (void) changeSpelling:(id)sender;
|
||||
|
||||
//
|
||||
// NSIgnoreMisspelledWords protocol
|
||||
//
|
||||
- (void)ignoreSpelling:(id)sender;
|
||||
/*
|
||||
* NSIgnoreMisspelledWords protocol
|
||||
*/
|
||||
- (void) ignoreSpelling: (id)sender;
|
||||
@end
|
||||
|
||||
|
||||
@interface NSText(GNUstepExtension)
|
||||
// GNU extension (override it if you want other characters treated
|
||||
// as newline characters)
|
||||
+(NSString*) newlineString;
|
||||
+ (NSString*) newlineString;
|
||||
|
||||
// GNU extension
|
||||
-(void) replaceRange:(NSRange)range
|
||||
withAttributedString:(NSAttributedString*)attrString;
|
||||
-(unsigned) textLength;
|
||||
- (NSRange) lineRangeForRect: (NSRect) rect;
|
||||
- (NSRect) rectForCharacterIndex: (unsigned) index;
|
||||
- (void) replaceRange: (NSRange)range
|
||||
withAttributedString: (NSAttributedString*)attrString;
|
||||
- (unsigned) textLength;
|
||||
|
||||
//
|
||||
// these NSTextView methods are here only informally (GNU extensions)
|
||||
//
|
||||
-(int) spellCheckerDocumentTag;
|
||||
- (int) spellCheckerDocumentTag;
|
||||
|
||||
-(void) insertText:insertString; // argument may be of class NSString or NSAttributedString (if isRichText)
|
||||
-(NSMutableDictionary*) typingAttributes;
|
||||
-(void) setTypingAttributes:(NSDictionary *)attrs;
|
||||
// changed to only except class NSString
|
||||
- (void) insertText: (NSString*)insertString;
|
||||
|
||||
-(BOOL) shouldDrawInsertionPoint;
|
||||
-(void) drawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)flag;
|
||||
- (NSMutableDictionary*) typingAttributes;
|
||||
- (void) setTypingAttributes: (NSDictionary*)attrs;
|
||||
|
||||
-(NSRange) selectionRangeForProposedRange:(NSRange)proposedCharRange granularity:(NSSelectionGranularity)granularity; // override if you want special cursor behaviour
|
||||
- (void) updateFontPanel;
|
||||
|
||||
-(NSArray*) acceptableDragTypes;
|
||||
-(void) updateDragTypeRegistration;
|
||||
- (BOOL) shouldDrawInsertionPoint;
|
||||
- (void) drawInsertionPointInRect: (NSRect)rect
|
||||
color: (NSColor*)color
|
||||
turnedOn: (BOOL)flag;
|
||||
|
||||
// override if you want special cursor behaviour
|
||||
- (NSRange) selectionRangeForProposedRange: (NSRange)proposedCharRange
|
||||
granularity: (NSSelectionGranularity)granularity;
|
||||
|
||||
- (NSArray*) acceptableDragTypes;
|
||||
- (void) updateDragTypeRegistration;
|
||||
@end
|
||||
|
||||
/* Notifications */
|
||||
|
@ -332,11 +335,11 @@ extern NSString *NSTextDidChangeNotification;
|
|||
|
||||
#ifdef GNUSTEP
|
||||
@interface NSObject(NSTextDelegate)
|
||||
- (BOOL)textShouldBeginEditing:(NSText *)textObject; /* YES means do it */
|
||||
- (BOOL)textShouldEndEditing:(NSText *)textObject; /* YES means do it */
|
||||
- (void)textDidBeginEditing:(NSNotification *)notification;
|
||||
- (void)textDidEndEditing:(NSNotification *)notification;
|
||||
- (void)textDidChange:(NSNotification *)notification; /* Any keyDown or paste which changes the contents causes this */
|
||||
- (BOOL) textShouldBeginEditing: (NSText*)textObject; /* YES means do it */
|
||||
- (BOOL) textShouldEndEditing: (NSText*)textObject; /* YES means do it */
|
||||
- (void) textDidBeginEditing: (NSNotification*)notification;
|
||||
- (void) textDidEndEditing: (NSNotification*)notification;
|
||||
- (void) textDidChange: (NSNotification*)notification; /* Any keyDown or paste which changes the contents causes this */
|
||||
@end
|
||||
#endif
|
||||
|
||||
|
|
|
@ -365,8 +365,14 @@ static Class fontPanelClass = Nil;
|
|||
|
||||
// We update our own selected font
|
||||
if (_selectedFont != nil)
|
||||
[self setSelectedFont: [self convertFont: _selectedFont]
|
||||
isMultiple: _multiple];
|
||||
{
|
||||
NSFont *newFont = [self convertFont: _selectedFont];
|
||||
|
||||
if (newFont != nil)
|
||||
{
|
||||
[self setSelectedFont: newFont isMultiple: _multiple];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) removeFontTrait: (id)sender
|
||||
|
@ -377,8 +383,14 @@ static Class fontPanelClass = Nil;
|
|||
|
||||
// We update our own selected font
|
||||
if (_selectedFont != nil)
|
||||
[self setSelectedFont: [self convertFont: _selectedFont]
|
||||
isMultiple: _multiple];
|
||||
{
|
||||
NSFont *newFont = [self convertFont: _selectedFont];
|
||||
|
||||
if (newFont != nil)
|
||||
{
|
||||
[self setSelectedFont: newFont isMultiple: _multiple];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) modifyFont: (id)sender
|
||||
|
@ -388,8 +400,14 @@ static Class fontPanelClass = Nil;
|
|||
|
||||
// We update our own selected font
|
||||
if (_selectedFont != nil)
|
||||
[self setSelectedFont: [self convertFont: _selectedFont]
|
||||
isMultiple: _multiple];
|
||||
{
|
||||
NSFont *newFont = [self convertFont: _selectedFont];
|
||||
|
||||
if (newFont != nil)
|
||||
{
|
||||
[self setSelectedFont: newFont isMultiple: _multiple];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) modifyFontViaPanel: (id)sender
|
||||
|
@ -399,8 +417,14 @@ static Class fontPanelClass = Nil;
|
|||
|
||||
// We update our own selected font
|
||||
if (_selectedFont != nil)
|
||||
[self setSelectedFont: [self convertFont: _selectedFont]
|
||||
isMultiple: _multiple];
|
||||
{
|
||||
NSFont *newFont = [self convertFont: _selectedFont];
|
||||
|
||||
if (newFont != nil)
|
||||
{
|
||||
[self setSelectedFont: newFont isMultiple: _multiple];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -222,6 +222,8 @@ float sizes[] = {4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
|
|||
//TODO: We go over every item in the panel and check if a
|
||||
// value is selected. If so we send it on to the manager
|
||||
// newFont = [fm convertFont: fontObject toHaveTrait: NSItalicFontMask];
|
||||
NSLog(@"Multiple font conversion not implemented in NSFontPanel");
|
||||
newFont = nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
5705
Source/NSText.m
5705
Source/NSText.m
File diff suppressed because it is too large
Load diff
|
@ -934,8 +934,8 @@ container, returning the modified location. */
|
|||
[super setDelegate: anObject];
|
||||
|
||||
#define SET_DELEGATE_NOTIFICATION(notif_name) \
|
||||
if ([delegate respondsToSelector: @selector(textView##notif_name: )]) \
|
||||
[nc addObserver: delegate \
|
||||
if ([_delegate respondsToSelector: @selector(textView##notif_name: )]) \
|
||||
[nc addObserver: _delegate \
|
||||
selector: @selector(textView##notif_name: ) \
|
||||
name: NSTextView##notif_name##Notification \
|
||||
object: self]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue