Fixed issue 587, more code reorganization/documentation

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1617 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-06-28 13:10:22 +00:00
parent 42dd162ffe
commit 00ef6f5d74
11 changed files with 92 additions and 48 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -43,7 +43,7 @@ var indexSectionsWithContent = {
"I": true,
"J": false,
"K": false,
"L": false,
"L": true,
"M": true,
"N": false,
"O": false,

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@ if (browserType) {document.write("<div class=" + browserType + ">");if (browserV
<div id=Index><div class=SRStatus id=Loading>Loading...</div><table border=0 cellspacing=0 cellpadding=0><div class=SRResult id=SR_sanitizeSvg><div class=IEntry><a href="../files/svgcanvas-js.html#SelectorManager.sanitizeSvg" target=_parent class=ISymbol>sanitizeSvg</a>, <span class=IParent>SelectorManager</span></div></div><div class=SRResult id=SR_save><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.save" target=_parent class=ISymbol>save</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_selectAllInCurrentLayer><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.selectAllInCurrentLayer" target=_parent class=ISymbol>selectAllInCurrentLayer</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_setCurrentLayer><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.setCurrentLayer" target=_parent class=ISymbol>setCurrentLayer</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_setCurrentLayerPosition><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.setCurrentLayerPosition" target=_parent class=ISymbol>setCurrentLayerPosition</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_setForeignString_lpaxmlString_comelt_rpa><div class=IEntry><a href="../files/extensions/ext-foreignobject-js.html#setForeignString(xmlString,elt)" target=_parent class=ISymbol>setForeignString(xmlString,elt)</a></div></div><div class=SRResult id=SR_setIdPrefix><div class=IEntry><a href="../files/svgcanvas-js.html#SelectorManager.setIdPrefix" target=_parent class=ISymbol>setIdPrefix</a>, <span class=IParent>SelectorManager</span></div></div><div class=SRResult id=SR_setLayerOpacity><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.setLayerOpacity" target=_parent class=ISymbol>setLayerOpacity</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_setLayerVisibility><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.setLayerVisibility" target=_parent class=ISymbol>setLayerVisibility</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_setSvgString><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.setSvgString" target=_parent class=ISymbol>setSvgString</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_setUnitAttr><div class=IEntry><a href="../files/svgcanvas-js.html#SvgCanvas.setUnitAttr" target=_parent class=ISymbol>setUnitAttr</a>, <span class=IParent>SvgCanvas</span></div></div><div class=SRResult id=SR_shortFloat><div class=IEntry><a href="../files/svgcanvas-js.html#SelectorManager.shortFloat" target=_parent class=ISymbol>shortFloat</a>, <span class=IParent>SelectorManager</span></div></div><div class=SRResult id=SR_showGrips><div class=IEntry><a href="../files/svgcanvas-js.html#Selector.Selector.showGrips" target=_parent class=ISymbol>showGrips</a>, <span class=IParent>Selector.<wbr>Selector</span></div></div><div class=SRResult id=SR_smoothControlPoints><div class=IEntry><a href="../files/svgcanvas-js.html#SelectorManager.smoothControlPoints" target=_parent class=ISymbol>smoothControlPoints</a>, <span class=IParent>SelectorManager</span></div></div><div class=SRResult id=SR_svgCanvasToString><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.svgCanvasToString" target=_parent class=ISymbol>svgCanvasToString</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_svgToString><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.svgToString" target=_parent class=ISymbol>svgToString</a>, <span class=IParent>pathActions</span></div></div></table><div class=SRStatus id=Searching>Searching...</div><div class=SRStatus id=NoMatches>No Matches</div><script type="text/javascript"><!--
<div id=Index><div class=SRStatus id=Loading>Loading...</div><table border=0 cellspacing=0 cellpadding=0><div class=SRResult id=SR_sanitizeSvg><div class=IEntry><a href="../files/svgcanvas-js.html#SelectorManager.sanitizeSvg" target=_parent class=ISymbol>sanitizeSvg</a>, <span class=IParent>SelectorManager</span></div></div><div class=SRResult id=SR_save><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.save" target=_parent class=ISymbol>save</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_selectAllInCurrentLayer><div class=IEntry><a href="../files/svgcanvas-js.html#SelectorManager.selectAllInCurrentLayer" target=_parent class=ISymbol>selectAllInCurrentLayer</a>, <span class=IParent>SelectorManager</span></div></div><div class=SRResult id=SR_setCurrentLayer><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.setCurrentLayer" target=_parent class=ISymbol>setCurrentLayer</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_setCurrentLayerPosition><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.setCurrentLayerPosition" target=_parent class=ISymbol>setCurrentLayerPosition</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_setDocumentTitle><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.setDocumentTitle" target=_parent class=ISymbol>setDocumentTitle</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_setForeignString_lpaxmlString_comelt_rpa><div class=IEntry><a href="../files/extensions/ext-foreignobject-js.html#setForeignString(xmlString,elt)" target=_parent class=ISymbol>setForeignString(xmlString,elt)</a></div></div><div class=SRResult id=SR_setIdPrefix><div class=IEntry><a href="../files/svgcanvas-js.html#SelectorManager.setIdPrefix" target=_parent class=ISymbol>setIdPrefix</a>, <span class=IParent>SelectorManager</span></div></div><div class=SRResult id=SR_setLayerOpacity><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.setLayerOpacity" target=_parent class=ISymbol>setLayerOpacity</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_setLayerVisibility><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.setLayerVisibility" target=_parent class=ISymbol>setLayerVisibility</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_setSvgString><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.setSvgString" target=_parent class=ISymbol>setSvgString</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_setUnitAttr><div class=IEntry><a href="../files/svgcanvas-js.html#SvgCanvas.setUnitAttr" target=_parent class=ISymbol>setUnitAttr</a>, <span class=IParent>SvgCanvas</span></div></div><div class=SRResult id=SR_shortFloat><div class=IEntry><a href="../files/svgcanvas-js.html#SelectorManager.shortFloat" target=_parent class=ISymbol>shortFloat</a>, <span class=IParent>SelectorManager</span></div></div><div class=SRResult id=SR_showGrips><div class=IEntry><a href="../files/svgcanvas-js.html#Selector.Selector.showGrips" target=_parent class=ISymbol>showGrips</a>, <span class=IParent>Selector.<wbr>Selector</span></div></div><div class=SRResult id=SR_smoothControlPoints><div class=IEntry><a href="../files/svgcanvas-js.html#SelectorManager.smoothControlPoints" target=_parent class=ISymbol>smoothControlPoints</a>, <span class=IParent>SelectorManager</span></div></div><div class=SRResult id=SR_svgCanvasToString><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.svgCanvasToString" target=_parent class=ISymbol>svgCanvasToString</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_svgToString><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.svgToString" target=_parent class=ISymbol>svgToString</a>, <span class=IParent>pathActions</span></div></div></table><div class=SRStatus id=Searching>Searching...</div><div class=SRStatus id=NoMatches>No Matches</div><script type="text/javascript"><!--
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults", "HTML");

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@ if (browserType) {document.write("<div class=" + browserType + ">");if (browserV
<div id=Index><div class=SRStatus id=Loading>Loading...</div><table border=0 cellspacing=0 cellpadding=0><div class=SRResult id=SR_Layers><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.Layers" target=_parent class=ISymbol>Layers</a>, <span class=IParent>pathActions</span></div></div></table><div class=SRStatus id=Searching>Searching...</div><div class=SRStatus id=NoMatches>No Matches</div><script type="text/javascript"><!--
<div id=Index><div class=SRStatus id=Loading>Loading...</div><table border=0 cellspacing=0 cellpadding=0><div class=SRResult id=SR_Layers><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.Layers" target=_parent class=ISymbol>Layers</a>, <span class=IParent>pathActions</span></div></div><div class=SRResult id=SR_linkControlPoints><div class=IEntry><a href="../files/svgcanvas-js.html#pathActions.linkControlPoints" target=_parent class=ISymbol>linkControlPoints</a>, <span class=IParent>pathActions</span></div></div></table><div class=SRStatus id=Searching>Searching...</div><div class=SRStatus id=NoMatches>No Matches</div><script type="text/javascript"><!--
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults", "HTML");

File diff suppressed because one or more lines are too long

View File

@ -2676,7 +2676,6 @@
if (paint.type == "linearGradient" || paint.type == "radialGradient") {
svgbox.removeChild(oldgrad);
var newgrad = svgbox.appendChild(document.importNode(paint[paint.type], true));
svgCanvas.fixOperaXML(newgrad, paint[paint.type])
newgrad.id = "gradbox_"+picker;
rectbox.setAttribute("fill", "url(#gradbox_" + picker + ")");
rectbox.setAttribute("opacity", paint.alpha/100);

View File

@ -3197,6 +3197,18 @@ this.removeFromSelection = function(elemsToRemove) {
selectedBBoxes = newSelectedBBoxes;
};
// Function: selectAllInCurrentLayer
// Clears the selection, then adds all elements in the current layer to the selection.
// This function then fires the selected event.
this.selectAllInCurrentLayer = function() {
if (current_layer) {
canvas.clearSelection();
canvas.addToSelection($(current_layer).children());
current_mode = "select";
call("selected", selectedElements);
}
};
// Function: smoothControlPoints
// Takes three points and creates a smoother line based on them
//
@ -6996,13 +7008,14 @@ this.setSvgString = function(xmlString) {
//
// Returns:
// This function returns false if the import was unsuccessful, true otherwise.
// TODO: properly handle if namespace is introduced by imported content (must add to svgcontent
// and update all prefixes in the imported node)
// TODO: properly handle recalculating dimensions, recalculateDimensions() doesn't handle
// arbitrary transform lists, but makes some assumptions about how the transform list
// was obtained
// TODO: import should happen in top-left of current zoomed viewport
// TODO: create a new layer for the imported SVG
// TODO:
// * properly handle if namespace is introduced by imported content (must add to svgcontent
// and update all prefixes in the imported node)
// * properly handle recalculating dimensions, recalculateDimensions() doesn't handle
// arbitrary transform lists, but makes some assumptions about how the transform list
// was obtained
// * import should happen in top-left of current zoomed viewport
// * create a new layer for the imported SVG
this.importSvgString = function(xmlString) {
try {
// convert string into XML document
@ -7190,6 +7203,8 @@ this.importSvgString = function(xmlString) {
// Group: Layers
// Function: identifyLayers
// Updates layer system
var identifyLayers = function() {
all_layers = [];
var numchildren = svgcontent.childNodes.length;
@ -7578,17 +7593,7 @@ this.setLayerOpacity = function(layername, opacity) {
}
};
// Function: selectAllInCurrentLayer
// Clears the selection, then adds all elements in the current layer to the selection.
// This function then fires the selected event.
this.selectAllInCurrentLayer = function() {
if (current_layer) {
canvas.clearSelection();
canvas.addToSelection($(current_layer).children());
current_mode = "select";
call("selected", selectedElements);
}
};
// Group: User actions
// Function: clear
// Clears the current document. This is not an undoable action.
@ -7620,14 +7625,24 @@ this.clear = function() {
call("cleared");
};
this.linkControlPoints = function(linkPoints) {
pathActions.linkControlPoints(linkPoints);
}
// Function: linkControlPoints
// Alias function
this.linkControlPoints = pathActions.linkControlPoints;
// Function: getContentElem
// Returns the content DOM element
this.getContentElem = function() { return svgcontent; };
// Function: getRootElem
// Returns the root DOM element
this.getRootElem = function() { return svgroot; };
// Function: getSelectedElems
// Returns the array with selected DOM elements
this.getSelectedElems = function() { return selectedElements; };
// Function: getResolution
// Returns the current dimensions and zoom level in an object
this.getResolution = function() {
// var vb = svgcontent.getAttribute("viewBox").split(' ');
// return {'w':vb[2], 'h':vb[3], 'zoom': current_zoom};
@ -7639,6 +7654,8 @@ this.getResolution = function() {
};
};
// Function: getDocumentTitle
// Returns the current document title or an empty string if not found
this.getDocumentTitle = function() {
var childs = svgcontent.childNodes;
for (var i=0; i<childs.length; i++) {
@ -7649,6 +7666,12 @@ this.getDocumentTitle = function() {
return '';
}
// Function: setDocumentTitle
// Adds/updates a title element for the document with the given name.
// This is an undoable action
//
// Parameters:
// newtitle - String with the new title
this.setDocumentTitle = function(newtitle) {
var childs = svgcontent.childNodes, doc_title = false, old_title = '';