Skip to content

Commit

Permalink
Cleanup classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
gcasa committed Oct 1, 2023
1 parent 0bc6061 commit 00854f1
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 114 deletions.
62 changes: 31 additions & 31 deletions Source/NSPopover.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/

Expand Down Expand Up @@ -76,18 +76,18 @@ @interface GSPopoverPanel : NSPanel
@implementation GSPopoverPanel

- (id) initWithContentRect: (NSRect)contentRect
styleMask: (NSUInteger)aStyle
backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag
styleMask: (NSUInteger)aStyle
backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag
{
self = [super initWithContentRect: contentRect
styleMask: aStyle
backing: bufferingType
defer: flag];
styleMask: aStyle
backing: bufferingType
defer: flag];
if (self)
{
[super setContentView: AUTORELEASE([[GSPopoverView alloc]
initWithFrame: contentRect])];
initWithFrame: contentRect])];
}
return self;
}
Expand All @@ -98,12 +98,12 @@ - (void) orderOut: (id)sender
[self close];
}

- (BOOL) canBecomeKeyWindow
- (BOOL) canBecomeKeyWindow
{
return NO;
}

- (BOOL) canBecomeMainWindow
- (BOOL) canBecomeMainWindow
{
return NO;
}
Expand All @@ -121,7 +121,7 @@ - (NSView *) contentView
{
return nil;
}

return [subviews objectAtIndex: 0];
}

Expand Down Expand Up @@ -180,18 +180,18 @@ - (void) setContentViewController: (NSViewController *)controller
BOOL loaded = [NSBundle loadNibNamed: controllerClassName
owner: controller];
if (!loaded)
{
[NSException raise: NSInternalInconsistencyException
format: @"Could not load controller %@", controllerClassName];
}
{
[NSException raise: NSInternalInconsistencyException
format: @"Could not load controller %@", controllerClassName];
}
else
{
if ([controller view] == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"Loaded controller named %@, but view is not set", controllerClassName];
}
}
{
if ([controller view] == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"Loaded controller named %@, but view is not set", controllerClassName];
}
}
}
ASSIGN(_contentViewController, controller);
}
Expand Down Expand Up @@ -245,14 +245,14 @@ - (IBAction) performClose: (id)sender
}

- (void) showRelativeToRect: (NSRect)positioningRect
ofView: (NSView *)positioningView
preferredEdge: (NSRectEdge)preferredEdge
ofView: (NSView *)positioningView
preferredEdge: (NSRectEdge)preferredEdge
{
NSView *view = nil;
NSRect screenRect;
NSRect windowFrame;
NSRect viewFrame;

[_contentViewController loadView];
view = [_contentViewController view];
viewFrame = [view frame];
Expand All @@ -263,7 +263,7 @@ - (void) showRelativeToRect: (NSRect)positioningRect
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreRetained
defer: NO];

[_realPanel setBackgroundColor: [NSColor darkGrayColor]];
[_realPanel setReleasedWhenClosed: YES];
[_realPanel setExcludedFromWindowsMenu: YES];
Expand All @@ -272,7 +272,7 @@ - (void) showRelativeToRect: (NSRect)positioningRect
[_realPanel setDelegate: self];
[_realPanel setContentView: view];
}

screenRect = [[positioningView window] convertRectToScreen:positioningRect];
windowFrame = [_realPanel frame];
windowFrame.origin = screenRect.origin;
Expand All @@ -296,10 +296,10 @@ - (void) showRelativeToRect: (NSRect)positioningRect

[_realPanel setFrame: windowFrame display: YES];
[_realPanel makeKeyAndOrderFront:self];

NSDebugLog(@"Showing relative to in window %@",NSStringFromRect(positioningRect));
NSDebugLog(@"Showing relative to in screen %@",NSStringFromRect(screenRect));

_shown = YES;
}

Expand Down Expand Up @@ -368,7 +368,7 @@ - (void) encodeWithCoder: (NSCoder *)coder
[coder encodeValueOfObjCType: @encode(CGFloat) at: &_contentSize.width];
[coder encodeValueOfObjCType: @encode(CGFloat) at: &_contentSize.height];
[coder encodeObject:_contentViewController];
}
}
}

