Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Enable image viewer for .ico files
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Gerber committed Mar 14, 2014
1 parent db59b6f commit d19f266
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/editor/ImageViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ define(function (require, exports, module) {
ProjectManager = require("project/ProjectManager"),
Strings = require("strings"),
StringUtils = require("utils/StringUtils"),
FileSystem = require("filesystem/FileSystem");
FileSystem = require("filesystem/FileSystem"),
FileUtils = require("file/FileUtils");

var _naturalWidth = 0,
_scale = 100,
Expand Down Expand Up @@ -312,7 +313,11 @@ define(function (require, exports, module) {
$("#img-preview").on("load", function () {
// add dimensions and size
_naturalWidth = this.naturalWidth;
var ext = FileUtils.getFileExtension(fullPath);
var dimensionString = _naturalWidth + " × " + this.naturalHeight + " " + Strings.UNIT_PIXELS;
if (ext === "ico") {
dimensionString += " (" + Strings.IMAGE_VIEWER_LARGEST_ICON + ")";
}
// get image size
var file = FileSystem.getFileForPath(fullPath);
var minimumPixels = 20; // for showing crosshair cursor
Expand Down
2 changes: 1 addition & 1 deletion src/language/languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@

"image": {
"name": "Image",
"fileExtensions": ["gif", "png", "jpe", "jpeg", "jpg"],
"fileExtensions": ["gif", "png", "jpe", "jpeg", "jpg", "ico"],
"isBinary": true
},

Expand Down
3 changes: 3 additions & 0 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,9 @@ define({
"INLINE_EDITOR_NO_MATCHES" : "No matches available.",
"CSS_QUICK_EDIT_NO_MATCHES" : "There are no existing CSS rules that match your selection.<br> Click \"New Rule\" to create one.",
"CSS_QUICK_EDIT_NO_STYLESHEETS" : "There are no stylesheets in your project.<br>Create one to add CSS rules.",

// Custom Viewers
"IMAGE_VIEWER_LARGEST_ICON" : "largest",

/**
* Unit names
Expand Down

0 comments on commit d19f266

Please sign in to comment.