source: other-projects/trunk/gs3-release-maker/tasks/sshtaskdef/src/mindbright/terminal/TerminalDefProps.java@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 5.2 KB
Line 
1/******************************************************************************
2 *
3 * Copyright (c) 1998,99 by Mindbright Technology AB, Stockholm, Sweden.
4 * www.mindbright.se, [email protected]
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 *****************************************************************************
17 * $Author: mats $
18 * $Date: 2000/03/08 14:50:18 $
19 * $Name: rel1-2-1 $
20 *****************************************************************************/
21package mindbright.terminal;
22
23import java.util.Properties;
24import java.awt.Toolkit;
25
26// !!! KLUDGE
27
28public abstract class TerminalDefProps {
29
30 // !!! OUCH (we don't want to drag in TerminalXTerm...
31 //
32 public final static String[] terminalTypes = {
33 "xterm", "linux", "scoansi", "att6386", "sun", "aixterm",
34 "vt220", "vt100", "ansi", "vt52",
35
36 "xterm-color", "linux-lat", "", "at386", "", "", "vt320", "vt102"
37 };
38 public static String listAvailableTerminalTypes() {
39 int i;
40 String list = " ";
41 for(i = 0; i < terminalTypes.length; i++)
42 list += terminalTypes[i] + " ";
43 return list;
44 }
45
46 static public final int PROP_NAME = 0;
47 static public final int PROP_VALUE = 1;
48 static public final int PROP_DESC = 2;
49 static public final int PROP_ALLOWED = 3;
50 static public Properties defaultProperties = new Properties();
51 static public final String[][] defaultPropDesc = {
52 // Options
53 { "rv", "false", "reverse video", "(true/false)"},
54 { "aw", "true", "autowrap of line if output reaches edge of window", "(true/false)" },
55 { "rw", "false", "reverse autowrap when going off left edge of window", "(true/false)" },
56 { "im", "false", "insert mode", "(true/false)" },
57 { "al", "false", "do auto-linefeed", "(true/false)" },
58 { "sk", "true", "reposition scroll-area to bottom on keyboard input", "(true/false)" },
59 { "si", "true", "reposition scroll-area to bottom on output to screen", "(true/false)" },
60 { "lp", "false", "use PgUp, PgDn, Home, End keys locally or escape them to shell", "(true/false)" },
61 { "sc", "false", "put <CR><NL> instead of <CR> at end of lines when selecting", "(true/false)" },
62 { "vi", "true", "visible cursor", "(true/false)" },
63 { "ad", "false", "ASCII Line-draw-characters", "(true/false)" },
64 { "le", "false", "do local echo", "(true/false)" },
65 { "sf", "false", "scale font when resizing window", "(true/false)" },
66 { "vb", "false", "visual bell", "(true/false)" },
67 { "ct", "true", "map <ctrl>+<space> to <NUL>", "(true/false)" },
68 { "dc", "false", "toggle 80/132 columns", "(true/false)" },
69 { "da", "true", "enable 80/132 switching", "(true/false)" },
70 { "cs", "true", "copy on mouse-selection", "(true/false)" },
71 // Settings
72 { "fn", defaultFont(), "name of font to use in terminal", ("(" + fontList() + ")") },
73 { "fs", "12", "size of font to use in terminal", "(system dep.)" },
74 { "gm", "80x24", "geometry of terminal", "('<cols>x<rows>')" },
75 { "te", terminalTypes[0],
76 "name of terminal to emulate", ("(" + listAvailableTerminalTypes() + ")") },
77 { "sl", "512", "number of lines to save in \"scrollback\" buffer", "(0 - 8k)" },
78 { "sb", "right", "scrollbar position", "(none/left/right)" },
79 { "bg", "white", "background color", "(<name> or '<r>,<g>,<b>')" },
80 { "fg", "black", "foreground color", "(<name> or '<r>,<g>,<b>')" },
81 { "cc", "i_blue", "cursor color", "(<name> or '<r>,<g>,<b>')" },
82 { "rg", "bottom", "resize gravity, fixpoint of screen when resizing", "(top/bottom)" },
83 { "bs", "DEL", "character to send on BACKSPACE", "('BS' or 'DEL')" },
84 { "de", "DEL", "character to send on DELETE", "('BS' or 'DEL')" },
85 { "sd", "\" \"", "delimeter characters for click-selection", "<string>" },
86 };
87 static {
88 for(int i = 0; i < defaultPropDesc.length; i++)
89 defaultProperties.put(defaultPropDesc[i][PROP_NAME], defaultPropDesc[i][PROP_VALUE]);
90 }
91
92 public static String[] systemFonts;
93 public static String fontList() {
94 if(systemFonts == null)
95 systemFonts = Toolkit.getDefaultToolkit().getFontList();
96 String list = "";
97 for(int i = 0; i < systemFonts.length; i++) {
98 list += systemFonts[i];
99 if(i < systemFonts.length - 1)
100 list += ", ";
101 }
102 return list;
103 }
104
105 public static String defaultFont() {
106 if(fontExists("monospaced"))
107 return "Monospaced";
108 if(fontExists("courier"))
109 return "Courier";
110 if(fontExists("dialoginput"))
111 return "DialogInput";
112 return systemFonts[0];
113 }
114
115 public static boolean fontExists(String font) {
116 int i;
117 if(systemFonts == null)
118 systemFonts = Toolkit.getDefaultToolkit().getFontList();
119 for(i = 0; i < systemFonts.length; i++) {
120 if(systemFonts[i].equalsIgnoreCase(font))
121 break;
122 }
123 if(i == systemFonts.length)
124 return false;
125 return true;
126 }
127
128 public static boolean isProperty(String key) {
129 return defaultProperties.containsKey(key);
130 }
131}
132
Note: See TracBrowser for help on using the repository browser.