From 84e4253dade312621f4f73ba58eab4d19f0c63d1 Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Sat, 15 Jan 2011 20:20:53 +0100 Subject: [PATCH] make Mandelbrot work nicely inside a tab in Fennec 4 - some remaining problems/conflicts with panning are Fennec's fault and reported --- Makefile.in | 16 +- extension/aboutMandelbrot.js | 67 ++++++++ extension/install.rdf | 6 +- extension/mobileOverlay.xul | 8 +- jar.mn | 7 + .../mandelbrot/content/mandelbrot-tab.xul | 156 ++++++++++++++++++ .../chrome/mandelbrot/content/mandelbrot.js | 17 +- .../chrome/mandelbrot/content/mandelbrot.xul | 3 +- .../mandelbrot/locales/en-US/mandelbrot.dtd | 3 +- .../mandelbrot/skin/classic/mandelbrot.css | 7 + .../mandelbrot/skin/classic/mobileUI.css | 116 +++++++++++++ 11 files changed, 390 insertions(+), 16 deletions(-) create mode 100644 extension/aboutMandelbrot.js create mode 100644 xulapp/chrome/mandelbrot/content/mandelbrot-tab.xul create mode 100644 xulapp/chrome/mandelbrot/skin/classic/mobileUI.css diff --git a/Makefile.in b/Makefile.in index 26ee514..11f742e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -45,16 +45,19 @@ include $(DEPTH)/config/autoconf.mk MODULE = mandelbrot -EXTENSION_VERSION = 4.0b1 +EXTENSION_VERSION = 4.0b2 XPI_NAME = mandelbrot USE_EXTENSION_MANIFEST = 1 NO_JAR_AUTO_REG = 1 +NO_JS_MANIFEST = 1 INSTALL_EXTENSION_ID = mandelbrot@kairo.at XPI_PKGNAME = mandelbrot-$(EXTENSION_VERSION) DIST_FILES = extension/install.rdf +EXTRA_COMPONENTS = extension/aboutMandelbrot.js + # this interferes with e.g. Firefox prefs #PREF_JS_EXPORTS = $(srcdir)/xulapp/defaults/preferences/prefs.js @@ -70,3 +73,14 @@ include $(topsrcdir)/config/rules.mk export:: $(NSINSTALL) -D $(FINAL_TARGET)/chrome/icons/default $(INSTALL) $(srcdir)/xulapp/chrome/icons/default/mandelbrotWindow* $(FINAL_TARGET)/chrome/icons/default + +ifdef MOZ_OMNIJAR +ABS_DIST = $(call core_abspath,$(DIST)/bin) + +libs:: + @echo "Packaging $(INSTALL_EXTENSION_ID).xpi" + if test -d "$(ABS_DIST)/extensions/$(INSTALL_EXTENSION_ID)"; then \ + cd $(ABS_DIST)/extensions/$(INSTALL_EXTENSION_ID)/; $(ZIP) -r9mX ../$(INSTALL_EXTENSION_ID).xpi *; \ + rm -rf $(ABS_DIST)/extensions/$(INSTALL_EXTENSION_ID); \ + fi +endif diff --git a/extension/aboutMandelbrot.js b/extension/aboutMandelbrot.js new file mode 100644 index 0000000..9715b34 --- /dev/null +++ b/extension/aboutMandelbrot.js @@ -0,0 +1,67 @@ +/* ***** 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 + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * 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 the KaiRo.at Mandelbrot. + * + * The Initial Developer of the Original Code is + * Robert Kaiser . + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Robert Kaiser (original author) + * + * 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"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +Components.utils.import("resource://gre/modules/Services.jsm"); +Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); + +function AboutMandelbrot() { } +AboutMandelbrot.prototype = { + classDescription: "about:mandelbrot", + contractID: "@mozilla.org/network/protocol/about;1?what=mandelbrot", + classID: Components.ID("{289dae5f-2a1d-4632-8df9-79c50147f91f}"), + QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIAboutModule]), + + getURIFlags: function(aURI) { + return Components.interfaces.nsIAboutModule.ALLOW_SCRIPT; + }, + + newChannel: function(aURI) { + let channel = Services.io.newChannel("chrome://mandelbrot/content/mandelbrot-tab.xul", + null, null); + channel.originalURI = aURI; + return channel; + } +}; + +/** + * XPCOMUtils.generateNSGetFactory was introduced in Mozilla 2. + * XPCOMUtils.generateNSGetModule is for Mozilla 1.9.x. + */ +if (XPCOMUtils.generateNSGetFactory) + var NSGetFactory = XPCOMUtils.generateNSGetFactory([AboutMandelbrot]); +else + var NSGetModule = XPCOMUtils.generateNSGetModule([AboutMandelbrot]); diff --git a/extension/install.rdf b/extension/install.rdf index 5dfc1ce..34be91f 100644 --- a/extension/install.rdf +++ b/extension/install.rdf @@ -13,7 +13,7 @@ {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 3.0 - 4.0b6pre + 4.0.* @@ -21,7 +21,7 @@ {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} 2.0a1pre - 2.1b1 + 2.1b2 @@ -29,7 +29,7 @@ {a23983c0-fd0e-11dc-95ff-0800200c9a66} 0.1 - 2.0a1 + 4.0b4pre diff --git a/extension/mobileOverlay.xul b/extension/mobileOverlay.xul index 070f2ff..46e2a5a 100644 --- a/extension/mobileOverlay.xul +++ b/extension/mobileOverlay.xul @@ -45,13 +45,13 @@ + oncommand="Browser.addTab('about:mandelbrot', true);"/> - - + + insertbefore="tool-panel-open"/> diff --git a/jar.mn b/jar.mn index 361b7eb..472bd94 100644 --- a/jar.mn +++ b/jar.mn @@ -4,11 +4,17 @@ mandelbrot.jar: % content mandelbrot %content/mandelbrot/ % skin mandelbrot classic/1.0 %skin/classic/mandelbrot/ % locale mandelbrot @AB_CD@ %locale/@AB_CD@/mandelbrot/ +% style chrome://mandelbrot/content/mandelbrot.xul chrome://mandelbrot/skin/mobileUI.css application={a23983c0-fd0e-11dc-95ff-0800200c9a66} +% style chrome://mandelbrot/content/mandelbrot-tab.xul chrome://mandelbrot/skin/mobileUI.css application={a23983c0-fd0e-11dc-95ff-0800200c9a66} +% style about:mandelbrot chrome://mandelbrot/skin/mobileUI.css application={a23983c0-fd0e-11dc-95ff-0800200c9a66} % overlay chrome://browser/content/browser.xul chrome://mandelbrot/content/fxOverlay.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} % overlay chrome://browser/content/browser.xul chrome://mandelbrot/content/mobileOverlay.xul application={a23983c0-fd0e-11dc-95ff-0800200c9a66} % overlay chrome://communicator/content/tasksOverlay.xul chrome://mandelbrot/content/smOverlay.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} +% component {289dae5f-2a1d-4632-8df9-79c50147f91f} components/aboutMandelbrot.js +% contract @mozilla.org/network/protocol/about;1?what=mandelbrot {289dae5f-2a1d-4632-8df9-79c50147f91f} content/mandelbrot/mandelbrot.js (xulapp/chrome/mandelbrot/content/mandelbrot.js) content/mandelbrot/mandelbrot.xul (xulapp/chrome/mandelbrot/content/mandelbrot.xul) + content/mandelbrot/mandelbrot-tab.xul (xulapp/chrome/mandelbrot/content/mandelbrot-tab.xul) content/mandelbrot/image-settings.js (xulapp/chrome/mandelbrot/content/image-settings.js) content/mandelbrot/image-settings.xul (xulapp/chrome/mandelbrot/content/image-settings.xul) content/mandelbrot/fxOverlay.xul (extension/fxOverlay.xul) @@ -17,6 +23,7 @@ mandelbrot.jar: skin/classic/mandelbrot/mandelbrot.css (xulapp/chrome/mandelbrot/skin/classic/mandelbrot.css) skin/classic/mandelbrot/mandelbrotIcon16.png (xulapp/chrome/mandelbrot/skin/classic/mandelbrotIcon16.png) skin/classic/mandelbrot/mandelbrotIcon32.png (xulapp/chrome/mandelbrot/skin/classic/mandelbrotIcon32.png) + skin/classic/mandelbrot/mobileUI.css (xulapp/chrome/mandelbrot/skin/classic/mobileUI.css) skin/classic/mandelbrot/image-settings.css (xulapp/chrome/mandelbrot/skin/classic/image-settings.css) locale/@AB_CD@/mandelbrot/mandelbrot.dtd (xulapp/chrome/mandelbrot/locales/@AB_CD@/mandelbrot.dtd) locale/@AB_CD@/mandelbrot/mandelbrot.properties (xulapp/chrome/mandelbrot/locales/@AB_CD@/mandelbrot.properties) diff --git a/xulapp/chrome/mandelbrot/content/mandelbrot-tab.xul b/xulapp/chrome/mandelbrot/content/mandelbrot-tab.xul new file mode 100644 index 0000000..6ace817 --- /dev/null +++ b/xulapp/chrome/mandelbrot/content/mandelbrot-tab.xul @@ -0,0 +1,156 @@ + + + + + + + + + %mandelOverlayDTD; + + %brandDTD; + + %mandelbrotDTD; +]> + + + + + +