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