[Sciviews-commits] r202 - in komodo/SciViews-K: . content content/js

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 30 11:36:23 CEST 2009


Author: prezez
Date: 2009-09-30 11:36:22 +0200 (Wed, 30 Sep 2009)
New Revision: 202

Added:
   komodo/SciViews-K/sciviewsk-0.9.2-ko.xpi
Modified:
   komodo/SciViews-K/content/RHelpOverlay.xul
   komodo/SciViews-K/content/js/commands.js
   komodo/SciViews-K/content/js/r.js
   komodo/SciViews-K/content/overlayMain.xul
   komodo/SciViews-K/install.rdf
Log:
R help window related changes.

Modified: komodo/SciViews-K/content/RHelpOverlay.xul
===================================================================
--- komodo/SciViews-K/content/RHelpOverlay.xul	2009-09-27 22:00:29 UTC (rev 201)
+++ komodo/SciViews-K/content/RHelpOverlay.xul	2009-09-30 09:36:22 UTC (rev 202)
@@ -37,15 +37,16 @@
 
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
-<?xml-stylesheet href="chrome://komodo/skin/toolbar.css" type="text/css"?>
+<?xml-stylesheet href="chrome://global/skin/toolbarbutton.css" type="text/css"?>
 <?xml-stylesheet href="chrome://global/skin/printPreview.css" type="text/css"?>
 <?xml-stylesheet href="chrome://komodo/skin/" type="text/css"?>
 <?xml-stylesheet href="chrome://komodo/skin/global/global.css" type="text/css"?>
-<?xml-stylesheet href="chrome://komodo/skin/toolbar.css" type="text/css"?>
+<!--<?xml-stylesheet href="chrome://komodo/skin/toolbar.css" type="text/css"?>-->
 <?xml-stylesheet href="chrome://komodo/skin/bindings/buttons.css" type="text/css"?>
 <?xml-stylesheet href="chrome://komodo/skin/bindings/views.css" type="text/css"?>
 <?xml-stylesheet href="chrome://komodo/skin/bindings/widgets.css" type="text/css"?>
 <?xml-stylesheet href="chrome://sciviewsk/skin/sciviewsk.css" type="text/css"?>
+<?xml-stylesheet href="chrome://sciviewsk/skin/test.css" type="text/css"?>
 
 
 <window
