[Pkg-mozext-commits] [SCM] Status bar widgets and progress indicators for Firefox 4+ branch, master, updated. upstream/0.2011.11.13.22-17-gc11a09d

Ximin Luo infinity0 at gmx.com
Tue Jun 5 19:20:02 UTC 2012


The following commit has been merged in the master branch:
commit dc69631c62662b4e1689ec2075a2b7e7859b34c6
Author: Ximin Luo <infinity0 at gmx.com>
Date:   Sun Jun 3 00:16:45 2012 +0100

    Imported Upstream version 0.2012.04.21.13

diff --git a/chrome.manifest b/chrome.manifest
index 68d46cf..17bf1a2 100644
--- a/chrome.manifest
+++ b/chrome.manifest
@@ -75,11 +75,13 @@ skin	status4evar-os	classic/1.0	chrome/skin/pinstripe/		os=Darwin
 # Browser overlays
 overlay	chrome://browser/content/browser.xul		chrome://status4evar/content/overlay.xul
 style	chrome://browser/content/browser.xul		chrome://status4evar/skin/version/overlay10.css		appversion<=10.0.*
+style	chrome://browser/content/browser.xul		chrome://status4evar/skin/version/overlay11.css		appversion<=11.0.*
 style	chrome://browser/content/browser.xul		chrome://status4evar-os/skin/version/overlay8.css	appversion<=8.0.*
 
 # Pref overlays
 style	chrome://status4evar/content/prefs.xul		chrome://status4evar/skin/version/prefs5.css		appversion<=5.0.*
 style	chrome://status4evar/content/prefs.xul		chrome://status4evar/skin/version/prefs6.css		appversion<=6.0.*
+style	chrome://status4evar/content/prefs.xul		chrome://status4evar/skin/version/prefs12.css		appversion>=12.0a2
 style	chrome://status4evar/content/prefs.xul		chrome://status4evar-os/skin/version/overlay8.css	appversion<=8.0.*
 
 # Toolbar overlays
diff --git a/chrome/content/overlay.js b/chrome/content/overlay.js
index 13dd494..23cbb67 100644
--- a/chrome/content/overlay.js
+++ b/chrome/content/overlay.js
@@ -38,37 +38,40 @@
 if(!caligon) var caligon = {};
 if(!caligon.status4evar) caligon.status4evar = {};
 
