From b59f7f3e274688a4c70df6e9a16f02d88005a381 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Thu, 4 Jul 2013 15:31:05 +0200 Subject: Codification (blocks to text) support complete text code mapping and block header support, both via GUI and primitives, for built-in blocks and for custom ones. --- widgets.js | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'widgets.js') diff --git a/widgets.js b/widgets.js index 7d12549..45ef2d1 100644 --- a/widgets.js +++ b/widgets.js @@ -74,7 +74,7 @@ HTMLCanvasElement, fontHeight, SymbolMorph, localize, SpeechBubbleMorph, ArrowMorph, MenuMorph, isString, isNil, SliderMorph, MorphicPreferences, ScrollFrameMorph*/ -modules.widgets = '2013-June-25'; +modules.widgets = '2013-July-04'; var PushButtonMorph; var ToggleButtonMorph; @@ -1680,16 +1680,33 @@ DialogBoxMorph.prototype.promptCode = function ( title, defaultString, world, - pic + pic, + instructions ) { var frame = new ScrollFrameMorph(), text = new TextMorph(defaultString || ''), + bdy = new AlignmentMorph('column', this.padding), size = pic ? Math.max(pic.width, 400) : 400; this.getInput = function () { return text.text; }; + function remarkText(string) { + return new TextMorph( + string, + 10, + null, // style + false, // bold + null, // italic + null, // alignment + null, // width + null, // font name + MorphicPreferences.isFlat ? null : new Point(1, 1), + new Color(255, 255, 255) // shadowColor + ); + } + frame.padding = 6; frame.setWidth(size); frame.acceptsDrops = false; @@ -1723,8 +1740,17 @@ DialogBoxMorph.prototype.promptCode = function ( this.key = 'promptCode' + title + defaultString; } - this.addBody(frame); + bdy.setColor(this.color); + bdy.add(frame); + if (instructions) { + bdy.add(remarkText(instructions)); + } + bdy.fixLayout(); + + this.addBody(bdy); frame.drawNew(); + bdy.drawNew(); + this.addButton('ok', 'OK'); this.addButton('cancel', 'Cancel'); this.fixLayout(); -- cgit v1.3.1