[Sciviews-commits] r447 - in komodo/SciViews-K-dev: . R content content/js
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Feb 26 19:50:54 CET 2012
Author: prezez
Date: 2012-02-26 19:50:54 +0100 (Sun, 26 Feb 2012)
New Revision: 447
Modified:
komodo/SciViews-K-dev/R/_startup.R
komodo/SciViews-K-dev/content/RHelpWindow.xul
komodo/SciViews-K-dev/content/js/commands.js
komodo/SciViews-K-dev/content/js/prefs.js
komodo/SciViews-K-dev/content/pref-R.xul
komodo/SciViews-K-dev/sciviewsk-1.1.5dev-ko.xpi
Log:
R help window: fallback to remote help url (set in preferences), remnant code for tabbed help removed. New commands in the context menu (copy and select all)
Modified: komodo/SciViews-K-dev/R/_startup.R
===================================================================
--- komodo/SciViews-K-dev/R/_startup.R 2012-02-26 14:50:45 UTC (rev 446)
+++ komodo/SciViews-K-dev/R/_startup.R 2012-02-26 18:50:54 UTC (rev 447)
@@ -8,6 +8,8 @@
with(as.environment("komodoConnection"), {
+
+
`svPager` <- function (files, header, title, delete.file) {
files <- gsub("\\", "\\\\", files[1L], fixed = TRUE)
tryCatch(koCmd(sprintf('sv.r.pager("%1$s", "%2$s", %3$s)',
@@ -39,6 +41,7 @@
options(browser = svBrowser, pager = svPager)
+
# a way round to get the url:
#getHelpURL(help("anova")) <- old syntax
#getHelpURL("anova") <- new syntax
@@ -46,9 +49,15 @@
if(tools:::httpdPort == 0L) suppressMessages(tools:::startDynamicHelp(TRUE))
help_type <- "html"
ret <- NULL
- oBrowser <- options(browser = function(url) ret <<- url)
+ oBrowser <- options(browser = function(uri) ret <<- uri)
on.exit(options(oBrowser))
- if(mode((cl <- match.call())[[2L]][[1L]]) == "name") { # handle old syntax
+ if(tools:::httpdPort == 0L) return("")
+ if(!length(list(...))) {
+ return(paste("http://127.0.0.1:", tools:::httpdPort, "/doc/html/index.html",
+ sep = ""))
+ }
+ cl <- match.call()
+ if(length(cl) > 1L && mode(cl[[2L]][[1L]]) == "name") { # handle old syntax
cl <- cl[[2L]]
cl$help_type <- help_type
print(eval(cl, .GlobalEnv))
@@ -66,10 +75,6 @@
src <- dir(pattern = "^[^_].*\\.R$")
Rdata <- "startup.RData"
- #lapply(src, function(x) {
- # compiler::cmpfile(x, paste(x, "comp", sep = ""))
- #}
- #)
if(file.exists(Rdata) && {
mtime <- file.info(c(Rdata, src))[, "mtime"]
Modified: komodo/SciViews-K-dev/content/RHelpWindow.xul
===================================================================
--- komodo/SciViews-K-dev/content/RHelpWindow.xul 2012-02-26 14:50:45 UTC (rev 446)
+++ komodo/SciViews-K-dev/content/RHelpWindow.xul 2012-02-26 18:50:54 UTC (rev 447)
@@ -33,8 +33,12 @@
***** END LICENSE BLOCK ***** -->
<!DOCTYPE overlay PUBLIC "-//MOZILLA//DTD XUL V1.0//EN"
-"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" [
+ <!ENTITY % textcontext SYSTEM "chrome://global/locale/textcontext.dtd">
+ %textcontext;
+]>
+
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<?xml-stylesheet href="chrome://global/skin/toolbarbutton.css" type="text/css"?>
@@ -53,7 +57,8 @@
width="700" height="500" screenX="20" screenY="20"
persist="screenX screenY width height"
style="min-height: 400px; min-width: 300px;">
-<script type="text/javascript">
+<script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
+<script type="application/javascript">
<![CDATA[
var sv;
@@ -120,7 +125,7 @@
sv.r.search(topic);
}
-function onFindCommand (event) {
+function onFindCommand(event) {
var button = event.target;
if (!button.checked) {
find();
@@ -228,6 +233,8 @@
el.setAttribute("disabled", nothingSelected);
document.getElementById("cmd_run_r_code").setAttribute("disabled", nothingSelected);
+ goUpdateCommand("cmd_copy");
+
}
function runSelAsRCode() {
@@ -294,33 +301,30 @@
var cmd = "";
// Use only one type of connection for both client and server!
//if (sv.r.server == "http") {
- if (sv.pref.getPref("sciviews.client.type", "socket") == "http") {
+ /*if (sv.pref.getPref("sciviews.client.type", "socket") == "http") {
var port = sv.pref.getPref("sciviews.r.port", 8888);
var path = "http://127.0.0.1:" + port + "/doc/html/index.html";
browser.homePage = sv.helpStartURI = path;
//alert(browser.homePage);
if (goTo) go(path);
- } else { // socket, we must start the help server and ask for its port
- // Make sure that help is started, but do not open a browser
- cmd = 'invisible(capture.output(suppressMessages(help.start(browser = function(...) return())))); ';
+ } else {*/ // socket, we must start the help server and ask for its port
// return the home page of R >= 2.10 help system
- cmd += 'cat(paste("\n", "http://127.0.0.1:", tools:::httpdPort, "/doc/html/index.html", sep = ""))';
+ cmd = 'cat(getHelpURL())';
- res = sv.r.evalCallback(cmd, function (path) {
- path = sv.string.removeLastCRLF(path);
- // Old treatment for R < 2.10
- //path = sv.file.getfile(path,
- // [(isWin ? null : ".R"), "doc", "html", "index.html"]);
- //path = sv.file.getURI(path);
+ res = sv.r.evalCallback(cmd, function (path) {
+ path = sv.string.removeLastCRLF(path);
+ // Old treatment for R < 2.10
+ //path = sv.file.getfile(path,
+ // [(isWin ? null : ".R"), "doc", "html", "index.html"]);
+ //path = sv.file.getURI(path);
- // Get just the last line, get rid of the help.start's message
- path = path.substring(path.lastIndexOf("\n") + 1);
+ // Get just the last line, get rid of the help.start's message
+ path = path.substring(path.lastIndexOf("\n") + 1);
- browser.homePage = sv.helpStartURI = path;
- //alert(browser.homePage);
- if (goTo) go(path);
+ browser.homePage = sv.helpStartURI = path;
+ if (goTo) go(path);
});
- }
+ //}
}
var browserUtils = {};
@@ -472,6 +476,11 @@
label="Run as R code" desc="Execute selected text in R" accesskey="r" />
<command id="cmd_rsearch_for" oncommand="rHelpSearch(sv.string.trim(window._content.getSelection().toString()));"
label="Search R for selection" desc="Search R for selected text" accesskey="S" />
+
+ <command id="cmd_copy" oncommand="goDoCommand('cmd_copy')" disabled="true"/>
+ <command id="cmd_selectAll" oncommand="goDoCommand('cmd_selectAll')"/>
+
+
</commandset>
<popupset>
@@ -484,6 +493,17 @@
<menuitem id="menu_cmd_rsearch_for"
command="cmd_rsearch_for"
/>
+ <menuseparator />
+ <menuitem id="context-copy"
+ label="©Cmd.label;"
+ accesskey="©Cmd.accesskey;"
+ command="cmd_copy"
+ disabled="true"/>
+ <menuitem id="context-selectall"
+ label="&selectAllCmd.label;"
+ accesskey="&selectAllCmd.accesskey;"
+ command="cmd_selectAll"/>
+
</menupopup>
</popupset>
Modified: komodo/SciViews-K-dev/content/js/commands.js
===================================================================
--- komodo/SciViews-K-dev/content/js/commands.js 2012-02-26 14:50:45 UTC (rev 446)
+++ komodo/SciViews-K-dev/content/js/commands.js 2012-02-26 18:50:54 UTC (rev 447)
@@ -235,43 +235,26 @@
if (!isUri) uri = "file://" + uri;
}
} else {
- uri = ""; // home page will be shown
+ try {
+ uri = sv.rconn.evalAtOnce("cat(getHelpURL())");
+ } catch(e) {
+ uri = sv.pref.getPref('r.remote.help') + 'doc/index.html';
+ }
}
- var rhelpTabbed = sv.pref.getPref("rhelp.tabbed", false) == "true";
var rHelpXulUri = "chrome://sciviewsk/content/RHelpWindow.xul";
- // Open R-help in a right tab
- if (rhelpTabbed) {
- // Make sure tab is visible and select it
- var tabPanel = document.getElementById("rhelpviewbox");
- var tab = document.getElementById("rhelp_tab");
- var tabBox = tabPanel.parentNode.parentNode;
- tabPanel.hidden = false;
- tab.hidden = false;
- tabBox.selectedIndex = tabBox.tabs.getIndexOfItem(tab);
+ _this.RHelpWin = _getWindowByURI(rHelpXulUri);
+ if (!RHelpWin || RHelpWin.closed) {
+ sv.log.debug("Starting R help with page " + uri);
- var RHelpFrame = document.getElementById("rhelpview-frame");
-
- RHelpFrame.webNavigation.loadURI(rHelpXulUri, null, null, null, null);
-
- //RHelpFrame.setAttribute("src", rHelpXulUri);
- RHelpWin = RHelpFrame.contentWindow;
- RHelpWin.go(uri);
-
+ // try/catch here somehow prevented from storing window
+ // reference in RHelpWin. No idea why...
+ RHelpWin = window.openDialog(rHelpXulUri, "RHelp",
+ "chrome=yes,dependent,resizable=yes," +
+ "scrollbars=yes,status=no,close,dialog=no", sv, uri);
} else {
- _this.RHelpWin = _getWindowByURI(rHelpXulUri);
- if (!RHelpWin || RHelpWin.closed) {
- sv.log.debug("Starting R help with page " + uri);
-
- // try/catch here somehow prevented from storing window
- // reference in RHelpWin. No idea why...
- RHelpWin = window.openDialog(rHelpXulUri, "RHelp",
- "chrome=yes,dependent,resizable=yes," +
- "scrollbars=yes,status=no,close,dialog=no", sv, uri);
- } else {
- RHelpWin.go(uri);
- }
+ RHelpWin.go(uri);
}
RHelpWin.focus();
Modified: komodo/SciViews-K-dev/content/js/prefs.js
===================================================================
--- komodo/SciViews-K-dev/content/js/prefs.js 2012-02-26 14:50:45 UTC (rev 446)
+++ komodo/SciViews-K-dev/content/js/prefs.js 2012-02-26 18:50:54 UTC (rev 447)
@@ -32,10 +32,8 @@
'r.application': '', // XXX this one is of questionable usefulness
CRANMirror: 'http://cran.r-project.org/',
RHelpCommand: 'javascript:sv.r.help(\"%w\")',
- 'sciviews.pkgs.sciviews' : 'false'
- //*Future preferences:*
- //sciviews.rhelp.open_in = [tab, window]
- //sciviews.r.auto-start
+ 'sciviews.pkgs.sciviews' : 'false',
+ 'r.remote.help': 'http://finzi.psych.upenn.edu/R/'
};
//// Set default preferences
Modified: komodo/SciViews-K-dev/content/pref-R.xul
===================================================================
--- komodo/SciViews-K-dev/content/pref-R.xul 2012-02-26 14:50:45 UTC (rev 446)
+++ komodo/SciViews-K-dev/content/pref-R.xul 2012-02-26 18:50:54 UTC (rev 447)
@@ -151,6 +151,12 @@
oncommand="PrefR_UpdateCranMirrors(false);" />
</hbox>
</vbox>
+ <vbox>
+ <hbox align="center">
+ <label value="Remote help url:" control="r.remote.help" />
+ <textbox id="r.remote.help" pref="true" width="222" />
+ </hbox>
+ </vbox>
</groupbox>
<hbox>
Modified: komodo/SciViews-K-dev/sciviewsk-1.1.5dev-ko.xpi
===================================================================
(Binary files differ)
More information about the Sciviews-commits
mailing list