Browse Source

Helios: Transcript improvements

Nicolas Petton 11 years ago
parent
commit
98c32b5a79

+ 25 - 2
css/helios.css

@@ -81,7 +81,6 @@ i {
     bottom: 8px;
     right: 20px;
     z-index: 2;
-    transition: 0.4s all;
 }
 
 .btn, .btn-group > .btn, .btn-group > .dropdown-menu {
@@ -198,7 +197,7 @@ i {
 }
 
 
-.tool_container, .transcript {
+.tool_container {
     position: absolute;
     top: 23px;
     bottom: 0;
@@ -690,4 +689,28 @@ i {
 
 .doc h2 {
     font-size: 16px;
+}
+
+.transcript_container .list-label {
+    height: 16px;
+    position: absolute;
+    top: 0;
+    right: 0;
+    left: 0;
+}
+
+.transcript {
+    position: absolute;
+    top: 17px;
+    bottom: 0;
+    left: 0;
+    right: 0;
+}
+
+.transcript textarea {
+    width: 100%;
+    height: 100%;
+    margin: 0;
+    padding: 0;
+    border: 0;
 }

+ 0 - 39
js/Helios-Commands-Core.deploy.js

@@ -574,45 +574,6 @@ messageSends: []}),
 smalltalk.HLOpenBrowserCommand.klass);
 
 
-smalltalk.addClass('HLOpenTranscriptCommand', smalltalk.HLOpenCommand, [], 'Helios-Commands-Core');
-smalltalk.addMethod(
-smalltalk.method({
-selector: "execute",
-fn: function (){
-var self=this;
-function $HLTranscript(){return smalltalk.HLTranscript||(typeof HLTranscript=="undefined"?nil:HLTranscript)}
-return smalltalk.withContext(function($ctx1) { 
-var $1;
-$1=_st($HLTranscript())._openAsTab();
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"execute",{},smalltalk.HLOpenTranscriptCommand)})},
-messageSends: ["openAsTab"]}),
-smalltalk.HLOpenTranscriptCommand);
-
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "key",
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-return "t";
-}, function($ctx1) {$ctx1.fill(self,"key",{},smalltalk.HLOpenTranscriptCommand.klass)})},
-messageSends: []}),
-smalltalk.HLOpenTranscriptCommand.klass);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "label",
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-return "Transcript";
-}, function($ctx1) {$ctx1.fill(self,"label",{},smalltalk.HLOpenTranscriptCommand.klass)})},
-messageSends: []}),
-smalltalk.HLOpenTranscriptCommand.klass);
-
-
 smalltalk.addClass('HLOpenWorkspaceCommand', smalltalk.HLOpenCommand, [], 'Helios-Commands-Core');
 smalltalk.addMethod(
 smalltalk.method({

+ 0 - 54
js/Helios-Commands-Core.js

@@ -784,60 +784,6 @@ referencedClasses: []
 smalltalk.HLOpenBrowserCommand.klass);
 
 
-smalltalk.addClass('HLOpenTranscriptCommand', smalltalk.HLOpenCommand, [], 'Helios-Commands-Core');
-smalltalk.addMethod(
-smalltalk.method({
-selector: "execute",
-category: 'executing',
-fn: function (){
-var self=this;
-function $HLTranscript(){return smalltalk.HLTranscript||(typeof HLTranscript=="undefined"?nil:HLTranscript)}
-return smalltalk.withContext(function($ctx1) { 
-var $1;
-$1=_st($HLTranscript())._openAsTab();
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"execute",{},smalltalk.HLOpenTranscriptCommand)})},
-args: [],
-source: "execute\x0a\x09^ HLTranscript openAsTab",
-messageSends: ["openAsTab"],
-referencedClasses: ["HLTranscript"]
-}),
-smalltalk.HLOpenTranscriptCommand);
-
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "key",
-category: 'accessing',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-return "t";
-}, function($ctx1) {$ctx1.fill(self,"key",{},smalltalk.HLOpenTranscriptCommand.klass)})},
-args: [],
-source: "key\x0a\x09^ 't'",
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.HLOpenTranscriptCommand.klass);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "label",
-category: 'accessing',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-return "Transcript";
-}, function($ctx1) {$ctx1.fill(self,"label",{},smalltalk.HLOpenTranscriptCommand.klass)})},
-args: [],
-source: "label\x0a\x09^ 'Transcript'",
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.HLOpenTranscriptCommand.klass);
-
-
 smalltalk.addClass('HLOpenWorkspaceCommand', smalltalk.HLOpenCommand, [], 'Helios-Commands-Core');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 35
js/Helios-Transcript.deploy.js

