KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > lib > terminalemulator > State


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is Terminal Emulator.
16  * The Initial Developer of the Original Software is Sun Microsystems, Inc..
17  * Portions created by Sun Microsystems, Inc. are Copyright (C) 2001.
18  * All Rights Reserved.
19  *
20  * Contributor(s): Ivan Soleimanipour.
21  */

22
23 /*
24  * "State.java"
25  * State.java 1.11 01/07/26
26  */

27
28 package org.netbeans.lib.terminalemulator;
29
30 class State {
31     public int rows;
32
33     // Index of Line visible on top of the canvas (0-origin)
34
public int firstx;
35     public int firsty;
36
37     // Cursor is in "cell" coordinates
38
public BCoord cursor = new BCoord();
39
40     public void adjust(int amount) {
41     firstx += amount;
42     if (firstx < 0)
43         firstx = 0;
44
45     cursor.row += amount;
46     if (cursor.row < 0)
47         cursor.row = 0;
48     }
49
50     // Current attribute as defined by class Attr
51
public int attr;
52
53     // If 'true' characters replace what's under cursor (default)
54
// If 'false' act as an insert operation.
55
public boolean overstrike = true;
56
57
58     /*
59      * Cursor saving and restoration.
60      * Saved values are not adjusted!
61      */

62     public void saveCursor() {
63     saved_cursor = (BCoord) cursor.clone();
64     }
65     public void restoreCursor() {
66     if (saved_cursor != null) {
67         cursor = saved_cursor;
68         saved_cursor = null;
69     }
70     }
71     private BCoord saved_cursor = null;
72 }
73
Popular Tags