From: Raymond I. <xw...@us...> - 2003-03-26 02:22:34
|
Update of /cvsroot/dynapi/dynapi3x/src/ext In directory sc8-pr-cvs1:/tmp/cvs-serv6593/src/ext Modified Files: debug.js Added Files: blueprint.html Log Message: updated/added by raymond --- NEW FILE --- <html> <head> <title>Blueprint Output</title> </head> <body> <form method="POST" action="--WEBBOT-SELF--" name="frm"> <div align="center"> <center> <table border="0"> <tr> <td align="center"><font color="#000080" size="5"><b>DynAPI Blueprint</b></font></td> </tr> <tr> <td align="center"><textarea rows="14" name="txtout" cols="54" wrap="off">Loading... Pleas wait</textarea></td> </tr> <tr> <td align="center"><input type="button" value="Close window" name="cmdclose" onclick="window.close()"></td> </tr> </table> </center> </div> </form> </body> </html> Index: debug.js =================================================================== RCS file: /cvsroot/dynapi/dynapi3x/src/ext/debug.js,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** debug.js 25 Feb 2003 21:38:09 -0000 1.2 --- debug.js 26 Mar 2003 02:22:31 -0000 1.3 *************** *** 1 **** ! /* DynAPI Distribution Debugger The DynAPI Distribution is distributed under the terms of the GNU LGPL license. */ function Debugger(useIDE) { this.DynObject = DynObject; this.DynObject(); this._useIDE = useIDE; this._mode='normal'; this.win = null; this._watch={}; this._evalBuffer=''; this._buffer = dynapi._debugBuffer; dynapi._debugBuffer = ''; // close the debug window on unload this.closeOnUnLoad = false; dynapi.onUnload(function() { if (dynapi.debug.closeOnUnLoad) dynapi.debug.close(); }); this.open(); } var p = dynapi.setPrototype('Debugger','DynObject'); p.close = function() { if (this.isLoaded()) { this.win.close(); this.win = null; } }; // error - output a browser generated error to the debug window p.error = function(msg, url, lno) { if (url && url.indexOf(dynapi.documentPath)==0) { url = url.substring(dynapi.documentPath.length); } this.print('Error:'+ (lno? ' Line '+lno : '') +' ['+url+']\n '+msg); }; // evaluates an expression in the scope of the main dynapi window p.evaluate = function(str) { dynapi.frame.eval(str); this.setEvalHistory(str); }; // get evaluation history p.getEvalHistory=function(n){ if(!this.isLoaded()) return; var t,f=this.win.document.debugform; if(n>=1) { var lim=this.win.evalHistory.length-1; this.win.evalIndex++; if (this.win.evalIndex>lim) this.win.evalIndex=(lim<0)?0:lim; t=this.win.evalHistory[this.win.evalIndex]; if(t)f.eval.value=t; }else if(n<=0){ this.win.evalIndex--; if(this.win.evalIndex<0) this.win.evalIndex=0; t=this.win.evalHistory[this.win.evalIndex]; if(t)f.eval.value=t; } }; // lists all known properties of an object p.inspect = function(obj,showFunctions) { this.print('Inspecting:'); var v; if (typeof(obj)=='string') obj=eval(obj); if (typeof(obj)=='object') { for (var i in obj) { if (obj[i]==null) v = 'null' else if (typeof(obj[i])=='undefined') v = 'null'; else if (typeof(obj[i])=='function') { if (showFunctions==false) continue; else v = '[Function]'; } else if (typeof(obj[i])=='object' && typeof(obj[i].length)!='undefined') v = 'Array';// ['+obj[i]+']'; else if (typeof(obj[i])=='object') v = '[Object]'; else v = obj[i]; this.print(' '+i+' = '+v); } } else this.print(' undefined'); }; p.isLoaded = function() { return (this.win!=null && this.win.document && typeof(this.win.document.debugform)=="object"); }; // opens the debugger window p.open = function() { var p = dynapi.library.path; if (!this.isLoaded() && p) { var url = dynapi.documentPath+p+'ext/debug.html#'; var w = (dynapi.ua.def||dynapi.ua.dom)? 350:355 //dynapi.ua.mac? (dynapi.ua.ie?330:300) : 350; var h = (dynapi.ua.def||dynapi.ua.dom)? 432:485 //dynapi.ua.mac? (dynapi.ua.ie?405:365) : (dynapi.ua.def||dynapi.ua.dom)? 420:476; if(!this._useIDE){ this.win = window.open(url,'debugwin','width='+w+',height='+h+',scrollbars=no,status=no,toolbar=no'); //,resizable=no this.win.opener=window; }else{ this.win = new DynLayer(this._getDebugTemplate(),0,0,w,null,'#0033CC'); dynapi.document.addChild(this.win); this.win.setAnchor({right:2,top:2}); this.win.onCreate(function(){ if(!this.document) this.document=this.doc; this.css.zIndex=10100; this.css.borderWidth="2px"; this.css.borderColor="navy"; this.css.borderStyle="solid"; this.css.overflow='hidden'; if(dynapi.ua.opera) this.setHeight(this.h+5); else this.setHeight(this.h-10); window.setTimeout('dynapi.debug.print()',100); // opera7 needs timeout }); this.win.addEventListener({ onmousedown : function(e) { // setup window dragging if(e.y<=32) { if(self.DragEvent) DragEvent.startDrag(e); } }, ondblclick: function(e) { var o=e.getSource(); if(e.y<=32) { if(o.h<=35) o.setHeight(o._lHeight); else { o._lHeight=o.h; o.setHeight(35); } } } }); // setup window dragging if(self.DragEvent) { dynapi.document.addEventListener(DragEvent.docListener); dynapi.document.captureMouseEvents(); } } this.win.evalHistory=[]; this.win.evalIndex=0; this.print(); /* dynapi.frame.onerror = function(msg, url, lno) { dynapi.debug.error(msg, url, lno); }; */ } }; // output text to the debug window p.print = function(s) { if (s==null) s = ''; else s = s + '\n'; if (this.isLoaded()) { this.switchMode('normal'); if (this._buffer != '') { // dump buffer s = this._buffer + s; this._buffer = ''; } this.win.document.debugform.print.value += s; this._normalModeData = this.win.document.debugform.print.value; // Does mozilla has something like this? if (dynapi.ua.ie) { var po = this.win.document.debugform.print; po.scrollTop = po.scrollHeight; var range = po.createTextRange(); range.collapse(false); range.select(); } } else this._buffer += s; }; // reloads selected javascripts, packages or html pages p.reload=function(t){ if (!this.isLoaded) return; t=t+''; if(t.substr(0,3).toLowerCase()=='go:') { t=t.substr(3).replace(/\\/g,'/'); dynapi.frame.location.href=t; return; } var i,f=t.split(';'); for(i=0;i<f.length;i++){ t=f[i]; if(t.indexOf('.js')<0) dynapi.library.load(t,null,true); else { var lib=dynapi.library; if (!lib.scripts[t]) lib.loadScript(t); else lib.reloadScript(t,null,true); } } this.win.focus(); }; p.reset=function(section){ if (!this.isLoaded) return; this._oldWatchSrc=''; if(!section) { this.win.document.debugform.reset(); this._normalModeData=''; this.switchMode('normal'); }else{ var t=this.win.document.debugform[section]; if(t) t.value=''; } }; p.status = function(str) { if (this.isLoaded()) { for (var i=1;i<arguments.length;i++) { str += ', '+arguments[i]; } this.win.document.debugform.stat.value = str; }; }; // Set Mode p.switchMode=function(m){ if (!this.isLoaded) return; if(m=='watch'||(this._mode=='normal' && m!='normal')) { this._normalModeData = this.win.document.debugform.print.value; this._mode='watch'; this._enableWatch(); }else if(m=='normal'||(this._mode=='watch' && m!='watch')){ this.win.document.debugform.print.value=(this._normalModeData)?this._normalModeData:''; this._mode='normal'; this._disableWatch(); } }; // enters text to the evaluate field in the debugger widnow p.setEvaluate = function(str) { if (!this.isLoaded()) this._evalBuffer=str; else { if (!str) str = ''; if(this._evalBuffer!='') { str =this._evalBuffer+str; this._evalBuffer=''; } this.win.document.debugform.eval.value = str; this.setEvalHistory(str); } }; // Set previous evaluation information p.setEvalHistory=function(s){ if(!this.isLoaded()) return; var i,found; if(s){ for(i=0;i<this.win.evalHistory.length;i++){ if(this.win.evalHistory[i]==s) {found=i;break;} } if(found!=null) this.win.evalHistory=dynapi.functions.removeFromArray(this.win.evalHistory,found); this.win.evalHistory[this.win.evalHistory.length]=s; this.win.evalIndex=this.win.evalHistory.length-1; } }; p.setIntegrated = function(b){ dynapi.debug._useIDE=b; // use Integrated debugging enviorn }; p.showHelp=function(){ var t='' +'-----------------------\n' +'Quick Help\n' +'-----------------------\n' +'1) To inspect an Object enter the name\n' +'of the object in the "Inspect Variable/Object"\n' +'textbox and then click on the "Inspect" button\n\n' +'2) To Load/Reload a DynAPI Package,\n' +'javascript or html page enter the name\n' +'of the package or javascript in the reload\n' +'text. For HTML pages type the prefix Go:\n' +'before the page name.\n' +'------------------------------------------------'; this.print(t); }; // watch object variables; p.watch = function(name,value){ if(arguments.length>1) this._watch[name]=value; else if(dynapi.frame.eval(name)) this._watch[name]='_watch object_'; else this._watch[name]='_watch object_'; }; p._disableWatch = function(){ this._oldWatchSrc=''; if(this._timerWatch) { window.clearTimeout(this._timerWatch); this._timerWatch=0; } }; p._enableWatch = function(){ if(this._mode!='watch') return; var src,row,v; src=' Name\t \t \t Value\n---------------------------------------\n'; for(i in this._watch){ if(this._watch[i]=='_watch object_') v=dynapi.frame.eval(i); else v=this._watch[i]; if(v==null) v='null'; if(typeof(v)=='string') v=v.replace(/\n/g,' '); src+=(i+' ').substr(0,22)+'\t '+v+'\n'; } if(src!=this._oldWatchSrc){ this.win.document.debugform.print.value=this._oldWatchSrc=src; } if(this._timerWatch) window.clearTimeout(this._timerWatch); this._timerWatch=window.setTimeout(this+'._enableWatch()',200); }; p._getDebugTemplate = function(styleOnly){ var ua = dynapi.ua; var f=dynapi.functions; var url = dynapi.documentPath+dynapi.library.path+'ext/'; var imgwatch=f.getImage(url+'images/debug_imgwatch.gif',25,22,{alias:"DebugIMGWatch",name:"DebugIMGWatch",downsrc:url+"images/debug_imgwatch_down.gif",oversrc:url+"images/debug_imgwatch_on.gif",onclick:"dynapi.functions.False(dynapi.debug.switchMode('watch'))",tooltip:"Show Watch Mode"}).getHTML(); var imgnormal=f.getImage(url+'images/debug_imgnormal.gif',25,22,{alias:"DebugIMGNormal",name:"DebugIMGNormal",downsrc:url+"images/debug_imgnormal_down.gif",oversrc:url+"images/debug_imgnormal_on.gif",onclick:"dynapi.functions.False(dynapi.debug.switchMode('normal'))",tooltip:"Show Normal Mode"}).getHTML(); var imginspect=f.getImage(url+'images/debug_imginspect.gif',80,22,{alias:"DebugIMGInspect",name:"DebugIMGInspect",oversrc:url+"images/debug_imginspect_on.gif",onclick:"dynapi.functions.False(dynapi.debug.inspect(dynapi.debug.win.document.debugform.inspect.value))",tooltip:"Inspect Variable/Object",hspace:1}).getHTML(); var imgreload=f.getImage(url+'images/debug_imgreload.gif',25,22,{alias:"DebugIMGReload",name:"DebugIMGReload",oversrc:url+"images/debug_imgreload_on.gif",onclick:"dynapi.functions.False(dynapi.debug.reload(dynapi.debug.win.document.debugform.reload.value))",tooltip:"Load/Reload DynAPI Packages, HTML Pages and JavaScript (.js) files",hspace:1}).getHTML(); var imgclear=f.getImage(url+'images/debug_imgclear.gif',46,22,{alias:"DebugIMGClear",name:"DebugIMGClear",oversrc:url+"images/debug_imgclear_on.gif",onclick:"dynapi.functions.False(dynapi.debug.reset());",tooltip:"Clear debug window",hspace:1}).getHTML(); var imgeval=f.getImage(url+'images/debug_imgeval.gif',100,22,{alias:"DebugIMGEval",name:"DebugIMGEval",oversrc:url+"images/debug_imgeval_on.gif",onclick:"dynapi.functions.False(dynapi.debug.evaluate(dynapi.debug.win.document.debugform.eval.value));",tooltip:"Evalute JavaScript",hspace:2}).getHTML(); var imgnext=f.getImage(url+'images/debug_imgnext.gif',25,22,{alias:"DebugIMGNext",name:"DebugIMGNext",oversrc:url+"images/debug_imgnext_on.gif",onclick:"dynapi.functions.False(dynapi.debug.getEvalHistory(1))",tooltip:"Forward",hspace:1}).getHTML(); var imgprev=f.getImage(url+'images/debug_imgprev.gif',25,22,{alias:"DebugIMGPrev",name:"DebugIMGPrev",oversrc:url+"images/debug_imgprev_on.gif",onclick:"dynapi.functions.False(dynapi.debug.getEvalHistory(-1))",tooltip:"Backward",hspace:1}).getHTML(); var imghelp=f.getImage(url+'images/debug_imghelp.gif',25,22,{alias:"DebugIMGHelp",name:"DebugIMGHelp",downsrc:url+"images/debug_imghelp_down.gif",oversrc:url+"images/debug_imghelp_on.gif",onclick:"dynapi.functions.False(dynapi.debug.showHelp())",tooltip:"Quick Help",hspace:1}).getHTML(); var str = ua.ie?"Internet Explorer":(ua.ns?"Netscape":(ua.moz?"Mozilla":ua.b)); var status = 'DynAPI '+dynapi.version+' ['+str+' '+dynapi.ua.v+']'; var h=[''],s=0; if(!dynapi.ua.ns4 && !dynapi.debug._useIDE) { h[s++]='<style type="text/css">\n'; h[s++]='.debugtextbox {\n'; h[s++]=' border-width:1;\n'; h[s++]=' border-style:solid;\n'; h[s++]=' border-color:#3399CC;\n'; h[s++]=' font-family: Courier,Monaco\n'; h[s++]=' font-size: 11px;\n'; h[s++]='}\n'; h[s++]='.textinspect{width:90px;}\n'; h[s++]='.textreload{width:130px;}\n'; h[s++]='.textprint{width:340px; height:220px;}\n'; h[s++]='.textstat{width:340px; background-color:#EFEBDE; }\n'; h[s++]='.texteval{width:340px;height:92px;}\n'; h[s++]='.cboprev{width:340px;}\n'; h[s++]='</style>\n'; } if(styleOnly) return h.join(''); h[s++]='<form name="debugform"><div align="center"><center><font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">\n'; h[s++]='<table border="0" bgcolor="#EFEBDE" cellspacing="0">\n'; h[s++]='<tr><td colspan="2" bgcolor="#0033CC"><table border="0" width="100%" cellspacing="0" cellpadding="0">\n'; h[s++]='<tr><td width="50%" nowrap><b><font size="2" color="#FFFFFF" face="Arial"><span style="cursor:default"><img border="0" src="'+url+'images/debug_icon.gif" align="absmiddle" width="32" height="32"> DynAPI Debugger '+(dynapi.debug._useIDE? '(IDE)':'')+'</span></font></b></td>\n'; h[s++]='<td width="50%" bgcolor="#0033CC"><table border="0" width="100%"><tr><td width="100%" align="right">\n'; h[s++]='<font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+imgwatch+' '+imgnormal+' '+imghelp+'</font></td></tr>\n'; h[s++]='</table></td></tr></table></td></tr>\n'; h[s++]='<tr><td colspan="2"><table border="0" cellspacing="0"><tr><td valign="middle">\n'; h[s++]='<input type="text" name="inspect" size="10" class="debugtextbox textinspect"></td><td>'+imginspect+'</td><td>\n'; h[s++]='<input type="text" name="reload" size="15" class="debugtextbox textreload"></td><td>'+imgreload+'</td></tr></table></td></tr><tr><td align="center" colspan="2">\n'; h[s++]='<textarea name="print" rows="11" cols="40" class="debugtextbox textprint" wrap="off"></textarea></td></tr>\n'; h[s++]='<tr><td nowrap><table border="0" cellspacing="0"><tr><td>\n'; h[s++]='<font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+imgclear+'</font></td><td>\n'; h[s++]='<font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+imgeval+'</font></td><td align="right">\n'; h[s++]='<font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+imgprev+'</font></td><td align="right">\n'; h[s++]='<font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+imgnext+'</font></td></tr></table>\n'; h[s++]='</td><td nowrap align="center"><font size="2" face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" color="#000000">JavaScript </font>\n'; h[s++]='</td></tr><tr><td align="center" colspan="2">\n'; h[s++]='<textarea name="eval" rows="7" cols="40" class="debugtextbox texteval" wrap="off"></textarea></td></tr>\n'; h[s++]='<tr><td align="center" colspan="2">\n'; h[s++]='<input type="text" name="stat" size="42" '+(dynapi.ua.mac? 'style="font-family:Monaco"':'')+' value="'+status+'" class="debugtextbox textstat"></td>\n'; h[s++]='</tr></table></font></center></div></form>\n'; return h.join(''); }; dynapi.debug = new Debugger(dynapi.debug._useIDE); if(!dynapi.loaded && !dynapi.ua.ns4) { document.write(dynapi.debug._getDebugTemplate(true)); } var t='------------------------------\n' +'Click "?" for help\n' +'------------------------------\n'; dynapi.debug.print(t); \ No newline at end of file --- 1 ---- ! /* DynAPI Distribution Debugger The DynAPI Distribution is distributed under the terms of the GNU LGPL license. */ // Note: Debugger does not have to be a DynObject - very important for blueprinted layers function Debugger(useIDE) { //this.DynObject = DynObject; //this.DynObject(); this._useIDE = useIDE; this._mode='normal'; this.win = null; this._watch={}; this._evalBuffer=''; this._buffer = dynapi._debugBuffer; dynapi._debugBuffer = ''; // close the debug window on unload this.closeOnUnLoad = false; dynapi.onUnload(function() { if (dynapi.debug.closeOnUnLoad) dynapi.debug.close(); }); this.open(); } var p = Debugger.prototype; //dynapi.setPrototype('Debugger','DynObject'); p.close = function() { if (this.isLoaded()) { this.win.close(); this.win = null; } }; // error - output a browser generated error to the debug window p.error = function(msg, url, lno) { if (url && url.indexOf(dynapi.documentPath)==0) { url = url.substring(dynapi.documentPath.length); } this.print('Error:'+ (lno? ' Line '+lno : '') +' ['+url+']\n '+msg); }; // evaluates an expression in the scope of the main dynapi window p.evaluate = function(str) { dynapi.frame.eval(str); this.setEvalHistory(str); }; // get evaluation history p.getEvalHistory=function(n){ if(!this.isLoaded()) return; var t,f=this.win.document.debugform; if(n>=1) { var lim=this.win.evalHistory.length-1; this.win.evalIndex++; if (this.win.evalIndex>lim) this.win.evalIndex=(lim<0)?0:lim; t=this.win.evalHistory[this.win.evalIndex]; if(t)f.eval.value=t; }else if(n<=0){ this.win.evalIndex--; if(this.win.evalIndex<0) this.win.evalIndex=0; t=this.win.evalHistory[this.win.evalIndex]; if(t)f.eval.value=t; } }; // lists all known properties of an object p.inspect = function(obj,showFunctions) { this.print('Inspecting:'); var v; if (typeof(obj)=='string') obj=eval(obj); if (typeof(obj)=='object') { for (var i in obj) { if (obj[i]==null) v = 'null' else if (typeof(obj[i])=='undefined') v = 'null'; else if (typeof(obj[i])=='function') { if (showFunctions==false) continue; else v = '[Function]'; } else if (typeof(obj[i])=='object' && typeof(obj[i].length)!='undefined') v = 'Array';// ['+obj[i]+']'; else if (typeof(obj[i])=='object') v = '[Object]'; else v = obj[i]; this.print(' '+i+' = '+v); } } else this.print(' undefined'); }; p.isLoaded = function() { return (this.win!=null && this.win.document && typeof(this.win.document.debugform)=="object"); }; // opens the debugger window p.open = function() { var p = dynapi.library.path; if (!this.isLoaded() && p) { var url = dynapi.documentPath+p+'ext/debug.html#'; var w = (dynapi.ua.def||dynapi.ua.dom)? 350:355 //dynapi.ua.mac? (dynapi.ua.ie?330:300) : 350; var h = (dynapi.ua.def||dynapi.ua.dom)? 432:485 //dynapi.ua.mac? (dynapi.ua.ie?405:365) : (dynapi.ua.def||dynapi.ua.dom)? 420:476; if(!this._useIDE){ this.win = window.open(url,'debugwin','width='+w+',height='+h+',scrollbars=no,status=no,toolbar=no'); //,resizable=no this.win.opener=window; }else{ this.win = new DynLayer(this._getDebugTemplate(),0,0,w,null,'#0033CC'); dynapi.document.addChild(this.win); this.win.setAnchor({right:2,top:2}); this.win.onCreate(function(){ if(!this.document) this.document=this.doc; this.css.zIndex=10100; this.css.borderWidth="2px"; this.css.borderColor="navy"; this.css.borderStyle="solid"; this.css.overflow='hidden'; if(dynapi.ua.opera) this.setHeight(this.h+5); else this.setHeight(this.h-10); window.setTimeout('dynapi.debug.print()',100); // opera7 needs timeout }); this.win.addEventListener({ onmousedown : function(e) { // setup window dragging if(e.y<=32) { if(self.DragEvent) DragEvent.startDrag(e); } }, ondblclick: function(e) { var o=e.getSource(); if(e.y<=32) { if(o.h<=35) o.setHeight(o._lHeight); else { o._lHeight=o.h; o.setHeight(35); } } } }); // setup window dragging if(self.DragEvent) { dynapi.document.addEventListener(DragEvent.docListener); dynapi.document.captureMouseEvents(); } } this.win.evalHistory=[]; this.win.evalIndex=0; this.print(); /* dynapi.frame.onerror = function(msg, url, lno) { dynapi.debug.error(msg, url, lno); }; */ } }; // output text to the debug window p.print = function(s) { if (s==null) s = ''; else s = s + '\n'; if (this.isLoaded()) { this.switchMode('normal'); if (this._buffer != '') { // dump buffer s = this._buffer + s; this._buffer = ''; } this.win.document.debugform.print.value += s; this._normalModeData = this.win.document.debugform.print.value; // Does mozilla has something like this? if (dynapi.ua.ie) { var po = this.win.document.debugform.print; po.scrollTop = po.scrollHeight; var range = po.createTextRange(); range.collapse(false); range.select(); } } else this._buffer += s; }; // reloads selected javascripts, packages or html pages p.reload=function(t){ if (!this.isLoaded) return; t=t+''; if(t.substr(0,3).toLowerCase()=='go:') { t=t.substr(3).replace(/\\/g,'/'); dynapi.frame.location.href=t; return; } var i,f=t.split(';'); for(i=0;i<f.length;i++){ t=f[i]; if(t.indexOf('.js')<0) dynapi.library.load(t,null,true); else { var lib=dynapi.library; if (!lib.scripts[t]) lib.loadScript(t); else lib.reloadScript(t,null,true); } } if(this.win.focus) this.win.focus(); else this.win.setZIndex({topmost:true}); }; p.reset=function(section){ if (!this.isLoaded) return; this._oldWatchSrc=''; if(!section) { this.win.document.debugform.reset(); this._normalModeData=''; this.switchMode('normal'); }else{ var t=this.win.document.debugform[section]; if(t) t.value=''; } }; p.status = function(str) { if (this.isLoaded()) { for (var i=1;i<arguments.length;i++) { str += ', '+arguments[i]; } this.win.document.debugform.stat.value = str; }; }; // Set Mode p.switchMode=function(m){ if (!this.isLoaded) return; if(m=='watch'||(this._mode=='normal' && m!='normal')) { this._normalModeData = this.win.document.debugform.print.value; this._mode='watch'; this._enableWatch(); }else if(m=='normal'||(this._mode=='watch' && m!='watch')){ this.win.document.debugform.print.value=(this._normalModeData)?this._normalModeData:''; this._mode='normal'; this._disableWatch(); } }; // enters text to the evaluate field in the debugger widnow p.setEvaluate = function(str) { if (!this.isLoaded()) this._evalBuffer=str; else { if (!str) str = ''; if(this._evalBuffer!='') { str =this._evalBuffer+str; this._evalBuffer=''; } this.win.document.debugform.eval.value = str; this.setEvalHistory(str); } }; // Set previous evaluation information p.setEvalHistory=function(s){ if(!this.isLoaded()) return; var i,found; if(s){ for(i=0;i<this.win.evalHistory.length;i++){ if(this.win.evalHistory[i]==s) {found=i;break;} } if(found!=null) this.win.evalHistory=dynapi.functions.removeFromArray(this.win.evalHistory,found); this.win.evalHistory[this.win.evalHistory.length]=s; this.win.evalIndex=this.win.evalHistory.length-1; } }; p.setIntegrated = function(b){ dynapi.debug._useIDE=b; // use Integrated debugging enviorn }; p.showHelp=function(){ var t='' +'-----------------------\n' +'Quick Help\n' +'-----------------------\n' +'1) To inspect an Object enter the name\n' +'of the object in the "Inspect Variable/Object"\n' +'textbox and then click on the "Inspect" button\n\n' +'2) To Load/Reload a DynAPI Package,\n' +'javascript or html page enter the name\n' +'of the package or javascript in the reload\n' +'text. For HTML pages type the prefix Go:\n' +'before the page name.\n' +'------------------------------------------------'; this.print(t); }; // watch object variables; p.watch = function(name,value){ if(arguments.length>1) this._watch[name]=value; else if(dynapi.frame.eval(name)) this._watch[name]='_watch object_'; else this._watch[name]='_watch object_'; }; p._disableWatch = function(){ this._oldWatchSrc=''; if(this._timerWatch) { window.clearTimeout(this._timerWatch); this._timerWatch=0; } }; p._enableWatch = function(){ if(this._mode!='watch') return; var src,row,v; src='Name\t \t \t Value\n---------------------------------------\n'; for(i in this._watch){ if(this._watch[i]=='_watch object_') v=dynapi.frame.eval(i); else v=this._watch[i]; if(v==null) v='null'; if(typeof(v)=='string') v=v.replace(/\n/g,' '); src+=(i+' ').substr(0,22)+'\t '+v+'\n'; } if(src!=this._oldWatchSrc){ this.win.document.debugform.print.value=this._oldWatchSrc=src; } if(this._timerWatch) window.clearTimeout(this._timerWatch); this._timerWatch=window.setTimeout(this+'._enableWatch()',200); }; p._getDebugTemplate = function(styleOnly){ var ua = dynapi.ua; var f=dynapi.functions; var url = dynapi.documentPath+dynapi.library.path+'ext/'; var imgwatch=f.getImage(url+'images/debug_imgwatch.gif',25,22,{alias:"DebugIMGWatch",name:"DebugIMGWatch",downsrc:url+"images/debug_imgwatch_down.gif",oversrc:url+"images/debug_imgwatch_on.gif",onclick:"dynapi.functions.False(dynapi.debug.switchMode('watch'))",tooltip:"Show Watch Mode"}).getHTML(); var imgnormal=f.getImage(url+'images/debug_imgnormal.gif',25,22,{alias:"DebugIMGNormal",name:"DebugIMGNormal",downsrc:url+"images/debug_imgnormal_down.gif",oversrc:url+"images/debug_imgnormal_on.gif",onclick:"dynapi.functions.False(dynapi.debug.switchMode('normal'))",tooltip:"Show Normal Mode"}).getHTML(); var imginspect=f.getImage(url+'images/debug_imginspect.gif',80,22,{alias:"DebugIMGInspect",name:"DebugIMGInspect",oversrc:url+"images/debug_imginspect_on.gif",onclick:"dynapi.functions.False(dynapi.debug.inspect(dynapi.debug.win.document.debugform.inspect.value))",tooltip:"Inspect Variable/Object",hspace:1}).getHTML(); var imgreload=f.getImage(url+'images/debug_imgreload.gif',25,22,{alias:"DebugIMGReload",name:"DebugIMGReload",oversrc:url+"images/debug_imgreload_on.gif",onclick:"dynapi.functions.False(dynapi.debug.reload(dynapi.debug.win.document.debugform.reload.value))",tooltip:"Load/Reload DynAPI Packages, HTML Pages and JavaScript (.js) files",hspace:1}).getHTML(); var imgclear=f.getImage(url+'images/debug_imgclear.gif',46,22,{alias:"DebugIMGClear",name:"DebugIMGClear",oversrc:url+"images/debug_imgclear_on.gif",onclick:"dynapi.functions.False(dynapi.debug.reset());",tooltip:"Clear debug window",hspace:1}).getHTML(); var imgeval=f.getImage(url+'images/debug_imgeval.gif',100,22,{alias:"DebugIMGEval",name:"DebugIMGEval",oversrc:url+"images/debug_imgeval_on.gif",onclick:"dynapi.functions.False(dynapi.debug.evaluate(dynapi.debug.win.document.debugform.eval.value));",tooltip:"Evalute JavaScript",hspace:2}).getHTML(); var imgnext=f.getImage(url+'images/debug_imgnext.gif',25,22,{alias:"DebugIMGNext",name:"DebugIMGNext",oversrc:url+"images/debug_imgnext_on.gif",onclick:"dynapi.functions.False(dynapi.debug.getEvalHistory(1))",tooltip:"Forward",hspace:1}).getHTML(); var imgprev=f.getImage(url+'images/debug_imgprev.gif',25,22,{alias:"DebugIMGPrev",name:"DebugIMGPrev",oversrc:url+"images/debug_imgprev_on.gif",onclick:"dynapi.functions.False(dynapi.debug.getEvalHistory(-1))",tooltip:"Backward",hspace:1}).getHTML(); var imghelp=f.getImage(url+'images/debug_imghelp.gif',25,22,{alias:"DebugIMGHelp",name:"DebugIMGHelp",downsrc:url+"images/debug_imghelp_down.gif",oversrc:url+"images/debug_imghelp_on.gif",onclick:"dynapi.functions.False(dynapi.debug.showHelp())",tooltip:"Quick Help",hspace:1}).getHTML(); var str = ua.ie?"Internet Explorer":(ua.ns?"Netscape":(ua.moz?"Mozilla":ua.b)); var status = 'DynAPI '+dynapi.version+' ['+str+' '+dynapi.ua.v+']'; var h=[''],s=0; if(!dynapi.ua.ns4 && !dynapi.debug._useIDE) { h[s++]='<style type="text/css">\n'; h[s++]='.debugtextbox {\n'; h[s++]=' border-width:1;\n'; h[s++]=' border-style:solid;\n'; h[s++]=' border-color:#3399CC;\n'; h[s++]=' font-family: Courier,Monaco\n'; h[s++]=' font-size: 11px;\n'; h[s++]='}\n'; h[s++]='.textinspect{width:90px;}\n'; h[s++]='.textreload{width:130px;}\n'; h[s++]='.textprint{width:340px; height:220px;}\n'; h[s++]='.textstat{width:340px; background-color:#EFEBDE; }\n'; h[s++]='.texteval{width:340px;height:92px;}\n'; h[s++]='.cboprev{width:340px;}\n'; h[s++]='</style>\n'; } if(styleOnly) return h.join(''); h[s++]='<form name="debugform"><div align="center"><center><font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">\n'; h[s++]='<table border="0" bgcolor="#EFEBDE" cellspacing="0">\n'; h[s++]='<tr><td colspan="2" bgcolor="#0033CC"><table border="0" width="100%" cellspacing="0" cellpadding="0">\n'; h[s++]='<tr><td width="50%" nowrap><b><font size="2" color="#FFFFFF" face="Arial"><span style="cursor:default"><img border="0" src="'+url+'images/debug_icon.gif" align="absmiddle" width="32" height="32"> DynAPI Debugger '+(dynapi.debug._useIDE? '(IDE)':'')+'</span></font></b></td>\n'; h[s++]='<td width="50%" bgcolor="#0033CC"><table border="0" width="100%"><tr><td width="100%" align="right">\n'; h[s++]='<font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+imgwatch+' '+imgnormal+' '+imghelp+'</font></td></tr>\n'; h[s++]='</table></td></tr></table></td></tr>\n'; h[s++]='<tr><td colspan="2"><table border="0" cellspacing="0"><tr><td valign="middle">\n'; h[s++]='<input type="text" name="inspect" size="10" class="debugtextbox textinspect"></td><td>'+imginspect+'</td><td>\n'; h[s++]='<input type="text" name="reload" size="15" class="debugtextbox textreload"></td><td>'+imgreload+'</td></tr></table></td></tr><tr><td align="center" colspan="2">\n'; h[s++]='<textarea name="print" rows="11" cols="40" class="debugtextbox textprint" wrap="off"></textarea></td></tr>\n'; h[s++]='<tr><td nowrap><table border="0" cellspacing="0"><tr><td>\n'; h[s++]='<font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+imgclear+'</font></td><td>\n'; h[s++]='<font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+imgeval+'</font></td><td align="right">\n'; h[s++]='<font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+imgprev+'</font></td><td align="right">\n'; h[s++]='<font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+imgnext+'</font></td></tr></table>\n'; h[s++]='</td><td nowrap align="center"><font size="2" face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" color="#000000">JavaScript </font>\n'; h[s++]='</td></tr><tr><td align="center" colspan="2">\n'; h[s++]='<textarea name="eval" rows="7" cols="40" class="debugtextbox texteval" wrap="off"></textarea></td></tr>\n'; h[s++]='<tr><td align="center" colspan="2">\n'; h[s++]='<input type="text" name="stat" size="42" '+(dynapi.ua.mac? 'style="font-family:Monaco"':'')+' value="'+status+'" class="debugtextbox textstat"></td>\n'; h[s++]='</tr></table></font></center></div></form>\n'; return h.join(''); }; dynapi.debug = new Debugger(dynapi.debug._useIDE); if(!dynapi.loaded && !dynapi.ua.ns4) { document.write(dynapi.debug._getDebugTemplate(true)); } var t='------------------------------\n' +'Click "?" for help\n' +'------------------------------\n'; dynapi.debug.print(t); \ No newline at end of file |