2
0
Pārlūkot izejas kodu

- Remove old methods with modules in Kernel
- New button "new class" in the browser
- Css fix for packages buttons

Nicolas Petton 13 gadi atpakaļ
vecāks
revīzija
5b55e07964
7 mainītis faili ar 66 papildinājumiem un 142 dzēšanām
  1. 1 22
      css/amber.css
  2. 3 2
      js/IDE.deploy.js
  3. 7 6
      js/IDE.js
  4. 1 25
      js/Kernel.deploy.js
  5. 2 36
      js/Kernel.js
  6. 50 37
      st/IDE.st
  7. 2 14
      st/Kernel.st

+ 1 - 22
css/amber.css

@@ -257,34 +257,13 @@ body.jtalkBody {
     height: 100%;
 }
 
-.jtalkTool .jt_commit {
+.jtalkTool .jt_packagesButtons {
     position: absolute;
     top: 129px;
     left: 0;
     z-index: 1;
 }
 
-.jtalkTool .jt_commit_local {
-    position: absolute;
-    top: 129px;
-    left: 60px;
-    z-index: 1;
-}
-
-.jtalkTool .jt_rename {
-    position: absolute;
-    top: 129px;
-    left: 105px;
-    z-index: 1;
-}
-
-.jtalkTool .jt_delete {
-    position: absolute;
-    top: 129px;
-    left: 165px;
-    z-index: 1;
-}
-
 .jtalkTool .jt_column {
     width: 25%;
     padding: 0;

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3 - 2
js/IDE.deploy.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 7 - 6
js/IDE.js


+ 1 - 25
js/Kernel.deploy.js

@@ -5048,31 +5048,6 @@ return self;}
 }),
 smalltalk.ClassBuilder);
 
-smalltalk.addMethod(
-'_superclass_subclass_instanceVariableNames_module_',
-smalltalk.method({
-selector: 'superclass:subclass:instanceVariableNames:module:',
-fn: function (aClass, aString, aString2, aString3){
-var self=this;
-var newClass=nil;
-newClass=smalltalk.send(self, "_addSubclassOf_named_instanceVariableNames_module_", [aClass, aString, smalltalk.send(self, "_instanceVariableNamesFor_", [aString2]), (($receiver = aString3) == nil || $receiver == undefined) ? (function(){return "unclassified";})() : $receiver]);
-smalltalk.send(self, "_setupClass_", [newClass]);
-return self;}
-}),
-smalltalk.ClassBuilder);
-
-smalltalk.addMethod(
-'_addSubclassOf_named_instanceVariableNames_module_',
-smalltalk.method({
-selector: 'addSubclassOf:named:instanceVariableNames:module:',
-fn: function (aClass, aString, aCollection, moduleName){
-var self=this;
-smalltalk.addClass(aString, aClass, aCollection, moduleName);
-	    return smalltalk[aString];
-return self;}
-}),
-smalltalk.ClassBuilder);
-
 smalltalk.addMethod(
 '_superclass_subclass_instanceVariableNames_package_',
 smalltalk.method({
@@ -5082,6 +5057,7 @@ var self=this;
 var newClass=nil;
 newClass=smalltalk.send(self, "_addSubclassOf_named_instanceVariableNames_package_", [aClass, aString, smalltalk.send(self, "_instanceVariableNamesFor_", [aString2]), (($receiver = aString3) == nil || $receiver == undefined) ? (function(){return "unclassified";})() : $receiver]);
 smalltalk.send(self, "_setupClass_", [newClass]);
+return newClass;
 return self;}
 }),
 smalltalk.ClassBuilder);

+ 2 - 36
js/Kernel.js

@@ -7190,41 +7190,6 @@ referencedClasses: []
 }),
 smalltalk.ClassBuilder);
 
