タブのフォーカス移動でツリーの自動開閉を行う設定の時、Ctrl-Tabでのフォーカス移動に際しては、Ctrlキーを放したタイミングで初めてツリーの開閉を制御するようにした
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4942 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
3f664f1754
commit
8c06bbf824
@ -1385,6 +1385,7 @@ var TreeStyleTabService = {
|
|||||||
this.onPrefChange('extensions.treestyletab.animation.indent.duration');
|
this.onPrefChange('extensions.treestyletab.animation.indent.duration');
|
||||||
this.onPrefChange('extensions.treestyletab.animation.collapse.duration');
|
this.onPrefChange('extensions.treestyletab.animation.collapse.duration');
|
||||||
this.onPrefChange('extensions.treestyletab.twisty.expandSensitiveArea');
|
this.onPrefChange('extensions.treestyletab.twisty.expandSensitiveArea');
|
||||||
|
this.onPrefChange('extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.whileFocusMovingByShortcut');
|
||||||
},
|
},
|
||||||
initialized : false,
|
initialized : false,
|
||||||
|
|
||||||
@ -1898,7 +1899,8 @@ catch(e) {
|
|||||||
window['piro.sakura.ne.jp'].animationManager.stop();
|
window['piro.sakura.ne.jp'].animationManager.stop();
|
||||||
this.destroyTabBrowser(gBrowser);
|
this.destroyTabBrowser(gBrowser);
|
||||||
|
|
||||||
this.endListenKeyEvents();
|
this.endListenKeyEventsFor(this.LISTEN_FOR_AUTOHIDE);
|
||||||
|
this.endListenKeyEventsFor(this.LISTEN_FOR_AUTOEXPAND_BY_FOCUSCHANGE);
|
||||||
|
|
||||||
document.getElementById('contentAreaContextMenu').removeEventListener('popupshowing', this, false);
|
document.getElementById('contentAreaContextMenu').removeEventListener('popupshowing', this, false);
|
||||||
document.removeEventListener('popupshowing', this, false);
|
document.removeEventListener('popupshowing', this, false);
|
||||||
@ -1990,6 +1992,36 @@ catch(e) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
keyEventListening : false,
|
||||||
|
keyEventListeningFlags : 0,
|
||||||
|
|
||||||
|
LISTEN_FOR_AUTOHIDE : 1,
|
||||||
|
LISTEN_FOR_AUTOEXPAND_BY_FOCUSCHANGE : 2,
|
||||||
|
|
||||||
|
startListenKeyEventsFor : function(aReason)
|
||||||
|
{
|
||||||
|
if (this.keyEventListeningFlags & aReason) return;
|
||||||
|
if (!this.keyEventListening) {
|
||||||
|
window.addEventListener('keydown', this, true);
|
||||||
|
window.addEventListener('keyup', this, true);
|
||||||
|
window.addEventListener('keypress', this, true);
|
||||||
|
this.keyEventListening = true;
|
||||||
|
}
|
||||||
|
this.keyEventListeningFlags |= aReason;
|
||||||
|
},
|
||||||
|
|
||||||
|
endListenKeyEventsFor : function(aReason)
|
||||||
|
{
|
||||||
|
if (!(this.keyEventListeningFlags & aReason)) return;
|
||||||
|
this.keyEventListeningFlags ^= aReason;
|
||||||
|
if (!this.keyEventListeningFlags && this.keyEventListening) {
|
||||||
|
window.removeEventListener('keydown', this, true);
|
||||||
|
window.removeEventListener('keyup', this, true);
|
||||||
|
window.removeEventListener('keypress', this, true);
|
||||||
|
this.keyEventListening = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onKeyDown : function(aEvent)
|
onKeyDown : function(aEvent)
|
||||||
{
|
{
|
||||||
var b = this.browser;
|
var b = this.browser;
|
||||||
@ -2005,7 +2037,8 @@ catch(e) {
|
|||||||
!aEvent.altKey &&
|
!aEvent.altKey &&
|
||||||
this.accelKeyPressed
|
this.accelKeyPressed
|
||||||
) {
|
) {
|
||||||
if (this.getTreePref('tabbar.autoShow.accelKeyDown') &&
|
if (sv.autoHideEnabled &&
|
||||||
|
this.getTreePref('tabbar.autoShow.accelKeyDown') &&
|
||||||
!sv.autoHideShown &&
|
!sv.autoHideShown &&
|
||||||
!sv.delayedAutoShowTimer &&
|
!sv.delayedAutoShowTimer &&
|
||||||
!this.delayedAutoShowForShortcutTimer) {
|
!this.delayedAutoShowForShortcutTimer) {
|
||||||
@ -2023,6 +2056,7 @@ catch(e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (sv.autoHideEnabled)
|
||||||
sv.hideTabbar();
|
sv.hideTabbar();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -2073,25 +2107,43 @@ catch(e) {
|
|||||||
aEvent.charCode == 0 && aEvent.keyCode == 16
|
aEvent.charCode == 0 && aEvent.keyCode == 16
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
if (this.getTreePref('tabbar.autoShow.tabSwitch'))
|
if (sv.autoHideEnabled &&
|
||||||
|
this.getTreePref('tabbar.autoShow.tabSwitch'))
|
||||||
sv.showTabbar(sv.kSHOWN_BY_SHORTCUT);
|
sv.showTabbar(sv.kSHOWN_BY_SHORTCUT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sv.showHideTabbarReason == sv.kSHOWN_BY_SHORTCUT)
|
// when you just release accel key...
|
||||||
|
|
||||||
|
if (sv.autoHideEnabled &&
|
||||||
|
sv.showHideTabbarReason == sv.kSHOWN_BY_SHORTCUT) {
|
||||||
sv.hideTabbar();
|
sv.hideTabbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._tabShouldBeExpandedAfterKeyReleased) {
|
||||||
|
let tab = this._tabShouldBeExpandedAfterKeyReleased;
|
||||||
|
if (this.hasChildTabs(tab) &&
|
||||||
|
(tab.getAttribute(this.kSUBTREE_COLLAPSED) == 'true')) {
|
||||||
|
this.getTabBrowserFromChild(tab)
|
||||||
|
.treeStyleTab
|
||||||
|
.collapseExpandTreesIntelligentlyFor(tab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._tabShouldBeExpandedAfterKeyReleased = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// autohide
|
||||||
|
|
||||||
updateAutoHideKeyListeners : function()
|
updateAutoHideKeyListeners : function()
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
this.getTreePref('tabbar.autoHide.mode') &&
|
this.getTreePref('tabbar.autoHide.mode') &&
|
||||||
this.shouldListenKeyEvents
|
this.shouldListenKeyEventsForAutoHide
|
||||||
) {
|
) {
|
||||||
this.startListenKeyEvents();
|
this.startListenKeyEventsFor(this.LISTEN_FOR_AUTOHIDE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.endListenKeyEvents();
|
this.endListenKeyEventsFor(this.LISTEN_FOR_AUTOHIDE);
|
||||||
}
|
}
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
if (window.windowState != Components.interfaces.nsIDOMChromeWindow.STATE_NORMAL) return;
|
if (window.windowState != Components.interfaces.nsIDOMChromeWindow.STATE_NORMAL) return;
|
||||||
@ -2100,27 +2152,7 @@ catch(e) {
|
|||||||
}, 0);
|
}, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
startListenKeyEvents : function()
|
get shouldListenKeyEventsForAutoHide()
|
||||||
{
|
|
||||||
if (this.keyEventListening) return;
|
|
||||||
window.addEventListener('keydown', this, true);
|
|
||||||
window.addEventListener('keyup', this, true);
|
|
||||||
window.addEventListener('keypress', this, true);
|
|
||||||
this.keyEventListening = true;
|
|
||||||
},
|
|
||||||
|
|
||||||
endListenKeyEvents : function()
|
|
||||||
{
|
|
||||||
if (!this.keyEventListening) return;
|
|
||||||
window.removeEventListener('keydown', this, true);
|
|
||||||
window.removeEventListener('keyup', this, true);
|
|
||||||
window.removeEventListener('keypress', this, true);
|
|
||||||
this.keyEventListening = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
keyEventListening : false,
|
|
||||||
|
|
||||||
get shouldListenKeyEvents()
|
|
||||||
{
|
{
|
||||||
return this.getTreePref('tabbar.autoShow.accelKeyDown') ||
|
return this.getTreePref('tabbar.autoShow.accelKeyDown') ||
|
||||||
this.getTreePref('tabbar.autoShow.tabSwitch') ||
|
this.getTreePref('tabbar.autoShow.tabSwitch') ||
|
||||||
@ -2526,6 +2558,13 @@ catch(e) {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
expandTreeAfterKeyReleased : function(aTab)
|
||||||
|
{
|
||||||
|
if (this.getTreePref('autoCollapseExpandSubTreeOnSelect.whileFocusMovingByShortcut')) return;
|
||||||
|
this._tabShouldBeExpandedAfterKeyReleased = aTab || null;
|
||||||
|
},
|
||||||
|
_tabShouldBeExpandedAfterKeyReleased : null,
|
||||||
|
|
||||||
registerTabFocusAllowance : function(aProcess) /* PUBLIC API */
|
registerTabFocusAllowance : function(aProcess) /* PUBLIC API */
|
||||||
{
|
{
|
||||||
this._tabFocusAllowance.push(aProcess);
|
this._tabFocusAllowance.push(aProcess);
|
||||||
@ -2658,6 +2697,17 @@ catch(e) {
|
|||||||
this.expandTwistyArea = value;
|
this.expandTwistyArea = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.whileFocusMovingByShortcut':
|
||||||
|
case 'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect':
|
||||||
|
if (!this.getTreePref('autoCollapseExpandSubTreeOnSelect.whileFocusMovingByShortcut') &&
|
||||||
|
this.getTreePref('autoCollapseExpandSubTreeOnSelect')) {
|
||||||
|
this.startListenKeyEventsFor(this.LISTEN_FOR_AUTOEXPAND_BY_FOCUSCHANGE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.endListenKeyEventsFor(this.LISTEN_FOR_AUTOEXPAND_BY_FOCUSCHANGE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -199,9 +199,10 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
b.mTabContainer.advanceSelectedTab.toSource().replace(
|
b.mTabContainer.advanceSelectedTab.toSource().replace(
|
||||||
'{',
|
'{',
|
||||||
<![CDATA[$&
|
<![CDATA[$&
|
||||||
if (TreeStyleTabService.getTreePref('focusMode') == TreeStyleTabService.kFOCUS_VISIBLE) {
|
var treeStyleTab = TreeStyleTabService.getTabBrowserFromChild(this).treeStyleTab;
|
||||||
|
treeStyleTab._focusChangedByShortcut = TreeStyleTabService.accelKeyPressed;
|
||||||
|
if (treeStyleTab.getTreePref('focusMode') == treeStyleTab.kFOCUS_VISIBLE) {
|
||||||
(function(aDir, aWrap, aSelf) {
|
(function(aDir, aWrap, aSelf) {
|
||||||
var treeStyleTab = TreeStyleTabService.getTabBrowserFromChild(aSelf).treeStyleTab;
|
|
||||||
var nextTab = (aDir < 0) ? treeStyleTab.getPreviousVisibleTab(aSelf.selectedItem) : treeStyleTab.getNextVisibleTab(aSelf.selectedItem) ;
|
var nextTab = (aDir < 0) ? treeStyleTab.getPreviousVisibleTab(aSelf.selectedItem) : treeStyleTab.getNextVisibleTab(aSelf.selectedItem) ;
|
||||||
if (!nextTab && aWrap) {
|
if (!nextTab && aWrap) {
|
||||||
nextTab = TreeStyleTabService.evaluateXPath(
|
nextTab = TreeStyleTabService.evaluateXPath(
|
||||||
@ -1883,15 +1884,30 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
b.selectedTab = this.getRootTab(tab);
|
b.selectedTab = this.getRootTab(tab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (this.hasChildTabs(tab) &&
|
else if (
|
||||||
(tab.getAttribute(this.kSUBTREE_COLLAPSED) == 'true') &&
|
this.getTreePref('autoCollapseExpandSubTreeOnSelect') &&
|
||||||
this.getTreePref('autoCollapseExpandSubTreeOnSelect')) {
|
(
|
||||||
if (!this._focusChangedByCurrentTabRemove ||
|
!this._focusChangedByCurrentTabRemove ||
|
||||||
this.getTreePref('autoCollapseExpandSubTreeOnSelect.onCurrentTabRemove'))
|
this.getTreePref('autoCollapseExpandSubTreeOnSelect.onCurrentTabRemove')
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
if (!this.hasChildTabs(tab) || (tab.getAttribute(this.kSUBTREE_COLLAPSED) != 'true'))
|
||||||
|
tab = null;
|
||||||
|
|
||||||
|
if (
|
||||||
|
this._focusChangedByShortcut &&
|
||||||
|
this.accelKeyPressed &&
|
||||||
|
!this.getTreePref('autoCollapseExpandSubTreeOnSelect.whileFocusMovingByShortcut')
|
||||||
|
) {
|
||||||
|
TreeStyleTabService.expandTreeAfterKeyReleased(tab);
|
||||||
|
}
|
||||||
|
else {
|
||||||
this.collapseExpandTreesIntelligentlyWithDelayFor(tab);
|
this.collapseExpandTreesIntelligentlyWithDelayFor(tab);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this._focusChangedByCurrentTabRemove = false;
|
this._focusChangedByCurrentTabRemove = false;
|
||||||
|
this._focusChangedByShortcut = false;
|
||||||
|
|
||||||
if (this.autoHideEnabled && this.autoHideShown)
|
if (this.autoHideEnabled && this.autoHideShown)
|
||||||
this.redrawContentArea();
|
this.redrawContentArea();
|
||||||
@ -3435,9 +3451,9 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
collapseExpandTreesIntelligentlyFor : function(aTab, aJustNow)
|
collapseExpandTreesIntelligentlyFor : function(aTab, aJustNow)
|
||||||
{
|
{
|
||||||
var b = this.mTabBrowser;
|
if (!aTab || this.doingCollapseExpand) return;
|
||||||
if (this.doingCollapseExpand) return;
|
|
||||||
|
|
||||||
|
var b = this.mTabBrowser;
|
||||||
var sameParentTab = this.getParentTab(aTab);
|
var sameParentTab = this.getParentTab(aTab);
|
||||||
var expandedParentTabs = [
|
var expandedParentTabs = [
|
||||||
aTab.getAttribute(this.kID)
|
aTab.getAttribute(this.kID)
|
||||||
@ -4074,8 +4090,8 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.mTabBrowser.mPanelContainer.addEventListener('scroll', this, true);
|
this.mTabBrowser.mPanelContainer.addEventListener('scroll', this, true);
|
||||||
if (this.shouldListenMouseMove)
|
if (this.shouldListenMouseMove)
|
||||||
this.startListenMouseMove();
|
this.startListenMouseMove();
|
||||||
if (this.mTabBrowser == gBrowser && this.shouldListenKeyEvents)
|
if (this.mTabBrowser == gBrowser && this.shouldListenKeyEventsForAutoHide)
|
||||||
TreeStyleTabService.startListenKeyEvents();
|
TreeStyleTabService.startListenKeyEventsFor(this.LISTEN_FOR_AUTOHIDE);
|
||||||
|
|
||||||
this.clearTabbarCanvas();
|
this.clearTabbarCanvas();
|
||||||
this.updateTabbarTransparency();
|
this.updateTabbarTransparency();
|
||||||
@ -4100,7 +4116,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.mTabBrowser.mPanelContainer.removeEventListener('scroll', this, true);
|
this.mTabBrowser.mPanelContainer.removeEventListener('scroll', this, true);
|
||||||
this.endListenMouseMove();
|
this.endListenMouseMove();
|
||||||
if (this.mTabBrowser == gBrowser)
|
if (this.mTabBrowser == gBrowser)
|
||||||
TreeStyleTabService.endListenKeyEvents();
|
TreeStyleTabService.endListenKeyEventsFor(this.LISTEN_FOR_AUTOHIDE);
|
||||||
|
|
||||||
this.clearTabbarCanvas();
|
this.clearTabbarCanvas();
|
||||||
this.updateTabbarTransparency();
|
this.updateTabbarTransparency();
|
||||||
|
@ -92,6 +92,7 @@ pref("extensions.treestyletab.useEffectiveTLD", true);
|
|||||||
|
|
||||||
pref("extensions.treestyletab.autoCollapseExpandSubTreeOnSelect", true);
|
pref("extensions.treestyletab.autoCollapseExpandSubTreeOnSelect", true);
|
||||||
pref("extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.onCurrentTabRemove", true);
|
pref("extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.onCurrentTabRemove", true);
|
||||||
|
pref("extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.whileFocusMovingByShortcut", false);
|
||||||
pref("extensions.treestyletab.collapseExpandSubTree.dblclick", false);
|
pref("extensions.treestyletab.collapseExpandSubTree.dblclick", false);
|
||||||
pref("extensions.treestyletab.autoExpandSubTreeOnCollapsedChildFocused", true);
|
pref("extensions.treestyletab.autoExpandSubTreeOnCollapsedChildFocused", true);
|
||||||
pref("extensions.treestyletab.autoExpandSubTreeOnAppendChild", true);
|
pref("extensions.treestyletab.autoExpandSubTreeOnAppendChild", true);
|
||||||
|
Loading…
Reference in New Issue
Block a user