changeset 379:a3231496c6de

merge
author Thinker K.F. Li <thinker@branda.to>
date Sat, 04 Apr 2009 11:55:11 +0800
parents 3d40e74d5a9d (current diff) 06b40e01cac4 (diff)
children 5b6230df7630
files
diffstat 14 files changed, 157 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/inkscape/firefox/MBServer.py	Sat Apr 04 11:54:37 2009 +0800
+++ b/inkscape/firefox/MBServer.py	Sat Apr 04 11:55:11 2009 +0800
@@ -472,7 +472,13 @@
 	def soap_GETDOC(self):
 		try:
 			self.target.generate()
-			return etree.tostring(self.target.document)
+			newdoc = deepcopy(self.target.document)
+			root = newdoc.getroot()
+			for id,node in self.target.selected.iteritems():
+				select = etree.Element('{http://madbutterfly.sourceforge.net/DTD/madbutterfly.dtd}select')
+				select.set('ref', id)
+				root.append(select)
+			return etree.tostring(newdoc)
 		except:
 			return traceback.format_exc()
 import os
Binary file inkscape/firefox/content/active-fill.png has changed
--- a/inkscape/firefox/content/active-fill.svg	Sat Apr 04 11:54:37 2009 +0800
+++ b/inkscape/firefox/content/active-fill.svg	Sat Apr 04 11:55:11 2009 +0800
@@ -64,18 +64,14 @@
      inkscape:groupmode="layer"
      id="layer1">
     <rect
-       style="fill:none;stroke:#000000;stroke-opacity:1"
-       id="rect2380"
-       width="30"
-       height="30"
-       x="79.802048"
-       y="67.262962" />
-    <rect
        style="fill:#00d300;fill-opacity:1;stroke:#00d300;stroke-width:1.90641569999999994;stroke-opacity:1"
        id="rect3154"
        width="28.388008"
        height="2.6291182"
        x="81.012871"
-       y="80.543571" />
+       y="80.543571"
+       inkscape:export-filename="/home/wycc/devel/test/main/MadButterfly/inkscape/firefox/content/active-fill.png"
+       inkscape:export-xdpi="86.949997"
+       inkscape:export-ydpi="86.949997" />
   </g>
 </svg>
Binary file inkscape/firefox/content/active-start.png has changed
--- a/inkscape/firefox/content/active-start.svg	Sat Apr 04 11:54:37 2009 +0800
+++ b/inkscape/firefox/content/active-start.svg	Sat Apr 04 11:55:11 2009 +0800
@@ -72,20 +72,19 @@
        sodipodi:rx="14.285714"
        sodipodi:ry="14.285714"
        d="M 128.57143,123.79076 A 14.285714,14.285714 0 1 1 99.999999,123.79076 A 14.285714,14.285714 0 1 1 128.57143,123.79076 z"
-       transform="matrix(0.7,0,0,0.7,14.342634,-4.5390011)" />
-    <rect
-       style="fill:none;stroke:#000000;stroke-opacity:1"
-       id="rect2380"
-       width="30"
-       height="30"
-       x="79.802048"
-       y="67.262962" />
+       transform="matrix(0.7,0,0,0.7,14.342634,-4.5390011)"
+       inkscape:export-filename="/home/wycc/devel/test/main/MadButterfly/inkscape/firefox/content/active-start.png"
+       inkscape:export-xdpi="86.949997"
+       inkscape:export-ydpi="86.949997" />
     <rect
        style="fill:#00d300;stroke:#00d300;stroke-opacity:1;fill-opacity:1"
        id="rect3154"
        width="5.8083773"
        height="3.5355339"
        x="104.04571"
-       y="80.090363" />
+       y="80.090363"
+       inkscape:export-filename="/home/wycc/devel/test/main/MadButterfly/inkscape/firefox/content/active-start.png"
+       inkscape:export-xdpi="86.949997"
+       inkscape:export-ydpi="86.949997" />
   </g>
 </svg>
Binary file inkscape/firefox/content/fill.png has changed
--- a/inkscape/firefox/content/fill.svg	Sat Apr 04 11:54:37 2009 +0800
+++ b/inkscape/firefox/content/fill.svg	Sat Apr 04 11:55:11 2009 +0800
@@ -64,18 +64,14 @@
      inkscape:groupmode="layer"
      id="layer1">
     <rect
-       style="fill:none;stroke:#000000;stroke-opacity:1"
-       id="rect2380"
-       width="30"
-       height="30"
-       x="79.802048"
-       y="67.262962" />
-    <rect
        style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.9064157;stroke-opacity:1"
        id="rect3154"
        width="28.388008"
        height="2.6291182"
        x="81.012871"
