[Sciviews-commits] r200 - in komodo/SciViews-K: . content content/js locale/en-GB locale/fr-FR skin skin/images

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Sep 27 21:58:53 CEST 2009


Author: prezez
Date: 2009-09-27 21:58:53 +0200 (Sun, 27 Sep 2009)
New Revision: 200

Added:
   komodo/SciViews-K/skin/images/house.png
Modified:
   komodo/SciViews-K/
   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
   komodo/SciViews-K/locale/en-GB/sciviewsk.dtd
   komodo/SciViews-K/locale/fr-FR/sciviewsk.dtd
   komodo/SciViews-K/skin/sciviewsk.css
Log:
More changes to R Help window: bug (on windows) with location of help homepage fixed, 
added simple page printing, more small improvements.


Property changes on: komodo/SciViews-K
___________________________________________________________________
Name: svn:ignore
   + !*
*-dev.*
build


Modified: komodo/SciViews-K/content/RHelpOverlay.xul
===================================================================
--- komodo/SciViews-K/content/RHelpOverlay.xul	2009-09-27 13:47:00 UTC (rev 199)
+++ komodo/SciViews-K/content/RHelpOverlay.xul	2009-09-27 19:58:53 UTC (rev 200)
@@ -53,9 +53,12 @@
     persist="screenX screenY width height"
     style="min-height: 400px; min-width: 300px;">
 
+	<script type="text/javascript" src="chrome://global/content/printUtils.js" />
+
     <script type="text/javascript">
         <![CDATA[
-        var sv;
+
+		var sv;
 		var rHelpBrowser;
 		var rHelpTopic;
 		var rHelpHome;
@@ -95,9 +98,9 @@
 			if (!button.checked) {
 				find();
 			} else {
-				// hide findToolbar:
 				var findToolbar = document.getElementById("FindToolbar");
-				findToolbar.setAttribute("hidden", "true");
+				//findToolbar.setAttribute("hidden", "true");
+				findToolbar.close();
 			}
 		}
 
@@ -108,8 +111,8 @@
 			var findToolbar = document.getElementById("FindToolbar");
 
 			if (!next) {
-				var isShown = findToolbar.getAttribute("hidden") != "true";
-				findToolbar.removeAttribute("hidden");
+				//var isShown = findToolbar.getAttribute("hidden") != "true";
+				findToolbar.open();
 
 				findToolbar._findField.value = rHelpBrowser.docShell.document.getSelection();
 				findToolbar._find(findToolbar._findField.value);
@@ -118,8 +121,8 @@
 			}
 		}
 
-		function printpage() {
-			alert("Print not implemented yet!");
+		function printPage() {
+			PrintUtils.print();
 			// This does not work!
 			//window.print();
 			// This does not work either!
@@ -129,7 +132,7 @@
 			//}
 		}
 
-		function home() {
+		function goHome() {
 			// Change rHelpHome (not set before to display quicker the first time)
 			rHelpHome = sv.prefs.getString("Rhelp.index",
 				"about:blank")
@@ -181,6 +184,12 @@
 				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);
 				}
 			},
 
@@ -200,22 +209,9 @@
 			onSecurityChange: function(aWebProgress, aRequest, aState) { }
 		}
 
-		function keyPressListener (event) {
-			if (event.ctrlKey && event.which == 102) { // Ctrl+F
-				find(false);
-			} else if (event.keyCode == 114) { // F3
-				find(true);
-			} else if (event.keyCode == 8) { // backspace
-				goBack();
-			}
-		}
-
 		function onFindToolbarAttrModified(event) {
 			if (event.attrName == "hidden"
 				&& (!event.newValue || event.newValue == "true")) {
-				//var bc = document.getElementById("cmd_rhelp_findToolbar");
-				//bc.setAttribute("hidden", event.target.hidden);
-				//rhelp-find!!!
 				document.getElementById("rhelp-find").checked = !event.target.hidden;
 			}
 		}
@@ -237,23 +233,34 @@
 			rHelpBrowser.addProgressListener(progressListener,
 			  Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
 
-			document.addEventListener("keypress", keyPressListener, true);
+			var findToolbar = document.getElementById("FindToolbar");
 
 			// Listen to find toolbar attribute modifications:
+			findToolbar.addEventListener("DOMAttrModified",
+				onFindToolbarAttrModified, true);
 
-			document.getElementById("FindToolbar").
-				addEventListener("DOMAttrModified",
-										 onFindToolbarAttrModified, true);
-
-			/*rHelpBrowser.removeProgressListener(myListener,
-			  Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
-			*/
         }
 
 
         ]]>
     </script>
 
