From 15ca73e0013027b5617f85dcce278919cda7a011 Mon Sep 17 00:00:00 2001 From: SHIMODA Hiroshi Date: Fri, 25 Mar 2011 11:42:50 +0900 Subject: [PATCH 1/5] show scrollbar in the tab bar with narrow width --- content/treestyletab/treestyletab.css | 13 +++ content/treestyletab/treestyletabbrowser.js | 4 + defaults/preferences/treestyletab.js | 2 + modules/utils.js | 89 ++++++++++++++++----- 4 files changed, 87 insertions(+), 21 deletions(-) diff --git a/content/treestyletab/treestyletab.css b/content/treestyletab/treestyletab.css index c10aa701..31f01666 100644 --- a/content/treestyletab/treestyletab.css +++ b/content/treestyletab/treestyletab.css @@ -282,6 +282,19 @@ toolbar.treestyletab-tabbar-toolbar[treestyletab-mode="vertical"] } +tabs.tabbrowser-tabs[treestyletab-tabbar-position="left"] + > .tabbrowser-arrowscrollbox + > .arrowscrollbox-scrollbox { + direction: rtl; +} +tabs.tabbrowser-tabs[treestyletab-tabbar-position="left"] + > .tabbrowser-arrowscrollbox + > .arrowscrollbox-scrollbox + > .scrollbox-innerbox { + direction: ltr; +} + + /* animation effects */ .tabbrowser-tabs[treestyletab-animation-enabled="true"][treestyletab-mode="vertical"]:not([treestyletab-tab-inverted="true"]) diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index b5893c10..38a27c77 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -442,6 +442,7 @@ TreeStyleTabBrowser.prototype = { this.onPrefChange('extensions.treestyletab.tabbar.invertTabContents'); this.onPrefChange('extensions.treestyletab.tabbar.invertClosebox'); this.onPrefChange('extensions.treestyletab.tabbar.autoShow.mousemove'); + this.onPrefChange('extensions.treestyletab.tabbar.narrowScrollbar'); this.onPrefChange('extensions.treestyletab.animation.enabled'); this.ObserverService.addObserver(this, this.kTOPIC_INDENT_MODIFIED, false); @@ -2039,6 +2040,9 @@ TreeStyleTabBrowser.prototype = { } return; + case 'extensions.treestyletab.tabbar.narrowScrollbar': + return this.setTabbrowserAttribute(this.kNARROW_SCROLLBAR, value); + case 'extensions.treestyletab.maxTreeLevel.phisical': if (this.maxTreeLevelPhisical = value) this.promoteTooDeepLevelTabs(); diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index df825a26..3c64f72f 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -15,6 +15,8 @@ pref("extensions.treestyletab.tabbar.scroll.smooth", true); pref("extensions.treestyletab.tabbar.scroll.duration", 250); // 0 = no scroll, 1 = scroll to new tab only when the current tab will not scrolled out, 2 = scroll to new tab always pref("extensions.treestyletab.tabbar.scrollToNewTab.mode", 1); +pref("extensions.treestyletab.tabbar.narrowScrollbar", true); +pref("extensions.treestyletab.tabbar.narrowScrollbar.size", "0.8em"); // flat, mixed, vertigo // pref("extensions.treestyletab.tabbar.style", "mixed"); pref("extensions.treestyletab.platform.default.tabbar.style", "mixed"); diff --git a/modules/utils.js b/modules/utils.js index cb6f837a..acf14c45 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -95,6 +95,7 @@ var TreeStyleTabUtils = { kMAX_LEVEL : 'treestyletab-max-tree-level', kPRINT_PREVIEW : 'treestyletab-print-preview', kANIMATION_ENABLED : 'treestyletab-animation-enabled', + kNARROW_SCROLLBAR : 'treestyletab-narrow-scrollbar', kTAB_INVERTED : 'treestyletab-tab-inverted', kTAB_CONTENTS_INVERTED : 'treestyletab-tab-contents-inverted', @@ -318,6 +319,7 @@ var TreeStyleTabUtils = { this.onPrefChange('extensions.treestyletab.tabbar.scroll.smooth'); this.onPrefChange('extensions.treestyletab.tabbar.scroll.duration'); this.onPrefChange('extensions.treestyletab.tabbar.scrollToNewTab.mode'); + this.onPrefChange('extensions.treestyletab.tabbar.narrowScrollbar.size'); this.onPrefChange('extensions.treestyletab.animation.enabled'); this.onPrefChange('extensions.treestyletab.animation.indent.duration'); this.onPrefChange('extensions.treestyletab.animation.collapse.duration'); @@ -354,6 +356,57 @@ var TreeStyleTabUtils = { Components.utils.import('resource://gre/modules/WindowsPreviewPerTab.jsm', ns); this.AeroPeek = ns.AeroPeek; }, + + updateNarrowScrollbarStyle : function TSTUtils_updateNarrowScrollbarStyle() + { + const SSS = Cc['@mozilla.org/content/style-sheet-service;1'] + .getService(Ci.nsIStyleSheetService); + + if (this.lastAgentSheet && + SSS.sheetRegistered(this.lastAgentSheet, SSS.AGENT_SHEET)) + SSS.unregisterSheet(this.lastAgentSheet, SSS.AGENT_SHEET); + + const style = 'data:text/css,'+encodeURIComponent( + .tabbrowser-arrowscrollbox + > .arrowscrollbox-scrollbox + > scrollbar[orient="vertical"], + tabs.tabbrowser-tabs[%MODE%="vertical"][%NARROW%="true"] + > .tabbrowser-arrowscrollbox + > .arrowscrollbox-scrollbox + > scrollbar[orient="vertical"] * { + max-width: %SIZE%; + min-width: %SIZE%; + } + + tabs.tabbrowser-tabs[%MODE%="vertical"][%NARROW%="true"] + > .tabbrowser-arrowscrollbox + > .arrowscrollbox-scrollbox + > scrollbar[orient="vertical"] { + font-size: %SIZE%; + } + + tabs.tabbrowser-tabs[%MODE%="vertical"][%NARROW%="true"] + > .tabbrowser-arrowscrollbox + > .arrowscrollbox-scrollbox + > scrollbar[orient="vertical"] * { + padding-left: 0; + padding-right: 0; + margin-left: 0; + margin-right: 0; + } + ]]>.toString() + .replace(/%MODE%/g, this.kMODE) + .replace(/%NARROW%/g, this.kNARROW_SCROLLBAR) + .replace(/%SIZE%/g, this.getTreePref('tabbar.narrowScrollbar.size')) + ); + this.lastAgentSheet = this.makeURIFromSpec(style); + SSS.loadAndRegisterSheet(this.lastAgentSheet, SSS.AGENT_SHEET); + }, + lastAgentSheet : null, observe : function TSTUtils_observe(aSubject, aTopic, aData) { @@ -2107,12 +2160,11 @@ var TreeStyleTabUtils = { case 'extensions.treestyletab.indent': this.baseIndent = value; this.ObserverService.notifyObservers(null, this.kTOPIC_INDENT_MODIFIED, value); - break; + return; case 'extensions.treestyletab.tabbar.width': case 'extensions.treestyletab.tabbar.shrunkenWidth': - this.updateTabWidthPrefs(aPrefName); - break; + return this.updateTabWidthPrefs(aPrefName); case 'browser.tabs.insertRelatedAfterCurrent': case 'browser.tabs.loadFolderAndReplace': @@ -2138,39 +2190,34 @@ var TreeStyleTabUtils = { this.setPref(target, this.getPref(aPrefName)); } this.prefOverriding = false; - break; + return; case 'extensions.treestyletab.clickOnIndentSpaces.enabled': - this.shouldDetectClickOnIndentSpaces = this.getPref(aPrefName); - break; + return this.shouldDetectClickOnIndentSpaces = this.getPref(aPrefName); case 'extensions.treestyletab.tabbar.scroll.smooth': - this.smoothScrollEnabled = value; - break; + return this.smoothScrollEnabled = value; case 'extensions.treestyletab.tabbar.scroll.duration': - this.smoothScrollDuration = value; - break; + return this.smoothScrollDuration = value; case 'extensions.treestyletab.tabbar.scrollToNewTab.mode': - this.scrollToNewTabMode = value; - break; + return this.scrollToNewTabMode = value; + + case 'extensions.treestyletab.tabbar.narrowScrollbar.size': + return this.updateNarrowScrollbarStyle(); case 'extensions.treestyletab.animation.enabled': - this.animationEnabled = value; - break; + return this.animationEnabled = value; case 'extensions.treestyletab.animation.indent.duration': - this.indentDuration = value; - break; + return this.indentDuration = value; case 'extensions.treestyletab.animation.collapse.duration': - this.collapseDuration = value; - break; + return this.collapseDuration = value; case 'extensions.treestyletab.twisty.expandSensitiveArea': - this.shouldExpandTwistyArea = value; - break; + return this.shouldExpandTwistyArea = value; default: - break; + return; } }, From 78871944c6d3d2d215213d10390377ff165a3fde Mon Sep 17 00:00:00 2001 From: SHIMODA Hiroshi Date: Fri, 25 Mar 2011 11:55:24 +0900 Subject: [PATCH 2/5] apply narrow scrollbar styles fro Firefox 3.6 --- content/treestyletab/treestyletab.css | 8 ++++---- modules/utils.js | 17 +++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/content/treestyletab/treestyletab.css b/content/treestyletab/treestyletab.css index 31f01666..155522ca 100644 --- a/content/treestyletab/treestyletab.css +++ b/content/treestyletab/treestyletab.css @@ -283,13 +283,13 @@ toolbar.treestyletab-tabbar-toolbar[treestyletab-mode="vertical"] tabs.tabbrowser-tabs[treestyletab-tabbar-position="left"] - > .tabbrowser-arrowscrollbox - > .arrowscrollbox-scrollbox { + .tabbrowser-arrowscrollbox + > scrollbox { direction: rtl; } tabs.tabbrowser-tabs[treestyletab-tabbar-position="left"] - > .tabbrowser-arrowscrollbox - > .arrowscrollbox-scrollbox + .tabbrowser-arrowscrollbox + > scrollbox > .scrollbox-innerbox { direction: ltr; } diff --git a/modules/utils.js b/modules/utils.js index acf14c45..d4dc651c 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -371,27 +371,28 @@ var TreeStyleTabUtils = { @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); tabs.tabbrowser-tabs[%MODE%="vertical"][%NARROW%="true"] - > .tabbrowser-arrowscrollbox - > .arrowscrollbox-scrollbox + .tabbrowser-arrowscrollbox + > scrollbox > scrollbar[orient="vertical"], tabs.tabbrowser-tabs[%MODE%="vertical"][%NARROW%="true"] - > .tabbrowser-arrowscrollbox - > .arrowscrollbox-scrollbox + .tabbrowser-arrowscrollbox + > scrollbox > scrollbar[orient="vertical"] * { max-width: %SIZE%; min-width: %SIZE%; } tabs.tabbrowser-tabs[%MODE%="vertical"][%NARROW%="true"] - > .tabbrowser-arrowscrollbox - > .arrowscrollbox-scrollbox + .tabbrowser-arrowscrollbox + > scrollbox > scrollbar[orient="vertical"] { font-size: %SIZE%; + overflow: hidden; } tabs.tabbrowser-tabs[%MODE%="vertical"][%NARROW%="true"] - > .tabbrowser-arrowscrollbox - > .arrowscrollbox-scrollbox + .tabbrowser-arrowscrollbox + > scrollbox > scrollbar[orient="vertical"] * { padding-left: 0; padding-right: 0; From f272ed650a409cc62563a48f0ea6cdabc6ab89e1 Mon Sep 17 00:00:00 2001 From: SHIMODA Hiroshi Date: Fri, 25 Mar 2011 11:57:56 +0900 Subject: [PATCH 3/5] remove needless style --- modules/utils.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/utils.js b/modules/utils.js index d4dc651c..165f805b 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -387,7 +387,6 @@ var TreeStyleTabUtils = { > scrollbox > scrollbar[orient="vertical"] { font-size: %SIZE%; - overflow: hidden; } tabs.tabbrowser-tabs[%MODE%="vertical"][%NARROW%="true"] From 9cbf74c98b0613c5801076f6019efee6f8d879aa Mon Sep 17 00:00:00 2001 From: SHIMODA Hiroshi Date: Fri, 25 Mar 2011 12:06:12 +0900 Subject: [PATCH 4/5] add checkbox to disable narrow scrollbar --- content/treestyletab/config.xul | 6 ++++++ locale/de-DE/treestyletab/treestyletab.dtd | 1 + locale/en-US/treestyletab/treestyletab.dtd | 1 + locale/es-ES/treestyletab/treestyletab.dtd | 1 + locale/fr-FR/treestyletab/treestyletab.dtd | 1 + locale/it-IT/treestyletab/treestyletab.dtd | 1 + locale/ja/treestyletab/treestyletab.dtd | 1 + locale/pl/treestyletab/treestyletab.dtd | 1 + locale/ru-RU/treestyletab/treestyletab.dtd | 1 + locale/sv-SE/treestyletab/treestyletab.dtd | 1 + locale/zh-CN/treestyletab/treestyletab.dtd | 1 + locale/zh-TW/treestyletab/treestyletab.dtd | 1 + 12 files changed, 17 insertions(+) diff --git a/content/treestyletab/config.xul b/content/treestyletab/config.xul index 6ce934be..ad6be750 100644 --- a/content/treestyletab/config.xul +++ b/content/treestyletab/config.xul @@ -49,6 +49,9 @@ + @@ -115,6 +118,9 @@ label="&config.tabbar.invertClosebox.left;" label-left="&config.tabbar.invertClosebox.left;" label-right="&config.tabbar.invertClosebox.right;"/> + + diff --git a/locale/en-US/treestyletab/treestyletab.dtd b/locale/en-US/treestyletab/treestyletab.dtd index cf92c51d..d528d02f 100644 --- a/locale/en-US/treestyletab/treestyletab.dtd +++ b/locale/en-US/treestyletab/treestyletab.dtd @@ -15,6 +15,7 @@ + diff --git a/locale/es-ES/treestyletab/treestyletab.dtd b/locale/es-ES/treestyletab/treestyletab.dtd index 71d69e07..fcc253c5 100644 --- a/locale/es-ES/treestyletab/treestyletab.dtd +++ b/locale/es-ES/treestyletab/treestyletab.dtd @@ -15,6 +15,7 @@ + diff --git a/locale/fr-FR/treestyletab/treestyletab.dtd b/locale/fr-FR/treestyletab/treestyletab.dtd index eb010a32..9d9210a8 100644 --- a/locale/fr-FR/treestyletab/treestyletab.dtd +++ b/locale/fr-FR/treestyletab/treestyletab.dtd @@ -15,6 +15,7 @@ + diff --git a/locale/it-IT/treestyletab/treestyletab.dtd b/locale/it-IT/treestyletab/treestyletab.dtd index d1c0e963..4be0b3a9 100644 --- a/locale/it-IT/treestyletab/treestyletab.dtd +++ b/locale/it-IT/treestyletab/treestyletab.dtd @@ -15,6 +15,7 @@ + diff --git a/locale/ja/treestyletab/treestyletab.dtd b/locale/ja/treestyletab/treestyletab.dtd index 191b5914..bdd1a617 100644 --- a/locale/ja/treestyletab/treestyletab.dtd +++ b/locale/ja/treestyletab/treestyletab.dtd @@ -15,6 +15,7 @@ + diff --git a/locale/pl/treestyletab/treestyletab.dtd b/locale/pl/treestyletab/treestyletab.dtd index 9d5277b4..04d89162 100644 --- a/locale/pl/treestyletab/treestyletab.dtd +++ b/locale/pl/treestyletab/treestyletab.dtd @@ -15,6 +15,7 @@ + diff --git a/locale/ru-RU/treestyletab/treestyletab.dtd b/locale/ru-RU/treestyletab/treestyletab.dtd index 6c918173..8df9f09d 100755 --- a/locale/ru-RU/treestyletab/treestyletab.dtd +++ b/locale/ru-RU/treestyletab/treestyletab.dtd @@ -15,6 +15,7 @@ + diff --git a/locale/sv-SE/treestyletab/treestyletab.dtd b/locale/sv-SE/treestyletab/treestyletab.dtd index 20115397..e93bdfe5 100644 --- a/locale/sv-SE/treestyletab/treestyletab.dtd +++ b/locale/sv-SE/treestyletab/treestyletab.dtd @@ -15,6 +15,7 @@ + diff --git a/locale/zh-CN/treestyletab/treestyletab.dtd b/locale/zh-CN/treestyletab/treestyletab.dtd index 1d1ff93a..c0c94ffc 100644 --- a/locale/zh-CN/treestyletab/treestyletab.dtd +++ b/locale/zh-CN/treestyletab/treestyletab.dtd @@ -15,6 +15,7 @@ + diff --git a/locale/zh-TW/treestyletab/treestyletab.dtd b/locale/zh-TW/treestyletab/treestyletab.dtd index 08e38a3a..a0c3e8cc 100644 --- a/locale/zh-TW/treestyletab/treestyletab.dtd +++ b/locale/zh-TW/treestyletab/treestyletab.dtd @@ -15,6 +15,7 @@ + From 29396bb18c41370c3d0728bb8cc66557b658fafa Mon Sep 17 00:00:00 2001 From: SHIMODA Hiroshi Date: Fri, 25 Mar 2011 12:12:33 +0900 Subject: [PATCH 5/5] inverted scrollbar can be disabled by a secret pref "extensions.treestyletab.tabbar.invertScrollbar" --- content/treestyletab/treestyletab.css | 4 ++-- content/treestyletab/treestyletabbrowser.js | 3 +++ defaults/preferences/treestyletab.js | 1 + modules/utils.js | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/content/treestyletab/treestyletab.css b/content/treestyletab/treestyletab.css index 155522ca..01afaf02 100644 --- a/content/treestyletab/treestyletab.css +++ b/content/treestyletab/treestyletab.css @@ -282,12 +282,12 @@ toolbar.treestyletab-tabbar-toolbar[treestyletab-mode="vertical"] } -tabs.tabbrowser-tabs[treestyletab-tabbar-position="left"] +tabs.tabbrowser-tabs[treestyletab-tabbar-position="left"][treestyletab-invert-scrollbar="true"] .tabbrowser-arrowscrollbox > scrollbox { direction: rtl; } -tabs.tabbrowser-tabs[treestyletab-tabbar-position="left"] +tabs.tabbrowser-tabs[treestyletab-tabbar-position="left"][treestyletab-invert-scrollbar="true"] .tabbrowser-arrowscrollbox > scrollbox > .scrollbox-innerbox { diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 38a27c77..725f21bb 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -442,6 +442,7 @@ TreeStyleTabBrowser.prototype = { this.onPrefChange('extensions.treestyletab.tabbar.invertTabContents'); this.onPrefChange('extensions.treestyletab.tabbar.invertClosebox'); this.onPrefChange('extensions.treestyletab.tabbar.autoShow.mousemove'); + this.onPrefChange('extensions.treestyletab.tabbar.invertScrollbar'); this.onPrefChange('extensions.treestyletab.tabbar.narrowScrollbar'); this.onPrefChange('extensions.treestyletab.animation.enabled'); @@ -2040,6 +2041,8 @@ TreeStyleTabBrowser.prototype = { } return; + case 'extensions.treestyletab.tabbar.invertScrollbar': + return this.setTabbrowserAttribute(this.kINVERT_SCROLLBAR, value); case 'extensions.treestyletab.tabbar.narrowScrollbar': return this.setTabbrowserAttribute(this.kNARROW_SCROLLBAR, value); diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index 3c64f72f..a82cfd33 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -15,6 +15,7 @@ pref("extensions.treestyletab.tabbar.scroll.smooth", true); pref("extensions.treestyletab.tabbar.scroll.duration", 250); // 0 = no scroll, 1 = scroll to new tab only when the current tab will not scrolled out, 2 = scroll to new tab always pref("extensions.treestyletab.tabbar.scrollToNewTab.mode", 1); +pref("extensions.treestyletab.tabbar.invertScrollbar", true); pref("extensions.treestyletab.tabbar.narrowScrollbar", true); pref("extensions.treestyletab.tabbar.narrowScrollbar.size", "0.8em"); // flat, mixed, vertigo diff --git a/modules/utils.js b/modules/utils.js index 165f805b..0aba0acd 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -95,6 +95,7 @@ var TreeStyleTabUtils = { kMAX_LEVEL : 'treestyletab-max-tree-level', kPRINT_PREVIEW : 'treestyletab-print-preview', kANIMATION_ENABLED : 'treestyletab-animation-enabled', + kINVERT_SCROLLBAR : 'treestyletab-invert-scrollbar', kNARROW_SCROLLBAR : 'treestyletab-narrow-scrollbar', kTAB_INVERTED : 'treestyletab-tab-inverted',