* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),

various methods add fieldEditor support.
	* GSContext.m/GSContext.h revert to previous code as solution discussed
	with Adam Fedor regarding backends had problems I had not forseen.
	* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
	cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
	dealloc bug), highlight: eliminate method (fixes dup display bug).
	* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
	* NSStringDrawing.h/.m remove unimplemented draw methods from Category
	(these are backend specific, can't be defined twice and are already
	implemented in xraw).
	* NSApplication.h redefine initialize_gnustep_backend () per Adam's
	redefinition in the backend.
	* Functions.m/.h remove initialize_gnustep_backend()
 	* NSCell.m preliminary implementation of fieldEditor mechanism,
	copyWithZone: optimize and eliminate use of ASSIGN
	* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
	* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
	matrix drawing if possible.
	* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
	(fewer lines and no if/else logic), changed code to use view frame instead
	of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
	adjustment unless view has been scaled.
	* NSScrollView.m define as externs various PS* functions for use in
	drawing, polish drawing, move all backend code to front.
	* Tools/dummy.m define dummy PS* functions employed in gui.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Felipe A. Rodriguez 1998-12-14 09:54:38 +00:00
parent 6130d3c1f9
commit f29476bc08
21 changed files with 1402 additions and 1390 deletions

View file

@ -1,3 +1,32 @@
Mon Dec 14 1998 Felipe A. Rodriguez <far@ix.netcom.com>
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
Mon Dec 14 9:10:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* NSPanel.m: Implemented all the alert panel functions

View file

@ -78,7 +78,7 @@ typedef enum _NSWindowOrderingMode {
} NSWindowOrderingMode;
extern NSString *NSBackendContext;
@interface GSContext : NSObject
{
@ -86,11 +86,6 @@ extern NSString *NSBackendContext;
NSMutableData *context_data;
}
//
// Setup the Backend library
//
+ (void) initializeGUIBackend;
//
// Setting and Identifying the concrete class
//

View file

@ -296,7 +296,7 @@ extern NSString *NSEventTrackingRunLoopMode;
/* Backend functions */
extern void initialize_gnustep_backend (void);
extern BOOL initialize_gnustep_backend (void);
//

View file

@ -38,9 +38,9 @@
{
// Attributes
NSImage *_alternateImage;
NSCell *_branchImage;
NSCell *_highlightBranchImage;
NSTextFieldCell *_browserText;
NSImage *_branchImage;
NSImage *_highlightBranchImage;
NSCell *_browserText;
BOOL _isLeaf;
BOOL _isLoaded;

View file

@ -67,8 +67,6 @@ enum
@interface NSString (NSStringDrawing)
- (void) drawAtPoint: (NSPoint)aPoint withAttributes: (NSDictionary *)attr;
- (void) drawInRect: (NSRect)aRect withAttributes: (NSDictionary *)attr;
- (NSSize)sizeWithAttributes:(NSDictionary *)attrs;
@end

View file

@ -414,8 +414,8 @@ extern NSSize NSTokenSize;
//
// Mouse capture/release
//
- (void)captureMouse: sender;
- (void)releaseMouse: sender;
- (void)_captureMouse: sender;
- (void)_releaseMouse: sender;
// Allow subclasses to init without the backend class
// attempting to create an actual window

View file

@ -60,12 +60,6 @@ extern char** environ;
return 0;
}
void
initialize_gnustep_backend(void)
{
[GSContext initializeGUIBackend];
}
//
// Convert an NSEvent Type to it's respective Event Mask
//

View file

@ -32,15 +32,13 @@
#include <Foundation/NSString.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSValue.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSException.h>
#include <Foundation/NSData.h>
#include <Foundation/NSZone.h>
#include <Foundation/NSUserDefaults.h>
#include "AppKit/GSContext.h"
NSZone *_globalGSZone = NULL; // The memory zone where all
// global objects are allocated
// from (Contexts are also
@ -48,21 +46,10 @@ NSZone *_globalGSZone = NULL; // The memory zone where all
//
// Class variables
//
static Class _concreteClass; // actual class of GSContext
static Class _concreteClass; // actual class of GSContext
static NSMutableArray *contextList; // list of drawing destinations
static BOOL _gnustepBackendInitialized = NO;
extern GSContext *_currentGSContext;
static NSString *knownBackends[] = {
@"XGContext",
@"XRContext",
nil
};
@interface GSContext (Backend)
+ (void) _initializeGUIBackend;
@end
@implementation GSContext
@ -73,45 +60,12 @@ static NSString *knownBackends[] = {
{
if (self == (_concreteClass = [GSContext class]))
{
_globalGSZone = NSDefaultMallocZone();
contextList = [[NSMutableArray allocWithZone: _globalGSZone] init];
contextList = [[NSMutableArray arrayWithCapacity:2] retain];
NSDebugLog(@"Initialize GSContext class\n");
[self setVersion:1]; // Initial version
}
}
+ (void) initializeGUIBackend
{
NSString *backend;
if (_gnustepBackendInitialized)
{
NSLog(@"Invalid initialization: Backend already initialized\n");
return;
}
backend = [[NSUserDefaults standardUserDefaults]
stringForKey: NSBackendContext];
if (backend)
_concreteClass = NSClassFromString(backend);
if (!_concreteClass || _concreteClass == [GSContext class])
{
/* No backend class set, or class not found */
int i = 0;
_concreteClass = Nil;
while (knownBackends[i])
if ((_concreteClass = NSClassFromString(knownBackends[i++])))
break;
}
if (!_concreteClass)
{
NSLog(@"Invalid initialization: No backend found\n");
return;
}
[_concreteClass _initializeGUIBackend];
}
+ (void) setConcreteClass: (Class)c { _concreteClass = c; }
+ (Class) concreteClass { return _concreteClass; }
@ -132,11 +86,11 @@ GSContext *context;
return context;
}
+ (GSContext *) currentContext { return _currentGSContext;}
+ (GSContext *) currentContext { return nil;} // backend
+ (void) setCurrentContext: (GSContext *)context
{
_currentGSContext = context;
[self subclassResponsibility:_cmd]; // backend
}
+ (void) destroyContext:(GSContext *) context
@ -171,6 +125,7 @@ int top; // deallocated with the
[contextList addObject: self];
[_concreteClass setCurrentContext: self];
if(info)
context_info = [info retain];
@ -193,4 +148,3 @@ int top; // deallocated with the
}
@end

View file