-       y="80.543571" />
+       y="80.543571"
+       inkscape:export-filename="/home/wycc/devel/test/main/MadButterfly/inkscape/firefox/content/fill.png"
+       inkscape:export-xdpi="86.949997"
+       inkscape:export-ydpi="86.949997" />
   </g>
 </svg>
--- a/inkscape/firefox/content/inkscape.js	Sat Apr 04 11:54:37 2009 +0800
+++ b/inkscape/firefox/content/inkscape.js	Sat Apr 04 11:55:11 2009 +0800
@@ -70,7 +70,7 @@
 function TextEditor(file) 
 {
 	var editor = document.getElementById('inkscape');
-	editor.innerHTML = "<embed src="+file+" width=700 height=700 />";
+	editor.innerHTML = "<embed src="+file+" width=900 height=700 />";
 	this.isInProgress = 0;
 }
 
@@ -81,8 +81,9 @@
 function Inkscape(file) 
 {
 	var ink = document.getElementById('inkscape');
-	ink.innerHTML = "<embed src="+file+" width=700 height=700 />";
+	ink.innerHTML = "<embed src="+file+" width=900 height=700 />";
 	this.isInProgress = 0;
+	this.callback = null;
 
 	setTimeout("inkscape.fetchDocument()",4000);
 }
@@ -122,6 +123,8 @@
 {
 	mbsvg = new MBSVGString(resp.Body[0].GETDOCResponse[0].Result[0].Text);
 	mbsvg.renderUI();
+	if (this.callback)
+		this.callback(mbsvg);
 
 	var soapBody = new SOAPObject("PUBLISH");
 	var sr = new SOAPRequest("PUBLISH", soapBody);
@@ -215,16 +218,67 @@
 	SOAPClient.SendRequest(sr, function (resp,arg) {arg.refreshDocument(resp);},this);
 }	
 
-Inkscape.prototype.fetchDocument = function()
+Inkscape.prototype.fetchDocument = function(callback)
 {	
 	var soapBody = new SOAPObject("START");
+	this.callback = callback
 	var sr = new SOAPRequest("START", soapBody);
 	SOAPClient.Proxy = "http://localhost:19192/";
 	SOAPClient.SendRequest(sr,function(resp,arg) {arg.refreshDocument(resp);},this);
 	this.isInProgress++;
 }
 
+/*
+ *  This module is used to define a symbol for the MadButterfly. This function will search for symbol which is defined in the current select object. We will list all SVG elements 
+ *  in the left side, multiple variables can be defined at one time. When any element is selected, the defined symbol will be listed in the right side. 
+ *
+ */
 
+Inkscape.prototype.MakeSymbol=function()
+{
+	function callback(mbsvg) {
+		this.loadSymbolScreen(mbsvg);
+	}
+	inkscape.fetchDocument(callback);
+}
+
+Inkscape.prototype.loadSymbolScreen=function (mbsvg) {
+	// Swap the left side to be the SVG element tree.
+	var i,l;
+
+	symboldialog.dialog('open');
+	l = mbsvg.selected_objects.length;
+	var jsonobj = []
+	for(i=0;i<l;i++) {
+		// Add symbol into the tree
+		var obj = { attributes: {id: 'sym'+i}, data : mbsvg.selected_objects[i]};
+		jsonobj.push(obj);
+	}
+  	this.symboltree = $.tree_create();
+  	this.symboltree.init($("#symbollist"), {
+	    data: {
+  		type: "json",
+		json : jsonobj
+	    },
+	    callback : {
+	        ondblclk : function(NODE,TREE_OBJ) { this.refreshSymbolPanel(TREE_OBJ); TREE_OBJ.toggle_branch.call(TREE_OBJ, NODE); TREE_OBJ.select_branch.call(TREE_OBJ, NODE);}
+	    }
+
+  	});
+	// Swap the right side to be the symbol editor screen.
+	symboldialog.show();
+}
+
+jQuery(document).ready(function() {
+		symboldialog = jQuery('#symboldialog');
+		symboldialog.dialog({width:500,
+				   modal: true,
+			           autoOpen:false,
+				   title:'Please select a file'});
+		symboldialog.hide();
+		symboldialog.append("<div id='symbollist'>");
+		symboldialog.append("<div id='symbol'>");
+		});
 
 function MBSVG(file)
 {
@@ -271,7 +325,7 @@
 		ss.layer = null;
 		scenes.push(ss);
 	}
