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

Commit

Permalink
Merge pull request #7201 from SAPlayer/image-viewer-ico
Browse files Browse the repository at this point in the history
Enable image viewer for .ico files
  • Loading branch information
RaymondLim committed Mar 19, 2014
2 parents 7e3c330 + d19f266 commit cd86e0f
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 @@ -457,6 +457,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 cd86e0f

Please sign in to comment.