1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 09:44:13 +01:00

Kill tab bindings.

This commit is contained in:
Kris Maglione
2010-12-17 00:46:26 -05:00
parent 2b254ecc6b
commit a73ee765d8
8 changed files with 41 additions and 112 deletions

View File

@@ -24,89 +24,6 @@
<!-- No white space. The table is white-space: pre; :( -->
<content><html:span class="td-strut"/><html:span class="td-span"><children/></html:span></content>
</binding>
<binding id="tab-3" display="xul:hbox"
extends="chrome://browser/content/tabbrowser.xml#tabbrowser-tab">
<content context="tabContextMenu" closetabtext="Close Tab">
<xul:stack class="tab-icon dactyl-tab-stack">
<xul:image xbl:inherits="validate,src=image" role="presentation"
class="tab-icon-image" dactyl:highlight="TabIcon"/>
<xul:vbox>
<xul:spring flex="1"/>
<xul:label xbl:inherits="value=ordinal" dactyl:highlight="TabIconNumber"/>
<xul:spring flex="1"/>
</xul:vbox>
</xul:stack>
<xul:label xbl:inherits="value=ordinal" dactyl:highlight="TabNumber"/>
<xul:label flex="1"
xbl:inherits="value=label,crop,accesskey"
class="tab-text" dactyl:highlight="TabText"
role="presentation"/>
<xul:toolbarbutton anonid="close-button"
tabindex="-1"
class="tab-close-button" dactyl:highlight="TabClose"/>
</content>
</binding>
<binding id="tab-4" display="xul:hbox"
extends="chrome://browser/content/tabbrowser.xml#tabbrowser-tab">
<content context="tabContextMenu" closetabtext="Close Tab">
<xul:stack class="tab-stack" flex="1">
<xul:vbox class="tab-progress-container">
<xul:progressmeter class="tab-progress" mode="normal"
xbl:inherits="value=progresspercent,busy,stalled,fadein,selected"/>
</xul:vbox>
<xul:hbox class="tab-content" align="center">
<xul:stack class="tab-icon dactyl-tab-stack">
<xul:image xbl:inherits="validate,src=image,fadein,pinned,busy,stalled,selected"
class="tab-icon-image" dactyl:highlight="TabIcon"
role="presentation"/>
<xul:vbox>
<xul:spring flex="1"/>
<xul:label xbl:inherits="value=ordinal" dactyl:highlight="TabIconNumber"/>
<xul:spring flex="1"/>
</xul:vbox>
</xul:stack>
<xul:label xbl:inherits="value=ordinal" dactyl:highlight="TabNumber"/>
<xul:label flex="1"
xbl:inherits="value=label,crop,accesskey,fadein,pinned,selected"
class="tab-text" dactyl:highlight="TabText"
role="presentation"/>
<xul:toolbarbutton anonid="close-button"
xbl:inherits="fadein,pinned,selected"
tabindex="-1"
clickthrough="never"
class="tab-close-button" dactyl:highlight="TabClose"/>
</xul:hbox>
</xul:stack>
</content>
</binding>
<binding id="tab-mac"
extends="chrome://browser/content/tabbrowser.xml#tabbrowser-tab">
<content chromedir="ltr" closetabtext="Close Tab">
<xul:hbox class="tab-image-left" xbl:inherits="selected"/>
<xul:hbox class="tab-image-middle" flex="1" align="center" xbl:inherits="selected">
<xul:stack class="tab-icon dactyl-tab-stack">
<xul:image xbl:inherits="validate,src=image" class="tab-icon-image"/>
<xul:image class="tab-extra-status"/>
<xul:vbox>
<xul:spring flex="1"/>
<xul:label xbl:inherits="value=ordinal" dactyl:highlight="TabIconNumber"/>
<xul:spring flex="1"/>
</xul:vbox>
</xul:stack>
<xul:stack class="tab-text-stack">
<xul:label xbl:inherits="value=ordinal" class="tab-text" dactyl:highlight="TabNumber"/>
</xul:stack>
<xul:stack class="tab-text-stack" flex="1">
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" crop="right" class="tab-text"/>
</xul:stack>
</xul:hbox>
<xul:toolbarbutton anonid="close-button" tabindex="-1" class="tab-close-button"/>
<xul:hbox class="tab-image-right" xbl:inherits="selected"/>
</content>
</binding>
</bindings>
<!-- vim:se ft=xbl sw=4 sts=4 tw=0 et: -->

View File

@@ -234,13 +234,18 @@ const ConfigBase = Class(ModuleBase, {
TabClose;.tab-close-button
TabIcon;.tab-icon
TabText;.tab-text
!TabNumber font-weight: bold; margin: 0px; padding-right: .3ex;
!TabIconNumber {
TabNumber font-weight: bold; margin: 0px; padding-right: .3ex;
TabNumber::after content: counter(dactyl-tab-number);
TabIconNumber {
width: 16px;
margin-left: -16px;
display: block;
font-weight: bold;
color: white;
text-align: center;
text-shadow: black -1px 0 1px, black 0 1px 1px, black 1px 0 1px, black 0 -1px 1px;
}
TabIconNumber::after content: counter(dactyl-tab-number);
Title color: magenta; background: white; font-weight: bold;
URL text-decoration: none; color: green; background: inherit;

View File

@@ -1237,9 +1237,6 @@ const Dactyl = Module("dactyl", {
styles.addSheet(true, "taboptions", "chrome://*",
classes.length ? classes.join(",") + "{ display: none; }" : "");
tabs.tabBinding.enabled = Array.some(opts, function (k) k in this.opts, this);
statusline.updateTabCount();
}
}
].filter(function (group) !group.feature || dactyl.has(group.feature));

View File

@@ -72,16 +72,16 @@ const Events = Module("events", {
};
this._activeMenubar = false;
this.addSessionListener(window, "DOMMenuBarActive", this.closure.onDOMMenuBarActive, true);
this.addSessionListener(window, "DOMMenuBarInactive", this.closure.onDOMMenuBarInactive, true);
this.addSessionListener(window, "focus", this.wrapListener(this.onFocus), true);
this.addSessionListener(window, "keydown", this.wrapListener(this.onKeyUpOrDown), true);
this.addSessionListener(window, "keypress", this.wrapListener(this.onKeyPress), true);
this.addSessionListener(window, "keyup", this.wrapListener(this.onKeyUpOrDown), true);
this.addSessionListener(window, "mousedown", this.wrapListener(this.onMouseDown), true);
this.addSessionListener(window, "popuphidden", this.closure.onPopupHidden, true);
this.addSessionListener(window, "popupshown", this.closure.onPopupShown, true);
this.addSessionListener(window, "resize", this.closure.onResize, true);
this.addSessionListener(window, "DOMMenuBarActive", this.onDOMMenuBarActive, true);
this.addSessionListener(window, "DOMMenuBarInactive", this.onDOMMenuBarInactive, true);
this.addSessionListener(window, "focus", this.onFocus, true);
this.addSessionListener(window, "keydown", this.onKeyUpOrDown, true);
this.addSessionListener(window, "keypress", this.onKeyPress, true);
this.addSessionListener(window, "keyup", this.onKeyUpOrDown, true);
this.addSessionListener(window, "mousedown", this.onMouseDown, true);
this.addSessionListener(window, "popuphidden", this.onPopupHidden, true);
this.addSessionListener(window, "popupshown", this.onPopupShown, true);
this.addSessionListener(window, "resize", this.onResize, true);
},
destroy: function () {
@@ -103,6 +103,7 @@ const Events = Module("events", {
*/
addSessionListener: function (target, event, callback, capture) {
let args = Array.slice(arguments, 0);
args[2] = this.wrapListener(callback);
args[0].addEventListener.apply(args[0], args.slice(1));
args[0] = Cu.getWeakReference(args[0]);
this.sessionListeners.push(args);

View File

@@ -214,11 +214,6 @@ const StatusLine = Module("statusline", {
return;
}
// update the ordinal which is used for numbered tabs
if (options.get("guioptions").has("n", "N"))
for (let [i, tab] in Iterator(tabs.visibleTabs))
tab.setAttribute("ordinal", i + 1);
this.widgets.tabcount.value = "[" + (tabs.index(null, true) + 1) + "/" + tabs.visibleTabs.length + "]";
}
},

View File

@@ -21,14 +21,6 @@ const Tabs = Module("tabs", {
this._lastBufferSwitchArgs = "";
this._lastBufferSwitchSpecial = true;
this.tabBinding = styles.addSheet(true, "tab-binding", "chrome://browser/content/browser.xul", String.replace(<><![CDATA[
xul|tab { -moz-binding: url(chrome://dactyl/content/bindings.xml#tab-3) !important; }
#TabsToolbar > xul|tabs > xul|tab { -moz-binding: url(chrome://dactyl/content/bindings.xml#tab-4) !important; }
// FIXME: better solution for themes?
.tabbrowser-tab[busy] > .tab-icon > .tab-icon-image { list-style-image: url('chrome://global/skin/icons/loading_16.png') !important; }
]]></>, /tab-./g, function (m) util.OS.isMacOSX ? "tab-mac" : m),
false, true);
// hide tabs initially to prevent flickering when 'stal' would hide them
// on startup
if (config.hasTabbrowser)
@@ -45,6 +37,17 @@ const Tabs = Module("tabs", {
},
_updateTabCount: function () {
for (let tab in values(this.allTabs)) {
function node(clas) document.getAnonymousElementByAttribute(tab, "class", clas);
if (!node("dactyl-tab-number")) {
let dom = util.xmlToDom(<xul xmlns:xul={XUL} xmlns:html={XHTML}
><xul:hbox highlight="TabIconNumber" class="dactyl-tab-number"
/><xul:hbox highlight="TabNumber"
/></xul>.*, document);
let img = node("tab-icon-image");
img.parentNode.appendChild(dom);
}
}
statusline.updateTabCount(true);
},
@@ -479,6 +482,9 @@ const Tabs = Module("tabs", {
services.sessionStore.setTabState(to, tabState);
}
}, {
load: function () {
tabs._updateTabCount();
},
commands: function () {
commands.add(["bd[elete]", "bw[ipeout]", "bun[load]", "tabc[lose]"],
"Delete current buffer",

View File

@@ -10,11 +10,12 @@ try {
Components.utils.import("resource://dactyl/base.jsm");
defineModule("util", {
exports: ["FailedAssertion", "Math", "NS", "Util", "XHTML", "XUL", "util"],
exports: ["FailedAssertion", "Math", "NS", "Util", "XBL", "XHTML", "XUL", "util"],
require: ["services"],
use: ["highlight", "storage", "template"]
});
const XBL = Namespace("xbl", "http://www.mozilla.org/xbl");
const XHTML = Namespace("html", "http://www.w3.org/1999/xhtml");
const XUL = Namespace("xul", "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
const NS = Namespace("dactyl", "http://vimperator.org/namespaces/liberator");

View File

@@ -1,5 +1,6 @@
@namespace dactyl url("http://vimperator.org/namespaces/liberator");
@namespace html url("http://www.w3.org/1999/xhtml");
@namespace xul uri("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/* Applied to all content */
[dactyl|activeframe] {
@@ -79,6 +80,12 @@
@-moz-document
url-prefix(chrome://) {
xul|tabs, xul|tabbrowser { counter-reset: dactyl-tab-number; }
xul|tab { counter-increment: dacytl-tab-number; }
.tab-icon-image, .tab-throbber { -moz-box-ordinal-group: 10; }
[dactyl|highlight~=TabNumber], [dactyl|highlight~=TabIconNumber] { -moz-box-ordinal-group: 20; }
.tab-text, .tab-label, .tab-close-button { -moz-box-ordinal-group: 50; }
#addon-bar > #addonbar-closebutton {
visibility: collapse;
}