From d1200d2264c420e58391ce61ace5b187940cd4d3 Mon Sep 17 00:00:00 2001 From: Piro / YUKI Hiroshi Date: Tue, 16 Feb 2016 01:32:56 +0900 Subject: [PATCH] Add secret preferences to disable multicolumn pseud tree * extensions.treestyletab.groupTab.columnize * extensions.treestyletab.tooltip.columnize --- defaults/preferences/treestyletab.js | 9 +++++++++ modules/fullTooltip.js | 14 ++++++++++---- modules/groupTab.js | 6 ++++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index 676f8e6b..70390fde 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -348,6 +348,10 @@ pref("extensions.treestyletab.tooltip.maxCount", 10); * Negative value means "do not show full tooltip". */ pref("extensions.treestyletab.tooltip.fullTooltipDelay", 2000); +/** + * If true, too many items are shown in multiple columns. + */ +pref("extensions.treestyletab.tooltip.columnize", true); /** * Visibility of extra menu items for the context menu on tabs, inserted by TST. @@ -660,6 +664,11 @@ pref("extensions.treestyletab.createSubtree.underParent.temporaryGroup", true); */ pref("extensions.treestyletab.pinnedTab.faviconized", true); +/** + * If true, too many items are shown in multiple columns in a dummy (group) tab. + */ +pref("extensions.treestyletab.groupTab.columnize", true); + /** * Compatibility hack flags for other addons. They can be disabled by each * addon, when the addon become working with TST without dirty hacks. diff --git a/modules/fullTooltip.js b/modules/fullTooltip.js index 1f0b3f6b..9c93e864 100644 --- a/modules/fullTooltip.js +++ b/modules/fullTooltip.js @@ -212,14 +212,19 @@ FullTooltipManager.prototype = inherit(TreeStyleTabBase, { { this.startListenTooltipEvents(); - var tooltip = this.tabFullTooltip; - var currentScreen = this.getCurrentScreen(tooltip.boxObject); - var tree = tooltip.lastChild.lastChild.lastChild; + if (utils.getTreePref('tooltip.columnize')) { + let tooltip = this.tabFullTooltip; + let currentScreen = this.getCurrentScreen(tooltip.boxObject); + let tree = tooltip.lastChild.lastChild.lastChild; PseudoTreeBuilder.columnizeTree(tree, { width : currentScreen.allowedWidth, height : currentScreen.allowedHeight }); this.window.setTimeout(this.resizeTooltip.bind(this), 0); + } + else { + this.resizeTooltip(); + } }, resizeTooltip : function FTM_resizeTooltip() { @@ -473,7 +478,8 @@ FullTooltipManager.prototype = inherit(TreeStyleTabBase, { var tree = PseudoTreeBuilder.build(aTab); var root = this.document.createElement('arrowscrollbox'); - root.setAttribute('orient', 'horizontal'); + var orient = utils.getTreePref('tooltip.columnize') ? 'horizontal' : 'vertical' ; + root.setAttribute('orient', orient); root.setAttribute('flex', 1); var container = root.appendChild(this.document.createElement('vbox')); diff --git a/modules/groupTab.js b/modules/groupTab.js index 5bab20af..fba531fb 100644 --- a/modules/groupTab.js +++ b/modules/groupTab.js @@ -39,11 +39,15 @@ var EXPORTED_SYMBOLS = ['GroupTab']; const Cc = Components.classes; const Ci = Components.interfaces; +Components.utils.import('resource://gre/modules/XPCOMUtils.jsm'); + Components.utils.import('resource://treestyletab-modules/lib/inherit.jsm'); Components.utils.import('resource://treestyletab-modules/base.js'); Components.utils.import('resource://treestyletab-modules/pseudoTreeBuilder.js'); Components.utils.import('resource://treestyletab-modules/tabAttributesObserver.js'); +XPCOMUtils.defineLazyModuleGetter(this, 'utils', 'resource://treestyletab-modules/utils.js', 'TreeStyleTabUtils'); + function GroupTab(aWindow) { this.window = aWindow; @@ -403,6 +407,8 @@ GroupTab.prototype = inherit(TreeStyleTabBase, { onResize : function GT_onResize() { + if (!utils.getTreePref('groupTab.columnize')) + return; var container = this.document.getElementById('tree'); var tree = container.firstChild; PseudoTreeBuilder.columnizeTree(tree);