Dept. of incomplete documentation: what if BufDelay* needs to be multichannel?
[supercollider.git] / SCClassLibrary / Platform / osx / OSXPlatform.sc
bloba1659b2c87feb97aa982fd46ee1f36d7261c770a
1 OSXPlatform : UnixPlatform
3         var <>preferencesAction;
4         var <>sleepAction, <>wakeAction, <>isSleeping=false;
6         initPlatform {
7                 super.initPlatform;
8                 recordingsDir = "~/Music/SuperCollider Recordings".standardizePath;
9                 this.declareFeature(\unixPipes); // pipes are possible (can't declare in UnixPlatform since IPhonePlatform is unixy yet can't support pipes)
10                 if (Platform.ideName == "scapp") { this.setDeferredTaskInterval(1/60); }
11         }
13         name { ^\osx }
15         startupFiles {
16                 var filename = "startup.rtf";
17                 var deprecated = [this.systemAppSupportDir +/+ filename, this.userAppSupportDir +/+ filename];
18                 Platform.deprecatedStartupFiles(deprecated);
19                 ^(deprecated ++ super.startupFiles)
20         }
22         startup {
23                 Server.program = "exec %/scsynth".format(String.scDir.shellQuote);
25                 if(Platform.ideName == "scapp") {
26                         Document.implementationClass.startup;
27                 };
28                 this.loadStartupFiles;
29                 if(Platform.ideName == "scapp") {
30                         // make server window
31                         Server.internal.makeWindow;
32                         Server.local.makeWindow;
33                 };
34         }
35         shutdown {
36                 HIDDeviceService.releaseDeviceList;
37                 if(Platform.ideName == "scapp"){
38                         CocoaMenuItem.clearCustomItems;
39                 };
40         }
42         // Prefer qt but fall back to cocoa if qt not installed.
43         defaultGUIScheme { if (GUI.get(\qt).notNil) {^\qt} {^\cocoa} }
44         defaultHIDScheme { ^\osx_hid }
46         setDeferredTaskInterval { |interval| _SetDeferredTaskInterval }
48         findHelpFile { | string |
49                 ^string.findHelpFile;
50         }
52         getMouseCoords {
53                 ^this.prGetMouseCoords(Point.new);
54         }
56         prGetMouseCoords {|point|
57                 _Mouse_getCoords
58                 ^this.primitiveFailed
59         }
61         // for now just write syntax colours. Could be other things.
62         writeClientCSS {
63                 var theme, file, string;
64                 theme = Document.theme;
65                 SCDoc.helpTargetDir.mkdir;
66                 file = File.open(SCDoc.helpTargetDir ++ "/frontend.css", "w");
67                 string = ".str { color: %; } /* strings */
68 .kwd { color: %; } /* special values like true, nil.. */
69 .com { color: %; } /* comments */
70 .typ { color: %; } /* class names */
71 .lit { color: %; } /* numbers and character literals */
72 .pun { color: %; } /* punctuation */
73 .pln { color: %; } /* plain text, methods and variable names */
74 .tag { color: %; } /* special variables like super, thisProcess... */
75 .dec { color: %; } /* declarations like var, const... */
76 .atn { color: %; } /* symbols */
77 .atv { color: %; } /* environment vars */".format(
78                         theme.stringColor.hexString,
79                         theme.specialValsColor.hexString,
80                         theme.commentColor.hexString,
81                         theme.classColor.hexString,
82                         theme.numberColor.hexString,
83                         theme.puncColor.hexString,
84                         theme.textColor.hexString,
85                         theme.specialVarsColor.hexString,
86                         theme.declColor.hexString,
87                         theme.symbolColor.hexString,
88                         theme.environColor.hexString
89                 );
90                 file.putString(string);
91                 file.close;
92         }