Lots of bugfixes. Update to editors to remove edited objects when groups are deleted.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@18498 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-01-29 06:24:55 +00:00
parent da35a01e7f
commit 6eb2f09927
11 changed files with 147 additions and 57 deletions

View file

@ -1,3 +1,16 @@
2004-01-29 01:22 Gregory John Casamento <greg_casamento@yahoo.com>
* GormInternalViewEditor.m: Added code to -destroyAndListSubviews
to remove the view from the document as appropriate.
* GormSplitViewEditor.m: Same as above.
* GormViewEditor.m: Added methods to handle view when inside the
scroll view directly as opposed to being contained in the NSView.
* GormScrollViewEditor.m: Same as above. Also added code to
handle removal of single view from the scroll view.
* GormViewWithContentViewEditor.m: Removed some debug code and
added code in -groupSelectionInScrollView to add the view itself
if there is only one view selected.
2004-01-29 12:09 Gregory John Casamento <greg_casamento@yahoo.com>
* Version 0.6.0

View file

@ -163,7 +163,6 @@ Gorm_HEADERS = \
GormSetNameController.h \
GormGeneralPref.h
Gorm_OBJC_FILES = \
Gorm.m \
GormDocument.m \
@ -205,7 +204,7 @@ Gorm_OBJC_FILES = \
GormClassInspector.m \
GormFontViewController.m \
GormSetNameController.m \
GormGeneralPref.m
GormGeneralPref.m
-include GNUmakefile.preamble

View file

@ -35,20 +35,23 @@
@implementation NSBox (GormObjectAdditions)
- (NSString*) editorClassName
{
// if([[self superview] isKindOfClass: [NSClipView class]])
// return @"GormInternalViewEditor";
return @"GormBoxEditor";
}
- (NSFont *) font
{
return [self titleFont];
}
- (void) setFont: (NSFont *)aFont
{
[self setTitleFont: aFont];
}
@end
@implementation GormBoxEditor
- (void) setOpened: (BOOL) flag

View file

@ -921,7 +921,7 @@ static NSImage *horizontalImage;
id thisView = [parent editedObject];
[parent close];
[thisView removeFromSuperview];
[document detachObject: thisView];
}
return newSelection;

View file

@ -167,28 +167,47 @@
- (NSArray *)destroyAndListSubviews
{
id internalView = [[[_EO documentView] subviews] objectAtIndex: 0];
NSEnumerator *enumerator = [[internalView subviews] objectEnumerator];
GormViewEditor *subview;
id documentView = [_EO documentView];
NSArray *subviews = [documentView subviews];
NSMutableArray *newSelection = [NSMutableArray array];
[parent makeSubeditorResign];
while ((subview = [enumerator nextObject]) != nil)
if([documentView conformsToProtocol: @protocol(IBEditors)] == YES)
{
id v;
NSRect frame;
v = [subview editedObject];
frame = [v frame];
frame = [parent convertRect: frame fromView: _EO];
[subview deactivate];
[v setFrame: frame];
[newSelection addObject: v];
id internalView = [subviews objectAtIndex: 0];
NSEnumerator *enumerator = [[internalView subviews] objectEnumerator];
GormViewEditor *subview;
[parent makeSubeditorResign];
while ((subview = [enumerator nextObject]) != nil)
{
id v;
NSRect frame;
v = [subview editedObject];
frame = [v frame];
frame = [parent convertRect: frame fromView: _EO];
[subview deactivate];
[v setFrame: frame];
[newSelection addObject: v];
}
}
else
{
NSRect frame = [documentView frame];
// in this case the view editor is the documentView and
// we need to add the internal view back into the superview
frame = [parent convertRect: frame fromView: _EO];
[documentView setFrame: frame];
[newSelection addObject: documentView];
[_EO setDocumentView: nil]; // remove any reference to the box.
// RELEASE(_EO);
}
{
id thisView = [self editedObject];
[self close];
[thisView removeFromSuperview];
[document detachObject: thisView];
}
return newSelection;

View file

@ -387,7 +387,7 @@
id thisView = [self editedObject];
[self close];
[thisView removeFromSuperview];
[document detachObject: thisView];
}
return newSelection;
}

View file

@ -34,7 +34,6 @@
BOOL activated;
BOOL closed;
GormViewWithSubviewsEditor *parent;
}
- (BOOL) activate;
- (id) initWithObject: (id)anObject
@ -46,8 +45,11 @@
- (void) detachSubviews;
- (void) postDraw: (NSRect) rect;
- (id) parent;
- (NSArray *)selection;
- (NSArray *) selection;
- (void) makeSelectionVisible: (BOOL) value;
- (BOOL) isOpened;
- (BOOL) canBeOpened;
- (void) setOpened: (BOOL) value;
@end
@interface GormViewEditor (EditingAdditions)

View file

@ -1423,6 +1423,28 @@ static BOOL currently_displaying = NO;
- (void) makeSelectionVisible: (BOOL) value
{
}
- (BOOL) canBeOpened
{
return NO;
}
- (BOOL) isOpened
{
return NO;
}
- (void) setOpened: (BOOL) value
{
if (value == YES)
{
[document setSelectionFromEditor: self];
}
else
{
[self setNeedsDisplay: YES];
}
}
@end

