[Yulup-commits] rev 20668 - in public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome: content content/help skin

andi at wyona.com andi at wyona.com
Thu Dec 7 21:46:46 CET 2006


Author: andi
Date: 2006-12-07 21:46:44 +0100 (Thu, 07 Dec 2006)
New Revision: 20668

Added:
   public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/help/helpbrowser.js
   public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/help/helpbrowser.xul
   public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/skin/helpbrowser.css
Modified:
   public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/yulup.js
Log:
First attempt at custom help browser.


Added: public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/help/helpbrowser.js
===================================================================
--- public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/help/helpbrowser.js	2006-12-07 19:45:37 UTC (rev 20667)
+++ public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/help/helpbrowser.js	2006-12-07 20:46:44 UTC (rev 20668)
@@ -0,0 +1,174 @@
+/*
+ * ***** BEGIN LICENSE BLOCK *****
+ * Copyright 2006 Wyona AG Zurich
+ *
+ * This file is part of Yulup.
+ *
+ * Yulup is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Yulup is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Yulup; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * ***** END LICENSE BLOCK *****
+ */
+
+/**
+ * @author Andreas Wuest
+ *
+ */
+
+const YULUP_HELP_URI = "chrome://yulup/content/help/user-manual/user_manual.xhtml";
+
+var YulupHelpBrowser = {
+    __browser            : null,
+    __webProgressListener: null,
+
+    onLoadListener: function () {
+        var browser         = null;
+        var browserInstance = null;
+
+        /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowser.onLoadListener() invoked\n");
+
+        browser = document.getElementById("uiYulupHelpBrowserBrowser");
+
+        browserInstance = Components.classes["@mozilla.org/appshell/component/browser/instance;1"].createInstance(Components.interfaces.nsIBrowserInstance);
+        browserInstance.setWebShellWindow(window);
+
+        window.XULBrowserWindow = new YulupHelpBrowserWindow();
+
+        YulupHelpBrowser.__webProgressListener = new YulupHelpBrowserWebProgressListener();
+
+        browser.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebProgress).addProgressListener(YulupHelpBrowser.__webProgressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
+
+        browser.webNavigation.loadURI(YULUP_HELP_URI, Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
+
+        YulupHelpBrowser.__browser = browser;
+    },
+
+    updateNavigation: function () {
+        /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowser.updateNavigation() invoked\n");
+
+        if (YulupHelpBrowser.__browser) {
+            if (YulupHelpBrowser.__browser.webNavigation.canGoBack) {
+                document.getElementById("cmd_yulup_goback").setAttribute("disabled", false);
+            } else {
+                document.getElementById("cmd_yulup_goback").setAttribute("disabled", true);
+            }
+
+            if (YulupHelpBrowser.__browser.webNavigation.canGoForward) {
+                document.getElementById("cmd_yulup_goforward").setAttribute("disabled", false);
+            } else {
+                document.getElementById("cmd_yulup_goforward").setAttribute("disabled", true);
+            }
+        }
+    },
+
+    goBack: function () {
+        /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowser.goBack() invoked\n");
+
+        if (YulupHelpBrowser.__browser && YulupHelpBrowser.__browser.webNavigation.canGoBack)
+            YulupHelpBrowser.__browser.webNavigation.goBack();
+    },
+
+    goForward: function () {
+        /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowser.goForward() invoked\n");
+
+        if (YulupHelpBrowser.__browser && YulupHelpBrowser.__browser.webNavigation.canGoForward)
+            YulupHelpBrowser.__browser.webNavigation.goForward();
+    }
+};
+
+
+function YulupHelpBrowserWindow() {
+    /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowserWindow() invoked\n");
+}
+
+YulupHelpBrowserWindow.prototype = {
+    QueryInterface: function (aUUID) {
+        /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowserWindow.QueryInterface(\"" + aUUID + "\") invoked\n");
+
+        if (aUUID.equals(Components.interfaces.nsISupports)              ||
+            aUUID.equals(Components.interfaces.nsISupportsWeakReference) ||
+            aUUID.equals(Components.interfaces.nsIXULBrowserWindow)) {
+            return this;
+        } else {
+            throw Components.results.NS_NOINTERFACE;
+        }
+    },
+
+    setJSDefaultStatus: function (aStatus) {
+        /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowserWindow.setJSDefaultStatus() invoked\n");
+
+        return;
+    },
+
+    setJSStatus: function (aStatus) {
+        /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowserWindow.setJSStatus() invoked\n");
+
+        return;
+    },
+
+    setOverLink: function (aLink) {
+        /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowserWindow.setOverLink() invoked\n");
+
+        return;
+    }
+};
+
+
+function YulupHelpBrowserWebProgressListener() {
+    /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowserWebProgressListener() invoked\n");
+}
+
+YulupHelpBrowserWebProgressListener.prototype = {
+    QueryInterface: function (aUUID) {
+        /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowserWebProgressListener.QueryInterface(\"" + aUUID + "\") invoked\n");
+
+        if (aUUID.equals(Components.interfaces.nsISupports)              ||
+            aUUID.equals(Components.interfaces.nsISupportsWeakReference) ||
+            aUUID.equals(Components.interfaces.nsIWebProgressListener)) {
+            return this;
+        } else {
+            throw Components.results.NS_NOINTERFACE;
+        }
+    },
+
+    onLocationChange: function (aWebProgress, aRequest, aLocation) {
+        /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowserWebProgressListener.onLocationChange() invoked\n");
+
+        YulupHelpBrowser.updateNavigation();
+    },
+
+    onProgressChange: function () {
+        /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowserWebProgressListener.onProgressChange() invoked\n");
+
+        return;
+    },
+
+    onSecurityChange: function () {
+        /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowserWebProgressListener.onSecurityChange() invoked\n");
+
+        return;
+    },
+
+    onStateChange: function () {
+        /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowserWebProgressListener.onStateChange() invoked\n");
+
+        return;
+    },
+
+    onStatusChange: function () {
+        /* DEBUG */ dump("Yulup:helpbrowser.js:YulupHelpBrowserWebProgressListener.onStatusChange() invoked\n");
+
+        return;
+    }
+};

Added: public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/help/helpbrowser.xul
===================================================================
--- public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/help/helpbrowser.xul	2006-12-07 19:45:37 UTC (rev 20667)
+++ public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/help/helpbrowser.xul	2006-12-07 20:46:44 UTC (rev 20668)
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+
+<!--
+# ***** BEGIN LICENSE BLOCK *****
+# Copyright 2006 Wyona AG Zurich
+#
+# This file is part of Yulup.
+#
+# Yulup is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Yulup is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Yulup; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+# ***** END LICENSE BLOCK *****
+-->
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://yulup/skin/helpbrowser.css" type="text/css"?>
+
+<!--<!DOCTYPE window SYSTEM "chrome://yulup/locale/helpbrowser.dtd">-->
+
+<window id="uiYulupHelpBrowserWindow"
+        orient="vertical"
+        align="stretch"
+        onload="YulupHelpBrowser.onLoadListener()"
+        title="Yulup Help Browser"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <script type="application/x-javascript"
+          src="chrome://yulup/content/common.js"/>
+  <script type="application/x-javascript"
+          src="chrome://yulup/content/help/helpbrowser.js"/>
+
+  <commandset id="yulupHelpBrowserNavigationCommandset">
+    <command id="cmd_yulup_goback"    oncommand="YulupHelpBrowser.goBack()"    disabled="true"/>
+    <command id="cmd_yulup_goforward" oncommand="YulupHelpBrowser.goForward()" disabled="true"/>
+  </commandset>
+
+  <toolbox id="uiYulupHelpBroserNavigationToolbox">
+    <toolbar id="uiYulupHelpBroserNavigationToolbar"
+             tbalign="stretch"
+             toolbarname="Yulup Help Browser Navigation Toolbar">
+      <toolbarbutton id="uiYulupHelpBrowserBackButton"
+                     command="cmd_yulup_goback"
+                     label="Back"
+                     tooltiptext="Go back"/>
+      <toolbarbutton id="uiYulupHelpBrowserForwardButton"
+                     command="cmd_yulup_goforward"
+                     label="Forward"
+                     tooltiptext="Go forward"/>
+    </toolbar>
+  </toolbox>
+
+  <browser id="uiYulupHelpBrowserBrowser" src="about:blank" type="content" align="stretch" flex="1"/>
+
+</window>

Modified: public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/yulup.js
===================================================================
--- public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/yulup.js	2006-12-07 19:45:37 UTC (rev 20667)
+++ public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/yulup.js	2006-12-07 20:46:44 UTC (rev 20668)
@@ -408,7 +408,8 @@
  * @return {Undefined} does not have a return value
  */
 function yulupShowHelp() {
-    window.open(YULUP_HELP_URI, "yulupHelpWindow", "left=0,top=0,resizable=yes,scrollbars=yes");
+    //window.open(YULUP_HELP_URI, "yulupHelpWindow", "left=0,top=0,resizable=yes,scrollbars=yes");
+    window.openDialog("chrome://yulup/content/help/helpbrowser.xul", "yulupHelpBrowserWindow", "chrome,dialog=no,menubar=no,width=1024,height=768");
 }
 
 /**

Added: public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/skin/helpbrowser.css
===================================================================
--- public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/skin/helpbrowser.css	2006-12-07 19:45:37 UTC (rev 20667)
+++ public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/skin/helpbrowser.css	2006-12-07 20:46:44 UTC (rev 20668)
@@ -0,0 +1,33 @@
+ at namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+/* -------------------- Toolbar Buttons  -------------------- */
+
+#uiYulupHelpBrowserBackButton {
+  -moz-box-orient: vertical;
+  min-width: 0px;
+  list-style-image: url("chrome://browser/skin/Toolbar-small.png");
+  -moz-image-region: rect(0px 24px 24px 0px);
+}
+
+#uiYulupHelpBrowserBackButton[disabled="true"] {
+  -moz-image-region: rect(48px 24px 72px 0px) !important;
+}
+
+#uiYulupHelpBrowserBackButton > dropmarker {
+  display: none !important;
+}
+
+#uiYulupHelpBrowserForwardButton {
+  -moz-box-orient: vertical;
+  min-width: 0px;
+  list-style-image: url("chrome://browser/skin/Toolbar-small.png");
+  -moz-image-region: rect(0px 48px 24px 24px);
+}
+
+#uiYulupHelpBrowserForwardButton[disabled="true"] {
+  -moz-image-region: rect(48px 48px 72px 24px) !important;
+}
+
+#uiYulupHelpBrowserForwardButton > dropmarker {
+  display: none !important;
+}




More information about the Phoenix-commits mailing list