From daef4d8093dc44d2ca0c64c003fd3d17240d5277 Mon Sep 17 00:00:00 2001 From: "daniel%glazman.org" Date: Thu, 5 Oct 2006 07:58:11 +0000 Subject: [PATCH] Dual sidebars for standalone Composer with movable and detachable sidebar items; b=354691, r=neil@httl.net --- .../content/composer/bindings/sidebar.css | 55 ++ .../content/composer/bindings/sidebar.xml | 652 ++++++++++++++++++ composer/base/content/composer/composer.js | 10 +- composer/base/content/composer/composer.xul | 24 +- .../composer/dialogs/standaloneSidebar.js | 86 +++ .../composer/dialogs/standaloneSidebar.xul | 58 ++ composer/base/content/composer/utils/dgid.js | 14 +- composer/base/jar.mn | 8 +- .../base/locale/en-US/composer/sidebar.dtd | 59 ++ .../base/skin/classic/composer/composer.css | 8 +- .../base/skin/classic/composer/sidebar.css | 78 +++ .../skin/classic/composer/sidebarcontent.css | 61 ++ composer/doc/sidebarcontent.html | 57 ++ 13 files changed, 1158 insertions(+), 12 deletions(-) create mode 100644 composer/base/content/composer/bindings/sidebar.css create mode 100644 composer/base/content/composer/bindings/sidebar.xml create mode 100644 composer/base/content/composer/dialogs/standaloneSidebar.js create mode 100644 composer/base/content/composer/dialogs/standaloneSidebar.xul create mode 100644 composer/base/locale/en-US/composer/sidebar.dtd create mode 100644 composer/base/skin/classic/composer/sidebar.css create mode 100644 composer/base/skin/classic/composer/sidebarcontent.css create mode 100644 composer/doc/sidebarcontent.html diff --git a/composer/base/content/composer/bindings/sidebar.css b/composer/base/content/composer/bindings/sidebar.css new file mode 100644 index 00000000000..209acb83fde --- /dev/null +++ b/composer/base/content/composer/bindings/sidebar.css @@ -0,0 +1,55 @@ +/* ***** 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 Composer. + * + * The Initial Developer of the Original Code is + * Disruptive Innovations SARL. + * Portions created by the Initial Developer are Copyright (C) 2006 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Daniel Glazman , 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 ***** */ + +@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); + +sidebar { + width: 200px; + -moz-box-orient: vertical; + -moz-binding: url('chrome://composer/content/bindings/sidebar.xml#sidebar'); +} + +sidebarcontent { + -moz-box-orient: vertical; + -moz-binding: url('chrome://composer/content/bindings/sidebar.xml#sidebarcontent'); + -moz-box-flex: 1; +} + +sidebaritems { + -moz-binding: url('chrome://composer/content/bindings/sidebar.xml#sidebaritems'); + display: none ! important; +} diff --git a/composer/base/content/composer/bindings/sidebar.xml b/composer/base/content/composer/bindings/sidebar.xml new file mode 100644 index 00000000000..3477e239d05 --- /dev/null +++ b/composer/base/content/composer/bindings/sidebar.xml @@ -0,0 +1,652 @@ + + + + + + %sidebarDTD; +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + + null + null + null + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/composer/base/content/composer/composer.js b/composer/base/content/composer/composer.js index 673b8e867f9..cdda1db1e03 100644 --- a/composer/base/content/composer/composer.js +++ b/composer/base/content/composer/composer.js @@ -11,7 +11,7 @@ * for the specific language governing rights and limitations under the * License. * - * The Original Code is Mozilla Composer. + * The Original Code is Composer. * * The Initial Developer of the Original Code is * Disruptive Innovations SARL. @@ -35,8 +35,6 @@ * * ***** END LICENSE BLOCK ***** */ -var gDialog = {}; - function Startup() { var url = null; @@ -44,14 +42,16 @@ function Startup() if (window.arguments.length == 2) url = window.arguments[1]; - gDialog.status = dgid("status"); - gDialog.progress = dgid("progress"); + GetUIElements(); // let's finish with the url if (url) OpenFile(url, true); ComposerCommands.setupMainCommands(); + + gDialog.sidebar1.init(gDialog.sidebaritems, gDialog.sidebar2, gDialog.splitter1); + gDialog.sidebar2.init(gDialog.sidebaritems, gDialog.sidebar1, gDialog.splitter2); } function OpenLocation(aEvent, type) diff --git a/composer/base/content/composer/composer.xul b/composer/base/content/composer/composer.xul index c5fe97fdb7b..9f1fca11aea 100644 --- a/composer/base/content/composer/composer.xul +++ b/composer/base/content/composer/composer.xul @@ -13,7 +13,7 @@ - for the specific language governing rights and limitations under the - License. - - - The Original Code is Mozilla Composer. + - The Original Code is Composer. - - The Initial Developer of the Original Code is - Disruptive Innovations SARL. @@ -48,6 +48,7 @@ title = "&window.title;" width = "800" height = "600" + persist="screenX screenY width height" onload = "Startup()" xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> @@ -74,7 +75,26 @@ - + + + + + + + + + + + + + + + + + + diff --git a/composer/base/content/composer/dialogs/standaloneSidebar.js b/composer/base/content/composer/dialogs/standaloneSidebar.js new file mode 100644 index 00000000000..94fc28517b9 --- /dev/null +++ b/composer/base/content/composer/dialogs/standaloneSidebar.js @@ -0,0 +1,86 @@ +/* ***** 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 Composer. + * + * The Initial Developer of the Original Code is + * Disruptive Innovations SARL. + * Portions created by the Initial Developer are Copyright (C) 2006 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Daniel Glazman , 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 ***** */ + +function Startup() +{ + if(window.arguments.length != 4) + return; + + GetUIElements(); + + gDialog.name = window.arguments[0]; + gDialog.label = window.arguments[1]; + gDialog.src = window.arguments[2]; + gDialog.sidebaritem = window.arguments[3]; + + document.documentElement.setAttribute("id", gDialog.name); + gDialog.iframe.setAttribute("src", gDialog.src); + document.title = gDialog.label; + + var root = document.documentElement; + var item = gDialog.sidebaritem; + root.setAttribute("screenX", item.getAttribute("screenX")); + root.setAttribute("screenY", item.getAttribute("screenY")); + root.setAttribute("width", item.getAttribute("width")); + root.setAttribute("height", item.getAttribute("height")); +} + +function Onclose() +{ + gDialog.sidebaritem.removeAttribute("standalone"); + + return true; +} + +function Shutdown() +{ + var item = gDialog.sidebaritem; + var root = document.documentElement; + + item.setAttribute("screenX", window.screenX); + item.setAttribute("screenY", window.screenY); + item.setAttribute("width", document.documentElement.width); + item.setAttribute("height", document.documentElement.height); + + var doc = gDialog.sidebaritem.ownerDocument; + var id = item.getAttribute("id"); + doc.persist(id, "standalone"); + doc.persist(id, "screenX"); + doc.persist(id, "screenY"); + doc.persist(id, "width"); + doc.persist(id, "height"); +} diff --git a/composer/base/content/composer/dialogs/standaloneSidebar.xul b/composer/base/content/composer/dialogs/standaloneSidebar.xul new file mode 100644 index 00000000000..0a96de73e8f --- /dev/null +++ b/composer/base/content/composer/dialogs/standaloneSidebar.xul @@ -0,0 +1,58 @@ + + + + + + + + +