annotate inkscape/firefox/content/wizard.js @ 1395:a768d74e5f49

Fix the svg:use. For a svg:use, it is a group which include the content it reference. It means that we can not tween it to its origin object directly. Instead, we need to ungroup it and then use the result matrix to generate the tweened transformation matrix. Therefore, we need to concate its matrix to the referenced object. Ad center object when the bbox-x is not available.
author wycc
date Sat, 02 Apr 2011 05:36:36 +0800
parents 3d21115297ba
children
rev   line source
367
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
1 function Wizard()
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
2 {
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
3 this.dialog = $('#wizard');
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
4 this.dialog.dialog({width:600,autoOpen:false});
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
5 this.step2 = $('#wizard_step2');
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
6 this.step2.dialog({width:600,autoOpen:false});
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
7 this.step3 = $('#wizard_step3');
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
8 this.step3.dialog({width:600,autoOpen:false});
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
9 }
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
10
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
11
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
12 Wizard.prototype.execute=function(cb)
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
13 {
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
14 this.dialog.dialog('open');
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
15 }
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
16
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
17 aaa=1
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
18 // In the first step, users will select the project type.
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
19 Wizard.prototype.step1_cb=function(type)
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
20 {
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
21 this.type = type;
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
22 var obj = $('#wizardname');
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
23 this.name = obj.attr('value');
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
24 this.step2.dialog('open');
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
25 this.dialog.dialog('close');
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
26 this.step3.dialog('close');
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
27 }
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
28
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
29 // In the step 2, get the output path
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
30 Wizard.prototype.step2_cb=function()
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
31 {
371
3d21115297ba Add textmenu template
wycc
parents: 367
diff changeset
32 this.dir = $('#outputpath').attr('value');
367
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
33 this.step2.dialog('close');
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
34 this.step3.dialog('open');
371
3d21115297ba Add textmenu template
wycc
parents: 367
diff changeset
35 system_mkdir(this.dir);
367
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
36 this.generate_source('main.c','main.c');
371
3d21115297ba Add textmenu template
wycc
parents: 367
diff changeset
37 this.step3.append('main.c<br>');
3d21115297ba Add textmenu template
wycc
parents: 367
diff changeset
38 this.generate_source('list.mbsvg','list.mbsvg');
3d21115297ba Add textmenu template
wycc
parents: 367
diff changeset
39 this.step3.append('list.mbsvg<br>');
367
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
40 this.generate_source('app.h',this.name+'.h');
371
3d21115297ba Add textmenu template
wycc
parents: 367
diff changeset
41 this.step3.append(this.name+'.h<br>');
367
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
42 this.generate_source('app.c',this.name+'.c');
371
3d21115297ba Add textmenu template
wycc
parents: 367
diff changeset
43 this.step3.append(this.name+'.c<br>');
367
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
44 this.generate_source('app.prj',this.name+'.prj');
371
3d21115297ba Add textmenu template
wycc
parents: 367
diff changeset
45 this.step3.append('app.prj<br>');
367
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
46 this.generate_source('Makefile','Makefile');
371
3d21115297ba Add textmenu template
wycc
parents: 367
diff changeset
47 this.step3.append('Makefile<br>');
367
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
48 this.done_cb();
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
49 }
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
50
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
51 Wizard.prototype.done_cb=function()
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
52 {
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
53 this.step3.dialog('close');
371
3d21115297ba Add textmenu template
wycc
parents: 367
diff changeset
54 this.cb(this.dir+'/'+this.name+'.prj');
367
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
55 }
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
56
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
57
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
58 Wizard.prototype.generate_source=function (tmpl,fname)
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
59 {
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
60 var file = system_open_write(this.dir+'/'+fname);
371
3d21115297ba Add textmenu template
wycc
parents: 367
diff changeset
61 var template = system_open_read('/usr/local/share/mb/template/'+this.type+'/'+tmpl);
367
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
62 if (template == null) {
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
63 return;
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
64 }
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
65 if (file == null) {
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
66 return;
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
67 }
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
68 var data = template.read(template.available());
371
3d21115297ba Add textmenu template
wycc
parents: 367
diff changeset
69 var regex = /\%n/gi;
367
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
70 // FIXME: replace name here
371
3d21115297ba Add textmenu template
wycc
parents: 367
diff changeset
71 data=data.replace(regex,this.name);
3d21115297ba Add textmenu template
wycc
parents: 367
diff changeset
72 file.write(data,data.length);
367
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
73 file.close();
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
74 template.close();
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
75 }
e21e9447f545 Add wizard. We still need to add the template files.
wycc
parents:
diff changeset
76