diff --git a/extensions/vixen/makefile.win b/extensions/vixen/makefile.win new file mode 100644 index 0000000000000..684846ae4c0b6 --- /dev/null +++ b/extensions/vixen/makefile.win @@ -0,0 +1,27 @@ +#!nmake +# +# The contents of this file are subject to the Netscape 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/NPL/ +# +# 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 mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): + +DEPTH=..\.. +include <$(DEPTH)/config/config.mak> + +DIRS = resources + +include <$(DEPTH)\config\rules.mak> diff --git a/extensions/vixen/resources/content/makefile.win b/extensions/vixen/resources/content/makefile.win new file mode 100644 index 0000000000000..cca6226de6ded --- /dev/null +++ b/extensions/vixen/resources/content/makefile.win @@ -0,0 +1,38 @@ +#!nmake +# +# The contents of this file are subject to the Netscape 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/NPL/ +# +# 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 mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): + +DEPTH=..\..\..\.. +include <$(DEPTH)/config/config.mak> + +CHROME_DIR=packages\xuledit +CHROME_CONTENT_DIR=xuledit\content + +CHROME_CONTENT = \ + .\vfdCommands.xul \ + .\vfdCommands.js \ + .\vfdScratch.xul \ + .\vfdScratchDocument.xul \ + .\xuledit.xul \ + .\xuledit.js \ + .\xe_NavOverlay.xul \ + $(NULL) + +include <$(DEPTH)\config\rules.mak> diff --git a/extensions/vixen/resources/content/vfdCommands.js b/extensions/vixen/resources/content/vfdCommands.js new file mode 100644 index 0000000000000..f8b62a237456f --- /dev/null +++ b/extensions/vixen/resources/content/vfdCommands.js @@ -0,0 +1,54 @@ + +const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; + +var nsVFD = { + + insertButtonElement: function (aButtonElementType) + { + switch (aButtonElementType) { + case "button": + var button = document.createElementNS(XUL_NS, "button"); + // insert some smarts to autogenerate button labels + button.setAttribute("value", "Button1"); + button.setAttribute("flex", "1"); + button.setAttribute("crop", "right"); + + this.genericInsertElement(button); + break; + case "toolbar-button": + break; + case "menu-button": + break; + } + }, + + genericInsertElement: function (aElement) + { + var domDocument = getDocument(); + + // get the focused element so we know where to insert + + // otherwise, just use the window + var scratchWindow = getDocumentWindow(domDocument); + + scratchWindow.appendChild(aElement); + }, +}; + +function getDocumentWindow(aDocument) +{ + if (!aDocument) + aDocument = getDocument(); + + for (var i = 0; i < aDocument.childNodes.length; i++) + if (aDocument.childNodes[i].localName == "window") + return aDocument.childNodes[i]; + return null; +} + +function getDocument() +{ + const WM_PROGID = "component://netscape/rdf/datasource?name=window-mediator"; + var wm = nsJSComponentManager.getService(WM_PROGID, "nsIWindowMediator"); + return wm.getMostRecentWindow("xuledit:document").frames["vfView"].document; +} \ No newline at end of file diff --git a/extensions/vixen/resources/content/vfdCommands.xul b/extensions/vixen/resources/content/vfdCommands.xul new file mode 100644 index 0000000000000..de6c242ddbbef --- /dev/null +++ b/extensions/vixen/resources/content/vfdCommands.xul @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/extensions/vixen/resources/content/vfdScratch.xul b/extensions/vixen/resources/content/vfdScratch.xul new file mode 100644 index 0000000000000..8d988d2906c6e --- /dev/null +++ b/extensions/vixen/resources/content/vfdScratch.xul @@ -0,0 +1,59 @@ + + + + + + + + + + + + +