mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-02 19:22:58 +00:00
Store a conversion table of views/objects we're replacing and restore connections to those replaced objects. (nib2cib)
This commit is contained in:
1 parent
0b22b1d022
commit
004cc5fe5a
3 files changed
+21
-1
No files matched your search
@@ -45,6 +45,7 @@ _CPButtonBezelStyleHeights[CPHUDBezelStyle] = 20;
|
||||
if (self)
|
||||
{
|
||||
var cell = [aCoder decodeObjectForKey:@"NSCell"];
|
||||
NIB_CONNECTION_EQUIVALENCY_TABLE[[cell UID]] = self;
|
||||
|
||||
if (![self NS_isCheckBox] && ![self NS_isRadio])
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
@import "NSView.j"
|
||||
|
||||
|
||||
@implementation NSMatrix : CPObject
|
||||
{
|
||||
}
|
||||
@@ -49,11 +48,15 @@
|
||||
|
||||
[view addSubview:cellView];
|
||||
|
||||
NIB_CONNECTION_EQUIVALENCY_TABLE[[cell UID]] = cellView;
|
||||
|
||||
frame.origin.x = CGRectGetMaxX(frame) + intercellSpacing.width;
|
||||
}
|
||||
|
||||
frame.origin.y = CGRectGetMaxY(frame) + intercellSpacing.height;
|
||||
}
|
||||
|
||||
NIB_CONNECTION_EQUIVALENCY_TABLE[self] = view;
|
||||
}
|
||||
|
||||
return view;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
@import <AppKit/CPCibControlConnector.j>
|
||||
@import <AppKit/CPCibOutletConnector.j>
|
||||
|
||||
NIB_CONNECTION_EQUIVALENCY_TABLE = {};
|
||||
|
||||
@implementation CPCibConnector (NSCoding)
|
||||
|
||||
@@ -37,6 +38,21 @@
|
||||
_destination = [aCoder decodeObjectForKey:@"NSDestination"];
|
||||
_label = [aCoder decodeObjectForKey:@"NSLabel"];
|
||||
|
||||
var sourceUID = [_source UID],
|
||||
destinationUID = [_destination UID];
|
||||
|
||||
if (sourceUID in NIB_CONNECTION_EQUIVALENCY_TABLE)
|
||||
{
|
||||
CPLog.trace("Swapped object: "+_source+" for object: "+NIB_CONNECTION_EQUIVALENCY_TABLE[sourceUID]);
|
||||
_source = NIB_CONNECTION_EQUIVALENCY_TABLE[sourceUID];
|
||||
}
|
||||
|
||||
if (destinationUID in NIB_CONNECTION_EQUIVALENCY_TABLE)
|
||||
{
|
||||
CPLog.trace("Swapped object: "+_destination+" for object: "+NIB_CONNECTION_EQUIVALENCY_TABLE[destinationUID]);
|
||||
_destination = NIB_CONNECTION_EQUIVALENCY_TABLE[destinationUID];
|
||||
}
|
||||
|
||||
CPLog.debug(@"Connection: " + [_source description] + " " + [_destination description] + " " + _label);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user