changeset 1:601d7c30681d

Port to Komodo 7 working. Add an icon. Make bookmark list update dynamically and trim line content.
author Peter Geer <pageer@skepticats.com>
date Sat, 25 Aug 2012 09:55:06 -0400
parents 0ebd7c7a83cb
children 5e91def41a82
files chrome.manifest chrome.p.manifest content/bookmarks/bookmarks-pane.xul content/bookmarks/bookmarksOverlay.js content/bookmarks/bookmarksOverlay.xul content/bookmarks/bookmarksTreeview.js content/editPosition/editPosition.js content/tabSwitcher/tabSwitcher.js content/tabswitchMenu.xul content/tabswitchMenuKO5.xul content/tabswitchMenuKO6.xul install.rdf skin/icon.png tabswitcher-0.9.2-ko.xpi tabswitcher-1.0.0-ko.xpi
diffstat 15 files changed, 131 insertions(+), 157 deletions(-) [+]
line wrap: on
line diff
--- a/chrome.manifest	Sat Aug 18 13:10:14 2012 -0400
+++ b/chrome.manifest	Sat Aug 25 09:55:06 2012 -0400
@@ -11,6 +11,5 @@
 
 overlay	chrome://komodo/content/komodo.xul	chrome://tabswitcher/content/tabswitchOverlay.xul
 overlay	chrome://komodo/content/komodo.xul	chrome://tabswitcher/content/bookmarks/bookmarksOverlay.xul
-overlay	chrome://komodo/content/komodo.xul	chrome://tabswitcher/content/tabswitchMenuKO5.xul appversion<6b1
-overlay	chrome://komodo/content/komodo.xul	chrome://tabswitcher/content/tabswitchMenuKO6.xul appversion>6b1
+overlay	chrome://komodo/content/komodo.xul	chrome://tabswitcher/content/tabswitchMenu.xul
 overlay	chrome://komodo/content/pref/pref.xul	chrome://tabswitcher/content/pref/prefOverlay.xul
--- a/chrome.p.manifest	Sat Aug 18 13:10:14 2012 -0400
+++ b/chrome.p.manifest	Sat Aug 25 09:55:06 2012 -0400
@@ -11,6 +11,5 @@
 
 overlay	chrome://komodo/content/komodo.xul	chrome://tabswitcher/content/tabswitchOverlay.xul
 overlay	chrome://komodo/content/komodo.xul	chrome://tabswitcher/content/bookmarks/bookmarksOverlay.xul
-overlay	chrome://komodo/content/komodo.xul	chrome://tabswitcher/content/tabswitchMenuKO5.xul appversion<6b1
-overlay	chrome://komodo/content/komodo.xul	chrome://tabswitcher/content/tabswitchMenuKO6.xul appversion>6b1
+overlay	chrome://komodo/content/komodo.xul	chrome://tabswitcher/content/tabswitchMenu.xul
 overlay	chrome://komodo/content/pref/pref.xul	chrome://tabswitcher/content/pref/prefOverlay.xul
--- a/content/bookmarks/bookmarks-pane.xul	Sat Aug 18 13:10:14 2012 -0400
+++ b/content/bookmarks/bookmarks-pane.xul	Sat Aug 25 09:55:06 2012 -0400
@@ -19,9 +19,6 @@
     <script type="application/x-javascript"
             src="chrome://komodo/content/library/logging.js" />
     <script type="application/x-javascript"
-            src="chrome://komodo/content/library/uilayout.js" />
-  
-    <script type="application/x-javascript"
             src="chrome://tabswitcher/content/common.js" />
     <script type="application/x-javascript"
             src="chrome://tabswitcher/content/bookmarks/bookmarksTreeview.js" />
@@ -34,15 +31,15 @@
                    flex="1"
                    bookmarklabel="&viewswitcher.bookmark.found;"/>
             <separator flex="1"/>
-            <button id="viewswitcher_bookmarks-refresh"
+            <toolbarbutton id="viewswitcher_bookmarks-refresh"
                     class="button-viewswitcher-refresh button-toolbar-a"
                     tooltiptext="&viewswitcher.bookmark.refresh.tooltip;"
                     oncommand="gViewSwitcherBookmarks.onRefresh();"/>
-            <button id="viewswitcher_bookmarks-remove-selected"
+            <toolbarbutton id="viewswitcher_bookmarks-remove-selected"
                     class="button-viewswitcher-remove-selected button-toolbar-a"
                     tooltiptext="&viewswitcher.bookmark.remove.selected.label;"
                     oncommand="gViewSwitcherBookmarks.onRemoveSelected();"/>
-            <button id="viewswitcher_bookmarks-remove-all"
+            <toolbarbutton id="viewswitcher_bookmarks-remove-all"
                     class="button-viewswitcher-remove-all button-toolbar-a"
                     tooltiptext="&viewswitcher.bookmark.remove.all.label;"
                     oncommand="gViewSwitcherBookmarks.onRemoveAll();"/>
--- a/content/bookmarks/bookmarksOverlay.js	Sat Aug 18 13:10:14 2012 -0400
+++ b/content/bookmarks/bookmarksOverlay.js	Sat Aug 25 09:55:06 2012 -0400
@@ -116,6 +116,19 @@
                                 this.handle_view_opened_setup, false);
         window.addEventListener('view_closed',
                                 this.handle_view_closed_setup, false);
+        
+        // NOTE: Taken from http://community.activestate.com/node/8939
+        // Seems a little hacky, but it's simple and it works.
+        var elems = new Array();
+        elems.push(top.document.getElementById('cmd_bookmarkToggle'));
+        elems.push(top.document.getElementById('cmd_bookmarkRemoveAll'));
+        for (var i = 0; i < elems.length; i++) {
+            if(elems[i]){
+                 var my_funct= "setTimeout(function(){ ko.extensions.tabswitcher.bookmarks.onRefresh();},500);";
+                 var ko_funct=elems[i].getAttribute('oncommand');
+                 elems[i].setAttribute('oncommand', ko_funct+';'+my_funct);
+            }
+        }
     },
 
     removeListeners : function() {
@@ -131,8 +144,23 @@
 
     onViewClosed : function(event) {
         this.onRefresh();
+    },
+    
+    focus : function() {
+        this.onRefresh();
+        document.getElementById("viewswitcher_bookmarks-tree").focus();
     }
 }
+if (typeof(ko) == 'undefined') {
+    ko = {};
+}
+if (typeof(ko.extensions) == 'undefined') {
+    ko.extensions = {};
+}
+if (typeof(ko.extensions.tabswitcher) == 'undefined') {
+    ko.extensions.tabswitcher = {};
+}
+ko.extensions.tabswitcher.bookmarks = gViewSwitcherBookmarks;
 
 window.addEventListener("load", function(event) {gViewSwitcherBookmarks.onLoad(event)}, false);
 window.addEventListener("unload", function(event) {gViewSwitcherBookmarks.onUnLoad(event)}, false);
--- a/content/bookmarks/bookmarksOverlay.xul	Sat Aug 18 13:10:14 2012 -0400
+++ b/content/bookmarks/bookmarksOverlay.xul	Sat Aug 25 09:55:06 2012 -0400
@@ -22,13 +22,13 @@
             label="&viewswitcher.bookmark.tab.title;"
             />
     </menupopup>
-    <!-- TODO: test -->
+    
     <ko-pane id="workspace_bottom_area">
         <browser type="ko-widget"
                  id="viewswitcher_bookmarks_tab"
                  label="&viewswitcher.bookmark.tab.title;"
                  src="chrome://tabswitcher/content/bookmarks/bookmarks-pane.xul"
-                 tab_onfocus="ko.extensions.tabswitcher.focus();" />
+                 tab_onfocus="ko.extensions.tabswitcher.bookmarks.focus();" />
     </ko-pane>
 
 </overlay>
