From bf26359e069a68fca62a15665065d74d9e3f137c Mon Sep 17 00:00:00 2001 From: SHIMODA Hiroshi Date: Mon, 29 Nov 2010 19:24:27 +0900 Subject: [PATCH] allow to collapse tol-level tree if maxTreeLevel==0 --- content/treestyletab/treestyletabbrowser.js | 11 ++++++++++- defaults/preferences/treestyletab.js | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index e0ebfba5..2c5ebc3e 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -1454,6 +1454,7 @@ TreeStyleTabBrowser.prototype = { resetTabbarSize : function TSTBrowser_resetTabbarSize() { if (this.isVertical) { + this.clearTreePref('tabbar.shrunkenWidth'); this.clearTreePref('tabbar.width'); } @@ -1524,6 +1525,7 @@ TreeStyleTabBrowser.prototype = { var orient = this.isVertical ? 'vertical' : 'horizontal' ; var oldState = { fixed : this.isFixed, + maxTreeLevel : this.maxTreeLevel, indented : this.maxTreeLevel != 0, canCollapse : b.getAttribute(this.kALLOW_COLLAPSE) == 'true' }; @@ -1533,6 +1535,7 @@ TreeStyleTabBrowser.prototype = { } var newState = { fixed : this.getTreePref('tabbar.fixed.'+orient), + maxTreeLevel : this.getTreePref('maxTreeLevel.'+orient), indented : this.getTreePref('maxTreeLevel.'+orient) != 0, canCollapse : this.getTreePref('allowSubtreeCollapseExpand.'+orient) }; @@ -1542,6 +1545,7 @@ TreeStyleTabBrowser.prototype = { } if (oldState.fixed == newState.fixed && + oldState.maxTreeLevel == newState.maxTreeLevel && oldState.indented == newState.indented && oldState.canCollapse == newState.canCollapse && oldState.alltabsButton == newState.alltabsButton) @@ -1562,6 +1566,7 @@ TreeStyleTabBrowser.prototype = { var b = this.mTabBrowser; var state = { fixed : this.isFixed, + maxTreeLevel : this.maxTreeLevel, indented : this.maxTreeLevel != 0, canCollapse : b.getAttribute(this.kALLOW_COLLAPSE) == 'true' }; @@ -4195,7 +4200,11 @@ TreeStyleTabBrowser.prototype = { if (!aTab.parentNode) return; // ignore removed tabs this.updateTabIndent(aTab, indent, aJustNow); aTab.setAttribute(this.kNEST, aLevel); - if (this.maxTreeLevel < 0 || this.maxTreeLevel > aLevel) { + if ( + !aLevel || + this.maxTreeLevel < 0 || + this.maxTreeLevel > aLevel + ) { aTab.setAttribute(this.kALLOW_COLLAPSE, true); this.collapseExpandSubtree(aTab, this.isSubtreeCollapsed(aTab)); } diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index 5062a06f..c2fc80cc 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -53,7 +53,7 @@ pref("extensions.treestyletab.autoExpand.enabled", true); pref("extensions.treestyletab.autoExpand.delay", 500); pref("extensions.treestyletab.autoExpand.intelligently", true); pref("extensions.treestyletab.autoExpand.collapseFinally", false); -pref("extensions.treestyletab.maxTreeLevel.horizontal", 1); +pref("extensions.treestyletab.maxTreeLevel.horizontal", 0); pref("extensions.treestyletab.maxTreeLevel.vertical", -1); pref("extensions.treestyletab.maxTreeLevel.phisical", false); pref("extensions.treestyletab.indent", 12);