mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 02:04:20 +00:00
Fix issues with storyboards and segues
This commit is contained in:
parent
82dce67eb4
commit
3d99541546
3 changed files with 84 additions and 61 deletions
|
@ -727,9 +727,13 @@
|
|||
NSXMLNode *pkind
|
||||
= [NSXMLNode attributeWithName: @"kind"
|
||||
stringValue: kind];
|
||||
NSXMLNode *panchorview
|
||||
= [NSXMLNode attributeWithName: @"popoverAnchorView"
|
||||
stringValue: anchorView];
|
||||
|
||||
NSXMLNode *panchorview = nil;
|
||||
if (anchorView != nil)
|
||||
{
|
||||
panchorview = [NSXMLNode attributeWithName: @"popoverAnchorView"
|
||||
stringValue: anchorView];
|
||||
}
|
||||
|
||||
[sbproxy addAttribute: pselector];
|
||||
[sbproxy addAttribute: ptarget];
|
||||
|
@ -737,8 +741,12 @@
|
|||
[sbproxy addAttribute: psegueIdent];
|
||||
[sbproxy addAttribute: psender];
|
||||
[sbproxy addAttribute: pkind];
|
||||
[sbproxy addAttribute: panchorview];
|
||||
|
||||
if (panchorview != nil)
|
||||
{
|
||||
[sbproxy addAttribute: panchorview];
|
||||
}
|
||||
|
||||
return sbproxy;
|
||||
}
|
||||
|
||||
|
@ -774,43 +782,48 @@
|
|||
ident = [[NSUUID UUID] UUIDString];
|
||||
}
|
||||
attr = [obj attributeForName: @"popoverAnchorView"];
|
||||
NSString *av = [attr stringValue];
|
||||
attr = [obj attributeForName: @"popoverBehavior"];
|
||||
NSString *pb = [attr stringValue];
|
||||
NSPopoverBehavior behavior = NSPopoverBehaviorApplicationDefined;
|
||||
if ([pb isEqualToString: @"a"])
|
||||
{
|
||||
behavior = NSPopoverBehaviorApplicationDefined;
|
||||
}
|
||||
else if ([pb isEqualToString: @"t"])
|
||||
{
|
||||
behavior = NSPopoverBehaviorTransient;
|
||||
}
|
||||
else if ([pb isEqualToString: @"s"])
|
||||
{
|
||||
behavior = NSPopoverBehaviorSemitransient;
|
||||
}
|
||||
|
||||
attr = [obj attributeForName: @"preferredEdge"];
|
||||
NSString *pe = [attr stringValue];
|
||||
NSRectEdge edge = NSMinXEdge;
|
||||
if ([pe isEqualToString: @"maxY"])
|
||||
{
|
||||
edge = NSMaxYEdge;
|
||||
}
|
||||
else if ([pe isEqualToString: @"minY"])
|
||||
{
|
||||
edge = NSMinYEdge;
|
||||
}
|
||||
else if ([pe isEqualToString: @"maxX"])
|
||||
{
|
||||
edge = NSMaxXEdge;
|
||||
}
|
||||
else if ([pe isEqualToString: @"minX"])
|
||||
{
|
||||
edge = NSMinXEdge;
|
||||
}
|
||||
[obj detach]; // segue can't be in the archive since it doesn't conform to NSCoding
|
||||
|
||||
NSString *av = [attr stringValue];
|
||||
NSPopoverBehavior behavior = NSNotFound;
|
||||
NSRectEdge edge = NSNotFound;
|
||||
|
||||
if (av != nil)
|
||||
{
|
||||
attr = [obj attributeForName: @"popoverBehavior"];
|
||||
NSString *pb = [attr stringValue];
|
||||
if ([pb isEqualToString: @"a"])
|
||||
{
|
||||
behavior = NSPopoverBehaviorApplicationDefined;
|
||||
}
|
||||
else if ([pb isEqualToString: @"t"])
|
||||
{
|
||||
behavior = NSPopoverBehaviorTransient;
|
||||
}
|
||||
else if ([pb isEqualToString: @"s"])
|
||||
{
|
||||
behavior = NSPopoverBehaviorSemitransient;
|
||||
}
|
||||
|
||||
attr = [obj attributeForName: @"preferredEdge"];
|
||||
NSString *pe = [attr stringValue];
|
||||
if ([pe isEqualToString: @"maxY"])
|
||||
{
|
||||
edge = NSMaxYEdge;
|
||||
}
|
||||
else if ([pe isEqualToString: @"minY"])
|
||||
{
|
||||
edge = NSMinYEdge;
|
||||
}
|
||||
else if ([pe isEqualToString: @"maxX"])
|
||||
{
|
||||
edge = NSMaxXEdge;
|
||||
}
|
||||
else if ([pe isEqualToString: @"minX"])
|
||||
{
|
||||
edge = NSMinXEdge;
|
||||
}
|
||||
}
|
||||
[obj detach]; // segue can't be in the archive since it doesn't conform to NSCoding
|
||||
|
||||
// Create proxy object to invoke methods on the window controller
|
||||
NSXMLElement *sbproxy = [self createStoryboardProxyElementWithSelector: @"doAction:"
|
||||
|
@ -838,11 +851,13 @@
|
|||
stringValue: [[sbproxy attributeForName: @"id"] stringValue]];
|
||||
NSXMLNode *controller_ident
|
||||
= [NSXMLNode attributeWithName: @"id"
|
||||
stringValue: uid];
|
||||
stringValue: uid];
|
||||
|
||||
[action addAttribute: selector];
|
||||
[action addAttribute: target];
|
||||
[action addAttribute: controller_ident];
|
||||
[segue_parent addChild: action];
|
||||
|
||||
[segue_parent addChild: action];
|
||||
}
|
||||
|
||||
// Create the segue...
|
||||
|
@ -851,9 +866,17 @@
|
|||
destination: dst];
|
||||
[ss _setKind: kind];
|
||||
[ss _setRelationship: rel];
|
||||
[ss _setPopoverBehavior: behavior];
|
||||
[ss _setPreferredEdge: edge];
|
||||
|
||||
|
||||
if (behavior != NSNotFound)
|
||||
{
|
||||
[ss _setPopoverBehavior: behavior];
|
||||
}
|
||||
|
||||
if (edge != NSNotFound)
|
||||
{
|
||||
[ss _setPreferredEdge: edge];
|
||||
}
|
||||
|
||||
// Add to maptable...
|
||||
[mapTable setObject: ss
|
||||
forKey: ident];
|
||||
|
|
|
@ -249,10 +249,12 @@
|
|||
NSRect screenRect;
|
||||
NSRect windowFrame;
|
||||
NSRect viewFrame;
|
||||
|
||||
NSWindow *window = nil;
|
||||
|
||||
[_contentViewController loadView];
|
||||
view = [_contentViewController view];
|
||||
viewFrame = [view frame];
|
||||
window = [view window];
|
||||
viewFrame = [view frame]; // [window convertRectToScreen: [view frame]];
|
||||
|
||||
if (!_realPanel)
|
||||
{
|
||||
|
@ -261,7 +263,6 @@
|
|||
backing: NSBackingStoreRetained
|
||||
defer: NO];
|
||||
|
||||
[_realPanel setBackgroundColor: [NSColor darkGrayColor]];
|
||||
[_realPanel setReleasedWhenClosed: YES];
|
||||
[_realPanel setExcludedFromWindowsMenu: YES];
|
||||
[_realPanel setLevel: NSPopUpMenuWindowLevel];
|
||||
|
@ -270,7 +271,7 @@
|
|||
[_realPanel setContentView: view];
|
||||
}
|
||||
|
||||
screenRect = [[positioningView window] convertRectToScreen:positioningRect];
|
||||
screenRect = [[positioningView window] convertRectToScreen: positioningRect];
|
||||
windowFrame = [_realPanel frame];
|
||||
windowFrame.origin = screenRect.origin;
|
||||
|
||||
|
@ -294,8 +295,8 @@
|
|||
[_realPanel setFrame: windowFrame display: YES];
|
||||
[_realPanel makeKeyAndOrderFront:self];
|
||||
|
||||
NSDebugLog(@"Showing relative to in window %@",NSStringFromRect(positioningRect));
|
||||
NSDebugLog(@"Showing relative to in screen %@",NSStringFromRect(screenRect));
|
||||
NSLog(@"Showing relative to in window %@",NSStringFromRect(positioningRect));
|
||||
NSLog(@"Showing relative to in screen %@",NSStringFromRect(screenRect));
|
||||
|
||||
_shown = YES;
|
||||
}
|
||||
|
|
|
@ -174,15 +174,15 @@
|
|||
{
|
||||
if (_popover == nil)
|
||||
{
|
||||
NSPopover *po = [[NSPopover alloc] init];
|
||||
NSRect rect = [_popoverAnchorView frame];
|
||||
|
||||
_popover = po; // weak... since we manually release...
|
||||
[po setBehavior: _popoverBehavior];
|
||||
[po setContentViewController: _destinationController];
|
||||
[po showRelativeToRect: rect
|
||||
ofView: _popoverAnchorView
|
||||
preferredEdge: _preferredEdge];
|
||||
NSLog(@"anchor view = %@", _popoverAnchorView);
|
||||
_popover = [[NSPopover alloc] init]; // manually release when closed...
|
||||
[_popover setBehavior: _popoverBehavior];
|
||||
[_popover setContentViewController: _destinationController];
|
||||
[_popover showRelativeToRect: rect
|
||||
ofView: _popoverAnchorView
|
||||
preferredEdge: _preferredEdge];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -190,8 +190,7 @@
|
|||
{
|
||||
[_destinationController dismissController: nil];
|
||||
[_popover close];
|
||||
RELEASE(_popover);
|
||||
_popover = nil;
|
||||
DESTROY(_popover);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue