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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Dec 15 15:41:38 CET 2012


Author: phgrosjean
Date: 2012-12-15 15:41:37 +0100 (Sat, 15 Dec 2012)
New Revision: 491

Added:
   komodo/SciViews-K/content/RObjects2Pane.xul
Modified:
   komodo/SciViews-K/chrome.manifest
   komodo/SciViews-K/content/js/commands.js
   komodo/SciViews-K/content/js/r.js
   komodo/SciViews-K/content/js/rconsole.js
   komodo/SciViews-K/content/js/robjects.js
   komodo/SciViews-K/content/js/sciviews.js
   komodo/SciViews-K/content/js/socket.js
   komodo/SciViews-K/content/overlayMain.xul
   komodo/SciViews-K/content/pkgman.xul
Log:
Correction for moveable pane support in Komodo 7

Modified: komodo/SciViews-K/chrome.manifest
===================================================================
--- komodo/SciViews-K/chrome.manifest	2012-12-13 15:39:40 UTC (rev 490)
+++ komodo/SciViews-K/chrome.manifest	2012-12-15 14:41:37 UTC (rev 491)
@@ -1,4 +1,4 @@
-content sciviewsk jar:sciviewsk.jar!/content/ xpcnativewrappers=yes
+content sciviewsk jar:sciviewsk.jar!/content/
 
 overlay chrome://komodo/content/komodo.xul chrome://sciviewsk/content/RConsoleOverlay.xul appversion<=6.99
 
@@ -11,11 +11,9 @@
 
 overlay chrome://places/content/places_panel.xul chrome://sciviewsk/content/placesOverlay.xul appversion>6.99
 
-
-
 locale  sciviewsk     en-GB     jar:sciviewsk.jar!/locale/en-GB/
 locale  sciviewsk     fr-FR     jar:sciviewsk.jar!/locale/fr-FR/
 
 skin    sciviewsk  classic/1.0  jar:sciviewsk.jar!/skin/
 
-#manifest components/component.manifest
+manifest components/component.manifest

Added: komodo/SciViews-K/content/RObjects2Pane.xul
===================================================================
--- komodo/SciViews-K/content/RObjects2Pane.xul	                        (rev 0)
+++ komodo/SciViews-K/content/RObjects2Pane.xul	2012-12-15 14:41:37 UTC (rev 491)
@@ -0,0 +1,333 @@
+<?xml version="1.0"?>
+	<!-- ***** BEGIN LICENSE BLOCK *****
+	Version: MPL 1.1/GPL 2.0/LGPL 2.1
+
+	The contents of this file are subject to the Mozilla Public License
+	Version 1.1 (the "License"); you may not use this file except in
+	compliance with the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS"
+	basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+	License for the specific language governing rights and limitations
+	under the License.
+
+	The Original Code is SciViews-K by Philippe Grosjean et al.
+
+	Contributor(s):
+	Philippe Grosjean
+	Romain Francois
+	Kamil Barton
+	ActiveState Software Inc (code inspired from)
+
+	Alternatively, the contents of this file may be used under the terms of
+	either the GNU General Public License Version 2 or later (the "GPL"), or
+	the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+	in which case the provisions of the GPL or the LGPL are applicable instead
+	of those above. If you wish to allow use of your version of this file only
+	under the terms of either the GPL or the LGPL, and not to allow others to
+	use your version of this file under the terms of the MPL, indicate your
+	decision by deleting the provisions above and replace them with the notice
+	and other provisions required by the GPL or the LGPL. If you do not delete
+	the provisions above, a recipient may use your version of this file under
+	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 % sciviewskDTD SYSTEM "chrome://sciviewsk/locale/sciviewsk.dtd">
+%sciviewskDTD;
+]>
+
+<?xml-stylesheet href="chrome://global/content/xul.css" type="text/css"?>
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="chrome://komodo/skin/global/global.css" type="text/css"?>
+<?xml-stylesheet href="chrome://global/skin/toolbarbutton.css"?>
+<?xml-stylesheet href="chrome://komodo/skin/toolbar.css"?>
+<?xml-stylesheet href="chrome://sciviewsk/skin/sciviewsk.css" type="text/css"?>
+
+<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<script type="application/x-javascript">
+<![CDATA[
+var sv;
+if (window.parent && window.parent.sv) sv = window.parent.sv;
+]]>
+</script>
+<script type="application/x-javascript" src="chrome://sciviewsk/content/js/tools/array.js"/>
+<script type="application/x-javascript" src="chrome://sciviewsk/content/js/tools/strings.js"/>
+<script type="application/x-javascript" src="chrome://sciviewsk/content/js/tools/file.js"/>
+<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
+<script type="application/x-javascript" src="chrome://sciviewsk/content/js/robjects.js"/>
+
+<popupset id="extensionPopupSet">
+		<menupopup id="rObjectsContext" onpopupshowing="sv.robjects.contextOnShow(event);">
+			<menuitem id="menu_robjects_insertfullname"
+				class="primary_menu_item"
+				oncommand="sv.robjects.insertName(true)"
+				accesskey="F"
+				label="&sciviews.robjects.insFullName;"
+				acceltext="Ins" />
+			<menuitem id="menu_cmd_robjects_insertquoted"
+				label="&sciviews.robjects.insertQuoted;"
+				oncommand="sv.robjects.insertName(false, true);"
+				accesskey="&sciviews.robjects.insertQuoted.acc;"
+				acceltext="Shift+Ins" />
+			<menuitem id="menu_robjects_insertname"
+				label="&sciviews.robjects.insName;"
+				oncommand="sv.robjects.insertName(false)"
+				accesskey="I"
+				acceltext="Ctrl+Ins" />
+
+			<menuseparator keep="false" intoplevel="true"/>
+			
+			<menuitem id="cmd_robjects_removeobj"
+				label="&sciviews.robjects.rmObj;"
+				oncommand="sv.robjects.removeSelected(event.shiftKey)"
+				accesskey="R"
+				acceltext="Del"
+				testDisableIf="t:noDelete"
+				key="key_cmd_delete" />
+			<menuitem id="menu_cmd_robjects_deletenow"
+				label="&sciviews.robjects.deleteNow;"
+				oncommand="sv.robjects.removeSelected(true);"
+				class="menuitem-iconic list-item-remove-icon"
+				acceltext="Shift+Del"
+				testDisableIf="t:noDelete"
+				accesskey="&sciviews.robjects.deleteNow.acc;" />
+
+			<menuseparator keep="false" intoplevel="true"/>
+			
+			<menuitem id="cmd_robjects_summary"
+				label="&sciviews.robjects.summary;"
+				oncommand="sv.robjects.do('summary')"
+				testDisableIf="t:isFunction t:isEnvironment"
+				accesskey="S" />
+			<menuitem id="cmd_robjects_print"
+				label="&sciviews.robjects.print;"
+				oncommand="sv.robjects.do('print')"
+				testDisableIf="t:isPackage"
+				accesskey="P" />
+			<menuitem id="cmd_robjects_plot"
+				label="&sciviews.robjects.plot;"
+				oncommand="sv.robjects.do('plot')"
+				testDisableIf="t:isFunction t:isEnvironment"
+				accesskey="O"/>
+			<menuitem id="cmd_robjects_str"
+				label="&sciviews.robjects.str;"
+				oncommand="sv.robjects.do('str')"
+				testDisableIf="t:isPackage"
+				accesskey="T"/>
+
+			<menuseparator keep="false" intoplevel="true"/>
+			
+			<menuitem id="menu_cmd_robjects_selectall"
+				label="&sciviews.robjects.selectAll;"
+				oncommand="sv.robjects.selection.selectAll();"
+				accesskey="&sciviews.robjects.selectAll.acc;"
+				acceltext="Ctrl+A" />
+			<menuitem id="menu_cmd_robjects_selectsiblings"
+				label="&sciviews.robjects.selectSiblings;"
+				oncommand="sv.robjects.selectAllSiblings(sv.robjects.selection.currentIndex);"
+				accesskey="&sciviews.robjects.selectSiblings.acc;"
+				acceltext="Ctrl+Shift+A" />
+
+			<menuseparator keep="false" intoplevel="true"/>
+			
+			<menuitem id="menu_cmd_robjects_write_table"
+				class="menuitem-iconic save-buffer-icon"
+				label="&sciviews.robjects.write_table;"
+				oncommand="sv.robjects.do('write.table')"
+				testDisableIf="t:cannotSaveToFile"
+				accesskey="T"/>
+
+			<menuitem id="menu_cmd_robjects_save"
+				class="menuitem-iconic save-buffer-icon"
+				label="&sciviews.robjects.save;"
+				oncommand="sv.robjects.do('save')"
+				testDisableIf="t:cannotSave"
+				accesskey="S" />
+
+			<menuseparator keep="false" intoplevel="true"/>
+			
+			<menuitem id="menu_cmd_robjects_help"
+				label="&sciviews.robjects.help;"
+				oncommand="sv.robjects.do('help')"
+				class="menuitem-iconic help-icon"
+				testDisableIf="t:multipleSelection t:noHelp"
+				accesskey="H" />
+
+			</menupopup>
+		</popupset>
+
+	<broadcasterset id="broadcasterset_global">
+		<broadcaster id="cmd_robjects_viewSearchPath"
+			tooltiptext="&sciviews.robjects.tab;: &sciviews.robjects.showHide;"
+			label="&sciviews.robjects.showHide;" splitter="bottom_splitter"
+			box="robjects_searchpath_panel"
+			oncommand="sv.robjects.toggleViewSearchPath(event);"
+			checked="true" state="open"/>
+	</broadcasterset>
+
+
+<vbox flex="1" id="robjectsViewbox_robjectsWrapper">
+	<vbox flex="99" id="robjectsViewbox_robjects">
+		<hbox align="center" id="robjectsToolbar" class="toolbar-box">
+			<toolbarbutton id="sciviews_robjects_refresh_button"
+						tooltiptext="&sciviews.robjects.refresh.tip;"
+						buttonstyle="pictures"
+						class="refresh-icon"
+						oncommand="sv.robjects.refreshAll();"/>
+			<toolbarbutton id="sciviews_robjects_searchpath_button"
+						observes="cmd_robjects_viewSearchPath"
+						buttonstyle="pictures" class="searchPath-icon"
+						checked="true" persist="state checked"/>
+			<toolbarbutton id="r_objects_pkg_menu"
+						buttonstyle="pictures" class="robjects-pkg-icon"
+						type="menu" orient="horizontal">
+		  
+						<menupopup>
+								<menuitem id="r_objects_pkg_load" label="Load packages..."
+								accesskey="l" class="menuitem-iconic r-pkg-load-icon"
+								oncommand="sv.r.pkg.load();"/>
+								<menuitem id="r_objects_pkg_load" label="Attach workspace..."
+								accesskey="a" class="menuitem-iconic r-data-attach"
+								oncommand="sv.r.loadWorkspace(null, true);"/>
+								<menuitem id="r_objects_pkg_install" label="Install..."
+								accesskey="i" class="menuitem-iconic r-pkg-install-icon"
+								oncommand="sv.r.pkg.install();"/>
+								<menuitem id="r_objects_pkg_installLocal" label="Install from local files..."
+								accesskey="c" class="menuitem-iconic r-pkg-install-local-icon"
+								oncommand="sv.r.pkg.install(null, 'local');"/>
+								<menuitem id="r_objects_pkg_update" label="Update"
+								accesskey="u" class="menuitem-iconic r-pkg-update-icon"
+								oncommand="sv.r.pkg.update();"/>
+								<menuitem id="r_objects_pkg_remove" label="Remove..."
+								accesskey="r" class="menuitem-iconic r-pkg-remove-icon"
+								oncommand="sv.r.pkg.remove();"/>
+								
+								<menuseparator/>
+								
+								<menuitem id="r_cran_mirror" label="Select CRAN mirror"
+									accesskey="S" class="menuitem-iconic r-cran-mirror-icon"
+									oncommand="sv.r.pkg.chooseCRANMirror();"/>
+								<menuitem id="r_repositories" label="Select R repositories"
+									accesskey="r" class="menuitem-iconic r-repositories-icon"
+									oncommand="sv.r.pkg.repositories();"/>
+								
+							</menupopup>
+				</toolbarbutton>
+				
+				<toolbarseparator style="min-width:10px;" flex="1"/>
+				
+				<toolbarbutton id="sciviews_robjects_filter"
+						tooltiptext="&sciviews.robjects.filter.tip;"
+						buttonstyle="pictures" type="menu" orient="horizontal"
+						class="rightarrow-button-a r-objects-filter">
+						
+						<menupopup id="sciviews_robjects_filterPopup">
+								<menuitem id="sciviews_robjects_context_filterByName"
+								label="&sciviews.robjects.filterByName;"
+								checked="true" accesskey="n" type="checkbox"
+								oncommand="sv.robjects.setFilterBy(this, 'name')"/>
+								<menuitem id="sciviews_robjects_context_filterByClass"
+								label="&sciviews.robjects.filterByClass;"
+								accesskey="c" type="checkbox"
+								oncommand="sv.robjects.setFilterBy(this, 'class')"/>
+								<menuitem id="sciviews_robjects_context_filterByGroup"
+								label="&sciviews.robjects.filterByGroup;"
+								accesskey="g" type="checkbox"
+								oncommand="sv.robjects.setFilterBy(this, 'group')"/>
+								<menuseparator/>
+								<menuitem id="sciviews_robjects_context_clrFilter"
+								label="&sciviews.robjects.clrFilter;" accesskey="l"
+								oncommand="document.getElementById('sciviews_robjects_filterbox')
+										.value = ''; sv.robjects.applyFilter();"/>
+							</menupopup>
+				</toolbarbutton>
+				
+				<textbox id="sciviews_robjects_filterbox" flex="1"
+						type="search" timeout="500"
+						tooltiptext="&sciviews.robjects.filter.tip;"
+						style="min-width: 40px; max-width: 200px; margin-right: 0px;"
+						class="search-box"
+						oncommand="sv.robjects.applyFilter();"
+						emptytext="&sciviews.robjects.filterEmptyText;"/>
+			</hbox>
+		
+			<vbox id="robjects_searchpath_panel"
+				persist="height collapsed" state="collapsed" flex="1">
+				
+				<listbox flex="1" id="sciviews_robjects_searchpath_listbox"
+						ondragdrop="nsDragAndDrop.drop(event, sv.robjects.packageListObserver);"
+						ondragover="nsDragAndDrop.dragOver(event, sv.robjects.packageListObserver);"
+						ondraggesture="nsDragAndDrop.startDrag(event, sv.robjects.packageListObserver);"
+						onkeypress="sv.robjects.packageListKeyEvent(event);"
+						oncommand="sv.robjects.packageSelectedEvent(event);"/>
+					</vbox>
+			
+					<splitter id="sciviews_robjects_splitter" collapse="before"
+					resizeafter="closest" resizebefore="closest" persist="state"
+					observes="cmd_robjects_viewSearchPath">
+						<grippy/>
+					</splitter>
+					
+					<vbox flex="5">
+						<tree flex="1" id="sciviews_robjects_objects_tree"
+						persist="sortDirection sortResource"
+						sortDirection="ascending" sortResource="r-name"
+						enableColumnDrag="true"
+						onselect="sv.robjects.onEvent(event);"
+						onkeypress="sv.robjects.onEvent(event);">
+							
+							<treecols>
+								<treecol id="r-name" label="&sciviews.robjects.Name;"
+								primary="true" sortActive="true"
+								persist="width ordinal hidden"
+								onclick="sv.robjects.sort(this);" ordinal="1" flex="4"/>
+								<splitter class="tree-splitter" ordinal="2"/>
+								<treecol id="r-dims" label="&sciviews.robjects.Dims;"
+								persist="width ordinal hidden"
+								onclick="sv.robjects.sort(this);" flex="1" ordinal="3"/>
+								<splitter class="tree-splitter" ordinal="4"/>
+								<treecol id="r-group" label="&sciviews.robjects.Group;"
+								flex="2" hidden="true" persist="width ordinal hidden"
+								onclick="sv.robjects.sort(this);" ordinal="5"/>
+								<splitter class="tree-splitter" ordinal="6"/>
+								<treecol id="r-class" label="&sciviews.robjects.Class;"
+								flex="2" hidden="true" persist="width ordinal hidden"
+								onclick="sv.robjects.sort(this);" ordinal="7"/>
+								<splitter class="tree-splitter" ordinal="8"/>
+								<treecol id="r-fullName" label="&sciviews.robjects.FullName;"
+								persist="width ordinal hidden" flex="1" hidden="true" ordinal="9"/>
+							</treecols>
+							
+							<treechildren id="sciviews_robjects_objects_tree_main"
+							ondraggesture="nsDragAndDrop.startDrag(event, sv.robjects.listObserver);"
+							ondragdrop="nsDragAndDrop.drop(event, sv.robjects.listObserver);"
+							ondragover="nsDragAndDrop.dragOver(event, sv.robjects.listObserver);"
+							onclick="sv.robjects.onEvent(event);"
+							ondblclick="sv.robjects.onEvent(event);"
+							context="rObjectsContext">
+							</treechildren>
+						</tree>
+					</vbox>
+					
+					<vbox>
+						<hbox align="center">
+							<toolbarbutton id="sciviews_robjects_foldAll_button"
+							buttonstyle="pictures"
+							class="robjects-fold-all-icon"
+							oncommand="sv.robjects.foldAll(true);"
+							tooltiptext="&sciviews.robjects.foldAll;"/>
+							<toolbarbutton id="sciviews_robjects_ExpandAll_button"
+							buttonstyle="pictures"
+							class="robjects-expand-all-icon"
+							oncommand="sv.robjects.foldAll(false);"
+							tooltiptext="&sciviews.robjects.unfoldAll;"/>
+						</hbox>
+					</vbox>
+				</vbox>
+			</vbox>
+</page>

