Mercurial > MadButterfly
comparison inkscape/firefox/content/inkscape.js @ 357:6fd8da22a5ef
Implement scene file load function.
author | wycc |
---|---|
date | Wed, 11 Mar 2009 01:32:09 +0800 |
parents | 4350aa369149 |
children | 50d33c3987ba |
comparison
equal
deleted
inserted
replaced
356:3e84458968ec | 357:6fd8da22a5ef |
---|---|
380 } | 380 } |
381 var nextScene; | 381 var nextScene; |
382 var currentScene = 0; | 382 var currentScene = 0; |
383 var currentLayer = ''; | 383 var currentLayer = ''; |
384 | 384 |
385 | |
386 function dump(n) | |
387 { | |
388 cmd = ""; | |
389 for(k in n) { | |
390 cmd = cmd + k+"="+n[k]+"\n"; | |
391 } | |
392 alert(cmd); | |
393 } | |
394 | |
395 | |
396 function openFile() | |
397 { | |
398 alert('bug'); | |
399 $.modal('<div>My data</div>'); | |
400 alert('done'); | |
401 } | |
402 | |
403 | |
385 var last_select = null; | 404 var last_select = null; |
386 inkscape = new Inkscape("scene.mbsvg"); | 405 |
387 | 406 $('#inkscape').html('Please select the project file<br>'); |
388 | 407 $('#inkscape').append('<input type=file value="Select the project file" id="mbsvg" accept="image/png">'); |
389 tree = $.tree_create(); | 408 $('#inkscape').append('<input type=button value="Load" onclick="loadFile()">'); |
409 | |
410 | |
411 function loadFile() | |
412 { | |
413 ele = $('#mbsvg'); | |
414 file = ele.attr('value'); | |
415 inkscape = new Inkscape("file://"+file); | |
416 | |
417 var tree = $.tree_create(); | |
390 file1_animation = [ | 418 file1_animation = [ |
391 { | 419 { |
392 attributes: {id:"an1-1"}, | 420 attributes: {id:"an1-1"}, |
393 data: "animation1" | 421 data: "animation1" |
394 }, | 422 }, |
420 | 448 |
421 tree.init($("#filelist"), { | 449 tree.init($("#filelist"), { |
422 data: { | 450 data: { |
423 type: "json", | 451 type: "json", |
424 json : { | 452 json : { |
425 attributes: {id: "node0"}, state: "open", data: "Project", children: [ | 453 attributes: {id: "prj"}, state: "open", data: "Project", |
454 children: [ | |
426 { attributes:{id:"scenes"}, data:"scene", children: scenes}, | 455 { attributes:{id:"scenes"}, data:"scene", children: scenes}, |
427 { attributes:{id:"sources"},data:"sources",children: sources} | 456 { attributes:{id:"sources"},data:"sources",children: sources} |
428 ] | 457 ] |
429 } | 458 } |
430 } | 459 }, |
460 ui : { | |
461 context : [ | |
462 { | |
463 id: "Open", | |
464 label: "Open", | |
465 icon: "open.png", | |
466 visible: function(NODE,TREE_OBJ) { if(NODE.length != 1) return false; return NODE[0].id == "prj";}, | |
467 action: function(NODE,TREE_OBJ) { openFile(TREE_OBJ);} | |
468 }, | |
469 { | |
470 id: "New", | |
471 label: "New", | |
472 icon: "create.png", | |
473 visible: function(NODE,TREE_OBJ) { if(NODE.length != 1) return false; return NODE[0].id == "prj";}, | |
474 action: function(NODE,TREE_OBJ) { alert("open is not support yet");} | |
475 }, | |
476 { | |
477 id: "Rename", | |
478 label: "Rename", | |
479 icon: "rename.png", | |
480 visible: function(NODE,TREE_OBJ) { if(NODE.length != 1) return false; return NODE[0].id == "prj";}, | |
481 action: function(NODE,TREE_OBJ) { alert("open is not support yet");} | |
482 }, | |
483 ] | |
484 }, | |
485 | |
431 }); | 486 }); |
432 | 487 } |