子孫タブだけを閉じる機能のメニュー項目を追加

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1622 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2007-11-26 15:07:10 +00:00
parent 6e0095d767
commit c560a09133
7 changed files with 36 additions and 3 deletions

View File

@ -47,6 +47,9 @@
<preference id="extensions.treestyletab.show.context-item-removeTabSubTree"
name="extensions.treestyletab.show.context-item-removeTabSubTree"
type="bool"/>
<preference id="extensions.treestyletab.show.context-item-removeDescendantTabs"
name="extensions.treestyletab.show.context-item-removeDescendantTabs"
type="bool"/>
<preference id="extensions.treestyletab.show.context-item-collapseAllSubtree"
name="extensions.treestyletab.show.context-item-collapseAllSubtree"
type="bool"/>
@ -145,16 +148,21 @@
<checkbox id="extensions.treestyletab.show.context-item-removeTabSubTree-check"
preference="extensions.treestyletab.show.context-item-removeTabSubTree"
label="&context.removeTabSubTree.label;"/>
<checkbox id="extensions.treestyletab.show.context-item-removeDescendantTabs-check"
preference="extensions.treestyletab.show.context-item-removeDescendantTabs"
label="&context.removeDescendantTabs.label;"/>
</hbox>
<hbox align="center">
<checkbox id="extensions.treestyletab.show.context-item-collapseAllSubtree-check"
preference="extensions.treestyletab.show.context-item-collapseAllSubtree"
label="&context.collapseAllSubtree.label;"/>
<checkbox id="extensions.treestyletab.show.context-item-expandAllSubtree-check"
preference="extensions.treestyletab.show.context-item-expandAllSubtree"
label="&context.expandAllSubtree.label;"/>
<checkbox id="extensions.treestyletab.show.context-item-toggleAutoHide-check"
preference="extensions.treestyletab.show.context-item-toggleAutoHide"
label="&context.toggleAutoHide.label;"/>
</hbox>
<checkbox id="extensions.treestyletab.show.context-item-toggleAutoHide-check"
preference="extensions.treestyletab.show.context-item-toggleAutoHide"
label="&context.toggleAutoHide.label;"/>
</groupbox>
<checkbox id="extensions.treestyletab.show.openSelectionLinks-check"
preference="extensions.treestyletab.show.openSelectionLinks"

View File

@ -36,6 +36,11 @@
accesskey="&context.removeTabSubTree.accesskey;"
oncommand="TreeStyleTabService.removeTabSubTree(TreeStyleTabService.getTabBrowserFromChild(this).mContextTab);"
onclick="if (event.button == 1 || (event.button == 0 &amp;&amp; (navigator.platform.indexOf('Mac') &lt; 0 ? event.ctrlKey : event.metaKey ))) { TreeStyleTabService.removeTabSubTree(TreeStyleTabService.getTabBrowserFromChild(this).mContextTab, true); event.stopPropagation(); this.parentNode.hidePopup(); }"/>
<menuitem id="context-item-removeDescendantTabs"
label="&context.removeDescendantTabs.label;"
accesskey="&context.removeDescendantTabs.accesskey;"
oncommand="TreeStyleTabService.removeTabSubTree(TreeStyleTabService.getTabBrowserFromChild(this).mContextTab, true);"
onclick="if (event.button == 1 || (event.button == 0 &amp;&amp; (navigator.platform.indexOf('Mac') &lt; 0 ? event.ctrlKey : event.metaKey ))) { TreeStyleTabService.removeTabSubTree(TreeStyleTabService.getTabBrowserFromChild(this).mContextTab); event.stopPropagation(); this.parentNode.hidePopup(); }"/>
<menuseparator id="context-separator-collapseExpandAll"/>
<menuitem id="context-item-collapseAllSubtree"

View File

