# HG changeset patch # User wycc # Date 1237016151 -28800 # Node ID a373b4743e63af465f43ba9105cb19ab1de203e4 # Parent 04609111485d05d9b300eabee99b5a3d2d5c3ae5 Add file dialog to add a new scene file into the project. diff -r 04609111485d -r a373b4743e63 inkscape/firefox/content/inkscape.js --- a/inkscape/firefox/content/inkscape.js Wed Mar 11 09:12:21 2009 +0800 +++ b/inkscape/firefox/content/inkscape.js Sat Mar 14 15:35:51 2009 +0800 @@ -544,8 +544,8 @@ id: "Open", label: "Open", icon: "open.png", - visible: function(NODE,TREE_OBJ) { if(NODE.length != 1) return false; return NODE[0].id == "prj";}, - action: function(NODE,TREE_OBJ) { openFile(TREE_OBJ);} + visible: function(NODE,TREE_OBJ) { if(NODE.length != 1) return false; return true;}, + action: function(NODE,TREE_OBJ) { onTree_openFile(NODE,TREE_OBJ);} }, { id: "New", @@ -567,6 +567,50 @@ }); } +function fileDialog_cb() +{ + var file = $('#filedialogsrc').attr('value'); + filedialog.dialog('close'); + filedialog_cb(file,filedialog_arg); +} + +function openFileDialog(callback,arg) +{ + filedialog_cb = callback; + filedialog_arg = arg; + filedialog.html('Please select the scene file
'); + filedialog.append(''); + filedialog.append(''); + filedialog.show(); + filedialog.dialog('open'); +} + + +function project_addScene(file,treeobj) +{ + if (file == '') { + return; + } + treeobj.create(false,treeobj.selected,file); +} + +function onTree_addSceneFile(node,treeobj) +{ + //treeobj.create(false,treeobj.selected,"xxx",null,"newscene"); + openFileDialog(project_addScene,treeobj); +} + + +function onTree_openFile(node,treeobj) +{ + if (node[0].id == "scenes") { + onTree_addSceneFile(node,treeobj); + } else if (node[0].id == "sources") { + onTree_addSourceFile(node,treeobj); + } +} + + function system_read(fname) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); @@ -599,10 +643,23 @@ prjname = $('#mbsvg').attr('value'); var prj = system_read(prjname); project_parse(prj); + filedialog.dialog('close'); } var last_select = null; -$('#inkscape').html('Please select the project file
'); -$('#inkscape').append(''); -$('#inkscape').append(''); +$('#filedialog').dialog({ width:500}); +jQuery(document).ready(function() { + filedialog = jQuery('#filedialog'); + filedialog.dialog({width:500, + modal: true, + autopen:false, + title:'Please select a file'}); + filedialog.show(); + filedialog.html('Please select the project file
'); + filedialog.append(''); + filedialog.append(''); + filedialog.dialog("open"); + }); + + diff -r 04609111485d -r a373b4743e63 inkscape/firefox/content/madbuilder.html --- a/inkscape/firefox/content/madbuilder.html Wed Mar 11 09:12:21 2009 +0800 +++ b/inkscape/firefox/content/madbuilder.html Sat Mar 14 15:35:51 2009 +0800 @@ -1,12 +1,13 @@ + - + @@ -67,6 +68,7 @@
+