Browse Source

IDE/Workspace: focus SourceArea when switching tabs to Workspace

mkroehnert 11 years ago
parent
commit
22586e8efd
3 changed files with 70 additions and 5 deletions
  1. 24 1
      js/IDE.deploy.js
  2. 36 3
      js/IDE.js
  3. 10 1
      st/IDE.st

+ 24 - 1
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({
@@ -550,7 +561,7 @@ selector: "printIt",
 fn: function (){
 var self=this;
 smalltalk.send(self,"_print_",[smalltalk.send(smalltalk.send(self,"_doIt",[]),"_printString",[])]);
-smalltalk.send(smalltalk.send(self,"_editor",[]),"_focus",[]);
+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(

+ 36 - 3
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({
@@ -731,11 +747,11 @@ category: 'actions',
 fn: function (){
 var self=this;
 smalltalk.send(self,"_print_",[smalltalk.send(smalltalk.send(self,"_doIt",[]),"_printString",[])]);
-smalltalk.send(smalltalk.send(self,"_editor",[]),"_focus",[]);
+smalltalk.send(self,"_focus",[]);
 return self},
 args: [],
-source: "printIt\x0a    self print: self doIt printString.\x0a    self editor focus.",
-messageSends: ["print:", "printString", "doIt", "focus", "editor"],
+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(

+ 10 - 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
@@ -306,7 +310,7 @@ print: aString
 
 printIt
     self print: self doIt printString.
-    self editor focus.
+	self focus.
 ! !
 
 !SourceArea methodsFor: 'events'!
@@ -2261,6 +2265,11 @@ inspectIt
 
 printIt
 	sourceArea printIt
+!
+
+show
+	super show.
+	sourceArea focus.
 ! !
 
 !Workspace methodsFor: 'rendering'!