Updates to make nib2cib work better with CPToolbar (and with image resources in IB in general).

This commit is contained in:
Ross Boucher committed 2010-11-02 20:31:43 -07:00
1 parent f46bbf83a8
commit a45668e7cb
4 files changed
+26 -3

No files matched your search

+1 -1
View File
@@ -972,7 +972,7 @@ var TOP_MARGIN = 5.0,
{
_imageView = [[CPImageView alloc] initWithFrame:[self bounds]];
[_imageView setImageScaling:CPScaleNone];
[_imageView setImageScaling:CPScaleProportionally];
[self addSubview:_imageView];
}
+3
View File
@@ -50,6 +50,9 @@ var FILE = require("file");
CPLog.warn("*** WARNING: Resource named " + _resourceName + " not found in supplied resources path.");
else
size = imageSize(FILE.join(FILE.cwd(), resourcePath));
if (resourcePath && FILE.basename(resourcePath) !== FILE.basename(_resourceName))
_resourceName = (_resourceName.indexOf("/") === -1 ? "" : FILE.dirname(_resourceName)) + FILE.basename(resourcePath);
}
_properties = [CPDictionary dictionaryWithObject:size forKey:@"size"];
+8 -1
View File
@@ -59,7 +59,14 @@ NS_CPToolbarItemIdentifierMap =
[self setAction:CPSelectorFromString([aCoder decodeObjectForKey:@"NSToolbarItemAction"])];
[self setEnabled:[aCoder decodeBoolForKey:@"NSToolbarItemEnabled"]];
[self setImage:[aCoder decodeBoolForKey:@"NSToolbarItemImage"]];
var image = [aCoder decodeObjectForKey:@"NSToolbarItemImage"];
[self setImage:[aCoder decodeObjectForKey:@"NSToolbarItemImage"]];
//FIXME: we shouldn't let toolbars have images which are too big at all
if (_maxSize.height > 0)
_maxSize.height = MIN(_maxSize.height, 32.0);
if (_minSize.height > 0)
_minSize.height = MIN(_minSize.height, 32.0);
[self setView:[aCoder decodeObjectForKey:@"NSToolbarItemView"]];
+14 -1
View File
@@ -65,8 +65,21 @@ var File = require("file");
if (File.basename(path) === aName)
return path;
if (File.isDirectory(path))
else if (File.isDirectory(path))
pathGroups.push(File.listPaths(path));
else if (!File.extension(aName))
{
var extensions = ["png", "gif", "jpg", "jpeg", "cib"],
extensionCount = extensions.length,
extension;
while(extensionCount--)
{
if (File.basename(path) === aName+"."+extensions[extensionCount])
return path;
}
}
}
}