CaScadeS cleanup
This commit is contained in:
daniel%glazman.org 2004-02-04 10:05:06 +00:00
Родитель 7e9db2bd71
Коммит 2cc555b6da
9 изменённых файлов: 1636 добавлений и 1206 удалений

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

@ -1,14 +1,17 @@
cascades.jar: cascades.jar:
content/cascades/EdCssProps.css (resources/content/EdCssProps.css) content/cascades/EdCssProps.css (resources/content/EdCssProps.css)
content/cascades/EdCssProps.js (resources/content/EdCssProps.js) content/cascades/EdCssProps.js (resources/content/EdCssProps.js)
content/cascades/EdCssProps-utils.js (resources/content/EdCssProps-utils.js) content/cascades/EdCssProps-utils.js (resources/content/EdCssProps-utils.js)
content/cascades/EdCssProps.xul (resources/content/EdCssProps.xul) content/cascades/EdCssProps.xul (resources/content/EdCssProps.xul)
content/cascades/cascadesOverlay.js (resources/content/cascadesOverlay.js) content/cascades/cascadesOverlay.js (resources/content/cascadesOverlay.js)
content/cascades/cascadesOverlay.xul (resources/content/cascadesOverlay.xul) content/cascades/cascadesOverlay.xul (resources/content/cascadesOverlay.xul)
content/cascades/commonCssProps.js (resources/content/commonCssProps.js) content/cascades/commonCssProps.js (resources/content/commonCssProps.js)
content/cascades/compatibility.js (resources/content/compatibility.js) content/cascades/compatibility.js (resources/content/compatibility.js)
content/cascades/contents.rdf (resources/content/contents.rdf) content/cascades/contents.rdf (resources/content/contents.rdf)
content/cascades/tabsOverlay.xul (resources/content/tabsOverlay.xul) content/cascades/tabsOverlay.xul (resources/content/tabsOverlay.xul)
locale/en-US/cascades/EdCssProps.dtd (resources/locale/en-US/EdCssProps.dtd) content/cascades/borderProps.xul (resources/content/borderProps.xul)
locale/en-US/cascades/cascadesOverlay.dtd (resources/locale/en-US/cascadesOverlay.dtd) content/cascades/textProps.xul (resources/content/textProps.xul)
locale/en-US/cascades/contents.rdf (resources/locale/en-US/contents.rdf) content/cascades/specificCSSProps.js (resources/content/specificCSSProps.js)
locale/en-US/cascades/EdCssProps.dtd (resources/locale/en-US/EdCssProps.dtd)
locale/en-US/cascades/cascadesOverlay.dtd (resources/locale/en-US/cascadesOverlay.dtd)
locale/en-US/cascades/contents.rdf (resources/locale/en-US/contents.rdf)

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

@ -69,13 +69,11 @@ treechildren::-moz-tree-cell-text(external) {
font-style: italic ! important; font-style: italic ! important;
} }
/*
spinbuttons image { border: solid thin black; padding: 2px; -moz-border-radius: 3px } spinbuttons image { border: solid thin black; padding: 2px; -moz-border-radius: 3px }
spinbuttons image:hover:active { spinbuttons image:hover:active {
/*-moz-border-top-colors: transparent transparent transparent #000000 #8290A5 #899AAC;
-moz-border-right-colors: transparent transparent transparent #000000 #8290A5 #899AAC;
-moz-border-bottom-colors: transparent transparent transparent #000000 #8290A5 #899AAC;
-moz-border-left-colors: transparent transparent transparent #000000 #8290A5 #899AAC;*/
background-color: #90A1B3; background-color: #90A1B3;
color: #FFFFFF; color: #FFFFFF;
} }
*/

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