+<keyset id="keyset_main">
+    <key id="key_find" key="f" observes="cmd_find" modifiers="accel" />
+    <key id="key_find_next" keycode="VK_F3" command="cmd_find_next" modifiers="" />
+    <key id="key_go_back" keycode="VK_BACK" command="cmd_go_back" modifiers="" />
+    <key id="key_go_home" keycode="VK_HOME" command="cmd_go_home" modifiers="alt" />
+</keyset>
+
+<commandset id="commandset_main">
+  <command id="cmd_find" oncommand="find(false);" />
+  <command id="cmd_find_next" oncommand="find(true);" />
+  <command id="cmd_go_back" oncommand="goBack(true);" disabled="true" />
+  <command id="cmd_go_forward" oncommand="goForward(true);" disabled="true" />
+  <command id="cmd_go_home" oncommand="goHome();" />
+  <command id="cmd_print" oncommand="printPage();" />
+</commandset>
+
     <hbox>
 		<vbox align="stretch" flex="1">
             <textbox id="rhelp-topic" flex="0"
@@ -275,15 +282,14 @@
 			tooltiptext="Search this page (Ctrl-F/F3)"
 			persist="buttonstyle" buttonstyle="pictures"/>
 		<toolbarbutton id="rhelp-back-button" class="history-back-icon"
-		    oncommand="goBack();" disabled="false" label="Back"
+		    label="Back" command="cmd_go_back"
 			tooltiptext="Back" persist="buttonstyle" buttonstyle="pictures"/>
 		<toolbarbutton id="rhelp-forward-button" class="history-forward-icon"
-		    oncommand="goForward();" disabled="false" label="Forward"
+		    command="cmd_go_forward" label="Forward"
 			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"/>
+		<toolbarbutton id="rhelp-home" class="home-icon"
+		    command="cmd_go_home" label="Home"
+			tooltiptext="R help index" buttonstyle="pictures"/>
 		<toolbarbutton id="rhelp-web" type="menu"
 		     disabled="false" label="Web"
 			tooltiptext="R help on the web" persist="buttonstyle"
@@ -311,9 +317,8 @@
 		</toolbarbutton>
 		<toolbarseparator/>
 		<toolbarbutton id="rhelp-print" class="print-button"
-		    oncommand="printpage();" disabled="false" label="Print"
-			tooltiptext="Print this page" persist="buttonstyle"
-			buttonstyle="pictures"/>
+		    command="cmd_print" disabled="false" label="Print"
+			tooltiptext="Print this page" buttonstyle="pictures"/>
     </hbox>
 
     <vbox flex="1">

Modified: komodo/SciViews-K/content/js/commands.js
===================================================================
--- komodo/SciViews-K/content/js/commands.js	2009-09-27 13:47:00 UTC (rev 199)
+++ komodo/SciViews-K/content/js/commands.js	2009-09-27 19:58:53 UTC (rev 200)
@@ -390,7 +390,7 @@
 		var vmProto = ko.views.viewManager.prototype;
 
 		var cmdsIfRRunning = ['OpenPkgManager', 'BrowseWD', 'quit_R',
-			'update_charset'];
+			 'OpenHelp']; //'update_charset',
 		var cmdsIfRNotRunning = ['start_R'];
 
 		// Make these commands active only when current document language is R

Modified: komodo/SciViews-K/content/js/r.js
===================================================================
--- komodo/SciViews-K/content/js/r.js	2009-09-27 13:47:00 UTC (rev 199)
+++ komodo/SciViews-K/content/js/r.js	2009-09-27 19:58:53 UTC (rev 200)
@@ -602,25 +602,36 @@
 
 // Start R help in the default browser
 sv.r.helpStart = function (start) {
-	var cmd = 'suppressMessages(make.packages.html()); options(htmlhelp = TRUE); ' +
-		'cat(paste("file://", URLencode(tempdir()), "/.R/doc/html/index.html\n", sep = ""))';
-	if (typeof(start) == "undefined" || start == true) {
+
+	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);
-			sv.prefs.setString("Rhelp.index", page, 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);
-		});
-	} else { // Just set the home page
-		var res = sv.r.evalCallback(cmd, function (page) {
-			ko.statusBar.AddMessage("", "RhelpStart");
-			page = sv.tools.strings.removeLastCRLF(page);
-			sv.prefs.setString("Rhelp.index", page, true);
-		});
-	}
+		}
+	});
 	return(res);
 }
 

Modified: komodo/SciViews-K/content/overlayMain.xul
===================================================================
--- komodo/SciViews-K/content/overlayMain.xul	2009-09-27 13:47:00 UTC (rev 199)
+++ komodo/SciViews-K/content/overlayMain.xul	2009-09-27 19:58:53 UTC (rev 200)
@@ -33,7 +33,7 @@
  the terms of any one of the MPL, the GPL or the LGPL.
 
  ***** END LICENSE BLOCK ***** -->