@ -6,6 +6,7 @@ function TreeStyleTabBrowser(aTabBrowser)
TreeStyleTabBrowser.prototype = {
kMENUITEM_REMOVESUBTREE : 'context-item-removeTabSubTree',
kMENUITEM_REMOVECHILDREN : 'context-item-removeDescendantTabs',
kMENUITEM_COLLAPSEEXPAND_SEPARATOR : 'context-separator-collapseExpandAll',
kMENUITEM_COLLAPSE : 'context-item-collapseAllSubtree',
kMENUITEM_EXPAND : 'context-item-expandAllSubtree',
@ -304,6 +305,7 @@ TreeStyleTabBrowser.prototype = {
var suffix = '-'+parseInt(Math.random() * 65000);
[
aSelf.kMENUITEM_REMOVESUBTREE,
aSelf.kMENUITEM_REMOVECHILDREN,
aSelf.kMENUITEM_COLLAPSEEXPAND_SEPARATOR,
aSelf.kMENUITEM_COLLAPSE,
aSelf.kMENUITEM_EXPAND,
@ -1249,6 +1251,17 @@ TreeStyleTabBrowser.prototype = {
item.setAttribute('hidden', true);
this.showHideRemoveSubTreeMenuItem(item, [b.mContextTab]);
item = this.evaluateXPath(
'descendant::xul:menuitem[starts-with(@id, "'+this.kMENUITEM_REMOVECHILDREN+'")]',
aEvent.currentTarget,
XPathResult.FIRST_ORDERED_NODE_TYPE
).singleNodeValue;
if (this.getTreePref('show.'+this.kMENUITEM_REMOVECHILDREN))
item.removeAttribute('hidden');
else
item.setAttribute('hidden', true);
this.showHideRemoveSubTreeMenuItem(item, [b.mContextTab]);
// collapse/expand all
sep = this.evaluateXPath(
'descendant::xul:menuseparator[starts-with(@id, "'+this.kMENUITEM_COLLAPSEEXPAND_SEPARATOR+'")]',

View File

@ -25,6 +25,7 @@ pref("extensions.treestyletab.insertNewChildAt", 1);
pref("extensions.treestyletab.show.openSelectionLinks", true);
pref("extensions.treestyletab.show.context-item-removeTabSubTree", true);
pref("extensions.treestyletab.show.context-item-removeDescendantTabs", false);
pref("extensions.treestyletab.show.context-item-collapseAllSubtree", true);
pref("extensions.treestyletab.show.context-item-expandAllSubtree", true);
pref("extensions.treestyletab.show.context-item-toggleAutoHide", true);

View File

@ -84,6 +84,8 @@
<!ENTITY selection.removeTabSubTree.accesskey "s">
<!ENTITY context.removeTabSubTree.label "Close this Tree">
<!ENTITY context.removeTabSubTree.accesskey "s">
<!ENTITY context.removeDescendantTabs.label "Close Children">
<!ENTITY context.removeDescendantTabs.accesskey "d">
<!ENTITY context.collapseAllSubtree.label "Collapse All Trees">
<!ENTITY context.collapseAllSubtree.accesskey "c">
<!ENTITY context.expandAllSubtree.label "Expand All Trees">

View File

@ -84,6 +84,8 @@
<!ENTITY selection.removeTabSubTree.accesskey "s">
<!ENTITY context.removeTabSubTree.label "Chiudi questo sottoalbero">
<!ENTITY context.removeTabSubTree.accesskey "s">
<!ENTITY context.removeDescendantTabs.label "Close Children">
<!ENTITY context.removeDescendantTabs.accesskey "d">
<!ENTITY context.collapseAllSubtree.label "Collapse All Trees">
<!ENTITY context.collapseAllSubtree.accesskey "c">
<!ENTITY context.expandAllSubtree.label "Expand All Trees">

View File

@ -82,6 +82,8 @@
<!ENTITY selection.removeTabSubTree.accesskey "s">
<!ENTITY context.removeTabSubTree.label "このサブツリーを閉じる">
<!ENTITY context.removeTabSubTree.accesskey "s">
<!ENTITY context.removeDescendantTabs.label "このタブの子タブをすべて閉じる">
<!ENTITY context.removeDescendantTabs.accesskey "d">
<!ENTITY context.collapseAllSubtree.label "サブツリーをすべてたたむ">
<!ENTITY context.collapseAllSubtree.accesskey "c">
<!ENTITY context.expandAllSubtree.label "サブツリーをすべて展開する">