diff --git a/content/treestyletab/config.js b/content/treestyletab/config.js index 5cea31a0..394f3c64 100644 --- a/content/treestyletab/config.js +++ b/content/treestyletab/config.js @@ -1,4 +1,5 @@ var gGroupBookmarkRadio, gGroupBookmarkTree, gGroupBookmarkReplace; +var gTabbarPlacePositionInitialized = false; function initGroupBookmarkRadio() { @@ -19,9 +20,24 @@ function onChangeGroupBookmarkRadio() } -function onChangeTabbarPosition() +function onChangeTabbarPosition(aOnChange) { var pos = document.getElementById('extensions.treestyletab.tabbar.position-radiogroup').value; document.getElementById('extensions.treestyletab.tabbar.invertScrollbar-check').disabled = pos != 'left'; document.getElementById('extensions.treestyletab.tabbar.invertUI-check').disabled = pos != 'right'; + + var indentPref = document.getElementById('extensions.treestyletab.enableSubtreeIndent'); + var collapsePref = document.getElementById('extensions.treestyletab.allowSubtreeCollapseExpand'); + var indentCheck = document.getElementById('extensions.treestyletab.enableSubtreeIndent-check'); + var collapseCheck = document.getElementById('extensions.treestyletab.allowSubtreeCollapseExpand-check'); + if (aOnChange) { + indentPref.value = indentCheck.checked = + collapsePref.value = collapseCheck.checked = (pos == 'left' || pos == 'right'); + } + if (pos == 'left' || pos == 'right') + indentCheck.setAttribute('style', 'visibility:hidden'); + else + indentCheck.removeAttribute('style', 'visibility:hidden'); + + gTabbarPlacePositionInitialized = true; } diff --git a/content/treestyletab/config.xul b/content/treestyletab/config.xul index 986f9944..24a4092c 100644 --- a/content/treestyletab/config.xul +++ b/content/treestyletab/config.xul @@ -22,6 +22,12 @@ + + @@ -38,10 +44,11 @@ label="&config.tabbar.scroll.smooth;"/> + + oncommand="onChangeTabbarPosition(true);"> @@ -79,6 +86,15 @@ + + + + + diff --git a/content/treestyletab/treestyletab.css b/content/treestyletab/treestyletab.css index 6223fb0b..1809564a 100644 --- a/content/treestyletab/treestyletab.css +++ b/content/treestyletab/treestyletab.css @@ -1,21 +1,21 @@ @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); @namespace html url("http://www.w3.org/1999/xhtml"); -tab .treestyletab-twisty, -tab .treestyletab-counter-container, -tab .treestyletab-drop-marker, -tab[treestyletab-children]:not([treestyletab-subtree-collapsed="true"]) .treestyletab-counter-container, +.tabbrowser-tab .treestyletab-twisty, +.tabbrowser-tab .treestyletab-counter-container, +.tabbrowser-tab .treestyletab-drop-marker, +.tabbrowser-tab[treestyletab-children]:not([treestyletab-subtree-collapsed="true"]) .treestyletab-counter-container, tabbrowser:not([treestyletab-vertical="true"]) > tabbox > splitter { display: none; } -tab[treestyletab-children] .treestyletab-twisty, -tab[treestyletab-children] .treestyletab-counter-container, -tab[treestyletab-drop-position] .treestyletab-drop-marker { +tabbrowser[treestyletab-allow-subtree-collapse="true"] .tabbrowser-tab[treestyletab-children] .treestyletab-twisty, +tabbrowser[treestyletab-allow-subtree-collapse="true"] .tabbrowser-tab[treestyletab-children] .treestyletab-counter-container, +.tabbrowser-tab[treestyletab-drop-position] .treestyletab-drop-marker { display: -moz-box; } -tab[treestyletab-collapsed="true"], +tabbrowser[treestyletab-allow-subtree-collapse="true"] .tabbrowser-tab[treestyletab-collapsed="true"], .tabbrowser-strip[collapsed="true"]+splitter, #appcontent[ahFull="true"] .tabbrowser-strip[ahHIDE="true"]+splitter /* AutoHide */ { visibility: collapse; @@ -91,3 +91,8 @@ tabbrowser[treestyletab-vertical="true"][treestyletab-appearance-inverted="true" -moz-box-ordinal-group: 30; } + +tabbrowser:not([treestyletab-vertical="true"]) .tabbrowser-tab:not([treestyletab-nest="0"]) + .tabbrowser-tab[treestyletab-nest="0"], +tabbrowser:not([treestyletab-vertical="true"]) .tabbrowser-tab[treestyletab-nest="0"] + .tabbrowser-tab[treestyletab-nest="0"][treestyletab-children] { + margin-left: 0.8em !important; +} diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index c16cf819..2ae1056b 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -13,6 +13,7 @@ var TreeStyleTabService = { kVERTICAL : 'treestyletab-vertical', kUI_INVERTED : 'treestyletab-appearance-inverted', kSCROLLBAR_INVERTED : 'treestyletab-scrollbar-inverted', + kALLOW_COLLAPSE : 'treestyletab-allow-subtree-collapse', kSTYLE : 'treestyletab-style', kFIRSTTAB_BORDER : 'treestyletab-firsttab-border', @@ -694,6 +695,7 @@ catch(e) { aTabBrowser.__treestyletab__observer.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.style'); aTabBrowser.__treestyletab__observer.observe(null, 'nsPref:changed', 'extensions.treestyletab.showBorderForFirstTab'); aTabBrowser.__treestyletab__observer.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.invertScrollbar'); + aTabBrowser.__treestyletab__observer.observe(null, 'nsPref:changed', 'extensions.treestyletab.allowSubtreeCollapseExpand'); delete addTabMethod; delete removeTabMethod; @@ -717,6 +719,8 @@ catch(e) { this.initTabContents(aTab); + aTab.setAttribute(this.kNEST, 0); + var event = document.createEvent('Events'); event.initEvent('TreeStyleTab:TabOpen', true, false); aTab.dispatchEvent(event); @@ -1875,7 +1879,9 @@ catch(e) { } } - if (!aProp) aProp = this.levelMarginProp; + if (!aProp) { + aProp = this.getPref('extensions.treestyletab.enableSubtreeIndent') ? this.levelMarginProp : 0 ; + } var b = this.getTabBrowserFromChildren(aTabs[0]); var margin = b.__treestyletab__levelMargin < 0 ? this.levelMargin : b.__treestyletab__levelMargin ; @@ -1883,7 +1889,7 @@ catch(e) { for (var i = 0, maxi = aTabs.length; i < maxi; i++) { - aTabs[i].setAttribute('style', aTabs[i].getAttribute('style')+'; margin: 0 !important; '+aProp+':'+indent+'px !important;'); + aTabs[i].setAttribute('style', aTabs[i].getAttribute('style').replace(/margin(-[^:]+):[^;]+;?/g, '')+'; '+aProp+':'+indent+'px !important;'); aTabs[i].setAttribute(this.kNEST, aLevel); this.updateTabsIndent(this.getChildTabs(aTabs[i]), aLevel+1, aProp); } @@ -2550,6 +2556,10 @@ TreeStyleTabBrowserObserver.prototype = { TreeStyleTabService.updateAllTabsIndent(this.mTabBrowser); break; + case 'extensions.treestyletab.enableSubtreeIndent': + TreeStyleTabService.updateAllTabsIndent(this.mTabBrowser); + break; + case 'extensions.treestyletab.tabbar.style': this.mTabBrowser.setAttribute(TreeStyleTabService.kSTYLE, value); break; @@ -2569,6 +2579,13 @@ TreeStyleTabBrowserObserver.prototype = { this.mTabBrowser.removeAttribute(TreeStyleTabService.kSCROLLBAR_INVERTED); break; + case 'extensions.treestyletab.allowSubtreeCollapseExpand': + if (value) + this.mTabBrowser.setAttribute(TreeStyleTabService.kALLOW_COLLAPSE, true); + else + this.mTabBrowser.removeAttribute(TreeStyleTabService.kALLOW_COLLAPSE); + break; + default: break; } diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index 89469fd5..47f5c856 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -5,6 +5,8 @@ pref("extensions.treestyletab.tabbar.invertUI", true); pref("extensions.treestyletab.tabbar.scroll.smooth", true); pref("extensions.treestyletab.tabbar.scroll.timeout", 250); pref("extensions.treestyletab.tabbar.style", "mixed"); +pref("extensions.treestyletab.enableSubtreeIndent", true); +pref("extensions.treestyletab.allowSubtreeCollapseExpand", true); pref("extensions.treestyletab.showBorderForFirstTab", false); pref("extensions.treestyletab.levelMargin", 12); diff --git a/install.rdf b/install.rdf index 343112e1..c5410101 100644 --- a/install.rdf +++ b/install.rdf @@ -5,7 +5,7 @@ + + diff --git a/locale/ja/treestyletab/treestyletab.dtd b/locale/ja/treestyletab/treestyletab.dtd index 7fe467e0..a703b9d0 100644 --- a/locale/ja/treestyletab/treestyletab.dtd +++ b/locale/ja/treestyletab/treestyletab.dtd @@ -12,6 +12,8 @@ + +