[Sciviews-commits] r198 - in komodo/SciViews-K: . content content/js templates
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Sep 27 12:02:44 CEST 2009
Author: phgrosjean
Date: 2009-09-27 12:02:42 +0200 (Sun, 27 Sep 2009)
New Revision: 198
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/sciviewsk-0.9.0-ko.xpi
komodo/SciViews-K/templates/R reference.kpz
Log:
Small changes to R help window and R autostat (disabled completely)
Modified: komodo/SciViews-K/content/RHelpOverlay.xul
===================================================================
--- komodo/SciViews-K/content/RHelpOverlay.xul 2009-09-26 23:05:49 UTC (rev 197)
+++ komodo/SciViews-K/content/RHelpOverlay.xul 2009-09-27 10:02:42 UTC (rev 198)
@@ -75,7 +75,6 @@
}
}
-
function txtInput(aEvent) {
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN) {
go();
@@ -86,10 +85,21 @@
rHelpTopic.select();
sv.r.search(rHelpTopic.value);
}
+
+ function searchpage() {
+ rHelpTopic.select();
+ findInDoc(rHelpTopic.value);
+ }
- function print() {
+ function printpage() {
alert("Print not implemented yet!");
+ // This does not work!
//window.print();
+ // This does not work either!
+ //var res = PrintUtils.showPageSetup();
+ //if (res) {
+ // PrintUtils.print(rHelpBrowser);
+ //}
}
function home() {
@@ -118,8 +128,10 @@
// so far used only to change title
// 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;
+ 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) ||
@@ -131,11 +143,13 @@
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
+ // 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);
+ //sv.cmdout.append(">>" +
+ //aWebProgress.DOMWindow.document.location);
}
if(aFlag & STATE_STOP) {
// This fires when the load finishes
@@ -144,27 +158,29 @@
},
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.
+ // 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) { },
+ onProgressChange: function(aWebProgress, aRequest, curSelf,
+ maxSelf, curTot, maxTot) { },
+ onStatusChange: function(aWebProgress, aRequest, aStatus,
+ aMessage) { },
onSecurityChange: function(aWebProgress, aRequest, aState) { }
}
function keyPressListener (event) {
//alert(event.ctrlKey + " * " + event.which);
-
if ((event.ctrlKey && event.which == 102)
|| event.keyCode == 114) {
findInDoc(rHelpTopic.value, false);
}
}
-
self.onload = function () {
var args = window.arguments;
sv = args[0];
@@ -178,11 +194,9 @@
rHelpBrowser.webNavigation.loadURI(page,
null, null, null, null);
-
rHelpBrowser.addProgressListener(progressListener,
Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
-
document.addEventListener("keypress", keyPressListener, true);
/*rHelpBrowser.removeProgressListener(myListener,
@@ -190,7 +204,6 @@
*/
}
-
function findInDoc(searchString, findBackwards) {
findBackwards = findBackwards? true : false;
@@ -209,22 +222,27 @@
}
}
}
-
-
]]>
</script>
<hbox>
<vbox align="stretch" flex="1">
- <textbox id="rhelp-topic" flex="0" emptytext="topic or web page"
+ <textbox id="rhelp-topic" flex="0"
+ emptytext="topic or web page (Ctrl-F/F3 search in doc)"
onkeypress="txtInput(event);"
- tooltiptext="Search topic or Web page (or Ctrl+F/F3 to search in document)"/>
+ tooltiptext="Search topic or Web page (or Ctrl-F/F3 to search in document)"/>
</vbox>
<toolbarbutton id="rhelp-go" class="macro-play-icon"
oncommand="go();" disabled="false" label="Go"
- tooltiptext="Show topic or web page" persist="buttonstyle" buttonstyle="pictures"/>
+ tooltiptext="Show topic or web page" persist="buttonstyle"
+ buttonstyle="pictures"/>
<toolbarbutton id="rhelp-search" class="help-icon"
oncommand="search();" disabled="false" label="Search"
- tooltiptext="Search expression in R help" persist="buttonstyle" buttonstyle="pictures"/>
+ tooltiptext="Search expression in R help" persist="buttonstyle"
+ buttonstyle="pictures"/>
+ <toolbarbutton id="rhelp-searchpage" class="list-item-down-icon"
+ oncommand="searchpage();" disabled="false" label="Search in page"
+ tooltiptext="Search expression in this page (Ctrl-F/F3)"
+ persist="buttonstyle" buttonstyle="pictures"/>
<spacer flex="1"/>
<toolbarbutton id="rhelp-back-button" class="history-back-icon"
oncommand="goBack();" disabled="false" label="Back"
@@ -234,10 +252,12 @@
tooltiptext="Forward" persist="buttonstyle" buttonstyle="pictures"/>
<toolbarbutton id="rhelp-home" class="open-file-icon"
oncommand="home();" disabled="false" label="Home"
- tooltiptext="R help index" persist="buttonstyle" buttonstyle="pictures"/>
+ tooltiptext="R help index" persist="buttonstyle"
+ buttonstyle="pictures"/>
<toolbarbutton id="rhelp-web" type="menu"
disabled="false" label="Web"
- tooltiptext="R help on the web" persist="buttonstyle" buttonstyle="pictures">
+ tooltiptext="R help on the web" persist="buttonstyle"
+ buttonstyle="pictures">
<menupopup>
<menuitem id="rhelp-menu-sitesearch" label="R Site Search"
accesskey="s"
@@ -261,8 +281,9 @@
</toolbarbutton>
<toolbarseparator/>
<toolbarbutton id="rhelp-print" class="print-button"
- oncommand="print();" disabled="false" label="Print"
- tooltiptext="Print this page" persist="buttonstyle" buttonstyle="pictures"/>
+ oncommand="printpage();" disabled="false" label="Print"
+ tooltiptext="Print this page" persist="buttonstyle"
+ buttonstyle="pictures"/>
</hbox>
<vbox flex="1">
Modified: komodo/SciViews-K/content/js/commands.js
===================================================================
--- komodo/SciViews-K/content/js/commands.js 2009-09-26 23:05:49 UTC (rev 197)
+++ komodo/SciViews-K/content/js/commands.js 2009-09-27 10:02:42 UTC (rev 198)
@@ -322,25 +322,38 @@
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();
}
} else {
// Webpage should be of the form: file:///
- webpage = sv.tools.file.getURI(sv.tools.file.getfile(webpage.replace(/\//g, "\\")));
-
+ // 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
+ //webpage = sv.tools.file.getURI(sv.tools.file.getfile(webpage.replace(/\//g, "\\")));
+ webpage = "file://" + webpage;
+
// We want to display a specific page
if (typeof(RHelpWin) == "undefined" || RHelpWin.closed) {
- RHelpWin = window.openDialog(
- "chrome://sciviewsk/content/RHelpOverlay.xul",
- "RHelp",
- "chrome=yes,dependent,resizable=yes,scrollbars=yes,status=no,close,dialog=no",
- sv, webpage);
+ 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);
}
RHelpWin.focus();
Modified: komodo/SciViews-K/content/js/r.js
===================================================================
--- komodo/SciViews-K/content/js/r.js 2009-09-26 23:05:49 UTC (rev 197)
+++ komodo/SciViews-K/content/js/r.js 2009-09-27 10:02:42 UTC (rev 198)
@@ -169,8 +169,10 @@
sv.r.eval = function (cmd) {
// If R is not running, start it now
if (!sv.r.running) {
+ // Indicate R should be started
+ ko.statusBar.AddMessage("R must be started for this command (R -> Start R)", "Rstart", 5000, true, true);
// Indicate that we want to execute this command when R is started
- sv.r.pendingCmd = cmd;
+ //sv.r.pendingCmd = cmd;
// and start R now
//sv.command.startR();
return null;
@@ -220,10 +222,14 @@
sv.r.evalCallback = function (cmd, procfun, context) {
// If R is not running, do nothing
if (!sv.r.running) {
+ // Indicate R should be started
+ ko.statusBar.AddMessage("R must be started for this command (R -> Start R)", "Rstart", 5000, true, true);
// Indicate that we want to execute this command when R is started
- sv.r.pendingCmd = cmd;
- sv.r.pendingFun = procfun;
- sv.r.pendingContext = context;
+ // We don't use this any more if R is not started automatically
+ //... but we keep it for now for a future implementation using okCancel
+ //sv.r.pendingCmd = cmd;
+ //sv.r.pendingFun = procfun;
+ //sv.r.pendingContext = context;
// and start R now
//sv.command.startR();
return null;
Modified: komodo/SciViews-K/content/overlayMain.xul
===================================================================
--- komodo/SciViews-K/content/overlayMain.xul 2009-09-26 23:05:49 UTC (rev 197)
+++ komodo/SciViews-K/content/overlayMain.xul 2009-09-27 10:02:42 UTC (rev 198)
@@ -63,7 +63,7 @@
<script type="application/x-javascript" src="chrome://sciviewsk/content/js/r-help.js"/>
<script type="application/x-javascript" src="chrome://sciviewsk/content/js/commands.js"/>
<script type="application/x-javascript" src="chrome://sciviewsk/content/js/misc.js"/>
-
+
<broadcasterset id="broadcasterset_global">
<broadcaster id="sv_r_is_running" disabled="false"/>
</broadcasterset>
Modified: komodo/SciViews-K/sciviewsk-0.9.0-ko.xpi
===================================================================
(Binary files differ)
Modified: komodo/SciViews-K/templates/R reference.kpz
===================================================================
(Binary files differ)
More information about the Sciviews-commits
mailing list