summaryrefslogtreecommitdiffstats
path: root/Bachelor/CCNA4/en_CCNA4_v30/elabs/Engine/actions_manual_scrolling.txt
blob: ec930c1c673b707dfd97cf3ec51b013c27fcb6e2 (plain)
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
//zmg, 03.01.01 

//this file needs a better description!



//Modified by Bargavi 

//to be compatible with flash MX



// Modified by Dean Wood 05.10.01

//   Changed hard-coded 7s to cursorXOffset.

//   Changed active_router references to VISIBLE_ROUTER

//     This allows scrolling during telnet sessions

//   Added manual_scrolling_setSlider()

//   Added manual_scrolling_setConent()



// Modified by Dean Wood 05.29.01

//    Added kludge to fix a bug in output_writeOut()





// Manual Scrolling



//manual_scrolling_scrollUp()

//IN: <none>

//DO: scrolls the current Hyperterminal screen "up" 1 line

//OUT: the console's output has been scrolled up 1 line

function manual_scrolling_scrollUp() {





	var r = eval("_root.r" + _root.VISIBLE_ROUTER); //ptr to active router object

	var optr = eval("_root.HyperTerminal.s" + _root.VISIBLE_ROUTER); //ptr to output (hyperterminal console)



	//r.indexLine = the number of the first line that is showing on the screen.

	//if it is less than 1 (all of the lines are showing on the screen), then

	//we can return because there is no need to scroll up.

	if (r.indexLine < 1) {

		return;

	}





	//kluge to fix a bug in output_writeOut()

	if(r.indexLine == r.stopLine)

		r.indexLine--;



	//decrement the indexLine counter (the lowest line number 

	//currently visible on the screen)

	r.indexLine--;



	//hide the cursor in the console window, and clear the output.

	_root.HyperTerminal.cursor._visible = false;

	optr.output.text = "";



	//_root.message = _root.VISIBLE_ROUTER + " (Scroll Up):\n";

	//_root.message += "  indexLine = " + r.indexLine + "\n";

	//_root.message += "  lastDLine = " + r.lastDLine + "\n";

	//_root.message += "  lastLine = " + r.lastLine + "\n";



	//output the 24 lines that now fit on the screen (given the updated

	//indexLine) via optr, the pointer to the Hyperterminal console

	for (var j = r.indexLine; j < (r.indexLine+24); j++) {

		//_root.message += "  line[" + j + "] = " + r.line[j];

		optr.output.text += r.line[j];//Bargavi

	}



	manual_scrolling_setSlider();

}







// manual_scrolling_scrollDown()

//IN: <none>

//DO: scrolls the current Hyperterminal screen "down" 1 line

//OUT: the console's output has been scrolled down 1 line

function manual_scrolling_scrollDown() {





	var rptr = eval("_root.r" + _root.VISIBLE_ROUTER); //ptr to active router object

	var optr = eval("_root.HyperTerminal.s" + _root.VISIBLE_ROUTER); //ptr to output (Hyperterminal console)



	//if we are at the last line of the display buffer (we can't scroll down

	//anymore because we're already at the bottom of the output) then

	//return.

	if (rptr.indexLine > rptr.lastDLine-24) {

		return;

	}



	//increment the indexLine counter (the lowest line number 

	//currently visible on the screen), and (temporarily) clear 

	//the Hyperterminal output

	rptr.indexLine++;

	optr.output.text = "";//Bargavi



	//_root.message = _root.VISIBLE_ROUTER + " (Scroll Down):\n";

	//_root.message += "  indexLine = " + rptr.indexLine + "\n";

	//_root.message += "  lastDLine = " + rptr.lastDLine + "\n";

	//_root.message += "  lastLine = " + rptr.lastLine + "\n";



	//output the 24 lines that now fit on the screen (given the updated

	//indexLine) via optr, the pointer to the Hyperterminal console

	for (var j = rptr.indexLine; j < (rptr.indexLine+24); j++) {

		//_root.message += "  line[" + j + "] = " + rptr.line[j];

		optr.output.text += rptr.line[j];//Bargavi

	}

	

	manual_scrolling_setSlider();

	

	if (rptr.indexLine == (rptr.lastDLine-23)) {

	

		//set the x-position of the cursor to the end of the

		//last line of displayed output

		rptr.cursorX = rptr.line[rptr.lastDLine].length;

		

		// (?)

		_root.HyperTerminal.cursor._x = rptr.cx + rptr.cursorXOffset * rptr.cursorX;

		

		//set the now correctly positioned Hyperterminal cursor to visible

		_root.HyperTerminal.cursor._visible = true;

	}

}





// manual_scrolling_setSlider()

//IN: <none>

//DO: positions the scroll bar's slider.

//OUT: the scroll bar's slider has been positioned.

function manual_scrolling_setSlider() {



	var rptr = eval("_root.r" + _root.VISIBLE_ROUTER); //ptr to active router object

	var sptr = _root.HyperTerminal.ScrollBar.Slider; //ptr to scroll bar slider





	//kluge to fix a bug in output_writeOut()

	if(rptr.indexLine == rptr.stopLine)

		rptr.indexLine--;



	var percentage = rptr.indexLine / (rptr.lastDLine - 23);

	sptr._y = sptr.range * percentage + sptr.min;

}





// manual_scrolling_setContent()

//IN: <none>

//DO: positions the content based on the scroll bar's slider position.

//OUT: the content has been positioned.

function manual_scrolling_setContent() {



	var rptr = eval("_root.r" + _root.VISIBLE_ROUTER); //ptr to active router object

	var optr = eval("_root.HyperTerminal.s" + _root.VISIBLE_ROUTER); //ptr to output (Hyperterminal console)

	var sptr = _root.HyperTerminal.ScrollBar.Slider; //ptr to scroll bar slider



	var percentage = (sptr._y - sptr.min) / sptr.range;

	rptr.indexLine = Math.round((rptr.lastDLine - 23) * percentage);



	//temporarily clear the Hyperterminal output

	optr.output.text = "";//Bargavi



	//output the 24 lines that now fit on the screen (given the updated

	//indexLine) via optr, the pointer to the Hyperterminal console

	for (var i = rptr.indexLine; i < (rptr.indexLine + 24); i++) {

		optr.output.text += rptr.line[i];//Bargavi

	}



	if(rptr.indexLine == (rptr.lastDLine - 23)) {



		//set the x-position of the cursor to the end of the

		//last line of displayed output

		rptr.cursorX = rptr.line[rptr.lastDLine].length;

	

		// (?)

		_root.HyperTerminal.cursor._x = rptr.cx + rptr.cursorXOffset * rptr.cursorX;

		

		//set the now correctly positioned Hyperterminal cursor to visible

		_root.HyperTerminal.cursor._visible = true;

	}

	else {



		//hide the cursor in the console window.

		_root.HyperTerminal.cursor._visible = false;

	}

}