aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs176
1 files changed, 88 insertions, 88 deletions
diff --git a/OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs b/OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs
index 91b3f60..47ff65a 100644
--- a/OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs
+++ b/OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs
@@ -1,88 +1,88 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.Windows.Forms; 4using System.Windows.Forms;
5 5
6namespace OpenSim.GUI 6namespace OpenSim.GUI
7{ 7{
8 class InputTextBoxControl:System.Windows.Forms.TextBox 8 class InputTextBoxControl:System.Windows.Forms.TextBox
9 { 9 {
10 public InputTextBoxControl() 10 public InputTextBoxControl()
11 { 11 {
12 this.KeyDown += new System.Windows.Forms.KeyEventHandler(TextInputControl_KeyDown); 12 this.KeyDown += new System.Windows.Forms.KeyEventHandler(TextInputControl_KeyDown);
13 } 13 }
14 14
15 15
16 private List<string> CommandHistory = new List<string>(); 16 private List<string> CommandHistory = new List<string>();
17 private bool InHistory = false; 17 private bool InHistory = false;
18 private int HistoryPosition = -1; 18 private int HistoryPosition = -1;
19 19
20 void TextInputControl_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) 20 void TextInputControl_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
21 { 21 {
22 22
23 23
24 if (e.KeyCode == Keys.Enter && InHistory == false) 24 if (e.KeyCode == Keys.Enter && InHistory == false)
25 { 25 {
26 CommandHistory.Add(this.Text); 26 CommandHistory.Add(this.Text);
27 } 27 }
28 28
29 29
30 if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down) 30 if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
31 { 31 {
32 // if not inside buffer, enter 32 // if not inside buffer, enter
33 // InBuffer = true 33 // InBuffer = true
34 //Console.WriteLine("History: Check"); 34 //Console.WriteLine("History: Check");
35 if (InHistory == false) 35 if (InHistory == false)
36 { 36 {
37 if (this.Text != "") 37 if (this.Text != "")
38 { 38 {
39 //Console.WriteLine("History: Add"); 39 //Console.WriteLine("History: Add");
40 CommandHistory.Add(this.Text); 40 CommandHistory.Add(this.Text);
41 HistoryPosition = CommandHistory.Count; 41 HistoryPosition = CommandHistory.Count;
42 } 42 }
43 else 43 else
44 { 44 {
45 //HistoryPosition = CommandHistory.Count + 1; 45 //HistoryPosition = CommandHistory.Count + 1;
46 } 46 }
47 //Console.WriteLine("History: InHistory"); 47 //Console.WriteLine("History: InHistory");
48 InHistory = true; 48 InHistory = true;
49 } 49 }
50 50
51 if (e.KeyCode == Keys.Up) 51 if (e.KeyCode == Keys.Up)
52 HistoryPosition -= 1; 52 HistoryPosition -= 1;
53 if (e.KeyCode == Keys.Down) 53 if (e.KeyCode == Keys.Down)
54 HistoryPosition += 1; 54 HistoryPosition += 1;
55 55
56 if (HistoryPosition > CommandHistory.Count - 1) 56 if (HistoryPosition > CommandHistory.Count - 1)
57 HistoryPosition = -1; 57 HistoryPosition = -1;
58 if (HistoryPosition < -1) 58 if (HistoryPosition < -1)
59 HistoryPosition = CommandHistory.Count - 1; 59 HistoryPosition = CommandHistory.Count - 1;
60 60
61 //Console.WriteLine("History: Pos: " + HistoryPosition); 61 //Console.WriteLine("History: Pos: " + HistoryPosition);
62 //Console.WriteLine("History: HaveInHistCount: " + CommandHistory.Count); 62 //Console.WriteLine("History: HaveInHistCount: " + CommandHistory.Count);
63 if (CommandHistory.Count != 0) 63 if (CommandHistory.Count != 0)
64 { 64 {
65 if (HistoryPosition != -1) 65 if (HistoryPosition != -1)
66 { 66 {
67 //Console.WriteLine("History: Getting"); 67 //Console.WriteLine("History: Getting");
68 //this.Text = CommandHistory.Item(HistoryPosition); 68 //this.Text = CommandHistory.Item(HistoryPosition);
69 this.Text = CommandHistory[HistoryPosition]; 69 this.Text = CommandHistory[HistoryPosition];
70 this.SelectionStart = this.Text.Length; 70 this.SelectionStart = this.Text.Length;
71 this.SelectionLength = 0; 71 this.SelectionLength = 0;
72 } 72 }
73 else 73 else
74 { 74 {
75 //Console.WriteLine("History: Nothing"); 75 //Console.WriteLine("History: Nothing");
76 this.Text = ""; 76 this.Text = "";
77 } 77 }
78 } 78 }
79 e.Handled = true; 79 e.Handled = true;
80 } else { 80 } else {
81 InHistory = false; 81 InHistory = false;
82 HistoryPosition = -1; 82 HistoryPosition = -1;
83 } 83 }
84 } 84 }
85 85
86 86
87 } 87 }
88} 88}