タブをサブツリー単位で移動できるようにした

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1222 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2007-10-17 18:36:39 +00:00
parent 8f181bbe09
commit c252552a7a
2 changed files with 26 additions and 8 deletions

View File

@ -406,7 +406,7 @@ var TreeStyleTabService = {
var adoption = this.getPref('extensions.treestyletab.adoptChildrenToGrandParentOnRemoveTab');
var processTab = !adoption ? function(aTab) {
self.repudiateTab(aTab);
b.moveTabTo(aTab, b.mTabContainer.lastChild._tPos);
self.moveTabSubTreeTo(aTab, b.mTabContainer.lastChild._tPos);
} :
parentTab ? function(aTab) {
self.adoptTabTo(aTab, parentTab, tab);
@ -612,13 +612,21 @@ var TreeStyleTabService = {
return lastChild;
},
getChildTabsOf : function(aTab)
getDescendantTabsOf : function(aTab)
{
var tabs = [];
this.getChildTabsOf(aTab, tabs);
return tabs;
},
getChildTabsOf : function(aTab, aAllTabsArray)
{
var tabs = [];
var id = aTab.getAttribute(this.kID);
var children = aTab.getAttribute(this.kCHILDREN);
if (!children) return tabs;
if (aAllTabsArray) tabs = aAllTabsArray;
var list = children.split('|');
var b = this.getTabBrowserFromChildren(aTab);
var tab;
@ -629,6 +637,8 @@ var TreeStyleTabService = {
tab = this.getTabById(list[i], b)
if (tab) {
tabs.push(tab);
if (aAllTabsArray)
this.getChildTabsOf(tab, tabs);
}
else {
children = children.replace('|'+list[i], '');
@ -642,7 +652,6 @@ var TreeStyleTabService = {
getFirstChildTabOf : function(aTab)
{
var id = aTab.getAttribute(this.kID);
var b = this.getTabBrowserFromChildren(aTab);
var children = aTab.getAttribute(this.kCHILDREN);
var firstChild = null;
@ -664,7 +673,6 @@ var TreeStyleTabService = {
getLastChildTabOf : function(aTab)
{
var id = aTab.getAttribute(this.kID);
var b = this.getTabBrowserFromChildren(aTab);
var children = aTab.getAttribute(this.kCHILDREN);
var lastChild = null;
@ -751,6 +759,19 @@ var TreeStyleTabService = {
}
},
moveTabSubTreeTo : function(aTab, aIndex)
{
var tabs = this.getDescendantTabsOf(aTab);
var b = this.getTabBrowserFromChildren(aTab);
b.moveTabTo(aTab, aIndex);
for (var i = 0, maxi = tabs.length; i < maxi; i++)
{
b.moveTabTo(tabs[i], aTab._tPos+i+1);
}
},
/* Pref Listener */
domain : 'extensions.treestyletab',

View File

@ -1,10 +1,7 @@
<?xml version="1.0"?>
<?xml-stylesheet href="treestyletab.css" type="text/css"?>
<?xml-stylesheet href="chrome://treestyletab/skin/treestyletab.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://treestyletab/locale/treestyletab.dtd">
<overlay id="treestyletab-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">