Cleanup filenames and references to `ide`

dev
Michael Ball 2015-12-01 01:45:58 -08:00
rodzic 888b0b97eb
commit 9490b65270
4 zmienionych plików z 33 dodań i 17 usunięć

Wyświetl plik

@ -1852,7 +1852,11 @@ SyntaxElementMorph.prototype.exportPictureWithResult = function (aBubble) {
ctx.drawImage(scr, 0, pic.height - scr.height);
ctx.drawImage(bub, scr.width + 2, 0);
// request to open pic in new window.
ide.saveCanvasAs(pic, ide.projetName + ' ' + localize('script pic'), true);
ide.saveCanvasAs(
pic,
ide.projetName || localize('Untitled') + ' ' + localize('script pic'),
true
);
};
// SyntaxElementMorph code mapping
@ -2324,7 +2328,8 @@ BlockMorph.prototype.userMenu = function () {
var ide = myself.parentThatIsA(IDE_Morph);
ide.saveCanvasAs(
myself.topBlock().scriptPic(),
ide.projetName + ' ' + localize('script pic'),
ide.projetName || localize('Untitled') + ' ' +
localize('script pic'),
true // request new window
);
},
@ -5415,11 +5420,13 @@ ScriptsMorph.prototype.cleanUp = function () {
ScriptsMorph.prototype.exportScriptsPicture = function () {
var pic = this.scriptsPicture(),
ide = this.parentThatIsA(IDE_Morph);
ide = this.world().children[0];
console.log(this);
if (pic) {
ide.saveCanvasAs(
pic,
ide.projetName + ' ' + localize('script pic'),
ide.projetName || localize('Untitled') + ' ' +
localize('script pic'),
true // request new window
);
}
@ -11098,7 +11105,8 @@ CommentMorph.prototype.userMenu = function () {
var ide = myself.parentThatIsA(IDE_Morph);
ide.saveCanvasAs(
myself.fullImageClassic(),
ide.projetName + ' ' + localize('comment pic'),
ide.projetName || localize('Untitled') + ' ' +
localize('comment pic'),
true // request new window
);
},

10
byob.js
Wyświetl plik

@ -766,10 +766,11 @@ CustomCommandBlockMorph.prototype.userMenu = function () {
menu.addItem(
"script pic...",
function () {
var ide = this.parentThatIsA(IDE_Morph);
var ide = this.world().children[0];
ide.saveCanvasAs(
this.topBlock().scriptPic(),
ide.projectName + ' ' + localize('script pic'),
ide.projectName || localize('Untitled') + ' ' +
localize('script pic'),
true // request opening a new window
);
},
@ -3379,7 +3380,10 @@ BlockExportDialogMorph.prototype.exportBlocks = function () {
+ '">'
+ str
+ '</blocks>';
ide.saveXMLAs(str, ide.projectName + ' ' + localize('blocks'));
ide.saveXMLAs(
str,
ide.projectName || localize('Untitled') + ' ' + localize('blocks')
);
} else {
new DialogBoxMorph().inform(
'Export blocks',

19
gui.js
Wyświetl plik

@ -3099,7 +3099,7 @@ IDE_Morph.prototype.exportSprite = function (sprite) {
+ '">'
+ str
+ '</sprites>';
ide.saveXMLAs(str, sprite.name);
this.saveXMLAs(str, sprite.name);
};
IDE_Morph.prototype.exportScriptsPicture = function () {
@ -3148,7 +3148,7 @@ IDE_Morph.prototype.exportScriptsPicture = function () {
y += padding;
y += each.height;
});
this.saveCanvasAs(pic, this.ProjectName, true);
this.saveCanvasAs(pic, this.projectName || localize('Untitled'), true);
};
IDE_Morph.prototype.exportProjectSummary = function (useDropShadows) {
@ -3690,7 +3690,9 @@ IDE_Morph.prototype.saveFileAs = function (
blobIsSupported = !!new Blob;
} catch (e) {}
if (newWindow) {
if (false) {
//if (newWindow) {
// Blob URIs need a custom URL to be displayed in a new window
if (contents instanceof Blob) {
dataURI = URL.createObjectURL(contents);
} else {
@ -3730,7 +3732,7 @@ IDE_Morph.prototype.saveFileAs = function (
IDE_Morph.prototype.saveCanvasAs = function (canvas, fileName, newWindow) {
// Export a Canvas object as a PNG image
// cavas.toBlob() is only supported in Firefox and IE, but is faster.
// cavas.toBlob() is currently only supported in Firefox and IE
var myself = this;
if (canvas.toBlob) {
canvas.toBlob(function (blob) {
@ -5905,7 +5907,7 @@ SpriteIconMorph.prototype.userMenu = function () {
var ide = myself.parentThatIsA(IDE_Morph);
ide.saveCanvasAs(
myself.object.fullImageClassic(),
this.name,
this.object.name,
true
);
},
@ -6270,9 +6272,10 @@ CostumeIconMorph.prototype.removeCostume = function () {
CostumeIconMorph.prototype.exportCostume = function () {
var ide = this.parentThatIsA(IDE_Morph);
if (this.object instanceof SVG_Costume) {
ide.saveFileAs(this.object.contents.src, 'text/svg', this.name);
} else { // rastered Costume
ide.saveCanvasAs(this.object.contents, this.name, true);
// don't show SVG costumes in a new tab (shows text)
ide.saveFileAs(this.object.contents.src, 'text/svg', this.object.name);
} else { // rasterized Costume
ide.saveCanvasAs(this.object.object.contents, this.object.name, true);
}
};

Wyświetl plik

@ -5739,7 +5739,7 @@ StageMorph.prototype.userMenu = function () {
function () {
ide.saveCanvasAs(
myself.fullImageClassic(),
localize('stage'),
myself.name,
true // open as new window
);
},
@ -7628,6 +7628,7 @@ WatcherMorph.prototype.userMenu = function () {
ide.saveFileAs(
this.currentValue.toString(),
'text/plain;charset=utf-8',
// TODO: Name!
'variable',
false
);