Modified: komodo/SciViews-K/content/js/commands.js
===================================================================
--- komodo/SciViews-K/content/js/commands.js	2012-12-13 15:39:40 UTC (rev 490)
+++ komodo/SciViews-K/content/js/commands.js	2012-12-15 14:41:37 UTC (rev 491)
@@ -195,7 +195,12 @@
 			isWin? "r-gui" : "r-terminal");
 
 		// Width of R output defined to fit R output panel (min = 66, max = 200)
-		var scimoz = document.getElementById("rconsole-scintilla2").scimoz;
+		var rcons = document.getElementById("rconsole-scintilla2");
+		// In ko7, we need a different code!
+		if (rcons == null) rcons = document
+			.getElementById("sciviews_rconsole_tab")
+			.contentDocument.getElementById("rconsole-scintilla2");	
+		var scimoz = rcons.scimoz;
 		var width = (Math.floor(window.innerWidth /
 			scimoz.textWidth(0, "0")) - 7)
 		if (width < 66) width = 66;
@@ -305,6 +310,8 @@
 		}
 	};
 
+	// TODO: at Komodo startup when R is running, I got in the notification pane:
+	// R is running -> R is not running -> R is running
 	this.updateRStatus = function (running) {
         // Toggle status if no argument
 		if (running === undefined) {
@@ -681,13 +688,15 @@
 										//'cmdset_rApp' commandset being grayed out
 										//at startup...
 			_this.updateRStatus(sv.r.test());
-			if(sv.r.running) sv.rbrowser.smartRefresh(true);
+			if(sv.r.running) sv.robjects.smartRefresh(true);
 	
 			// For completions
-			var cuih = ko.codeintel.CompletionUIHandler;
-			cuih.prototype.types.argument = cuih.prototype.types.interface;
-			cuih.prototype.types.environment = cuih.prototype.types.namespace;
-			cuih.prototype.types.file = "chrome://sciviewsk/skin/images/cb_file.png";
+
+// TODO PhG: This does not work for Komodo Edit 7!
+//			var cuih = ko.codeintel.CompletionUIHandler;
+//			cuih.prototype.types.argument = cuih.prototype.types.interface;
+//			cuih.prototype.types.environment = cuih.prototype.types.namespace;
+//			cuih.prototype.types.file = "chrome://sciviewsk/skin/images/cb_file.png";
 		}, 600);
 
 		var osName = Components.classes['@activestate.com/koOs;1']

