diff options
| author | Nathan Dinsmore <queryselector@gmail.com> | 2013-04-21 13:53:39 -0400 |
|---|---|---|
| committer | Nathan Dinsmore <queryselector@gmail.com> | 2013-04-21 14:45:51 -0400 |
| commit | cad54f7433f48a016f3ebc8ae37a6fe75090bcfb (patch) | |
| tree | 024cb87decb2a244b46e6e1fe8869041f4adedd9 /gui.js | |
| parent | 977da0314c01ce8d3cda160cb913e12d4a980f36 (diff) | |
| download | snap-yow-cad54f7433f48a016f3ebc8ae37a6fe75090bcfb.tar.gz snap-yow-cad54f7433f48a016f3ebc8ae37a6fe75090bcfb.zip | |
Fixed #23
Only one of each kind of dialog can now be open at any given time.
You can still open multiple dialogs for editing a costume and editing a block.
Diffstat (limited to 'gui.js')
| -rw-r--r-- | gui.js | 43 |
1 files changed, 22 insertions, 21 deletions
@@ -1679,7 +1679,7 @@ IDE_Morph.prototype.cloudMenu = function () { } else { myself.prompt('Export Project As...', function (name) { myself.exportProjectMedia(name); - }); + }, 'exportProject'); } }, null, @@ -1693,7 +1693,7 @@ IDE_Morph.prototype.cloudMenu = function () { } else { myself.prompt('Export Project As...', function (name) { myself.exportProjectNoMedia(name); - }); + }, 'exportProject'); } }, null, @@ -1707,7 +1707,7 @@ IDE_Morph.prototype.cloudMenu = function () { } else { myself.prompt('Export Project As...', function (name) { myself.exportProjectAsCloudData(name); - }); + }, 'exportProject'); } }, null, @@ -1754,8 +1754,8 @@ IDE_Morph.prototype.cloudMenu = function () { myself.cloudError() ); - }); - }); + }, 'project'); + }, 'project'); }, null, new Color(100, 0, 0) @@ -1996,7 +1996,7 @@ IDE_Morph.prototype.projectMenu = function () { } else { myself.prompt('Export Project As...', function (name) { myself.exportProject(name); - }); + }, 'exportProject'); } }, 'show project data as XML\nin a new browser window', @@ -2181,7 +2181,7 @@ IDE_Morph.prototype.aboutSnap = function () { }; IDE_Morph.prototype.editProjectNotes = function () { - var dialog = new DialogBoxMorph(), + var dialog = new DialogBoxMorph().withKey('projectNotes'), frame = new ScrollFrameMorph(), text = new TextMorph(this.projectNotes || ''), ok = dialog.ok, @@ -2228,7 +2228,7 @@ IDE_Morph.prototype.editProjectNotes = function () { dialog.addButton('cancel', 'Cancel'); dialog.fixLayout(); dialog.drawNew(); - world.add(dialog); + dialog.popUp(world); dialog.setCenter(world.center()); text.edit(); }; @@ -2934,7 +2934,7 @@ IDE_Morph.prototype.userSetBlocksScale = function () { function (num) { myself.setBlocksScale(num); } - ).prompt( + ).withKey('zoomBlocks').prompt( 'Zoom blocks', SyntaxElementMorph.prototype.scale.toString(), this.world(), @@ -3006,7 +3006,7 @@ IDE_Morph.prototype.initializeCloud = function () { myself.cloudError() ); } - ).promptCredentials( + ).withKey('cloud').promptCredentials( 'Sign in', 'login', null, @@ -3047,7 +3047,7 @@ IDE_Morph.prototype.createCloudAccount = function () { myself.cloudError() ); } - ).promptCredentials( + ).withKey('cloud').promptCredentials( 'Sign up', 'signup', 'http://snap.berkeley.edu/tos.html', @@ -3077,7 +3077,7 @@ IDE_Morph.prototype.changeCloudPassword = function () { myself.cloudError() ); } - ).promptCredentials( + ).withKey('cloud').promptCredentials( 'Change Password', 'changePassword', null, @@ -3334,7 +3334,7 @@ IDE_Morph.prototype.setCloudURL = function () { function (url) { SnapCloud.url = url; } - ).prompt( + ).withKey('cloudURL').prompt( 'Cloud URL', SnapCloud.url, this.world(), @@ -3384,8 +3384,8 @@ IDE_Morph.prototype.confirm = function (message, title, action) { ); }; -IDE_Morph.prototype.prompt = function (message, callback, choices) { - (new DialogBoxMorph(null, callback)).prompt( +IDE_Morph.prototype.prompt = function (message, callback, choices, key) { + (new DialogBoxMorph(null, callback)).withKey(key).prompt( message, '', this.world(), @@ -3402,6 +3402,10 @@ ProjectDialogMorph.prototype = new DialogBoxMorph(); ProjectDialogMorph.prototype.constructor = ProjectDialogMorph; ProjectDialogMorph.uber = DialogBoxMorph.prototype; +// ProjectDialogMorph constants: + +ProjectDialogMorph.prototype.key = 'project'; + // ProjectDialogMorph instance creation: function ProjectDialogMorph(ide, label) { @@ -3584,8 +3588,7 @@ ProjectDialogMorph.prototype.buildContents = function () { ProjectDialogMorph.prototype.popUp = function (wrrld) { var world = wrrld || this.ide.world(); if (world) { - world.add(this); - world.keyboardReceiver = this; + ProjectDialogMorph.uber.popUp.call(this, world); this.handle = new HandleMorph( this, 350, @@ -3593,8 +3596,6 @@ ProjectDialogMorph.prototype.popUp = function (wrrld) { this.corner, this.corner ); - this.setCenter(world.center()); - this.edit(); } }; @@ -4689,7 +4690,7 @@ CostumeIconMorph.prototype.editCostume = function () { CostumeIconMorph.prototype.renameCostume = function () { var costume = this.object, ide = this.parentThatIsA(IDE_Morph); - (new DialogBoxMorph( + new DialogBoxMorph( null, function (answer) { if (answer && (answer !== costume.name)) { @@ -4698,7 +4699,7 @@ CostumeIconMorph.prototype.renameCostume = function () { ide.hasChangedMedia = true; } } - )).prompt( + ).prompt( 'rename costume', costume.name, this.world() |
