diff options
Diffstat (limited to 'OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs')
-rw-r--r-- | OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs b/OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs deleted file mode 100644 index d6a3d04..0000000 --- a/OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs +++ /dev/null | |||
@@ -1,111 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.Windows.Forms; | ||
32 | |||
33 | namespace OpenSim.GUI | ||
34 | { | ||
35 | class InputTextBoxControl:System.Windows.Forms.TextBox | ||
36 | { | ||
37 | public InputTextBoxControl() | ||
38 | { | ||
39 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(TextInputControl_KeyDown); | ||
40 | } | ||
41 | |||
42 | private List<string> CommandHistory = new List<string>(); | ||
43 | private bool InHistory = false; | ||
44 | private int HistoryPosition = -1; | ||
45 | |||
46 | void TextInputControl_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) | ||
47 | { | ||
48 | if (e.KeyCode == Keys.Enter && InHistory == false) | ||
49 | { | ||
50 | CommandHistory.Add(this.Text); | ||
51 | } | ||
52 | |||
53 | if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down) | ||
54 | { | ||
55 | // if not inside buffer, enter | ||
56 | // InBuffer = true | ||
57 | //Console.WriteLine("History: Check"); | ||
58 | if (InHistory == false) | ||
59 | { | ||
60 | if (this.Text != "") | ||
61 | { | ||
62 | //Console.WriteLine("History: Add"); | ||
63 | CommandHistory.Add(this.Text); | ||
64 | HistoryPosition = CommandHistory.Count; | ||
65 | } | ||
66 | else | ||
67 | { | ||
68 | //HistoryPosition = CommandHistory.Count + 1; | ||
69 | } | ||
70 | //Console.WriteLine("History: InHistory"); | ||
71 | InHistory = true; | ||
72 | } | ||
73 | |||
74 | if (e.KeyCode == Keys.Up) | ||
75 | HistoryPosition -= 1; | ||
76 | if (e.KeyCode == Keys.Down) | ||
77 | HistoryPosition += 1; | ||
78 | |||
79 | if (HistoryPosition > CommandHistory.Count - 1) | ||
80 | HistoryPosition = -1; | ||
81 | if (HistoryPosition < -1) | ||
82 | HistoryPosition = CommandHistory.Count - 1; | ||
83 | |||
84 | //Console.WriteLine("History: Pos: " + HistoryPosition); | ||
85 | //Console.WriteLine("History: HaveInHistCount: " + CommandHistory.Count); | ||
86 | if (CommandHistory.Count != 0) | ||
87 | { | ||
88 | if (HistoryPosition != -1) | ||
89 | { | ||
90 | //Console.WriteLine("History: Getting"); | ||
91 | //this.Text = CommandHistory.Item(HistoryPosition); | ||
92 | this.Text = CommandHistory[HistoryPosition]; | ||
93 | this.SelectionStart = this.Text.Length; | ||
94 | this.SelectionLength = 0; | ||
95 | } | ||
96 | else | ||
97 | { | ||
98 | //Console.WriteLine("History: Nothing"); | ||
99 | this.Text = ""; | ||
100 | } | ||
101 | } | ||
102 | e.Handled = true; | ||
103 | } | ||
104 | else | ||
105 | { | ||
106 | InHistory = false; | ||
107 | HistoryPosition = -1; | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | } | ||