Permalink
Browse files

fix document focus after chat/shout window for scapp/qt

  • Loading branch information...
1 parent 172189c commit cf81cbcf583e0c6ccfa325b703e5b41e941f0b58 @cappelnord committed Jan 22, 2012
Showing with 20 additions and 3 deletions.
  1. +9 −2 MandelClock.sc
  2. +10 −0 MandelPlatform.sc
  3. +1 −1 StringInputDialog.sc
View
11 MandelClock.sc
@@ -696,12 +696,19 @@ MandelClock {
}
}
+ pr_sendWindow {|title, func|
+ StringInputDialog.new(title, "Send", {|string|
+ func.value(string);
+ platform.focusCurrentDocument;
+ });
+ }
+
chatWindow {
- StringInputDialog.new("MandelClock Chat", "Send", {|string| this.chat(string);});
+ this.pr_sendWindow("MandelClock Chat", {|string| this.chat(string);});
}
shoutWindow {
- StringInputDialog.new("MandelClock Shout", "Send", {|string| this.shout(string);});
+ this.pr_sendWindow("MandelClock Shout", {|string| this.shout(string);});
}
metro {|pan=0.0, quant=4|
View
10 MandelPlatform.sc
@@ -26,6 +26,10 @@ MandelPlatform : MandelModule {
displayNotification {|title, message|
"This should have been implemented by the platform".postln;
}
+
+ focusCurrentDocument {
+ // don't know if this can apply to other platforms
+ }
}
MandelPlatformLinux : MandelPlatform {
@@ -43,4 +47,10 @@ MandelPlatformOSX : MandelPlatform {
displayNotification {|title, message|
("osascript '" ++ mc.classPath("mcNotify.scpt") ++ "' '" ++ title ++ "' '" ++ message ++ "'").unixCmd(postOutput:false);
}
+
+ focusCurrentDocument {
+ (thisProcess.platform.ideName == "scapp").if { // might make sense for other ides, but can't try
+ Document.current.front;
+ };
+ }
}
View
2 StringInputDialog.sc
@@ -114,8 +114,8 @@ StringInputDialog {
}
doAction {
+ window.close;
function.value(txt.string);
- window.close;
}
close {

0 comments on commit cf81cbc

Please sign in to comment.