Ejemplo n.º 1
0
    public void KeyDownProcessor(char key)
    {
        if (key == 13)
        {
            return;
        }
        CursorController cursor = Typer.Cursor;

        if (key == '\b')
        {
            if (_command.Length + 1 == Typer.PositionX)
            {
                Typer.MoveCursor(true);
                _screen.TypeChar(0, cursor.x, cursor.y);
                _screen.Apply();
                if (!string.IsNullOrEmpty(_command))
                {
                    DeleteLastChar();
                }
            }
            else
            {
                Typer.MoveCursor(true);
                _command = _command.Substring(0, Typer.PositionX - 1) + _command.Substring(Typer.PositionX);
                int x = cursor.x;
                cursor.SetPosition(Typer.borderWidth, cursor.y);
                Typer.Print(">" + _command + " ");
                cursor.SetPosition(x, cursor.y);
                _screen.Apply();
            }
        }
        else if (_command.Length + 1 == Typer.PositionX)
        {
            if (cursor.x == DisplaySystem.COLS - 1 - Typer.borderWidth)
            {
                return;
            }
            _screen.TypeChar(Utils.GetCharNumber(key), cursor.x, cursor.y);
            cursor.Next();
            _command = _command + key;
            _screen.Apply();
        }
        else if (!string.IsNullOrEmpty(_command))
        {
            if (_command.Length > DisplaySystem.COLS - 3 - Typer.borderWidth)
            {
                return;
            }
            InsertToString(key);
        }
    }
Ejemplo n.º 2
0
    public void DrawBorder()
    {
        Color tmp = Screen.GetFontColor();

        Screen.SetFontColor(borderColor);
        for (int i = 0; i < DisplaySystem.COLS; i++)
        {
            for (int j = 0; j < borderHeight; j++)
            {
                Screen.TypeChar(1, i, j);
                Screen.TypeChar(1, i, DisplaySystem.LINES - 1 - j);
            }
        }
        for (int i = 0; i < DisplaySystem.LINES; i++)
        {
            for (int j = 0; j < borderWidth; j++)
            {
                Screen.TypeChar(1, j, i);
                Screen.TypeChar(1, DisplaySystem.COLS - 1 - j, i);
            }
        }
        Screen.SetFontColor(tmp);
    }
Ejemplo n.º 3
0
        private void ClearPage()
        {
            screen.ResetInvertBlock(typer.Cursor.x, typer.Cursor.y);
            typer.Cursor.SetPosition(typer.borderWidth, typer.borderHeight);
            screen.Clear();
            typer.DrawBorder();
            int step = 4;

            foreach (char c in openedFile)
            {
                screen.TypeChar(Utils.GetCharNumber(c), step++, 0, screen.GetBackColor(), typer.GetBorderColor());
            }
            step = DisplaySystem.COLS / 2;
            foreach (char c in "ctrl+Q to exit")
            {
                screen.TypeChar(Utils.GetCharNumber(c), step++, DisplaySystem.LINES - 1, screen.GetBackColor(), typer.GetBorderColor());
            }
            step = DisplaySystem.COLS / 2;
            foreach (char c in saved ? "    saved" : "ctrl+S to save")
            {
                screen.TypeChar(Utils.GetCharNumber(c), step++, 0, screen.GetBackColor(), typer.GetBorderColor());
            }
        }
Ejemplo n.º 4
0
 void TyperChar(int x, int y, int c)
 {
     _console.Invoker.Add(() => _display.TypeChar(c, x, y));
 }