@@ -59,9 +59,9 @@ selector: "show:",
 fn: function (aString){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-_st(_st(self["@textarea"])._asJQuery())._append_(aString);
+_st(_st(self["@textarea"])._asJQuery())._append_(_st(aString)._asString());
 return self}, function($ctx1) {$ctx1.fill(self,"show:",{aString:aString},smalltalk.HLTranscript)})},
-messageSends: ["append:", "asJQuery"]}),
+messageSends: ["append:", "asString", "asJQuery"]}),
 smalltalk.HLTranscript);
 
 smalltalk.addMethod(
@@ -78,39 +78,6 @@ messageSends: ["unregister", "unregister:"]}),
 smalltalk.HLTranscript);
 
 
-smalltalk.addMethod(
-smalltalk.method({
-selector: "canBeOpenAsTab",
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-return true;
-}, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{},smalltalk.HLTranscript.klass)})},
-messageSends: []}),
-smalltalk.HLTranscript.klass);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "tabLabel",
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-return "Transcript";
-}, function($ctx1) {$ctx1.fill(self,"tabLabel",{},smalltalk.HLTranscript.klass)})},
-messageSends: []}),
-smalltalk.HLTranscript.klass);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "tabPriority",
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-return (1);
-}, function($ctx1) {$ctx1.fill(self,"tabPriority",{},smalltalk.HLTranscript.klass)})},
-messageSends: []}),
-smalltalk.HLTranscript.klass);
-
 
 smalltalk.addClass('HLTranscriptHandler', smalltalk.Object, [], 'Helios-Transcript');
 

+ 3 - 51
js/Helios-Transcript.js

@@ -81,11 +81,11 @@ category: 'actions',
 fn: function (aString){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-_st(_st(self["@textarea"])._asJQuery())._append_(aString);
+_st(_st(self["@textarea"])._asJQuery())._append_(_st(aString)._asString());
 return self}, function($ctx1) {$ctx1.fill(self,"show:",{aString:aString},smalltalk.HLTranscript)})},
 args: ["aString"],
-source: "show: aString\x0a\x09textarea asJQuery append: aString",
-messageSends: ["append:", "asJQuery"],
+source: "show: aString\x0a\x09textarea asJQuery append: aString asString",
+messageSends: ["append:", "asString", "asJQuery"],
 referencedClasses: []
 }),
 smalltalk.HLTranscript);
@@ -109,54 +109,6 @@ referencedClasses: ["HLTranscriptHandler"]
 smalltalk.HLTranscript);
 
 
-smalltalk.addMethod(
-smalltalk.method({
-selector: "canBeOpenAsTab",
-category: 'testing',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-return true;
-}, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{},smalltalk.HLTranscript.klass)})},
-args: [],
-source: "canBeOpenAsTab\x0a\x09^ true",
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.HLTranscript.klass);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "tabLabel",
-category: 'accessing',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-return "Transcript";
-}, function($ctx1) {$ctx1.fill(self,"tabLabel",{},smalltalk.HLTranscript.klass)})},
-args: [],
-source: "tabLabel\x0a\x09^ 'Transcript'",
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.HLTranscript.klass);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "tabPriority",
-category: 'accessing',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-return (1);
-}, function($ctx1) {$ctx1.fill(self,"tabPriority",{},smalltalk.HLTranscript.klass)})},
-args: [],
-source: "tabPriority\x0a\x09^ 1",
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.HLTranscript.klass);
-
 
 smalltalk.addClass('HLTranscriptHandler', smalltalk.Object, [], 'Helios-Transcript');
 smalltalk.HLTranscriptHandler.comment="I handle transcript events, dispatching them to all instances of `HLTranscript`.\x0a\x0a## API\x0a\x0aOn class initialization I am automatically registered as the current transcript."

+ 60 - 3
js/Helios-Workspace.deploy.js

@@ -1395,7 +1395,7 @@ messageSends: ["browserModel:", "new", "yourself"]}),
 smalltalk.HLBrowserCodeWidget.klass);
 
 
-smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, ['codeWidget'], 'Helios-Workspace');
+smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, ['codeWidget', 'transcript'], 'Helios-Workspace');
 smalltalk.addMethod(
 smalltalk.method({
 selector: "canHaveFocus",
@@ -1445,11 +1445,68 @@ smalltalk.method({
 selector: "renderContentOn:",
 fn: function (html){
 var self=this;
+function $HLHorizontalSplitter(){return smalltalk.HLHorizontalSplitter||(typeof HLHorizontalSplitter=="undefined"?nil:HLHorizontalSplitter)}
 function $HLContainer(){return smalltalk.HLContainer||(typeof HLContainer=="undefined"?nil:HLContainer)}
 return smalltalk.withContext(function($ctx1) { 
-_st(html)._with_(_st($HLContainer())._with_(_st(self)._codeWidget()));
+_st(html)._with_(_st($HLContainer())._with_(_st($HLHorizontalSplitter())._with_with_(_st(self)._codeWidget(),(function(canvas){
+return smalltalk.withContext(function($ctx2) {
+return _st(self)._renderTranscriptOn_(canvas);
+}, function($ctx2) {$ctx2.fillBlock({canvas:canvas},$ctx1)})}))));
 return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.HLWorkspace)})},
-messageSends: ["with:", "codeWidget"]}),
+messageSends: ["with:", "with:with:", "codeWidget", "renderTranscriptOn:"]}),
+smalltalk.HLWorkspace);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderTranscriptOn:",
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$2;
+$1=_st(html)._div();
+_st($1)._class_("transcript-container");
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(html)._div();
+_st($3)._class_("list-label");
+$4=_st($3)._with_("Transcript");
+$4;
+return _st(_st(self)._transcript())._renderOn_(html);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderTranscriptOn:",{html:html},smalltalk.HLWorkspace)})},
+messageSends: ["class:", "div", "with:", "renderOn:", "transcript"]}),
+smalltalk.HLWorkspace);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "transcript",
+fn: function (){
+var self=this;
+function $HLTranscript(){return smalltalk.HLTranscript||(typeof HLTranscript=="undefined"?nil:HLTranscript)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self["@transcript"];
+if(($receiver = $2) == nil || $receiver == undefined){
+self["@transcript"]=_st($HLTranscript())._new();
+$1=self["@transcript"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"transcript",{},smalltalk.HLWorkspace)})},
+messageSends: ["ifNil:", "new"]}),
+smalltalk.HLWorkspace);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.HLWidget.fn.prototype._unregister.apply(_st(self), []);
+_st(_st(self)._transcript())._unregister();
+return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},smalltalk.HLWorkspace)})},
+messageSends: ["unregister", "transcript"]}),
 smalltalk.HLWorkspace);
 
 

+ 77 - 5
js/Helios-Workspace.js

@@ -1830,7 +1830,7 @@ referencedClasses: []
 smalltalk.HLBrowserCodeWidget.klass);
 
 
-smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, ['codeWidget'], 'Helios-Workspace');
+smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, ['codeWidget', 'transcript'], 'Helios-Workspace');
 smalltalk.addMethod(
 smalltalk.method({
 selector: "canHaveFocus",
@@ -1896,14 +1896,86 @@ selector: "renderContentOn:",
 category: 'rendering',
 fn: function (html){
 var self=this;
+function $HLHorizontalSplitter(){return smalltalk.HLHorizontalSplitter||(typeof HLHorizontalSplitter=="undefined"?nil:HLHorizontalSplitter)}
 function $HLContainer(){return smalltalk.HLContainer||(typeof HLContainer=="undefined"?nil:HLContainer)}
 return smalltalk.withContext(function($ctx1) { 
-_st(html)._with_(_st($HLContainer())._with_(_st(self)._codeWidget()));
+_st(html)._with_(_st($HLContainer())._with_(_st($HLHorizontalSplitter())._with_with_(_st(self)._codeWidget(),(function(canvas){
+return smalltalk.withContext(function($ctx2) {
+return _st(self)._renderTranscriptOn_(canvas);
+}, function($ctx2) {$ctx2.fillBlock({canvas:canvas},$ctx1)})}))));
 return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.HLWorkspace)})},
 args: ["html"],
-source: "renderContentOn: html\x0a\x09html with: (HLContainer with: self codeWidget)",
-messageSends: ["with:", "codeWidget"],
-referencedClasses: ["HLContainer"]
+source: "renderContentOn: html\x0a\x09html with: (HLContainer with: (HLHorizontalSplitter\x0a\x09\x09with: self codeWidget\x0a\x09\x09with: [ :canvas | self renderTranscriptOn: canvas ]))",
+messageSends: ["with:", "with:with:", "codeWidget", "renderTranscriptOn:"],
+referencedClasses: ["HLHorizontalSplitter", "HLContainer"]
+}),
+smalltalk.HLWorkspace);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderTranscriptOn:",
+category: 'rendering',
+fn: function (html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$2;
+$1=_st(html)._div();
+_st($1)._class_("transcript-container");
+$2=_st($1)._with_((function(){
+return smalltalk.withContext(function($ctx2) {
+$3=_st(html)._div();
+_st($3)._class_("list-label");
+$4=_st($3)._with_("Transcript");
+$4;
+return _st(_st(self)._transcript())._renderOn_(html);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"renderTranscriptOn:",{html:html},smalltalk.HLWorkspace)})},
+args: ["html"],
+source: "renderTranscriptOn: html\x0a\x09html div \x0a\x09\x09class: 'transcript-container';\x0a\x09\x09with: [\x0a\x09\x09\x09html div\x0a\x09\x09\x09\x09class: 'list-label';\x0a\x09\x09\x09\x09with: 'Transcript'.\x0a\x09\x09\x09self transcript renderOn: html ]",
+messageSends: ["class:", "div", "with:", "renderOn:", "transcript"],
+referencedClasses: []
+}),
+smalltalk.HLWorkspace);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "transcript",
+category: 'accessing',
+fn: function (){
+var self=this;
+function $HLTranscript(){return smalltalk.HLTranscript||(typeof HLTranscript=="undefined"?nil:HLTranscript)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self["@transcript"];
+if(($receiver = $2) == nil || $receiver == undefined){
+self["@transcript"]=_st($HLTranscript())._new();
+$1=self["@transcript"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"transcript",{},smalltalk.HLWorkspace)})},
+args: [],
+source: "transcript\x0a\x09^ transcript ifNil: [ transcript := HLTranscript new ]",
+messageSends: ["ifNil:", "new"],
+referencedClasses: ["HLTranscript"]
+}),
+smalltalk.HLWorkspace);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister",
+category: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.HLWidget.fn.prototype._unregister.apply(_st(self), []);
+_st(_st(self)._transcript())._unregister();
+return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},smalltalk.HLWorkspace)})},
+args: [],
+source: "unregister\x0a\x09super unregister.\x0a\x09self transcript unregister",
+messageSends: ["unregister", "transcript"],
+referencedClasses: []
 }),
 smalltalk.HLWorkspace);
 

