added regular "result pic..." entry to reporter block context menu

pull/95/head
jmoenig 2020-06-04 11:16:19 +02:00
rodzic e7ba24b083
commit ffcffd6636
2 zmienionych plików z 14 dodań i 19 usunięć

Wyświetl plik

@ -7,7 +7,7 @@
<script type="text/javascript" src="src/morphic.js?version=2020-06-01"></script> <script type="text/javascript" src="src/morphic.js?version=2020-06-01"></script>
<script type="text/javascript" src="src/symbols.js?version=2020-05-28"></script> <script type="text/javascript" src="src/symbols.js?version=2020-05-28"></script>
<script type="text/javascript" src="src/widgets.js?version=2020-05-06"></script> <script type="text/javascript" src="src/widgets.js?version=2020-05-06"></script>
<script type="text/javascript" src="src/blocks.js?version=2020-05-28"></script> <script type="text/javascript" src="src/blocks.js?version=2020-06-04"></script>
<script type="text/javascript" src="src/threads.js?version=2020-05-30"></script> <script type="text/javascript" src="src/threads.js?version=2020-05-30"></script>
<script type="text/javascript" src="src/objects.js?version=2020-05-18"></script> <script type="text/javascript" src="src/objects.js?version=2020-05-18"></script>
<script type="text/javascript" src="src/gui.js?version=2020-06-01"></script> <script type="text/javascript" src="src/gui.js?version=2020-06-01"></script>

Wyświetl plik

@ -148,7 +148,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2020-May-28'; modules.blocks = '2020-June-04';
var SyntaxElementMorph; var SyntaxElementMorph;
var BlockMorph; var BlockMorph;
@ -2617,12 +2617,12 @@ BlockMorph.prototype.userMenu = function () {
myself = this, myself = this,
shiftClicked = world.currentKey === 16, shiftClicked = world.currentKey === 16,
proc = this.activeProcess(), proc = this.activeProcess(),
top = this.topBlock(),
vNames = proc && proc.context && proc.context.outerContext ? vNames = proc && proc.context && proc.context.outerContext ?
proc.context.outerContext.variables.names() : [], proc.context.outerContext.variables.names() : [],
alternatives, alternatives,
field, field,
rcvr, rcvr;
top;
function addOption(label, toggle, test, onHint, offHint) { function addOption(label, toggle, test, onHint, offHint) {
menu.addItem( menu.addItem(
@ -2661,18 +2661,6 @@ BlockMorph.prototype.userMenu = function () {
"help...", "help...",
'showHelp' 'showHelp'
); );
if (shiftClicked) {
top = this.topBlock();
if (top instanceof ReporterBlockMorph) {
menu.addItem(
"script pic with result...",
() => top.exportResultPic(),
'open a new window\n' +
'with a picture of both\nthis script and its result',
new Color(100, 0, 0)
);
}
}
if (this.isTemplate) { if (this.isTemplate) {
if (this.parent instanceof SyntaxElementMorph) { // in-line if (this.parent instanceof SyntaxElementMorph) { // in-line
if (this.selector === 'reportGetVar') { // script var definition if (this.selector === 'reportGetVar') { // script var definition
@ -2925,13 +2913,21 @@ BlockMorph.prototype.userMenu = function () {
IDE_Morph IDE_Morph
); );
ide.saveCanvasAs( ide.saveCanvasAs(
this.topBlock().scriptPic(), top.scriptPic(),
(ide.projectName || localize('untitled')) + ' ' + (ide.projectName || localize('untitled')) + ' ' +
localize('script pic') localize('script pic')
); );
}, },
'open a new window\nwith a picture of this script' 'open a new window\nwith a picture of this script'
); );
if (top instanceof ReporterBlockMorph) {
menu.addItem(
"result pic...",
() => top.exportResultPic(),
'open a new window\n' +
'with a picture of both\nthis script and its result'
);
}
if (shiftClicked) { if (shiftClicked) {
menu.addItem( menu.addItem(
'download script', 'download script',
@ -2975,7 +2971,6 @@ BlockMorph.prototype.userMenu = function () {
if (this.parent.parentThatIsA(RingMorph)) { if (this.parent.parentThatIsA(RingMorph)) {
menu.addLine(); menu.addLine();
menu.addItem("unringify", 'unringify'); menu.addItem("unringify", 'unringify');
top = this.topBlock();
if (this instanceof ReporterBlockMorph || if (this instanceof ReporterBlockMorph ||
(!(top instanceof HatBlockMorph))) { (!(top instanceof HatBlockMorph))) {
menu.addItem("ringify", 'ringify'); menu.addItem("ringify", 'ringify');
@ -2986,7 +2981,7 @@ BlockMorph.prototype.userMenu = function () {
|| (this.parent instanceof CommandSlotMorph) || (this.parent instanceof CommandSlotMorph)
|| (this instanceof HatBlockMorph) || (this instanceof HatBlockMorph)
|| (this instanceof CommandBlockMorph || (this instanceof CommandBlockMorph
&& (this.topBlock() instanceof HatBlockMorph))) { && (top instanceof HatBlockMorph))) {
return menu; return menu;
} }
menu.addLine(); menu.addLine();