1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
//=========================================================================
// Author: D. Menasce (INFN Milano Bicocca)
// Site: http://hal9000.mib.infn.it/~menasce
//
// This utility creates a window containing a text area that is used for
// trace-back blackboard by other scripts.
//=========================================================================
function DM_TraceWindow(fileCaller,functionCaller,msg)
{
var theTtop = 780 ;
var theLeft = 500 ;
var theWidth = 800 ;
var theHeight = 350 ;
var theTraceWindow = parent.theTraceWindow ;
if( !theTraceWindow )
{
theTraceWindow = DM_OpenWindow(theTtop,theLeft,theWidth,theHeight) ;
} else if( theTraceWindow.closed ) {
theTraceWindow = DM_OpenWindow(theTtop,theLeft,theWidth,theHeight) ;
}
if( typeof msg == "undefined" ) msg = "" ;
var newMsg = DM_FormatMsg(fileCaller,functionCaller,msg) ;
DM_WriteWindow(theTraceWindow, newMsg) ;
parent.theTraceWindow = theTraceWindow ;
theTraceWindow.onresize = resizer ;
}
//=========================================================================
function resizer()
{
}
//=========================================================================
function DM_OpenWindow(Top,Left,Width,Height)
{
theTraceWindow = window.open("",
"theTraceWindow",
"menubar = no, " +
"location = no, " +
"resizable = no, " +
"scrollbars= yes, " +
"titlebar = yes, " +
"status = yes, " +
"left = " + Left + ", " +
"top = " + Top + ", " +
"height = " + Height + ", " +
"width = " + Width );
theTraceWindow.document.write("<html> ");
theTraceWindow.document.write(" <head> ");
theTraceWindow.document.write(" <style type=text/css> ");
theTraceWindow.document.write(" .traceRegion ");
theTraceWindow.document.write(" { ");
theTraceWindow.document.write(" font-size: 8pt ; ");
theTraceWindow.document.write(" background-color:#fdf2d0; ");
theTraceWindow.document.write(" } ");
theTraceWindow.document.write(" .button ");
theTraceWindow.document.write(" { ");
theTraceWindow.document.write(" font-size: 8pt ; ");
theTraceWindow.document.write(" color: #ff2222; ");
theTraceWindow.document.write(" } ");
theTraceWindow.document.write(" h1 ");
theTraceWindow.document.write(" { ");
theTraceWindow.document.write(" font-size: 9pt ; ");
theTraceWindow.document.write(" color: #73d0fb; ");
theTraceWindow.document.write(" } ");
theTraceWindow.document.write(" </style> ");
theTraceWindow.document.write(" <script type=text/javascript> ");
theTraceWindow.document.write(" function increaseTraceRegion() ");
theTraceWindow.document.write(" { ");
theTraceWindow.document.write(" widerTraceRegion() ; ");
theTraceWindow.document.write(" higherTraceRegion() ; ");
theTraceWindow.document.write(" } ");
theTraceWindow.document.write(" function clearTraceRegion() ");
theTraceWindow.document.write(" { ");
theTraceWindow.document.write(" var theTracer= document.getElementById('traceRegion'); ");
theTraceWindow.document.write(" theTracer.innerHTML = ''; ");
theTraceWindow.document.write(" } ");
theTraceWindow.document.write(" function widerTraceRegion() ");
theTraceWindow.document.write(" { ");
theTraceWindow.document.write(" var theTracer= document.getElementById('traceRegion'); ");
theTraceWindow.document.write(" var cols = theTracer.getAttribute('cols'); ");
theTraceWindow.document.write(" var oldCol = parseInt(cols) + 5; ");
theTraceWindow.document.write(" theTracer.setAttribute('cols',oldCol); ");
theTraceWindow.document.write(" } ");
theTraceWindow.document.write(" function higherTraceRegion() ");
theTraceWindow.document.write(" { ");
theTraceWindow.document.write(" var theTracer= document.getElementById('traceRegion'); ");
theTraceWindow.document.write(" var rows = theTracer.getAttribute('rows'); ");
theTraceWindow.document.write(" var oldRow = parseInt(rows) + 5; ");
theTraceWindow.document.write(" theTracer.setAttribute('rows',oldRow); ");
theTraceWindow.document.write(" } ");
theTraceWindow.document.write(" function defaultTraceRegion() ");
theTraceWindow.document.write(" { ");
theTraceWindow.document.write(" var theTracer= document.getElementById('traceRegion'); ");
theTraceWindow.document.write(" theTracer.setAttribute('rows',19); ");
theTraceWindow.document.write(" theTracer.setAttribute('cols',125); ");
theTraceWindow.document.write(" } ");
theTraceWindow.document.write(" </script> ");
theTraceWindow.document.write(" <title> ");
theTraceWindow.document.write(" Trace back utility ");
theTraceWindow.document.write(" </title> ");
theTraceWindow.document.write(" </head> ");
theTraceWindow.document.write(" <body bgcolor=#414141> ");
theTraceWindow.document.write(" <form action='javascript:void()'> ");
theTraceWindow.document.write(" <h1>Trace back region ");
theTraceWindow.document.write(" <button name = 'clearTextArea' ");
theTraceWindow.document.write(" onclick = 'clearTraceRegion()' ");
theTraceWindow.document.write(" class = 'button' ");
theTraceWindow.document.write(" value = 'Clear'> ");
theTraceWindow.document.write(" Clear ");
theTraceWindow.document.write(" </button> ");
theTraceWindow.document.write(" <button name = 'moreColumns' ");
theTraceWindow.document.write(" onclick = 'widerTraceRegion()' ");
theTraceWindow.document.write(" class = 'button' ");
theTraceWindow.document.write(" value = 'Wider'> ");
theTraceWindow.document.write(" Wider ");
theTraceWindow.document.write(" </button> ");
theTraceWindow.document.write(" <button name = 'moreRows' ");
theTraceWindow.document.write(" onclick = 'higherTraceRegion()' ");
theTraceWindow.document.write(" class = 'button' ");
theTraceWindow.document.write(" value = 'Higher'> ");
theTraceWindow.document.write(" Higher ");
theTraceWindow.document.write(" </button> ");
theTraceWindow.document.write(" <button name = 'defaultSize' ");
theTraceWindow.document.write(" onclick = 'defaultTraceRegion()' ");
theTraceWindow.document.write(" class = 'button' ");
theTraceWindow.document.write(" value = 'Default'> ");
theTraceWindow.document.write(" Default Size ");
theTraceWindow.document.write(" </button> ");
theTraceWindow.document.write(" </h1> ");
theTraceWindow.document.write(" </form> ");
theTraceWindow.document.write(" <textarea id = 'traceRegion' ");
theTraceWindow.document.write(" class = 'traceRegion' ");
theTraceWindow.document.write(" name = 'abstract' ");
theTraceWindow.document.write(" rows = '19' ");
theTraceWindow.document.write(" cols = '125'></textarea> ");
theTraceWindow.document.write(" </body> ");
theTraceWindow.document.write("</html> ");
theTraceWindow.document.close();
theTraceWindow.moveTo( Left, Top) ;
theTraceWindow.resizeTo(Width, Height) ;
return theTraceWindow ;
}
//=========================================================================
function DM_FormatMsg(fileCaller,functionCaller,msg)
{
var newMsg = "["+ fileCaller + "::" + functionCaller + "()]" ;
var len = newMsg.length ;
var startPos = 35 - len ;
if( startPos < 1 ) {startPos = 1 ;}
for(var i=0; i < startPos; i++)
{
newMsg += " " ;
}
newMsg += msg;
return newMsg ;
}
//=========================================================================
function DM_WriteWindow(theTraceWindow,msg)
{
var theTracer = theTraceWindow.document.getElementById("traceRegion") ;
var prevContent = theTracer.innerHTML ;
prevContent += "\n" ;
prevContent += msg ;
theTracer.innerHTML = prevContent ;
theTracer.scrollTop = theTracer.scrollHeight ; // Bring last line into view
}
//=========================================================================
function DM_ClearTrace()
{
var leftW = top.left.theTraceWindow ;
if( !leftW )
{
return ; // Nothing to clear
}
if( leftW )
{
theTraceWindow = leftW ;
}
if( rightW )
{
theTraceWindow = rightW ;
}
var theTracer = theTraceWindow.document.getElementById("traceRegion") ;
theTracer.innerHTML = "" ;
}
//---------- Additional tools under development ---------------------------s
//=========================================================================
function DM_TheWindowObject(theWindow)
{
this.getTitle = DM_GetTitle ;
this.getImages = DM_GetImages ;
this.docTitle = theWindow.document.title ;
this.docImages = theWindow.document.images ;
DM_TraceWindow(this.name,theWindow.document.title) ;
}
//=========================================================================
function DM_GetTitle()
{
return this.docTitle ;
}
//=========================================================================
function DM_GetImages()
{
return this.docImages ;
}
|