@end
101 changes: 51 additions & 50 deletions Source/NSStoryboardSegue.m
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/* Implementation of class NSStoryboardSegue
Copyright (C) 2020 Free Software Foundation, Inc.
By: Gregory Casamento
Date: Mon Jan 20 15:57:31 EST 2020
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Expand Down Expand Up @@ -71,23 +71,23 @@ - (void) _setSourceController: (id)controller
_sourceController = controller;
}

+ (instancetype) segueWithIdentifier: (NSStoryboardSegueIdentifier)identifier
source: (id)sourceController
destination: (id)destinationController
performHandler: (GSStoryboardSeguePerformHandler)performHandler
+ (instancetype) segueWithIdentifier: (NSStoryboardSegueIdentifier)identifier
source: (id)sourceController
destination: (id)destinationController
performHandler: (GSStoryboardSeguePerformHandler)performHandler
{
NSStoryboardSegue *segue = [[NSStoryboardSegue alloc] initWithIdentifier: identifier
source: sourceController
destination: destinationController];
source: sourceController
destination: destinationController];
AUTORELEASE(segue);
[segue _setHandler: performHandler];

return segue;
}

- (instancetype) initWithIdentifier: (NSStoryboardSegueIdentifier)identifier
source: (id)sourceController
destination: (id)destinationController
- (instancetype) initWithIdentifier: (NSStoryboardSegueIdentifier)identifier
source: (id)sourceController
destination: (id)destinationController
{
self = [super init];
if (self != nil)
Expand Down Expand Up @@ -116,59 +116,59 @@ - (void) perform
if ([_kind isEqualToString: @"relationship"])
{
if ([_relationship isEqualToString: @"window.shadowedContentViewController"])
{
NSWindow *w = [_sourceController window];
NSView *v = [_destinationController view];
[w setContentView: v];
[w setTitle: [_destinationController title]];
[_sourceController showWindow: self];
}
{
NSWindow *w = [_sourceController window];
NSView *v = [_destinationController view];
[w setContentView: v];
[w setTitle: [_destinationController title]];
[_sourceController showWindow: self];
}
else if ([_relationship isEqualToString: @"splitItems"])
{
NSView *v = [_destinationController view];
NSSplitViewController *svc = (NSSplitViewController *)_sourceController;
[[svc splitView] addSubview: v];
NSUInteger idx = [[[svc splitView] subviews] count] - 1;
NSSplitViewItem *item = [[svc splitViewItems] objectAtIndex: idx];
[item setViewController: _destinationController];
}
{
NSView *v = [_destinationController view];
NSSplitViewController *svc = (NSSplitViewController *)_sourceController;
[[svc splitView] addSubview: v];
NSUInteger idx = [[[svc splitView] subviews] count] - 1;
NSSplitViewItem *item = [[svc splitViewItems] objectAtIndex: idx];
[item setViewController: _destinationController];
}
else if ([_relationship isEqualToString: @"tabItems"])
{
NSTabViewController *tvc = (NSTabViewController *)_sourceController;
NSTabViewItem *item = [NSTabViewItem tabViewItemWithViewController: _destinationController];
[tvc addTabViewItem: item];
}
{
NSTabViewController *tvc = (NSTabViewController *)_sourceController;
NSTabViewItem *item = [NSTabViewItem tabViewItemWithViewController: _destinationController];
[tvc addTabViewItem: item];
}
}
else if ([_kind isEqualToString: @"modal"])
{
NSWindow *w = nil;
if ([_destinationController isKindOfClass: [NSWindowController class]])
{
w = [_destinationController window];
}
{
w = [_destinationController window];
}
else
{
w = [NSWindow windowWithContentViewController: _destinationController];
[w setTitle: [_destinationController title]];
}
{
w = [NSWindow windowWithContentViewController: _destinationController];
[w setTitle: [_destinationController title]];
}
RETAIN(w);
[w center];
[NSApp runModalForWindow: w];
}
else if ([_kind isEqualToString: @"show"])
{
if ([_destinationController isKindOfClass: [NSWindowController class]])
{
[_destinationController showWindow: _sourceController];
}
{
[_destinationController showWindow: _sourceController];
}
else
{
NSWindow *w = [NSWindow windowWithContentViewController: _destinationController];
[w setTitle: [_destinationController title]];
[w center];
[w orderFrontRegardless];
RETAIN(w);
}
{
NSWindow *w = [NSWindow windowWithContentViewController: _destinationController];
[w setTitle: [_destinationController title]];
[w center];
[w orderFrontRegardless];
RETAIN(w);
}
}
else if ([_kind isEqualToString: @"popover"])
{
Expand All @@ -188,6 +188,7 @@ - (void) perform
{
if ([_popover behavior] == NSPopoverBehaviorTransient)
{
[_destinationController dismissController: nil];
[_popover close];
RELEASE(_popover);
_popover = nil;
Expand Down
Loading

0 comments on commit 00854f1

Please sign in to comment.