[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-dev] SF.net SVN: supercollider:[8346] trunk
Revision: 8346
http://supercollider.svn.sourceforge.net/supercollider/?rev=8346&view=rev
Author: danstowell
Date: 2008-12-31 17:07:52 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
Move OSX-only String:findHelpFile method into OSXPlatform (where it is declared as a "feature"). Then make String:findHelpFile use either the platform's method, or a Help-tree based method if no such feature.
(Cleaner behaviour for non-mac platforms, avoids an override of the mac-specific version. Also, I think this makes String:findHelpFile work on linux the way it should do, returning a path rather than opening a window.)
Modified Paths:
--------------
trunk/Source/app/CocoaFilePrimitives.M
trunk/build/SCClassLibrary/Common/GUI/PlusGUI/Collections/StringPlusGUI.sc
trunk/build/SCClassLibrary/Platform/osx/OSXPlatform.sc
Modified: trunk/Source/app/CocoaFilePrimitives.M
===================================================================
--- trunk/Source/app/CocoaFilePrimitives.M 2008-12-31 14:50:37 UTC (rev 8345)
+++ trunk/Source/app/CocoaFilePrimitives.M 2008-12-31 17:07:52 UTC (rev 8346)
@@ -163,10 +163,11 @@
{
if (!g->canCallOS) return errCantCallOS;
- PyrSlot *receiver = g->sp;
+ PyrSlot *a = g->sp;
+ PyrSlot *receiver = g->sp - 1;
// this function should be moved out of the MyDocument instance
- NSString *path = pathOfHelpFileFor( nsStringFromPyrSlot(receiver));
+ NSString *path = pathOfHelpFileFor( nsStringFromPyrSlot(a));
if(path) {
PyrString* pyrPathString = newPyrString(g->gc,[path fileSystemRepresentation],0,true);
@@ -282,7 +283,7 @@
//definePrimitive(base, index++, "_Cocoa_SaveAsPlist", prSaveAsPlist, 2, 0);
// definePrimitive(base, index++, "_Cocoa_StandardizePath", prStandardizePath, 1, 0);
definePrimitive(base, index++, "_Cocoa_GetPathsInDirectory", prGetPathsInDirectory, 4, 0);
- definePrimitive(base, index++, "_Cocoa_HelpFileForString_", prHelpFileForString, 1, 0);
+ definePrimitive(base, index++, "_Cocoa_HelpFileForString_", prHelpFileForString, 2, 0);
/* definePrimitive(base, index++, "_ObjC_AllocInit", prAllocInit, 4, 0);
definePrimitive(base, index++, "_ObjC_Dealloc", prDealloc, 2, 0);
Modified: trunk/build/SCClassLibrary/Common/GUI/PlusGUI/Collections/StringPlusGUI.sc
===================================================================
--- trunk/build/SCClassLibrary/Common/GUI/PlusGUI/Collections/StringPlusGUI.sc 2008-12-31 14:50:37 UTC (rev 8345)
+++ trunk/build/SCClassLibrary/Common/GUI/PlusGUI/Collections/StringPlusGUI.sc 2008-12-31 17:07:52 UTC (rev 8346)
@@ -77,12 +77,18 @@
}
- /// cocoa or at least foundation dependant
findHelpFile {
- _Cocoa_HelpFileForString_
- ^this.primitiveFailed
+ ^if(thisProcess.platform.hasFeature(\findHelpFile)){
+ // on osx, there's a primitve which does it nice and fast
+ thisProcess.platform.findHelpFile(this)
+ }{
+ // this is very fast, but not on first run since it needs a tree to be scanned+built
+ Help.findHelpFile(this)
+ }
+
}
openHelpFile {
(this.findHelpFile ? "Help/Help.html".standardizePath).openHTMLFile
}
}
+
Modified: trunk/build/SCClassLibrary/Platform/osx/OSXPlatform.sc
===================================================================
--- trunk/build/SCClassLibrary/Platform/osx/OSXPlatform.sc 2008-12-31 14:50:37 UTC (rev 8345)
+++ trunk/build/SCClassLibrary/Platform/osx/OSXPlatform.sc 2008-12-31 17:07:52 UTC (rev 8346)
@@ -3,6 +3,7 @@
initPlatform {
super.initPlatform;
recordingsDir = "~/Music/SuperCollider Recordings".standardizePath;
+ this.declareFeature(\findHelpFile); // Announce that we have our own way of finding helpfiles
}
name { ^\osx }
@@ -30,4 +31,10 @@
defaultHIDScheme { ^\osx_hid }
recompile { _Recompile }
+
+ findHelpFile { | string |
+ _Cocoa_HelpFileForString_
+ ^this.primitiveFailed
+ }
}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
_______________________________________________
sc-dev mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/