@ -43,7 +43,7 @@ const CHARSET_RULE = 5;
const PAGE_RULE = 6; const PAGE_RULE = 6;
const OWNER_NODE = 7; const OWNER_NODE = 7;
const COMPATIBILITY_TAB = 1; // const COMPATIBILITY_TAB = 1;
const GENERAL_TAB = 2; const GENERAL_TAB = 2;
const TEXT_TAB = 3; const TEXT_TAB = 3;
const BACKGROUND_TAB = 4; const BACKGROUND_TAB = 4;
@ -63,15 +63,17 @@ var objectsArray = null;
var gTimerID; var gTimerID;
var gAsyncLoadingTimerID; var gAsyncLoadingTimerID;
// needed for commonCssProps.js
var gHaveDocumentUrl = false; var gHaveDocumentUrl = false;
var predefSelector = "";
var gInsertIndex = -1; var gInsertIndex = -1;
// * dialog initialization code // * dialog initialization code
function Startup() function Startup()
{ {
// are we in a pre-1.3 Mozilla ?
if (typeof window.InitEditorShell == "function") { if (typeof window.InitEditorShell == "function") {
// yes, so let's get an editorshell
if (!InitEditorShell()) if (!InitEditorShell())
return; return;
} }
@ -81,6 +83,9 @@ function Startup()
} }
// gDialog is declared in EdDialogCommon.js // gDialog is declared in EdDialogCommon.js
gDialog.selectionBased = false;
// Set commonly-used widgets like this: // Set commonly-used widgets like this:
gDialog.selectedTab = TEXT_TAB; gDialog.selectedTab = TEXT_TAB;
gDialog.sheetsTreechildren = document.getElementById("stylesheetsTree"); gDialog.sheetsTreechildren = document.getElementById("stylesheetsTree");
@ -95,7 +100,7 @@ function Startup()
gDialog.upButton = document.getElementById("upButton"); gDialog.upButton = document.getElementById("upButton");
gDialog.downButton = document.getElementById("downButton"); gDialog.downButton = document.getElementById("downButton");
gDialog.selectedTab = COMPATIBILITY_TAB; gDialog.selectedTab = GENERAL_TAB;
gDialog.sheetInfoTabPanelTitle = document.getElementById("sheetInfoTabPanelTitle"); gDialog.sheetInfoTabPanelTitle = document.getElementById("sheetInfoTabPanelTitle");
gDialog.textTab = document.getElementById("textTab"); gDialog.textTab = document.getElementById("textTab");
gDialog.brownFoxLabel = document.getElementById("brownFoxLabel"); gDialog.brownFoxLabel = document.getElementById("brownFoxLabel");
@ -170,6 +175,7 @@ function toggleExpertMode()
{ {
// toggle the boolean // toggle the boolean
gDialog.expertMode = !gDialog.expertMode; gDialog.expertMode = !gDialog.expertMode;
if (gDialog.expertMode) { if (gDialog.expertMode) {
if (gDialog.selectedIndex == -1) { if (gDialog.selectedIndex == -1) {
// if expert mode is on but no selection in the tree, only // if expert mode is on but no selection in the tree, only
@ -197,7 +203,6 @@ function toggleExpertMode()
// * This function recreates the contents of the STYLE elements and // * This function recreates the contents of the STYLE elements and
// of the stylesheets local to the filesystem // of the stylesheets local to the filesystem
// XXXX : this function is about to disappear due to last code cleanup
function FlushChanges() function FlushChanges()
{ {
if (gDialog.modified) { if (gDialog.modified) {
@ -488,6 +493,8 @@ function GetSelectedItemData()
gDialog.selectedIndex = -1; gDialog.selectedIndex = -1;
gDialog.selectedObject = null; gDialog.selectedObject = null;
if (!objectsArray)
return;
// look for the object in objectsArray corresponding to the // look for the object in objectsArray corresponding to the
// selectedItem // selectedItem
var i, l = objectsArray.length; var i, l = objectsArray.length;
@ -515,7 +522,6 @@ function onSelectCSSTreeItem(tab)
{ {
// convert the tab string into a tab id // convert the tab string into a tab id
if (tab == "general") tab = GENERAL_TAB; if (tab == "general") tab = GENERAL_TAB;
else if (tab == "compatibility") tab = COMPATIBILITY_TAB;
else if (tab == "text") tab = TEXT_TAB; else if (tab == "text") tab = TEXT_TAB;
else if (tab == "background") tab = BACKGROUND_TAB; else if (tab == "background") tab = BACKGROUND_TAB;
else if (tab == "border") tab = BORDER_TAB; else if (tab == "border") tab = BORDER_TAB;
@ -527,8 +533,7 @@ function onSelectCSSTreeItem(tab)
if (gDialog.selectedIndex == -1) { if (gDialog.selectedIndex == -1) {
// there is no tree item selected, let's fallback to the Info tab // there is no tree item selected, let's fallback to the Info tab
// but there is nothing we can display in that tab... // but there is nothing we can display in that tab...
if (tab != COMPATIBILITY_TAB) gDialog.sheetTabbox.selectedTab = gDialog.sheetInfoTab;
gDialog.sheetTabbox.selectedTab = gDialog.sheetInfoTab;
return; return;
} }
@ -550,9 +555,6 @@ function onSelectCSSTreeItem(tab)
tab = gDialog.selectedTab ? gDialog.selectedTab : GENERAL_TAB; tab = gDialog.selectedTab ? gDialog.selectedTab : GENERAL_TAB;
} }
switch (tab) { switch (tab) {
case COMPATIBILITY_TAB:
return;
break;
case TEXT_TAB: case TEXT_TAB:
// we have to update the text preview, let's remove its style attribute // we have to update the text preview, let's remove its style attribute
gDialog.brownFoxLabel.removeAttribute("style"); gDialog.brownFoxLabel.removeAttribute("style");
@ -761,7 +763,7 @@ function AddEditableZoneToInfobox(rows, label, value, callback, focus)
function AddRadioGroupToInfoBox(rows, label) function AddRadioGroupToInfoBox(rows, label)
{ {
var row = document.createElementNS(XUL_NS, "row"); var row = document.createElementNS(XUL_NS, "row");
row.setAttribute("align", "baseline"); row.setAttribute("align", "center");
var labelLabel = document.createElementNS(XUL_NS, "label"); var labelLabel = document.createElementNS(XUL_NS, "label");
labelLabel.setAttribute("value", label); labelLabel.setAttribute("value", label);
@ -1712,18 +1714,3 @@ function AddCSSLevelChoice(rows)
rows.appendChild(row); rows.appendChild(row);
} }
function SelectCSSLevel(level)
{
var bit = kCompatibilities[level];
var i = 0;
var id = kButtonCompatibilityArray[i];
while (id) {
var elt = document.getElementById(id);
if (elt) {
var compats = parseInt(kButtonCompatibilityArray[i+1], 2);
EnableUI(elt, (compats >> bit) & 1);
}
i += 2;
id = kButtonCompatibilityArray[i];
}
}

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

@ -140,9 +140,6 @@
<vbox> <vbox>
<tabbox id="sheetTabbox"> <tabbox id="sheetTabbox">
<tabs> <tabs>
<tab id="compatibilityTab"
label="&compatibilityTab.label;"
oncommand="onSelectCSSTreeItem('compatibility');"/>
<tab id="sheetInfoTab" <tab id="sheetInfoTab"
label="&sheetInfoTab.label;" label="&sheetInfoTab.label;"
oncommand="onSelectCSSTreeItem('general');"/> oncommand="onSelectCSSTreeItem('general');"/>
@ -164,38 +161,6 @@
</tabs> </tabs>
<!-- defined in tabsOverlay --> <!-- defined in tabsOverlay -->
<tabpanels id="TabPanels"> <tabpanels id="TabPanels">
<grid id="compatibilityTabPanel" flex="1">
<columns><column/><column/><column/><column/></columns>
<rows>
<row align="center">
<label value="NOT YET IMPLEMENTED" class="titleLabel"/>
</row>
<row align="center">
<label value="CSS Level:"/>
<menulist>
<menupopup>
<menuitem label="3"/>
<menuitem label="2" oncommand="SelectCSSLevel('CSS2')"/>
<menuitem label="1" oncommand="SelectCSSLevel('CSS1')"/>
</menupopup>
</menulist>
</row>
<row align="center">
<label value="Edit stylesheets compatible with:"/>
<checkbox label="Gecko" selected="true"/>
<checkbox label="Netscape 4"/>
</row>
<row align="center">
<spacer/>
<checkbox label="WinIE 4"/>
<checkbox label="WinIE 5/6"/>
</row>
<row align="center">
<spacer/>
<checkbox label="Opera 6"/>
</row>
</rows>
</grid>
<!-- STYLESHEET INFORMATION PANEL --> <!-- STYLESHEET INFORMATION PANEL -->
<vbox id="sheetInfoTabPanel" <vbox id="sheetInfoTabPanel"
flex="1"> flex="1">
@ -207,7 +172,11 @@
</grid> </grid>
</vbox> </vbox>
</vbox> </vbox>
<!-- other tabs defined in tabsOverlay.xul --> <vbox id="textTabPanel" />
<vbox id="backgroundTabPanel" />
<vbox id="borderTabPanel" />
<vbox id="boxTabPanel" />
<vbox id="auralTabPanel" />
</tabpanels> </tabpanels>
</tabbox> </tabbox>
<hbox align="center"> <hbox align="center">

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

@ -0,0 +1,75 @@
<?xml version="1.0"?>
<!-- ***** 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 CaScadeS, a stylesheet editor for Composer.
-
- The Initial Developer of the Original Code is
- Daniel Glazman.
- Portions created by the Initial Developer are Copyright (C) 2002
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Original author: Daniel Glazman (daniel@glazman.org)
-
- 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 LGPL or the GPL. 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 ***** -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://editor/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://editor/skin/EditorDialog.css" type="text/css"?>
<?xml-stylesheet href="chrome://cascades/content/EdCssProps.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xul-overlay href="chrome://editor/content/EdDialogOverlay.xul"?>
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://cascades/content/tabsOverlay.xul"?>
<!DOCTYPE dialog SYSTEM "chrome://cascades/locale/EdCssProps.dtd">
<dialog title="&Window.title;"
id="specificCssPropsWindow"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
buttons="accept,cancel,help"
onload="Startup();"
ondialogcancel="CancelChanges();"
ondialogaccept="FlushChanges();"
onclose="CancelChanges();">
<script type="application/x-javascript" src="chrome://cascades/content/specificCSSProps.js" />
<!-- Methods common to all editor dialogs -->
<script type="application/x-javascript" src="chrome://editor/content/editorUtilities.js"/>
<script type="application/x-javascript" src="chrome://editor/content/EdDialogCommon.js"/>
<script type="application/x-javascript" src="chrome://cascades/content/commonCssProps.js"/>
<script type="application/x-javascript" src="chrome://cascades/content/EdCssProps-utils.js"/>
<script type="application/x-javascript" src="chrome://global/content/dialogOverlay.js" />
<spacer id="location" offsetY="50" persist="offsetX offsetY"/>
<spacer id="dummy" style="display:none"/>
<broadcaster id="args" value=""/>
<vbox id="borderTabPanel" />
</dialog>

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

@ -196,6 +196,8 @@ function GetColorAndUpdate(ColorWellID)
textZone.value = color; textZone.value = color;
if (ColorWellID == "bordertopCW") if (ColorWellID == "bordertopCW")
IfFourSidesSameStyle('border', 'color', color, 'allFourBordersSame', 'borderPreview', null); IfFourSidesSameStyle('border', 'color', color, 'allFourBordersSame', 'borderPreview', null);
else if (ColorWellID == "backgroundCW")
AddStyleToElement(gDialog.backgroundPreview, "background-color", color);
} }
try { try {
gDialog.selectedObject.style.setProperty(property, gDialog.selectedObject.style.setProperty(property,
@ -931,6 +933,7 @@ function getSpecifiedStyle(property)
if (gDialog.selectedObject && gDialog.selectedObject.style) { if (gDialog.selectedObject && gDialog.selectedObject.style) {
return gDialog.selectedObject.style.getPropertyValue(property).toLowerCase(); return gDialog.selectedObject.style.getPropertyValue(property).toLowerCase();
} }
return null; return null;
} }
@ -1078,6 +1081,10 @@ function ToggleFourBorderSidesSameStyle(elt)
AddStyleToElement(gDialog.borderPreview, "border-"+sideArray[i]+"-color", color); AddStyleToElement(gDialog.borderPreview, "border-"+sideArray[i]+"-color", color);
AddStyleToElement(gDialog.borderPreview, "border-"+sideArray[i]+"-style", style); AddStyleToElement(gDialog.borderPreview, "border-"+sideArray[i]+"-style", style);
AddStyleToElement(gDialog.borderPreview, "border-"+sideArray[i]+"-width", width); AddStyleToElement(gDialog.borderPreview, "border-"+sideArray[i]+"-width", width);
AddStyleToElement(gDialog.selectedObject, "border-"+sideArray[i]+"-color", color);
AddStyleToElement(gDialog.selectedObject, "border-"+sideArray[i]+"-style", style);
AddStyleToElement(gDialog.selectedObject, "border-"+sideArray[i]+"-width", width);
} }
else { else {
styleMenulist.removeAttribute("disabled"); styleMenulist.removeAttribute("disabled");
@ -1182,6 +1189,9 @@ function Spinbutton(increment, id)
} }
elt.value = (Math.round(100 * (parseFloat(numPart) + (increment * unitIncrement)))/100) + unitPart; elt.value = (Math.round(100 * (parseFloat(numPart) + (increment * unitIncrement)))/100) + unitPart;
} }
else
elt.value = increment + "px";
elt.oninput();
} }
} }

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

@ -0,0 +1,311 @@
/* ***** 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 CaScadeS, a stylesheet editor for Composer.
*
* The Initial Developer of the Original Code is
* Daniel Glazman.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original author: Daniel Glazman <daniel@glazman.org>
*
* 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 ***** */
var gTimerID;
const urlString = "url(";
const styleStr = "style";
var textColor, backgroundColor;
var gHaveDocumentUrl = false;
var predefSelector = "";
var gPanel = "";
var gOriginalStyle = "";
// const COMPATIBILITY_TAB = 1;
const GENERAL_TAB = 2;
const TEXT_TAB = 3;
const BACKGROUND_TAB = 4;
const BORDER_TAB = 5;
const BOX_TAB = 6;
const AURAL_TAB = 7;
function doDump(text, value) {
dump("===> " + text + " : " + value + "\n");
}
// dialog initialization code
function Startup()
{
// are we in a pre-1.3 Mozilla ?
if (typeof window.InitEditorShell == "function") {
// yes, so let's get an editorshell
if (!InitEditorShell())
return;
}
else if (typeof window.GetCurrentEditor != "function" || !GetCurrentEditor()) {
window.close();
return;
}
var title = "Styles";
gDialog.selectionBased = false;
gDialog.isSelectionCollapsed = false;
gDialog.selectionInSingleLine = false;
// if a title was provided at window creation, let's use it
if ("arguments" in window && window.arguments.length >= 3) {
gPanel = window.arguments[0];
title = window.arguments[1];
gDialog.selectionBased = window.arguments[2];
}
var w = document.getElementById("specificCssPropsWindow");
if (!w || !gPanel) // we should never hit this but let's be paranoid...
return;
w.setAttribute("title", title);
// gDialog is declared in EdDialogCommon.js
// Set commonly-used widgets like this:
gDialog.textTab = document.getElementById("textTab");
gDialog.brownFoxLabel = document.getElementById("brownFoxLabel");
gDialog.backgroundImageInput = document.getElementById("backgroundImageInput");
gDialog.backgroundPreview = document.getElementById("backgroundPreview");
gDialog.sheetTabbox = document.getElementById("sheetTabbox");
gDialog.backgroundColorInput = document.getElementById("backgroundColorInput");
gDialog.textColorInput = document.getElementById("textColorInput");
gDialog.backgroundRepeatMenulist = document.getElementById("backgroundRepeatMenulist");
gDialog.backgroundAttachmentCheckbox = document.getElementById("backgroundAttachmentCheckbox");
gDialog.xBackgroundPositionRadiogroup = document.getElementById("xBackgroundPositionRadiogroup");
gDialog.yBackgroundPositionRadiogroup = document.getElementById("yBackgroundPositionRadiogroup");
gDialog.fontFamilyRadiogroup = document.getElementById("fontFamilyRadiogroup");
gDialog.customFontFamilyInput = document.getElementById("customFontFamilyInput");
gDialog.predefFontFamilyMenulist = document.getElementById("predefFontFamilyMenulist");
gDialog.fontSizeInput = document.getElementById("fontSizeInput");
gDialog.lineHeightInput = document.getElementById("lineHeightInput");
gDialog.textUnderlineCheckbox = document.getElementById("underlineTextDecorationCheckbox");
gDialog.textOverlineCheckbox = document.getElementById("overlineTextDecorationCheckbox");
gDialog.textLinethroughCheckbox = document.getElementById("linethroughTextDecorationCheckbox");
gDialog.textBlinkCheckbox = document.getElementById("blinkTextDecorationCheckbox");
gDialog.noDecorationCheckbox = document.getElementById("noneTextDecorationCheckbox");
gDialog.topBorderStyleMenulist = document.getElementById("topBorderStyleMenulist");
gDialog.topBorderWidthInput = document.getElementById("topBorderWidthInput");
gDialog.topBorderColorInput = document.getElementById("topBorderColorInput");
gDialog.leftBorderStyleMenulist = document.getElementById("leftBorderStyleMenulist");
gDialog.leftBorderWidthInput = document.getElementById("leftBorderWidthInput");
gDialog.leftBorderColorInput = document.getElementById("leftBorderColorInput");
gDialog.rightBorderStyleMenulist = document.getElementById("rightBorderStyleMenulist");
gDialog.rightBorderWidthInput = document.getElementById("rightBorderWidthInput");
gDialog.rightBorderColorInput = document.getElementById("rightBorderColorInput");
gDialog.bottomBorderStyleMenulist = document.getElementById("bottomBorderStyleMenulist");
gDialog.bottomBorderWidthInput = document.getElementById("bottomBorderWidthInput");
gDialog.bottomBorderColorInput = document.getElementById("bottomBorderColorInput");
gDialog.allFourBordersSame = document.getElementById("allFourBordersSame");
gDialog.borderPreview = document.getElementById("borderPreview");
gDialog.volumeScrollbar = document.getElementById("volumeScrollbar");
gDialog.volumeMenulist = document.getElementById("volumeMenulist");
gDialog.muteVolumeCheckbox = document.getElementById("muteVolumeCheckbox");
gDialog.opacityScrollbar = document.getElementById("opacityScrollbar");
gDialog.opacityLabel = document.getElementById("opacityLabel");
gDialog.modified = false;
gDialog.selectedIndex = -1;
var elt;
if (gDialog.selectionBased)
{
var editor = GetCurrentEditor();
var selection = editor.selection;
gDialog.isSelectionCollapsed = selection.isCollapsed;
if (gDialog.isSelectionCollapsed) {
elt = selection.focusNode;
while (!editor.nodeIsBlock(elt))
elt = elt.parentNode;
}
else
{
var range = selection.getRangeAt(0);
var startNode = range.startContainer;
var startOffset = range.startOffset;
if (startNode.nodeType != Node.TEXT_NODE)
elt = startNode.childNodes.item(startOffset);
else
elt = startNode;
}
}
else
{
elt = window.opener.gContextMenuFiringDocumentElement;
}
if (!elt) return;
if (elt.nodeType == Node.TEXT_NODE)
elt = elt.parentNode;
if (gDialog.selectionBased &&
gDialog.isSelectionCollapsed &&
elt.nodeName.toLowerCase() == "body")
{
// the selection is collapsed in a line directly contained in the BODY
gDialog.selectionInSingleLine = true;
elt = GetCurrentEditor().document.createElement("div");
}
gDialog.selectedObject = elt;
gDialog.selectedHasStyle = elt.hasAttribute("style");
if (gDialog.selectedHasStyle)
gDialog.selectedStyle = elt.getAttribute("style");
gDialog.selectedSheet = null;
InitDialog();
if (gDialog.selectionBased && !gDialog.isSelectionCollapsed)
{
gDialog.selectedObject = GetCurrentEditor().document.createElement("div");
}
// Set window location relative to parent window (based on persisted attributes)
SetWindowLocation();
// Set focus to first widget in dialog, e.g.:
}
function DisableTabIfNotSpecified(id, tabs, firstTab)
{
if (tabs.indexOf(id) == -1) {
/* disable the corresponding tab */
var elt = document.getElementById( id + "Tab" );
elt.setAttribute("collapsed", "true");
}
else
firstTab = id;
return firstTab;
}
function InitDialog()
{
switch (gPanel) {
case "border":
InitBorderTabPanel();
break;
case "text":
InitTextTabPanel();
break;
default:
break;
}
}
function getSelectedBlock()
{
var anchorNode = editorShell.editorSelection.anchorNode;
if (!anchorNode) return null;
var node;
if (anchorNode.firstChild)
{
// Start at actual selected node
var offset = editorShell.editorSelection.anchorOffset;
// Note: If collapsed, offset points to element AFTER caret,
// thus node may be null
node = anchorNode.childNodes.item(offset);
}
if (!node)
node = anchorNode;
while (!nodeIsBlock(node) && node.nodeName.toLowerCase() != "body") {
node = node.parentNode;
}
if (node.nodeName.toLowerCase() == "body") {
node = null;
}
return node;
}
function nodeIsBlock(node)
{
// HR doesn't count because it's not a container
return !node || (node.localName != 'HR' && editorShell.NodeIsBlock(node));
}
function SetModifiedFlagOnStylesheet()
{
/* STUB */
}
function FlushChanges()
{
var editor = GetCurrentEditor();
editor.incrementModificationCount(1);
if (gDialog.selectionBased)
{
var selection = editor.selection;
// we still have to update the selection, the preview is not "live",
// with the styles hold by gDialog.selectedObject
var elt;
if (gDialog.isSelectionCollapsed)
{
// do we have to create a block here or not ?
editor.beginTransaction();
if (gDialog.selectionInSingleLine)
{
// yes, need to create a div around the line
editor.setParagraphFormat("div");
}
elt = selection.focusNode;
while (!editor.nodeIsBlock(elt))
elt = elt.parentNode;
editor.setAttribute(elt, styleStr, gDialog.selectedObject.getAttribute(styleStr));
editor.endTransaction();
}
else
{
// nope, the selection is already in a block, nothing to do here
// the preview is live
// let's reuse Absolute Positioning code here
editor.makeComplexBlock(gDialog.selectedObject.getAttribute(styleStr));
}
}
}
function CancelChanges()
{
if (gDialog.selectedHasStyle)
gDialog.selectedObject.setAttribute("style", gDialog.selectedStyle);
else
gDialog.selectedObject.removeAttribute("style");
}

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

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

@ -0,0 +1,74 @@
<?xml version="1.0"?>
<!-- ***** 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 CaScadeS, a stylesheet editor for Composer.
-
- The Initial Developer of the Original Code is
- Daniel Glazman.
- Portions created by the Initial Developer are Copyright (C) 2002
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Original author: Daniel Glazman (daniel@glazman.org)
-
- 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 LGPL or the GPL. 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 ***** -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://editor/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://editor/skin/EditorDialog.css" type="text/css"?>
<?xml-stylesheet href="chrome://cascades/content/EdCssProps.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xul-overlay href="chrome://editor/content/EdDialogOverlay.xul"?>
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://cascades/content/tabsOverlay.xul"?>
<!DOCTYPE dialog SYSTEM "chrome://cascades/locale/EdCssProps.dtd">
<dialog title="&Window.title;"
id="specificCssPropsWindow"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
buttons="accept,cancel,help"
onload="Startup();"
ondialogcancel="CancelChanges();"
onclose="FlushChanges();">
<script type="application/x-javascript" src="chrome://cascades/content/specificCSSProps.js" />
<!-- Methods common to all editor dialogs -->
<script type="application/x-javascript" src="chrome://editor/content/editorUtilities.js"/>
<script type="application/x-javascript" src="chrome://editor/content/EdDialogCommon.js"/>
<script type="application/x-javascript" src="chrome://cascades/content/commonCssProps.js"/>
<script type="application/x-javascript" src="chrome://cascades/content/EdCssProps-utils.js"/>
<script type="application/x-javascript" src="chrome://global/content/dialogOverlay.js" />
<spacer id="location" offsetY="50" persist="offsetX offsetY"/>
<spacer id="dummy" style="display:none"/>
<broadcaster id="args" value=""/>
<vbox id="textTabPanel" />
</dialog>