From afe62246d605e97cee16e085a84cf800f678bff9 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Tue, 9 Apr 2013 13:56:09 +0200 Subject: Bold type shared project names in the project dialog --- gui.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'gui.js') diff --git a/gui.js b/gui.js index 1eab70b..6689eaa 100644 --- a/gui.js +++ b/gui.js @@ -3785,7 +3785,13 @@ ProjectDialogMorph.prototype.installCloudProjectList = function (pl) { this.projectList.length > 0 ? function (element) { return element.ProjectName; - } : null + } : null, + [ // format: display shared project names bold + [ + 'bold', + function (proj) {return proj.Public === 'true'; } + ] + ] ); this.fixListFieldItemColors(); @@ -4012,7 +4018,8 @@ ProjectDialogMorph.prototype.deleteProject = function () { ProjectDialogMorph.prototype.shareProject = function () { var myself = this, - proj = this.listField.selected; + proj = this.listField.selected, + entry = this.listField.active; if (proj) { this.ide.confirm( @@ -4028,7 +4035,10 @@ ProjectDialogMorph.prototype.shareProject = function () { function () { SnapCloud.disconnect(); proj.Public = 'true'; - myself.listField.select(proj); + entry.label.isBold = true; + entry.label.drawNew(); + entry.label.changed(); + myself.listField.select(proj, entry); myself.ide.showMessage('shared.', 2); }, myself.ide.cloudError(), @@ -4044,7 +4054,9 @@ ProjectDialogMorph.prototype.shareProject = function () { ProjectDialogMorph.prototype.unshareProject = function () { var myself = this, - proj = this.listField.selected; + proj = this.listField.selected, + entry = this.listField.active; + if (proj) { this.ide.confirm( @@ -4060,7 +4072,10 @@ ProjectDialogMorph.prototype.unshareProject = function () { function () { SnapCloud.disconnect(); proj.Public = 'false'; - myself.listField.select(proj); + entry.label.isBold = false; + entry.label.drawNew(); + entry.label.changed(); + myself.listField.select(proj, entry); myself.ide.showMessage('unshared.', 2); }, myself.ide.cloudError(), -- cgit v1.3.1 From d4d537c186e68790faf22d3eda46e0d154e230fe Mon Sep 17 00:00:00 2001 From: jmoenig Date: Tue, 9 Apr 2013 14:11:32 +0200 Subject: Feedback msg when sharing / unsharing projects --- gui.js | 2 ++ history.txt | 1 + 2 files changed, 3 insertions(+) (limited to 'gui.js') diff --git a/gui.js b/gui.js index 6689eaa..ab7ba56 100644 --- a/gui.js +++ b/gui.js @@ -4028,6 +4028,7 @@ ProjectDialogMorph.prototype.shareProject = function () { ) + '\n"' + proj.ProjectName + '"?', 'Share Project', function () { + myself.ide.showMessage('sharing\nproject...'); SnapCloud.reconnect( function () { SnapCloud.callService( @@ -4065,6 +4066,7 @@ ProjectDialogMorph.prototype.unshareProject = function () { ) + '\n"' + proj.ProjectName + '"?', 'Unshare Project', function () { + myself.ide.showMessage('unsharing\nproject...'); SnapCloud.reconnect( function () { SnapCloud.callService( diff --git a/history.txt b/history.txt index 0fa9047..bdc3b26 100755 --- a/history.txt +++ b/history.txt @@ -1604,3 +1604,4 @@ ______ * Morphic: Formatting options for Triggers and MenuItems (and ListItems): bold, italic * Morphic: ListMorph (items) manipulation capabilites * GUI: display shared project names bold typed in the project dialog +* GUI: Feedback msg when sharing / unsharing projects -- cgit v1.3.1 From e23a6944095008dd4ed811267d05a68d58c46548 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Tue, 9 Apr 2013 15:12:29 +0200 Subject: Hide IDE while opening a shared project for presentation --- gui.js | 12 ++++++++++++ history.txt | 1 + 2 files changed, 13 insertions(+) (limited to 'gui.js') diff --git a/gui.js b/gui.js index ab7ba56..675c51a 100644 --- a/gui.js +++ b/gui.js @@ -143,6 +143,7 @@ IDE_Morph.prototype.init = function (isAutoFill) { this.stageRatio = 1; // for IDE animations, e.g. when zooming this.loadNewProject = false; // flag when starting up translated + this.shield = null; // initialize inherited properties: IDE_Morph.uber.init.call(this); @@ -248,6 +249,11 @@ IDE_Morph.prototype.openIn = function (world) { this.toggleAppMode(true); this.runScripts(); } else if (location.hash.substr(0, 9) === '#present:') { + this.shield = new Morph(); + this.shield.color = this.color; + this.shield.setExtent(this.parent.extent()); + this.parent.add(this.shield); + myself.showMessage('Fetching project\nfrom the cloud...'); SnapCloud.getPublicProject( location.hash.substr(9), @@ -261,6 +267,8 @@ IDE_Morph.prototype.openIn = function (world) { myself.rawOpenCloudDataString(projectData); }, function () { + this.shield.destroy(); + this.shield = null; msg.destroy(); myself.toggleAppMode(true); myself.runScripts(); @@ -3235,6 +3243,10 @@ IDE_Morph.prototype.cloudError = function () { // if none is found, show an error dialog box var response = responseText, explanation = getURL('http://snap.berkeley.edu/cloudmsg.txt'); + if (myself.shield) { + myself.shield.destroy(); + myself.shield = null; + } if (explanation) { myself.showMessage(explanation); return; diff --git a/history.txt b/history.txt index bdc3b26..370ec15 100755 --- a/history.txt +++ b/history.txt @@ -1605,3 +1605,4 @@ ______ * Morphic: ListMorph (items) manipulation capabilites * GUI: display shared project names bold typed in the project dialog * GUI: Feedback msg when sharing / unsharing projects +* GUI: Shield (hide) IDE while opening a shared project for presentation -- cgit v1.3.1 From 74ad2abc66cd2652048de4b7906b1f9f015540e7 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Tue, 9 Apr 2013 18:03:44 +0200 Subject: Support for debugging shared projects --- gui.js | 52 +++++++++++++++++++++++++++++++++++++++++++++++++--- history.txt | 1 + 2 files changed, 50 insertions(+), 3 deletions(-) (limited to 'gui.js') diff --git a/gui.js b/gui.js index 675c51a..3686c3b 100644 --- a/gui.js +++ b/gui.js @@ -267,8 +267,8 @@ IDE_Morph.prototype.openIn = function (world) { myself.rawOpenCloudDataString(projectData); }, function () { - this.shield.destroy(); - this.shield = null; + myself.shield.destroy(); + myself.shield = null; msg.destroy(); myself.toggleAppMode(true); myself.runScripts(); @@ -1694,7 +1694,6 @@ IDE_Morph.prototype.cloudMenu = function () { null, new Color(100, 0, 0) ); - menu.addLine(); menu.addItem( 'export project as cloud data...', function () { @@ -1709,6 +1708,53 @@ IDE_Morph.prototype.cloudMenu = function () { null, new Color(100, 0, 0) ); + menu.addLine(); + menu.addItem( + 'open shared project from cloud...', + function () { + myself.prompt('Author name…', function (usr) { + myself.prompt('Project name...', function (prj) { + var id = 'Username=' + + encodeURIComponent(usr) + + '&ProjectName=' + + encodeURIComponent(prj); + myself.showMessage( + 'Fetching project\nfrom the cloud...' + ); + SnapCloud.getPublicProject( + id, + function (projectData) { + var msg; + if (!Process.prototype.isCatchingErrors) { + window.open( + 'data:text/xml,' + projectData + ); + } + myself.nextSteps([ + function () { + msg = myself.showMessage( + 'Opening project...' + ); + }, + function () { + myself.rawOpenCloudDataString( + projectData + ); + }, + function () { + msg.destroy(); + } + ]); + }, + myself.cloudError() + ); + + }); + }); + }, + null, + new Color(100, 0, 0) + ); } menu.popup(world, pos); }; diff --git a/history.txt b/history.txt index 370ec15..6637ee7 100755 --- a/history.txt +++ b/history.txt @@ -1606,3 +1606,4 @@ ______ * GUI: display shared project names bold typed in the project dialog * GUI: Feedback msg when sharing / unsharing projects * GUI: Shield (hide) IDE while opening a shared project for presentation +* GUI: Support for debugging shared projects -- cgit v1.3.1