update configuration UI

This commit is contained in:
SHIMODA Hiroshi 2010-11-29 19:36:13 +09:00
parent 9b2b99674f
commit 00c5f4b04f
4 changed files with 133 additions and 34 deletions

View File

@ -195,7 +195,7 @@ function onSyncGroupBookmarkPrefToUI()
}
function onChangeTabbarPosition(aOnChange)
function onChangeTabbarPosition()
{
var pos = document.getElementById('extensions.treestyletab.tabbar.position-radiogroup').value;
var invertTab = document.getElementById('extensions.treestyletab.tabbar.invertTab-check');
@ -216,24 +216,24 @@ function onChangeTabbarPosition(aOnChange)
else
invertClosebox.setAttribute('collapsed', true);
var indentCheckH = document.getElementById('extensions.treestyletab.enableSubtreeIndent.horizontal-check');
var indentCheckV = document.getElementById('extensions.treestyletab.enableSubtreeIndent.vertical-check');
var maxTreeLevelH = document.getElementById('maxTreeLevel-groupbox-horizontal');
var maxTreeLevelV = document.getElementById('maxTreeLevel-groupbox-vertical');
var collapseCheckH = document.getElementById('extensions.treestyletab.allowSubtreeCollapseExpand.horizontal-check');
var collapseCheckV = document.getElementById('extensions.treestyletab.allowSubtreeCollapseExpand.vertical-check');
var hideAllTabsCheckH = document.getElementById('extensions.treestyletab.tabbar.hideAlltabsButton.horizontal-check');
var hideAllTabsCheckV = document.getElementById('extensions.treestyletab.tabbar.hideAlltabsButton.vertical-check');
if (pos == 'left' || pos == 'right') {
indentCheckH.setAttribute('collapsed', true);
indentCheckV.removeAttribute('collapsed');
maxTreeLevelH.setAttribute('collapsed', true);
maxTreeLevelV.removeAttribute('collapsed');
collapseCheckH.setAttribute('collapsed', true);
collapseCheckV.removeAttribute('collapsed');
hideAllTabsCheckH.setAttribute('collapsed', true);
hideAllTabsCheckV.removeAttribute('collapsed');
}
else {
indentCheckH.removeAttribute('collapsed');
indentCheckV.setAttribute('collapsed', true);
maxTreeLevelH.removeAttribute('collapsed');
maxTreeLevelV.setAttribute('collapsed', true);
collapseCheckH.removeAttribute('collapsed');
collapseCheckV.setAttribute('collapsed', true);
hideAllTabsCheckH.removeAttribute('collapsed');
@ -243,6 +243,52 @@ function onChangeTabbarPosition(aOnChange)
gTabbarPlacePositionInitialized = true;
}
function onSyncMaxTreeLevelUIToPref(aTarget)
{
var isHorizontal = aTarget.indexOf('horizontal') != -1;
aTarget = document.getElementById(aTarget);
if (aTarget.sync)
return;
aTarget.sync = true;
var UIValue = parseInt(aTarget.value);
var prefValue = UIValue;
Array.slice(aTarget.getElementsByTagName('textbox')).forEach(function(aNode) {
if (aNode.getAttribute('max-tree-level-radio') == UIValue) {
aNode.removeAttribute('disabled');
prefValue = parseInt(aNode.value);
}
else
aNode.setAttribute('disabled', true);
});
aTarget.sync = false;
return prefValue;
}
function onSyncMaxTreeLevelPrefToUI(aTarget)
{
var isHorizontal = aTarget.indexOf('horizontal') != -1;
aTarget = document.getElementById(aTarget);
if (aTarget.sync)
return;
aTarget.sync = true;
var pref = document.getElementById(aTarget.getAttribute('preference'));
var value = pref.value;
var UIValue = Math.max(-1, Math.min(1, value));
Array.slice(aTarget.getElementsByTagName('textbox')).forEach(function(aNode) {
if (aNode.getAttribute('max-tree-level-radio') == UIValue) {
aNode.removeAttribute('disabled');
aNode.value = value;
}
else
aNode.setAttribute('disabled', true);
});
aTarget.sync = false;
return UIValue;
}
var gAutoHideModeRadio,
gAutoHideModeToggle,

View File

@ -24,12 +24,12 @@
<preference id="extensions.treestyletab.tabbar.syncRelatedPrefsForDynamicPosition"
name="extensions.treestyletab.tabbar.syncRelatedPrefsForDynamicPosition"
type="bool"/>
<preference id="extensions.treestyletab.enableSubtreeIndent.horizontal"
name="extensions.treestyletab.enableSubtreeIndent.horizontal"
type="bool"/>
<preference id="extensions.treestyletab.enableSubtreeIndent.vertical"
name="extensions.treestyletab.enableSubtreeIndent.vertical"
type="bool"/>
<preference id="extensions.treestyletab.maxTreeLevel.horizontal"
name="extensions.treestyletab.maxTreeLevel.horizontal"
type="int"/>
<preference id="extensions.treestyletab.maxTreeLevel.vertical"
name="extensions.treestyletab.maxTreeLevel.vertical"
type="int"/>
<preference id="extensions.treestyletab.allowSubtreeCollapseExpand.horizontal"
name="extensions.treestyletab.allowSubtreeCollapseExpand.horizontal"
type="bool"/>
@ -121,26 +121,68 @@
<checkbox id="extensions.treestyletab.allowSubtreeCollapseExpand.vertical-check"
preference="extensions.treestyletab.allowSubtreeCollapseExpand.vertical"
label="&config.allowSubtreeCollapseExpand;"/>
<checkbox id="extensions.treestyletab.enableSubtreeIndent.horizontal-check"
preference="extensions.treestyletab.enableSubtreeIndent.horizontal"
label="&config.enableSubtreeIndent;"
oncommand="
if (document.getElementById('extensions.treestyletab.tabbar.syncRelatedPrefsForDynamicPosition').value)
document.getElementById('extensions.treestyletab.tabbar.fixed.horizontal').value = !this.checked;
"/>
<checkbox id="extensions.treestyletab.enableSubtreeIndent.vertical-check"
preference="extensions.treestyletab.enableSubtreeIndent.vertical"
label="&config.enableSubtreeIndent;"/>
</hbox>
<hbox align="center" id="hideAlltabsButton-box">
<checkbox id="extensions.treestyletab.tabbar.hideAlltabsButton.horizontal-check"
preference="extensions.treestyletab.tabbar.hideAlltabsButton.horizontal"
label="&config.tabbar.hideAlltabsButton;"
collapsed="true"/>
<checkbox id="extensions.treestyletab.tabbar.hideAlltabsButton.vertical-check"
preference="extensions.treestyletab.tabbar.hideAlltabsButton.vertical"
label="&config.tabbar.hideAlltabsButton;"/>
<hbox align="center" id="hideAlltabsButton-box">
<checkbox id="extensions.treestyletab.tabbar.hideAlltabsButton.horizontal-check"
preference="extensions.treestyletab.tabbar.hideAlltabsButton.horizontal"
label="&config.tabbar.hideAlltabsButton;"
collapsed="true"/>
<checkbox id="extensions.treestyletab.tabbar.hideAlltabsButton.vertical-check"
preference="extensions.treestyletab.tabbar.hideAlltabsButton.vertical"
label="&config.tabbar.hideAlltabsButton;"/>
</hbox>
</hbox>
<groupbox id="maxTreeLevel-groupbox-vertical">
<caption label="&config.maxTreeLevel.caption;"/>
<radiogroup id="maxTreeLevel-radiogroup-vertical"
orient="vertical"
preference="extensions.treestyletab.maxTreeLevel.vertical"
onsynctopreference="return onSyncMaxTreeLevelUIToPref('maxTreeLevel-radiogroup-vertical');"
onsyncfrompreference="return onSyncMaxTreeLevelPrefToUI('maxTreeLevel-radiogroup-vertical');">
<radio value="0" label="&config.maxTreeLevel.0;"
max-tree-level-radio="0"/>
<radio value="-1" label="&config.maxTreeLevel.-1;"
max-tree-level-radio="-1"/>
<hbox align="center">
<radio value="1" id="maxTreeLevel-radio1-vertical"
max-tree-level-radio="1"
label="&config.maxTreeLevel.1;"/>
<textbox id="maxTreeLevel-radio1-textbox-vertical"
max-tree-level-radio="1"
type="number"
min="1" increment="1" size="2"
oninput="document.getElementById(this.parentNode.parentNode.getAttribute('preference')).value = this.value;"/>
<label max-tree-level-radio="1"
control="maxTreeLevel-radio1-vertical"
value="&config.maxTreeLevel.1.after;"/>
</hbox>
</radiogroup>
</groupbox>
<groupbox id="maxTreeLevel-groupbox-horizontal" collapsed="true">
<caption label="&config.maxTreeLevel.caption;"/>
<radiogroup id="maxTreeLevel-radiogroup-horizontal"
orient="vertical"
preference="extensions.treestyletab.maxTreeLevel.horizontal"
onsynctopreference="return onSyncMaxTreeLevelUIToPref('maxTreeLevel-radiogroup-horizontal');"
onsyncfrompreference="return onSyncMaxTreeLevelPrefToUI('maxTreeLevel-radiogroup-horizontal');">
<radio value="0" label="&config.maxTreeLevel.0;"
max-tree-level-radio="0"/>
<radio value="-1" label="&config.maxTreeLevel.-1;"
max-tree-level-radio="-1"/>
<hbox align="center">
<radio value="1" id="maxTreeLevel-radio1-horizontal"
max-tree-level-radio="1"
label="&config.maxTreeLevel.1;"/>
<textbox id="maxTreeLevel-radio1-textbox-horizontal"
max-tree-level-radio="1"
type="number"
min="1" increment="1" size="2"
oninput="document.getElementById(this.parentNode.parentNode.getAttribute('preference')).value = this.value;"/>
<label max-tree-level-radio="1"
control="maxTreeLevel-radio1-horizontal"
value="&config.maxTreeLevel.1.after;"/>
</hbox>
</radiogroup>
</groupbox>
</vbox>
</groupbox>
@ -236,6 +278,9 @@
<preference id="extensions.treestyletab.show.context-item-bookmarkTabSubtree"
name="extensions.treestyletab.show.context-item-bookmarkTabSubtree"
type="bool"/>
<preference id="extensions.treestyletab.preferences.newTab-tabbox.selectedIndex"
name="extensions.treestyletab.preferences.newTab-tabbox.selectedIndex"
type="int"/>
</preferences>
<vbox>

View File

@ -15,7 +15,11 @@
<!ENTITY config.tabbar.invertClosebox.right "Show closebox at rightside in each tab">
<!ENTITY config.tabbar.invertTab "Invert tab appearance">
<!ENTITY config.tabbar.invertTabContents "Invert tab contents">
<!ENTITY config.enableSubtreeIndent "Indent tabs">
<!ENTITY config.maxTreeLevel.caption "Visualization of nested trees">
<!ENTITY config.maxTreeLevel.0 "Nothing (no indentation)">
<!ENTITY config.maxTreeLevel.-1 "Indent tabs">
<!ENTITY config.maxTreeLevel.1 "Indent tabs until">
<!ENTITY config.maxTreeLevel.1.after "level(s)">
<!ENTITY config.allowSubtreeCollapseExpand "Allow to collapse/expand tree of tabs">
<!ENTITY config.tabbar.hideAlltabsButton "Show &quot;List all tabs&quot; button">

View File

@ -15,7 +15,11 @@
<!ENTITY config.tabbar.invertClosebox.right "タブのクローズボックスを右に表示">
<!ENTITY config.tabbar.invertTab "タブの表示を左右反転">
<!ENTITY config.tabbar.invertTabContents "タブの内容を左右反転">
<!ENTITY config.enableSubtreeIndent "タブをインデント表示する">
<!ENTITY config.maxTreeLevel.caption "ツリーの深さの表示">
<!ENTITY config.maxTreeLevel.0 "何もしない(インデントなし)">
<!ENTITY config.maxTreeLevel.-1 "タブをインデント表示する">
<!ENTITY config.maxTreeLevel.1 "タブをインデント表示する(">
<!ENTITY config.maxTreeLevel.1.after "階層まで)">
<!ENTITY config.allowSubtreeCollapseExpand "ツリーを折りたためるようにする">
<!ENTITY config.tabbar.hideAlltabsButton "「タブの一覧を表示」ボタンを表示する">