-	if (max < 20) max = 20;
+	if (max < 20) max = 30;
 	// Collect all layers
 	var nodes = xmlDoc.getElementsByTagNameNS("http://www.w3.org/2000/svg","svg")[0].childNodes;
 	var layers = new Array();
@@ -292,9 +346,17 @@
 			layers.push(nodes[i]);
 		}
 	}
+	var select = xmlDoc.getElementsByTagNameNS("http://madbutterfly.sourceforge.net/DTD/madbutterfly.dtd","select");
+	len = select.length;
+	selectobjs = [];
+	for(i=0;i<len;i++) {
+		selectobjs.push(select[i].getAttribute('ref'));
+	}
+	self.selected_objects = selectobjs;
 	self.layers = layers;
 	self.scenes = scenes;
 	self.maxframe = max;
+	self.doc = xmlDoc;
 }
 
 MBSVGString.prototype=MBSVG.prototype;
@@ -303,7 +365,7 @@
 	var layers = this.layers;
 	var scenes = this.scenes;
 	var max = this.maxframe;
-	var cmd = "<table border=1>\n";
+	var cmd = "<table border=0>\n";
 	cmd = cmd + "<tr><td></td>";
 	for(var j=1;j<=max;j++) 
 		cmd = cmd + "<td>"+j+"</td>";
@@ -320,17 +382,17 @@
 			for(var k=0;k<scenes.length;k++) {
 				if (id != scenes[k].layer) continue;
 				if (n == scenes[k].start) {
-					cmd = cmd + "<td><img class='normal' src=start.png id='"+id_str+"' onClick='selectCell(this)' /></td>";
+					cmd = cmd + "<td><img class='normal' width='16' src=start.png id='"+id_str+"' onClick='selectCell(this)' /></td>";
 					empty = 0;
 					break;
 				} else if ((n>scenes[k].start)&&(n <= scenes[k].end)) {
-					cmd = cmd + "<td><img class='normal' src=fill.png id='"+id_str+"' onClick='selectCell(this)' /></td>";
+					cmd = cmd + "<td><img class='normal' width='16' src=fill.png id='"+id_str+"' onClick='selectCell(this)' /></td>";
 					empty = 0;
 					break;
 				}
 			}
 			if (empty) {
-				cmd = cmd + "<td><img class='normal' src=empty.png id='"+id_str+"'onClick='selectCell(this)' /></td>";
+				cmd = cmd + "<td><img class='normal' width='16' src=empty.png id='"+id_str+"'onClick='selectCell(this)' /></td>";
 			}
 
 		}
@@ -389,8 +451,16 @@
 	} else if (id == 'DeleteScene') {
 		if (inkscape.isInProgress != 0) return;
 		inkscape.deleteScene(currentScene);
+	} else if (id == 'MakeSymbol') {
+		if (inkscape.isInProgress != 0) return;
+		inkscape.MakeSymbol();
 	} else if (id == 'Save') {
 		project_save();
+	} else if (id == 'Test') {
+		if (project_compile()) {
+			project_run();
+		} else {
+		}
 	} else {
 		alert(id+' has not been implemented yet');
 	}
@@ -458,6 +528,10 @@
 	   
 }
 
+function project_compile()
+{
+}
+
 
 function project_showFile(node)
 {
@@ -807,4 +881,7 @@
 		filedialog.dialog("open");
 		});
 
-
+$('#frame').draggable();
+$('#btns').draggable({cursor:'crosshair'});
+$('#list').tabs();
+$('#display').tabs();
--- a/inkscape/firefox/content/madbuilder.html	Sat Apr 04 11:54:37 2009 +0800
+++ b/inkscape/firefox/content/madbuilder.html	Sat Apr 04 11:55:11 2009 +0800
@@ -46,13 +46,16 @@
 		        color: blue;
 		    	padding: 6px 0 4px 18px; /* push text down 1px */
 		} 
+		.filepanel {
+			height:700px
+		}
 	</style>
 </head>
 <body>
-<div id='frame' width=800 height=200>
+<div class='draggable' id='frame' width=1100 height=200>
 </div>
 
-<div id='btns'>
+<div class='buttonpanel' id='btns'>
 	<br/>
 	<a class='button' href='#'> <span id='Jump'       onClick='onButtonClick(this)'>Jump</span></a>
 	<a class='button' href='#'> <span id='InsertKey' onClick='onButtonClick(this)'>Insert</span></a>
@@ -67,9 +70,38 @@
 	<br/>
 	<br/>
 </div>
