タブのインデント表示の有効無効、サブツリーの折り畳みの有効無効を切り替えられるようにし、

横長のタブバーではどちらも標準でOFFにするようにした

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1336 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2007-10-25 22:59:34 +00:00
parent cae70c3338
commit d402c0cfd2
8 changed files with 73 additions and 13 deletions

View File

@ -1,4 +1,5 @@
var gGroupBookmarkRadio, gGroupBookmarkTree, gGroupBookmarkReplace; var gGroupBookmarkRadio, gGroupBookmarkTree, gGroupBookmarkReplace;
var gTabbarPlacePositionInitialized = false;
function initGroupBookmarkRadio() function initGroupBookmarkRadio()
{ {
@ -19,9 +20,24 @@ function onChangeGroupBookmarkRadio()
} }
function onChangeTabbarPosition() function onChangeTabbarPosition(aOnChange)
{ {
var pos = document.getElementById('extensions.treestyletab.tabbar.position-radiogroup').value; 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.invertScrollbar-check').disabled = pos != 'left';
document.getElementById('extensions.treestyletab.tabbar.invertUI-check').disabled = pos != 'right'; 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;
} }

View File

@ -22,6 +22,12 @@
<preference id="extensions.treestyletab.tabbar.style" <preference id="extensions.treestyletab.tabbar.style"
name="extensions.treestyletab.tabbar.style" name="extensions.treestyletab.tabbar.style"
type="string"/> type="string"/>
<preference id="extensions.treestyletab.enableSubtreeIndent"
name="extensions.treestyletab.enableSubtreeIndent"
type="bool"/>
<preference id="extensions.treestyletab.allowSubtreeCollapseExpand"
name="extensions.treestyletab.allowSubtreeCollapseExpand"
type="bool"/>
<preference id="extensions.treestyletab.tabbar.invertScrollbar" <preference id="extensions.treestyletab.tabbar.invertScrollbar"
name="extensions.treestyletab.tabbar.invertScrollbar" name="extensions.treestyletab.tabbar.invertScrollbar"
type="bool"/> type="bool"/>
@ -38,10 +44,11 @@
label="&config.tabbar.scroll.smooth;"/> label="&config.tabbar.scroll.smooth;"/>
<groupbox> <groupbox>
<caption label="&config.tabbar.position.caption;"/> <caption label="&config.tabbar.position.caption;"/>
<vbox>
<radiogroup id="extensions.treestyletab.tabbar.position-radiogroup" <radiogroup id="extensions.treestyletab.tabbar.position-radiogroup"
preference="extensions.treestyletab.tabbar.position" preference="extensions.treestyletab.tabbar.position"
orient="horizontal" orient="horizontal"
oncommand="onChangeTabbarPosition();"> oncommand="onChangeTabbarPosition(true);">
<grid> <grid>
<columns> <columns>
<column flex="1"/> <column flex="1"/>
@ -79,6 +86,15 @@
</rows> </rows>
</grid> </grid>
</radiogroup> </radiogroup>
<hbox align="center">
<checkbox id="extensions.treestyletab.enableSubtreeIndent-check"
preference="extensions.treestyletab.enableSubtreeIndent"
label="&config.enableSubtreeIndent;"/>
<checkbox id="extensions.treestyletab.allowSubtreeCollapseExpand-check"
preference="extensions.treestyletab.allowSubtreeCollapseExpand"
label="&config.allowSubtreeCollapseExpand;"/>
</hbox>
</vbox>
</groupbox> </groupbox>
<groupbox> <groupbox>
<caption label="&config.tabbar.style.caption;"/> <caption label="&config.tabbar.style.caption;"/>

View File