@@ -58,82 +59,85 @@
     <script type="text/javascript">
         <![CDATA[
 
-		var sv;
-		var rHelpBrowser;
-		var rHelpTopic;
-		var rHelpHome;
+	var sv;
+	var rHelpBrowser;
+	var rHelpTopic;
+	var rHelpHome;
 
-        function display(page) {
-			rHelpBrowser.webNavigation.loadURI(page, null, null, null, null);
+	function go(uri) {
+
+		if (uri) {
+			rHelpTopic.value = uri;
+		} else {
+			uri = rHelpTopic.value;
 		}
+		rHelpTopic.select();
 
-		function go() {
-			var page = rHelpTopic.value;
-			rHelpTopic.select();
+		if (!uri)
+			return;
 
-			//FIXME: java search applet does not work in this browser
-			// perhaps translate address (onLocationChange):
-			// <<R.help.homedir>>/search/SearchEngine.html?SEARCHTERM=<<KEYWORD>>&TITLES=?&KEYWORDS=?&ALIASES=?
-			// to R's help.search("<<KEYWORD>>")
-			// get the results page, possibly convert to html??
+		//FIXME: java search applet does not work in this browser
+		// perhaps translate address (onLocationChange):
+		// <<R.help.homedir>>/search/SearchEngine.html?SEARCHTERM=<<KEYWORD>>&TITLES=?&KEYWORDS=?&ALIASES=?
+		// to R's help.search("<<KEYWORD>>")
+		// get the results page, possibly convert to html??
 
-			// Try to differenciate an URL from a help topic
-			var isUri = page.search(/^((f|ht)tps?|chrome|about|file):\/{0,3}/) === 0;
+		// Try to differenciate an URL from a help topic
+		var isUri = uri.search(/^((f|ht)tps?|chrome|about|file):\/{0,3}/) === 0;
 
-			if (isUri) {
-				// This looks like a URL
-				rHelpBrowser.webNavigation.loadURI(page, null, null, null, null);
-			} else {
-				// Look for this 'topic' web page
-				sv.r.help(rHelpTopic.value);
-			}
+		if (isUri) {
+			// This looks like a URL
+			rHelpBrowser.webNavigation.loadURI(uri, null, null, null, null);
+		} else {
+			// Look for this 'topic' web page
+			sv.r.help(uri);
 		}
+	}
 
-		function txtInput(aEvent) {
-			if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN) {
-				go();
-			}
+	function txtInput(aEvent) {
+		if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN) {
+			go();
 		}
+	}
 
-		function search() {
-			rHelpTopic.select();
-			sv.r.search(rHelpTopic.value);
-        }
+	function search() {
+		rHelpTopic.select();
+		sv.r.search(rHelpTopic.value);
+	}
 
-		function onFindCommand (event) {
-			var button = event.target;
-			if (!button.checked) {
-				find();
-			} else {
-				var findToolbar = document.getElementById("FindToolbar");
-				//findToolbar.setAttribute("hidden", "true");
-				findToolbar.close();
-			}
+	function onFindCommand (event) {
+		var button = event.target;
+		if (!button.checked) {
+			find();
+		} else {
+			var findToolbar = document.getElementById("FindToolbar");
+			//findToolbar.setAttribute("hidden", "true");
+			findToolbar.close();
 		}
+	}
 
 
-		function find(next) {
-			//rHelpTopic.select();
-			//findInDoc(rHelpTopic.value);
-			var findToolbar = document.getElementById("FindToolbar");
+	function find(next) {
+		//rHelpTopic.select();
+		//findInDoc(rHelpTopic.value);
+		var findToolbar = document.getElementById("FindToolbar");
 
-			if (!next) {
-				//var isShown = findToolbar.getAttribute("hidden") != "true";
-				findToolbar.open();
+		if (!next) {
+			//var isShown = findToolbar.getAttribute("hidden") != "true";
+			findToolbar.open();
 
-				findToolbar._findField.value = rHelpBrowser.docShell.document.getSelection();
-				findToolbar._find(findToolbar._findField.value);
-			} else {
-				findToolbar._findAgain(event.shiftKey);
-			}
+			findToolbar._findField.value = rHelpBrowser.docShell.document.getSelection();
+			findToolbar._find(findToolbar._findField.value);
+		} else {
+			findToolbar._findAgain(event.shiftKey);
 		}
+	}
 
-		function goHome() {
-			// Change rHelpHome (not set before to display quicker the first time)
-			rHelpHome = sv.prefs.getString("Rhelp.index",
-				"about:blank")
-			rHelpBrowser.webNavigation.loadURI(rHelpHome,
-				null, null, null, null);
+	function goHome() {
+		// Change rHelpHome (not set before to display quicker the first time)
+		rHelpHome = sv.command.helpStartURI;
+		rHelpBrowser.webNavigation.loadURI(rHelpHome,
+			null, null, null, null);
 		}
 
         function goBack() {
@@ -150,128 +154,112 @@
         }
 
 
-		// Browser progress listener:
-		// so far used only to change title and location text
+	// Browser progress listener:
+	// so far used only to change title and location text
 
-		// From: https://developer.mozilla.org/en/Code_snippets/Progress_Listeners
-		const STATE_START = Components.interfaces.
-			nsIWebProgressListener.STATE_START;
-		const STATE_STOP = Components.interfaces.
-			nsIWebProgressListener.STATE_STOP;
-		var progressListener = {
-			QueryInterface: function(aIID) 	{
-				if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
-					aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
-					aIID.equals(Components.interfaces.nsISupports))
-						return this;
-					throw Components.results.NS_NOINTERFACE;
-			},
+	// From: https://developer.mozilla.org/en/Code_snippets/Progress_Listeners
+	const STATE_START = Components.interfaces.
+		nsIWebProgressListener.STATE_START;
+	const STATE_STOP = Components.interfaces.
+		nsIWebProgressListener.STATE_STOP;
+	var progressListener = {
+		QueryInterface: function(aIID) 	{
+			if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
+				aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
+				aIID.equals(Components.interfaces.nsISupports))
+					return this;
+				throw Components.results.NS_NOINTERFACE;
+		},
 
-			onStateChange: function(aWebProgress, aRequest, aFlag, aStatus) {
-				// If you use myListener for more than one tab/window, use
-				// aWebProgress.DOMWindow to obtain the tab/window which
-				// triggers the state change
-				if(aFlag & STATE_START) {
-					// This fires when the load event is initiated
-					rHelpTopic.value = aWebProgress.DOMWindow.document.location;
-					//sv.cmdout.append(">>" +
-					//aWebProgress.DOMWindow.document.location);
-				}
-				if(aFlag & STATE_STOP) {
-					// This fires when the load finishes
-					self.document.title = aWebProgress.DOMWindow.document.title;
-					document.getElementById("cmd_go_back")
-						.setAttribute("disabled", !rHelpBrowser.webNavigation
-								  .canGoBack)
-					document.getElementById("cmd_go_forward")
-						.setAttribute("disabled", !rHelpBrowser.webNavigation
-								  .canGoForward);
-				}
-			},
+		onStateChange: function(aWebProgress, aRequest, aFlag, aStatus) {
+			// If you use myListener for more than one tab/window, use
+			// aWebProgress.DOMWindow to obtain the tab/window which
+			// triggers the state change
+			if(aFlag & STATE_START) {
+				// This fires when the load event is initiated
+				rHelpTopic.value = aWebProgress.DOMWindow.document.location;
+				//sv.cmdout.append(">>" +
+				//aWebProgress.DOMWindow.document.location);
+			}
+			if(aFlag & STATE_STOP) {
+				// This fires when the load finishes
+				self.document.title = aWebProgress.DOMWindow.document.title;
+				document.getElementById("cmd_go_back")
+					.setAttribute("disabled", !rHelpBrowser.webNavigation
+							  .canGoBack)
+				document.getElementById("cmd_go_forward")
+					.setAttribute("disabled", !rHelpBrowser.webNavigation
+							  .canGoForward);
+			}
+		},
 
-			onLocationChange: function(aProgress, aRequest, aURI){
-				// This fires when the location bar changes; i.e load event is
-				// confirmed or when the user switches tabs. If you use
-				// myListener for more than one tab/window, use
-				// aProgress.DOMWindow to obtain the tab/window which triggered
-				//the change.
-			},
+		onLocationChange: function(aProgress, aRequest, aURI){
+			// This fires when the location bar changes; i.e load event is
+			// confirmed or when the user switches tabs. If you use
+			// myListener for more than one tab/window, use
+			// aProgress.DOMWindow to obtain the tab/window which triggered
+			//the change.
+		},
 
-			// For definitions of the remaining functions see XULPlanet.com
-			onProgressChange: function(aWebProgress, aRequest, curSelf,
-				maxSelf, curTot, maxTot) { },
-			onStatusChange: function(aWebProgress, aRequest, aStatus,
-				aMessage) { },
-			onSecurityChange: function(aWebProgress, aRequest, aState) { }
-		}
+		// For definitions of the remaining functions see XULPlanet.com
+		onProgressChange: function(aWebProgress, aRequest, curSelf,
+			maxSelf, curTot, maxTot) { },
+		onStatusChange: function(aWebProgress, aRequest, aStatus,
+			aMessage) { },
+		onSecurityChange: function(aWebProgress, aRequest, aState) { }
+	}
 
-		function onFindToolbarAttrModified(event) {
-			if (event.attrName == "hidden"
-				&& (!event.newValue || event.newValue == "true")) {
-				document.getElementById("rhelp-find").checked = !event.target.hidden;
-			}
+	function onFindToolbarAttrModified(event) {
+		if (event.attrName == "hidden"
+			&& (!event.newValue || event.newValue == "true")) {
+			document.getElementById("rhelp-find").checked = !event.target.hidden;
 		}
+	}
 
 
-		self.onload = function () {
-            var args = window.arguments;
-			sv = args[0];
-			var page = rHelpHome;
-			if (typeof(args[1]) != "undefined") page = args[1];
-			rHelpTopic = document.getElementById("rhelp-topic");
+	self.onload = function () {
+	    var args = window.arguments;
+	    sv = args[0];
+	    var page = rHelpHome;
+	    if (typeof(args[1]) != "undefined") page = args[1];
+	    rHelpTopic = document.getElementById("rhelp-topic");
 
-			rHelpTopic.clickSelectsAll = true;
+	    rHelpTopic.clickSelectsAll = true;
 
-			rHelpBrowser = document.getElementById("rhelp-browser");
-			rHelpBrowser.webNavigation.loadURI(page,
-				null, null, null, null);
+	    rHelpBrowser = document.getElementById("rhelp-browser");
+	    rHelpBrowser.webNavigation.loadURI(page,
+		    null, null, null, null);
 
-			rHelpBrowser.addProgressListener(progressListener,
-			  Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
+	    rHelpBrowser.addProgressListener(progressListener,
+	      Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
 
-			var findToolbar = document.getElementById("FindToolbar");
+	    var findToolbar = document.getElementById("FindToolbar");
 
-			// Listen to find toolbar attribute modifications:
-			findToolbar.addEventListener("DOMAttrModified",
-				onFindToolbarAttrModified, true);
+	    // Listen to find toolbar attribute modifications:
+	    findToolbar.addEventListener("DOMAttrModified",
+		    onFindToolbarAttrModified, true);
 
-        }
+	}
 
-
-
-  // calling PrintUtils.printPreview() requires that you have three functions
-  // in the global scope: getPPBrowser(), which returns the browser element in
-  // the window print preview uses, getNavToolbox(), which returns the element
-  // (usually the main toolbox element) before which the print preview toolbar
-  // should be inserted, and getWebNavigation(), which returns the document's
-  // nsIWebNavigation object
+	// required by PrintUtils.printPreview()
 	function getWebNavigation() rHelpBrowser.webNavigation;
 	function getNavToolbox() document.getElementById("nav-toolbar");
 	function getPPBrowser() rHelpBrowser;
 
-        ]]>
+]]>
     </script>
 	<script type="text/javascript" src="chrome://global/content/printUtils.js" />
 <script type="text/javascript">
+	function printPage() {
+		PrintUtils.print();
+	}
 
-
-		function printPage() {
-			PrintUtils.print();
-		}
-
-		function printPreview() {
-			function enterPP () {
-				document.getElementById("nav-toolbar").hidden = true;
-			}
-			function exitPP () {
-				document.getElementById("nav-toolbar").hidden = false;
-			}
-
-			PrintUtils.printPreview(enterPP, exitPP);
-		}
-
-
-
+	function printPreview() {
+		function enterPP ()	document.getElementById("nav-toolbar").hidden = true;
+		function exitPP ()	document.getElementById("nav-toolbar").hidden = false;
+		
+		PrintUtils.printPreview(enterPP, exitPP);
+	}
 </script>
 
 
@@ -331,22 +319,22 @@
 			<menupopup>
 				<menuitem id="rhelp-menu-sitesearch" label="R Site Search"
 					accesskey="s"
-					oncommand="display('http://finzi.psych.upenn.edu/search.html');"/>
+					oncommand="go('http://finzi.psych.upenn.edu/search.html');"/>
 				<menuitem id="rhelp-menu-cran" label="CRAN"
 					accesskey="c"
-					oncommand="display('http://cran.r-project.org/');"/>
+					oncommand="go('http://cran.r-project.org/');"/>
 				<menuitem id="rhelp-menu-wiki" label="R wiki"
 					accesskey="w"
-					oncommand="display('http://wiki.r-project.org/');"/>
+					oncommand="go('http://wiki.r-project.org/');"/>
 				<menuitem id="rhelp-menu-bioconductor" label="Bioconductor"
 					accesskey="b"
-					oncommand="display('http://www.bioconductor.org/');"/>
+					oncommand="go('http://www.bioconductor.org/');"/>
 				<menuitem id="rhelp-menu-graph" label="Graph Gallery"
 					accesskey="g"
-					oncommand="display('http://addictedtor.free.fr/graphiques/');"/>
+					oncommand="go('http://addictedtor.free.fr/graphiques/');"/>
 				<menuitem id="rhelp-menu-forge" label="R-Forge"
 					accesskey="f"
-					oncommand="display('http://r-forge.r-project.org/');"/>
+					oncommand="go('http://r-forge.r-project.org/');"/>
 			</menupopup>
 		</toolbarbutton>
 		<toolbarseparator/>

Modified: komodo/SciViews-K/content/js/commands.js
===================================================================
--- komodo/SciViews-K/content/js/commands.js	2009-09-27 22:00:29 UTC (rev 201)
+++ komodo/SciViews-K/content/js/commands.js	2009-09-30 09:36:22 UTC (rev 202)
@@ -20,7 +20,24 @@
 // sv.command object constructor
 (function () {
 	var RHelpWin;  // A reference to the R Help Window
+	var _this = this;
 
+	function _getWindowByURI(uri) {
+		var wm = Components.classes['@mozilla.org/appshell/window-mediator;1']
+			.getService(Components.interfaces.nsIWindowMediator);
+		en = wm.getEnumerator("");
+
+		if (uri) {
+			var win;
+			while (en.hasMoreElements()) {
+				win = en.getNext();
+				if (win.location.href == uri)
+					return win;
+			}
+		}
+		return null;
+	}
+
 	// private methods
 	function _keepCheckingR (stopMe) {
 		clearInterval(sv.r.testInterval);
@@ -313,72 +330,94 @@
 	}
 
 	this.openPkgManager = function () {
-		window.openDialog(
-			"chrome://sciviewsk/content/pkgManagerOverlay.xul",
-			"RPackageManager",
-			"chrome=yes,dependent,centerscreen,resizable=yes,scrollbars=yes,status=no",
-			sv);
-	}
+		var rPkgMgrXulUri = "chrome://sciviewsk/content/pkgManagerOverlay.xul";
 
-	this.openHelp = function (webpage) {
-		if (typeof(webpage) == "undefined") {
-			// We are asking for the R help home page
-			if (typeof(RHelpWin) == "undefined" || RHelpWin.closed) {
-				sv.log.debug("Starting R help");
-				sv.r.helpStart(true);
-			} else {
-				sv.log.debug("Displaying R help and going home");
-				RHelpWin.home();
-				RHelpWin.focus();
+		var rPkgMgr = _getWindowByURI(rPkgMgrXulUri);
+		if (!rPkgMgr || rPkgMgr.closed) {
+			try {
+				rPkgMgr = window.openDialog(rHelpXulUri, "RHelp",
+				"chrome=yes,dependent,resizable=yes," +
+				"scrollbars=yes,status=no,close,dialog=no", sv, uri);
+
+			} catch (e) {
 			}
 		} else {
-			// Webpage should be of the form: file:///
-			// Commented out and replaced by a bad hack (prepending 'file://')
-			// because:
-			// 1) sv.tools.file.getfile() returns null on Mac OS X
-			// 2) sv.tools.file.getURI() raises an error on Mac OS X
+			rPkgMgr.display(uri);
+		}
+		rPkgMgr.focus();
+	}
 
-			// This should hopefully work on all platforms (it does on Win and Linux)
-			// First, check if "webpage" is an URI already:
-			var isUri = webpage.search(/^((f|ht)tps?|chrome|about|file):\/{0,3}/) === 0;
-			// We will need special treatment of backslashes in windows
-			var isWin = navigator.platform.search(/Win\d+$/) === 0;
+	this.helpStartURI = "";
 
-			try {
-			    if (!isUri) {
-					if (isWin)
-						webpage = webpage.replace(/\//g, "\\");
-					webpage = sv.tools.file.getURI(sv.tools.file.getfile(webpage));
-			    }
-			} catch (e) {
-			    // fallback:
-			    if (!isUri)
-				webpage = "file://" + webpage;
+	this.openHelp = function (uri) {
+		sv.cmdout.append(uri);
 
-			    sv.log.exception(e, "sv.command.openHelp");
+
+	    // We will need special treatment of in windows
+	    var isWin = navigator.platform.search(/Win\d+$/) === 0;
+
+	    if (!_this.helpStartURI) {
+			var cmd = 'suppressMessages(make.packages.html()); options(htmlhelp = TRUE); ';
+			cmd += "cat(" + (isWin? "R.home()" : "tempdir()") + ");";
+
+
+			var res = sv.r.evalCallback(cmd, function (path) {
+				path = sv.tools.strings.removeLastCRLF(path);
+				path = sv.tools.file.getfile(path,
+					[(isWin? null : ".R"), "doc", "html", "index.html"]);
+
+				path = sv.tools.file.getURI(path);
+				_this.helpStartURI = path;
+				_this.openHelp(path);
+				//alert(_this.helpStartURI);
+			});
+			return;
+		}
+		if (!uri)
+			uri = _this.helpStartURI;
+
+		// Webpage should be of the form: file:///
+		// Commented out and replaced by a bad hack (prepending 'file://')
+		// because:
+		// 1) sv.tools.file.getfile() returns null on Mac OS X
+		// 2) sv.tools.file.getURI() raises an error on Mac OS X
+
+		// This should hopefully work on all platforms (it does on Win and Linux)
+		// First, check if "uri" is an URI already:
+		var isUri = uri.search(/^((f|ht)tps?|chrome|about|file):\/{0,3}/) === 0;
+
+		try {
+			if (!isUri) {
+				if (isWin)
+					uri = uri.replace(/\//g, "\\");
+				uri = sv.tools.file.getURI(sv.tools.file.getfile(uri));
 			}
+		} catch (e) {
+			// fallback:
+			if (!isUri)
+			uri = "file://" + uri;
 
+			sv.log.exception(e, "sv.command.openHelp");
+		}
 
-			// We want to display a specific page
-			if (typeof(RHelpWin) == "undefined" || RHelpWin.closed) {
-				sv.log.debug("Starting R help with page " + webpage);
-				try {
-					RHelpWin = window.openDialog(
-						"chrome://sciviewsk/content/RHelpOverlay.xul",
-						"RHelp",
-							"chrome=yes,dependent,resizable=yes,scrollbars=yes,status=no,close,dialog=no",
-						sv, webpage);
-				// Recalculate home page for R Help only
-				} catch (e) {
-					sv.log.exception(e, "Unable to display R help", true);
-				}
-				sv.r.helpStart(false);
-			} else {
-				sv.log.debug("Showing R help for page " + webpage);
-				RHelpWin.display(webpage);
+		var rHelpXulUri = "chrome://sciviewsk/content/RHelpOverlay.xul";
+		RHelpWin = _getWindowByURI(rHelpXulUri);
+
+		if (!RHelpWin || RHelpWin.closed) {
+			sv.log.debug("Starting R help with page " + uri);
+			try {
+				RHelpWin = window.openDialog(rHelpXulUri, "RHelp",
+				"chrome=yes,dependent,resizable=yes," +
+				"scrollbars=yes,status=no,close,dialog=no", sv, uri);
+
+			} catch (e) {
+				sv.log.exception(e, "Unable to display R help", true);
 			}
-			RHelpWin.focus();
+		} else {
+			sv.log.debug("Showing R help for page " + uri);
+			RHelpWin.go(uri);
 		}
+		RHelpWin.focus();
 	}
 
 	this.setControllers = function () {

Modified: komodo/SciViews-K/content/js/r.js
===================================================================
--- komodo/SciViews-K/content/js/r.js	2009-09-27 22:00:29 UTC (rev 201)
+++ komodo/SciViews-K/content/js/r.js	2009-09-30 09:36:22 UTC (rev 202)
@@ -5,7 +5,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 // To cope with versions incompatibilities, we define this:
 // sv.alert(sv.r.RMinVersion); // Display minimum R version required
-// sv.r.sep; // ??? Defined as ";;", Kamil, what is this???
+// sv.r.sep; // Item separator that R should use returning data.
 // sv.r.running; // Is the linked R interpreter currently running?
 // sv.r.test();  // Check if an R interpreter is communicating with us
 //
@@ -23,7 +23,6 @@
 // sv.r.calltip_show(tip);		// Companion functions for sv.r.calltip
 // sv.r.complete(code); // AutoComplete mechanism for R
 // sv.r.display(topic, what); // Display 'topic' according to 'what' type
-// sv.r.helpStart(start); // Start R help in the browser, unless start is false
 // sv.r.help(topic, package); // Get help in R for 'topic', 'package' is optional
 // sv.r.example(topic); // Run example in R for 'topic', 'topic' is optional
 // sv.r.search(topic); // Search R help for 'topic'
@@ -70,7 +69,6 @@
 //
 // sv.r.pkg namespace: /////////////////////////////////////////////////////////
 // sv.r.pkg.repositories(); // Select repositories for installing R packages
-// sv.r.pkg.CRANmirror();   // Select preferred CRAN mirror
 // sv.r.pkg.chooseCRANMirror(andInstall); // replacement for .CRANmirror,
 							// optionally calls .install after execution
 // sv.r.pkg.available();    // List available R packages on selected repository
@@ -93,6 +91,14 @@
 // sv.r.pkg.installSV(); // Install the SciViews-R packages from CRAN
 // sv.r.pkg.installSVrforge(); // Install development versions of SciViews-R
                                // from R-Forge
+// sv.r.pkg.CRANmirror();   // Select preferred CRAN mirror
+
+
+/// REMOVED! use sv.command.openHelp instead
+// sv.r.helpStart(start); // Start R help in the browser, unless start is false
+
+
+
 ////////////////////////////////////////////////////////////////////////////////
 //
 // TODO: in overlay: add "source file" context menu item in the project tab
@@ -600,50 +606,20 @@
 	return(res);
 }
 
-// Start R help in the default browser
-sv.r.helpStart = function (start) {
 
-	if (typeof(start) == "undefined")
-		start = true;
-
-	var isWin = navigator.platform.search(/Win\d+$/) === 0;
-
-	var cmd = 'suppressMessages(make.packages.html()); options(htmlhelp = TRUE); ';
-	cmd += "cat(" + (isWin? "R.home()" : "tempdir()") + ");";
-
-
-	if (start === true) {
-		ko.statusBar.AddMessage(sv.translate("R help started... should display" +
-			" in browser soon"), "RhelpStart", 10000, true);
-	}
-
-	var res = sv.r.evalCallback(cmd, function (page) {
-		ko.statusBar.AddMessage("", "RhelpStart");
-		page = sv.tools.strings.removeLastCRLF(page);
-
-		page = sv.tools.file.getfile(page,
-			[(isWin? null : ".R"), "doc", "html", "index.html"])
-
-		page = sv.tools.file.getURI(page);
-		sv.prefs.setString("Rhelp.index", page, true);
-
-		if (start === true) {
-			// Launch the help window
-			sv.command.openHelp(page);
-		}
-	});
-	return(res);
-}
-
 // Get help in R (HTML format)
 sv.r.help = function (topic, pkg) {
 	var res = false;
+
+	if (typeof(topic) == "undefined" || topic == "")
+		topic = sv.getTextRange("word");
+
+	if (topic == "")
+		ko.statusBar.AddMessage(sv.translate("Selection is empty..."), "R",
+			1000, false);
+
 	if (!topic && !pkg) {
-		if (typeof(topic) == "undefined" || topic == "")
-			topic = sv.getTextRange("word");
-		if (topic == "")
-			ko.statusBar.AddMessage(sv.translate("Selection is empty..."), "R",
-				1000, false);
+		return false;
 	} else {
 		var cmd = '';
 		cmd += pkg? ' package = "' + pkg + '", ' : "";
@@ -655,7 +631,7 @@
 		ko.statusBar.AddMessage(sv.translate("R help asked for \"%S\"", topic),
 			"R", 5000, true);
 	}
-	return(res);
+	return res;
 }
 
 // Run the example for selected item
@@ -721,6 +697,7 @@
 
 
 // Search R web sites for topic
+// TODO: open results in RHelpWin, do not use R
 sv.r.siteSearch = function (topic) {
 	var res = false;
 	if (typeof(topic) == "undefined" | topic == "")
@@ -733,6 +710,7 @@
 		ko.statusBar.AddMessage("R site search asked for '" + topic + "'",
 			"R", 5000, true);
 	}
+
 	return(res);
 }
 

Modified: komodo/SciViews-K/content/overlayMain.xul
===================================================================
--- komodo/SciViews-K/content/overlayMain.xul	2009-09-27 22:00:29 UTC (rev 201)
+++ komodo/SciViews-K/content/overlayMain.xul	2009-09-30 09:36:22 UTC (rev 202)
@@ -90,7 +90,7 @@
 				desc="R: &pkgMgr;" label="&pkgMgr;" accesskey="&pkgMgr.key;"/>
 
 			<command id="cmd_sv_OpenHelp" key="key_cmd_sv_OpenHelp"
-				oncommand="sv.r.helpStart(true);"
+				oncommand="sv.command.openHelp();"
 				desc="R: &helpStart;" label="&helpStart;" accesskey="&helpStart.key;"/>
 			<command id="cmd_sv_BrowseWD" key="key_cmd_sv_BrowseWD"
 				oncommand="sv.r.setwd('current', true);"

Modified: komodo/SciViews-K/install.rdf
===================================================================
--- komodo/SciViews-K/install.rdf	2009-09-27 22:00:29 UTC (rev 201)
+++ komodo/SciViews-K/install.rdf	2009-09-30 09:36:22 UTC (rev 202)
@@ -4,7 +4,7 @@
     <Description about="urn:mozilla:install-manifest">
         <em:id>sciviewsk at sciviews.org</em:id>
         <em:name>SciViews-K</em:name>
-        <em:version>0.9.1</em:version>
+        <em:version>0.9.2</em:version>
         <em:description>Edit R (http://www.r-project.org) code with Komodo</em:description>
         <em:creator>Philippe Grosjean</em:creator>
         <em:homepageURL>http://sciviews.org/SciViews-K</em:homepageURL>

Added: komodo/SciViews-K/sciviewsk-0.9.2-ko.xpi
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/sciviewsk-0.9.2-ko.xpi
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream



More information about the Sciviews-commits mailing list