A start on documentation for SvgCanvas using NaturalDocs. You will need to download the NaturalDocs and put it in svg-edit/naturaldocs

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@788 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Jeff Schiller 2009-10-09 19:07:52 +00:00
parent 6cb43ab4ad
commit 1ecb018dd4
2 changed files with 39 additions and 3 deletions

View File

@ -1,5 +1,6 @@
NAME=svg-edit
VERSION=2.3
VERSION=2.4
MAKEDOCS=naturaldocs/NaturalDocs
PACKAGE=$(NAME)-$(VERSION)
YUI=build/yuicompressor.jar
ZIP=zip
@ -7,6 +8,7 @@ ZIP=zip
all: release firefox opera
build/$(PACKAGE):
$(MAKEDOCS) -i editor/ -o html docs/ -p config/
mkdir -p build/$(PACKAGE)
cp -r editor/* build/$(PACKAGE)
-find build/$(PACKAGE) -name .svn -type d -exec rm -rf {} \;
@ -36,6 +38,7 @@ opera: build/$(PACKAGE)
cd build/opera ; $(ZIP) ../$(PACKAGE).wgt -r * ; cd ../..
clean:
rm -rf docs/*
rm -rf build/$(PACKAGE)
rm -rf build/firefox
rm -rf build/opera

View File

@ -2987,6 +2987,12 @@ function BatchCommand(text) {
call("opened", str);
};
// Function: save
// Serializes the current drawing into SVG XML text and returns it to the 'saved' handler.
// This function also includes the XML prolog.
//
// Returns:
// Nothing
this.save = function() {
// remove the selected outline before serializing
this.clearSelection();
@ -3007,12 +3013,23 @@ function BatchCommand(text) {
}
};
// Function: getSvgString
// Returns the current drawing as raw SVG XML text.
//
// Returns:
// The current drawing as raw SVG XML text.
this.getSvgString = function() {
return svgCanvasToString();
};
// this function returns false if the set was unsuccessful, true otherwise
// TODO: after parsing in the new text, do we need to synchronize getId()?
// Function: setSvgString
// This function sets the current drawing as the input SVG XML.
//
// Parameters:
// xmlString - The SVG as XML text.
//
// Returns:
// This function returns false if the set was unsuccessful, true otherwise.
this.setSvgString = function(xmlString) {
try {
// convert string into XML document
@ -3124,6 +3141,13 @@ function BatchCommand(text) {
walkTree(current_layer, function(e){e.setAttribute("style","pointer-events:all");});
};
// Function: createLayer
// This function clears the selection and then creates a new top-level layer in the drawing
// with the given name and sets the current layer to it. This function then calls the
// 'changed' handler.
//
// Parameters:
// name - The given name
this.createLayer = function(name) {
var batchCmd = new BatchCommand("Create Layer");
var new_layer = svgdoc.createElementNS(svgns, "g");
@ -3139,6 +3163,9 @@ function BatchCommand(text) {
call("changed", [new_layer]);
};
// Function: deleteCurrentLayer
// This function clears the selection and then deletes the current layer from the drawing.
// This function then calls the 'changed' handler.
this.deleteCurrentLayer = function() {
if (current_layer && all_layers.length > 1) {
var batchCmd = new BatchCommand("Delete Layer");
@ -3156,9 +3183,15 @@ function BatchCommand(text) {
return false;
};
// Function: getNumLayers
// This function returns the number of layers in the current drawing.
//
// Returns:
// The number of layers in the current drawing.
this.getNumLayers = function() {
return all_layers.length;
};
this.getLayer = function(i) {
if (i >= 0 && i < canvas.getNumLayers()) {
return all_layers[i][0];