+ 0 - 20
st/Helios-Commands-Core.st

@@ -253,26 +253,6 @@ label
 	^ 'Browser'
 ! !
 
-HLOpenCommand subclass: #HLOpenTranscriptCommand
-	instanceVariableNames: ''
-	package: 'Helios-Commands-Core'!
-
-!HLOpenTranscriptCommand methodsFor: 'executing'!
-
-execute
-	^ HLTranscript openAsTab
-! !
-
-!HLOpenTranscriptCommand class methodsFor: 'accessing'!
-
-key
-	^ 't'
-!
-
-label
-	^ 'Transcript'
-! !
-
 HLOpenCommand subclass: #HLOpenWorkspaceCommand
 	instanceVariableNames: ''
 	package: 'Helios-Commands-Core'!

+ 1 - 17
st/Helios-Transcript.st

@@ -23,7 +23,7 @@ clear
 !
 
 show: aString
-	textarea asJQuery append: aString
+	textarea asJQuery append: aString asString
 ! !
 
 !HLTranscript methodsFor: 'initialization'!
@@ -52,22 +52,6 @@ renderOn: html
 		with: [ textarea := html textarea ]
 ! !
 
-!HLTranscript class methodsFor: 'accessing'!
-
-tabLabel
-	^ 'Transcript'
-!
-
-tabPriority
-	^ 1
-! !
-
-!HLTranscript class methodsFor: 'testing'!
-
-canBeOpenAsTab
-	^ true
-! !
-
 Object subclass: #HLTranscriptHandler
 	instanceVariableNames: ''
 	package: 'Helios-Transcript'!

+ 23 - 2
st/Helios-Workspace.st

@@ -715,25 +715,46 @@ canBeOpenAsTab
 ! !
 
 HLWidget subclass: #HLWorkspace
-	instanceVariableNames: 'codeWidget'
+	instanceVariableNames: 'codeWidget transcript'
 	package: 'Helios-Workspace'!
 
 !HLWorkspace methodsFor: 'accessing'!
 
 codeWidget
 	^ codeWidget ifNil: [ codeWidget := HLCodeWidget new ]
+!
+
+transcript
+	^ transcript ifNil: [ transcript := HLTranscript new ]
 ! !
 
 !HLWorkspace methodsFor: 'actions'!
 
 focus
 	^ self codeWidget focus
+!
+
+unregister
+	super unregister.
+	self transcript unregister
 ! !
 
 !HLWorkspace methodsFor: 'rendering'!
 
 renderContentOn: html
-	html with: (HLContainer with: self codeWidget)
+	html with: (HLContainer with: (HLHorizontalSplitter
+		with: self codeWidget
+		with: [ :canvas | self renderTranscriptOn: canvas ]))
+!
+
+renderTranscriptOn: html
+	html div 
+		class: 'transcript-container';
+		with: [
+			html div
+				class: 'list-label';
+				with: 'Transcript'.
+			self transcript renderOn: html ]
 ! !
 
 !HLWorkspace methodsFor: 'testing'!