home *** CD-ROM | disk | FTP | other *** search
- // C Point Debugger JavaScript Library v5.0
- // Copyright© 2002 C Point Pty Ltd, 71 Williamson Road, Para Hills 5096
- // Web: http://www.c-point.com Email: c-point@c-point.com
-
- // *********************************************************************** //
- // To use the C Point Debugger JavaScript Library you must be a registered
- // user of Antechinus JavaScript Editor.
- // *********************************************************************** //
-
- Debugger=1;
- debugInit=0;
- UseTimeStamp=1;
- DbgX=0;
- DbgY=0;
- DbgWidth=500;
- DbgHeight=120;
- function PROPERTIES(objName, obj)
- {
- if(!Debugger) return;
- InitDbgSession();
- var str = "";
- for(var v in obj)
- {
- str=objName+"."+v+" = " + obj[v] + "\n";
- document.fm.ta.value = str + document.fm.ta.value;
- }
- }
- function TRACE0(val)
- {
- if(!Debugger)return;
- InitDbgSession();
- document.fm.ta.value = val + "\n" + document.fm.ta.value;
- }
- var timestamp=0;
- function TRACE(label, val)
- {
- if(!Debugger)return;
- InitDbgSession();
- var msg = label + "=" + val;
- var now = new Date();
- var elapsed = now - timestamp;
- if(UseTimeStamp)
- {
- msg+=" (" + elapsed + " msec)";
- }
- timestamp = now;
-
- document.fm.ta.value = msg + "\n" + document.fm.ta.value;
- }
-
- // ************ Move object functions ************
- function InitDbgSession()
- {
- if(debugInit)return;
- debugInit=1;
- // Init the draggable class
- bMoving = false;
- document.onmousedown=DbgStartMove;
- document.onmousemove=DbgMoveObj;
- document.onmouseup=new Function("bMoving=false");
- // Init debugger session
- var str = '<div class=dbgdrag border=1 style="position:absolute; left:' + DbgX +
- ';top:' + DbgY + '; width:' + DbgWidth + 'px;' +
- 'background-color=silver;height:' + DbgHeight + 'px; z-index:1;border=1;borderColor=black">' +
- '<form name ="fm">';
- DbgWidth-=10;
- DbgHeight-=10;
- str+='<textarea name="ta" style="position:absolute; width:' + DbgWidth + 'px;height:' + DbgHeight +
- 'px;left:5;top:5;">' + '</textarea></form></div>';
- document.write(str);
- }
-
- function DbgMoveObj()
- {
- if(!bMoving) return true;
- if(event.button!=1) return true;
-
- // Reposition the object, keeping the same distance from the cursor
- ob.style.pixelLeft=event.clientX-xdif;
- ob.style.pixelTop=event.clientY-ydif;
- return false;
- }
-
- function DbgStartMove()
- {
- // Only "draggable" objects can move
- if(event.srcElement.className!="dbgdrag") return;
-
- bMoving=true;
- // Store the object and the differnce between the obj pos and cursor pos: it must remain the same
- ob=event.srcElement;
- xdif=event.clientX-event.srcElement.style.pixelLeft;
- ydif=event.clientY-event.srcElement.style.pixelTop;
- }
-
-