--- a/content/bookmarks/bookmarksTreeview.js	Sat Aug 18 13:10:14 2012 -0400
+++ b/content/bookmarks/bookmarksTreeview.js	Sat Aug 25 09:55:06 2012 -0400
@@ -196,10 +196,10 @@
     getCellText : function(row, column) {
         switch (column.id || column) {
             case "viewswitcher_bookmarks-filename":
-                if (ko.views.manager.currentView.document.file) {
-                    return this.items[row].view.document.file.path;
+                if (ko.views.manager.currentView.koDoc.file) {
+                    return this.items[row].view.koDoc.file.displayPath;
                 } else {
-                    return this.items[row].view.document.displayPath;
+                    return this.items[row].view.koDoc.displayPath;
                 }
             case "viewswitcher_bookmarks-linenum":
                 return this.items[row].line + 1;
@@ -207,7 +207,7 @@
                 var scimoz = this.items[row].view.scintilla.scimoz;
                 var lineStart = scimoz.positionFromLine(this.items[row].line);
                 var lineEnd = scimoz.getLineEndPosition(this.items[row].line);
-                return scimoz.getTextRange(lineStart, lineEnd);
+                return scimoz.getTextRange(lineStart, lineEnd).trim();
         }
 
         return "";
--- a/content/editPosition/editPosition.js	Sat Aug 18 13:10:14 2012 -0400
+++ b/content/editPosition/editPosition.js	Sat Aug 25 09:55:06 2012 -0400
@@ -212,11 +212,11 @@
             };
             //DafizillaCommon.log("pushEdit");
 
-            if (!currentView.document) {
+            if (!currentView.koDoc) {
                 return;
             }
 
-            if (!currentView.document.isDirty) {
+            if (!currentView.koDoc.isDirty) {
                 return;
             }
 
@@ -471,7 +471,7 @@
                 var text = view.title+" l:"+(item.line+1)+" c:"+(item.col+1);
                 mi.setAttribute("label", text);
                 mi.setAttribute("crop", "center");
-                mi.setAttribute("tooltiptext", view.document.displayPath);
+                mi.setAttribute("tooltiptext", view.koDoc.displayPath);
                 mi.setAttribute("oncommand", command.replace("%1", index));
                 menu.appendChild(mi);
             }
@@ -494,7 +494,7 @@
             if (editPos) {
                 var currentView = ko.views.manager.currentView;
 
-                if (currentView.document) {
+                if (currentView.koDoc) {
                     var currPos = currentView.scimoz.currentPos;
                     var currLine = currentView.scimoz.lineFromPosition(currPos);
 
@@ -589,7 +589,7 @@
 
     viewOpened : function(view) {
         try {
-            if (view.document) {
+            if (view.koDoc) {
                 if (this.prefs.editShowMarkers) {
                     var scimoz = view.scimoz;
 
--- a/content/tabSwitcher/tabSwitcher.js	Sat Aug 18 13:10:14 2012 -0400
+++ b/content/tabSwitcher/tabSwitcher.js	Sat Aug 25 09:55:06 2012 -0400
@@ -126,8 +126,8 @@
 
         var selectedItem = this.tabTreeView.currentSelectedItem;
         var path = "";
-        if (selectedItem && selectedItem.document) {
-            path = selectedItem.document.file.dirName;
+        if (selectedItem) {
+            path = selectedItem.koDoc.file.dirName;
         }
         document.getElementById("view-path").value = path;
         this.isInputInProgress = false;
@@ -157,8 +157,8 @@
     onSelect : function() {
         if (!this.isInputInProgress) {
             var selectedItem = this.tabTreeView.currentSelectedItem;
-            if (selectedItem && selectedItem.document) {
-                document.getElementById("view-path").value = selectedItem.document.file.dirName;
+            if (selectedItem) {
+                document.getElementById("view-path").value = selectedItem.koDoc.file.dirName;
             }
         }
     },
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/content/tabswitchMenu.xul	Sat Aug 25 09:55:06 2012 -0400
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE overlay SYSTEM "chrome://tabswitcher/locale/tabswitcher.dtd" >
+
+<overlay id="tabswitchMenuKO5"
+         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+    <menupopup id="naviation_menupopup">
+        <menuitem id="tabswitcher-select-view"
+                    class="menuitem-iconic-wide"
+                    label="&menuitem-tabswitcher-select-view.label;"
+                    command="cmd_tabswitcher_show"
+                    key="key_cmd_tabswitcher_show"
+                    insertbefore="naviation_menupopup_separator_2"/>
+
+        <menu label="&menuitem-sort.tabs.label;" id="tabswitcher-window-sorters"
+          insertbefore="naviation_menupopup_separator_2">
+            <menupopup id="tabswitcher-menupopup-window-sorters">
+              <menuitem id="tabswitcher-window-sort-by-name"
+                          class="menuitem-iconic-wide"
+                          label="&menuitem-sort.tabs.by.name.label;"
+                          command="cmd_tabswitcher_sort_by_name"
+                          key="key_cmd_tabswitcher_sort_by_name"/>
+              <menuitem id="tabswitcher-window-sort-by-ext"
+                          class="menuitem-iconic-wide"
+                          label="&menuitem-sort.tabs.by.ext.label;"
+                          command="cmd_tabswitcher_sort_by_ext"
+                          key="key_cmd_tabswitcher_sort_by_ext"/>
+            </menupopup>
+        </menu>
+    </menupopup>
+
+    <menupopup id="tabContextMenu">
+        <menuseparator />
+        <menu label="&menuitem-sort.tabs.label;" id="tabswitcher-context-sorters">
+            <menupopup id="tabswitcher-menupopup-context-sorters">
+              <menuitem id="tabswitcher-context-sort-by-name"
+                          class="menuitem-iconic-wide"
+                          label="&menuitem-sort.tabs.by.name.label;"
+                          command="cmd_tabswitcher_sort_by_name"
+                          key="key_cmd_tabswitcher_sort_by_name"/>
+              <menuitem id="tabswitcher-context-sort-by-ext"
+                          class="menuitem-iconic-wide"
+                          label="&menuitem-sort.tabs.by.ext.label;"
+                          command="cmd_tabswitcher_sort_by_ext"
+                          key="key_cmd_tabswitcher_sort_by_ext"/>
+            </menupopup>
+        </menu>
+    </menupopup>
+
+</overlay>
--- a/content/tabswitchMenuKO5.xul	Sat Aug 18 13:10:14 2012 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE overlay SYSTEM "chrome://tabswitcher/locale/tabswitcher.dtd" >
-
-<overlay id="tabswitchMenuKO5"
-         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-    <menupopup id="popup_window">
-        <menuitem id="tabswitcher-select-view"
-                    class="menuitem-iconic-wide"
-                    label="&menuitem-tabswitcher-select-view.label;"
-                    command="cmd_tabswitcher_show"
-                    key="key_cmd_tabswitcher_show"
-                    insertbefore="window-menu-separator"/>
-
-        <menu label="&menuitem-sort.tabs.label;" id="tabswitcher-window-sorters"
-          insertbefore="window-menu-separator">
-            <menupopup id="tabswitcher-menupopup-window-sorters">
-              <menuitem id="tabswitcher-window-sort-by-name"
-                          class="menuitem-iconic-wide"
-                          label="&menuitem-sort.tabs.by.name.label;"
-                          command="cmd_tabswitcher_sort_by_name"
-                          key="key_cmd_tabswitcher_sort_by_name"/>
-              <menuitem id="tabswitcher-window-sort-by-ext"
-                          class="menuitem-iconic-wide"
-                          label="&menuitem-sort.tabs.by.ext.label;"
-                          command="cmd_tabswitcher_sort_by_ext"
-                          key="key_cmd_tabswitcher_sort_by_ext"/>
-            </menupopup>
-        </menu>
-    </menupopup>
-
-    <menupopup id="tabContextMenu">
-        <menuseparator />
-        <menu label="&menuitem-sort.tabs.label;" id="tabswitcher-context-sorters">
-            <menupopup id="tabswitcher-menupopup-context-sorters">
-              <menuitem id="tabswitcher-context-sort-by-name"
-                          class="menuitem-iconic-wide"
-                          label="&menuitem-sort.tabs.by.name.label;"
-                          command="cmd_tabswitcher_sort_by_name"
-                          key="key_cmd_tabswitcher_sort_by_name"/>
-              <menuitem id="tabswitcher-context-sort-by-ext"
-                          class="menuitem-iconic-wide"
-                          label="&menuitem-sort.tabs.by.ext.label;"
-                          command="cmd_tabswitcher_sort_by_ext"
-                          key="key_cmd_tabswitcher_sort_by_ext"/>
-            </menupopup>
-        </menu>
-    </menupopup>
-
-</overlay>
-
--- a/content/tabswitchMenuKO6.xul	Sat Aug 18 13:10:14 2012 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE overlay SYSTEM "chrome://tabswitcher/locale/tabswitcher.dtd" >
-
-<overlay id="tabswitchMenuKO5"
-         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-    <menupopup id="naviation_menupopup">
-        <menuitem id="tabswitcher-select-view"
-                    class="menuitem-iconic-wide"
-                    label="&menuitem-tabswitcher-select-view.label;"
-                    command="cmd_tabswitcher_show"
-                    key="key_cmd_tabswitcher_show"
-                    insertbefore="naviation_menupopup_separator_2"/>
-
-        <menu label="&menuitem-sort.tabs.label;" id="tabswitcher-window-sorters"
-          insertbefore="naviation_menupopup_separator_2">
-            <menupopup id="tabswitcher-menupopup-window-sorters">
-              <menuitem id="tabswitcher-window-sort-by-name"
-                          class="menuitem-iconic-wide"
-                          label="&menuitem-sort.tabs.by.name.label;"
-                          command="cmd_tabswitcher_sort_by_name"
-                          key="key_cmd_tabswitcher_sort_by_name"/>
-              <menuitem id="tabswitcher-window-sort-by-ext"
-                          class="menuitem-iconic-wide"
-                          label="&menuitem-sort.tabs.by.ext.label;"
-                          command="cmd_tabswitcher_sort_by_ext"
-                          key="key_cmd_tabswitcher_sort_by_ext"/>
-            </menupopup>
-        </menu>
-    </menupopup>
-
-    <menupopup id="tabContextMenu">
-        <menuseparator />
-        <menu label="&menuitem-sort.tabs.label;" id="tabswitcher-context-sorters">
-            <menupopup id="tabswitcher-menupopup-context-sorters">
-              <menuitem id="tabswitcher-context-sort-by-name"
-                          class="menuitem-iconic-wide"
-                          label="&menuitem-sort.tabs.by.name.label;"
-                          command="cmd_tabswitcher_sort_by_name"
-                          key="key_cmd_tabswitcher_sort_by_name"/>
-              <menuitem id="tabswitcher-context-sort-by-ext"
-                          class="menuitem-iconic-wide"
-                          label="&menuitem-sort.tabs.by.ext.label;"
-                          command="cmd_tabswitcher_sort_by_ext"
-                          key="key_cmd_tabswitcher_sort_by_ext"/>
-            </menupopup>
-        </menu>
-    </menupopup>
-
-</overlay>
--- a/install.rdf	Sat Aug 18 13:10:14 2012 -0400
+++ b/install.rdf	Sat Aug 25 09:55:06 2012 -0400
@@ -1,33 +1,36 @@
 <?xml version="1.0"?>
 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
-     xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-    <Description about="urn:mozilla:install-manifest">
-        <em:id>tabswitcher@skepticats.com</em:id>
-        <em:name>tabswitcher</em:name>
-        <em:version>1.0.0</em:version>
-        <em:description>This is a port of TabSwitcher 0.9.1 to Komodo 7.  It allows you to easily switch between tabs, sort them, list bookmarks, and more.</em:description>
-        <em:creator>Peter A. Geer</em:creator>
-	<em:contributor>Davide Ficano, aka dafizilla, originally created this extension and did all the hard work.</em:contributor>
-	<em:contributor>Nathan Rijksen for sort tabs idea and code</em:contributor>
-	<em:contributor>Adam Groszer for granularity code</em:contributor>
-        <em:homepageURL>http://linlog.skepticats.com/projects/tabswitcher/</em:homepageURL>
-        <em:type>2</em:type> <!-- type=extension --> 
+	 xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+	<Description about="urn:mozilla:install-manifest">
+		<em:id>tabswitcher@skepticats.com</em:id>
+		<em:name>TabSwitcher</em:name>
+		<em:version>1.0.0</em:version>
+		<em:description>Allows you to easily switch between tabs, list bookmarks, and navigate between edit positions.</em:description>
+		<em:creator>Peter Geer</em:creator>
+		<em:contributor>Davide Ficano originally created this extension and did all the hard work.</em:contributor>
+		<em:contributor>Nathan Rijksen for sort tabs idea and code</em:contributor>
+		<em:contributor>Adam Groszer for granularity code</em:contributor>
+		<em:iconURL>chrome://tabswitcher/skin/icon.png</em:iconURL>
+		<em:type>2</em:type> <!-- type=extension --> 
+		<!-- Leave empty to use the default Komodo settings -->
+		<em:homepageURL></em:homepageURL>
+		<em:updateURL></em:updateURL>
 
-        <em:targetApplication>
-            <Description>
-                <!-- Komodo IDE's uuid -->
-                <em:id>{36E66FA0-F259-11D9-850E-000D935D3368}</em:id>
-                <em:minVersion>7.0</em:minVersion>
-                <em:maxVersion>7.*</em:maxVersion>
-            </Description>
-        </em:targetApplication>
-        <em:targetApplication>
-            <Description>
-                <!-- Komodo Edit's uuid -->
-                <em:id>{b1042fb5-9e9c-11db-b107-000d935d3368}</em:id>
-                <em:minVersion>7.0</em:minVersion>
-                <em:maxVersion>7.*</em:maxVersion>
-            </Description>
-        </em:targetApplication>
-    </Description>
+		<em:targetApplication>
+			<Description>
+				<!-- Komodo IDE's uuid -->
+				<em:id>{36E66FA0-F259-11D9-850E-000D935D3368}</em:id>
+				<em:minVersion>7.0</em:minVersion>
+				<em:maxVersion>7.*</em:maxVersion>
+			</Description>
+		</em:targetApplication>
+		<em:targetApplication>
+			<Description>
+				<!-- Komodo Edit's uuid -->
+				<em:id>{b1042fb5-9e9c-11db-b107-000d935d3368}</em:id>
+				<em:minVersion>7.0</em:minVersion>
+				<em:maxVersion>7.*</em:maxVersion>
+			</Description>
+		</em:targetApplication>
+	</Description>
 </RDF>
Binary file skin/icon.png has changed
Binary file tabswitcher-0.9.2-ko.xpi has changed
Binary file tabswitcher-1.0.0-ko.xpi has changed