389
|
1 asdasd=1;
|
|
2 function MadSwatter(inkscape)
|
|
3 {
|
|
4 this.inkscape = inkscape;
|
|
5 }
|
|
6
|
|
7
|
|
8 function MadSwatter_callback(mbsvg,self)
|
|
9 {
|
392
|
10 var ch = $(mbsvg).find("channels");
|
|
11 try {
|
|
12 var oldch = $(inkscape.mbsvg.doc).find("channels");
|
|
13 var newch = $(mbsvg).find("channels");
|
|
14 oldch.replaceWith(newch);
|
|
15 $('#display').tabs('select',0);
|
|
16 } catch(e) {
|
|
17 alert(e);
|
|
18 }
|
|
19 //self.inkscape.updateDocument();
|
|
20 }
|
389
|
21
|
392
|
22
|
|
23
|
|
24 // Call MadSwatter, we will create file in the /tmp and then create an iframe inside thge madswatter div to
|
|
25 // load this file. After the MadSwatter finish the job, it should send an event editcb back to us. In this way,
|
|
26 // we can avoid the security issue.
|
|
27 function MadSwatter_invoke(dom,callback,self)
|
|
28 {
|
|
29 var f = system_open_write("/tmp/swatter.tmp");
|
|
30 var serializer = new XMLSerializer();
|
|
31 var cont = serializer.serializeToString(dom[0]);
|
|
32
|
|
33 f.write(cont,cont.length);
|
|
34 f.close();
|
|
35 $('#madswatter').html('<iframe width="900" height="700" src="chrome://madswatter/content/editor.xhtml"></iframe>');
|
389
|
36 }
|
|
37
|
|
38 MadSwatter.prototype.edit=function()
|
|
39 {
|
|
40 // Generate a new document with the current scene
|
|
41 // FIXME: Do we need to do animation filter here?
|
|
42 // FIXME: Do we need to support hiearchical animation?
|
392
|
43 var kk = this.inkscape.mbsvg.generateCurrentSVG();
|
389
|
44 $('#display').tabs('select',2);
|
392
|
45 MadSwatter_invoke(kk,MadSwatter_callback,this);
|
389
|
46 // Simulate the MadSwatter
|
392
|
47 //kk.find("metadata").append("<channels></channels>");
|
|
48 //setTimeout(function () { MadSwatter_callback(kk,this);}, 3000);
|
389
|
49 }
|