mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 21:17:03 +00:00
Fix for fonts not working in nib2cib and performance improvement for adding views.
Reviewed by me.
This commit is contained in:
+11
-4
@@ -414,16 +414,23 @@ var DOMElementPrototype = nil,
|
||||
/* @ignore */
|
||||
- (void)_setWindow:(CPWindow)aWindow
|
||||
{
|
||||
// FIXME: check _window == aWindow? If not, comment why!
|
||||
if ([_window firstResponder] == self)
|
||||
if (_window === aWindow)
|
||||
return;
|
||||
|
||||
// Clear out first responder if we're the first responder and leaving.
|
||||
if ([_window firstResponder] === self)
|
||||
[_window makeFirstResponder:nil];
|
||||
|
||||
// Notify the view and its subviews
|
||||
[self viewWillMoveToWindow:aWindow];
|
||||
[_subviews makeObjectsPerformSelector:@selector(_setWindow:) withObject:aWindow];
|
||||
|
||||
|
||||
_window = aWindow;
|
||||
|
||||
var count = [_subviews count];
|
||||
|
||||
while (count--)
|
||||
[_subviews[count] _setWindow:aWindow];
|
||||
|
||||
[self viewDidMoveToWindow];
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
_controlSize = (flags2 & 0xE0000) >> 17;
|
||||
|
||||
_objectValue = [aCoder decodeObjectForKey:@"NSContents"];
|
||||
_font = [aCoder decodeObjectForKey:@"NSFont"];
|
||||
_font = [aCoder decodeObjectForKey:@"NSSupport"];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
+11
-2
@@ -27,8 +27,17 @@
|
||||
|
||||
- (id)NS_initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
// FIXME: bold?
|
||||
return [self _initWithName:[aCoder decodeObjectForKey:@"NSName"] size:[aCoder decodeDoubleForKey:@"NSSize"] bold:NO];
|
||||
var isBold = NO,
|
||||
fontName = [aCoder decodeObjectForKey:@"NSName"];
|
||||
|
||||
// FIXME: Is this alwasy true?
|
||||
if (fontName.indexOf("-Bold") === fontName.length - "-Bold".length)
|
||||
isBold = YES;
|
||||
|
||||
if (fontName === "LucidaGrande" || fontName === "LucidaGrande-Bold")
|
||||
fontName = "Arial";
|
||||
|
||||
return [self _initWithName:fontName size:[aCoder decodeDoubleForKey:@"NSSize"] bold:isBold];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user