From fbe67ad40cb98710b92940aaeb3772fa70d40661 Mon Sep 17 00:00:00 2001 From: piro Date: Sat, 23 Feb 2008 00:41:15 +0000 Subject: [PATCH] =?UTF-8?q?=E8=A4=87=E6=95=B0=E3=82=BF=E3=83=96=E3=82=92?= =?UTF-8?q?=E3=81=BE=E3=81=A8=E3=82=81=E3=81=A6=E3=83=89=E3=83=A9=E3=83=83?= =?UTF-8?q?=E3=82=B0=E3=81=97=E3=81=A6=E8=A4=87=E8=A3=BD=E3=81=99=E3=82=8B?= =?UTF-8?q?=E5=87=A6=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1845 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletabbrowser.js | 71 +++++++++++++++------ 1 file changed, 51 insertions(+), 20 deletions(-) diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index e3950af4..92184326 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -1640,7 +1640,7 @@ TreeStyleTabBrowser.prototype = { aDragSession.sourceNode && aDragSession.sourceNode.localName == 'tab') { if ('duplicateTab' in this.mTabBrowser && - navigator.platform.toLowerCase().indexOf('mac') == 0 ? aEvent.metaKey : aEvent.ctrlKey ) + (navigator.platform.toLowerCase().indexOf('mac') == 0 ? aEvent.metaKey : aEvent.ctrlKey )) info.action = info.action | this.kACTION_DUPLICATE; if (info.action & this.kACTION_ATTACH) { @@ -1813,42 +1813,44 @@ TreeStyleTabBrowser.prototype = { } if (aDraggedTab && aInfo.action & this.kACTION_PART) { - b.movingSelectedTabs = true; - draggedTabs.forEach(function(aTab) { - self.partTab(aTab); - self.collapseExpandTab(aTab, false); - }); - b.movingSelectedTabs = false; + if (!(aInfo.action & this.kACTION_DUPLICATE)) + this.partTabsOnDrop(draggedTabs); } else if (aInfo.action & this.kACTION_ATTACH) { - b.movingSelectedTabs = true; - draggedTabs.forEach(function(aTab) { - if (aInfo.parent) - self.attachTabTo(aTab, aInfo.parent); - else - self.partTab(aTab); - self.collapseExpandTab(aTab, false); - }); - b.movingSelectedTabs = false; + if (!(aInfo.action & this.kACTION_DUPLICATE)) + this.attachTabsOnDrop(draggedTabs, aInfo.parent); } else { return false; } + var newSelection = []; if ( - aInfo.action & this.kACTION_MOVE && + ( + aInfo.action & this.kACTION_MOVE || + aInfo.action & this.kACTION_DUPLICATE + ) && ( !aInfo.insertBefore || this.getNextVisibleTab(draggedTabs[0]) != aInfo.insertBefore ) ) { - b.movingSelectedTabs = true; + b.movingSelectedTabs = true; // Multiple Tab Handler + var tab, newIndex; + var newRoots = []; for (var i = draggedTabs.length-1; i > -1; i--) { tab = draggedTabs[i]; - if (aInfo.action & this.kACTION_DUPLICATE) + if (aInfo.action & this.kACTION_DUPLICATE) { + if ('MultipleTabService' in window) + MultipleTabService.setSelection(tab, false); tab = b.duplicateTab(tab); + if ('MultipleTabService' in window) + MultipleTabService.setSelection(tab, true); + if (!this.getParentTab(tab)) + newRoots.push(tab); + } newIndex = aInfo.insertBefore ? aInfo.insertBefore._tPos : tabs.length - 1 ; if (aInfo.insertBefore && newIndex > tab._tPos) newIndex--; @@ -1858,10 +1860,39 @@ TreeStyleTabBrowser.prototype = { this.collapseExpandTab(tab, false); this.internallyTabMoving = false; } - b.movingSelectedTabs = false; + + if (aInfo.action & this.kACTION_DUPLICATE && + aInfo.action & this.kACTION_ATTACH) + this.attachTabsOnDrop(newRoots, aInfo.parent); + + b.movingSelectedTabs = false; // Multiple Tab Handler } + return true; }, + attachTabsOnDrop : function(aTabs, aParent) + { + this.mTabBrowser.movingSelectedTabs = true; // Multiple Tab Handler + var self = this; + aTabs.forEach(function(aTab) { + if (aParent) + self.attachTabTo(aTab, aParent); + else + self.partTab(aTab); + self.collapseExpandTab(aTab, false); + }); + this.mTabBrowser.movingSelectedTabs = false; // Multiple Tab Handler + }, + partTabsOnDrop : function(aTabs) + { + this.mTabBrowser.movingSelectedTabs = true; // Multiple Tab Handler + var self = this; + aTabs.forEach(function(aTab) { + self.partTab(aTab); + self.collapseExpandTab(aTab, false); + }); + this.mTabBrowser.movingSelectedTabs = false; // Multiple Tab Handler + }, clearDropPosition : function() {