- 
+
 <!DOCTYPE overlay PUBLIC "-//MOZILLA//DTD XUL V1.0//EN"
 	"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" [
 	<!ENTITY % komodoDTD SYSTEM "chrome://komodo/locale/komodo.dtd">
@@ -63,12 +63,12 @@
 	<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>
 
-	<commandset id="allcommands"> 
+	<commandset id="allcommands">
 		<command id="Tasks:svAbout"
 			oncommand="alert('SciViews-K (Komodo R Editor) version ' + sv.version + '\na Komodo extension to interact with R\n(see http://www.sciviews.org/SciViews-K)');"/>
 
@@ -88,6 +88,10 @@
 			<command id="cmd_sv_OpenPkgManager" key="key_cmd_sv_OpenPkgManager"
 				oncommand="sv.command.openPkgManager();" disabled="true"
 				desc="R: &pkgMgr;" label="&pkgMgr;" accesskey="&pkgMgr.key;"/>
+
+			<command id="cmd_sv_OpenHelp" key="key_cmd_sv_OpenHelp"
+				oncommand="sv.r.helpStart(true);"
+				desc="R: &helpStart;" label="&helpStart;" accesskey="&helpStart.key;"/>
 			<command id="cmd_sv_BrowseWD" key="key_cmd_sv_BrowseWD"
 				oncommand="sv.r.setwd('current', true);"
 				desc="R: &svBrowseWD;" label="&svBrowseWD;" accesskey="&svBrowseWD.key;"/>
@@ -123,9 +127,9 @@
 			<command id="cmd_sv_RSourcePara" key="key_cmd_sv_RSourcePara"
 				oncommand="ko.commands.doCommand('cmd_sv_RSourcePara')"
 				desc="R: &rSrcPara;" label="&rSrcPara;" accesskey="&rSrcPara.key;"/>
-			
+
 			<commandset id="cmdset_r_control" commandupdater="true" events="select"
-				oncommandupdate="ko.commands.updateCommandset(this);">	  
+				oncommandupdate="ko.commands.updateCommandset(this);">
 				<command id="cmd_sv_RRunSelection" key="key_cmd_sv_RRunSelection"
 					oncommand="ko.commands.doCommand('cmd_sv_RRunSelection')"
 					desc="R: &rSendSel;" label="&rSendSel;" accesskey="&rSendSel.key;"/>
@@ -134,7 +138,7 @@
 					desc="R: &rSrcSel;" label="&rSrcSel;" accesskey="&rSrcSel.key;"/>
 			</commandset>
 		</commandset>
-	
+
 		<!--<commandset id="cmdset_view_dependent"
 				removeelement="cmd_triggerPrecedingCompletion">
 			<command id="cmd_triggerPrecedingCompletion"
@@ -193,6 +197,8 @@
 					class="menuitem"/>-->
 				<menuitem id="r_start_pkg_manager" observes="cmd_sv_OpenPkgManager"
 					class="menuitem"/>
+				<menuitem id="r_start_help" observes="cmd_sv_OpenHelp"
+					class="menuitem"/>
 				<menuitem id="r_browse_wd" observes="cmd_sv_BrowseWD"
 					class="menuitem-iconic r-working-dir-icon"/>
 				<menuseparator/>

Modified: komodo/SciViews-K/install.rdf
===================================================================
--- komodo/SciViews-K/install.rdf	2009-09-27 13:47:00 UTC (rev 199)
+++ komodo/SciViews-K/install.rdf	2009-09-27 19:58:53 UTC (rev 200)
@@ -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.0</em:version>
+        <em:version>0.9.1</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>

Modified: komodo/SciViews-K/locale/en-GB/sciviewsk.dtd
===================================================================
--- komodo/SciViews-K/locale/en-GB/sciviewsk.dtd	2009-09-27 13:47:00 UTC (rev 199)
+++ komodo/SciViews-K/locale/en-GB/sciviewsk.dtd	2009-09-27 19:58:53 UTC (rev 200)
@@ -86,3 +86,6 @@
 
 <!ENTITY RUpdateCharset "Update character set">
 <!ENTITY RUpdateCharset.key "C">
+
+<!ENTITY helpStart "R Help start">
+<!ENTITY helpStart.key "h">

Modified: komodo/SciViews-K/locale/fr-FR/sciviewsk.dtd
===================================================================
--- komodo/SciViews-K/locale/fr-FR/sciviewsk.dtd	2009-09-27 13:47:00 UTC (rev 199)
+++ komodo/SciViews-K/locale/fr-FR/sciviewsk.dtd	2009-09-27 19:58:53 UTC (rev 200)
@@ -86,3 +86,6 @@
 
 <!ENTITY RUpdateCharset "Mise-à-jour du jeu de caractères">
 <!ENTITY RUpdateCharset.key "C">
+
+<!ENTITY helpStart "R Help start">
+<!ENTITY helpStart.key "h">

Added: komodo/SciViews-K/skin/images/house.png
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/skin/images/house.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: komodo/SciViews-K/skin/sciviewsk.css
===================================================================
--- komodo/SciViews-K/skin/sciviewsk.css	2009-09-27 13:47:00 UTC (rev 199)
+++ komodo/SciViews-K/skin/sciviewsk.css	2009-09-27 19:58:53 UTC (rev 200)
@@ -114,6 +114,10 @@
 	list-style-image: url("chrome://sciviewsk/skin/images/find.png");
 }
 
+.home-icon {
+	list-style-image: url("chrome://sciviewsk/skin/images/house.png");
+}
+
 .r-objects-filter:hover,
 .r-objects-filter:hover:active {
 	list-style-image: url("chrome://sciviewsk/skin/images/filter-a.png");



More information about the Sciviews-commits mailing list