mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 19:51:00 +00:00
Improved standalone view support.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21133 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3b0820f7e3
commit
d71b1e88b8
4 changed files with 54 additions and 13 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2005-04-20 21:51 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCore/GormClassManager.m: Restrict instantiation of NSView and
|
||||
subclasses using Command-Shift-I. This means that standalone views
|
||||
can only be created from objects which are draggable from the palette.
|
||||
* GormCore/GormViewEditor.m: Removed logging ever time a standalone
|
||||
view is placed, as I don't consider the functionality experimental
|
||||
at this point.
|
||||
* GormCore/GormViewWindow.m: Size the window to accommodate the
|
||||
view if it already has size, if it doesn't resize the view to the
|
||||
window's dimensions.
|
||||
|
||||
2005-04-20 06:27 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Palettes/2Controls/ControlsPalette.gorm: Corrected minor
|
||||
|
|
|
@ -1928,6 +1928,11 @@
|
|||
{
|
||||
return NO;
|
||||
}
|
||||
else if([self isSuperclass: @"NSView" linkedToClass: className] ||
|
||||
[className isEqualToString: @"NSView"])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
else if([self isSuperclass: @"NSWindow" linkedToClass: className] ||
|
||||
[className isEqualToString: @"NSWindow"])
|
||||
{
|
||||
|
|
|
@ -312,7 +312,7 @@ static BOOL currently_displaying = NO;
|
|||
// standalone view.
|
||||
if([anObject window] == nil)
|
||||
{
|
||||
NSLog(@"#### Stand alone view: %@",_editedObject);
|
||||
NSDebugLog(@"#### Stand alone view: %@",_editedObject);
|
||||
viewWindow = [[GormViewWindow alloc] initWithView: _editedObject];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
}
|
||||
|
||||
- (id) initWithView: (NSView *)view;
|
||||
- (void) resize;
|
||||
- (void) initialResize;
|
||||
@end
|
||||
|
||||
@implementation GormViewWindowDelegate
|
||||
|
@ -46,28 +46,53 @@
|
|||
if((self = [super init]) != nil)
|
||||
{
|
||||
_view = view;
|
||||
[self resize];
|
||||
[self initialResize];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) resize
|
||||
- (void) initialResize
|
||||
{
|
||||
NSWindow *window = [_view window];
|
||||
NSRect newFrame = [window frame];
|
||||
NSRect windowFrame = [window frame];
|
||||
|
||||
// if the view is uninitialized, it's new... give it size.
|
||||
if(NSIsEmptyRect([_view frame]))
|
||||
{
|
||||
NSRect newFrame = windowFrame;
|
||||
|
||||
newFrame.origin.x = 10;
|
||||
newFrame.origin.y = 20;
|
||||
newFrame.size.height -= 70;
|
||||
newFrame.size.width -= 20;
|
||||
[_view setFrame: newFrame];
|
||||
}
|
||||
else // otherwise take size from it.
|
||||
{
|
||||
NSRect newFrame = [_view frame];
|
||||
|
||||
newFrame.origin.x = windowFrame.origin.x;
|
||||
newFrame.origin.y = windowFrame.origin.y;
|
||||
newFrame.size.height += 70;
|
||||
newFrame.size.width += 20;
|
||||
|
||||
[window setFrame: newFrame display: YES];
|
||||
}
|
||||
|
||||
[window center];
|
||||
}
|
||||
|
||||
- (void) windowDidResize: (NSNotification *)notification
|
||||
{
|
||||
NSWindow *window = [_view window];
|
||||
NSRect windowFrame = [window frame];
|
||||
NSRect newFrame = windowFrame;
|
||||
|
||||
newFrame.origin.x = 10;
|
||||
newFrame.origin.y = 20;
|
||||
newFrame.size.height -= 70;
|
||||
newFrame.size.width -= 20;
|
||||
[_view setFrame: newFrame];
|
||||
|
||||
NSLog(@"Resized %@",NSStringFromRect(newFrame));
|
||||
}
|
||||
|
||||
- (void) windowDidResize: (NSNotification *)notification
|
||||
{
|
||||
[self resize];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -105,7 +130,6 @@
|
|||
[[self contentView] addSubview: _view];
|
||||
DESTROY(_delegate);
|
||||
[self setDelegate: [[GormViewWindowDelegate alloc] initWithView: _view]];
|
||||
[self center];
|
||||
}
|
||||
|
||||
- (NSView *) view
|
||||
|
|
Loading…
Reference in a new issue