Modified: komodo/SciViews-K/content/js/r.js
===================================================================
--- komodo/SciViews-K/content/js/r.js	2012-12-13 15:39:40 UTC (rev 490)
+++ komodo/SciViews-K/content/js/r.js	2012-12-15 14:41:37 UTC (rev 491)
@@ -382,7 +382,7 @@
 					var file = ko.places.manager.getSelectedItem().file;
 					dir = file.isDirectory? file.path : file.dirName;
 				} catch(e) {
-					dir = sv.file.pathFromURI(ko.places.manager.currentPlace);
+					dir = sv.tools.file.pathFromURI(ko.places.manager.currentPlace);
 				}
 			}
 			break;
@@ -787,7 +787,7 @@
 	sv.command.openHelp(rSearchUrl + "?file:" + file);
 	// Do we clean up the file after use?
 	if (cleanUp || cleanUp === undefined)
-		window.setTimeout("try { sv.file.getfile('" + file +
+		window.setTimeout("try { sv.tools.file.getfile('" + file +
 			"').remove(false); } catch(e) {}", 10000);
 }
 

Modified: komodo/SciViews-K/content/js/rconsole.js
===================================================================
--- komodo/SciViews-K/content/js/rconsole.js	2012-12-13 15:39:40 UTC (rev 490)
+++ komodo/SciViews-K/content/js/rconsole.js	2012-12-15 14:41:37 UTC (rev 491)
@@ -92,6 +92,10 @@
     
     function _ClearUI () {
         var descWidget = document.getElementById("rconsole-desc");
+        // In ko7, we need a different code!
+        if (descWidget == null) descWidget = document
+            .getElementById("sciviews_rconsole_tab")
+            .contentDocument.getElementById("rconsole-desc");
         descWidget.style.setProperty("color", "black", "");
         descWidget.removeAttribute("value");
         descWidget.removeAttribute("_command");
@@ -113,6 +117,10 @@
     
             // TODO: shouldn't we eliminate this???
             var treeWidget = document.getElementById("rconsole-tree");
+            // In ko7, we need a different code!
+            if (treeWidget == null) treeWidget = document
+            	.getElementById("sciviews_rconsole_tab")
+            	.contentDocument.getElementById("rconsole-tree");
             var boxObject = treeWidget.treeBoxObject
                 .QueryInterface(Components.interfaces.nsITreeBoxObject);
         
@@ -121,7 +129,10 @@
                 // visible before we can assign the view to it
                 RConsole_Show(window);
             }
