Changeset 36072
- Timestamp:
- 12/05/09 20:07:13 (4 years ago)
- Location:
- lang/haxe/Tonyu2
- Files:
-
- 1 added
- 1 removed
- 8 modified
-
Project.hx (modified) (2 diffs)
-
Projects/toste/Test.tonyu (modified) (2 diffs)
-
Projects/toste/haxe/Test.hx (modified) (2 diffs)
-
Projects/toste/toste.swf (modified) (previous)
-
htdocs/Project.class.js (modified) (6 diffs)
-
htdocs/index.html (modified) (1 diff)
-
htdocs/shortcut.js (added)
-
ide.n (deleted)
-
ide/HaxeC.hx (modified) (3 diffs)
-
ide/ProjectProcessor.hx (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/haxe/Tonyu2/Project.hx
r36059 r36072 65 65 public var haxeDir(getHaxeDir,null):String ; 66 66 public function getHaxeDir():String{ return home+"\\haxe";} 67 public function haxe2swf() {67 public function haxe2swf():String { 68 68 var c=new ide.HaxeC(haxeDir, name); 69 c.compile();69 return c.compile(); 70 70 /* 71 71 neko.Sys.setCwd(haxeDir); … … 81 81 neko.Sys.setCwd(home); */ 82 82 } 83 public function make() {83 public function make():String { 84 84 tonyu2haxe(); 85 haxe2swf(); 85 var res=haxe2swf(); 86 return res; 86 87 } 87 88 public function new (home:String, name:String){ -
lang/haxe/Tonyu2/Projects/toste/Test.tonyu
r36071 r36072 2 2 3 3 x=0; 4 y=200; 4 5 while (x<200) { 5 6 x=x+1; … … 8 9 update(); 9 10 } 11 while (y>0) { 12 y=y-rnd(6);y=y+2; 13 update(); 14 } -
lang/haxe/Tonyu2/Projects/toste/haxe/Test.hx
r36071 r36072 5 5 case 0: 6 6 x=0; 7 y=200; 7 8 state=1; 8 9 case 1: … … 21 22 state=1; 22 23 case 3: 24 state=5; 25 case 5: 26 if ((y>0)) { 27 state=6; 28 } else { 29 state=7; 30 } 31 case 6: 32 y=(y-rnd(6)); 33 y=(y+2); 34 state=8; 35 return; 36 case 8: 37 state=5; 38 case 7: 23 39 terminateProc(); 24 40 return; -
lang/haxe/Tonyu2/htdocs/Project.class.js
r36070 r36072 1 1 function procAjax(p) { 2 if (p==null) return function(){}; 2 3 return function (res) { 3 4 try { … … 12 13 return ["div",{style:pos(x,y)},cont]; 13 14 } 15 var curProject; 16 shortcut.add("Ctrl+W",function(){curProject.saveTonyuSource()}); 17 shortcut.add("F9",function(){curProject.makeRun()}); 14 18 //alert("P"); 19 20 function dButton(onClick,caption) { 21 var b; 22 return b=tag("button",{onclick:function () { 23 b.target.disabled=true; 24 onClick(function () {b.target.disabled=false;}); 25 }},caption); 26 } 27 15 28 Project =Class.create({ 16 29 initialize: function (name) { … … 21 34 open: function () { 22 35 var t=this; 36 curProject=t; 23 37 t.editor=tag("textarea",{rows:15 , cols:80}); 24 38 t.fileList=tag("div",{style:pos(420,10)}); 25 39 t.swfArea=tag("div",{style:pos(10,10)}); 26 $tag("body").set([["div", "プロジェクト", t.name], 40 t.modifiedIndicator=tag("span"); 41 t.compileResult=tag("textarea",{rows:5 , cols:80}); 42 document.title=t.name +" - Tonyu System"; 43 $tag("body").set([ 27 44 t.swfArea, 28 45 t.fileList, 29 46 posDiv(500,10,[ 30 47 t.editor, 31 ["button",{onclick:function(){t.saveTonyuSource()}},"SAVE"], 32 ["button",{onclick:function(){t.run()}},"Run"], 33 ["button",{onclick:function(){t.makeRun()}},"Make&Run"] 48 dButton(function(e){t.saveTonyuSource(e)},"SAVE(Ctrl+W)"), 49 dButton(function(e){t.run(e)},"Run"), 50 dButton(function(e){t.makeRun(e)},"Make&Run(F9)"), 51 t.modifiedIndicator,["br"], 52 t.compileResult 34 53 ]) 35 54 ]); 36 55 attachIndentAdaptor(t.editor.target); 56 setInterval(function (){ 57 t.updateModifiedIndicator(); 58 }, 50); 37 59 t.listTonyuSource(); 38 60 }, … … 68 90 t.editor.setAttr("value",res); 69 91 t.currentSourceName=name; 92 t.savedCont=res; 70 93 } 71 94 }, 72 saveTonyuSourceAs: function (cl,cont) { 95 updateModifiedIndicator: function () { 96 var t=this; 97 t.modifiedIndicator.set(t.editorContentModified() ? "*" : ""); 98 }, 99 editorContentModified: function () { 100 var t=this; 101 return t.savedCont!=t.editor.getAttr("value"); 102 }, 103 saveTonyuSourceAs: function (cl,cont,next) { 73 104 var t=this; 74 105 new Ajax.Request( … … 77 108 method: 'POST', 78 109 parameters: {content: cont}, 79 onComplete: procAjax( showResponse)110 onComplete: procAjax(next2) 80 111 }); 81 function showResponse(res) { 82 alert(res); 112 function next2(res) { 113 if (res=="OK") { 114 t.savedCont=cont; 115 t.updateModifiedIndicator(); 116 if (next!=null) next(); 117 } 83 118 } 84 119 }, 85 saveTonyuSource: function ( ) {120 saveTonyuSource: function (next) { 86 121 var t=this; 87 122 //alert(t.currentSourceName); 88 123 if (t.currentSourceName == null) return; 89 t.saveTonyuSourceAs( t.currentSourceName, t.editor.getAttr("value") );124 t.saveTonyuSourceAs( t.currentSourceName, t.editor.getAttr("value"),next ); 90 125 }, 91 make: function ( afterMake) {126 make: function (next) { 92 127 var t=this; 128 t.swfArea.set("Compiling..."); 93 129 new Ajax.Request( 94 130 t.homeURL+"/make" , … … 96 132 method: 'GET', 97 133 parameters: {}, 98 onComplete: procAjax( showResponse)134 onComplete: procAjax(next2) 99 135 }); 100 function showResponse(res) {101 //alert(res);102 afterMake(res);136 function next2(res) { 137 t.compileResult.setAttr("value",res); 138 if (next) next(res); 103 139 } 104 140 }, 105 makeRun: function ( ) {141 makeRun: function (next) { 106 142 var t=this; 107 t.make(function(res) { 108 t.swfArea.set(res); 109 setTimeout(function(){t.run();},10); 110 }); 143 if (t.editorContentModified()) { 144 t.saveTonyuSource(domake); 145 } else {domake();} 146 function domake() { 147 t.make(function(res) { 148 if (res.length<5) { 149 t.swfArea.set(res); 150 t.run(next); 151 } else { 152 if (next) next(); 153 } 154 //setTimeout(function(){t.run();},10); 155 }); 156 } 111 157 }, 112 run: function ( ) {158 run: function (next) { 113 159 var t=this; 114 160 t.swfArea.set(swf(t.homeURL+"/swf")); 161 if (next) next(); 115 162 } 116 163 }); -
lang/haxe/Tonyu2/htdocs/index.html
r36070 r36072 5 5 <body id="body" onload="boot()">Please wait...</body> 6 6 <script src="htdocs/prototype.js"></script> 7 <script src="htdocs/shortcut.js"></script> 7 8 <script src="htdocs/indent.js"></script> 8 9 <script src="htdocs/TagBuilder.class.js"></script> -
lang/haxe/Tonyu2/ide/HaxeC.hx
r36059 r36072 8 8 this.swfName=swfName; 9 9 } 10 public function compile() {10 public function compile():String { 11 11 var home=neko.Sys.getCwd(); 12 12 neko.Sys.setCwd(dir); … … 27 27 trace(haxePath+" "+args); 28 28 var p=new neko.io.Process(haxePath,args); 29 var stderr=""; 29 30 while (true) { 30 31 try { 31 32 var s=p.stderr.readLine(); 33 stderr+=s; 32 34 trace(s); 33 35 } catch (e:haxe.io.Eof) {break;} … … 35 37 p.close(); 36 38 trace("setCWD "+home); 37 neko.Sys.setCwd(home); 39 neko.Sys.setCwd(home); 40 return stderr; 38 41 } 39 42 static public function init() { -
lang/haxe/Tonyu2/ide/ProjectProcessor.hx
r36049 r36072 40 40 } 41 41 function make() { 42 project.make();43 res.content= "Build end";42 var makeR=project.make(); 43 res.content=makeR; //"Build end"; 44 44 } 45 45 function tonyuSrc() {
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)