@ -487,9 +487,9 @@ unsigned i;
copyOfMainMenu = [main_menu copy]; // under the mouse
copyMenuWindow = [copyOfMainMenu menuWindow];
[copyOfMainMenu _rightMouseDisplay];
[copyMenuWindow captureMouse:self];
[copyMenuWindow _captureMouse:self];
[[copyOfMainMenu menuCells] mouseDown:theEvent];
[copyMenuWindow releaseMouse:self];
[copyMenuWindow _releaseMouse:self];
}
break;

View file

@ -35,12 +35,15 @@
#include <AppKit/NSImage.h>
#include <AppKit/NSEvent.h>
//
// Class variables
//
static NSImage *branch_image;
static NSImage *highlight_image;
//
// Private methods
//
@interface NSBrowserCell (Private)
- (void)setBranchImageCell:aCell;
- (void)setHighlightBranchImageCell:aCell;
@ -49,15 +52,22 @@ static NSImage *highlight_image;
@implementation NSBrowserCell (Private)
- (void)setBranchImageCell:aCell { _branchImage = aCell; }
- (void)setHighlightBranchImageCell:aCell { _highlightBranchImage = aCell; }
- (void)setTextFieldCell:aCell { _browserText = aCell; }
- (void)setTextFieldCell:aCell { ASSIGN(_browserText, aCell); }
- (void)setBranchImageCell:aCell { ASSIGN(_branchImage, aCell); }
- (void)setHighlightBranchImageCell:aCell
{
ASSIGN(_highlightBranchImage, aCell);
}
@end
//*****************************************************************************
//
// NSBrowserCell implementation
// NSBrowserCell
//
//*****************************************************************************
@implementation NSBrowserCell
//
@ -67,10 +77,9 @@ static NSImage *highlight_image;
{
if (self == [NSBrowserCell class])
{
[self setVersion:1];
// The default images
branch_image = [NSImage imageNamed: @"common_ArrowRight"];
highlight_image = [NSImage imageNamed: @"common_ArrowRightH"];
[self setVersion:1]; // The default images
ASSIGN(branch_image, [NSImage imageNamed: @"common_ArrowRight"]);
ASSIGN(highlight_image, [NSImage imageNamed: @"common_ArrowRightH"]);
}
}
@ -92,14 +101,13 @@ static NSImage *highlight_image;
{
[super initTextCell: aString];
// create image cells
_branchImage = [[NSCell alloc] initImageCell: [NSBrowserCell branchImage]];
_highlightBranchImage = [[NSCell alloc] initImageCell:
[NSBrowserCell highlightedBranchImage]];
_branchImage = [[NSBrowserCell branchImage] retain];
_highlightBranchImage = [[NSBrowserCell highlightedBranchImage] retain];
// create the text cell
_browserText = [[NSTextFieldCell alloc] initTextCell: aString];
_browserText = [[[NSCell alloc] initTextCell: aString] retain];
[_browserText setEditable: NO];
[_browserText setBordered: NO];
[_browserText setDrawsBackground: YES];
[_browserText setAlignment:NSLeftTextAlignment];
_alternateImage = nil;
_isLeaf = NO;
@ -114,7 +122,8 @@ static NSImage *highlight_image;
{
[_branchImage release];
[_highlightBranchImage release];
[_alternateImage release];
if(_alternateImage)
[_alternateImage release];
[_browserText release];
[super dealloc];
@ -124,14 +133,13 @@ static NSImage *highlight_image;
{
NSBrowserCell* c = [super copyWithZone:zone];
// Copy the image cells
[c setBranchImageCell: [_branchImage copy]];
[c setHighlightBranchImageCell: [_branchImage copy]];
[c setAlternateImage: _alternateImage];
[c setTextFieldCell: [_browserText copy]]; // Copy the text cell
[c setLeaf: _isLeaf];
[c setLoaded: NO];
c->_branchImage = [_branchImage retain];
if(_alternateImage)
c->_alternateImage = [_alternateImage retain];
c->_highlightBranchImage = [_highlightBranchImage retain];
c->_browserText = [[_browserText copy] retain]; // Copy the text cell
c->_isLeaf = _isLeaf;
c->_isLoaded = _isLoaded;
return c;
}
@ -142,15 +150,8 @@ NSBrowserCell* c = [super copyWithZone:zone];
- (NSImage *)alternateImage { return _alternateImage; }
- (void)setAlternateImage:(NSImage *)anImage
{
[anImage retain];
[_alternateImage release];
_alternateImage = anImage;
// Set the image in our
if (_alternateImage) // highlight cell
[_highlightBranchImage setImage: _alternateImage];
else
[_highlightBranchImage setImage:[NSBrowserCell highlightedBranchImage]];
{ // set image to display
ASSIGN(_alternateImage, anImage); // when highlighted
}
//
@ -220,10 +221,10 @@ NSImage *image = nil;
NSColor *white = [NSColor whiteColor];
[white set];
[_browserText setBackgroundColor: white];
// [_browserText setBackgroundColor: white];
if (!_isLeaf)
{
image = [_highlightBranchImage image];
image = _highlightBranchImage;
image_rect.size.height = cellFrame.size.height;
image_rect.size.width = image_rect.size.height;
// Right justify
@ -237,10 +238,10 @@ NSImage *image = nil;
NSColor *backColor = [[controlView window] backgroundColor];
[backColor set];
[_browserText setBackgroundColor:backColor];
// [_browserText setBackgroundColor:backColor];
if (!_isLeaf)
{
image = [_branchImage image];
image = _branchImage;
image_rect.size.height = cellFrame.size.height;
image_rect.size.width = image_rect.size.height;
// Right justify
@ -264,13 +265,6 @@ NSImage *image = nil;
[self drawInteriorWithFrame: cellFrame inView: controlView];
}
- (void)highlight:(BOOL)lit withFrame:(NSRect)cellFrame // may not be per
inView:(NSView *)controlView // spec FIX ME?
{
[super highlight: lit withFrame: cellFrame inView: controlView];
[self drawInteriorWithFrame: cellFrame inView: controlView];
}
//
// Editing Text
//

View file

@ -208,7 +208,8 @@ NSString* _string = [aString copy];
{
[super setType:buttonType];
switch (buttonType) {
switch (buttonType)
{
case NSMomentaryLight:
[self setHighlightsBy:NSChangeBackgroundCellMask];
[self setShowsStateBy:NSNoCellMask];
@ -249,7 +250,7 @@ NSString* _string = [aString copy];
[self setImagePosition:NSImageLeft];
[self setAlignment:NSLeftTextAlignment];
break;
}
}
// update our state
[self setState:[self state]];
@ -283,9 +284,11 @@ NSString* _string = [aString copy];
NSButtonCell* c = [super copyWithZone:zone];
c->altContents = [[altContents copy] retain];
ASSIGN(c->altImage, altImage);
if(altImage)
c->altImage = [altImage retain];
c->keyEquivalent = [[keyEquivalent copy] retain];
ASSIGN(c->keyEquivalentFont, keyEquivalentFont);
if(keyEquivalentFont)
c->keyEquivalentFont = [keyEquivalentFont retain];
c->keyEquivalentModifierMask = keyEquivalentModifierMask;
c->transparent = transparent;
c->highlightsByMask = highlightsByMask;

View file

@ -134,10 +134,14 @@
- (void)dealloc
{
[contents release];
[cell_image release];
if(contents)
[contents release];
if(cell_image)
[cell_image release];
[cell_font release];
[represented_object release];
if(represented_object)
[represented_object release];
[super dealloc];
}
@ -386,14 +390,27 @@ NSString* _string;
// Editing Text
//
- (void)editWithFrame:(NSRect)aRect
inView:(NSView *)controlView
editor:(NSText *)textObject
delegate:(id)anObject
event:(NSEvent *)theEvent
{}
inView:(NSView *)controlView
editor:(NSText *)textObject
delegate:(id)anObject
event:(NSEvent *)theEvent
{
[[controlView window] makeFirstResponder:textObject];
[textObject setFrame:aRect];
[textObject setText:[self stringValue]];
[textObject setDelegate:anObject];
[controlView addSubview:textObject];
NSEraseRect(aRect);
[textObject display];
}
- (void)endEditing:(NSText *)textObject
{}
{
[textObject removeFromSuperview];
[self setStringValue: [textObject text]];
[textObject setDelegate:nil];
}
- (void)selectWithFrame:(NSRect)aRect
inView:(NSView *)controlView
@ -719,9 +736,11 @@ BOOL mouseWentUp;
{
NSCell* c = [[isa allocWithZone: zone] init];
c->contents = [[contents copy] retain];
ASSIGN(c->cell_image, cell_image);
ASSIGN(c->cell_font, cell_font);
if(contents)
c->contents = [[contents copy] retain];
if(cell_image)
c->cell_image = [cell_image retain];
c->cell_font = [cell_font retain];
c->cell_state = cell_state;
c->cell_highlighted = cell_highlighted;
c->cell_enabled = cell_enabled;

View file

@ -39,7 +39,9 @@
//
// Class variables
//
static id MB_NSCONTROL_CELL_CLASS = nil;
static id _NSCONTROL_CELL_CLASS = nil;
@implementation NSControl
@ -48,54 +50,36 @@ static id MB_NSCONTROL_CELL_CLASS = nil;
//
+ (void)initialize
{
if (self == [NSControl class])
{
NSDebugLog(@"Initialize NSControl class\n");
// Initial version
[self setVersion:1];
// Set cell class
[self setCellClass:[NSCell class]];
}
if (self == [NSControl class])
{
NSDebugLog(@"Initialize NSControl class\n");
[self setVersion:1]; // Initial version
[self setCellClass:[NSCell class]]; // Set cell class
}
}
//
// Setting the Control's Cell
//
+ (Class)cellClass
{
return MB_NSCONTROL_CELL_CLASS;
}
+ (void)setCellClass:(Class)factoryId
{
MB_NSCONTROL_CELL_CLASS = factoryId;
}
+ (Class)cellClass { return _NSCONTROL_CELL_CLASS; }
+ (void)setCellClass:(Class)factoryId { _NSCONTROL_CELL_CLASS = factoryId; }
//
// Instance methods
//
//
// Initializing an NSControl Object
//
- (id)initWithFrame:(NSRect)frameRect
{
[super initWithFrame:frameRect];
[super initWithFrame:frameRect];
// create our cell
[self setCell:[[_NSCONTROL_CELL_CLASS new] autorelease]];
tag = 0;
// create our cell
[self setCell:[[MB_NSCONTROL_CELL_CLASS new] autorelease]];
tag = 0;
return self;
return self;
}
- (void)dealloc
{
// release our cell
[cell release];
[cell release]; // release our cell
[super dealloc];
}
@ -104,64 +88,52 @@ static id MB_NSCONTROL_CELL_CLASS = nil;
//
- copyWithZone:(NSZone *)zone
{
id c;
c = NSCopyObject (self, 0, zone);
id c = NSCopyObject (self, 0, zone);
// make sure the new copy also has a new copy of the cell
[cell retain];
[c setCell: [[cell copy] autorelease]];
return c;
[cell retain]; // give new control
[c setCell: [[cell copy] autorelease]]; // a copy of cell
return c;
}
//
// Setting the Control's Cell
//
- (id)cell
{
return cell;
}
- (id)cell { return cell; }
- (void)setCell:(NSCell *)aCell
{
// Not a cell class --then forget it
if (![aCell isKindOfClass:[NSCell class]])
return;
if (![aCell isKindOfClass:[NSCell class]]) // must be a cell
return;
[cell setControlView:nil];
[aCell setControlView:self];
[aCell retain];
[cell release];
cell = aCell;
[cell setControlView:nil];
[aCell setControlView:self];
[aCell retain];
[cell release];
cell = aCell;
}
//
// Enabling and Disabling the Control
//
- (BOOL)isEnabled
{
return [[self selectedCell] isEnabled];
}
- (void)setEnabled:(BOOL)flag
{
[[self selectedCell] setEnabled:flag];
}
- (BOOL)isEnabled { return [[self selectedCell] isEnabled]; }
- (void)setEnabled:(BOOL)flag { [[self selectedCell] setEnabled:flag]; }
//
// Identifying the Selected Cell
//
- (id)selectedCell
{
if ([cell state])
return cell;
else
return nil;
if ([cell state])
return cell;
else
return nil;
}
- (int)selectedTag
{
return [[self selectedCell] tag];
return [[self selectedCell] tag];
}
//
@ -169,51 +141,48 @@ static id MB_NSCONTROL_CELL_CLASS = nil;
//
- (double)doubleValue
{
return [[self selectedCell] doubleValue];
return [[self selectedCell] doubleValue];
}
- (float)floatValue
{
return [[self selectedCell] floatValue];
return [[self selectedCell] floatValue];
}
- (int)intValue
{
return [[self selectedCell] intValue];
return [[self selectedCell] intValue];
}
- (void)setDoubleValue:(double)aDouble
{
[[self selectedCell] setDoubleValue:aDouble];
[self setNeedsDisplay:YES];
[[self selectedCell] setDoubleValue:aDouble];
[self setNeedsDisplay:YES];
}
- (void)setFloatValue:(float)aFloat
{
[[self selectedCell] setFloatValue:aFloat];
[self setNeedsDisplay:YES];
[[self selectedCell] setFloatValue:aFloat];
[self setNeedsDisplay:YES];
}
- (void)setIntValue:(int)anInt
{
[[self selectedCell] setIntValue:anInt];
[self setNeedsDisplay:YES];
[[self selectedCell] setIntValue:anInt];
[self setNeedsDisplay:YES];
}
- (void)setNeedsDisplay
{
[super setNeedsDisplay:YES];
}
- (void)setNeedsDisplay { [super setNeedsDisplay:YES]; }
- (void)setStringValue:(NSString *)aString
{
[[self selectedCell] setStringValue:aString];
[self setNeedsDisplay:YES];
[[self selectedCell] setStringValue:aString];
[self setNeedsDisplay:YES];
}
- (NSString *)stringValue
{
return [[self selectedCell] stringValue];
return [[self selectedCell] stringValue];
}
//
@ -221,26 +190,26 @@ static id MB_NSCONTROL_CELL_CLASS = nil;
//
- (void)takeDoubleValueFrom:(id)sender
{
[[self selectedCell] takeDoubleValueFrom:sender];
[self setNeedsDisplay:YES];
[[self selectedCell] takeDoubleValueFrom:sender];
[self setNeedsDisplay:YES];
}
- (void)takeFloatValueFrom:(id)sender
{
[[self selectedCell] takeFloatValueFrom:sender];
[self setNeedsDisplay:YES];
[[self selectedCell] takeFloatValueFrom:sender];
[self setNeedsDisplay:YES];
}
- (void)takeIntValueFrom:(id)sender
{
[[self selectedCell] takeIntValueFrom:sender];
[self setNeedsDisplay:YES];
[[self selectedCell] takeIntValueFrom:sender];
[self setNeedsDisplay:YES];
}
- (void)takeStringValueFrom:(id)sender
{
[[self selectedCell] takeStringValueFrom:sender];
[self setNeedsDisplay:YES];
[[self selectedCell] takeStringValueFrom:sender];
[self setNeedsDisplay:YES];
}
//
@ -248,114 +217,90 @@ static id MB_NSCONTROL_CELL_CLASS = nil;
//
- (NSTextAlignment)alignment
{
if (cell)
return [cell alignment];
else
return NSLeftTextAlignment;
if (cell)
return [cell alignment];
else
return NSLeftTextAlignment;
}
- (NSFont *)font
{
if (cell)
return [cell font];
else
return nil;
if (cell)
return [cell font];
else
return nil;
}
- (void)setAlignment:(NSTextAlignment)mode
{
if (cell)
{
[cell setAlignment:mode];
[self setNeedsDisplay:YES];
}
if (cell)
{
[cell setAlignment:mode];
[self setNeedsDisplay:YES];
}
}
- (void)setFont:(NSFont *)fontObject
{
if (cell) [cell setFont:fontObject];
if (cell)
[cell setFont:fontObject];
}
- (void)setFloatingPointFormat:(BOOL)autoRange
left:(unsigned)leftDigits
right:(unsigned)rightDigits
left:(unsigned)leftDigits
right:(unsigned)rightDigits
{}
//
// Managing the Field Editor
//
- (BOOL)abortEditing
{
return NO;
}
- (NSText *)currentEditor
{
return nil;
}
- (void)validateEditing
{}
- (BOOL)abortEditing { return NO; }
- (NSText *)currentEditor { return nil; }
- (void)validateEditing {} // FIX ME
//
// Resizing the Control
//
- (void)calcSize
{}
- (void)sizeToFit
{}
- (void)calcSize {} // FIX ME
- (void)sizeToFit {}
//
// Displaying the Control and Cell
//
- (void)drawCell:(NSCell *)aCell
{
if (cell == aCell)
{
[self lockFocus];
[cell drawWithFrame:bounds inView:self];
[self unlockFocus];
}
if (cell == aCell)
{
[self lockFocus];
[cell drawWithFrame:bounds inView:self];
[self unlockFocus];
}
}
- (void)drawCellInside:(NSCell *)aCell
{
if (cell == aCell)
{
[self lockFocus];
[cell drawInteriorWithFrame:bounds inView:self];
[self unlockFocus];
}
if (cell == aCell)
{
[self lockFocus];
[cell drawInteriorWithFrame:bounds inView:self];
[self unlockFocus];
}
}
- (void)selectCell:(NSCell *)aCell
{
if (cell == aCell) [cell setState:1];
- (void)selectCell:(NSCell *)aCell
{
if (cell == aCell)
[cell setState:1];
}
- (void)updateCell:(NSCell *)aCell
{
[self setNeedsDisplay:YES];
}
- (void)updateCellInside:(NSCell *)aCell
{
[self setNeedsDisplay:YES];
}
- (void)updateCell:(NSCell *)aCell { [self setNeedsDisplay:YES]; }
- (void)updateCellInside:(NSCell *)aCell { [self setNeedsDisplay:YES]; }
//
// Target and Action
//
- (SEL)action
{
return [cell action];
}
- (BOOL)isContinuous
{
return [cell isContinuous];
}
- (SEL)action { return [cell action]; }
- (BOOL)isContinuous { return [cell isContinuous]; }
- (BOOL)sendAction:(SEL)theAction to:(id)theTarget
{
@ -367,43 +312,17 @@ NSApplication *theApp = [NSApplication sharedApplication];
return NO;
}
- (int)sendActionOn:(int)mask
{
return 0;
}
- (void)setAction:(SEL)aSelector
{
[cell setAction:aSelector];
}
- (void)setContinuous:(BOOL)flag
{
[cell setContinuous:flag];
}
- (void)setTarget:(id)anObject
{
[cell setTarget:anObject];
}
- (id)target
{
return [cell target];
}
- (int)sendActionOn:(int)mask { return 0; }
- (void)setAction:(SEL)aSelector { [cell setAction:aSelector]; }
- (void)setContinuous:(BOOL)flag { [cell setContinuous:flag]; }
- (void)setTarget:(id)anObject { [cell setTarget:anObject]; }
- (id)target { return [cell target]; }
//
// Assigning a Tag
//
- (void)setTag:(int)anInt
{
tag = anInt;
}
- (int)tag
{
return tag;
}
- (void)setTag:(int)anInt { tag = anInt; }
- (int)tag { return tag; }
//
// Tracking the Mouse
@ -429,7 +348,7 @@ unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask |
else
oldActionMask = [cell sendActionOn: NSPeriodicMask];
[[self window] captureMouse: self]; // capture mouse
[window _captureMouse: self]; // capture the mouse
[self lockFocus];
@ -466,7 +385,7 @@ unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask |
done = YES; // then we are done
}
[[self window] releaseMouse: self]; // Release mouse
[window _releaseMouse: self]; // Release mouse
if (mouseUp) // the mouse went up in the button
{
@ -486,13 +405,8 @@ unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask |
[self sendAction:[self action] to:[self target]]; // perform action
}
- (BOOL)ignoresMultiClick
{
return NO;
}
- (void)setIgnoresMultiClick:(BOOL)flag
{}
- (BOOL)ignoresMultiClick { return NO; }
- (void)setIgnoresMultiClick:(BOOL)flag {} // FIX ME
//
// Methods Implemented by the Delegate
@ -500,13 +414,13 @@ unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask |
- (BOOL)control:(NSControl *)control
textShouldBeginEditing:(NSText *)fieldEditor
{
return NO;
return NO;
}
- (BOOL)control:(NSControl *)control
textShouldEndEditing:(NSText *)fieldEditor
{
return NO;
return NO;
}
- (void)controlTextDidBeginEditing:(NSNotification *)aNotification
@ -523,20 +437,20 @@ unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask |
//
- (void)encodeWithCoder:aCoder
{
[super encodeWithCoder:aCoder];
[aCoder encodeValueOfObjCType: "i" at: &tag];
[aCoder encodeObject: cell];
[super encodeWithCoder:aCoder];
[aCoder encodeValueOfObjCType: "i" at: &tag];
[aCoder encodeObject: cell];
}
- initWithCoder:aDecoder
{
[super initWithCoder:aDecoder];
[aDecoder decodeValueOfObjCType: "i" at: &tag];
cell = [aDecoder decodeObject];
return self;
[super initWithCoder:aDecoder];
[aDecoder decodeValueOfObjCType: "i" at: &tag];
cell = [aDecoder decodeObject];
return self;
}
@end

View file

@ -1161,7 +1161,7 @@ static MPoint anchor = {0, 0};
[NSEvent startPeriodicEventsAfterDelay:0.05 withPeriod:0.05];
ASSIGN(lastEvent, theEvent);
[window captureMouse: self]; // grab the mouse
[window _captureMouse: self]; // grab the mouse
[self lockFocus]; // selection involves two steps, first
// a loop that continues until the left
while (!done) // mouse goes up; then a series of
@ -1321,7 +1321,7 @@ static MPoint anchor = {0, 0};
lastLocation = [self convertPoint:lastLocation fromView:nil];
}
[window releaseMouse: self]; // Release the mouse
[window _releaseMouse: self]; // Release the mouse
switch (mode) // Finish the selection
{ // process
@ -1362,6 +1362,23 @@ static MPoint anchor = {0, 0};
[lastEvent release];
}
- (void)updateCell:(NSCell *)aCell
{ // attempt to update
int r, c; // only the cell and
// not the hole matrix
if([aCell isOpaque])
{
if([self getRow:&r column:&c ofCell:aCell])
{
[self setNeedsDisplayInRect:[self cellFrameAtRow:r column:c]];
return;
}
}
// oh well, update the
[self setNeedsDisplay:YES]; // whole matrix
}
- (BOOL)performKeyEquivalent:(NSEvent*)theEvent
{
int i, j;

View file

@ -33,160 +33,226 @@
#include <AppKit/NSScrollView.h>
#include <AppKit/NSWindow.h>
//
// Postscript functions to be defined and implemented by the backend
//
extern void PSsetlinewidth(float width);
extern void PSsetgray(float num);
extern void PSmoveto(float x, float y);
extern void PSrlineto(float x, float y);
extern void PSstroke(void);
extern void PSgrestore(void);
extern void PSgsave(void);
@implementation NSScrollView
//
// Class variables
//
static Class rulerViewClass = nil;
//
// Class methods
//
+ (void)initialize
{
if (self == [NSScrollView class])
{
NSDebugLog(@"Initialize NSScrollView class\n");
[self setVersion:1];
}
}
+ (void)setRulerViewClass:(Class)aClass
+ (void)setRulerViewClass:(Class)aClass { rulerViewClass = aClass; }
+ (Class)rulerViewClass { return rulerViewClass; }
+ (NSSize)contentSizeForFrameSize:(NSSize)frameSize // calc content size by
hasHorizontalScroller:(BOOL)hFlag // taking into account
hasVerticalScroller:(BOOL)vFlag // the border type
borderType:(NSBorderType)borderType
{
rulerViewClass = aClass;
}
NSSize size = frameSize;
// Substract 1 from the width and height of
if (hFlag) // the line that separates the horizontal
{ // and vertical scroller from the clip view
size.height -= [NSScroller scrollerWidth];
size.height -= 1;
}
if (vFlag)
{
size.width -= [NSScroller scrollerWidth];
size.width -= 1;
}
+ (Class)rulerViewClass
{
return rulerViewClass;
}
switch (borderType)
{
case NSNoBorder:
break;
case NSLineBorder:
size.width -= 2;
size.height -= 2;
break;
case NSBezelBorder:
case NSGrooveBorder:
size.width -= 4;
size.height -= 4;
break;
}
/* Backends should rewrite the following 2 methods and adjust the frames
depending on the border type. */
+ (NSSize)contentSizeForFrameSize:(NSSize)frameSize
hasHorizontalScroller:(BOOL)hFlag
hasVerticalScroller:(BOOL)vFlag
borderType:(NSBorderType)borderType
{
NSSize size = frameSize;
if (hFlag)
size.height -= [NSScroller scrollerWidth];
if (vFlag)
size.width -= [NSScroller scrollerWidth];
return size;
return size;
}
+ (NSSize)frameSizeForContentSize:(NSSize)contentSize
hasHorizontalScroller:(BOOL)hFlag
hasVerticalScroller:(BOOL)vFlag
borderType:(NSBorderType)borderType
hasHorizontalScroller:(BOOL)hFlag
hasVerticalScroller:(BOOL)vFlag
borderType:(NSBorderType)borderType
{
NSSize size = contentSize;
NSSize size = contentSize;
// Add 1 to the width and height for the
if (hFlag) // line that separates the horizontal and
{ // vertical scroller from the clip view.
size.height += [NSScroller scrollerWidth];
size.height += 1;
}
if (vFlag)
{
size.width += [NSScroller scrollerWidth];
size.width += 1;
}
if (hFlag)
size.height += [NSScroller scrollerWidth];
if (vFlag)
size.width += [NSScroller scrollerWidth];
switch (borderType)
{
case NSNoBorder:
break;
case NSLineBorder:
size.width += 2;
size.height += 2;
break;
case NSBezelBorder:
case NSGrooveBorder:
size.width += 4;
size.height += 4;
break;
}
return size;
return size;
}
//
// Instance methods
//
- initWithFrame:(NSRect)rect
{
[super initWithFrame:rect];
[self setContentView:[[NSClipView new] autorelease]];
_lineScroll = 10;
_pageScroll = 10;
_borderType = NSBezelBorder;
_scrollsDynamically = YES;
// autoresizingMask = NSViewMaxYMargin;
[self tile];
return self;
[super initWithFrame:rect];
[self setContentView:[[NSClipView new] autorelease]];
_lineScroll = 10;
_pageScroll = 10;
_borderType = NSBezelBorder;
_scrollsDynamically = YES;
[self tile];
return self;
}
- init
{
return [self initWithFrame:NSZeroRect];
return [self initWithFrame:NSZeroRect];
}
- (void)dealloc
{
[_contentView release];
[_horizScroller release];
[_vertScroller release];
[_horizRuler release];
[_vertRuler release];
[super dealloc];
[_contentView release];
[_horizScroller release];
[_vertScroller release];
[_horizRuler release];
[_vertRuler release];
[super dealloc];
}
- (void)setContentView:(NSView*)aView
{
ASSIGN(_contentView, aView);
[self addSubview:_contentView];
[self tile];
ASSIGN(_contentView, aView);
[self addSubview:_contentView];
[self tile];
}
- (void)setHorizontalScroller:(NSScroller*)aScroller
{
[_horizScroller removeFromSuperview];
[_horizScroller removeFromSuperview];
/* Do not add the scroller view to the subviews array yet; the user has to
explicitly invoke -setHasHorizontalScroller:. */
ASSIGN(_horizScroller, aScroller);
if (_horizScroller) {
[_horizScroller setTarget:self];
[_horizScroller setAction:@selector(_doScroll:)];
}
// Do not add the scroller view to the subviews array yet;
// -setHasHorizontalScroller must be invoked first
ASSIGN(_horizScroller, aScroller);
if (_horizScroller)
{
[_horizScroller setTarget:self];
[_horizScroller setAction:@selector(_doScroll:)];
}
}
- (void)setHasHorizontalScroller:(BOOL)flag
{
if (_hasHorizScroller == flag)
return;
if (_hasHorizScroller == flag)
return;
_hasHorizScroller = flag;
_hasHorizScroller = flag;
if (_hasHorizScroller) {
if (!_horizScroller)
[self setHorizontalScroller:[[NSScroller new] autorelease]];
[self addSubview:_horizScroller];
}
else
[_horizScroller removeFromSuperview];
if (_hasHorizScroller)
{
if (!_horizScroller)
[self setHorizontalScroller:[[NSScroller new] autorelease]];
[self addSubview:_horizScroller];
}
else
[_horizScroller removeFromSuperview];
[self tile];
[self tile];
}
- (void)setVerticalScroller:(NSScroller*)aScroller
{
[_vertScroller removeFromSuperview];
[_vertScroller removeFromSuperview];
/* Do not add the scroller view to the subviews array yet; the user has to
explicitly invoke -setHasVerticalScroller:. */
ASSIGN(_vertScroller, aScroller);
if (_vertScroller) {
[_vertScroller setTarget:self];
[_vertScroller setAction:@selector(_doScroll:)];
}
// Do not add the scroller view to the subviews array yet;
// -setHasVerticalScroller must be invoked first
ASSIGN(_vertScroller, aScroller);
if (_vertScroller)
{
[_vertScroller setTarget:self];
[_vertScroller setAction:@selector(_doScroll:)];
}
}
- (void)setHasVerticalScroller:(BOOL)flag
{
if (_hasVertScroller == flag)
return;
if (_hasVertScroller == flag)
return;
_hasVertScroller = flag;
_hasVertScroller = flag;
if (_hasVertScroller) {
if (!_vertScroller) {
[self setVerticalScroller:[[NSScroller new] autorelease]];
if (_contentView && ![_contentView isFlipped])
[_vertScroller setFloatValue:1];
}
[self addSubview:_vertScroller];
}
else
[_vertScroller removeFromSuperview];
if (_hasVertScroller)
{
if (!_vertScroller)
{
[self setVerticalScroller:[[NSScroller new] autorelease]];
if (_contentView && ![_contentView isFlipped])
[_vertScroller setFloatValue:1];
}
[self addSubview:_vertScroller];
}
else
[_vertScroller removeFromSuperview];
[self tile];
[self tile];
}
- (void)_doScroll:(NSScroller*)scroller
@ -306,8 +372,8 @@ id documentView;
[_vertScroller setEnabled:YES];
knobProportion = clipViewBounds.size.height /
documentFrame.size.height;
floatValue = clipViewBounds.origin.y / (documentFrame.size.height -
clipViewBounds.size.height);
floatValue = clipViewBounds.origin.y / (documentFrame.size.height
- clipViewBounds.size.height);
if (![_contentView isFlipped])
floatValue = 1 - floatValue;
[_vertScroller setFloatValue:floatValue
@ -333,104 +399,215 @@ id documentView;
}
}
// [self setNeedsDisplay:YES]; // not needed by XRAW causes flicker
[window flushWindow];
}
- (void)setHorizontalRulerView:(NSRulerView*)aRulerView
- (void)setHorizontalRulerView:(NSRulerView*)aRulerView // FIX ME
{
/* TODO */
ASSIGN(_horizRuler, aRulerView);
ASSIGN(_horizRuler, aRulerView);
}
- (void)setHasHorizontalRuler:(BOOL)flag
- (void)setHasHorizontalRuler:(BOOL)flag // FIX ME
{
/* TODO */
if (_hasHorizRuler == flag)
return;
if (_hasHorizRuler == flag)
return;
_hasHorizRuler = flag;
_hasHorizRuler = flag;
}
- (void)setVerticalRulerView:(NSRulerView*)ruler
- (void)setVerticalRulerView:(NSRulerView*)ruler // FIX ME
{
/* TODO */
ASSIGN(_vertRuler, ruler);
ASSIGN(_vertRuler, ruler);
}
- (void)setHasVerticalRuler:(BOOL)flag
- (void)setHasVerticalRuler:(BOOL)flag // FIX ME
{
/* TODO */
if (_hasVertRuler == flag)
return;
if (_hasVertRuler == flag)
return;
_hasVertRuler = flag;
_hasVertRuler = flag;
}
- (void)setRulersVisible:(BOOL)flag
{
/* TODO */
}
- (void)setFrame:(NSRect)rect
{
[super setFrame:rect];
[self tile];
[super setFrame:rect];
[self tile];
}
- (void)setFrameSize:(NSSize)size
{
[super setFrameSize:size];
[self tile];
[super setFrameSize:size];
[self tile];
}
/* This method should be implemented in the backend to position the scroll
view's interface elements */
- (void)tile
{
NSRect boundsRect = [self bounds];
NSSize contentSize = [isa contentSizeForFrameSize:boundsRect.size
hasHorizontalScroller:_hasHorizScroller
hasVerticalScroller:_hasVertScroller
borderType:_borderType];
float scrollerWidth = [NSScroller scrollerWidth];
NSRect contentRect = { NSZeroPoint, contentSize };
NSRect vertScrollerRect = NSZeroRect;
NSRect horizScrollerRect = NSZeroRect;
float borderThickness = 0;
switch ([self borderType])
{
case NSNoBorder:
break;
case NSLineBorder:
borderThickness = 1;
break;
case NSBezelBorder:
case NSGrooveBorder:
borderThickness = 2;
break;
}
contentRect.origin.x = borderThickness;
contentRect.origin.y = borderThickness;
if (_hasVertScroller)
{
vertScrollerRect.origin.x = boundsRect.origin.x + borderThickness;
vertScrollerRect.origin.y = boundsRect.origin.y + borderThickness;
vertScrollerRect.size.width = scrollerWidth;
vertScrollerRect.size.height =bounds.size.height - 2 * borderThickness;
contentRect.origin.x += scrollerWidth + 1;
}
if (_hasHorizScroller)
{
horizScrollerRect.origin.x = boundsRect.origin.x
+ vertScrollerRect.origin.x
+ vertScrollerRect.size.width + 1;
horizScrollerRect.origin.y = boundsRect.origin.y + borderThickness;
horizScrollerRect.size.width = boundsRect.size.width
- horizScrollerRect.origin.x
- borderThickness;
horizScrollerRect.size.height = scrollerWidth;
contentRect.origin.y += scrollerWidth + 1;
contentRect.size.height -= 1;
}
[_contentView setFrame:contentRect];
[_horizScroller setFrame:horizScrollerRect];
[_vertScroller setFrame:vertScrollerRect];
// If the document view is not
if (![_contentView isFlipped]) // flipped reverse the meaning
[_vertScroller setFloatValue:1]; // of the vertical scroller's
}
- (void)drawRect:(NSRect)rect
{
float scrollerWidth = [NSScroller scrollerWidth];
float horizLinePosition, horizLineLength = [self bounds].size.width;
float borderThickness = 0;
fprintf (stderr,
"NSScrollView drawRect: origin (%1.2f, %1.2f), size (%1.2f, %1.2f)\n",
rect.origin.x, rect.origin.y,
rect.size.width, rect.size.height);
PSgsave ();
switch ([self borderType])
{
case NSNoBorder:
break;
case NSLineBorder:
borderThickness = 1;
NSFrameRect (rect);
break;
case NSBezelBorder:
borderThickness = 2;
NSDrawGrayBezel (rect, rect);
break;
case NSGrooveBorder:
borderThickness = 2;
NSDrawGroove (rect, rect);
break;
}
horizLinePosition = borderThickness;
PSsetlinewidth (1);
PSsetgray (0);
if (_hasVertScroller)
{
horizLinePosition = scrollerWidth + borderThickness;
horizLineLength -= scrollerWidth + 2 * borderThickness;
PSmoveto (horizLinePosition, borderThickness + 1);
PSrlineto (0, [self bounds].size.height - 2 * borderThickness);
PSstroke ();
}
if (_hasHorizScroller)
{
PSmoveto (horizLinePosition, scrollerWidth + borderThickness + 1);
PSrlineto (horizLineLength - 1, 0);
PSstroke ();
}
PSgrestore ();
}
- (NSRect)documentVisibleRect
{
return [_contentView documentVisibleRect];
return [_contentView documentVisibleRect];
}
- (void)setBackgroundColor:(NSColor*)aColor
{
[_contentView setBackgroundColor:aColor];
[_contentView setBackgroundColor:aColor];
}
- (NSColor*)backgroundColor
{
return [_contentView backgroundColor];
- (NSColor*)backgroundColor
{
return [_contentView backgroundColor];
}
- (void)setBorderType:(NSBorderType)borderType
{
_borderType = borderType;
- (void)setBorderType:(NSBorderType)borderType
{
_borderType = borderType;
}
- (void)setDocumentView:(NSView*)aView
{
[_contentView setDocumentView:aView];
if (_contentView && ![_contentView isFlipped])
[_vertScroller setFloatValue:1];
[self tile];
[_contentView setDocumentView:aView];
if (_contentView && ![_contentView isFlipped])
[_vertScroller setFloatValue:1];
[self tile];
[_contentView viewFrameChanged:nil];
// update scroller
[self reflectScrolledClipView:(NSClipView*)_contentView];
}
- (id)documentView
- (void)resizeSubviewsWithOldSize:(NSSize)oldSize
{
return [_contentView documentView];
fprintf (stderr, "NSScrollView resizeSubviewsWithOldSize \n");
[super resizeSubviewsWithOldSize:oldSize];
[self tile];
}
- (id)documentView { return [_contentView documentView]; }
- (NSCursor*)documentCursor { return [_contentView documentCursor]; }
- (void)setDocumentCursor:(NSCursor*)aCursor
{
[_contentView setDocumentCursor:aCursor];
}
- (NSCursor*)documentCursor
{
return [_contentView documentCursor];
[_contentView setDocumentCursor:aCursor];
}
- (BOOL)isOpaque { return YES; }

View file

@ -589,7 +589,6 @@ NSRect rect;
if (theCell)
{
[theCell highlight:YES withFrame:rect inView:self];
// [self setNeedsDisplayInRect:rect]; // not needed by XRAW
[window flushWindow];
NSLog (@"tracking cell %x", theCell);
@ -608,7 +607,6 @@ NSRect rect;
}
[theCell highlight:NO withFrame:rect inView:self];
// [self setNeedsDisplayInRect:rect]; // not needed by XRAW
[window flushWindow];
}
@ -770,7 +768,7 @@ NSUsableScrollerParts usableParts;
case NSScrollerKnobSlot:
x = 0; // if the scroller does
width = scrollerWidth + 1; // not have buttons the
width = scrollerWidth; // not have buttons the
// slot completely
if (usableParts == NSNoScrollerParts) // fills the scroller.
{

View file

@ -35,16 +35,6 @@
@implementation NSString (NSStringDrawing)
- (void) drawAtPoint: (NSPoint)aPoint withAttributes: (NSDictionary *)attr
{
[self notImplemented: _cmd];
}
- (void) drawInRect: (NSRect)aRect withAttributes: (NSDictionary *)attr
{
[self notImplemented: _cmd];
}
- (NSSize)sizeWithAttributes:(NSDictionary *)attrs
{
NSFont *font;

View file

@ -1553,7 +1553,8 @@ NSLog(@"keycode:%x",keyCode);
{ [self drawInsertionPointAtIndex:[self selectedRange].location color:nil turnedOn:NO];
//<!> stop timed entry
}
if([self isEditable]) return [self textShouldEndEditing:(NSText*)self];
if([self isEditable])
return [self textShouldEndEditing:(NSText*)self];
return YES;
}
-(BOOL) becomeFirstResponder
@ -1608,7 +1609,8 @@ NSLog(@"keycode:%x",keyCode);
-(BOOL) textShouldEndEditing:(NSText *)textObject
{ if ([delegate respondsToSelector:@selector(textShouldEndEditing:)])
return [delegate textShouldEndEditing:(NSText*)self];
else return YES;
else
return YES;
}

File diff suppressed because it is too large Load diff

View file

@ -130,6 +130,8 @@ int style;
[content_view release]; // Release the content view
}
if(_fieldEditor)
[_fieldEditor release];
[background_color release];
[represented_filename release];
[miniaturized_title release];
@ -265,12 +267,7 @@ NSView *wv;
// Window device attributes
//
- (NSBackingStoreType)backingType { return backing_type; }
- (NSDictionary *)deviceDescription
{
return nil;
}
- (NSDictionary *)deviceDescription { return nil; }
- (int)gState { return 0; }
- (BOOL)isOneShot { return is_one_shot; }
@ -307,10 +304,17 @@ NSView *wv;
}
- (NSText *)fieldEditor:(BOOL)createFlag forObject:anObject
{
{ // ask delegate if it can
if ([delegate respondsToSelector: // provide a field editor
@selector(windowWillReturnFieldEditor:toObject:)])
return [delegate windowWillReturnFieldEditor:self toObject:anObject];
if(!_fieldEditor && createFlag) // each window has a global
_fieldEditor = [[NSText alloc] init]; // text field editor
{ // text field editor
_fieldEditor = [[NSText new] retain];
[_fieldEditor setFieldEditor:YES];
}
return _fieldEditor;
}
@ -381,8 +385,7 @@ NSApplication *theApp = [NSApplication sharedApplication];
- (void)orderFrontRegardless {}
- (void)orderOut:sender {}
- (void)orderWindow:(NSWindowOrderingMode)place
relativeTo:(int)otherWin
- (void)orderWindow:(NSWindowOrderingMode)place relativeTo:(int)otherWin
{
}
@ -900,6 +903,8 @@ NSView *v;
v = [content_view hitTest:[theEvent locationInWindow]];
NSDebugLog([v description]);
NSDebugLog(@"\n");
if(first_responder != v) // if hit view is not first
[self makeFirstResponder:v]; // responder ask it to be
[v mouseDown:theEvent];
last_point = [theEvent locationInWindow];
break;
@ -1094,8 +1099,7 @@ id result = nil;
return YES;
}
- (NSSize)windowWillResize:(NSWindow *)sender
toSize:(NSSize)frameSize
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize
{
if ([delegate respondsToSelector:@selector(windowWillResize:toSize:)])
return [delegate windowWillResize:sender toSize:frameSize];
@ -1103,8 +1107,7 @@ id result = nil;
return frameSize;
}
- windowWillReturnFieldEditor:(NSWindow *)sender
toObject:client
- windowWillReturnFieldEditor:(NSWindow *)sender toObject:client
{
return nil;
}
@ -1311,8 +1314,8 @@ id result = nil;
//
// Mouse capture/release
//
- (void)captureMouse: sender {} // Do nothing, should be
- (void)releaseMouse: sender {} // implemented by back-end
- (void)_captureMouse: sender {} // Do nothing, should be
- (void)_releaseMouse: sender {} // implemented by back-end
- (void)performDeminiaturize:sender {}
- (void)performHide:sender {}
- (void)performUnhide:sender {}

View file

@ -33,26 +33,23 @@
* a back end.
*/
BOOL
initialize_gnustep_backend(void)
{
return YES;
}
BOOL initialize_gnustep_backend(void) { return YES; }
void NSHighlightRect(NSRect aRect) {}
void NSRectFill(NSRect aRect) {}
void NSBeep(void) {}
void NSFrameRect(NSRect aRect) {}
void NSDrawButton(NSRect aRect, NSRect clipRect) {}
void NSDrawGrayBezel(NSRect aRect, NSRect clipRect) {}
void NSDrawGroove(NSRect aRect, NSRect clipRect) {}
void
NSHighlightRect(NSRect aRect)
{
}
void
NSRectFill(NSRect aRect)
{
}
void
NSBeep(void)
{
}
void PSlineto(float x, float y) {}
void PSmoveto(float x, float y) {}
void PSrlineto(float x, float y) {}
void PSsetgray(float num) {}
void PSstroke(void) {}
void PSsetlinewidth(float width) {}
void PSgrestore(void) {}
void PSgsave(void) {}
void GSfill() {}
void GSsetgray() {}
@ -70,18 +67,6 @@ void GSstroke() {}
void GSrlineto() {}
void GSrectclip() {}
void NSFrameRect(NSRect aRect)
{
}
void NSDrawButton(NSRect aRect, NSRect clipRect)
{
}
void NSDrawGrayBezel(NSRect aRect, NSRect clipRect)
{
}
void NSDrawGroove(NSRect aRect, NSRect clipRect)
{
}
@interface GMModel : NSObject
@end