@ -1,21 +1,21 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml"); @namespace html url("http://www.w3.org/1999/xhtml");
tab .treestyletab-twisty, .tabbrowser-tab .treestyletab-twisty,
tab .treestyletab-counter-container, .tabbrowser-tab .treestyletab-counter-container,
tab .treestyletab-drop-marker, .tabbrowser-tab .treestyletab-drop-marker,
tab[treestyletab-children]:not([treestyletab-subtree-collapsed="true"]) .treestyletab-counter-container, .tabbrowser-tab[treestyletab-children]:not([treestyletab-subtree-collapsed="true"]) .treestyletab-counter-container,
tabbrowser:not([treestyletab-vertical="true"]) > tabbox > splitter { tabbrowser:not([treestyletab-vertical="true"]) > tabbox > splitter {
display: none; display: none;
} }
tab[treestyletab-children] .treestyletab-twisty, tabbrowser[treestyletab-allow-subtree-collapse="true"] .tabbrowser-tab[treestyletab-children] .treestyletab-twisty,
tab[treestyletab-children] .treestyletab-counter-container, tabbrowser[treestyletab-allow-subtree-collapse="true"] .tabbrowser-tab[treestyletab-children] .treestyletab-counter-container,
tab[treestyletab-drop-position] .treestyletab-drop-marker { .tabbrowser-tab[treestyletab-drop-position] .treestyletab-drop-marker {
display: -moz-box; display: -moz-box;
} }
tab[treestyletab-collapsed="true"], tabbrowser[treestyletab-allow-subtree-collapse="true"] .tabbrowser-tab[treestyletab-collapsed="true"],
.tabbrowser-strip[collapsed="true"]+splitter, .tabbrowser-strip[collapsed="true"]+splitter,
#appcontent[ahFull="true"] .tabbrowser-strip[ahHIDE="true"]+splitter /* AutoHide */ { #appcontent[ahFull="true"] .tabbrowser-strip[ahHIDE="true"]+splitter /* AutoHide */ {
visibility: collapse; visibility: collapse;
@ -91,3 +91,8 @@ tabbrowser[treestyletab-vertical="true"][treestyletab-appearance-inverted="true"
-moz-box-ordinal-group: 30; -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;
}

View File

@ -13,6 +13,7 @@ var TreeStyleTabService = {
kVERTICAL : 'treestyletab-vertical', kVERTICAL : 'treestyletab-vertical',
kUI_INVERTED : 'treestyletab-appearance-inverted', kUI_INVERTED : 'treestyletab-appearance-inverted',
kSCROLLBAR_INVERTED : 'treestyletab-scrollbar-inverted', kSCROLLBAR_INVERTED : 'treestyletab-scrollbar-inverted',
kALLOW_COLLAPSE : 'treestyletab-allow-subtree-collapse',
kSTYLE : 'treestyletab-style', kSTYLE : 'treestyletab-style',
kFIRSTTAB_BORDER : 'treestyletab-firsttab-border', 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.tabbar.style');
aTabBrowser.__treestyletab__observer.observe(null, 'nsPref:changed', 'extensions.treestyletab.showBorderForFirstTab'); 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.tabbar.invertScrollbar');
aTabBrowser.__treestyletab__observer.observe(null, 'nsPref:changed', 'extensions.treestyletab.allowSubtreeCollapseExpand');
delete addTabMethod; delete addTabMethod;
delete removeTabMethod; delete removeTabMethod;
@ -717,6 +719,8 @@ catch(e) {
this.initTabContents(aTab); this.initTabContents(aTab);
aTab.setAttribute(this.kNEST, 0);
var event = document.createEvent('Events'); var event = document.createEvent('Events');
event.initEvent('TreeStyleTab:TabOpen', true, false); event.initEvent('TreeStyleTab:TabOpen', true, false);
aTab.dispatchEvent(event); 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 b = this.getTabBrowserFromChildren(aTabs[0]);
var margin = b.__treestyletab__levelMargin < 0 ? this.levelMargin : b.__treestyletab__levelMargin ; 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++) 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); aTabs[i].setAttribute(this.kNEST, aLevel);
this.updateTabsIndent(this.getChildTabs(aTabs[i]), aLevel+1, aProp); this.updateTabsIndent(this.getChildTabs(aTabs[i]), aLevel+1, aProp);
} }
@ -2550,6 +2556,10 @@ TreeStyleTabBrowserObserver.prototype = {
TreeStyleTabService.updateAllTabsIndent(this.mTabBrowser); TreeStyleTabService.updateAllTabsIndent(this.mTabBrowser);
break; break;
case 'extensions.treestyletab.enableSubtreeIndent':
TreeStyleTabService.updateAllTabsIndent(this.mTabBrowser);
break;
case 'extensions.treestyletab.tabbar.style': case 'extensions.treestyletab.tabbar.style':
this.mTabBrowser.setAttribute(TreeStyleTabService.kSTYLE, value); this.mTabBrowser.setAttribute(TreeStyleTabService.kSTYLE, value);
break; break;
@ -2569,6 +2579,13 @@ TreeStyleTabBrowserObserver.prototype = {
this.mTabBrowser.removeAttribute(TreeStyleTabService.kSCROLLBAR_INVERTED); this.mTabBrowser.removeAttribute(TreeStyleTabService.kSCROLLBAR_INVERTED);
break; break;
case 'extensions.treestyletab.allowSubtreeCollapseExpand':
if (value)
this.mTabBrowser.setAttribute(TreeStyleTabService.kALLOW_COLLAPSE, true);
else
this.mTabBrowser.removeAttribute(TreeStyleTabService.kALLOW_COLLAPSE);
break;
default: default:
break; break;
} }