View file

@ -924,7 +924,7 @@ int _sortViews(id view1, id view2, void *context)
prevRect = currRect;
}
NSLog(@"The vote is %d",count);
NSDebugLog(@"The vote is %d",count);
if(count >= 0)
vertical = YES;
@ -1061,42 +1061,80 @@ int _sortViews(id view1, id view2, void *context)
return;
}
enumerator = [selection objectEnumerator];
while ((subview = [enumerator nextObject]) != nil)
// if there is more than one view we must join them together.
if([selection count] > 1)
{
// deactivate the editor for each subview.
enumerator = [selection objectEnumerator];
while ((subview = [enumerator nextObject]) != nil)
{
superview = [subview superview];
rect = NSUnionRect(rect, [subview frame]);
[subview deactivate];
}
// create the containing view.
view = [[NSView alloc] initWithFrame:
NSMakeRect(0, 0, rect.size.width, rect.size.height)];
// create scroll view now.
scrollView = [[NSScrollView alloc] initWithFrame: rect];
[scrollView setHasHorizontalScroller: YES];
[scrollView setHasVerticalScroller: YES];
[scrollView setBorderType: NSBezelBorder];
// attach the scroll view...
[document attachObject: scrollView
toParent: _editedObject];
[superview addSubview: scrollView];
[scrollView setDocumentView: view];
// add the views.
enumerator = [selection objectEnumerator];
while ((subview = [enumerator nextObject]) != nil)
{
NSPoint frameOrigin;
[view addSubview: [subview editedObject]];
frameOrigin = [[subview editedObject] frame].origin;
frameOrigin.x -= rect.origin.x;
frameOrigin.y -= rect.origin.y;
[[subview editedObject] setFrameOrigin: frameOrigin];
[subview close];
}
}
else if([selection count] == 1)
{
NSPoint frameOrigin;
id v = nil;
// since we have one view, it will be used as the document view.
subview = [selection objectAtIndex: 0];
superview = [subview superview];
rect = NSUnionRect(rect, [subview frame]);
[subview deactivate];
}
view = [[NSView alloc] initWithFrame:
NSMakeRect(0, 0, rect.size.width, rect.size.height)];
scrollView = [[NSScrollView alloc] initWithFrame: rect];
[scrollView setHasHorizontalScroller: YES];
[scrollView setHasVerticalScroller: YES];
[scrollView setBorderType: NSBezelBorder];
// create scroll view now.
scrollView = [[NSScrollView alloc] initWithFrame: rect];
[scrollView setHasHorizontalScroller: YES];
[scrollView setHasVerticalScroller: YES];
[scrollView setBorderType: NSBezelBorder];
[document attachObject: scrollView
toParent: _editedObject];
// attach the scroll view...
[document attachObject: scrollView
toParent: _editedObject];
[superview addSubview: scrollView];
[superview addSubview: scrollView];
[scrollView setDocumentView: view];
// add the view
v = [subview editedObject];
[scrollView setDocumentView: v];
enumerator = [selection objectEnumerator];
while ((subview = [enumerator nextObject]) != nil)
{
NSPoint frameOrigin;
[view addSubview: [subview editedObject]];
frameOrigin = [[subview editedObject] frame].origin;
// set the origin..
frameOrigin = [v frame].origin;
frameOrigin.x -= rect.origin.x;
frameOrigin.y -= rect.origin.y;
[[subview editedObject] setFrameOrigin: frameOrigin];
[v setFrameOrigin: frameOrigin];
[subview close];
}
editor = [document editorForObject: scrollView
inEditor: self
create: YES];
@ -1115,11 +1153,11 @@ int _sortViews(id view1, id view2, void *context)
if ([selection count] != 1)
return;
NSLog(@"ungroup called");
NSDebugLog(@"ungroup called");
toUngroup = [selection objectAtIndex: 0];
NSLog(@"toUngroup = %@",[toUngroup description]);
NSDebugLog(@"toUngroup = %@",[toUngroup description]);
if ([toUngroup isKindOfClass: [GormBoxEditor class]]
|| [toUngroup isKindOfClass: [GormSplitViewEditor class]]

View file

@ -29,20 +29,15 @@
@interface GormViewWithSubviewsEditor : GormViewEditor <IBSelectionOwners>
{
BOOL _displaySelection;
BOOL opened;
GormViewWithSubviewsEditor *openedSubeditor;
NSMutableArray *selection;
BOOL opened;
}
- (BOOL) isOpened;
- (BOOL) canBeOpened;
- (void) setOpenedSubeditor: (GormViewWithSubviewsEditor *) newEditor;
- (void) setOpened: (BOOL) value;
- (void) openParentEditor;
- (void) makeSubeditorResign;
- (void) silentlyResetSelection;
- (void) makeSelectionVisible: (BOOL) value;
- (NSArray*) selection;
- (void) selectObjects: (NSArray *) objects;
- (void) copySelection;
- (void) deleteSelection;

View file

@ -80,7 +80,6 @@
}
}
- (BOOL) canBeOpened
{
return YES;