-            _gRTerminalView = document.getElementById("rconsole-scintilla");
+            _gRTerminalView = (document.getElementById("rconsole-scintilla") == null) ?
+                document.getElementById("sciviews_rconsole_tab")
+                    .contentDocument.getElementById("rconsole-scintilla") :
+                document.getElementById("rconsole-scintilla");
             _gRTerminalView.init();
             _gRTerminalView.initWithTerminal(_gRTerminalHandler);
             boxObject.view = _gRTerminalHandler;
@@ -130,7 +141,12 @@
             //["mousedown", "focus"].forEach(function(eventname) {
             //        window.frameElement.addEventListener(eventname, function(event) {
             //        if (event.originalTarget == event.target) {
-            //            document.getElementById("rconsole-deck").focus();
+            //          var deck = document.getElementById("rconsole-deck");
+            //          // In ko7, we need a different code!
+            //          if (deck == null) deck = document
+            //          	.getElementById("sciviews_rconsole_tab")
+            //          	.contentDocument.getElementById("rconsole-deck");	
+            //          deck.focus();
             //        }
             //    }, false);
             //});
@@ -141,12 +157,20 @@
             // by appending the prompt to it
             sv.cmdout.append(":> ", false);
             // Observe keypress event on the R Console panel
-            document.getElementById("rconsole-scintilla")
-                .addEventListener('keypress', sv.rconsole.rconsoleOnKeyPress,
+            var rcons = document.getElementById("rconsole-scintilla");
+            // In ko7, we need a different code!
+            if (rcons == null) rcons = document
+            	.getElementById("sciviews_rconsole_tab")
+            	.contentDocument.getElementById("rconsole-scintilla");	
+            rcons.addEventListener('keypress', sv.rconsole.rconsoleOnKeyPress,
                 true);            
             // And observe keypress events on the R Output panel
-            document.getElementById("rconsole-scintilla2")
-                .addEventListener('keypress', sv.rconsole.routputOnKeyPress,
+            var rcons2 = document.getElementById("rconsole-scintilla2");
+            // In ko7, we need a different code!
+            if (rcons2 == null) rcons2 = document
+                .getElementById("sciviews_rconsole_tab")
+                .contentDocument.getElementById("rconsole-scintilla2");	
+            rcons2.addEventListener('keypress', sv.rconsole.routputOnKeyPress,
                 true);
         } finally {
             ko.main.addWillCloseHandler(sv.rconsole.finalize);
@@ -199,7 +223,12 @@
         _ClearUI();
         
         // Clear the console and make sure work wrap is none
-        //var scimoz = document.getElementById("rconsole-scintilla").scimoz;
+        var terminalView = document.getElementById("rconsole-scintilla");
+        // In ko7, we need a different code!
+        if (terminalView == null) terminalView = document
+            .getElementById("sciviews_rconsole_tab")
+            .contentDocument.getElementById("rconsole-scintilla");
+        //var scimoz = terminalView.scimoz;
         // Note the width of the R console in characters is approximately
         //Math.floor(window.innerWidth / scimoz.textWidth(0, "0")) - 7
         // => set this option in R everytime the Komodo window size changes!
@@ -213,16 +242,23 @@
             .getService(Components.interfaces.koILastErrorService);
         _gRTerminalView.startSession(clearContent);
         _gRTerminalHandler.setCwd(cwd);
-        var terminalView = document.getElementById("rconsole-scintilla");
         terminalView.cwd = cwd;
     
         var descWidget = document.getElementById("rconsole-desc");
+        // In ko7, we need a different code!
+        if (descWidget == null) descWidget = document
+            .getElementById("sciviews_rconsole_tab")
+            .contentDocument.getElementById("rconsole-desc");
         descWidget.setAttribute("value", "R is running (" + command + ")");
         // Store the command name for later use
         descWidget.setAttribute("_command", command);
     
         if (clearContent) {
             var listButton = document.getElementById("rconsole-list-button");
+            // In ko7, we need a different code!
+            if (listButton == null) listButton = document
+                .getElementById("sciviews_rconsole_tab")
+                .contentDocument.getElementById("rconsole-list-button");
             listButton.setAttribute("disabled", "true");
             _gRTerminalView.clear();
         }
@@ -234,6 +270,10 @@
         _gRTerminalView.endSession();
     
         var descWidget = document.getElementById("rconsole-desc");
+        // In ko7, we need a different code!
+        if (descWidget == null) descWidget = document
+            .getElementById("sciviews_rconsole_tab")
+            .contentDocument.getElementById("rconsole-desc");
         var command = descWidget.getAttribute("_command");
         var msg = null;
         var osSvc = Components.classes["@activestate.com/koOs;1"]
@@ -250,6 +290,10 @@
     
         _gRProcess = null;
         var closeButton = document.getElementById("rconsole-close-button");
+        // In ko7, we need a different code!
+        if (closeButton == null) closeButton = document
+            .getElementById("sciviews_rconsole_tab")
+            .contentDocument.getElementById("rconsole-close-button");
         closeButton.setAttribute("disabled", "true");
     }
     
@@ -343,7 +387,7 @@
     
     // Clear the R console and the command history
     this.clear = function RConsole_Clear () {
-        //var scimoz = document.getElementById("runoutput-scintilla").scimoz;
+        //var scimoz = _gTerminalView;
         //var eolChar = ["\r\n", "\n", "\r"][scimoz.eOLMode];
         //var readOnly = scimoz.readOnly;
         //try {
@@ -366,7 +410,6 @@
         if (typeof show == 'undefined' || show == null) show = true;
         if (show) ko.uilayout.ensureTabShown("sciviews_rconsole_tab", false);
         
-        //var scimoz = document.getElementById("runoutput-scintilla").scimoz;
         var scimoz = _gRTerminalView;
         var eolChar = ["\r\n", "\n", "\r"][scimoz.eOLMode];
         if (newline || newline === undefined) command += eolChar;
@@ -399,6 +442,10 @@
         if (_gRTerminalHandler.active) {
             _gRProcess = process;
             var closeButton = document.getElementById("rconsole-close-button");
+            // In ko7, we need a different code!
+            if (closeButton == null) closeButton = document
+                .getElementById("sciviews_rconsole_tab")
+                .contentDocument.getElementById("rconsole-close-button");
             closeButton.removeAttribute("disabled");
         }
     }
@@ -410,13 +457,21 @@
     
     function _SetView (editor, deck) {
         // Ignore editor, always use the window we're in
-        var deckWidget = window.document.getElementById("rconsole-deck");
+        var deckWidget = document.getElementById("rconsole-deck");
+        // In ko7, we need a different code!
+        if (deckWidget == null) deckWidget = document
+            .getElementById("sciviews_rconsole_tab")
+            .contentDocument.getElementById("rconsole-deck");
         deckWidget.setAttribute("selectedIndex", deck);
     }
     
     this.toggleView = function RConsole_ToggleView (newview) {
         if (typeof newview == 'undefined' || newview == null) {
             var deckWidget = document.getElementById("rconsole-deck");
+            // In ko7, we need a different code!
+            if (deckWidget == null) deckWidget = document
+                .getElementById("sciviews_rconsole_tab")
+                .contentDocument.getElementById("rconsole-deck");
             if (deckWidget.getAttribute("selectedIndex") == 1) {
                 newview = 0;
             } else {
@@ -433,8 +488,12 @@
         
     this.onFocus = function RConsole_OnFocus(event) {
         if (event.originalTarget != window) return;
-        var selected = window.document.getElementById("rconsole-deck")
-            .selectedPanel;
+        var deckWidget = document.getElementById("rconsole-deck");
+        // In ko7, we need a different code!
+        if (deckWidget == null) deckWidget = document
+            .getElementById("sciviews_rconsole_tab")
+            .contentDocument.getElementById("rconsole-deck");
+        var selected = deckWidget.selectedPanel;
         if ("scintilla" in selected) {
             selected.scintilla.focus();
         } else {

Modified: komodo/SciViews-K/content/js/robjects.js
===================================================================
--- komodo/SciViews-K/content/js/robjects.js	2012-12-13 15:39:40 UTC (rev 490)
+++ komodo/SciViews-K/content/js/robjects.js	2012-12-15 14:41:37 UTC (rev 491)
@@ -315,12 +315,18 @@
 			var cmd1 = this.getOpenItems(true);
 			var cmd2 = this.treeData.map(function (x)
 				_getObjListCommand(x.fullName,""));
-			cmd = sv.array.unique(cmd1.concat(cmd2)).join("\n");
+			cmd = sv.tools.array.unique(cmd1.concat(cmd2)).join("\n");
 		}
 	
 		isInitialized = true;
-		if (init) document.getElementById("sciviews_robjects_objects_tree")
-			.view = this;
+		if (init) {
+			var tree = document.getElementById("sciviews_robjects_objects_tree");
+			// In ko7, we need a different code!
+			if (tree == null) tree = document	
+				.getElementById("sciviews_robjects_tab").contentDocument
+				.getElementById("sciviews_robjects_objects_tree");
+			tree.view = this;
+		}
 	
 		//print(cmd);
 		// cmd, callback, hidden
@@ -351,6 +357,10 @@
 	// Allow for filtering by exclusion: prepend with "!"
 	function _getFilter () {
 		var tb = document.getElementById("sciviews_robjects_filterbox");
+		// In ko7, we need a different code!
+		if (tb == null) tb = document	
+			.getElementById("sciviews_robjects_tab").contentDocument
+			.getElementById("sciviews_robjects_filterbox");
 		var obRx, text, not;
 		text = tb.value;
 		not = (text[0] == "!");
@@ -501,6 +511,10 @@
 		var columnName, currentElement, tree, sortDirection, realOrder, order,
 			sortDirs;
 		tree = document.getElementById("sciviews_robjects_objects_tree");
+		// In ko7, we need a different code!
+		if (tree == null) tree = document	
+			.getElementById("sciviews_robjects_tab").contentDocument
+			.getElementById("sciviews_robjects_objects_tree");
 		sortDirection = tree.getAttribute("sortDirection");
 		sortDirs = ["descending", "natural", "ascending", "descending"];
 		realOrder = sortDirs.indexOf(sortDirection) - 1;
@@ -576,8 +590,12 @@
 		var cols = tree.getElementsByTagName("treecol");
 		for (var i = 0; i < cols.length; i++)
 			cols[i].removeAttribute("sortDirection");
-		document.getElementById(columnName)
-			.setAttribute("sortDirection", sortDirection);
+		var columnWidget = document.getElementById(columnName);
+		// In ko7, we need a different code!
+		if (columnWidget == null) columnWidget = document	
+			.getElementById("sciviews_robjects_tab").contentDocument
+			.getElementById(columnName);
+		columnWidget.setAttribute("sortDirection", sortDirection);
 
 		if (!root || root == _this.treeData) {
 			// Sort packages always by name
@@ -836,8 +854,13 @@
 			pos = _this.searchPath.indexOf(path);
 			if (pos == -1) return(false);
 
-			document.getElementById("sciviews_robjects_searchpath_listbox")
-				.getItemAtIndex(pos).checked = true;
+			var listWidget = document
+				.getElementById("sciviews_robjects_searchpath_listbox");
+			// In ko7, we need a different code!
+			if (listWidget == null) listWidget = document	
+				.getElementById("sciviews_robjects_tab").contentDocument
+				.getElementById("sciviews_robjects_searchpath_listbox");
+			listWidget.getItemAtIndex(pos).checked = true;
 			_addObject(path, "", _parseObjectList, path);
 			return(true);
 		},
@@ -868,7 +891,12 @@
 	//
 	//	isInitialized = true;
 	//
-	//	document.getElementById("sciviews_robjects_objects_tree").view = this;
+	// var objTree = document.getElementById("sciviews_robjects_objects_tree");
+	// In ko7, we need a different code!
+	//if (objTree == null) objTree = document	
+	//	.getElementById("sciviews_robjects_tab").contentDocument
+	//	.getElementById("sciviews_robjects_objects_tree");
+	//objTree.view = this;
 	//	this.treeBox.scrollToRow(0);
 	//};
 
@@ -890,7 +918,11 @@
 		var pack;
 		var node = document
 			.getElementById("sciviews_robjects_searchpath_listbox");
-		var selectedLabel = node.selectedItem? node.selectedItem.label : null;
+		// In ko7, we need a different code!
+		if (node == null) node = document	
+			.getElementById("sciviews_robjects_tab").contentDocument
+			.getElementById("sciviews_robjects_searchpath_listbox");
+		var selectedLabel = node.selectedItem ? node.selectedItem.label : null;
 		
 		while (node.firstChild)
 			node.removeChild(node.firstChild);
@@ -931,10 +963,18 @@
 		var broadcaster = document
 			.getElementById("cmd_robjects_viewSearchPath");
 		var box = document.getElementById(broadcaster.getAttribute("box"));
+		// In ko7, we need a different code!
+		if (box == null) box = document	
+			.getElementById("sciviews_robjects_tab").contentDocument
+			.getElementById(broadcaster.getAttribute("box"));
 
 		if (what == "splitter" || what == "grippy") {
-			var state = document.getElementById("sciviews_robjects_splitter")
-				.getAttribute("state");
+			var splitter = document.getElementById("sciviews_robjects_splitter");
+			// In ko7, we need a different code!
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/sciviews -r 491


More information about the Sciviews-commits mailing list