View File

@ -5,6 +5,8 @@ pref("extensions.treestyletab.tabbar.invertUI", true);
pref("extensions.treestyletab.tabbar.scroll.smooth", true); pref("extensions.treestyletab.tabbar.scroll.smooth", true);
pref("extensions.treestyletab.tabbar.scroll.timeout", 250); pref("extensions.treestyletab.tabbar.scroll.timeout", 250);
pref("extensions.treestyletab.tabbar.style", "mixed"); pref("extensions.treestyletab.tabbar.style", "mixed");
pref("extensions.treestyletab.enableSubtreeIndent", true);
pref("extensions.treestyletab.allowSubtreeCollapseExpand", true);
pref("extensions.treestyletab.showBorderForFirstTab", false); pref("extensions.treestyletab.showBorderForFirstTab", false);
pref("extensions.treestyletab.levelMargin", 12); pref("extensions.treestyletab.levelMargin", 12);

View File

@ -5,7 +5,7 @@
<RDF:Description RDF:about="urn:mozilla:install-manifest" <RDF:Description RDF:about="urn:mozilla:install-manifest"
em:id="treestyletab@piro.sakura.ne.jp" em:id="treestyletab@piro.sakura.ne.jp"
em:name="Tree Style Tab" em:name="Tree Style Tab"
em:version="0.2.2007102501" em:version="0.2.2007102601"
em:creator="SHIMODA Hiroshi" em:creator="SHIMODA Hiroshi"
em:description="Show tabs like a tree." em:description="Show tabs like a tree."
em:homepageURL="http://piro.sakura.ne.jp/xul/treestyletab/" em:homepageURL="http://piro.sakura.ne.jp/xul/treestyletab/"

View File

@ -12,6 +12,8 @@
<!ENTITY config.tabbar.position.bottom "Bottom"> <!ENTITY config.tabbar.position.bottom "Bottom">
<!ENTITY config.tabbar.invertScrollbar "Show scrollbar leftmost"> <!ENTITY config.tabbar.invertScrollbar "Show scrollbar leftmost">
<!ENTITY config.tabbar.invertUI "Invert tab appearance"> <!ENTITY config.tabbar.invertUI "Invert tab appearance">
<!ENTITY config.enableSubtreeIndent "Indent tabs">
<!ENTITY config.allowSubtreeCollapseExpand "Allow to collapse/expand sub tree of tabs">
<!ENTITY config.tabbar.style.caption "Appearance of the tab bar"> <!ENTITY config.tabbar.style.caption "Appearance of the tab bar">
<!ENTITY config.tabbar.style.default "Plain"> <!ENTITY config.tabbar.style.default "Plain">

View File

@ -12,6 +12,8 @@
<!ENTITY config.tabbar.position.bottom "下"> <!ENTITY config.tabbar.position.bottom "下">
<!ENTITY config.tabbar.invertScrollbar "スクロールバーを左に表示"> <!ENTITY config.tabbar.invertScrollbar "スクロールバーを左に表示">
<!ENTITY config.tabbar.invertUI "タブを左右反転"> <!ENTITY config.tabbar.invertUI "タブを左右反転">
<!ENTITY config.enableSubtreeIndent "タブをインデント表示する">
<!ENTITY config.allowSubtreeCollapseExpand "サブツリーを折りたためるようにする">
<!ENTITY config.tabbar.style.caption "タブバーの表示スタイル"> <!ENTITY config.tabbar.style.caption "タブバーの表示スタイル">
<!ENTITY config.tabbar.style.default "プレーン"> <!ENTITY config.tabbar.style.default "プレーン">