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

[sc-dev] findHelpFile patch



Hi -

The attached patch moves the responsibility for String:findHelpFile
into the CocoaDocument / Emacs classes, for a cleaner override on
non-Mac platforms.

I'm away from both svn and mac at the moment. Could someone please
verify that the patch doesn't break String:findHelpFile on osx, and if
seems OK, commit?

Thanks
Dan
-- 
http://www.mcld.co.uk
Index: build/SCClassLibrary/Platform/osx/CocoaDocument.sc
===================================================================
--- build/SCClassLibrary/Platform/osx/CocoaDocument.sc	(revision 8198)
+++ build/SCClassLibrary/Platform/osx/CocoaDocument.sc	(working copy)
@@ -195,5 +195,9 @@
 	*prGetIndexOfListener {
 		_TextWindow_GetIndexOfListener
 	}
+	*findHelpFile { |str|
+		_Cocoa_HelpFileForString_
+		^this.primitiveFailed
+	}
+}
 
-}
\ No newline at end of file
Index: build/SCClassLibrary/Common/GUI/Document.sc
===================================================================
--- build/SCClassLibrary/Common/GUI/Document.sc	(revision 8198)
+++ build/SCClassLibrary/Common/GUI/Document.sc	(working copy)
@@ -655,7 +655,8 @@
 	}
 	
 
-	
+	*findHelpFile { |str|
+		^this.subclassResponsibility
+	}
 }
 
-
Index: build/SCClassLibrary/Common/GUI/PlusGUI/Collections/StringPlusGUI.sc
===================================================================
--- build/SCClassLibrary/Common/GUI/PlusGUI/Collections/StringPlusGUI.sc	(revision 8198)
+++ build/SCClassLibrary/Common/GUI/PlusGUI/Collections/StringPlusGUI.sc	(working copy)
@@ -77,10 +77,8 @@
 	}
 
 
-	/// cocoa or at least foundation dependant
 	findHelpFile {
-		_Cocoa_HelpFileForString_
-		^this.primitiveFailed
+		^Document.implementationClass.findHelpFile(this)
 	}
 	openHelpFile {
 		(this.findHelpFile ? "Help/Help.html".standardizePath).openHTMLFile
Index: linux/scel/sc/extDocument.sc
===================================================================
--- linux/scel/sc/extDocument.sc	(revision 8198)
+++ linux/scel/sc/extDocument.sc	(working copy)
@@ -31,12 +31,6 @@
 
 
 + String{
-	findHelpFile {
-		if ( Emacs.initialized) {
-			Emacs.evalLispExpression(['sclang-find-help', this].asLispString);
-		}
-	}
-
 	openHelpFile {
 		if ( Emacs.initialized) {
 			this.findHelpFile;
Index: linux/scel/sc/ScelDocument.sc
===================================================================
--- linux/scel/sc/ScelDocument.sc	(revision 8198)
+++ linux/scel/sc/ScelDocument.sc	(working copy)
@@ -314,4 +314,11 @@
 	prGetLastIndex {
 		^this.shouldNotImplement(thisMethod)
 	}
+
+	*findHelpFile { |str|
+		if ( Emacs.initialized) {
+			Emacs.evalLispExpression(['sclang-find-help', str].asLispString);
+		}
+	}
+	
 }
\ No newline at end of file
Index: Source/app/CocoaFilePrimitives.M
===================================================================
--- Source/app/CocoaFilePrimitives.M	(revision 8198)
+++ Source/app/CocoaFilePrimitives.M	(working copy)
@@ -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);