mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-24 03:51:22 +00:00
Correction for Report#6890
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@18430 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7914bf834d
commit
6cfc472fcf
6 changed files with 94 additions and 24 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2004-01-17 23:07 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormViewEditor.[hm]: Addition of selection and makeSelectionVisible
|
||||
methods to allow views to exist within a scrollview without a
|
||||
containing NSView.
|
||||
* GormViewWithContentViewEditor.m: Changed code in
|
||||
groupSelectionInScrollView to not insert a NSView to contain the
|
||||
subview being grouped in the case where there is only one
|
||||
view selected. These fixes correct Report#6890.
|
||||
|
||||
2004-01-14 10:26 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* ClassInformation.plist: Added submenuAction: to the NSMenu
|
||||
class.
|
||||
|
||||
2004-01-14 01:42 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormDocument.m: attachObject:toParent: when the connection
|
||||
|
|
|
@ -378,6 +378,9 @@
|
|||
};
|
||||
|
||||
NSMenu = {
|
||||
Actions = (
|
||||
submenuAction:
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
|
||||
|
|
|
@ -603,7 +603,6 @@
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSTextField (GormObjectAdditions)
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
- (void) detachSubviews;
|
||||
- (void) postDraw: (NSRect) rect;
|
||||
- (id) parent;
|
||||
- (NSArray *)selection;
|
||||
- (void) makeSelectionVisible: (BOOL) value;
|
||||
@end
|
||||
|
||||
@interface GormViewEditor (EditingAdditions)
|
||||
|
|
|
@ -1406,6 +1406,23 @@ static BOOL currently_displaying = NO;
|
|||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSArray*) selection
|
||||
{
|
||||
NSMutableArray *result = [NSMutableArray arrayWithCapacity: 1];
|
||||
|
||||
// add self to the result...
|
||||
if ([self respondsToSelector: @selector(editedObject)])
|
||||
[result addObject: [self editedObject]];
|
||||
else
|
||||
[result addObject: self];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void) makeSelectionVisible: (BOOL) value
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -1061,8 +1061,11 @@ int _sortViews(id view1, id view2, void *context)
|
|||
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];
|
||||
|
||||
while ((subview = [enumerator nextObject]) != nil)
|
||||
{
|
||||
superview = [subview superview];
|
||||
|
@ -1070,22 +1073,23 @@ int _sortViews(id view1, id view2, void *context)
|
|||
[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;
|
||||
|
@ -1096,6 +1100,36 @@ int _sortViews(id view1, id view2, void *context)
|
|||
[[subview editedObject] setFrameOrigin: frameOrigin];
|
||||
[subview close];
|
||||
}
|
||||
}
|
||||
else if([selection count] == 1)
|
||||
{
|
||||
NSPoint frameOrigin;
|
||||
|
||||
// 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];
|
||||
[scrollView setDocumentView: [subview editedObject]];
|
||||
|
||||
// set the origin..
|
||||
frameOrigin = [[subview editedObject] frame].origin;
|
||||
frameOrigin.x -= rect.origin.x;
|
||||
frameOrigin.y -= rect.origin.y;
|
||||
[[subview editedObject] setFrameOrigin: frameOrigin];
|
||||
[subview close];
|
||||
}
|
||||
|
||||
editor = [document editorForObject: scrollView
|
||||
inEditor: self
|
||||
|
|
Loading…
Reference in a new issue