-smalltalk.addMethod(
-unescape('_superclass_subclass_instanceVariableNames_module_'),
-smalltalk.method({
-selector: unescape('superclass%3Asubclass%3AinstanceVariableNames%3Amodule%3A'),
-category: 'class creation',
-fn: function (aClass, aString, aString2, aString3){
-var self=this;
-var newClass=nil;
-newClass=smalltalk.send(self, "_addSubclassOf_named_instanceVariableNames_module_", [aClass, aString, smalltalk.send(self, "_instanceVariableNamesFor_", [aString2]), (($receiver = aString3) == nil || $receiver == undefined) ? (function(){return "unclassified";})() : $receiver]);
-smalltalk.send(self, "_setupClass_", [newClass]);
-return self;},
-args: ["aClass", "aString", "aString2", "aString3"],
-source: unescape('superclass%3A%20aClass%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20module%3A%20aString3%0A%09%7C%20newClass%20%7C%0A%09newClass%20%3A%3D%20self%20addSubclassOf%3A%20aClass%0A%09%09%09%09named%3A%20aString%20instanceVariableNames%3A%20%28self%20instanceVariableNamesFor%3A%20aString2%29%0A%09%09%09%09module%3A%20%28aString3%20ifNil%3A%20%5B%27unclassified%27%5D%29.%0A%09self%20setupClass%3A%20newClass'),
-messageSends: ["addSubclassOf:named:instanceVariableNames:module:", "instanceVariableNamesFor:", "ifNil:", "setupClass:"],
-referencedClasses: []
-}),
-smalltalk.ClassBuilder);
-
-smalltalk.addMethod(
-unescape('_addSubclassOf_named_instanceVariableNames_module_'),
-smalltalk.method({
-selector: unescape('addSubclassOf%3Anamed%3AinstanceVariableNames%3Amodule%3A'),
-category: 'private',
-fn: function (aClass, aString, aCollection, moduleName){
-var self=this;
-smalltalk.addClass(aString, aClass, aCollection, moduleName);
-	    return smalltalk[aString];
-return self;},
-args: ["aClass", "aString", "aCollection", "moduleName"],
-source: unescape('addSubclassOf%3A%20aClass%20named%3A%20aString%20instanceVariableNames%3A%20aCollection%20module%3A%20moduleName%0A%09%3Csmalltalk.addClass%28aString%2C%20aClass%2C%20aCollection%2C%20moduleName%29%3B%0A%09%20%20%20%20return%20smalltalk%5BaString%5D%3E'),
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.ClassBuilder);
-
 smalltalk.addMethod(
 unescape('_superclass_subclass_instanceVariableNames_package_'),
 smalltalk.method({
@@ -7235,9 +7200,10 @@ var self=this;
 var newClass=nil;
 newClass=smalltalk.send(self, "_addSubclassOf_named_instanceVariableNames_package_", [aClass, aString, smalltalk.send(self, "_instanceVariableNamesFor_", [aString2]), (($receiver = aString3) == nil || $receiver == undefined) ? (function(){return "unclassified";})() : $receiver]);
 smalltalk.send(self, "_setupClass_", [newClass]);
+return newClass;
 return self;},
 args: ["aClass", "aString", "aString2", "aString3"],
-source: unescape('superclass%3A%20aClass%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20package%3A%20aString3%0A%09%7C%20newClass%20%7C%0A%09newClass%20%3A%3D%20self%20addSubclassOf%3A%20aClass%0A%09%09%09%09named%3A%20aString%20instanceVariableNames%3A%20%28self%20instanceVariableNamesFor%3A%20aString2%29%0A%09%09%09%09package%3A%20%28aString3%20ifNil%3A%20%5B%27unclassified%27%5D%29.%0A%09self%20setupClass%3A%20newClass'),
+source: unescape('superclass%3A%20aClass%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20package%3A%20aString3%0A%09%7C%20newClass%20%7C%0A%09newClass%20%3A%3D%20self%20addSubclassOf%3A%20aClass%0A%09%09%09%09named%3A%20aString%20instanceVariableNames%3A%20%28self%20instanceVariableNamesFor%3A%20aString2%29%0A%09%09%09%09package%3A%20%28aString3%20ifNil%3A%20%5B%27unclassified%27%5D%29.%0A%09self%20setupClass%3A%20newClass.%0A%09%5EnewClass'),
 messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:"],
 referencedClasses: []
 }),

+ 50 - 37
st/IDE.st

@@ -339,7 +339,7 @@ renderButtonsOn: html
 ! !
 
 TabWidget subclass: #Browser
-	instanceVariableNames: 'selectedPackage selectedClass selectedProtocol selectedMethod commitButton packagesList classesList protocolsList methodsList sourceArea tabsList selectedTab saveButton classButtons methodButtons unsavedChanges renameButton deleteButton commitLocalButton'
+	instanceVariableNames: 'selectedPackage selectedClass selectedProtocol selectedMethod packagesList classesList protocolsList methodsList sourceArea tabsList selectedTab saveButton classButtons methodButtons unsavedChanges'
 	category: 'IDE'!
 
 !Browser methodsFor: 'accessing'!
@@ -555,7 +555,8 @@ compileDefinition
     self 
 	resetClassesList;
 	updateCategoriesList;
-	updateClassesList
+	updateClassesList.
+    self selectClass: newClass
 !
 
 cancelChanges
@@ -657,7 +658,7 @@ selectTab: aString
 renameClass
     | newName |
     newName := self prompt: 'Rename class ', selectedClass name.
-    newName notEmpty ifTrue: [
+    (newName notNil and: [newName notEmpty]) ifTrue: [
 	selectedClass rename: newName.
 	self 
 		updateClassesList;
@@ -748,6 +749,17 @@ commitPackageToLocalStorage
           	key := 'smalltalk.packages.' , selectedPackage.
 		sourceCode := (Exporter new exportPackage: selectedPackage).
 		<localStorage[key] = sourceCode>]
+!
+
+addNewClass
+	| className |
+	className := self prompt: 'New class'.
+	(className notNil and: [className notEmpty]) ifTrue: [
+		Object subclass: className instanceVariableNames: '' package: self selectedPackage.
+          	 self 
+			resetClassesList;
+			updateClassesList.
+		self selectClass: (Smalltalk current at: className)]
 ! !
 
 !Browser methodsFor: 'initialization'!
@@ -769,40 +781,37 @@ renderBoxOn: html
 !
 
 renderTopPanelOn: html
-    html div 
-	class: 'top'; 
-	with: [
-	    packagesList := html ul class: 'jt_column browser packages'.
-	    commitButton := html button 
-		class: 'jt_commit';
-		title: 'Commit classes in this package to disk';
-		onClick: [self commitPackage];
-		with: 'Commit'.
-            commitLocalButton := html button 
-		class: 'jt_commit_local';
-		title: 'Commit classes in this package to local storage';
-		onClick: [self commitPackageToLocalStorage];
-		with: 'Local'.
-            renameButton := html button 
-		class: 'jt_rename';
-		title: 'Rename package';
-		onClick: [self renamePackage];
-		with: 'Rename'.
-            deleteButton := html button 
-		class: 'jt_delete';
-		title: 'Remove this package from the system';
-		onClick: [self removePackage];
-		with: 'Remove'.
-	    classesList := ClassesList on: self.
-	    classesList renderOn: html.
-	    protocolsList := html ul class: 'jt_column browser protocols'.
-	    methodsList := html ul class: 'jt_column browser methods'.
-	    self
-		updateCategoriesList;
-		updateClassesList;
-		updateProtocolsList;
-		updateMethodsList.
-	    html div class: 'jt_clear']
+	html div 
+		class: 'top'; 
+		with: [
+			packagesList := html ul class: 'jt_column browser packages'.
+          		html div class: 'jt_packagesButtons'; with: [
+				html button 
+					title: 'Commit classes in this package to disk';
+					onClick: [self commitPackage];
+					with: 'Commit'.
+        			html button 
+					title: 'Commit classes in this package to local storage';
+					onClick: [self commitPackageToLocalStorage];
+					with: 'Local'.
+        			html button
+					title: 'Rename package';
+					onClick: [self renamePackage];
+					with: 'Rename'.
+        			html button
+					title: 'Remove this package from the system';
+					onClick: [self removePackage];
+					with: 'Remove'].
+			classesList := ClassesList on: self.
+			classesList renderOn: html.
+			protocolsList := html ul class: 'jt_column browser protocols'.
+			methodsList := html ul class: 'jt_column browser methods'.
+			self
+				updateCategoriesList;
+				updateClassesList;
+				updateProtocolsList;
+				updateMethodsList.
+			html div class: 'jt_clear']
 !
 
 renderTabsOn: html
@@ -930,6 +939,10 @@ updateTabsList
 updateSourceAndButtons
 	self disableSaveButton.
 	classButtons contents: [:html |
+		html button
+			title: 'Create a new class';
+			onClick: [self addNewClass];
+			with: 'New class'.
 		html button
 			with: 'Rename class';
 			onClick: [self renameClass].

+ 2 - 14
st/Kernel.st

@@ -2500,20 +2500,13 @@ class: aClass instanceVariableNames: aString
 	self setupClass: aClass
 !
 
-superclass: aClass subclass: aString instanceVariableNames: aString2 module: aString3
-	| newClass |
-	newClass := self addSubclassOf: aClass
-				named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)
-				module: (aString3 ifNil: ['unclassified']).
-	self setupClass: newClass
-!
-
 superclass: aClass subclass: aString instanceVariableNames: aString2 package: aString3
 	| newClass |
 	newClass := self addSubclassOf: aClass
 				named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)
 				package: (aString3 ifNil: ['unclassified']).
-	self setupClass: newClass
+	self setupClass: newClass.
+	^newClass
 ! !
 
 !ClassBuilder methodsFor: 'private'!
@@ -2531,11 +2524,6 @@ setupClass: aClass
 	<smalltalk.init(aClass);>
 !
 
-addSubclassOf: aClass named: aString instanceVariableNames: aCollection module: moduleName
-	<smalltalk.addClass(aString, aClass, aCollection, moduleName);
-	    return smalltalk[aString]>
-!
-
 addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName
 	<smalltalk.addClass(aString, aClass, aCollection, packageName);
 	    return smalltalk[aString]>

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels