TxUI broke sometime over the course of the new builder, it should be fixed now.

This commit is contained in:
Xenni_cp 2009-06-10 20:27:16 +00:00
parent e78a5bda65
commit e26bed4101

View file

@ -8,6 +8,14 @@ namespace Cosmos.Playground.Xenni.TxUI
{ {
public sealed class TxUIManager public sealed class TxUIManager
{ {
public static void Beep()
{
PIT.EnableSound();
PIT.T2Frequency = 2048;
PIT.Wait(250);
PIT.DisableSound();
}
public static TxUIManager Instance = null; public static TxUIManager Instance = null;
private List<TxCtrl> Controls = new List<TxCtrl>(); private List<TxCtrl> Controls = new List<TxCtrl>();
private TxCtrl FocusTarget = null; private TxCtrl FocusTarget = null;
@ -215,7 +223,7 @@ namespace Cosmos.Playground.Xenni.TxUI
default: default:
if (FocusTarget == null || !FocusTarget.OnKeyPress(c)) if (FocusTarget == null || !FocusTarget.OnKeyPress(c))
{ {
Console.Beep(2048, 250); TxUIManager.Beep();
} }
break; break;
} }
@ -620,7 +628,7 @@ namespace Cosmos.Playground.Xenni.TxUI
case '\u0968': case '\u0968':
if (_CursorPosX == 0) if (_CursorPosX == 0)
{ {
Console.Beep(2048, 250); TxUIManager.Beep();
break; break;
} }
Lines[_CursorPosY] = Lines[_CursorPosY].Substring(0, _CursorPosX - 1) + Lines[_CursorPosY].Substring(_CursorPosX, Lines[_CursorPosY].Length - _CursorPosX); Lines[_CursorPosY] = Lines[_CursorPosY].Substring(0, _CursorPosX - 1) + Lines[_CursorPosY].Substring(_CursorPosX, Lines[_CursorPosY].Length - _CursorPosX);
@ -640,7 +648,7 @@ namespace Cosmos.Playground.Xenni.TxUI
} }
if (_CursorPosY == 0) if (_CursorPosY == 0)
{ {
Console.Beep(2048, 250); TxUIManager.Beep();
break; break;
} }
@ -658,7 +666,7 @@ namespace Cosmos.Playground.Xenni.TxUI
} }
if (_CursorPosY == (Height - 1)) if (_CursorPosY == (Height - 1))
{ {
Console.Beep(2048, 250); TxUIManager.Beep();
break; break;
} }
@ -672,7 +680,7 @@ namespace Cosmos.Playground.Xenni.TxUI
default: default:
if (_CursorPosX == Width || Lines[_CursorPosY].Length == Width) if (_CursorPosX == Width || Lines[_CursorPosY].Length == Width)
{ {
Console.Beep(2048, 250); TxUIManager.Beep();
break; break;
} }
Lines[_CursorPosY] = Lines[_CursorPosY].Substring(0, _CursorPosX) + c.ToString() + Lines[_CursorPosY].Substring(_CursorPosX, Lines[_CursorPosY].Length - _CursorPosX); Lines[_CursorPosY] = Lines[_CursorPosY].Substring(0, _CursorPosX) + c.ToString() + Lines[_CursorPosY].Substring(_CursorPosX, Lines[_CursorPosY].Length - _CursorPosX);
@ -704,17 +712,17 @@ namespace Cosmos.Playground.Xenni.TxUI
if (value < 0) if (value < 0)
{ {
value = 0; value = 0;
Console.Beep(2048, 250); TxUIManager.Beep();
} }
if (value > Width) if (value > Width)
{ {
value = Width; value = Width;
Console.Beep(2048, 250); TxUIManager.Beep();
} }
if (value > Lines[_CursorPosY].Length) if (value > Lines[_CursorPosY].Length)
{ {
value = Lines[_CursorPosY].Length; value = Lines[_CursorPosY].Length;
Console.Beep(2048, 250); TxUIManager.Beep();
} }
_CursorPosX = value; _CursorPosX = value;
@ -732,12 +740,12 @@ namespace Cosmos.Playground.Xenni.TxUI
if (value < 0) if (value < 0)
{ {
value = 0; value = 0;
Console.Beep(2048, 250); TxUIManager.Beep();
} }
if (value >= Height) if (value >= Height)
{ {
value = (Height - 1); value = (Height - 1);
Console.Beep(2048, 250); TxUIManager.Beep();
} }
_CursorPosY = value; _CursorPosY = value;