This commit is contained in:
brade%netscape.com 1999-10-26 21:27:05 +00:00
Родитель bcede772bf
Коммит 0261db1f5b
8 изменённых файлов: 1760 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,232 @@
/*
* 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 Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Dan Haddix (dan6992@hotmail.com)
*/
var tHide = false;
var highCont = false;
var imageElement;
var mapName;
var imageMap;
var oldMap = false;
function Startup(){
if (!InitEditorShell())
return;
dump("EditorShell found for image map dialog\n");
initDialog();
}
function initDialog(){
//Check to make sure selected element is an image
imageElement = editorShell.GetSelectedElement("img");
if (!imageElement) //If not an image close window
window.close();
//Set iframe pointer
frameDoc = window.frames[0].document;
//Fill button array
buttonArray[0] = document.getElementById("pointer");
buttonArray[1] = document.getElementById("rect");
buttonArray[2] = document.getElementById("cir");
buttonArray[3] = document.getElementById("poly");
//Create marquee
marquee = frameDoc.createElement("div");
marquee.setAttribute("id", "marquee");
frameDoc.body.appendChild(marquee);
//Create background div
bgDiv = frameDoc.createElement("div");
bgDiv.setAttribute("id", "bgDiv");
frameDoc.body.appendChild(bgDiv);
//Place Image
newImg = frameDoc.createElement("img");
newImg.setAttribute("src", imageElement.getAttribute("src"));
newImg.setAttribute("id", "mainImg");
frameDoc.getElementById("bgDiv").appendChild(newImg);
//Recreate Image Map if it exists
if (imageElement.getAttribute("usemap") != "")
recreateMap();
}
function exitImageMap(){
dump("exit called");
window.close();
}
function hideToolbar(){
// Check to see if toolbar is already hidden
if (tHide){
// If it is show it
document.getElementById("toolbar").setAttribute("collapsed", "false");
// Set the menu items text back to "Hide Toolbar"
document.getElementById("view_hidetoolbar").setAttribute("value", "Hide Toolbar");
tHide = false
}
else{
// If not hide it
document.getElementById("toolbar").setAttribute("collapsed", "true");
//Set the menu items text to "Show Toolbar"
document.getElementById("view_hidetoolbar").setAttribute("value", "Show Toolbar");
tHide = true;
}
}
function highContrast(){
imgEl = frameDoc.getElementById("mainImg");
if (highCont){
imgEl.style.opacity = "100%";
highCont = false;
}
else{
imgEl.style.opacity = "10%";
highCont = true;
}
}
function recreateMap(){
map = imageElement.getAttribute("usemap");
map = map.substring(1, map.length);
mapCollection = imageElement.ownerDocument.getElementsByName(map);
areaCollection = mapCollection[0].childNodes;
var len = areaCollection.length;
var i=0;
for(i=0; i<len; i++){
area = areaCollection[i];
shape = area.getAttribute("shape");
shape = shape.toLowerCase();
coords = area.getAttribute("coords");
href = area.getAttribute("href");
//target = area.getAttribute("target");
//title = null; //area.getAttribute("title");
if (shape == "rect")
Rect(coords, href, null, null, true);
else if (shape == "circle")
Circle(coords, href, null, null, true);
else
Poly(coords, href, null, null, true);
}
imageElement.ownerDocument.body.removeChild(mapCollection[0]);
}
function finishMap(){
spots = frameDoc.getElementsByName("hotspot");
var len = spots.length;
createMap();
if (len >= 1){
var i=0;
for(i=0; i<len; i++){
dump(len+"\n");
curSpot = spots[i];
if (curSpot.getAttribute("class") == "rect")
createRect(curSpot);
else if (curSpot.getAttribute("class") == "cir")
createCir(curSpot);
else
createPoly(curSpot);
}
imageElement.setAttribute("usemap", ("#"+mapName));
editorShell.InsertElement(imageMap, false);
}
exitImageMap();
}
function createMap(){
imageMap = editorShell.CreateElementWithDefaults("map");
mapName = imageElement.getAttribute("src");
mapName = mapName.substring(mapName.lastIndexOf("/"), mapName.length);
mapName = mapName.substring(mapName.lastIndexOf("\\"), mapName.length);
mapName = mapName.substring(1, mapName.indexOf("."));
imageMap.setAttribute("name", mapName);
}
function createRect(which){
newRect = document.createElement("area");
newRect.setAttribute("shape", "rect");
coords = parseInt(which.style.left)+","+parseInt(which.style.top)+","+(parseInt(which.style.left)+parseInt(which.style.width))+","+(parseInt(which.style.top)+parseInt(which.style.height));
newRect.setAttribute("coords", coords);
if (which.getAttribute("href") != "")
newRect.setAttribute("href", which.getAttribute("href"));
else{
newRect.setAttribute("nohref", "");
}
newRect.removeAttribute("id");
imageMap.appendChild(newRect);
dump("rect created\n");
}
function createCir(which){
newCir = document.createElement("area");
newCir.setAttribute("shape", "circle");
radius = Math.floor(parseInt(which.style.width)/2);
coords = (parseInt(which.style.left)+radius)+","+(parseInt(which.style.top)+radius)+","+radius;
newCir.setAttribute("coords", coords);
if (which.getAttribute("href") != "")
newCir.setAttribute("href", which.getAttribute("href"));
else{
newCir.setAttribute("nohref", "");
}
newCir.removeAttribute("id");
imageMap.appendChild(newCir);
dump("circle created\n");
}
function createPoly(which){
newPoly = document.createElement("area");
newPoly.setAttribute("shape", "poly");
var coords = '';
var len = which.childNodes.length;
var i=0
for(i=0; i<len; i++){
coords += (parseInt(which.style.left)+parseInt(which.childNodes[i].style.left))+","+(parseInt(which.style.top)+parseInt(which.childNodes[i].style.top))+",";
}
coords = coords.substring(0, (coords.length-1));
newPoly.setAttribute("coords", coords);
if (which.getAttribute("href") != "")
newPoly.setAttribute("href", which.getAttribute("href"));
else{
newPoly.setAttribute("nohref", "");
}
newPoly.removeAttribute("id");
imageMap.appendChild(newPoly);
dump("poly created\n");
}
function hotSpotProps(which){
if (which == null)
return;
href = which.getAttribute("href");
hotSpotWin = window.openDialog("chrome://editor/content/EdImageMapHotSpot.xul", "htsptdlg", "modal", which, href);
}
function deleteAreas(){
if (oldMap){
area = imageMap.firstChild;
while (area){
area = imageMap.removeChild(area).nextSibling;
}
}
}