-window.addEventListener("load", function()
+window.addEventListener("load", function buildS4E()
 {
+	window.removeEventListener("load", buildS4E, false);
+
 	let CC = Components.classes;
 	let CI = Components.interfaces;
 	let CU = Components.utils;
 
-	caligon.status4evar.service = CC["@caligonstudios.com/status4evar;1"].getService(CI.nsIStatus4Evar);
-	let s4e_service = caligon.status4evar.service;
-
-	caligon.status4evar.strings = document.getElementById("bundle_status4evar");
-	let s4e_strings = caligon.status4evar.strings;
+	let s4e_service = CC["@caligonstudios.com/status4evar;1"].getService(CI.nsIStatus4Evar);
+	caligon.status4evar.service = s4e_service;
 
 //
 // Element getters
 //
-	caligon.status4evar.getters =
+	let s4e_getters =
 	{
+		getterMap:
+		[
+			["addonbar",              "addon-bar"],
+			["addonbarCloseButton",   "addonbar-closebutton"],
+			["browserBottomBox",      "browser-bottombox"],
+			["downloadButton",        "status4evar-download-button"],
+			["downloadButtonTooltip", "status4evar-download-tooltip"],
+			["statusWidget",          "status4evar-status-widget"],
+			["statusWidgetLabel",     "status4evar-status-text"],
+			["statusOverlay",         "statusbar-display"],
+			["strings",               "bundle_status4evar"],
+			["toolbarProgress",       "status4evar-progress-bar"],
+			["urlbarProgress",        "urlbar-progress-alt"]
+		],
+
 		resetGetters: function()
 		{
-			[
-				["addonbar",			"addon-bar"],
-				["addonbarCloseButton",		"addonbar-closebutton"],
-				["browserBottomBox",		"browser-bottombox"],
-				["downloadButton",		"status4evar-download-button"],
-				["downloadButtonTooltip",	"status4evar-download-tooltip"],
-				["statusWidget",		"status4evar-status-widget"],
-				["statusWidgetLabel",		"status4evar-status-text"],
-				["statusOverlay",		"statusbar-display"],
-				["toolbarProgress",		"status4evar-progress-bar"],
-				["urlbarProgress",		"urlbar-progress-alt"]
-			].forEach(function(getter)
+			this.getterMap.forEach(function(getter)
 			{
 				let [prop, id] = getter;
 				delete this[prop];
@@ -96,25 +99,37 @@ window.addEventListener("load", function()
 				delete this.urlbar;
 				return this.urlbar = ub;
 			});
+		},
+
+		destroy: function()
+		{
+			this.getterMap.forEach(function(getter)
+			{
+				let [prop, id] = getter;
+				delete this[prop];
+			}, this);
+
+			delete this.urlbar;
 		}
 	}
-	let s4e_getters = caligon.status4evar.getters;
+	caligon.status4evar.getters = s4e_getters;
 
 //
 // Status service
 //
-	caligon.status4evar.statusService =
+	let s4e_statusService =
 	{
-		_overLink:		{ val: "", type: "" },
-		_network:		{ val: "", type: "" },
-		_networkXHR:		{ val: "", type: "" },
-		_status:		{ val: "", type: "" },
-		_jsStatus:		{ val: "", type: "" },
-		_jsDefaultStatus:	{ val: "", type: "" },
-		_defaultStatus:		{ val: "", type: "" },
-
-		_statusText:		{ val: "", type: "" },
-		_noUpdate:		false,
+		_overLink:        { val: "", type: "" },
+		_network:         { val: "", type: "" },
+		_networkXHR:      { val: "", type: "" },
+		_status:          { val: "", type: "" },
+		_jsStatus:        { val: "", type: "" },
+		_jsDefaultStatus: { val: "", type: "" },
+		_defaultStatus:   { val: "", type: "" },
+
+		_statusText:      { val: "", type: "" },
+		_noUpdate:        false,
+		_statusTimeoutID: 0,
 
 		getCompositeStatusText: function()
 		{
@@ -232,6 +247,20 @@ window.addEventListener("load", function()
 			window.watch("XULBrowserWindow", XULBWHandler);
 		},
 
+		destroy: function()
+		{
+			// No need to unbind from the XULBrowserWindow, it's already null at this point
+
+			s4e_overLinkService.destroy();
+			this.clearTimer();
+
+			["_overLink", "_network", "_networkXHR", "_status", "_jsStatus", "_jsDefaultStatus", "_defaultStatus",
+			"_statusText"].forEach(function(prop)
+			{
+				delete this[prop];
+			}, this);
+		},
+
 		buildTextOrder: function()
 		{
 			this.__defineGetter__("_textOrder", function()
@@ -266,11 +295,7 @@ window.addEventListener("load", function()
 
 			if(this._statusText.val != text.val || force)
 			{
-				if(this._statusTimeoutID)
-				{
-					window.clearTimeout(this._statusTimeoutID);
-					delete this._statusTimeoutID;
-				}
+				this.clearTimer();
 
 				if(this._noUpdate)
 				{
@@ -285,12 +310,22 @@ window.addEventListener("load", function()
 				{
 					this._statusTimeoutID = window.setTimeout(function(self)
 					{
+						self._statusTimeoutID = 0;
 						self.clearStatusField();
 					}, s4e_service.statusTimeout, this);
 				}
 			}
 		},
 
+		clearTimer: function()
+		{
+			if(this._statusTimeoutID != 0)
+			{
+				window.clearTimeout(this._statusTimeoutID);
+				this._statusTimeoutID = 0;
+			}
+		},
+
 		clearStatusField: function()
 		{
 			s4e_getters.statusOverlay.value = "";
@@ -327,15 +362,6 @@ window.addEventListener("load", function()
 						urlbar.setStatusType(text.type);
 					}
 					break;
-//				case 4:
-//					if(allowTooltip)
-//					{
-//						if(text.anchor instanceof HTMLAnchorElement)
-//						{
-//							// Set the tooltip for a content link
-//						}
-//						break;
-//					}
 				default:
 					label = s4e_getters.statusOverlay;
 					break;
@@ -350,21 +376,22 @@ window.addEventListener("load", function()
 			}
 		}
 	}
-	let s4e_statusService = caligon.status4evar.statusService;
+	caligon.status4evar.statusService = s4e_statusService;
 
 //
 // Over Link delay service
 //
-	caligon.status4evar.overLinkService =
+	let s4e_overLinkService =
 	{
 		_timer: 0,
 		_currentLink: { link: "", anchor: null },
 		_pendingLink: { link: "", anchor: null },
+		_listening: false,
 
 		update: function(aLink, aAnchor)
 		{
-			window.clearTimeout(this._timer);
-			window.removeEventListener("mousemove", this, true);
+			this.clearTimer();
+			this.stopListen();
 			this._pendingLink = { link: aLink, anchor: aAnchor };
 
 			if(!aLink)
@@ -375,7 +402,7 @@ window.addEventListener("load", function()
 				}
 				else
 				{
-					this._timer = window.setTimeout(this._show.bind(this), s4e_service.statusLinkOverDelayHide);
+					this._showDelayed();
 				}
 			}
 			else if(this._currentLink.link || !s4e_service.statusLinkOverDelayShow)
@@ -385,7 +412,45 @@ window.addEventListener("load", function()
 			else
 			{
 				this._showDelayed();
+				this.startListen();
+			}
+		},
+
+		destroy: function()
+		{
+			this.clearTimer();
+			this.stopListen();
+
+			["_currentLink", "_pendingLink"].forEach(function(prop)
+			{
+				delete this[prop];
+			}, this);
+		},
+
+		startListen: function()
+		{
+			if(!this._listening)
+			{
 				window.addEventListener("mousemove", this, true);
+				this._listening = true;
+			}
+		},
+
+		stopListen: function()
+		{
+			if(this._listening)
+			{
+				window.removeEventListener("mousemove", this, true);
+				this._listening = false;
+			}
+		},
+
+		clearTimer: function()
+		{
+			if(this._timer != 0)
+			{
+				window.clearTimeout(this._timer);
+				this._timer = 0;
 			}
 		},
 
@@ -394,18 +459,23 @@ window.addEventListener("load", function()
 			switch(event.type)
 			{
 				case "mousemove":
-					window.clearTimeout(this._timer);
+					this.clearTimer();
 					this._showDelayed();
 			}
 		},
 
 		_showDelayed: function()
 		{
-			this._timer = setTimeout(function(self)
+			let delay = ((this._pendingLink.link)
+				? s4e_service.statusLinkOverDelayShow
+				: s4e_service.statusLinkOverDelayHide);
+
+			this._timer = window.setTimeout(function(self)
 			{
+				self._timer = 0;
 				self._show();
-				window.removeEventListener("mousemove", self, true);
-			}, s4e_service.statusLinkOverDelayShow, this);
+				self.stopListen();
+			}, delay, this);
 		},
 
 		_show: function()
@@ -414,12 +484,12 @@ window.addEventListener("load", function()
 			s4e_statusService.setOverLinkInternal(this._currentLink.link, this._currentLink.anchor);
 		}
 	}
-	let s4e_overLinkService = caligon.status4evar.overLinkService;
+	caligon.status4evar.overLinkService = s4e_overLinkService;
 
 //
 // Progress meters and network status
 //
-	caligon.status4evar.progressMeter =
+	let s4e_progressMeter =
 	{
 		_busyUI: false,
 
@@ -457,6 +527,16 @@ window.addEventListener("load", function()
 			}
 		},
 
+		setup: function()
+		{
+			gBrowser.addProgressListener(s4e_progressMeter);
+		},
+
+		destroy: function()
+		{
+			gBrowser.removeProgressListener(s4e_progressMeter);
+		},
+
 		onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage)
 		{
 			s4e_statusService.setNetworkStatus(aMessage);
@@ -489,10 +569,10 @@ window.addEventListener("load", function()
 							switch (aStatus)
 							{
 								case Components.results.NS_BINDING_ABORTED:
-									msg = s4e_strings.getString("nv_stopped");
+									msg = s4e_getters.strings.getString("nv_stopped");
 									break;
 								case Components.results.NS_ERROR_NET_TIMEOUT:
-									msg = s4e_strings.getString("nv_timeout");
+									msg = s4e_getters.strings.getString("nv_timeout");
 									break;
 							}
 						}
@@ -500,7 +580,7 @@ window.addEventListener("load", function()
 
 					if(!msg && (!location || location.spec != "about:blank"))
 					{
-						msg = s4e_strings.getString("nv_done");
+						msg = s4e_getters.strings.getString("nv_done");
 					}
 
 					s4e_statusService.setDefaultStatus(msg);
@@ -552,19 +632,15 @@ window.addEventListener("load", function()
 			return this.onProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
 		},
 
-		QueryInterface: XPCOMUtils.generateQI([ CI.nsIWebProgressListener,
-		                                        CI.nsIWebProgressListener2 ])
+		QueryInterface: XPCOMUtils.generateQI([ CI.nsIWebProgressListener, CI.nsIWebProgressListener2 ])
 	}
-	let s4e_progressMeter = caligon.status4evar.progressMeter;
+	caligon.status4evar.progressMeter = s4e_progressMeter;
 
 //
 // Implement download status
 //
-	caligon.status4evar.downloadStatus =
+	let s4e_downloadStatus =
 	{
-		_activeStr:      s4e_strings.getString("activeDownloads"),
-		_pausedStr:      s4e_strings.getString("pausedDownloads"),
-		_noDnldStr:      s4e_strings.getString("noDownloads"),
 		_listening:      false,
 		_lastTime:       Infinity,
 
@@ -613,6 +689,7 @@ window.addEventListener("load", function()
 			}
 
 			this.DownloadManager.addListener(this);
+			Services.obs.addObserver(this, "private-browsing", true);
 
 			this._listening = true;
 			this._lastTime = Infinity;
@@ -626,9 +703,18 @@ window.addEventListener("load", function()
 			{
 				this._listening = false;
 				this.DownloadManager.removeListener(this);
+				Services.obs.removeObserver(this, "private-browsing");
 			}
 		},
 
+		destroy: function()
+		{
+			this.uninit();
+			delete this.PluralForm;
+			delete this.DownloadUtils;
+			delete this.DownloadManager;
+		},
+
 		updateStatus: function()
 		{
 			if(!s4e_getters.downloadButton)
@@ -693,8 +779,9 @@ window.addEventListener("load", function()
 			}
 
 			let dlPaused = (numActive == numPaused);
-			let numDls =         ((dlPaused) ? numPaused         : (numActive - numPaused));
-			let dlStatus =       ((dlPaused) ? this._pausedStr   : this._activeStr);
+			let dlStatus =       ((dlPaused) ? s4e_getters.strings.getString("pausedDownloads")
+			                                 : s4e_getters.strings.getString("activeDownloads"));
+			let dlCount =        ((dlPaused) ? numPaused         : (numActive - numPaused));
 			let dlTotalSize =    ((dlPaused) ? pausedTotalSize   : activeTotalSize);
 			let dlTransferred =  ((dlPaused) ? pausedTransferred : activeTransferred);
 			let dlMaxProgress =  ((dlPaused) ? pausedMaxProgress : activeMaxProgress);
@@ -702,7 +789,7 @@ window.addEventListener("load", function()
 			let dlProgressType = ((dlPaused) ? "paused"          : "active");
 
 			[this._dlTimeStr, this._lastTime] = this.DownloadUtils.getTimeLeft(maxTime, this._lastTime);
-			this._dlCountStr =     this.PluralForm.get(numDls, dlStatus).replace("#1", numDls);
+			this._dlCountStr =     this.PluralForm.get(dlCount, dlStatus).replace("#1", dlCount);
 			this._dlProgressAvg =  ((dlTotalSize == 0) ? 100 : ((dlTransferred * 100) / dlTotalSize));
 			this._dlProgressMax =  ((dlTotalSize == 0) ? 100 : dlMaxProgress);
 			this._dlProgressMin =  ((dlTotalSize == 0) ? 100 : dlMinProgress);
@@ -725,8 +812,7 @@ window.addEventListener("load", function()
 			if(!this._dlActive)
 			{
 				download_button.collapsed = true;
-				download_button.label = this._noDnldStr;
-				download_tooltip.label = this._noDnldStr;
+				download_button.label = download_tooltip.label = s4e_getters.strings.getString("noDownloads");
 
 				download_button.pmCollapsed = true;
 				download_button.pmType = "active";
@@ -786,14 +872,25 @@ window.addEventListener("load", function()
 		onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus, aDownload) {},
 		onSecurityChange: function(aWebProgress, aRequest, aState, aDownload) {},
 
-		QueryInterface: XPCOMUtils.generateQI([ CI.nsIDownloadProgressListener ])
+		observe: function(subject, topic, data)
+		{
+			if(topic == "private-browsing" && (data == "enter" || data == "exit"))
+			{
+				window.setTimeout(function(self)
+				{
+					self.updateStatus();
+				}, 0, this);
+			}
+		},
+
+		QueryInterface: XPCOMUtils.generateQI([ CI.nsIDownloadProgressListener, CI.nsISupportsWeakReference, CI.nsIObserver ])
 	}
-	let s4e_downloadStatus = caligon.status4evar.downloadStatus;
+	caligon.status4evar.downloadStatus = s4e_downloadStatus;
 
 //
 // Update status text flexible splitters
 //
-	caligon.status4evar.updateSplitters = function(action)
+	let s4e_updateSplitters = function(action)
 	{
 		let splitter_before = document.getElementById("status4evar-status-splitter-before");
 		if(splitter_before)
@@ -844,70 +941,84 @@ window.addEventListener("load", function()
 			status.parentNode.insertBefore(getSplitter(splitter_after, "after"), nextSibling);
 		}
 	}
-	let s4e_updateSplitters = caligon.status4evar.updateSplitters;
+	caligon.status4evar.updateSplitters = s4e_updateSplitters;
 
 //
 // Update window re-size gripper
 //
-	let s4e_lastwindowState = null;
-
-	caligon.status4evar.updateWindowGripper = function(action)
+	let s4e_windowGripper =
 	{
-		let gripper = document.getElementById("status4evar-window-gripper");
-		let addon_bar = s4e_getters.addonbar;
-		s4e_lastwindowState = window.windowState;
+		lastwindowState: null,
 
-		if(!action || !addon_bar || !s4e_service.addonbarWindowGripper
-		|| window.windowState != window.STATE_NORMAL || addon_bar.toolbox.customizing)
+		update: function(action)
 		{
-			if(gripper)
+			let gripper = document.getElementById("status4evar-window-gripper");
+			let addon_bar = s4e_getters.addonbar;
+			this.lastwindowState = window.windowState;
+
+			if(!action || !addon_bar || !s4e_service.addonbarWindowGripper
+			|| window.windowState != window.STATE_NORMAL || addon_bar.toolbox.customizing)
 			{
-				gripper.parentNode.removeChild(gripper);
+				if(gripper)
+				{
+					gripper.parentNode.removeChild(gripper);
+				}
+				return;
+			}
+
+			if(!gripper)
+			{
+				gripper = document.createElement("resizer");
+				gripper.id = "status4evar-window-gripper";
+				gripper.dir = "bottomend";
 			}
-			return;
-		}
 
-		if(!gripper)
+			addon_bar.appendChild(gripper);
+		},
+
+		handleEvent: function(e)
 		{
-			gripper = document.createElement("resizer");
-			gripper.id = "status4evar-window-gripper";
-			gripper.dir = "bottomend";
-		}
+			if(window.windowState != this.lastwindowState)
+			{
+				s4e_windowGripper.update(true);
+			}
+		},
 
-		addon_bar.appendChild(gripper);
-	}
-	let s4e_updateWindowGripper = caligon.status4evar.updateWindowGripper;
+		setup: function()
+		{
+			window.addEventListener("resize", this, false);
+		},
 
-	caligon.status4evar.resizeHandler = function(e)
-	{
-		if(window.windowState != s4e_lastwindowState)
+		destroy: function()
 		{
-			s4e_updateWindowGripper(true);
-		}
+			window.removeEventListener("resize", this, false);
+		},
+
+		QueryInterface: XPCOMUtils.generateQI([ CI.nsIDOMEventListener ])
 	}
-	let s4e_resizeHandler = caligon.status4evar.resizeHandler;
+	caligon.status4evar.windowGripper = s4e_windowGripper;
 
 //
 // Prepare the window before customization
 //
-	caligon.status4evar.beforeCustomization = function()
+	let s4e_beforeCustomization = function()
 	{
 		s4e_updateSplitters(false);
-		s4e_updateWindowGripper(false);
+		s4e_windowGripper.update(false);
 
 		s4e_statusService.setNoUpdate(true);
 		let status_label = s4e_getters.statusWidgetLabel;
 		if(status_label)
 		{
-			status_label.value = s4e_strings.getString("statusText");
+			status_label.value = s4e_getters.strings.getString("statusText");
 		}
 	}
-	let s4e_beforeCustomization = caligon.status4evar.beforeCustomization;
+	caligon.status4evar.beforeCustomization = s4e_beforeCustomization;
 
 //
 // Update the window after customization
 //
-	caligon.status4evar.updateWindow = function()
+	let s4e_updateWindow = function()
 	{
 		s4e_statusService.setNoUpdate(false);
 		s4e_getters.resetGetters();
@@ -920,9 +1031,48 @@ window.addEventListener("load", function()
 		// This also handles the following:
 		// * buildTextOrder()
 		// * updateStatusField(true)
-		// * updateWindowGripper(true)
+		// * windowGripper.update(true)
 	}
-	let s4e_updateWindow = caligon.status4evar.updateWindow;
+	caligon.status4evar.updateWindow = s4e_updateWindow;
+
+//
+// Setup and register S4E components on window creation
+//
+	let s4e_setupWindow = function()
+	{
+		s4e_updateWindow();
+
+		s4e_progressMeter.setup();
+		s4e_windowGripper.setup();
+		gNavToolbox.addEventListener("beforecustomization", s4e_beforeCustomization, false);
+		gNavToolbox.addEventListener("aftercustomization", s4e_updateWindow, false);
+		window.addEventListener("unload", s4e_destroyWindow, false);
+
+		// OMFG HAX! If a page is already loading, fake a network start event
+		if(XULBrowserWindow._busyUI)
+		{
+			let nsIWPL = CI.nsIWebProgressListener;
+			s4e_progressMeter.onStateChange(0, null, nsIWPL.STATE_START | nsIWPL.STATE_IS_NETWORK, 0);
+		}
+	}
+	caligon.status4evar.setupWindow = s4e_setupWindow;
+
+//
+// Destroy and unregister S4E components on window destruction
+//
+	let s4e_destroyWindow = function()
+	{
+		window.removeEventListener("unload", s4e_destroyWindow, false);
+		gNavToolbox.removeEventListener("aftercustomization", s4e_updateWindow, false);
+		gNavToolbox.removeEventListener("beforecustomization", s4e_beforeCustomization, false);
+
+		s4e_statusService.destroy();
+		s4e_downloadStatus.destroy();
+		s4e_progressMeter.destroy();
+		s4e_windowGripper.destroy();
+		s4e_getters.destroy();
+	}
+	caligon.status4evar.destroyWindow = s4e_destroyWindow;
 
 //
 // Setup
@@ -986,18 +1136,6 @@ window.addEventListener("load", function()
 		}
 	}
 
-	s4e_updateWindow();
-
-	gBrowser.addProgressListener(s4e_progressMeter);
-	gNavToolbox.addEventListener("beforecustomization", s4e_beforeCustomization, false);
-	gNavToolbox.addEventListener("aftercustomization", s4e_updateWindow, false);
-	window.addEventListener("resize", s4e_resizeHandler, false);
-
-	// OMFG HAX! If a page is already loading, fake a network start event
-	if(XULBrowserWindow._busyUI)
-	{
-		let nsIWPL = CI.nsIWebProgressListener;
-		s4e_progressMeter.onStateChange(0, null, nsIWPL.STATE_START | nsIWPL.STATE_IS_NETWORK, 0);
-	}
+	s4e_setupWindow();
 }, false);
 
diff --git a/chrome/content/tabbrowser.xml b/chrome/content/tabbrowser.xml
index a922baa..f238713 100644
--- a/chrome/content/tabbrowser.xml
+++ b/chrome/content/tabbrowser.xml
@@ -2,7 +2,7 @@
 
 <!-- ***** BEGIN LICENSE BLOCK *****
    - Version: MPL 1.1/GPL 2.0/LGPL 2.1
-   - 
+   -
    - The contents of this file are subject to the Mozilla Public License Version
    - 1.1 (the "License"); you may not use this file except in compliance with
    - the License. You may obtain a copy of the License at
@@ -12,32 +12,17 @@
    - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    - for the specific language governing rights and limitations under the
    - License.
-   - 
-   - The Original Code is Mozilla Firefox.
-   - 
-   - The Initial Developer of the Original Code is
-   - David Hyatt.
-   - 
-   - Portions created by the Initial Developer are Copyright (C) 2001
+   -
+   - The Original Code is Status-4-Evar.
+   -
+   - The Initial Developer of the Original Code is 
+   - Matthew Turnbull <sparky at bluefang-logic.com>.
+   -
+   - Portions created by the Initial Developer are Copyright (C) 2011
    - the Initial Developer. All Rights Reserved.
-   - 
+   -
    - Contributor(s):
-   -   David Hyatt <hyatt at netscape.com> (Original Author of <tabbrowser>)
-   -   Mike Connor <mconnor at steelgryphon.com>
-   -   Peter Parente <parente at cs.unc.edu>
-   -   Giorgio Maone <g.maone at informaction.com>
-   -   Asaf Romano <mozilla.mano at sent.com>
-   -   Seth Spitzer <sspitzer at mozilla.org>
-   -   Simon Bünzli <zeniko at gmail.com>
-   -   Michael Ventnor <ventnor.bugzilla at yahoo.com.au>
-   -   Mark Pilgrim <pilgrim at gmail.com>
-   -   Dão Gottwald <dao at mozilla.com>
-   -   Paul O’Shannessy <paul at oshannessy.com>
-   -   Rob Arnold <tellrob at gmail.com>
-   -   Frank Yan <fyan at mozilla.com>
-   -   Patrick Walton <pcwalton at mozilla.com>
-   -   Matthew Turnbull <sparky at bluefang-logic.com>
-   - 
+   -
    - Alternatively, the contents of this file may be used under the terms of
    - either the GNU General Public License Version 2 or later (the "GPL"), or
    - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -59,63 +44,137 @@
 
 	<binding id="statuspanel" display="xul:hbox" extends="chrome://browser/content/tabbrowser.xml#statuspanel">
 		<implementation>
-			<constructor><![CDATA[
-				this.doMirror(false);
-			]]></constructor>
+			<!--                          -->
+			<!-- Inverted mirror handling -->
+			<!--                          -->
 
-			<field name="findMirror"><![CDATA[
+			<field name="_invertMirror"><![CDATA[
+				false
+			]]></field>
+
+			<property name="invertMirror">
+				<setter><![CDATA[
+					this._invertMirror = val;
+					this.mirror = this._isMirrored;
+					return val;
+				]]></setter>
+				<getter><![CDATA[
+					return this._invertMirror;
+				]]></getter>
+			</property>
+
+			<!--                       -->
+			<!-- Mouse mirror handling -->
+			<!--                       -->
+
+			<field name="_mouseMirror"><![CDATA[
 				true
 			]]></field>
 
-			<field name="invertMirror"><![CDATA[
+			<field name="_mouseMirrorListen"><![CDATA[
 				false
 			]]></field>
 
 			<property name="mouseMirror">
 				<setter><![CDATA[
-					if(val)
-					{
-						this.removeAttribute("nomouse");
-					}
-					else
-					{
-						this.setAttribute("nomouse", "true");
-					}
+					this._mouseMirror = val;
+					this.setupMouseMirror(this.value);
 					return val;
 				]]></setter>
 				<getter><![CDATA[
-					return this.getAttribute("nomouse") != "true";
+					return this._mouseMirror;
 				]]></getter>
 			</property>
 
-			<property name="value">
-				<setter><![CDATA[
-					if(!val)
+			<method name="setupMouseMirror">
+				<parameter name="val"/>
+				<body><![CDATA[
+					if(val && this._mouseMirror)
 					{
-						this.doMirror(this.findMirror && window.gFindBarInitialized && !window.gFindBar.hidden)
+						this._calcMouseTargetRect();
+						if(!this._mouseMirrorListen)
+						{
+							MousePosTracker.addListener(this);
+							this._mouseMirrorListen = true;
+						}
 					}
+					else
+					{
+						this.mirror = false;
+						if(this._mouseMirrorListen)
+						{
+							MousePosTracker.removeListener(this);
+							this._mouseMirrorListen = false;
+						}
+					}
+				]]></body>
+			</method>
 
-					this.style.minWidth =
-						(this.getAttribute("type") == "network" &&
-						this.getAttribute("previoustype") == "network")
-						? getComputedStyle(this).width : "";
-
-					this.setAttribute("label", val);
-					if(val)
+			<method name="_calcMouseTargetRect">
+				<body><![CDATA[
+					let alignRight = false;
+					let isRTL = (getComputedStyle(document.documentElement).direction == "rtl");
+					if((this._invertMirror && !isRTL) || (!this._invertMirror && isRTL))
 					{
-						this.removeAttribute("inactive");
+						alignRight = true;
 					}
-					else
+
+					let rect = this.getBoundingClientRect();
+					this._mouseTargetRect =
 					{
-						this.setAttribute("inactive", "true");
+						top:    rect.top,
+						bottom: rect.bottom,
+						left:   ((alignRight) ? window.innerWidth - rect.width : 0),
+						right:  ((alignRight) ? window.innerWidth : rect.width)
+					};
+				]]></body>
+			</method>
+
+			<method name="onMouseEnter">
+				<body><![CDATA[
+					this.mirror = true;
+				]]></body>
+			</method>
+
+			<method name="onMouseLeave">
+				<body><![CDATA[
+					this.mirror = false;
+				]]></body>
+			</method>
+
+			<!--                 -->
+			<!-- Mirror handling -->
+			<!--                 -->
+
+			<field name="_isMirrored"><![CDATA[
+				false
+			]]></field>
+
+			<property name="mirror">
+				<setter><![CDATA[
+					this._isMirrored = val;
+					if(this._invertMirror)
+					{
+						val = !val;
 					}
-					return val;
+
+					this.setBooleanAttr("mirror", val);
 				]]></setter>
 				<getter><![CDATA[
-					return this.getAttribute("label");
+					return this._isMirrored;
 				]]></getter>
 			</property>
 
+			<method name="_mirror">
+				<body><![CDATA[
+					this.mirror = !this._isMirrored;
+				]]></body>
+			</method>
+
+			<!--                -->
+			<!-- Value handling -->
+			<!--                -->
+
 			<property name="label">
 				<setter><![CDATA[
 					window.caligon.status4evar.statusService.setStatusText(val);
@@ -126,36 +185,93 @@
 				]]></getter>
 			</property>
 
-			<method name="handleEvent">
-				<parameter name="event"/>
+			<property name="value">
+				<setter><![CDATA[
+					this.setValue(val);
+					this.setupMouseMirror(val);
+					return val;
+				]]></setter>
+				<getter><![CDATA[
+					return this.getAttribute("label");
+				]]></getter>
+			</property>
+
+			<method name="setValue">
+				<parameter name="val"/>
 				<body><![CDATA[
-					if(this.findMirror && event.type == "findbaropen" && this.value)
+					if(this.getAttribute("type") == "network" && this.getAttribute("previoustype") == "network")
 					{
-						this.doMirror(true);
+						this.style.minWidth = getComputedStyle(this).width;
 					}
+					else
+					{
+						this.style.minWidth = "";
+					}
+
+					this.setAttribute("label", val);
+					this.setBooleanAttr("inactive", !val);
 				]]></body>
 			</method>
 
-			<method name="doMirror">
-				<parameter name="mirror"/>
+			<!--         -->
+			<!-- Helpers -->
+			<!--         -->
+
+			<method name="setBooleanAttr">
+				<parameter name="name"/>
+				<parameter name="val"/>
 				<body><![CDATA[
-					if(this.invertMirror)
+					if(val)
 					{
-						mirror = !mirror;
+						this.setAttribute(name, "true");
 					}
+					else
+					{
+						this.removeAttribute(name);
+					}
+				]]></body>
+			</method>
+		</implementation>
+	</binding>
+
+	<binding id="statuspanel-11" display="xul:hbox" extends="chrome://status4evar/content/tabbrowser.xml#statuspanel">
+		<implementation>
+			<field name="findMirror"><![CDATA[
+				true
+			]]></field>
 
-					if(mirror)
+			<property name="value">
+				<setter><![CDATA[
+					if(!val)
 					{
-						this.setAttribute("mirror", "true");
+						this.mirror = (this.findMirror && window.gFindBarInitialized && !window.gFindBar.hidden);
 					}
-					else
+
+					this.setValue(val);
+					return val;
+				]]></setter>
+				<getter><![CDATA[
+					return this.getAttribute("label");
+				]]></getter>
+			</property>
+
+			<method name="setupMouseMirror">
+				<parameter name="val"/>
+				<body><![CDATA[
+					this.setBooleanAttr("nomouse", !this._mouseMirror);
+				]]></body>
+			</method>
+
+			<method name="handleEvent">
+				<parameter name="event"/>
+				<body><![CDATA[
+					if(this.findMirror && event.type == "findbaropen" && this.value)
 					{
-						this.removeAttribute("mirror");
+						this.mirror = true;
 					}
 				]]></body>
 			</method>
 		</implementation>
 	</binding>
-
 </bindings>
 
diff --git a/chrome/content/urlbarBindings.xml b/chrome/content/urlbarBindings.xml
index ec72ade..14b18db 100644
--- a/chrome/content/urlbarBindings.xml
+++ b/chrome/content/urlbarBindings.xml
@@ -146,10 +146,15 @@
 					switch (aEvent.type)
 					{
 						case "transitionend":
-							if(aEvent.target == this._overLinkBox
-							   && aEvent.propertyName == "opacity")
+							if(aEvent.target == this._overLinkBox && aEvent.propertyName == "opacity")
 							{
 								this._overLinkTransitioning = false;
+
+								let style = window.getComputedStyle(this._overLinkBox);
+								if(style.opacity == 0)
+								{
+									this.formatValue();
+								}
 							}
 							break;
 						default:
@@ -215,25 +220,33 @@
 			<method name="_setOverLinkState">
 				<parameter name="aVal"/>
 				<body><![CDATA[
+					let style = null;
 					switch(aVal)
 					{
 						case "fade-in":
-							var style = window.getComputedStyle(this._overLinkBox);
+							style = window.getComputedStyle(this._overLinkBox);
 							this._overLinkTransitioning = style.opacity != 1;
+							this._clearFormatting();
 							this.setAttribute("overlinkstate", aVal);
 							break;
 						case "fade-out":
 							style = window.getComputedStyle(this._overLinkBox);
 							this._overLinkTransitioning = style.opacity != 0;
 							this.setAttribute("overlinkstate", aVal);
+							if(!this._overLinkTransitioning)
+							{
+								this.formatValue();
+							}
 							break;
 						case "showing":
 							this._overLinkTransitioning = false;
 							this.setAttribute("overlinkstate", aVal);
+							this._clearFormatting();
 							break;
 						default:
 							this._overLinkTransitioning = false;
 							this.removeAttribute("overlinkstate");
+							this.formatValue();
 							break;
 					}
 				]]></body>
diff --git a/chrome/locale/fr/overlay.properties b/chrome/locale/fr/overlay.properties
index bd4f3f8..267de0b 100644
--- a/chrome/locale/fr/overlay.properties
+++ b/chrome/locale/fr/overlay.properties
@@ -1,7 +1,7 @@
 activeDownloads=1 téléchargement en cours;#1 téléchargements en cours
-pausedDownloads=1 téléchargement en pause;#1 téléchargement en pause
+pausedDownloads=1 téléchargement en pause;#1 téléchargements en pause
 noDownloads=Aucun téléchargement
-nv_done=Effectué
+nv_done=Terminé
 nv_stopped=Arrêté
 nv_timeout=Hors délai
 statusText=Texte d'état
diff --git a/chrome/skin/all/overlay.css b/chrome/skin/all/overlay.css
index 28d658b..4e935aa 100644
--- a/chrome/skin/all/overlay.css
+++ b/chrome/skin/all/overlay.css
@@ -353,14 +353,6 @@ splitter.status4evar-status-splitter:not(:hover)
 }
 
 /*
- * Popup status
- */
-statuspanel[nomouse="true"]
-{
-	pointer-events: none;
-}
-
-/*
  * Status bar
  */
 
diff --git a/chrome/skin/winstripe/version/overlay8.css b/chrome/skin/all/version/overlay11.css
similarity index 91%
copy from chrome/skin/winstripe/version/overlay8.css
copy to chrome/skin/all/version/overlay11.css
index 777384a..7e94321 100644
--- a/chrome/skin/winstripe/version/overlay8.css
+++ b/chrome/skin/all/version/overlay11.css
@@ -38,15 +38,16 @@
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 
 /*
- * Location bar
+ * Status pop-up
  */
 
-.urlbar-stack
+statuspanel
 {
-	margin: -2px 0px;
+	-moz-binding: url("chrome://status4evar/content/tabbrowser.xml#statuspanel-11");
 }
 
-.urlbar-input-layer
+statuspanel[nomouse="true"]
 {
-	padding: 2px 0px;
+	pointer-events: none;
 }
+
diff --git a/chrome/skin/pinstripe/prefs.css b/chrome/skin/all/version/prefs12.css
similarity index 97%
copy from chrome/skin/pinstripe/prefs.css
copy to chrome/skin/all/version/prefs12.css
index 7676cdc..973278f 100644
--- a/chrome/skin/pinstripe/prefs.css
+++ b/chrome/skin/all/version/prefs12.css
@@ -37,7 +37,7 @@
 
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 
-#status4evar-addonbar-windowGripper-check
+#status4evar-status-popup-findMirror-check
 {
 	display: none;
 }
diff --git a/chrome/skin/winstripe/version/overlay8.css b/chrome/skin/winstripe/version/overlay8.css
index 777384a..2539ec9 100644
--- a/chrome/skin/winstripe/version/overlay8.css
+++ b/chrome/skin/winstripe/version/overlay8.css
@@ -50,3 +50,4 @@
 {
 	padding: 2px 0px;
 }
+
diff --git a/components/status4evar.js b/components/status4evar.js
index 3a97a33..786b7bd 100644
--- a/components/status4evar.js
+++ b/components/status4evar.js
@@ -143,7 +143,7 @@ Status_4_Evar.prototype =
 			},
 			updateWindow: function(win)
 			{
-				win.caligon.status4evar.updateWindowGripper(true);
+				win.caligon.status4evar.windowGripper.update(true);
 			}
 		},
 
diff --git a/components/status4evar.xpt b/components/status4evar.xpt
index 8c18f05..25f4716 100644
Binary files a/components/status4evar.xpt and b/components/status4evar.xpt differ
diff --git a/install.rdf b/install.rdf
index c74f379..7a7e628 100644
--- a/install.rdf
+++ b/install.rdf
@@ -50,7 +50,7 @@
 		<em:name>Status-4-Evar</em:name>
 		<em:optionsURL>chrome://status4evar/content/prefs.xul</em:optionsURL>
 		<em:type>2</em:type>
-		<em:version>2012.01.14.17</em:version>
+		<em:version>2012.04.21.13</em:version>
 
 		<!-- Localizations -->
 
@@ -343,7 +343,7 @@
 			<Description>
 				<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
 				<em:minVersion>4.0</em:minVersion>
-				<em:maxVersion>12.0a1</em:maxVersion>
+				<em:maxVersion>13.0a1</em:maxVersion>
 			</Description>
 		</em:targetApplication>
 

-- 
Status bar widgets and progress indicators for Firefox 4+



More information about the Pkg-mozext-commits mailing list