Mercurial > 510Connectbot
annotate src/org/tn5250j/framework/tn5250/ScreenPlanes.java @ 121:477cca1e0c15
add more 5250 config items
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 18 Jun 2014 19:00:05 -0700 |
parents | 77ac18bc1b2f |
children | 446dbcf606eb |
rev | line source |
---|---|
3 | 1 /** |
2 * Title: ScreenPlanes.java | |
3 * Copyright: Copyright (c) 2001 | |
4 * Company: | |
5 * @author Kenneth J. Pouncey | |
6 * @version 0.5 | |
7 * | |
8 * Description: | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; either version 2, or (at your option) | |
13 * any later version. | |
14 * | |
15 * This program is distributed in the hope that it will be useful, | |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 * GNU General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU General Public License | |
21 * along with this software; see the file COPYING. If not, write to | |
22 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, | |
23 * Boston, MA 02111-1307 USA | |
24 * | |
25 */ | |
26 package org.tn5250j.framework.tn5250; | |
27 | |
28 import static org.tn5250j.TN5250jConstants.*; | |
29 | |
30 import java.util.Properties; | |
31 | |
32 public class ScreenPlanes { | |
33 | |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
34 private final Screen5250 scr; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
35 private int screenSize; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
36 private int numRows; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
37 private int numCols; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
38 private int errorLineNum; |
3 | 39 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
40 private static final int initAttr = 32; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
41 private static final char initChar = 0; |
3 | 42 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
43 protected char[] screen; // text plane |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
44 private char[] screenAttr; // attribute plane |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
45 private char[] screenGUI; // gui plane |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
46 private char[] screenIsAttr; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
47 private char[] fieldExtended; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
48 private char[] screenField; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
49 private char[] screenColor; // color plane |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
50 protected char[] screenExtended; // extended plane |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
51 private char[] screenIsChanged; |
3 | 52 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
53 private char[] initArray; |
3 | 54 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
55 private char[] errorLine; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
56 private char[] errorLineAttr; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
57 private char[] errorLineIsAttr; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
58 private char[] errorLineGui; |
3 | 59 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
60 public ScreenPlanes(Screen5250 s5250, int size) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
61 scr = s5250; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
62 setSize(size); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
63 } |
3 | 64 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
65 protected void setSize(int newSize) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
66 screenSize = newSize; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
67 numCols = 80; |
3 | 68 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
69 switch (newSize) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
70 case 24: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
71 numRows = 24; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
72 break; |
3 | 73 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
74 case 27: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
75 numRows = 27; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
76 numCols = 132; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
77 break; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
78 } |
3 | 79 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
80 // this is used here when size changes |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
81 setErrorLine(numRows); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
82 screenSize = numRows * numCols; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
83 screen = new char[screenSize]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
84 screenAttr = new char[screenSize]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
85 screenIsAttr = new char[screenSize]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
86 screenGUI = new char[screenSize]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
87 screenColor = new char[screenSize]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
88 screenExtended = new char[screenSize]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
89 fieldExtended = new char[screenSize]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
90 screenIsChanged = new char[screenSize]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
91 screenField = new char[screenSize]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
92 initArray = new char[screenSize]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
93 initalizePlanes(); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
94 } |
3 | 95 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
96 protected void setErrorLine(int line) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
97 // * NOTE * for developers I have changed the send qry to pass different |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
98 // parameters to the host so check setsize for setting error line as well. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
99 // |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
100 if (line == 0 || line > numRows) |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
101 errorLineNum = numRows; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
102 else |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
103 errorLineNum = line; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
104 } |
3 | 105 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
106 /** |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
107 * Returns the current error line number |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
108 * |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
109 * @return current error line number |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
110 */ |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
111 protected int getErrorLine() { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
112 return errorLineNum; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
113 } |
3 | 114 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
115 protected void saveErrorLine() { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
116 // if there is already an error line saved then do not save it again |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
117 // This signifies that there was a previous error and the original error |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
118 // line was not restored yet. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
119 if (errorLine == null) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
120 errorLine = new char[numCols]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
121 errorLineAttr = new char[numCols]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
122 errorLineIsAttr = new char[numCols]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
123 errorLineGui = new char[numCols]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
124 int r = scr.getPos(errorLineNum - 1, 0); |
3 | 125 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
126 for (int x = 0; x < numCols; x++) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
127 errorLine[x] = screen[r + x]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
128 errorLineAttr[x] = screenAttr[r + x]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
129 errorLineIsAttr[x] = screenIsAttr[r + x]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
130 errorLineGui[x] = screenGUI[r + x]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
131 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
132 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
133 } |
3 | 134 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
135 /** |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
136 * Restores the error line characters from the save buffer. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
137 * |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
138 * @see #saveErrorLine() |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
139 */ |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
140 protected void restoreErrorLine() { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
141 if (errorLine != null) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
142 int r = scr.getPos(errorLineNum - 1, 0); |
3 | 143 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
144 for (int x = 0; x < numCols - 1; x++) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
145 setScreenCharAndAttr(r + x, errorLine[x], errorLineAttr[x], |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
146 (errorLineIsAttr[x] == '1' ? true : false)); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
147 screenGUI[x] = errorLineGui[x]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
148 } |
3 | 149 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
150 errorLine = null; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
151 errorLineAttr = null; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
152 errorLineIsAttr = null; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
153 errorLineGui = null; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
154 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
155 } |
3 | 156 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
157 protected boolean isErrorLineSaved() { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
158 return errorLine == null ? false : true; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
159 } |
3 | 160 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
161 protected void setScreenCharAndAttr(int pos, char c, int attr, boolean isAttr) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
162 screen[pos] = c; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
163 screenAttr[pos] = (char)attr; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
164 disperseAttribute(pos, attr); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
165 screenIsAttr[pos] = (isAttr ? (char)1 : (char)0); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
166 screenGUI[pos] = NO_GUI; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
167 } |
3 | 168 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
169 protected void setScreenAttr(int pos, int attr, boolean isAttr) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
170 screenAttr[pos] = (char)attr; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
171 screenIsAttr[pos] = isAttr ? (char)1 : (char)0; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
172 disperseAttribute(pos, attr); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
173 screenGUI[pos] = initChar; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
174 } |
3 | 175 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
176 protected void setScreenAttr(int pos, int attr) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
177 screenAttr[pos] = (char)attr; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
178 //screenGUI[pos] = initChar; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
179 disperseAttribute(pos, attr); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
180 } |
3 | 181 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
182 protected void setScreenFieldAttr(int pos, int attr) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
183 screenField[pos] = (char)attr; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
184 } |
3 | 185 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
186 protected final void setChar(int pos, char c) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
187 screenIsChanged[pos] = screen[pos] == c ? '0' : '1'; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
188 screen[pos] = c; |
3 | 189 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
190 if (screenIsAttr[pos] == 1) |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
191 setScreenCharAndAttr(pos, c, 32, false); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
192 } |
3 | 193 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
194 protected final char getChar(int pos) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
195 return screen[pos]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
196 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
197 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
198 protected final char getCharColor(int pos) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
199 return screenColor[pos]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
200 } |
3 | 201 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
202 protected final int getCharAttr(int pos) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
203 return screenAttr[pos]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
204 } |
3 | 205 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
206 protected final char getCharExtended(int pos) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
207 return screenExtended[pos]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
208 } |
75
bf01d1eec5c6
convert 5250 to vt320 attributes
Carl Byington <carl@five-ten-sg.com>
parents:
6
diff
changeset
|
209 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
210 protected final boolean isAttributePlace(int pos) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
211 return screenIsAttr[pos] == 1 ? true : false; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
212 } |
3 | 213 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
214 public final void setUseGUI(int pos, int which) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
215 screenIsChanged[pos] = screenGUI[pos] == which ? '0' : '1'; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
216 screenGUI[pos] = (char)which; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
217 } |
3 | 218 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
219 private void disperseAttribute(int pos, int attr) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
220 char c = 0; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
221 char cs = 0; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
222 char ul = 0; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
223 char nd = 0; |
3 | 224 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
225 if (attr == 0) |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
226 return; |
3 | 227 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
228 switch (attr) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
229 case 32: // green normal |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
230 c = ATTR_32; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
231 break; |
3 | 232 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
233 case 33: // green/revers |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
234 c = ATTR_33; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
235 break; |
3 | 236 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
237 case 34: // white normal |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
238 c = ATTR_34; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
239 break; |
3 | 240 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
241 case 35: // white/reverse |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
242 c = ATTR_35; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
243 break; |
3 | 244 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
245 case 36: // green/underline |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
246 c = ATTR_36; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
247 ul = EXTENDED_5250_UNDERLINE; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
248 break; |
3 | 249 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
250 case 37: // green/reverse/underline |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
251 c = ATTR_37; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
252 ul = EXTENDED_5250_UNDERLINE; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
253 break; |
3 | 254 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
255 case 38: // white/underline |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
256 c = ATTR_38; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
257 ul = EXTENDED_5250_UNDERLINE; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
258 break; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
259 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
260 case 39: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
261 nd = EXTENDED_5250_NON_DSP; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
262 break; |
3 | 263 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
264 case 40: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
265 case 42: // red/normal |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
266 c = ATTR_40; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
267 break; |
3 | 268 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
269 case 41: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
270 case 43: // red/reverse |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
271 c = ATTR_41; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
272 break; |
3 | 273 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
274 case 44: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
275 case 46: // red/underline |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
276 c = ATTR_44; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
277 ul = EXTENDED_5250_UNDERLINE; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
278 break; |
3 | 279 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
280 case 45: // red/reverse/underline |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
281 c = ATTR_45; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
282 ul = EXTENDED_5250_UNDERLINE; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
283 break; |
3 | 284 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
285 case 47: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
286 nd = EXTENDED_5250_NON_DSP; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
287 break; |
3 | 288 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
289 case 48: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
290 c = ATTR_48; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
291 cs = EXTENDED_5250_COL_SEP; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
292 break; |
3 | 293 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
294 case 49: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
295 c = ATTR_49; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
296 cs = EXTENDED_5250_COL_SEP; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
297 break; |
3 | 298 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
299 case 50: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
300 c = ATTR_50; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
301 cs = EXTENDED_5250_COL_SEP; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
302 break; |
3 | 303 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
304 case 51: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
305 c = ATTR_51; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
306 cs = EXTENDED_5250_COL_SEP; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
307 break; |
3 | 308 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
309 case 52: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
310 c = ATTR_52; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
311 // colSep = true; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
312 ul = EXTENDED_5250_UNDERLINE; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
313 break; |
3 | 314 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
315 case 53: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
316 c = ATTR_53; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
317 // colSep = true; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
318 ul = EXTENDED_5250_UNDERLINE; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
319 break; |
3 | 320 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
321 case 54: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
322 c = ATTR_54; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
323 // colSep = true; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
324 ul = EXTENDED_5250_UNDERLINE; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
325 break; |
3 | 326 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
327 case 55: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
328 nd = EXTENDED_5250_NON_DSP; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
329 break; |
3 | 330 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
331 case 56: // pink |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
332 c = ATTR_56; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
333 break; |
3 | 334 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
335 case 57: // pink/reverse |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
336 c = ATTR_57; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
337 break; |
3 | 338 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
339 case 58: // blue/reverse |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
340 c = ATTR_58; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
341 break; |
3 | 342 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
343 case 59: // blue |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
344 c = ATTR_59; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
345 break; |
3 | 346 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
347 case 60: // pink/underline |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
348 c = ATTR_60; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
349 ul = EXTENDED_5250_UNDERLINE; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
350 break; |
3 | 351 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
352 case 61: // pink/reverse/underline |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
353 c = ATTR_61; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
354 ul = EXTENDED_5250_UNDERLINE; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
355 break; |
3 | 356 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
357 case 62: // blue/underline |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
358 c = ATTR_62; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
359 ul = EXTENDED_5250_UNDERLINE; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
360 break; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
361 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
362 case 63: // nondisplay |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
363 nd = EXTENDED_5250_NON_DSP; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
364 cs = EXTENDED_5250_COL_SEP; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
365 break; |
3 | 366 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
367 default: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
368 c = (COLOR_BG_BLACK << 8 & 0xff00) | |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
369 (COLOR_FG_YELLOW & 0xff); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
370 break; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
371 } |
3 | 372 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
373 screenColor[pos] = c; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
374 screenExtended[pos] = (char)(ul | cs | nd); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
375 } |
3 | 376 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
377 protected void initalizePlanes() { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
378 char c = (COLOR_BG_BLACK << 8 & 0xff00) | |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
379 (COLOR_FG_GREEN & 0xff); |
3 | 380 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
381 for (int y = 0; y < screenSize; y++) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
382 screenAttr[y] = initAttr; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
383 screenColor[y] = c; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
384 } |
3 | 385 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
386 // here we will just copy the initialized plane onto the other planes |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
387 // using arraycopy which will be faster. I hope. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
388 System.arraycopy(initArray, 0, screen, 0, screenSize); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
389 System.arraycopy(initArray, 0, screenGUI, 0, screenSize); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
390 System.arraycopy(initArray, 0, screenIsAttr, 0, screenSize); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
391 System.arraycopy(initArray, 0, screenExtended, 0, screenSize); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
392 System.arraycopy(initArray, 0, fieldExtended, 0, screenSize); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
393 System.arraycopy(initArray, 0, screenField, 0, screenSize); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
394 } |
3 | 395 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
396 protected void initalizeFieldPlanes() { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
397 System.arraycopy(initArray, 0, fieldExtended, 0, screenSize); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
398 System.arraycopy(initArray, 0, screenField, 0, screenSize); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
399 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
400 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
401 protected final int getWhichGUI(int pos) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
402 return screenGUI[pos]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
403 } |
3 | 404 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
405 protected final boolean isChanged(int pos) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
406 return screenIsChanged[pos] == 0 ? false : true; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
407 } |
3 | 408 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
409 protected final boolean isUseGui(int pos) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
410 return screenGUI[pos] == NO_GUI ? false : true; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
411 } |
3 | 412 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
413 /** |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
414 * Return the data associated with the plane that is passed. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
415 * |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
416 * @param from Position from which to start |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
417 * @param to Position to end |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
418 * @param plane From which plane to obtain the data |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
419 * @return Character array containing the data requested |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
420 */ |
3 | 421 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
422 protected synchronized char[] getPlaneData(int from, int to, int plane) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
423 int len = (to - from); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
424 char[] planeChars = new char[len + 1]; |
3 | 425 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
426 switch (plane) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
427 case PLANE_TEXT: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
428 System.arraycopy(screen, from, planeChars, 0, len); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
429 break; |
3 | 430 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
431 case PLANE_ATTR: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
432 System.arraycopy(screenAttr, from, planeChars, 0, len); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
433 break; |
3 | 434 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
435 case PLANE_COLOR: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
436 System.arraycopy(screenColor, from, planeChars, 0, len); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
437 break; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
438 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
439 case PLANE_EXTENDED: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
440 System.arraycopy(screenExtended, from, planeChars, 0, len); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
441 break; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
442 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
443 case PLANE_EXTENDED_GRAPHIC: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
444 System.arraycopy(screenGUI, from, planeChars, 0, len); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
445 break; |
3 | 446 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
447 case PLANE_FIELD: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
448 System.arraycopy(screenField, from, planeChars, 0, len); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
449 break; |
3 | 450 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
451 case PLANE_IS_ATTR_PLACE: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
452 System.arraycopy(screenIsAttr, from, planeChars, 0, len); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
453 break; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
454 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
455 default: |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
456 System.arraycopy(screen, from, planeChars, 0, len); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
457 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
458 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
459 return planeChars; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
460 } |
3 | 461 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
462 /** |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
463 * Converts a linear presentation space position to its corresponding row. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
464 * |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
465 * @param pos The position to be converted |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
466 * @return The row which corresponds to the position given |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
467 * @throws OhioException |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
468 */ |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
469 private int convertPosToRow(int pos) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
470 return (pos / numCols) + 1; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
471 } |
3 | 472 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
473 /** |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
474 * Converts a linear presentation space position to its corresponding column. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
475 * |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
476 * @param pos The position to be converted |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
477 * @return The column which corresponds to the position given |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
478 * @throws OhioException |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
479 */ |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
480 private int convertPosToColumn(int pos) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
481 return (pos % numCols) + 1; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
482 } |
3 | 483 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
484 /** |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
485 * |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
486 * Converts a row and column coordinate to its corresponding linear position. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
487 * |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
488 * @param row - The row of the coordinate |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
489 * @param col - The column of the coordinate |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
490 * @return The linear position which corresponds to the coordinate given. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
491 * @throws OhioException |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
492 */ |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
493 private int convertRowColToPos(int row, int col) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
494 return (row - 1) * numCols + col - 1; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
495 } |
3 | 496 |
497 | |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
498 /** |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
499 * <p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
500 * GetScreen retrieves the various planes associated with the presentation |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
501 * space. The data is returned as a linear array of character values in the |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
502 * array provided. The array is not terminated by a null character except |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
503 * when data is retrieved from the text plane, in which case a single null |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
504 * character is appended. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
505 * </p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
506 * <p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
507 * The application must supply a buffer for the returned data and the length |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
508 * of the buffer. Data is returned starting from the beginning of the |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
509 * presentation space and continuing until the buffer is full or the entire |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
510 * plane has been copied. For text plane data, the buffer must include one |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
511 * extra position for the terminating null character. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
512 * <p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
513 * |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
514 * @param buffer |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
515 * @param bufferLength |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
516 * @param plane |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
517 * @return The number of characters copied to the buffer |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
518 * @throws OhioException |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
519 */ |
3 | 520 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
521 public synchronized int GetScreen(char buffer[], int bufferLength, int plane) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
522 return GetScreen(buffer, bufferLength, 0, screenSize, plane); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
523 } |
3 | 524 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
525 /** |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
526 * <p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
527 * GetScreen retrieves the various planes associated with the presentation |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
528 * space. The data is returned as a linear array of character values in the |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
529 * array provided. The array is not terminated by a null character except |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
530 * when data is retrieved from the text plane, in which case a single null |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
531 * character is appended. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
532 * </p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
533 * <p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
534 * The application must supply a buffer for the returned data and the length |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
535 * of the buffer. Data is returned starting from the given position and |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
536 * continuing until the specified number of characters have been copied, the |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
537 * buffer is full or the entire plane has been copied. For text plane data, |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
538 * the buffer must include one extra position for the terminating null character. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
539 * </p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
540 * |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
541 * @param buffer |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
542 * @param bufferLength |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
543 * @param from |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
544 * @param length |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
545 * @param plane |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
546 * @return The number of characters copied to the buffer |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
547 * @throws OhioException |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
548 */ |
3 | 549 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
550 public synchronized int GetScreen(char buffer[], int bufferLength, int from, |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
551 int length, int plane) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
552 // if(buffer == null) |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
553 // throw new OhioException(sessionVT.getSessionConfiguration(), |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
554 // OhioScreen.class.getName(), "osohio.screen.ohio00300", 1); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
555 if (buffer == null) |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
556 return 0; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
557 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
558 int min = Math.min(Math.min(buffer.length, bufferLength), screenSize); |
3 | 559 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
560 if ((from + min) > screenSize) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
561 min = screenSize - from; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
562 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
563 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
564 char[] pd = getPlaneData(from, from + min, plane); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
565 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
566 if (pd != null) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
567 System.arraycopy(pd, 0, buffer, 0, min); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
568 return pd.length; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
569 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
570 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
571 return 0; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
572 } |
3 | 573 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
574 /** |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
575 * <p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
576 * GetScreen retrieves the various planes associated with the presentation |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
577 * space. The data is returned as a linear array of character values in the |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
578 * array provided. The array is not terminated by a null character except |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
579 * when data is retrieved from the text plane, in which case a single null |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
580 * character is appended. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
581 * </p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
582 * <p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
583 * The application must supply a buffer for the returned data and the length |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
584 * of the buffer. Data is returned starting from the given coordinates and |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
585 * continuing until the specified number of characters have been copied, |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
586 * the buffer is full, or the entire plane has been copied. For text plane |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
587 * data, the buffer must include one extra position for the terminating null |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
588 * character. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
589 * </p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
590 * |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
591 * @param buffer |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
592 * @param bufferLength |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
593 * @param row |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
594 * @param col |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
595 * @param length |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
596 * @param plane |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
597 * @return The number of characters copied to the buffer. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
598 * @throws OhioException |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
599 */ |
3 | 600 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
601 public synchronized int GetScreen(char buffer[], int bufferLength, int row, |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
602 int col, int length, int plane) |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
603 // throws OhioException { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
604 { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
605 // Call GetScreen function after converting row and column to |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
606 // a position. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
607 return GetScreen(buffer, bufferLength, convertRowColToPos(row, col), |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
608 length, plane); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
609 } |
3 | 610 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
611 /** |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
612 * <p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
613 * GetScreenRect retrieves data from the various planes associated with the |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
614 * presentation space. The data is returned as a linear array of character |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
615 * values in the buffer provided. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
616 * </p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
617 * |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
618 * <p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
619 * The application supplies two positions that represent opposing corners of |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
620 * a rectangle within the presentation space. The starting and ending |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
621 * positions can have any spatial relationship to each other. The data |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
622 * returned starts from the row containing the upper-most point to the row |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
623 * containing the lower-most point, and from the left-most column to the |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
624 * right-most column. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
625 * </p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
626 * <p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
627 * The specified buffer must be at least large enough to contain the number |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
628 * of characters in the rectangle. If the buffer is too small, no data is |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
629 * copied and zero is returned by the method. Otherwise, the method returns |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
630 * the number of characters copied. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
631 * </p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
632 * |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
633 * @param buffer |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
634 * @param bufferLength |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
635 * @param startPos |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
636 * @param endPos |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
637 * @param plane |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
638 * @return The number of characters copied to the buffer |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
639 * @throws OhioException |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
640 */ |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
641 protected int GetScreenRect(char buffer[], int bufferLength, |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
642 int startPos, int endPos, int plane) |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
643 // throws OhioException { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
644 { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
645 // We will use the row,col routine here because it is easier to use |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
646 // row colum than it is for position since I wrote the other first and |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
647 // am to lazy to implement it here |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
648 // Maybe it would be faster to do it the other way? |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
649 int startRow = convertPosToRow(startPos); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
650 int startCol = convertPosToColumn(startPos); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
651 int endRow = convertPosToRow(endPos); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
652 int endCol = convertPosToColumn(endPos); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
653 return GetScreenRect(buffer, bufferLength, startRow, startCol, |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
654 endRow, endCol, plane); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
655 } |
3 | 656 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
657 /** |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
658 * <p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
659 * GetScreenRect retrieves data from the various planes associated with the |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
660 * presentation space. The data is returned as a linear array of character |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
661 * values in the buffer provided. The buffer is not terminated by a null |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
662 * character. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
663 * </p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
664 * <p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
665 * The application supplies two coordinates that represent opposing corners |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
666 * of a rectangle within the presentation space. The starting and ending |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
667 * coordinates can have any spatial relationship to each other. The data |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
668 * returned starts from the row containing the upper-most point to the row |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
669 * containing the lower-most point, and from the left-most column to the |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
670 * right-most column. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
671 * </p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
672 * <p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
673 * The specified buffer must be at least large enough to contain the number |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
674 * of characters in the rectangle. If the buffer is too small, no data is |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
675 * copied and zero is returned by the method. Otherwise, the method returns |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
676 * the number of characters copied. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
677 * </p> |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
678 * |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
679 * @param buffer |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
680 * @param bufferLength |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
681 * @param startRow |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
682 * @param startCol |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
683 * @param endRow |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
684 * @param endCol |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
685 * @param plane |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
686 * @return The number characters copied to the buffer |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
687 * @throws OhioException |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
688 */ |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
689 protected int GetScreenRect(char buffer[], int bufferLength, |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
690 int startRow, int startCol, |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
691 int endRow, int endCol, int plane) |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
692 // throws OhioException { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
693 { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
694 // number of bytes obtained |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
695 int numBytes = 0; |
3 | 696 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
697 // lets check the row range. If they are reversed then we need to |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
698 // place them in the correct order. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
699 if (startRow > endRow) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
700 int r = startRow; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
701 startRow = endRow; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
702 endRow = r; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
703 } |
3 | 704 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
705 // lets check the column range. If they are reversed then we need to |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
706 // place them in the correct order. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
707 if (startCol > endCol) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
708 int c = startCol; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
709 startCol = endCol; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
710 endCol = c; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
711 } |
3 | 712 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
713 int numCols = (endCol - startCol) + 1; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
714 int numRows = (endRow - startRow) + 1; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
715 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
716 // lets make sure it is within the bounds of the character array passed |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
717 // if not the return as zero bytes where read as per documentation. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
718 if (numCols * numRows <= bufferLength) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
719 // make sure it is one larger. I guess for other languanges to |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
720 // reference like in C which is terminated by a zero byte at the end |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
721 // of strings. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
722 char cb[] = new char[numCols + 1]; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
723 int charOffset = 0; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
724 int bytes = 0; |
3 | 725 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
726 // now let's loop through and get the screen information for |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
727 // each row; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
728 for (int row = startRow; row <= endRow;) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
729 if ((bytes = GetScreen(cb, cb.length, row, startCol, numCols, plane)) != 0) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
730 System.arraycopy(cb, 0, buffer, charOffset, numCols); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
731 } |
3 | 732 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
733 row++; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
734 charOffset += numCols; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
735 // make sure we count the number of bytes returned |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
736 numBytes += bytes; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
737 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
738 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
739 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
740 return numBytes; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
741 } |
3 | 742 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
743 private int isOption(char[] screen, |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
744 int x, |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
745 int lenScreen, |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
746 int numPref, |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
747 int numSuff, |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
748 char suff) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
749 boolean hs = true; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
750 int sp = x; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
751 int os = 0; |
3 | 752 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
753 // check to the left for option |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
754 while (--sp >= 0 && screen[sp] <= ' ') { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
755 if (x - sp > numPref || screen[sp] == suff || |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
756 screen[sp] == '.' || |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
757 screen[sp] == '*') { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
758 hs = false; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
759 break; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
760 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
761 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
762 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
763 // now lets check for how long the option is it has to be numPref or less |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
764 os = sp; |
3 | 765 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
766 while (hs && --os > 0 && screen[os] > ' ') { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
767 if (sp - os >= numPref || screen[os] == suff || |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
768 screen[os] == '.' || |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
769 screen[os] == '*') { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
770 hs = false; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
771 break; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
772 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
773 } |
3 | 774 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
775 if (sp - os > 1 && !Character.isDigit(screen[os + 1])) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
776 hs = false; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
777 } |
3 | 778 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
779 sp = x; |
3 | 780 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
781 if (Character.isDigit(screen[sp + 1])) |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
782 hs = false; |
3 | 783 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
784 // now lets make sure there are no more than numSuff spaces after option |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
785 while (hs && (++sp < lenScreen && screen[sp] <= ' ' |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
786 || screen[sp] == suff)) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
787 if (sp - x >= numSuff || screen[sp] == suff || |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
788 screen[sp] == '.' || |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
789 screen[sp] == '*') { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
790 hs = false; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
791 break; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
792 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
793 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
794 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
795 if (hs && !Character.isLetterOrDigit(screen[sp])) |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
796 hs = false; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
797 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
798 if (hs) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
799 return os; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
800 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
801 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
802 return -1; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
78
diff
changeset
|
803 } |
3 | 804 |
805 } |