Просмотреть файл

@ -0,0 +1,148 @@
<?xml version="1.0"?>
<!--
- 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 Communicator client code, released
- March 31, 1998.
-
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
- Copyright (C) 1998-1999 Netscape Communications Corporation. All
- Rights Reserved.
-
- Contributor(s):
- Dan Haddix (dan6992@hotmail.com)
-->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://editor/skin/" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://editor/locale/EditorImageMap.dtd">
<!-- dialog containing a control requiring initial setup -->
<xul:window title="&windowTitle.label;"
xmlns:xul ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns="http://www.w3.org/TR/REC-html40"
onload = "Startup()"
onunload="//finishMap();"
align="vertical"
width="640" height="480">
<!-- Methods common to all editor dialogs -->
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js">
</script>
<script language="JavaScript" src="chrome://editor/content/EdImageMap.js">
</script>
<script language="JavaScript" src="chrome://editor/content/EdImageMapShapes.js">
</script>
<xul:broadcaster id="args" value=""/>
<xul:keyset id="defaultKeySet">
<xul:key id="removestyleskb" disabled="false" shift="true" command="true" alt="false" key="k" onkeypress="EditorRemoveStyle('all')" />
<xul:key id="decreasefontsizekb" disabled="false" shift="true" command="true" alt="false" key="[" onkeypress="DecreaseFontSize()" />
<xul:key id="increasefontsizekb" disabled="false" shift="true" command="true" alt="false" key="]" onkeypress="IncreaseFontSize()" />
<!-- how to handle return, enter, tab, function keys, arrow keys, others? saari working on solution -->
</xul:keyset>
<xul:broadcaster id="args" value="chrome://editor/content/EditorInitPage.html"/>
<xul:broadcaster id="canPrint"/>
<!-- Interim hack to transition from nsIXULWindowCallbacks/ShowWindowWithArgs -->
<xul:broadcaster id="dialog.start" ready="false"/>
<xul:observes element="dialog.start" attribute="ready" onchange="EditorStartup('html')"/>
<xul:broadcaster id="Editor:Document:Dirty" dirty="false"/>
<xul:menubar>
<!-- File menu -->
<xul:menu value="File" accesskey="f">
<xul:menupopup>
<xul:menuitem value="Clear All" accesskey="a" onaction=""/>
<xul:menuitem value="Exit" accesskey="f" onaction="exitImap()"/>
</xul:menupopup>
</xul:menu>
<xul:menu value="Edit" accesskey="e">
<xul:menupopup>
<xul:menuitem value="Cut" onaction=""/>
<xul:menuitem value="Copy" onaction=""/>
<xul:menuitem value="Paste" onaction=""/>
<xul:menuseparator/>
<xul:menuitem value="Hotspot Properties" onaction="hotSpotProps(currentElement[0])"/>
</xul:menupopup>
</xul:menu>
<xul:menu value="View" accesskey="v">
<xul:menupopup>
<xul:menuitem id="view_hidetoolbar" value="Hide Toolbar" onaction="hideToolbar()"/>
<xul:menu value="Scale" accesskey="v">
<xul:menupopup>
<xul:menuitem value="100%" onaction=""/>
<xul:menuitem value="200%" onaction=""/>
<xul:menuitem value="400%" onaction=""/>
</xul:menupopup>
</xul:menu>
<xul:menuseparator/>
<xul:menuitem value="High Contrast" onaction=""/>
</xul:menupopup>
</xul:menu>
<xul:menu value="Help">
<xul:menupopup>
<xul:menuitem value="About Image Map Editor" onaction=""/>
</xul:menupopup>
</xul:menu>
<xul:spring flex="100%"/>
</xul:menubar>
<xul:toolbar id="toolbar">
<xul:titledbutton src="&cutIcon.url;"/>
<xul:titledbutton src="&copyIcon.url;"/>
<xul:titledbutton src="&pasteIcon.url;"/>
<xul:menuseparator/>
<xul:titledbutton src="&zoomInIcon.url;"/>
<xul:titledbutton src="&zoomOutIcon.url;"/>
<xul:titledbutton toggled="0" src="&contrastIcon.url;" onclick="highContrast()"/>-
<xul:spring flex="100%"/>
</xul:toolbar>
<xul:box align="horizontal" flex="100">
<xul:toolbar id="toolbox" align="vertical">
<xul:titledbutton src="&pointerIcon.url;" id="pointer" toggled="0" onclick="changeTool(event, 'select')"/>
<xul:titledbutton src="&rectangleIcon.url;" id="rect" toggled="1" onclick="changeTool(event, 'rect')"/>
<xul:titledbutton src="&circleIcon.url;" id="cir" toggled="0" onclick="changeTool(event, 'cir')"/>
<xul:titledbutton src="&polygonIcon.url;" id="poly" toggled="0" onclick="changeTool(event, 'poly')"/>
<xul:spring flex="100%"/>
</xul:toolbar>
<iframe id="content" src="EdImageMapPage.html" flex="100%"/>
<!--<div id="content" style="overflow:auto; background-color:#808080; border: 2 inset #000000;" flex="100%" onmousedown="downMouse(event)" onmouseup="upMouse(event)" onmousemove="moveMouse(event)" onclick="clickMouse(event)" onkeypress="polyFinish()"></div>-->
</xul:box>
<xul:toolbar>
<!-- Cheap hack untill I get key events hooked up -->
<xul:titledbutton value="Delete Spot" onclick="deleteElement(currentElement)"/>
<xul:spring flex="100%"/>
<xul:titledbutton value="OK" onclick="finishMap()"/>
<xul:titledbutton value="Cancel" onclick="exitImageMap()"/>
</xul:toolbar>
</xul:window>

