mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-28 19:08:50 +00:00
Updates to make nib2cib work better with CPToolbar (and with image resources in IB in general).
This commit is contained in:
1 parent
f46bbf83a8
commit
a45668e7cb
4 files changed
+26
-3
No files matched your search
+1
-1
@@ -972,7 +972,7 @@ var TOP_MARGIN = 5.0,
|
||||
{
|
||||
_imageView = [[CPImageView alloc] initWithFrame:[self bounds]];
|
||||
|
||||
[_imageView setImageScaling:CPScaleNone];
|
||||
[_imageView setImageScaling:CPScaleProportionally];
|
||||
|
||||
[self addSubview:_imageView];
|
||||
}
|
||||
|
||||
@@ -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"];
|
||||
|
||||
@@ -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"]];
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user