新しい子タブの挿入位置をサブツリーの最初か最後かで選べるようにした
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1422 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
bb40161923
commit
8b877cef23
@ -247,6 +247,9 @@
|
||||
<preference id="extensions.treestyletab.focusMode"
|
||||
name="extensions.treestyletab.focusMode"
|
||||
type="int"/>
|
||||
<preference id="extensions.treestyletab.insertNewChildAt"
|
||||
name="extensions.treestyletab.insertNewChildAt"
|
||||
type="int"/>
|
||||
</preferences>
|
||||
|
||||
<checkbox id="extensions.treestyletab.autoCollapseExpandSubTreeOnSelect-check"
|
||||
@ -266,6 +269,15 @@
|
||||
label="&config.focusMode;"
|
||||
onsyncfrompreference="return document.getElementById('extensions.treestyletab.focusMode').value == 0;"
|
||||
onsynctopreference="return document.getElementById('extensions.treestyletab.focusMode-check').checked ? 0 : 1 ;"/>
|
||||
<groupbox>
|
||||
<caption label="&config.insertNewChildAt.caption;"/>
|
||||
<radiogroup id="extensions.treestyletab.insertNewChildAt-radiogroup"
|
||||
preference="extensions.treestyletab.insertNewChildAt"
|
||||
orient="vertical">
|
||||
<radio value="0" label="&config.insertNewChildAt.first;"/>
|
||||
<radio value="1" label="&config.insertNewChildAt.last;"/>
|
||||
</radiogroup>
|
||||
</groupbox>
|
||||
</prefpane>
|
||||
|
||||
<script src="config.js" type="application/x-javascript"/>
|
||||
|
@ -45,6 +45,9 @@ var TreeStyleTabService = {
|
||||
kTABBAR_HORIZONTAL : 3,
|
||||
kTABBAR_VERTICAL : 12,
|
||||
|
||||
kINSERT_FISRT : 0,
|
||||
kINSERT_LAST : 1,
|
||||
|
||||
levelMargin : 12,
|
||||
levelMarginProp : 'margin-left',
|
||||
positionProp : 'screenY',
|
||||
@ -103,6 +106,7 @@ var TreeStyleTabService = {
|
||||
var ownerBrowser = this.getTabBrowserFromFrame(frame);
|
||||
ownerBrowser.__treestyletab__readyToAttachNewTab = true;
|
||||
ownerBrowser.__treestyletab__readyToAttachMultiple = aMultiple || false ;
|
||||
ownerBrowser.__treestyletab__multipleCount = 0;
|
||||
ownerBrowser.__treestyletab__parentTab = this.getTabFromFrame(frame, ownerBrowser).getAttribute(this.kID);
|
||||
ownerBrowser.__treestyletab__insertBefore = aInsertBefore ? aInsertBefore.getAttribute(this.kID) : null ;
|
||||
},
|
||||
@ -117,6 +121,7 @@ var TreeStyleTabService = {
|
||||
var ownerBrowser = this.getTabBrowserFromFrame(frame);
|
||||
ownerBrowser.__treestyletab__readyToAttachNewTabGroup = true;
|
||||
ownerBrowser.__treestyletab__readyToAttachMultiple = true;
|
||||
ownerBrowser.__treestyletab__multipleCount = 0;
|
||||
},
|
||||
|
||||
stopToOpenChildTab : function(aFrameOrTabBrowser)
|
||||
@ -128,6 +133,7 @@ var TreeStyleTabService = {
|
||||
ownerBrowser.__treestyletab__readyToAttachNewTab = false;
|
||||
ownerBrowser.__treestyletab__readyToAttachNewTabGroup = false;
|
||||
ownerBrowser.__treestyletab__readyToAttachMultiple = false;
|
||||
ownerBrowser.__treestyletab__multipleCount = 0;
|
||||
ownerBrowser.__treestyletab__parentTab = null;
|
||||
ownerBrowser.__treestyletab__insertBefore = null;
|
||||
},
|
||||
@ -198,9 +204,13 @@ var TreeStyleTabService = {
|
||||
) {
|
||||
openTab = info.modifier && info.invert ? !openTab : true ;
|
||||
parent = parentHost == targetHost && !internal.forceChild ? parentTab : frame ;
|
||||
insertBefore = parentHost == targetHost && !internal.forceChild && (
|
||||
insertBefore = parentHost == targetHost && !internal.forceChild &&
|
||||
(this.getTreePref('insertNewChildAt') == this.kINSERT_FIRST ?
|
||||
nextTab :
|
||||
(
|
||||
this.getTabById(currentTab.__treestyletab__next, b) ||
|
||||
(nextTab ? (currentTab.__treestyletab__next = nextTab.getAttribute(this.kID), nextTab) : null )
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (
|
||||
@ -1189,13 +1199,27 @@ catch(e) {
|
||||
if (parent)
|
||||
this.attachTabTo(tab, parent);
|
||||
|
||||
var insertBefore;
|
||||
var refTab;
|
||||
var newIndex = -1;
|
||||
if (b.__treestyletab__insertBefore &&
|
||||
(insertBefore = this.getTabById(b.__treestyletab__insertBefore, b))) {
|
||||
var index = insertBefore._tPos;
|
||||
if (index > tab._tPos) index--;
|
||||
(refTab = this.getTabById(b.__treestyletab__insertBefore, b))) {
|
||||
newIndex = refTab._tPos;
|
||||
}
|
||||
else if (parent &&
|
||||
this.getTreePref('insertNewChildAt') == this.kINSERT_FISRT &&
|
||||
b.__treestyletab__multipleCount == 0) {
|
||||
/* 複数の子タブを一気に開く場合、最初に開いたタブだけを
|
||||
子タブの最初の位置に挿入し、続くタブは「最初の開いたタブ」と
|
||||
「元々最初の子だったタブ」との間に挿入していく */
|
||||
newIndex = parent._tPos + 1;
|
||||
if (refTab = this.getFirstChildTab(parent))
|
||||
b.__treestyletab__insertBefore = refTab.getAttribute(this.kID);
|
||||
}
|
||||
|
||||
if (newIndex > -1) {
|
||||
if (newIndex > tab._tPos) newIndex--;
|
||||
b.__treestyletab__internallyTabMoving = true;
|
||||
b.moveTabTo(tab, index);
|
||||
b.moveTabTo(tab, newIndex);
|
||||
b.__treestyletab__internallyTabMoving = false;
|
||||
}
|
||||
}
|
||||
@ -1203,6 +1227,9 @@ catch(e) {
|
||||
if (!b.__treestyletab__readyToAttachMultiple) {
|
||||
this.stopToOpenChildTab(b);
|
||||
}
|
||||
else {
|
||||
b.__treestyletab__multipleCount++;
|
||||
}
|
||||
},
|
||||
|
||||
onTabRemoved : function(aEvent)
|
||||
|
@ -10,6 +10,8 @@ pref("extensions.treestyletab.enableSubtreeIndent", true);
|
||||
pref("extensions.treestyletab.allowSubtreeCollapseExpand", true);
|
||||
pref("extensions.treestyletab.showBorderForFirstTab", false);
|
||||
pref("extensions.treestyletab.levelMargin", 12);
|
||||
// 0 = first child, 1 = last child
|
||||
pref("extensions.treestyletab.insertNewChildAt", 1);
|
||||
|
||||
pref("extensions.treestyletab.show.openSelectionLinks", true);
|
||||
pref("extensions.treestyletab.show.context-item-removeTabSubTree", true);
|
||||
|
@ -5,7 +5,7 @@
|
||||
<RDF:Description RDF:about="urn:mozilla:install-manifest"
|
||||
em:id="treestyletab@piro.sakura.ne.jp"
|
||||
em:name="Tree Style Tab"
|
||||
em:version="0.3.2007103101"
|
||||
em:version="0.3.2007103102"
|
||||
em:creator="SHIMODA Hiroshi"
|
||||
em:description="Show tabs like a tree."
|
||||
em:homepageURL="http://piro.sakura.ne.jp/xul/treestyletab/"
|
||||
|
@ -67,6 +67,10 @@
|
||||
|
||||
<!ENTITY config.focusMode "Focus to the next/previous tab even if it is invisible, by Control(Command)-Tab">
|
||||
|
||||
<!ENTITY config.insertNewChildAt.caption "Insertion position of new child tabs">
|
||||
<!ENTITY config.insertNewChildAt.first "Insert to the top of the sub tree, as the first child">
|
||||
<!ENTITY config.insertNewChildAt.last "Append to the last of the sub tree">
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -67,6 +67,9 @@
|
||||
|
||||
<!ENTITY config.focusMode "Control(Command)-Tabでタブを切り替える時、折りたたまれたタブにもフォーカスする">
|
||||
|
||||
<!ENTITY config.insertNewChildAt.caption "新しい子タブを開く位置">
|
||||
<!ENTITY config.insertNewChildAt.first "サブツリーの最初の位置に挿入する">
|
||||
<!ENTITY config.insertNewChildAt.last "サブツリーの末尾に追加する">
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user