-<table>
-	<tr><td width=200 height=700 valign=top><div id='filelist' valign=top></div></td><td width=700 height=700 valign=top> <div id='inkscape'></div><div id='editor'></div></td></tr>
-</table>		
+
+<table><tr>
+<td valign='top'>	
+	<div width='200' height='700' id='list'>
+	<ul>
+		<li><a href='#filelist'>Project</a></li>
+		<li><a href='#sourcelist'>Source list</a></li>
+	</ul>
+<span class='filepanel' height='600' id='filelist' valign='top'/>
+<span class='filepanel' id='sourcelist' valign=top/>
+</div>
+</td>
+<td valign='top' width='900'>
+<div id='display'>
+	<ul>
+		<li><a href='#inkscape'>MBSVG</a></li>
+		<li><a href='#editor'>Editor</a></li>
+		<li><a href='#compiler'>Compiler</a></li>
+		<li><a href='#debugger'>Debugger</a></li>
+	</ul>
+<div>
+<div class='filepanel' id='inkscape'></div>
+<div class='filepanel' id='editor'></div>
+<div class='filepanel' id='compiler'></div>
+<div class='filepanel' id='debugger'></div>
+</div>
+</div>
+</td>
+</table>
+
+
+
 <div id='filedialog'></div>
 
 <div id='wizard'>
Binary file inkscape/firefox/content/start.png has changed
--- a/inkscape/firefox/content/start.svg	Sat Apr 04 11:54:37 2009 +0800
+++ b/inkscape/firefox/content/start.svg	Sat Apr 04 11:55:11 2009 +0800
@@ -72,20 +72,19 @@
        sodipodi:rx="14.285714"
        sodipodi:ry="14.285714"
        d="M 128.57143,123.79076 A 14.285714,14.285714 0 1 1 99.999999,123.79076 A 14.285714,14.285714 0 1 1 128.57143,123.79076 z"
-       transform="matrix(0.7,0,0,0.7,14.342634,-4.5390011)" />
-    <rect
-       style="fill:none;stroke:#000000;stroke-opacity:1"
-       id="rect2380"
-       width="30"
-       height="30"
-       x="79.802048"
-       y="67.262962" />
+       transform="matrix(0.7,0,0,0.7,14.342634,-4.5390011)"
+       inkscape:export-filename="/home/wycc/devel/test/main/MadButterfly/inkscape/firefox/content/start.png"
+       inkscape:export-xdpi="86.949997"
+       inkscape:export-ydpi="86.949997" />
     <rect
        style="fill:#000000;stroke:#000000;stroke-opacity:1;fill-opacity:1"
        id="rect3154"
        width="5.8083773"
        height="3.5355339"
        x="104.04571"
-       y="80.090363" />
+       y="80.090363"
+       inkscape:export-filename="/home/wycc/devel/test/main/MadButterfly/inkscape/firefox/content/start.png"
+       inkscape:export-xdpi="86.949997"
+       inkscape:export-ydpi="86.949997" />
   </g>
 </svg>
--- a/inkscape/firefox/template/textmenu/Makefile	Sat Apr 04 11:54:37 2009 +0800
+++ b/inkscape/firefox/template/textmenu/Makefile	Sat Apr 04 11:55:11 2009 +0800
@@ -1,4 +1,4 @@
-SRC=main.c %f.c
+SRC=main.c %n.c
 OBJ=$(SRC:.c=.o)
 CFLAGS+=`pkg-config --cflags libmbfly` `pkg-config --cflags pangocairo` 
 LDFLAGS=`pkg-config --libs libmbfly`
--- a/inkscape/firefox/template/textmenu/app.c	Sat Apr 04 11:54:37 2009 +0800
+++ b/inkscape/firefox/template/textmenu/app.c	Sat Apr 04 11:55:11 2009 +0800
@@ -2,7 +2,7 @@
 #include <mb.h>
 #include "mbapp.h"
 #include "animated_menu.h"
-#include "app.h"
+#include "%n.h"
 
 void myselect_callback(mb_animated_menu_t *m, int select)
 {
--- a/inkscape/firefox/template/textmenu/main.c	Sat Apr 04 11:54:37 2009 +0800
+++ b/inkscape/firefox/template/textmenu/main.c	Sat Apr 04 11:55:11 2009 +0800
@@ -4,7 +4,7 @@
 //#include "menu.h"
 #include "mbapp.h"
 #include "animated_menu.h"
-#include "app.h"
+#include "%n.h"
 
 
 char *menus[] = {