cmake build system: visiblity support for clang
[supercollider.git] / SCClassLibrary / Platform / osx / OSXPlatform.sc
blob5a4ea56d4023dd0b172d0c5bc834fb155c3b67d4
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                 if(Platform.ideName == "scapp"){
24                         Document.implementationClass.startup;
25                         // make server window
26                         Server.internal.makeWindow;
27                         Server.local.makeWindow;
28                 };
29                 this.loadStartupFiles;
30         }
31         shutdown {
32                 HIDDeviceService.releaseDeviceList;
33                 if(Platform.ideName == "scapp"){
34                         CocoaMenuItem.clearCustomItems;
35                 };
36         }
38         // Prefer qt but fall back to cocoa if qt not installed.
39         defaultGUIScheme { if (GUI.get(\qt).notNil) {^\qt} {^\cocoa} }
40         defaultHIDScheme { ^\osx_hid }
42         setDeferredTaskInterval { |interval| _SetDeferredTaskInterval }
44         findHelpFile { | string |
45                 ^string.findHelpFile;
46         }
48         getMouseCoords {
49                 ^this.prGetMouseCoords(Point.new);
50         }
52         prGetMouseCoords {|point|
53                 _Mouse_getCoords
54                 ^this.primitiveFailed
55         }
57         // for now just write syntax colours. Could be other things.
58         writeClientCSS {
59                 var theme, file, string;
60                 theme = Document.theme;
61                 SCDoc.helpTargetDir.mkdir;
62                 file = File.open(SCDoc.helpTargetDir ++ "/frontend.css", "w");
63                 string = ".str { color: %; } /* strings */
64 .kwd { color: %; } /* special values like true, nil.. */
65 .com { color: %; } /* comments */
66 .typ { color: %; } /* class names */
67 .lit { color: %; } /* numbers and character literals */
68 .pun { color: %; } /* punctuation */
69 .pln { color: %; } /* plain text, methods and variable names */
70 .tag { color: %; } /* special variables like super, thisProcess... */
71 .dec { color: %; } /* declarations like var, const... */
72 .atn { color: %; } /* symbols */
73 .atv { color: %; } /* environment vars */".format(
74                         theme.stringColor.hexString,
75                         theme.specialValsColor.hexString,
76                         theme.commentColor.hexString,
77                         theme.classColor.hexString,
78                         theme.numberColor.hexString,
79                         theme.puncColor.hexString,
80                         theme.textColor.hexString,
81                         theme.specialVarsColor.hexString,
82                         theme.declColor.hexString,
83                         theme.symbolColor.hexString,
84                         theme.environColor.hexString
85                 );
86                 file.putString(string);
87                 file.close;
88         }