Pārlūkot izejas kodu

Merge pull request #234 from mkroehnert/fix-89

IDE/SourceArea: focus editor after >>printIt (fixes #89)
Nicolas Petton 11 gadi atpakaļ
vecāks
revīzija
82334632f9
3 mainītis faili ar 79 papildinājumiem un 13 dzēšanām
  1. 28 5
      js/IDE.deploy.js
  2. 40 7
      js/IDE.js
  3. 11 1
      st/IDE.st

+ 28 - 5
js/IDE.deploy.js

@@ -434,6 +434,17 @@ fn: function () {
 }),
 smalltalk.SourceArea);
 
+smalltalk.addMethod(
+"_focus",
+smalltalk.method({
+selector: "focus",
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self,"_editor",[]),"_focus",[]);
+return self}
+}),
+smalltalk.SourceArea);
+
 smalltalk.addMethod(
 "_handleKeyDown_",
 smalltalk.method({
@@ -547,11 +558,11 @@ smalltalk.addMethod(
 "_printIt",
 smalltalk.method({
 selector: "printIt",
-fn: function () {
-    var self = this;
-    smalltalk.send(self, "_print_", [smalltalk.send(smalltalk.send(self, "_doIt", []), "_printString", [])]);
-    return self;
-}
+fn: function (){
+var self=this;
+smalltalk.send(self,"_print_",[smalltalk.send(smalltalk.send(self,"_doIt",[]),"_printString",[])]);
+smalltalk.send(self,"_focus",[]);
+return self}
 }),
 smalltalk.SourceArea);
 
@@ -4408,6 +4419,18 @@ fn: function (html) {
 }),
 smalltalk.Workspace);
 
+smalltalk.addMethod(
+"_show",
+smalltalk.method({
+selector: "show",
+fn: function (){
+var self=this;
+smalltalk.send(self,"_show",[],smalltalk.TabWidget);
+smalltalk.send(self["@sourceArea"],"_focus",[]);
+return self}
+}),
+smalltalk.Workspace);
+
 
 
 smalltalk.addMethod(

+ 40 - 7
js/IDE.js

@@ -579,6 +579,22 @@ referencedClasses: ["Importer"]
 }),
 smalltalk.SourceArea);
 
+smalltalk.addMethod(
+"_focus",
+smalltalk.method({
+selector: "focus",
+category: 'actions',
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self,"_editor",[]),"_focus",[]);
+return self},
+args: [],
+source: "focus\x0a      self editor focus.",
+messageSends: ["focus", "editor"],
+referencedClasses: []
+}),
+smalltalk.SourceArea);
+
 smalltalk.addMethod(
 "_handleKeyDown_",
 smalltalk.method({
@@ -728,14 +744,14 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "printIt",
 category: 'actions',
-fn: function () {
-    var self = this;
-    smalltalk.send(self, "_print_", [smalltalk.send(smalltalk.send(self, "_doIt", []), "_printString", [])]);
-    return self;
-},
+fn: function (){
+var self=this;
+smalltalk.send(self,"_print_",[smalltalk.send(smalltalk.send(self,"_doIt",[]),"_printString",[])]);
+smalltalk.send(self,"_focus",[]);
+return self},
 args: [],
-source: "printIt\x0a    self print: self doIt printString",
-messageSends: ["print:", "printString", "doIt"],
+source: "printIt\x0a    self print: self doIt printString.\x0a\x09self focus.",
+messageSends: ["print:", "printString", "doIt", "focus"],
 referencedClasses: []
 }),
 smalltalk.SourceArea);
@@ -5808,6 +5824,23 @@ referencedClasses: []
 }),
 smalltalk.Workspace);
 
+smalltalk.addMethod(
+"_show",
+smalltalk.method({
+selector: "show",
+category: 'actions',
+fn: function (){
+var self=this;
+smalltalk.send(self,"_show",[],smalltalk.TabWidget);
+smalltalk.send(self["@sourceArea"],"_focus",[]);
+return self},
+args: [],
+source: "show\x0a\x09super show.\x0a\x09sourceArea focus.",
+messageSends: ["show", "focus"],
+referencedClasses: []
+}),
+smalltalk.Workspace);
+
 
 
 smalltalk.addMethod(

+ 11 - 1
st/IDE.st

@@ -267,6 +267,10 @@ fileIn
     Importer new import: self currentLineOrSelection readStream
 !
 
+focus
+      self editor focus.
+!
+
 handleKeyDown: anEvent
     <if(anEvent.ctrlKey) {
 		if(anEvent.keyCode === 80) { //ctrl+p
@@ -305,7 +309,8 @@ print: aString
 !
 
 printIt
-    self print: self doIt printString
+    self print: self doIt printString.
+	self focus.
 ! !
 
 !SourceArea methodsFor: 'events'!
@@ -2260,6 +2265,11 @@ inspectIt
 
 printIt
 	sourceArea printIt
+!
+
+show
+	super show.
+	sourceArea focus.
 ! !
 
 !Workspace methodsFor: 'rendering'!