Fix for fonts not working in nib2cib and performance improvement for adding views.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I
2009-01-22 17:30:56 -08:00
parent cc32844a9c
commit d28bfee704
3 changed files with 23 additions and 7 deletions
+11 -4
View File
@@ -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];
}
+1 -1
View File
@@ -68,7 +68,7 @@
_controlSize = (flags2 & 0xE0000) >> 17;
_objectValue = [aCoder decodeObjectForKey:@"NSContents"];
_font = [aCoder decodeObjectForKey:@"NSFont"];
_font = [aCoder decodeObjectForKey:@"NSSupport"];
}
return self;
+11 -2
View File
@@ -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