From 47ab810c5e72f555a8a610377a922c0a019d1190 Mon Sep 17 00:00:00 2001 From: Infocatcher Date: Thu, 30 Aug 2012 21:42:56 +0400 Subject: [PATCH 1/4] Add separate indent preferences for horizontal tabs --- defaults/preferences/treestyletab.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index 3762bde7..e60a013d 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -271,8 +271,10 @@ pref("extensions.treestyletab.maxTreeLevel.phisical", false); * If you set "autoShrink.onlyForVisible" to "false", TST keeps indent size * shrunken even if "too deeply nested" tabs are invisible. */ -pref("extensions.treestyletab.indent", 12); -pref("extensions.treestyletab.indent.min", 3); +pref("extensions.treestyletab.indent", 12); +pref("extensions.treestyletab.indent.horizontal", 4); +pref("extensions.treestyletab.indent.min", 3); +pref("extensions.treestyletab.indent.min.horizontal", 1); pref("extensions.treestyletab.indent.autoShrink", true); pref("extensions.treestyletab.indent.autoShrink.onlyForVisible", true); /** From 5f29a2dc5f9de21838bf0e63b3158dcb4b2ca38e Mon Sep 17 00:00:00 2001 From: Infocatcher Date: Thu, 30 Aug 2012 21:46:50 +0400 Subject: [PATCH 2/4] Add separate indent preferences for horizontal tabs Note: original code doesn't handle "extensions.treestyletab.indent.min" change. --- modules/utils.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/utils.js b/modules/utils.js index 6eee61eb..64149c29 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -250,7 +250,8 @@ var TreeStyleTabUtils = { DEFAULT_SHRUNKEN_WIDTH_RATIO : 0.67, /* base variables */ - baseIndent : 12, + baseIndentVertical : 12, + baseIndentHorizontal : 4, shouldDetectClickOnIndentSpaces : true, smoothScrollEnabled : true, @@ -361,6 +362,7 @@ var TreeStyleTabUtils = { this.addPrefListener(this); this.onPrefChange('extensions.treestyletab.indent'); + this.onPrefChange('extensions.treestyletab.indent.horizontal'); this.onPrefChange('extensions.treestyletab.clickOnIndentSpaces.enabled'); this.onPrefChange('browser.tabs.loadFolderAndReplace.override'); this.onPrefChange('browser.tabs.insertRelatedAfterCurrent.override'); @@ -2697,7 +2699,11 @@ var TreeStyleTabUtils = { switch (aPrefName) { case 'extensions.treestyletab.indent': - this.baseIndent = value; + this.baseIndentVertical = value; + this.ObserverService.notifyObservers(null, this.kTOPIC_INDENT_MODIFIED, value); + return; + case 'extensions.treestyletab.indent.horizontal': + this.baseIndentHorizontal = value; this.ObserverService.notifyObservers(null, this.kTOPIC_INDENT_MODIFIED, value); return; From 9fc8f4a8828d556dc13851f969dfa94d2747aa29 Mon Sep 17 00:00:00 2001 From: Infocatcher Date: Thu, 30 Aug 2012 21:51:21 +0400 Subject: [PATCH 3/4] Add separate indent preferences for horizontal tabs Note: I think, we should cache "this.isVertical"... Only TST itself can change tab bar position, so this looks simple to implement. --- modules/browser.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/browser.js b/modules/browser.js index 6bb31080..01748b40 100644 --- a/modules/browser.js +++ b/modules/browser.js @@ -163,6 +163,10 @@ TreeStyleTabBrowser.prototype = { }, _maxTreeLevel : -1, + get baseIndent() { + return this.isVertical ? this.baseIndentVertical : this.baseIndentHorizontal; + }, + get enableSubtreeIndent() { return this._enableSubtreeIndent; @@ -5295,15 +5299,17 @@ TreeStyleTabBrowser.prototype = { this.getFirstNormalTab(b).boxObject[this.invertedSizeProp], b.mTabContainer.boxObject[this.invertedSizeProp] ); - if (!this.isVertical) { + var isVertical = this.isVertical; + if (!isVertical) { if (this._horizontalTabMaxIndentBase) maxIndentBase = this._horizontalTabMaxIndentBase; else this._horizontalTabMaxIndentBase = maxIndentBase; } - var maxIndent = maxIndentBase * (this.isVertical ? 0.33 : 0.5 ); + var maxIndent = maxIndentBase * (isVertical ? 0.33 : 0.5 ); - var indentUnit = Math.max(Math.floor(maxIndent / nest), this.getTreePref('indent.min')); + var indentMin = this.getTreePref(isVertical ? 'indent.min' : 'indent.min.horizontal'); + var indentUnit = Math.max(Math.floor(maxIndent / nest), indentMin); if (indent > maxIndent) { this.indent = indentUnit; } From 1aa4f0e97ac312f2d951722d3d686ec6af58505b Mon Sep 17 00:00:00 2001 From: Piro / YUKI Hiroshi Date: Fri, 31 Aug 2012 03:48:00 +0900 Subject: [PATCH 4/4] Rename preferences for vertical tab bar with the suffix ".vertical" --- defaults/preferences/treestyletab.js | 4 ++-- modules/browser.js | 2 +- modules/utils.js | 11 ++++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index e60a013d..1210cfac 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -271,9 +271,9 @@ pref("extensions.treestyletab.maxTreeLevel.phisical", false); * If you set "autoShrink.onlyForVisible" to "false", TST keeps indent size * shrunken even if "too deeply nested" tabs are invisible. */ -pref("extensions.treestyletab.indent", 12); +pref("extensions.treestyletab.indent.vertical", 12); pref("extensions.treestyletab.indent.horizontal", 4); -pref("extensions.treestyletab.indent.min", 3); +pref("extensions.treestyletab.indent.min.vertical", 3); pref("extensions.treestyletab.indent.min.horizontal", 1); pref("extensions.treestyletab.indent.autoShrink", true); pref("extensions.treestyletab.indent.autoShrink.onlyForVisible", true); diff --git a/modules/browser.js b/modules/browser.js index 01748b40..ac2fe16f 100644 --- a/modules/browser.js +++ b/modules/browser.js @@ -5308,7 +5308,7 @@ TreeStyleTabBrowser.prototype = { } var maxIndent = maxIndentBase * (isVertical ? 0.33 : 0.5 ); - var indentMin = this.getTreePref(isVertical ? 'indent.min' : 'indent.min.horizontal'); + var indentMin = this.getTreePref(isVertical ? 'indent.min.vertical' : 'indent.min.horizontal'); var indentUnit = Math.max(Math.floor(maxIndent / nest), indentMin); if (indent > maxIndent) { this.indent = indentUnit; diff --git a/modules/utils.js b/modules/utils.js index 64149c29..3c62a51c 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -361,7 +361,7 @@ var TreeStyleTabUtils = { this.addPrefListener(this); - this.onPrefChange('extensions.treestyletab.indent'); + this.onPrefChange('extensions.treestyletab.indent.vertical'); this.onPrefChange('extensions.treestyletab.indent.horizontal'); this.onPrefChange('extensions.treestyletab.clickOnIndentSpaces.enabled'); this.onPrefChange('browser.tabs.loadFolderAndReplace.override'); @@ -415,7 +415,7 @@ var TreeStyleTabUtils = { this.setDefaultPref(key, this.getPref(originalKey)); } }, - kPREF_VERSION : 8, + kPREF_VERSION : 9, migratePrefs : function TSTUtils_migratePrefs() { // migrate old prefs @@ -519,6 +519,11 @@ var TreeStyleTabUtils = { if (delay !== null) this.setTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay', delay); } + case 8: + orientalPrefs = orientalPrefs.concat([ + 'extensions.treestyletab.indent', + 'extensions.treestyletab.indent.min' + ]); default: for (let i = 0, maxi = orientalPrefs.length; i < maxi; i++) { @@ -2698,7 +2703,7 @@ var TreeStyleTabUtils = { var value = this.getPref(aPrefName); switch (aPrefName) { - case 'extensions.treestyletab.indent': + case 'extensions.treestyletab.indent.vertical': this.baseIndentVertical = value; this.ObserverService.notifyObservers(null, this.kTOPIC_INDENT_MODIFIED, value); return;