Просмотреть файл

@ -0,0 +1,64 @@
/*
* 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 Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Dan Haddix (dan6992@hotmail.com)
*/
var dialog;
// dialog initialization code
function Startup()
{
if (!InitEditorShell())
return;
doSetOKCancel(onOK, null);
// Create dialog object to store controls for easy access
dialog = new Object;
dialog.urlInput = document.getElementById("urlInput");
dialog.url = window.arguments[0].getAttribute("href");
if (dialog.url != '')
dialog.urlInput.value = dialog.url;
// Kinda clunky: Message was wrapped in a <p>,
// so actual message is a child text node
//dialog.srcMessage = (document.getElementById("srcMessage")).firstChild;
//if (null == dialog.srcInput ||
// null == dialog.srcMessage )
//{
// dump("Not all dialog controls were found!!!\n");
//}
// Set initial focus
dialog.urlInput.focus();
}
function onOK()
{
dump(window.arguments[0].id+"\n");
window.arguments[0].setAttribute("href", dialog.urlInput.value);
window.close();
}

Просмотреть файл

@ -0,0 +1,57 @@
<?xml version="1.0"?>
<!--
- 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 Communicator client code, released
- March 31, 1998.
-
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
- Copyright (C) 1998-1999 Netscape Communications Corporation. All
- Rights Reserved.
-
- Contributor(s):
- Dan Haddix (dan6992@hotmail.com)
-->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://editor/skin/" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xul-overlay href="chrome://editor/content/EdDialogOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://editor/locale/EditorImageMapHotSpot.dtd">
<xul:window class="dialog" title="&windowTitle.label;"
xmlns:xul ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns="http://www.w3.org/TR/REC-html40"
onload = "Startup()"
align="vertical" flex="100%">
<!-- Methods common to all editor dialogs -->
<script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js" />
<script language="JavaScript" src="chrome://editor/content/EdImageMapHotSpot.js" />
<xul:broadcaster id="args" value=""/>
<xul:box>
<label for="urlInput" id="urlLabel">&hotSpotURL.label;</label>
</xul:box>
<xul:box>
<input type="text" id="urlInput"/>
</xul:box>
<!-- from global dialogOverlay -->
<box id="okCancelButtons"/>
</xul:window>

