mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-24 12:01:16 +00:00
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:
parent
da35a01e7f
commit
6eb2f09927
11 changed files with 147 additions and 57 deletions
13
ChangeLog
13
ChangeLog
|
@ -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>
|
2004-01-29 12:09 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* Version 0.6.0
|
* Version 0.6.0
|
||||||
|
|
|
@ -163,7 +163,6 @@ Gorm_HEADERS = \
|
||||||
GormSetNameController.h \
|
GormSetNameController.h \
|
||||||
GormGeneralPref.h
|
GormGeneralPref.h
|
||||||
|
|
||||||
|
|
||||||
Gorm_OBJC_FILES = \
|
Gorm_OBJC_FILES = \
|
||||||
Gorm.m \
|
Gorm.m \
|
||||||
GormDocument.m \
|
GormDocument.m \
|
||||||
|
|
|
@ -35,20 +35,23 @@
|
||||||
@implementation NSBox (GormObjectAdditions)
|
@implementation NSBox (GormObjectAdditions)
|
||||||
- (NSString*) editorClassName
|
- (NSString*) editorClassName
|
||||||
{
|
{
|
||||||
|
// if([[self superview] isKindOfClass: [NSClipView class]])
|
||||||
|
// return @"GormInternalViewEditor";
|
||||||
|
|
||||||
return @"GormBoxEditor";
|
return @"GormBoxEditor";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSFont *) font
|
- (NSFont *) font
|
||||||
{
|
{
|
||||||
return [self titleFont];
|
return [self titleFont];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setFont: (NSFont *)aFont
|
- (void) setFont: (NSFont *)aFont
|
||||||
{
|
{
|
||||||
[self setTitleFont: aFont];
|
[self setTitleFont: aFont];
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@implementation GormBoxEditor
|
@implementation GormBoxEditor
|
||||||
|
|
||||||
- (void) setOpened: (BOOL) flag
|
- (void) setOpened: (BOOL) flag
|
||||||
|
|
|
@ -921,7 +921,7 @@ static NSImage *horizontalImage;
|
||||||
id thisView = [parent editedObject];
|
id thisView = [parent editedObject];
|
||||||
[parent close];
|
[parent close];
|
||||||
[thisView removeFromSuperview];
|
[thisView removeFromSuperview];
|
||||||
|
[document detachObject: thisView];
|
||||||
}
|
}
|
||||||
|
|
||||||
return newSelection;
|
return newSelection;
|
||||||
|
|
|
@ -167,10 +167,15 @@
|
||||||
|
|
||||||
- (NSArray *)destroyAndListSubviews
|
- (NSArray *)destroyAndListSubviews
|
||||||
{
|
{
|
||||||
id internalView = [[[_EO documentView] subviews] objectAtIndex: 0];
|
id documentView = [_EO documentView];
|
||||||
|
NSArray *subviews = [documentView subviews];
|
||||||
|
NSMutableArray *newSelection = [NSMutableArray array];
|
||||||
|
|
||||||
|
if([documentView conformsToProtocol: @protocol(IBEditors)] == YES)
|
||||||
|
{
|
||||||
|
id internalView = [subviews objectAtIndex: 0];
|
||||||
NSEnumerator *enumerator = [[internalView subviews] objectEnumerator];
|
NSEnumerator *enumerator = [[internalView subviews] objectEnumerator];
|
||||||
GormViewEditor *subview;
|
GormViewEditor *subview;
|
||||||
NSMutableArray *newSelection = [NSMutableArray array];
|
|
||||||
|
|
||||||
[parent makeSubeditorResign];
|
[parent makeSubeditorResign];
|
||||||
while ((subview = [enumerator nextObject]) != nil)
|
while ((subview = [enumerator nextObject]) != nil)
|
||||||
|
@ -184,11 +189,25 @@
|
||||||
[v setFrame: frame];
|
[v setFrame: frame];
|
||||||
[newSelection addObject: v];
|
[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];
|
id thisView = [self editedObject];
|
||||||
[self close];
|
[self close];
|
||||||
[thisView removeFromSuperview];
|
[thisView removeFromSuperview];
|
||||||
|
[document detachObject: thisView];
|
||||||
}
|
}
|
||||||
|
|
||||||
return newSelection;
|
return newSelection;
|
||||||
|
|
|
@ -387,7 +387,7 @@
|
||||||
id thisView = [self editedObject];
|
id thisView = [self editedObject];
|
||||||
[self close];
|
[self close];
|
||||||
[thisView removeFromSuperview];
|
[thisView removeFromSuperview];
|
||||||
|
[document detachObject: thisView];
|
||||||
}
|
}
|
||||||
return newSelection;
|
return newSelection;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
BOOL activated;
|
BOOL activated;
|
||||||
BOOL closed;
|
BOOL closed;
|
||||||
GormViewWithSubviewsEditor *parent;
|
GormViewWithSubviewsEditor *parent;
|
||||||
|
|
||||||
}
|
}
|
||||||
- (BOOL) activate;
|
- (BOOL) activate;
|
||||||
- (id) initWithObject: (id)anObject
|
- (id) initWithObject: (id)anObject
|
||||||
|
@ -48,6 +47,9 @@
|
||||||
- (id) parent;
|
- (id) parent;
|
||||||
- (NSArray *) selection;
|
- (NSArray *) selection;
|
||||||
- (void) makeSelectionVisible: (BOOL) value;
|
- (void) makeSelectionVisible: (BOOL) value;
|
||||||
|
- (BOOL) isOpened;
|
||||||
|
- (BOOL) canBeOpened;
|
||||||
|
- (void) setOpened: (BOOL) value;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GormViewEditor (EditingAdditions)
|
@interface GormViewEditor (EditingAdditions)
|
||||||
|
|
|
@ -1423,6 +1423,28 @@ static BOOL currently_displaying = NO;
|
||||||
- (void) makeSelectionVisible: (BOOL) value
|
- (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
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -924,7 +924,7 @@ int _sortViews(id view1, id view2, void *context)
|
||||||
prevRect = currRect;
|
prevRect = currRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSLog(@"The vote is %d",count);
|
NSDebugLog(@"The vote is %d",count);
|
||||||
|
|
||||||
if(count >= 0)
|
if(count >= 0)
|
||||||
vertical = YES;
|
vertical = YES;
|
||||||
|
@ -1061,8 +1061,11 @@ int _sortViews(id view1, id view2, void *context)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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];
|
enumerator = [selection objectEnumerator];
|
||||||
|
|
||||||
while ((subview = [enumerator nextObject]) != nil)
|
while ((subview = [enumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
superview = [subview superview];
|
superview = [subview superview];
|
||||||
|
@ -1070,22 +1073,23 @@ int _sortViews(id view1, id view2, void *context)
|
||||||
[subview deactivate];
|
[subview deactivate];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create the containing view.
|
||||||
view = [[NSView alloc] initWithFrame:
|
view = [[NSView alloc] initWithFrame:
|
||||||
NSMakeRect(0, 0, rect.size.width, rect.size.height)];
|
NSMakeRect(0, 0, rect.size.width, rect.size.height)];
|
||||||
|
// create scroll view now.
|
||||||
scrollView = [[NSScrollView alloc] initWithFrame: rect];
|
scrollView = [[NSScrollView alloc] initWithFrame: rect];
|
||||||
[scrollView setHasHorizontalScroller: YES];
|
[scrollView setHasHorizontalScroller: YES];
|
||||||
[scrollView setHasVerticalScroller: YES];
|
[scrollView setHasVerticalScroller: YES];
|
||||||
[scrollView setBorderType: NSBezelBorder];
|
[scrollView setBorderType: NSBezelBorder];
|
||||||
|
|
||||||
|
// attach the scroll view...
|
||||||
[document attachObject: scrollView
|
[document attachObject: scrollView
|
||||||
toParent: _editedObject];
|
toParent: _editedObject];
|
||||||
|
|
||||||
[superview addSubview: scrollView];
|
[superview addSubview: scrollView];
|
||||||
[scrollView setDocumentView: view];
|
[scrollView setDocumentView: view];
|
||||||
|
|
||||||
|
// add the views.
|
||||||
enumerator = [selection objectEnumerator];
|
enumerator = [selection objectEnumerator];
|
||||||
|
|
||||||
while ((subview = [enumerator nextObject]) != nil)
|
while ((subview = [enumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
NSPoint frameOrigin;
|
NSPoint frameOrigin;
|
||||||
|
@ -1096,6 +1100,40 @@ int _sortViews(id view1, id view2, void *context)
|
||||||
[[subview editedObject] setFrameOrigin: frameOrigin];
|
[[subview editedObject] setFrameOrigin: frameOrigin];
|
||||||
[subview close];
|
[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];
|
||||||
|
|
||||||
|
// 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];
|
||||||
|
|
||||||
|
// add the view
|
||||||
|
v = [subview editedObject];
|
||||||
|
[scrollView setDocumentView: v];
|
||||||
|
|
||||||
|
// set the origin..
|
||||||
|
frameOrigin = [v frame].origin;
|
||||||
|
frameOrigin.x -= rect.origin.x;
|
||||||
|
frameOrigin.y -= rect.origin.y;
|
||||||
|
[v setFrameOrigin: frameOrigin];
|
||||||
|
[subview close];
|
||||||
|
}
|
||||||
|
|
||||||
editor = [document editorForObject: scrollView
|
editor = [document editorForObject: scrollView
|
||||||
inEditor: self
|
inEditor: self
|
||||||
|
@ -1115,11 +1153,11 @@ int _sortViews(id view1, id view2, void *context)
|
||||||
if ([selection count] != 1)
|
if ([selection count] != 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSLog(@"ungroup called");
|
NSDebugLog(@"ungroup called");
|
||||||
|
|
||||||
toUngroup = [selection objectAtIndex: 0];
|
toUngroup = [selection objectAtIndex: 0];
|
||||||
|
|
||||||
NSLog(@"toUngroup = %@",[toUngroup description]);
|
NSDebugLog(@"toUngroup = %@",[toUngroup description]);
|
||||||
|
|
||||||
if ([toUngroup isKindOfClass: [GormBoxEditor class]]
|
if ([toUngroup isKindOfClass: [GormBoxEditor class]]
|
||||||
|| [toUngroup isKindOfClass: [GormSplitViewEditor class]]
|
|| [toUngroup isKindOfClass: [GormSplitViewEditor class]]
|
||||||
|
|
|
@ -29,20 +29,15 @@
|
||||||
@interface GormViewWithSubviewsEditor : GormViewEditor <IBSelectionOwners>
|
@interface GormViewWithSubviewsEditor : GormViewEditor <IBSelectionOwners>
|
||||||
{
|
{
|
||||||
BOOL _displaySelection;
|
BOOL _displaySelection;
|
||||||
BOOL opened;
|
|
||||||
GormViewWithSubviewsEditor *openedSubeditor;
|
GormViewWithSubviewsEditor *openedSubeditor;
|
||||||
NSMutableArray *selection;
|
NSMutableArray *selection;
|
||||||
|
BOOL opened;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) isOpened;
|
|
||||||
- (BOOL) canBeOpened;
|
|
||||||
- (void) setOpenedSubeditor: (GormViewWithSubviewsEditor *) newEditor;
|
- (void) setOpenedSubeditor: (GormViewWithSubviewsEditor *) newEditor;
|
||||||
- (void) setOpened: (BOOL) value;
|
|
||||||
- (void) openParentEditor;
|
- (void) openParentEditor;
|
||||||
- (void) makeSubeditorResign;
|
- (void) makeSubeditorResign;
|
||||||
- (void) silentlyResetSelection;
|
- (void) silentlyResetSelection;
|
||||||
- (void) makeSelectionVisible: (BOOL) value;
|
|
||||||
- (NSArray*) selection;
|
|
||||||
- (void) selectObjects: (NSArray *) objects;
|
- (void) selectObjects: (NSArray *) objects;
|
||||||
- (void) copySelection;
|
- (void) copySelection;
|
||||||
- (void) deleteSelection;
|
- (void) deleteSelection;
|
||||||
|
|
|
@ -80,7 +80,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (BOOL) canBeOpened
|
- (BOOL) canBeOpened
|
||||||
{
|
{
|
||||||
return YES;
|
return YES;
|
||||||
|
|
Loading…
Reference in a new issue