[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] SF.net SVN: supercollider: [6922] trunk/Standalone Resources/SCClassLibrary /DefaultLibrary/Main.sc



Revision: 6922
          http://svn.sourceforge.net/supercollider/?rev=6922&view=rev
Author:   joshpar
Date:     2008-01-10 14:48:40 -0800 (Thu, 10 Jan 2008)

Log Message:
-----------
update for current compat

Modified Paths:
--------------
    trunk/Standalone Resources/SCClassLibrary/DefaultLibrary/Main.sc

Modified: trunk/Standalone Resources/SCClassLibrary/DefaultLibrary/Main.sc
===================================================================
--- trunk/Standalone Resources/SCClassLibrary/DefaultLibrary/Main.sc	2008-01-10 21:55:57 UTC (rev 6921)
+++ trunk/Standalone Resources/SCClassLibrary/DefaultLibrary/Main.sc	2008-01-10 22:48:40 UTC (rev 6922)
@@ -1,26 +1,26 @@
-// Special version of Main for demo stand-alone application.
-
 Main : Process {
+	var platform, argv;
+	var <>recvOSCfunc;
 	
+		// proof-of-concept: the interpreter can set this variable when executing code in a file
+		// should be nil most of the time
+	var	<>nowExecutingPath;
+
 	startup {
 		super.startup;
-		
 		// set the 's' interpreter variable to the internal server.
-		// You should use the internal server for standalone applications--
-		// otherwise, if your application has a problem, the user will
-		// be stuck with a process, possibly making sound, that he won't know 
-		// how to kill
 		interpreter.s = Server.internal;
-//		GUI.fromID( this.platform.defaultGUIScheme );
-//		GeneralHID.fromID( this.platform.defaultHIDScheme );
-//		this.platform.startup;
+		GUI.fromID( this.platform.defaultGUIScheme );
+		GeneralHID.fromID( this.platform.defaultHIDScheme );
+		this.platform.startup;
 		StartUp.run;
-		
-		// server windows turned off for stand-alone application
-//		Server.internal.makeWindow;
-//		Server.local.makeWindow;
-		
-		// Start the application using internal server
+		(
+			osx: "Welcome to SuperCollider, type cmd-d for help"
+		 ).at(platform.name).postln;
+		/* uncomment these lines if you want to close the Server windows */
+		// Server.local.window.close;
+		// Server.internal.window.close;
+		/* a sample stand-alone application */
 		interpreter.s.waitForBoot({
 			var sb, demo;
 			sb = SCWindow.screenBounds;
@@ -39,15 +39,12 @@
 			// Close post window after application launches. If you want
 			// to hide it completely, put this line after Document.startup instead.
 			Document.closeAll(false);
-		}, 25);
-				
-		// You probably don't want to include this, since the user won't have it
-//		"~/scwork/startup.rtf".loadPaths;
+		}, 25);		
 	}
 	
 	shutdown { // at recompile, quit
 		Server.quitAll;
-		HIDDeviceService.releaseDeviceList;
+		this.platform.shutdown;
 		super.shutdown;
 	}
 	
@@ -56,22 +53,23 @@
 	}
 	
 	stop { // called by command-.
-		
-		Server.freeAll; // stop all sounds on local servers
-		
+
 		SystemClock.clear;
 		AppClock.clear;
 		TempoClock.default.clear;
 		CmdPeriod.clear;
 		
+		Server.freeAll; // stop all sounds on local servers
 		Server.resumeThreads;
 	}
 	
 	recvOSCmessage { arg time, replyAddr, msg;
+		/// added by tboverma on Jul-17-2006
+		recvOSCfunc.value(time, replyAddr, msg);
 		// this method is called when an OSC message is received.
 		OSCresponder.respond(time, replyAddr, msg);
 	}
-	
+
 	recvOSCbundle { arg time, replyAddr ... msgs;
 		// this method is called when an OSC bundle is received.
 		msgs.do({ arg msg; 
@@ -80,8 +78,31 @@
 	}
 	
 	newSCWindow {
-		SCWindow.viewPalette;
-		SCWindow.new.front;
+		var win, palette;
+		win = SCWindow("construction");
+		win.front;
+		win.toggleEditMode;
 	}
+
+
+	platformClass {
+		// override in platform specific extension
+		^Platform
+	}
+	platform {
+		^platform ?? { platform = this.platformClass.new }
+	}
+	argv {
+		^argv ?? { argv = this.prArgv }
+	}
+
+	showHelpBrowser {
+		Help.gui
+	}
 	
-}
\ No newline at end of file
+	// PRIVATE
+	prArgv {
+		_Argv
+		^[]
+	}
+}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.