Просмотреть файл

@ -0,0 +1,8 @@
<html>
<head>
<title>Image Map Editor</title>
<link rel=StyleSheet href="chrome://editor/content/EdImageMap.css" type="text/css">
</head>
<body onmousedown="top.downMouse(event)" onmouseup="top.upMouse(event)" onmousemove="top.moveMouse(event)" onclick="top.clickMouse(event)" onkeypress="top.polyFinish()">
</body>
</html>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,50 @@
<!--
- 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 Communicator client code, released
- March 31, 1998.
-
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
- Copyright (C) 1998-1999 Netscape Communications Corporation. All
- Rights Reserved.
-
- Contributor(s):
- Dan Haddix (dan6992@hotmail.com)
-->
<!-- These strings are generic to all or most of the editor's dialogs. -->
<!-- They should be moved into a "common" file -->
<!ENTITY OKButton.label "OK">
<!ENTITY CancelButton.label "Cancel">
<!ENTITY AdvancedEditButton.label "Advanced Edit...">
<!-- This button is for the progressive disclosure of additional editing functionality -->
<!-- THIS TEXT WILL CHANGE DYNAMICALLY, SO VALUES SHOULD BE IN Editor.properties STRING BUNDLE FILE -->
<!ENTITY MoreButton.label "More">
<!ENTITY FewerButton.label "Fewer">
<!-- These strings are for use specifically in the editor's image map dialog. -->
<!-- Window title -->
<!ENTITY windowTitle.label "Image Map Editor">
<!-- Toolbar image locations -->
<!ENTITY pointerIcon.url "chrome://editor/skin/images/pointertool.gif">
<!ENTITY rectangleIcon.url "chrome://editor/skin/images/rectangletool.gif">
<!ENTITY circleIcon.url "chrome://editor/skin/images/circletool.gif">
<!ENTITY polygonIcon.url "chrome://editor/skin/images/polygontool.gif">
<!ENTITY cutIcon.url "chrome://editor/skin/images/cut.gif">
<!ENTITY copyIcon.url "chrome://editor/skin/images/copy.gif">
<!ENTITY pasteIcon.url "chrome://editor/skin/images/paste.gif">
<!ENTITY zoomInIcon.url "chrome://editor/skin/images/zoomin.gif">
<!ENTITY zoomOutIcon.url "chrome://editor/skin/images/zoomout.gif">
<!ENTITY contrastIcon.url "chrome://editor/skin/images/contrast.gif">

Просмотреть файл

@ -0,0 +1,28 @@
<!--
- 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 Communicator client code, released
- March 31, 1998.
-
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
- Copyright (C) 1998-1999 Netscape Communications Corporation. All
- Rights Reserved.
-
- Contributor(s):
- Dan Haddix (dan6992@hotmail.com)
-->
<!-- Window title -->
<!ENTITY windowTitle.label "Hotspot Properties">
<!ENTITY urlFieldset.label "Enter Url">
<!ENTITY hotSpotURL.label "Hotspot URL:">