Browse Source

- Added JSObjectProxy>>doesNotUnderstand:
- Improved IDE's tabs

Nicolas Petton 13 năm trước cách đây
mục cha
commit
69ea8b8cee
6 tập tin đã thay đổi với 75 bổ sung57 xóa
  1. 1 1
      js/IDE.deploy.js
  2. 2 2
      js/IDE.js
  3. 19 12
      js/Kernel.deploy.js
  4. 27 20
      js/Kernel.js
  5. 16 17
      st/IDE.st
  6. 10 5
      st/Kernel.st

+ 1 - 1
js/IDE.deploy.js

@@ -207,7 +207,7 @@ var self=this;
 var li=nil;
 li=smalltalk.send(html, "_li", []);
 (($receiver = smalltalk.send(self['@selectedTab'], "__eq", [aWidget])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(li, "_class_", ["selected"]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(li, "_class_", ["selected"]);})]);
-smalltalk.send(li, "_with_", [(function(){smalltalk.send(smalltalk.send(html, "_span", []), "_class_", ["ltab"]);(function($rec){smalltalk.send($rec, "_class_", ["mtab"]);return smalltalk.send($rec, "_with_", [(function(){(($receiver = smalltalk.send(aWidget, "_canBeClosed", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function($rec){smalltalk.send($rec, "_class_", ["close"]);smalltalk.send($rec, "_with_", ["x"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_closeTab_", [aWidget]);})]);})(smalltalk.send(html, "_span", []));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_class_", ["close"]);smalltalk.send($rec, "_with_", ["x"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_closeTab_", [aWidget]);})]);})(smalltalk.send(html, "_span", []));})]);return (function($rec){smalltalk.send($rec, "_with_", [smalltalk.send(self, "_labelFor_", [aWidget])]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectTab_", [aWidget]);})]);})(smalltalk.send(html, "_span", []));})]);})(smalltalk.send(html, "_span", []));return smalltalk.send(smalltalk.send(html, "_span", []), "_class_", ["rtab"]);})]);
+(function($rec){smalltalk.send($rec, "_with_", [(function(){smalltalk.send(smalltalk.send(html, "_span", []), "_class_", ["ltab"]);(function($rec){smalltalk.send($rec, "_class_", ["mtab"]);return smalltalk.send($rec, "_with_", [(function(){(($receiver = smalltalk.send(aWidget, "_canBeClosed", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function($rec){smalltalk.send($rec, "_class_", ["close"]);smalltalk.send($rec, "_with_", ["x"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_closeTab_", [aWidget]);})]);})(smalltalk.send(html, "_span", []));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_class_", ["close"]);smalltalk.send($rec, "_with_", ["x"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_closeTab_", [aWidget]);})]);})(smalltalk.send(html, "_span", []));})]);return smalltalk.send(smalltalk.send(html, "_span", []), "_with_", [smalltalk.send(self, "_labelFor_", [aWidget])]);})]);})(smalltalk.send(html, "_span", []));return smalltalk.send(smalltalk.send(html, "_span", []), "_class_", ["rtab"]);})]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectTab_", [aWidget]);})]);})(li);
 return self;}
 }),
 smalltalk.TabManager);

+ 2 - 2
js/IDE.js

@@ -288,10 +288,10 @@ var self=this;
 var li=nil;
 li=smalltalk.send(html, "_li", []);
 (($receiver = smalltalk.send(self['@selectedTab'], "__eq", [aWidget])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(li, "_class_", ["selected"]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(li, "_class_", ["selected"]);})]);
-smalltalk.send(li, "_with_", [(function(){smalltalk.send(smalltalk.send(html, "_span", []), "_class_", ["ltab"]);(function($rec){smalltalk.send($rec, "_class_", ["mtab"]);return smalltalk.send($rec, "_with_", [(function(){(($receiver = smalltalk.send(aWidget, "_canBeClosed", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function($rec){smalltalk.send($rec, "_class_", ["close"]);smalltalk.send($rec, "_with_", ["x"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_closeTab_", [aWidget]);})]);})(smalltalk.send(html, "_span", []));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_class_", ["close"]);smalltalk.send($rec, "_with_", ["x"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_closeTab_", [aWidget]);})]);})(smalltalk.send(html, "_span", []));})]);return (function($rec){smalltalk.send($rec, "_with_", [smalltalk.send(self, "_labelFor_", [aWidget])]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectTab_", [aWidget]);})]);})(smalltalk.send(html, "_span", []));})]);})(smalltalk.send(html, "_span", []));return smalltalk.send(smalltalk.send(html, "_span", []), "_class_", ["rtab"]);})]);
+(function($rec){smalltalk.send($rec, "_with_", [(function(){smalltalk.send(smalltalk.send(html, "_span", []), "_class_", ["ltab"]);(function($rec){smalltalk.send($rec, "_class_", ["mtab"]);return smalltalk.send($rec, "_with_", [(function(){(($receiver = smalltalk.send(aWidget, "_canBeClosed", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function($rec){smalltalk.send($rec, "_class_", ["close"]);smalltalk.send($rec, "_with_", ["x"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_closeTab_", [aWidget]);})]);})(smalltalk.send(html, "_span", []));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_class_", ["close"]);smalltalk.send($rec, "_with_", ["x"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_closeTab_", [aWidget]);})]);})(smalltalk.send(html, "_span", []));})]);return smalltalk.send(smalltalk.send(html, "_span", []), "_with_", [smalltalk.send(self, "_labelFor_", [aWidget])]);})]);})(smalltalk.send(html, "_span", []));return smalltalk.send(smalltalk.send(html, "_span", []), "_class_", ["rtab"]);})]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectTab_", [aWidget]);})]);})(li);
 return self;},
 args: ["aWidget", "html"],
-source: unescape('renderTabFor%3A%20aWidget%20on%3A%20html%0A%20%20%20%20%7C%20li%20%7C%0A%20%20%20%20li%20%3A%3D%20html%20li.%0A%20%20%20%20selectedTab%20%3D%20aWidget%20ifTrue%3A%20%5B%0A%09li%20class%3A%20%27selected%27%5D.%0A%20%20%20%20li%20with%3A%20%5B%0A%20%20%20%20%20%20%20%20html%20span%20class%3A%20%27ltab%27.%0A%09html%20span%0A%20%20%20%20%20%09%20%20%20%20class%3A%20%27mtab%27%3B%0A%20%20%20%20%20%20%09%20%20%20%20with%3A%20%5B%0A%20%20%20%20%20%20%20%20%09aWidget%20canBeClosed%20ifTrue%3A%20%5B%0A%09%20%20%20%20%09%09html%20span%20%0A%09%09%09%09class%3A%20%27close%27%3B%0A%09%09%09%09with%3A%20%27x%27%3B%0A%09%09%09onClick%3A%20%5Bself%20closeTab%3A%20aWidget%5D%5D.%0A%09%20%20%20%20%09%09html%20span%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09with%3A%20%28self%20labelFor%3A%20aWidget%29%3B%0A%09%20%20%20%20%09%09%09onClick%3A%20%5Bself%20selectTab%3A%20aWidget%5D%5D.%0A%20%20%20%20%20%20%20%20html%20span%20class%3A%20%27rtab%27%5D.'),
+source: unescape('renderTabFor%3A%20aWidget%20on%3A%20html%0A%09%7C%20li%20%7C%0A%09li%20%3A%3D%20html%20li.%0A%09selectedTab%20%3D%20aWidget%20ifTrue%3A%20%5B%0A%09li%20class%3A%20%27selected%27%5D.%0A%09li%20with%3A%20%5B%0A%09%09html%20span%20class%3A%20%27ltab%27.%0A%09%09html%20span%0A%20%20%20%20%20%09%20%20%20%20%09%09class%3A%20%27mtab%27%3B%0A%20%20%20%20%20%20%09%20%20%20%20%09%09with%3A%20%5B%0A%20%20%20%20%20%20%20%20%09%09%09aWidget%20canBeClosed%20ifTrue%3A%20%5B%0A%09%20%20%20%20%09%09%09%09html%20span%20%0A%09%09%09%09%09%09class%3A%20%27close%27%3B%0A%09%09%09%09%09%09with%3A%20%27x%27%3B%0A%09%09%09%09%09onClick%3A%20%5Bself%20closeTab%3A%20aWidget%5D%5D.%0A%09%20%20%20%20%09%09html%20span%20with%3A%20%28self%20labelFor%3A%20aWidget%29%5D.%0A%20%20%20%20%20%20%20%20%09html%20span%20class%3A%20%27rtab%27%5D%3B%0A%09onClick%3A%20%5Bself%20selectTab%3A%20aWidget%5D'),
 messageSends: ["li", "ifTrue:", unescape("%3D"), "class:", "with:", "span", "canBeClosed", "onClick:", "closeTab:", "labelFor:", "selectTab:"],
 referencedClasses: []
 }),

+ 19 - 12
js/Kernel.deploy.js

@@ -5454,18 +5454,7 @@ smalltalk.method({
 selector: 'current',
 fn: function (){
 var self=this;
-return self['@current'];
-return self;}
-}),
-smalltalk.ErrorHandler.klass);
-
-smalltalk.addMethod(
-'_initialize',
-smalltalk.method({
-selector: 'initialize',
-fn: function (){
-var self=this;
-smalltalk.send(self, "_register", []);
+return (($receiver = self['@current']) == nil || $receiver == undefined) ? (function(){return self['@current']=smalltalk.send(self, "_new", []);})() : $receiver;
 return self;}
 }),
 smalltalk.ErrorHandler.klass);
@@ -5545,6 +5534,24 @@ return self;}
 }),
 smalltalk.JSObjectProxy);
 
+smalltalk.addMethod(
+'_doesNotUnderstand_',
+smalltalk.method({
+selector: 'doesNotUnderstand:',
+fn: function (aMessage){
+var self=this;
+var obj=nil;
+var selector=nil;
+var arguments=nil;
+obj=smalltalk.send(self, "_jsObject", []);
+selector=smalltalk.send(aMessage, "_selector", []);
+arguments=smalltalk.send(aMessage, "_arguments", []);
+if(obj[selector]) {return smalltalk.send(obj, selector, arguments)};
+smalltalk.send(self, "_doesNotUnderstand_", [aMessage], smalltalk.Object);
+return self;}
+}),
+smalltalk.JSObjectProxy);
+
 
 smalltalk.addMethod(
 '_on_',

+ 27 - 20
js/Kernel.js

@@ -4049,7 +4049,7 @@ return self;},
 args: [],
 source: unescape('asSet%0A%09%5ESet%20withAll%3A%20self'),
 messageSends: ["withAll:"],
-referencedClasses: [smalltalk.Set]
+referencedClasses: [smalltalk.nil]
 }),
 smalltalk.Collection);
 
@@ -7771,27 +7771,11 @@ selector: 'current',
 category: 'accessing',
 fn: function (){
 var self=this;
-return self['@current'];
-return self;},
-args: [],
-source: unescape('current%0A%09%5Ecurrent'),
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.ErrorHandler.klass);
-
-smalltalk.addMethod(
-'_initialize',
-smalltalk.method({
-selector: 'initialize',
-category: 'initialization',
-fn: function (){
-var self=this;
-smalltalk.send(self, "_register", []);
+return (($receiver = self['@current']) == nil || $receiver == undefined) ? (function(){return self['@current']=smalltalk.send(self, "_new", []);})() : $receiver;
 return self;},
 args: [],
-source: unescape('initialize%0A%09self%20register'),
-messageSends: ["register"],
+source: unescape('current%0A%09%5Ecurrent%20ifNil%3A%20%5Bcurrent%20%3A%3D%20self%20new%5D'),
+messageSends: ["ifNil:", "new"],
 referencedClasses: []
 }),
 smalltalk.ErrorHandler.klass);
@@ -7901,6 +7885,29 @@ referencedClasses: [smalltalk.Dictionary]
 }),
 smalltalk.JSObjectProxy);
 
+smalltalk.addMethod(
+'_doesNotUnderstand_',
+smalltalk.method({
+selector: 'doesNotUnderstand:',
+category: 'proxy',
+fn: function (aMessage){
+var self=this;
+var obj=nil;
+var selector=nil;
+var arguments=nil;
+obj=smalltalk.send(self, "_jsObject", []);
+selector=smalltalk.send(aMessage, "_selector", []);
+arguments=smalltalk.send(aMessage, "_arguments", []);
+if(obj[selector]) {return smalltalk.send(obj, selector, arguments)};
+smalltalk.send(self, "_doesNotUnderstand_", [aMessage], smalltalk.Object);
+return self;},
+args: ["aMessage"],
+source: unescape('doesNotUnderstand%3A%20aMessage%0A%09%7C%20obj%20selector%20arguments%20%7C%0A%09obj%20%3A%3D%20self%20jsObject.%0A%09selector%20%3A%3D%20aMessage%20selector.%0A%09arguments%20%3A%3D%20aMessage%20arguments.%0A%09%3Cif%28obj%5Bselector%5D%29%20%7Breturn%20smalltalk.send%28obj%2C%20selector%2C%20arguments%29%7D%3E.%0A%09super%20doesNotUnderstand%3A%20aMessage'),
+messageSends: ["jsObject", "selector", "arguments", "doesNotUnderstand:"],
+referencedClasses: []
+}),
+smalltalk.JSObjectProxy);
+
 
 smalltalk.addMethod(
 '_on_',

+ 16 - 17
st/IDE.st

@@ -140,24 +140,23 @@ renderOn: html
 !
 
 renderTabFor: aWidget on: html
-    | li |
-    li := html li.
-    selectedTab = aWidget ifTrue: [
+	| li |
+	li := html li.
+	selectedTab = aWidget ifTrue: [
 	li class: 'selected'].
-    li with: [
-        html span class: 'ltab'.
-	html span
-     	    class: 'mtab';
-      	    with: [
-        	aWidget canBeClosed ifTrue: [
-	    		html span 
-				class: 'close';
-				with: 'x';
-			onClick: [self closeTab: aWidget]].
-	    		html span
-              			with: (self labelFor: aWidget);
-	    			onClick: [self selectTab: aWidget]].
-        html span class: 'rtab'].
+	li with: [
+		html span class: 'ltab'.
+		html span
+     	    		class: 'mtab';
+      	    		with: [
+        			aWidget canBeClosed ifTrue: [
+	    				html span 
+						class: 'close';
+						with: 'x';
+					onClick: [self closeTab: aWidget]].
+	    		html span with: (self labelFor: aWidget)].
+        	html span class: 'rtab'];
+	onClick: [self selectTab: aWidget]
 !
 
 renderTabs

+ 10 - 5
st/Kernel.st

@@ -2691,7 +2691,7 @@ ErrorHandler class instanceVariableNames: 'current'!
 !ErrorHandler class methodsFor: 'accessing'!
 
 current
-	^current
+	^current ifNil: [current := self new]
 !
 
 setCurrent: anHandler
@@ -2700,10 +2700,6 @@ setCurrent: anHandler
 
 !ErrorHandler class methodsFor: 'initialization'!
 
-initialize
-	self register
-!
-
 register
 	ErrorHandler setCurrent: self new
 ! !
@@ -2737,6 +2733,15 @@ inspectOn: anInspector
 		variables._at_put_(i, self['@jsObject'][i]);
 	}>.
 	anInspector setVariables: variables
+!
+
+doesNotUnderstand: aMessage
+	| obj selector arguments |
+	obj := self jsObject.
+	selector := aMessage selector.
+	arguments := aMessage arguments.
+	<if(obj[selector]) {return smalltalk.send(obj, selector, arguments)}>.
+	super doesNotUnderstand: aMessage
 ! !
 
 !JSObjectProxy class methodsFor: 'instance creation'!