1999-12-13 17:01:35 +00:00
|
|
|
|
/* GormWindowEditor.m
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 1999 Free Software Foundation, Inc.
|
|
|
|
|
*
|
|
|
|
|
* Author: Richard Frith-Macdonald <richard@brainstrom.co.uk>
|
|
|
|
|
* Date: 1999
|
|
|
|
|
*
|
|
|
|
|
* This file is part of GNUstep.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "GormPrivate.h"
|
|
|
|
|
|
2002-08-14 00:01:42 +00:00
|
|
|
|
#import "GormViewWithContentViewEditor.h"
|
2001-06-07 03:57:51 +00:00
|
|
|
|
|
2002-08-14 00:01:42 +00:00
|
|
|
|
#include <math.h>
|
2002-02-18 12:37:26 +00:00
|
|
|
|
|
2002-08-14 00:01:42 +00:00
|
|
|
|
#define _EO ((NSWindow *)_editedObject)
|
|
|
|
|
|
|
|
|
|
#import "GormInternalViewEditor.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// static NSRect
|
|
|
|
|
// NSRectFromPoints(NSPoint p0, NSPoint p1)
|
|
|
|
|
// {
|
|
|
|
|
// NSRect r;
|
|
|
|
|
|
|
|
|
|
// if (p0.x < p1.x)
|
|
|
|
|
// {
|
|
|
|
|
// r.origin.x = p0.x;
|
|
|
|
|
// r.size.width = p1.x - p0.x;
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// r.origin.x = p1.x;
|
|
|
|
|
// r.size.width = p0.x - p1.x;
|
|
|
|
|
// }
|
|
|
|
|
// if (p0.y < p1.y)
|
|
|
|
|
// {
|
|
|
|
|
// r.origin.y = p0.y;
|
|
|
|
|
// r.size.height = p1.y - p0.y;
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// r.origin.y = p1.y;
|
|
|
|
|
// r.size.height = p0.y - p1.y;
|
|
|
|
|
// }
|
|
|
|
|
// return r;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// static NSPoint
|
|
|
|
|
// _constrainPointToBounds(NSPoint point, NSRect bounds)
|
|
|
|
|
// {
|
|
|
|
|
// point.x = MAX(point.x, NSMinX(bounds));
|
|
|
|
|
// point.x = MIN(point.x, NSMaxX(bounds));
|
|
|
|
|
// point.y = MAX(point.y, NSMinY(bounds));
|
|
|
|
|
// point.y = MIN(point.y, NSMaxY(bounds));
|
|
|
|
|
// return point;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// @class GSTableCornerView;
|
|
|
|
|
|
|
|
|
|
// static NSView *bestKnownSuperview(NSView *aView, NSPoint loc)
|
|
|
|
|
// {
|
|
|
|
|
// NSView *best = aView;
|
|
|
|
|
// NSView *view = aView;
|
|
|
|
|
// NSLog(@"Convert %@", aView);
|
2002-02-18 12:37:26 +00:00
|
|
|
|
|
2002-08-14 00:01:42 +00:00
|
|
|
|
// if ([view isKindOfClass:[NSTableHeaderView class]])
|
|
|
|
|
// {
|
|
|
|
|
// NSPoint p = [view convertPoint: loc
|
|
|
|
|
// fromView: nil];
|
|
|
|
|
// int columnNumber = [(NSTableHeaderView*) view columnAtPoint: p];
|
|
|
|
|
|
|
|
|
|
// if (columnNumber == -1)
|
|
|
|
|
// return nil;
|
|
|
|
|
|
|
|
|
|
// if ([(NSTableHeaderView*)view tableView] == nil)
|
|
|
|
|
// return nil;
|
|
|
|
|
|
|
|
|
|
// return [[[(NSTableHeaderView*)view tableView] tableColumns]
|
|
|
|
|
// objectAtIndex: columnNumber];
|
|
|
|
|
// }
|
|
|
|
|
// else if ([view isKindOfClass:[GSTableCornerView class]])
|
|
|
|
|
// {
|
|
|
|
|
// if ([view enclosingScrollView] != nil)
|
|
|
|
|
// return [view enclosingScrollView];
|
|
|
|
|
// }
|
|
|
|
|
// else if ([view isKindOfClass:[NSScroller class]])
|
|
|
|
|
// {
|
|
|
|
|
// if ([view enclosingScrollView] != nil)
|
|
|
|
|
// {
|
|
|
|
|
// if ([[view enclosingScrollView] documentView]
|
|
|
|
|
// && ([[[view enclosingScrollView] documentView]
|
|
|
|
|
// isKindOfClass: [NSTableView class]]
|
|
|
|
|
// || [[[view enclosingScrollView] documentView]
|
|
|
|
|
// isKindOfClass: [NSTextView class]])
|
|
|
|
|
// )
|
|
|
|
|
// return [view enclosingScrollView];
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2002-02-18 12:37:26 +00:00
|
|
|
|
|
2002-08-14 00:01:42 +00:00
|
|
|
|
// while( view )
|
|
|
|
|
// {
|
|
|
|
|
// if([view isKindOfClass:[NSBrowser class]]
|
|
|
|
|
// || [view isKindOfClass:[NSTextView class]]
|
|
|
|
|
// || [view isKindOfClass:[NSTableView class]])
|
|
|
|
|
// {
|
|
|
|
|
// best = view;
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// else if([view isKindOfClass:[NSScrollView class]])
|
|
|
|
|
// {
|
|
|
|
|
// best = view;
|
|
|
|
|
// }
|
2002-02-18 12:37:26 +00:00
|
|
|
|
|
2002-08-14 00:01:42 +00:00
|
|
|
|
// view = [view superview];
|
|
|
|
|
// }
|
2002-02-18 12:37:26 +00:00
|
|
|
|
|
2002-08-14 00:01:42 +00:00
|
|
|
|
// if([best isKindOfClass:[NSScrollView class]])
|
|
|
|
|
// {
|
|
|
|
|
// view = [best contentView];
|
|
|
|
|
// if([view isKindOfClass:[NSClipView class]])
|
|
|
|
|
// {
|
|
|
|
|
// view = [view documentView];
|
2002-02-18 12:37:26 +00:00
|
|
|
|
|
2002-08-14 00:01:42 +00:00
|
|
|
|
// if([view isKindOfClass:[NSTextView class]]
|
|
|
|
|
// || [view isKindOfClass:[NSTableView class]])
|
|
|
|
|
// {
|
|
|
|
|
// return view;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2002-02-18 12:37:26 +00:00
|
|
|
|
|
2002-08-14 00:01:42 +00:00
|
|
|
|
// return best;
|
|
|
|
|
// }
|
2002-02-18 12:37:26 +00:00
|
|
|
|
|
1999-12-14 17:38:17 +00:00
|
|
|
|
@implementation NSWindow (GormObjectAdditions)
|
|
|
|
|
- (NSString*) editorClassName
|
|
|
|
|
{
|
|
|
|
|
return @"GormWindowEditor";
|
|
|
|
|
}
|
2000-01-13 21:19:03 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Method to return the image that should be used to display windows within
|
|
|
|
|
* the matrix containing the objects in a document.
|
|
|
|
|
*/
|
1999-12-13 17:01:35 +00:00
|
|
|
|
- (NSImage*) imageForViewer
|
|
|
|
|
{
|
|
|
|
|
static NSImage *image = nil;
|
|
|
|
|
|
|
|
|
|
if (image == nil)
|
|
|
|
|
{
|
|
|
|
|
NSBundle *bundle = [NSBundle mainBundle];
|
|
|
|
|
NSString *path = [bundle pathForImageResource: @"GormWindow"];
|
|
|
|
|
|
|
|
|
|
image = [[NSImage alloc] initWithContentsOfFile: path];
|
|
|
|
|
}
|
|
|
|
|
return image;
|
|
|
|
|
}
|
2002-01-14 04:19:01 +00:00
|
|
|
|
|
1999-12-13 17:01:35 +00:00
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Default implementations of methods used for updating a view by
|
|
|
|
|
* direct action through an editor.
|
|
|
|
|
*/
|
|
|
|
|
@implementation NSView (ViewAdditions)
|
|
|
|
|
|
|
|
|
|
- (BOOL) acceptsColor: (NSColor*)color atPoint: (NSPoint)point
|
|
|
|
|
{
|
|
|
|
|
return NO; /* Can the view accept a color drag-and-drop? */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (BOOL) allowsAltDragging
|
|
|
|
|
{
|
|
|
|
|
return NO; /* Can the view be dragged into a matrix? */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) depositColor: (NSColor*)color atPoint: (NSPoint)point
|
|
|
|
|
{
|
|
|
|
|
/* Handle color drop in view. */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSSize) maximumSizeFromKnobPosition: (IBKnobPosition)knobPosition
|
|
|
|
|
{
|
|
|
|
|
NSView *s = [self superview];
|
|
|
|
|
NSRect r = (s != nil) ? [s bounds] : [self bounds];
|
|
|
|
|
|
|
|
|
|
return r.size; /* maximum resize permitted */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSSize) minimumSizeFromKnobPosition: (IBKnobPosition)position
|
|
|
|
|
{
|
1999-12-16 18:06:22 +00:00
|
|
|
|
return NSMakeSize(5, 5); /* Minimum resize permitted */
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) placeView: (NSRect)newFrame
|
|
|
|
|
{
|
|
|
|
|
[self setFrame: newFrame]; /* View changed by editor. */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-08-14 00:01:42 +00:00
|
|
|
|
@interface GormWindowEditor : GormViewWithContentViewEditor
|
1999-12-13 17:01:35 +00:00
|
|
|
|
{
|
1999-12-14 17:38:17 +00:00
|
|
|
|
NSWindow *edited;
|
2001-06-07 03:57:51 +00:00
|
|
|
|
NSView *edit_view;
|
1999-12-14 17:38:17 +00:00
|
|
|
|
NSMutableArray *subeditors;
|
1999-12-18 11:08:18 +00:00
|
|
|
|
BOOL isLinkSource;
|
1999-12-13 17:01:35 +00:00
|
|
|
|
NSPasteboard *dragPb;
|
1999-12-17 18:46:03 +00:00
|
|
|
|
NSString *dragType;
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
- (BOOL) acceptsTypeFromArray: (NSArray*)types;
|
|
|
|
|
- (BOOL) activate;
|
|
|
|
|
- (id) initWithObject: (id)anObject inDocument: (id<IBDocuments>)aDocument;
|
2001-08-21 13:35:15 +00:00
|
|
|
|
- (void) changeFont: (id) sender;
|
1999-12-13 17:01:35 +00:00
|
|
|
|
- (void) close;
|
|
|
|
|
- (void) closeSubeditors;
|
2002-08-14 00:01:42 +00:00
|
|
|
|
// - (void) copySelection;
|
2000-01-03 11:00:14 +00:00
|
|
|
|
- (void) deactivate;
|
1999-12-13 17:01:35 +00:00
|
|
|
|
- (void) deleteSelection;
|
|
|
|
|
- (id<IBDocuments>) document;
|
1999-12-14 17:38:17 +00:00
|
|
|
|
- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f;
|
|
|
|
|
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag;
|
1999-12-13 17:01:35 +00:00
|
|
|
|
- (void) makeSelectionVisible: (BOOL)flag;
|
|
|
|
|
- (id<IBEditors>) openSubeditorForObject: (id)anObject;
|
|
|
|
|
- (void) orderFront;
|
|
|
|
|
- (void) pasteInSelection;
|
|
|
|
|
- (void) resetObject: (id)anObject;
|
2002-08-14 00:01:42 +00:00
|
|
|
|
// - (void) selectObjects: (NSArray*)objects;
|
|
|
|
|
// - (void) validateEditing;
|
|
|
|
|
// - (BOOL) wantsSelection;
|
|
|
|
|
//- (NSWindow*) window;
|
1999-12-13 17:01:35 +00:00
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation GormWindowEditor
|
|
|
|
|
|
2000-01-05 16:34:53 +00:00
|
|
|
|
- (BOOL) acceptsFirstMouse: (NSEvent*)theEvent
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
NSLog(@"********* TELL pyr *********** acceptsFirstMouse");
|
2000-01-05 16:34:53 +00:00
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-21 13:35:15 +00:00
|
|
|
|
- (BOOL) acceptsFirstResponder
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
NSLog(@"********* TELL pyr *********** acceptsFirstResponder");
|
2001-08-21 13:35:15 +00:00
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-22 12:50:11 +00:00
|
|
|
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
|
|
|
|
{
|
2000-01-03 11:00:14 +00:00
|
|
|
|
[NSException raise: NSInternalInconsistencyException
|
|
|
|
|
format: @"Argh - encoding window editor"];
|
1999-12-22 12:50:11 +00:00
|
|
|
|
}
|
2000-01-03 11:00:14 +00:00
|
|
|
|
|
1999-12-13 17:01:35 +00:00
|
|
|
|
- (BOOL) acceptsTypeFromArray: (NSArray*)types
|
|
|
|
|
{
|
1999-12-14 17:38:17 +00:00
|
|
|
|
/*
|
1999-12-17 17:22:18 +00:00
|
|
|
|
* A window editor can accept views pasted in to the window.
|
1999-12-14 17:38:17 +00:00
|
|
|
|
*/
|
|
|
|
|
return [types containsObject: IBViewPboardType];
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (BOOL) activate
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
if (activated == NO)
|
|
|
|
|
{
|
|
|
|
|
NSView *contentView = [_EO contentView];
|
|
|
|
|
// NSLog(@"contentView %@", contentView);
|
|
|
|
|
contentViewEditor = [document editorForObject: contentView
|
|
|
|
|
inEditor: self
|
|
|
|
|
create: YES];
|
|
|
|
|
// NSLog(@"contentViewEditor %@", contentViewEditor);
|
|
|
|
|
[(NSWindow *)_editedObject setInitialFirstResponder: self];
|
|
|
|
|
[self setOpened: YES];
|
|
|
|
|
activated = YES;
|
|
|
|
|
return YES;
|
1999-12-14 17:38:17 +00:00
|
|
|
|
}
|
2002-08-14 00:01:42 +00:00
|
|
|
|
|
|
|
|
|
return NO;
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-10-29 16:30:48 +00:00
|
|
|
|
- (void) changeFont: (id)sender
|
2001-08-21 13:35:15 +00:00
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
NSLog(@"********* TELL pyr *********** changeFont");
|
2001-08-21 13:35:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-13 17:01:35 +00:00
|
|
|
|
- (void) close
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
NSAssert(closed == NO, NSInternalInconsistencyException);
|
|
|
|
|
closed = YES;
|
2000-01-03 11:00:14 +00:00
|
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
1999-12-14 17:38:17 +00:00
|
|
|
|
|
2000-01-03 11:00:14 +00:00
|
|
|
|
[self makeSelectionVisible: NO];
|
1999-12-14 17:38:17 +00:00
|
|
|
|
if ([(id<IB>)NSApp selectionOwner] == self)
|
|
|
|
|
{
|
|
|
|
|
[document resignSelectionForEditor: self];
|
|
|
|
|
}
|
2000-01-03 11:00:14 +00:00
|
|
|
|
|
|
|
|
|
[self closeSubeditors];
|
|
|
|
|
|
|
|
|
|
[self deactivate];
|
|
|
|
|
|
1999-12-15 11:12:52 +00:00
|
|
|
|
[document editor: self didCloseForObject: edited];
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) closeSubeditors
|
|
|
|
|
{
|
1999-12-14 17:38:17 +00:00
|
|
|
|
while ([subeditors count] > 0)
|
|
|
|
|
{
|
|
|
|
|
id<IBEditors> sub = [subeditors lastObject];
|
|
|
|
|
|
|
|
|
|
[sub close];
|
|
|
|
|
[subeditors removeObjectIdenticalTo: sub];
|
|
|
|
|
}
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) copySelection
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
NSLog(@"********* TELL pyr *********** copySelection");
|
1999-12-14 17:38:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-03 11:00:14 +00:00
|
|
|
|
- (void) deactivate
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
if (activated == YES)
|
2000-01-03 11:00:14 +00:00
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
[contentViewEditor deactivate];
|
|
|
|
|
activated = NO;
|
2000-01-03 11:00:14 +00:00
|
|
|
|
}
|
2002-08-14 00:01:42 +00:00
|
|
|
|
return;
|
2000-01-03 11:00:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-14 17:38:17 +00:00
|
|
|
|
- (void) dealloc
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
if (closed == NO)
|
2000-01-03 11:00:14 +00:00
|
|
|
|
{
|
|
|
|
|
[self close];
|
|
|
|
|
}
|
1999-12-14 17:38:17 +00:00
|
|
|
|
RELEASE(edited);
|
|
|
|
|
RELEASE(selection);
|
|
|
|
|
RELEASE(subeditors);
|
|
|
|
|
RELEASE(document);
|
|
|
|
|
[super dealloc];
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) deleteSelection
|
|
|
|
|
{
|
1999-12-14 17:38:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Dragging source protocol implementation
|
|
|
|
|
*/
|
|
|
|
|
- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
NSLog(@"********* TELL pyr *********** draggedImage");
|
1999-12-14 17:38:17 +00:00
|
|
|
|
/*
|
1999-12-17 17:22:18 +00:00
|
|
|
|
* FIXME - handle this.
|
|
|
|
|
* Notification that a drag failed/succeeded.
|
1999-12-14 17:38:17 +00:00
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
NSLog(@"********* TELL pyr *********** draggingSourceOperationMaskForLocal");
|
|
|
|
|
return NSDragOperationNone;
|
1999-12-14 17:38:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (unsigned) draggingEntered: (id<NSDraggingInfo>)sender
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
return NSDragOperationNone;
|
2002-09-21 15:24:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-17 18:46:03 +00:00
|
|
|
|
- (unsigned) draggingUpdated: (id<NSDraggingInfo>)sender
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
return NSDragOperationNone;
|
2002-09-21 15:24:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-13 17:01:35 +00:00
|
|
|
|
- (void) drawSelection
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
NSLog(@"********* TELL pyr *********** drawSelection");
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (id<IBDocuments>) document
|
|
|
|
|
{
|
|
|
|
|
return document;
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-14 00:01:42 +00:00
|
|
|
|
- (id) initWithObject: (id)anObject
|
|
|
|
|
inDocument: (id<IBDocuments>)aDocument
|
1999-12-14 17:38:17 +00:00
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
_displaySelection = YES;
|
|
|
|
|
_editedObject = (NSView*)anObject;
|
|
|
|
|
edited = anObject;
|
1999-12-14 17:38:17 +00:00
|
|
|
|
|
2002-08-14 00:01:42 +00:00
|
|
|
|
if ((self = [super initWithFrame: NSZeroRect]) == nil)
|
1999-12-14 17:38:17 +00:00
|
|
|
|
return nil;
|
|
|
|
|
|
2002-08-14 00:01:42 +00:00
|
|
|
|
document = aDocument;
|
|
|
|
|
|
|
|
|
|
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
|
|
|
|
GormLinkPboardType, IBViewPboardType, nil]];
|
2001-08-21 13:35:15 +00:00
|
|
|
|
|
1999-12-14 17:38:17 +00:00
|
|
|
|
selection = [NSMutableArray new];
|
|
|
|
|
subeditors = [NSMutableArray new];
|
|
|
|
|
|
2002-08-14 00:01:42 +00:00
|
|
|
|
[(NSWindow *)_editedObject setInitialFirstResponder: self];
|
|
|
|
|
|
|
|
|
|
activated = NO;
|
|
|
|
|
closed = NO;
|
2002-04-07 22:02:41 +00:00
|
|
|
|
|
2002-08-14 00:01:42 +00:00
|
|
|
|
[self activate];
|
|
|
|
|
|
1999-12-14 17:38:17 +00:00
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-13 17:01:35 +00:00
|
|
|
|
- (void) makeSelectionVisible: (BOOL)flag
|
|
|
|
|
{
|
1999-12-15 21:43:57 +00:00
|
|
|
|
if (flag == NO)
|
|
|
|
|
{
|
1999-12-16 18:06:22 +00:00
|
|
|
|
if ([selection count] > 0)
|
1999-12-15 21:43:57 +00:00
|
|
|
|
{
|
|
|
|
|
NSEnumerator *enumerator = [selection objectEnumerator];
|
1999-12-16 06:56:02 +00:00
|
|
|
|
NSView *view;
|
1999-12-15 21:43:57 +00:00
|
|
|
|
|
|
|
|
|
[[self window] disableFlushWindow];
|
|
|
|
|
while ((view = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
NSRect rect = GormExtBoundsForRect([view frame]);
|
|
|
|
|
|
2001-06-07 03:57:51 +00:00
|
|
|
|
[edit_view displayRect: rect];
|
1999-12-15 21:43:57 +00:00
|
|
|
|
}
|
|
|
|
|
[[self window] enableFlushWindow];
|
1999-12-16 06:56:02 +00:00
|
|
|
|
[[self window] flushWindowIfNeeded];
|
1999-12-15 21:43:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
[self drawSelection];
|
|
|
|
|
[[self window] flushWindow];
|
|
|
|
|
}
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (id<IBEditors>) openSubeditorForObject: (id)anObject
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
NSLog(@"********* TELL pyr *********** openSubeditorForObject");
|
|
|
|
|
return nil;
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) orderFront
|
|
|
|
|
{
|
1999-12-14 17:38:17 +00:00
|
|
|
|
[edited orderFront: self];
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) pasteInSelection
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
NSLog(@"********* TELL pyr *********** pasteInSelection");
|
|
|
|
|
// [self pasteInView: edit_view];
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-14 17:38:17 +00:00
|
|
|
|
- (BOOL) performDragOperation: (id<NSDraggingInfo>)sender
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
NSLog(@"********* TELL pyr *********** performDragOperation");
|
|
|
|
|
return NO;
|
1999-12-14 17:38:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (BOOL) prepareForDragOperation: (id<NSDraggingInfo>)sender
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
return NO;
|
2002-09-21 15:24:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-13 17:01:35 +00:00
|
|
|
|
- (void) resetObject: (id)anObject
|
|
|
|
|
{
|
1999-12-23 07:49:27 +00:00
|
|
|
|
[[self window] makeKeyAndOrderFront: self];
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-05-08 09:43:11 +00:00
|
|
|
|
- (id) selectAllItems: (id)sender
|
1999-12-17 21:53:06 +00:00
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
NSLog(@"********* TELL pyr *********** selectAllItems");
|
|
|
|
|
return nil;
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (unsigned) selectionCount
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
NSLog(@"********* TELL pyr *********** selectionCount");
|
|
|
|
|
return 0;
|
|
|
|
|
// return [selection count];
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) validateEditing
|
|
|
|
|
{
|
2002-08-14 00:01:42 +00:00
|
|
|
|
NSLog(@"********* TELL pyr *********** validateEditing");
|
1999-12-13 17:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-07 22:02:41 +00:00
|
|
|
|
- (void)windowDidBecomeMain: (id) aNotification
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"windowDidBecomeMain %@", selection);
|
|
|
|
|
if ([NSApp isConnecting] == NO)
|
|
|
|
|
{
|
|
|
|
|
[document setSelectionFromEditor: self];
|
|
|
|
|
NSLog(@"windowDidBecomeMain %@", selection);
|
|
|
|
|
[self makeSelectionVisible: YES];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)windowDidResignMain: (id) aNotification
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"windowDidResignMain");
|
|
|
|
|
// [document setSelectionFromEditor: self];
|
|
|
|
|
[self makeSelectionVisible: NO];
|
|
|
|
|
}
|
2002-08-14 00:01:42 +00:00
|
|
|
|
|
1999-12-13 17:01:35 +00:00
|
|
|
|
@end
|