Merge branch 'master' of github.com:piroor/treestyletab

This commit is contained in:
SHIMODA Hiroshi 2012-02-10 15:32:02 +09:00
commit 4fd96587f5
10 changed files with 210 additions and 172 deletions

View File

@ -10,7 +10,7 @@
.treestyletab-twisty {
visibility: hidden;
}
.tabbrowser-tabs[treestyletab-allow-subtree-collapse="true"]
.tabbrowser-tabs[treestyletab-allow-subtree-collapse="true"]:not([treestyletab-twisty-style="none"])
.tabbrowser-tab[treestyletab-children][treestyletab-allow-subtree-collapse="true"]
.treestyletab-twisty {
visibility: visible;
@ -59,9 +59,7 @@
mask: url("res/tabEffects.svg#fadein-mask");
}
.tabbrowser-tabs[treestyletab-allow-subtree-collapse="true"][treestyletab-stack-collapsed-tabs="true"]
.tabbrowser-tab[treestyletab-collapsed-done="true"] .tab-image-middle > *,
.tabbrowser-tabs[treestyletab-allow-subtree-collapse="true"][treestyletab-stack-collapsed-tabs="true"]
.tabbrowser-tab[treestyletab-collapsed-done="true"] .tab-close-button {
.tabbrowser-tab[treestyletab-collapsed-done="true"] .tab-content > * {
visibility: collapse;
}

View File

@ -130,7 +130,7 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
<![CDATA[
for (let i = 0, maxi = this.tabTSTProperties.length; i < maxi; i++)
{
let tabProperties = this.tabTSTProperties[i];
let property = this.tabTSTProperties[i];
tabProperties += '|' + property + '=' + encodeURIComponent(aTab.getAttribute(property));
}
$&]]>

View File

@ -422,17 +422,18 @@ pref("extensions.treestyletab.autoCollapseExpandSubtreeOnSelect", true);
pref("extensions.treestyletab.autoCollapseExpandSubtreeOnSelect.onCurrentTabRemove", true);
/**
* When you press Ctrl-Tab/Shift-Ctrl-Tab, Firefox advances focus of tabs.
* If this is "true", TST collapses/expands focused tree after a delay specified
* by another preference "autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay".
* (If the delay is "0", TST dynamiclaly collapses/expands focused tree even if
* If this is "true", TST expands focused tree after a delay specified
* by another preference "autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay".
* (If the delay is "0", TST dynamiclaly expands focused tree even if
* you are browsing tabs by those shortcuts.)
* If this is "false", TST doesn't collapse/expand trees while you are switching
* If this is "false", TST doesn't expand trees while you are switching
* tab focus by those keyboard shortcuts. And then, after you release the Ctrl
* key, TST will expand the tree if the newly selected tab have its collapsed
* tree.
*/
pref("extensions.treestyletab.autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut", true);
pref("extensions.treestyletab.autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay", 800);
pref("extensions.treestyletab.autoExpandSubtreeOnSelect.whileFocusMovingByShortcut", true);
pref("extensions.treestyletab.autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.collapseOthers", true);
pref("extensions.treestyletab.autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay", 800);
/**
* If this is "true", TST expands/collapses tree by double-clicking on tabs.
* Otherwise TST simply ignores such actions.
@ -508,7 +509,7 @@ pref("extensions.treestyletab.autoAttach.goButton", 1);
* 0 = Focus to both visible and collapsed tabs. (If a collapsed tab is
* focused, the tree will be expanded by another pref "autoExpandSubtreeOnCollapsedChildFocused".
* 1 = Focus to visible tabs. Collapsed tabs will be skipped. (But if the tree
* is expanded by "autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut",
* is expanded by "autoExpandSubtreeOnSelect.whileFocusMovingByShortcut",
* visible tabs in the tree can be focused.)
*/
pref("extensions.treestyletab.focusMode", 1);

View File

@ -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.14.2012020901"
em:version="0.14.2012021001"
em:creator="SHIMODA Hiroshi"
em:description="Show tabs like a tree."
em:homepageURL="http://piro.sakura.ne.jp/xul/_treestyletab.html.en"

View File

@ -27,9 +27,9 @@ bookmarkDroppedTabs.bookmarkAll=&Все вкладки в дереве
bookmarkDroppedTabs.bookmarkOnlyParent=Только &родительскую вкладку
undoCloseTabSetBehavior.label=Эта вкладка была закрыта вместе с другими вкладками (%S шт.). Восстановить другие вкладки?
undoCloseTabSetBehavior.restoreOnce=Восстановить вкладки
undoCloseTabSetBehavior.restoreForever=Всегда восстанавливать вкладки
undoCloseTabSetBehavior.ignoreForever=Больше не показывать это сообщение
undoCloseTabSetBehavior.restoreOnce=&Восстановить вкладки
undoCloseTabSetBehavior.restoreForever=В&сегда восстанавливать вкладки
undoCloseTabSetBehavior.ignoreForever=Больше &не показывать это сообщение
openSelectedPlaces.bookmarks=из %2$S закладок, включая "%1$S"
openSelectedPlaces.history=из %2$S из истории ссылок, включая "%1$S"

View File

@ -532,7 +532,7 @@ TreeStyleTabBrowser.prototype = {
{
let tab = tabs[i];
if (aStacked)
tab.style.zIndex = count * 1000 - index;
tab.style.zIndex = count * 1000 - i;
else
tab.style.zIndex = '';
}
@ -3905,6 +3905,11 @@ TreeStyleTabBrowser.prototype = {
)
return;
var shouldCollapseExpandNow = this.getTreePref('autoCollapseExpandSubtreeOnSelect');
var newActiveTabOptions = {
canCollapseTree : shouldCollapseExpandNow,
canExpandTree : shouldCollapseExpandNow
};
if (this.isCollapsed(tab)) {
if (this.getTreePref('autoExpandSubtreeOnCollapsedChildFocused')) {
let parentTab = tab;
@ -3912,47 +3917,61 @@ TreeStyleTabBrowser.prototype = {
{
this.collapseExpandSubtree(parentTab, false);
}
this.collapseExpandTreesIntelligentlyForNewActiveTab(tab);
this.handleNewActiveTab(tab, newActiveTabOptions);
}
else {
b.selectedTab = this.getRootTab(tab);
}
}
else if (
this.getTreePref('autoCollapseExpandSubtreeOnSelect') &&
(
!this._focusChangedByCurrentTabRemove ||
this.getTreePref('autoCollapseExpandSubtreeOnSelect.onCurrentTabRemove')
/**
* Focus movings by arrow keys should not be handled on TabSelect,
* because they are already handled by handleAdvanceSelectedTab().
*/
this.windowService.arrowKeyEventOnTab &&
this.windowService.arrowKeyEventOnTab.advanceFocus
) ||
(
/**
* Focus movings by closing of the old current tab should be handled
* only when it is activated by user preference expressly.
*/
this._focusChangedByCurrentTabRemove &&
!this.getTreePref('autoCollapseExpandSubtreeOnSelect.onCurrentTabRemove')
)
) {
// do nothing!
}
else if (this.hasChildTabs(tab) && this.isSubtreeCollapsed(tab)) {
if (
this._focusChangedByShortcut &&
this.windowService.accelKeyPressed
) {
if (!this.hasChildTabs(tab) || !this.isSubtreeCollapsed(tab))
tab = null;
let event = this.windowService.arrowKeyEventOnTab;
let byArrowKey = event && event.advanceFocus;
let byShortcut = this._focusChangedByShortcut && this.windowService.accelKeyPressed;
if (!byArrowKey) {
if (byShortcut) {
if (!this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut')) {
this.windowService.expandTreeAfterKeyReleased(tab);
if (this.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut')) {
newActiveTabOptions.canExpandTree = true;
newActiveTabOptions.canCollapseTree = (
newActiveTabOptions.canCollapseTree &&
this.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.collapseOthers')
);
let delay = this.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay');
if (delay > 0) {
this._autoExpandOnTabSelectTimer = this.window.setTimeout(function(aSelf) {
if (tab && tab.parentNode)
aSelf.handleNewActiveTab(tab, newActiveTabOptions);
}, delay, this);
}
else {
let delay = this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay');
if (delay > 0) {
this._autoExpandOnTabSelectTimer = this.window.setTimeout(function(aSelf) {
if (tab && tab.parentNode)
aSelf.collapseExpandTreesIntelligentlyForNewActiveTab(tab);
}, delay, this);
}
else {
this.collapseExpandTreesIntelligentlyForNewActiveTab(tab);
}
this.handleNewActiveTab(tab, newActiveTabOptions);
}
}
else {
this.collapseExpandTreesIntelligentlyForNewActiveTab(tab);
else if (newActiveTabOptions.canExpandTree) {
this.windowService.expandTreeAfterKeyReleased(tab);
}
}
else {
this.handleNewActiveTab(tab, newActiveTabOptions);
}
}
this._focusChangedByCurrentTabRemove = false;
@ -3971,6 +3990,32 @@ TreeStyleTabBrowser.prototype = {
this._autoExpandOnTabSelectTimer = null;
}
},
handleNewActiveTab : function TSTBrowser_handleNewActiveTab(aTab, aOptions)
{
if (this.doingCollapseExpand || !aTab) return;
aOptions = aOptions || {};
if (this._handleNewActiveTabTimer)
this.window.clearTimeout(this._handleNewActiveTabTimer);
/**
* First, we wait until all event listeners for the TabSelect
* event were processed.
*/
this._handleNewActiveTabTimer = this.window.setTimeout(function(aSelf) {
aSelf.window.clearTimeout(aSelf._handleNewActiveTabTimer);
aSelf._handleNewActiveTabTimer = null;
if (aOptions.canExpandTree) {
if (aOptions.canCollapseTree)
aSelf.collapseExpandTreesIntelligentlyFor(aTab);
else
aSelf.collapseExpandSubtree(aTab, false);
}
}, 0, this);
},
_handleNewActiveTabTimer : null,
handleAdvanceSelectedTab : function TSTBrowser_handleAdvanceSelectedTab(aDir, aWrap)
{
@ -5663,22 +5708,6 @@ TreeStyleTabBrowser.prototype = {
this.collapseExpandSubtree(aTab, false, aJustNow);
},
collapseExpandTreesIntelligentlyForNewActiveTab : function TSTBrowser_collapseExpandTreesIntelligentlyForNewActiveTab(aTab)
{
if (this.doingCollapseExpand) return;
if (this._cETIFNATTimer)
this.window.clearTimeout(this._cETIFNATTimer);
/**
* First, we wait until all event listeners for the TabSelect
* event were processed.
*/
this._cETIFNATTimer = this.window.setTimeout(function(aSelf) {
aSelf.window.clearTimeout(aSelf._cETIFNATTimer);
aSelf._cETIFNATTimer = null;
aSelf.collapseExpandTreesIntelligentlyFor(aTab);
}, 0, this);
},
_cETIFNATTimer : null,
collapseExpandAllSubtree : function TSTBrowser_collapseExpandAllSubtree(aCollapse, aJustNow)
{

View File

@ -222,7 +222,7 @@ var confirmWithPopup;
accessKey = match[2];
}
else if (match = aLabel.match(/^\s*(.*[^&])?\&(([^&]).*$)/)) {
aLabel = (match[1] + match[2]).replace(/\&\&/g, '&');
aLabel = ((match[1] || '') + match[2]).replace(/\&\&/g, '&');
accessKey = match[3];
}
else {

View File

@ -320,7 +320,7 @@ catch(e) {
info.parent = tab;
info.insertBefore = sv.getTreePref('insertNewChildAt') == sv.kINSERT_FISRT ?
(sv.getFirstChildTab(tab) || visible) :
(sv.getNextSiblingTab(tab) || sv.getNextTab(sv.getLastDescendantTab(tab)) || visible);
(sv.getNextSiblingTab(tab) || sv.getNextTab(sv.getLastDescendantTab(tab)));
break;
case sv.kDROP_BEFORE:

View File

@ -355,6 +355,7 @@ var TreeStyleTabUtils = {
this.isMac = this.XULAppInfo.OS == 'Darwin';
this.applyPlatformDefaultPrefs();
this.migratePrefs();
this.addPrefListener(this);
@ -411,6 +412,123 @@ var TreeStyleTabUtils = {
this.setDefaultPref(key, this.getPref(originalKey));
}
},
kPREF_VERSION : 8,
migratePrefs : function TSTUtils_migratePrefs()
{
// migrate old prefs
var orientalPrefs = [];
switch (this.getTreePref('prefsVersion'))
{
case 0:
orientalPrefs = orientalPrefs.concat([
'extensions.treestyletab.tabbar.fixed',
'extensions.treestyletab.enableSubtreeIndent',
'extensions.treestyletab.allowSubtreeCollapseExpand'
]);
case 2:
if (this.getTreePref('urlbar.loadSameDomainToNewChildTab') !== null) {
let value = this.getTreePref('urlbar.loadSameDomainToNewChildTab');
this.setTreePref('urlbar.loadSameDomainToNewTab', value);
this.setTreePref('urlbar.loadSameDomainToNewTab.asChild', value);
if (value) this.setTreePref('urlbar.loadDifferentDomainToNewTab', value);
this.clearTreePref('urlbar.loadSameDomainToNewChildTab');
}
case 3:
if (this.getTreePref('loadDroppedLinkToNewChildTab') !== null) {
this.setTreePref('dropLinksOnTab.behavior',
this.getTreePref('loadDroppedLinkToNewChildTab.confirm') ?
this.kDROPLINK_ASK :
this.getTreePref('loadDroppedLinkToNewChildTab') ?
this.kDROPLINK_NEWTAB :
this.kDROPLINK_LOAD
);
this.clearTreePref('loadDroppedLinkToNewChildTab.confirm');
this.clearTreePref('loadDroppedLinkToNewChildTab');
}
if (this.getTreePref('openGroupBookmarkAsTabSubTree') !== null) {
let behavior = 0;
if (this.getTreePref('openGroupBookmarkAsTabSubTree.underParent'))
behavior += this.kGROUP_BOOKMARK_USE_DUMMY;
if (!this.getTreePref('openGroupBookmarkBehavior.confirm')) {
behavior += (
this.getTreePref('openGroupBookmarkAsTabSubTree') ?
this.kGROUP_BOOKMARK_SUBTREE :
this.getTreePref('browser.tabs.loadFolderAndReplace') ?
this.kGROUP_BOOKMARK_REPLACE :
this.kGROUP_BOOKMARK_SEPARATE
);
}
this.setTreePref('openGroupBookmark.behavior', behavior);
this.clearTreePref('openGroupBookmarkBehavior.confirm');
this.clearTreePref('openGroupBookmarkAsTabSubTree');
this.clearTreePref('openGroupBookmarkAsTabSubTree.underParent');
this.setPref('browser.tabs.loadFolderAndReplace', !!(behavior & this.kGROUP_BOOKMARK_REPLACE));
}
case 4:
let (prefs = [
'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect',
'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.onCurrentTabRemove',
'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.whileFocusMovingByShortcut',
'extensions.treestyletab.autoExpandSubTreeOnAppendChild',
'extensions.treestyletab.autoExpandSubTreeOnCollapsedChildFocused',
'extensions.treestyletab.collapseExpandSubTree.dblclick',
'extensions.treestyletab.createSubTree.underParent',
'extensions.treestyletab.show.context-item-reloadTabSubTree',
'extensions.treestyletab.show.context-item-removeTabSubTree',
'extensions.treestyletab.show.context-item-bookmarkTabSubTree',
'extensions.multipletab.show.multipletab-selection-item-removeTabSubTree',
'extensions.multipletab.show.multipletab-selection-item-createSubTree'
]) {
for (let i = 0, maxi = pref.length; i < maxi; i++)
{
let pref = prefs[i];
let value = this.getPref(pref);
if (value === null) continue;
this.setPref(pref.replace('SubTree', 'Subtree'), value);
this.clearPref(pref);
}
}
case 5:
let (behavior = this.getTreePref('openGroupBookmark.behavior')) {
behavior = behavior | 2048;
this.setTreePref('openGroupBookmark.behavior', behavior);
}
case 6:
let (
general = this.getTreePref('autoAttachNewTabsAsChildren'),
search = this.getTreePref('autoAttachSearchResultAsChildren')
) {
if (general !== null)
this.setTreePref('autoAttach', general);
if (search !== null)
this.setTreePref('autoAttach.searchResult', search);
}
case 7:
let (
enabled = this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut'),
delay = this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay')
) {
if (enabled !== null) {
this.setTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut', enabled);
this.setTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.collapseOthers', enabled);
}
if (delay !== null)
this.setTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay', delay);
}
default:
for (let i = 0, maxi = orientalPrefs.length; i < maxi; i++)
{
let pref = orientalPrefs[i];
let value = this.getPref(pref);
if (value === null) continue;
this.setPref(pref+'.horizontal', value);
this.setPref(pref+'.vertical', value);
this.clearPref(pref);
}
break;
}
this.setTreePref('prefsVersion', this.kPREF_VERSION);
},
updateAeroPeek : function TSTUtils_updateAeroPeek()
{

View File

@ -209,7 +209,7 @@ TreeStyleTabWindow.prototype = {
return toolbox && toolbox.customizing;
},
get maximized()
get maximized()
{
var sizemode = this.document.documentElement.getAttribute('sizemode');
return (
@ -315,119 +315,11 @@ TreeStyleTabWindow.prototype = {
w.TreeStyleTabWindowHelper.preInit();
this.migratePrefs();
// initialize theme
this.onPrefChange('extensions.treestyletab.tabbar.style');
},
preInitialized : false,
kPREF_VERSION : 7,
migratePrefs : function TSTWindow_migratePrefs()
{
// migrate old prefs
var orientalPrefs = [];
switch (this.getTreePref('prefsVersion'))
{
case 0:
orientalPrefs = orientalPrefs.concat([
'extensions.treestyletab.tabbar.fixed',
'extensions.treestyletab.enableSubtreeIndent',
'extensions.treestyletab.allowSubtreeCollapseExpand'
]);
case 2:
if (this.getTreePref('urlbar.loadSameDomainToNewChildTab') !== null) {
let value = this.getTreePref('urlbar.loadSameDomainToNewChildTab');
this.setTreePref('urlbar.loadSameDomainToNewTab', value);
this.setTreePref('urlbar.loadSameDomainToNewTab.asChild', value);
if (value) this.setTreePref('urlbar.loadDifferentDomainToNewTab', value);
this.clearTreePref('urlbar.loadSameDomainToNewChildTab');
}
case 3:
if (this.getTreePref('loadDroppedLinkToNewChildTab') !== null) {
this.setTreePref('dropLinksOnTab.behavior',
this.getTreePref('loadDroppedLinkToNewChildTab.confirm') ?
this.kDROPLINK_ASK :
this.getTreePref('loadDroppedLinkToNewChildTab') ?
this.kDROPLINK_NEWTAB :
this.kDROPLINK_LOAD
);
this.clearTreePref('loadDroppedLinkToNewChildTab.confirm');
this.clearTreePref('loadDroppedLinkToNewChildTab');
}
if (this.getTreePref('openGroupBookmarkAsTabSubTree') !== null) {
let behavior = 0;
if (this.getTreePref('openGroupBookmarkAsTabSubTree.underParent'))
behavior += this.kGROUP_BOOKMARK_USE_DUMMY;
if (!this.getTreePref('openGroupBookmarkBehavior.confirm')) {
behavior += (
this.getTreePref('openGroupBookmarkAsTabSubTree') ?
this.kGROUP_BOOKMARK_SUBTREE :
this.getTreePref('browser.tabs.loadFolderAndReplace') ?
this.kGROUP_BOOKMARK_REPLACE :
this.kGROUP_BOOKMARK_SEPARATE
);
}
this.setTreePref('openGroupBookmark.behavior', behavior);
this.clearTreePref('openGroupBookmarkBehavior.confirm');
this.clearTreePref('openGroupBookmarkAsTabSubTree');
this.clearTreePref('openGroupBookmarkAsTabSubTree.underParent');
this.setPref('browser.tabs.loadFolderAndReplace', !!(behavior & this.kGROUP_BOOKMARK_REPLACE));
}
case 4:
let (prefs = [
'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect',
'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.onCurrentTabRemove',
'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.whileFocusMovingByShortcut',
'extensions.treestyletab.autoExpandSubTreeOnAppendChild',
'extensions.treestyletab.autoExpandSubTreeOnCollapsedChildFocused',
'extensions.treestyletab.collapseExpandSubTree.dblclick',
'extensions.treestyletab.createSubTree.underParent',
'extensions.treestyletab.show.context-item-reloadTabSubTree',
'extensions.treestyletab.show.context-item-removeTabSubTree',
'extensions.treestyletab.show.context-item-bookmarkTabSubTree',
'extensions.multipletab.show.multipletab-selection-item-removeTabSubTree',
'extensions.multipletab.show.multipletab-selection-item-createSubTree'
]) {
for (let i = 0, maxi = pref.length; i < maxi; i++)
{
let pref = prefs[i];
let value = this.getPref(pref);
if (value === null) continue;
this.setPref(pref.replace('SubTree', 'Subtree'), value);
this.clearPref(pref);
}
}
case 5:
let (behavior = this.getTreePref('openGroupBookmark.behavior')) {
behavior = behavior | 2048;
this.setTreePref('openGroupBookmark.behavior', behavior);
}
case 6:
let (
general = this.getTreePref('autoAttachNewTabsAsChildren'),
search = this.getTreePref('autoAttachSearchResultAsChildren')
) {
if (general !== null)
this.setTreePref('autoAttach', general);
if (search !== null)
this.setTreePref('autoAttach.searchResult', search);
}
default:
for (let i = 0, maxi = orientalPrefs.length; i < maxi; i++)
{
let pref = orientalPrefs[i];
let value = this.getPref(pref);
if (value === null) continue;
this.setPref(pref+'.horizontal', value);
this.setPref(pref+'.vertical', value);
this.clearPref(pref);
}
break;
}
this.setTreePref('prefsVersion', this.kPREF_VERSION);
},
init : function TSTWindow_init()
{
var w = this.window;
@ -887,7 +779,7 @@ TreeStyleTabWindow.prototype = {
{
return !this.ctrlTabPreviewsEnabled &&
(
this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut') ||
this.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut') ||
this.getTreePref('autoCollapseExpandSubtreeOnSelect')
);
},