コード例 #1
0
ファイル: MoneyInput.cs プロジェクト: 10der/tvision
        public override void Draw()
        {
            DrawBuffer B             = new DrawBuffer(Size.X * Size.Y);
            string     DisplayString = "";

            if (CurrentDecimals == 0)
            {
                DisplayString = string.Format("{0," + (Size.X - 2).ToString() + ":N0}" + System.Globalization.CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator + " ", Value);
            }
            else if (CurrentDecimals < 0)
            {
                DisplayString = string.Format("{0," + (Size.X - 1).ToString() + ":N0} ", Value);
            }
            else
            {
                DisplayString = string.Format("{0," + (Size.X - 1).ToString() + ":N" + CurrentDecimals.ToString() + "} ", Value);
            }
            if ((State & StateFlags.Selected) != 0)
            {
                B.FillStr(DisplayString, (byte)GetColor(1), 0);
                ShowCursor();
            }
            else
            {
                B.FillStr(DisplayString, (byte)GetColor(1), 0);
                HideCursor();
            }
            WriteLine(0, 0, (int)Size.X, (int)Size.Y, B);
        }
コード例 #2
0
ファイル: Indicator.cs プロジェクト: 10der/tvision
        public override void Draw()
        {
            byte Color;
            char Frame;

            long[]     L = new long[2];
            string     S;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            if ((State & StateFlags.Dragging) == 0)
            {
                Color = (byte)GetColor(1);
                Frame = ldDblHorizontalBar;
            }
            else
            {
                Color = (byte)GetColor(2);
                Frame = ldHorizontalBar;
            }
            B.FillChar((char)Frame, Color, (int)Size.X);
            if (Modified)
            {
                B.drawBuffer[0].AsciiChar = (char)ldModified;
            }
            L[0] = Location.Y + 1;
            L[1] = Location.X + 1;
            S    = string.Format("{0:G}:{1:G}", L[0], L[1]);
            B.FillStr(S, Color, 8 - S.IndexOf(':', 0) + 1);
            WriteBuf(0, 0, (int)Size.X, 1, B);
        }
コード例 #3
0
        public override void Draw()
        {
            const int  Width = 20;
            int        DayOf, CurDays;
            string     S;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            uint       Color, BoldColor;

            Color     = (byte)GetColor(6);
            BoldColor = (byte)GetColor(7);
            DayOf     = (int)(new DateTime((int)Year, (int)Month, 1)).DayOfWeek;
            Days      = (byte)(DaysInMonth[(int)(Month - 1)]);
            if (((Year % 4) == 0) && (Month == 2))
            {
                Days++;
            }
            S = string.Format("{0:0000}", Year);
            B.FillChar(' ', Color, Width);
            B.FillCStr(string.Format("{0,-10} {1} \x1E \x1F", MonthStr[Month - 1], S), Color, 0);
            WriteLine(0, 0, Width, 1, B);
            B.FillChar(' ', Color, Width);
            B.FillStr(DayString, Color, 0);
            WriteLine(0, 1, Width, 1, B);
            CurDays = 1 - DayOf;
            for (int i = 1; i <= 6; i++)
            {
                for (int j = 0; j <= 6; j++)
                {
                    if ((CurDays < 1) || (CurDays > Days))
                    {
                        B.FillStr("   ", Color, j * 3);
                    }
                    else
                    if ((Year == CurYear) && (Month == CurMonth) && (CurDays == CurDay))
                    {
                        B.FillStr(string.Format("{0:00}", CurDays), BoldColor, j * 3);
                    }
                    else
                    {
                        B.FillStr(string.Format("{0:00}", CurDays), Color, j * 3);
                    }
                    CurDays++;
                }
                WriteLine(0, i + 1, Width, 1, B);
            }
        }
コード例 #4
0
        public override void Draw()
        {
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            uint       C = GetColor(2);

            B.FillChar((char)' ', (byte)C, (int)Size.X);
            B.FillStr(TimeStr, (byte)C, 0);
            WriteLine(0, 0, (int)Size.X, 1, B);
        }
コード例 #5
0
        public override void Draw()
        {
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            OldMem = GC.GetTotalMemory(false);
            string S = string.Format("{0:G" + Size.X.ToString() + "}", OldMem);
            byte   C = (byte)GetColor(2);

            B.FillChar((char)' ', C, (int)Size.X);
            B.FillStr(S, C, 0);
            WriteLine(0, 0, (int)Size.X, 1, B);
        }
コード例 #6
0
ファイル: CalcDisplay.cs プロジェクト: 10der/tvision
        public override void Draw()
        {
            byte       Color;
            int        I;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            Color = (byte)GetColor(1);
            I     = (int)(Size.X - Number.Length - 2);
            B.FillChar(' ', Color, (int)Size.X);
            B.FillChar(Sign, Color, 1, I);
            B.FillStr(Number, Color, I + 1);
            WriteBuf(0, 0, (int)Size.X, 1, B);
        }
コード例 #7
0
ファイル: Cluster.cs プロジェクト: 10der/tvision
        public void DrawMultiBox(string Icon, string Marker)
        {
            int        Cur, Col;
            uint       CNorm, CSel, CDis, Color;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            CNorm = GetColor(0x0301);
            CSel  = GetColor(0x0402);
            CDis  = GetColor(0x0505);

            for (int i = 0; i <= Size.Y; i++)
            {
                B.FillChar(' ', (byte)CNorm, Size.X);
                for (int j = 0; j <= ((Strings.Count / Size.Y) + 1); j++)
                {
                    Cur = (int)(j * Size.Y + i);
                    if (Cur < Strings.Count)
                    {
                        Col = Column(Cur);
                        if (((Col + ItemCLen(Strings[Cur]) + 5) <
                             (B.drawBuffer.Length)) && (Col < Size.X))
                        {
                            if (!ButtonState(Cur))
                            {
                                Color = CDis;
                            }
                            else
                            if ((Cur == Sel) && ((State & StateFlags.Focused) != 0))
                            {
                                Color = CSel;
                            }
                            else
                            {
                                Color = CNorm;
                            }
                            B.FillChar((char)' ', (byte)Color, (int)Size.X - Col, Col);
                            B.FillStr(Icon, (byte)Color, Col);
                            B.drawBuffer[Col + 2].AsciiChar = (char)Marker[MultiMark(Cur)];
                            B.FillCStr(Strings[Cur], (uint)Color, Col + 5);
                            if (ShowMarkers && ((State & StateFlags.Focused) != 0) && (Cur == Sel))
                            {
                                B.drawBuffer[Col].AsciiChar = (char)SpecialChars[0];
                                B.drawBuffer[Column((int)(Cur + Size.Y)) - 1].AsciiChar = (char)SpecialChars[1];
                            }
                        }
                    }
                }
                WriteBuf(0, i, (int)Size.X, 1, B);
            }
            SetCursor(Column(Sel) + 2, Row(Sel));
        }
コード例 #8
0
ファイル: ColorDisplay.cs プロジェクト: 10der/tvision
        public override void Draw()
        {
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            byte       C = Color;

            if (C == 0)
            {
                C = ErrorAttr;
            }
            for (int i = 0; i <= (Size.X / Text.Length); i++)
            {
                B.FillStr(Text, C, i * Text.Length);
            }
            WriteLine(0, 0, (int)Size.X, (int)Size.Y, B);
        }
コード例 #9
0
ファイル: DateInput.cs プロジェクト: 10der/tvision
        public override void Draw()
        {
            DrawBuffer B             = new DrawBuffer(Size.X * Size.Y);
            string     DisplayString = string.Format(" {0,2:D2}.{1,2:D2}.{2,4:D4} ", Day, Month, Year);

            B.FillStr(DisplayString, (byte)GetColor(1), 0);
            if ((State & StateFlags.Selected) != 0)
            {
                ShowCursor();
            }
            else
            {
                HideCursor();
            }
            WriteLine(0, 0, (int)Size.X, (int)Size.Y, B);
        }
コード例 #10
0
ファイル: InputLine.cs プロジェクト: 10der/tvision
        public override void Draw()
        {
            uint       Color;
            int        L, R;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            if ((State & StateFlags.Focused) == 0)
            {
                Color = GetColor(1);
            }
            else
            {
                Color = GetColor(2);
            }
            B.FillChar((char)' ', Color, (int)Size.X);
            B.FillStr((Data + new string(' ', (int)Size.X)).Substring(FirstPos, (int)(Size.X - 2)), Color, 1);
            if (CanScroll(1))
            {
                B.FillChar(ldRightScroll, GetColor(4), 1, (int)Size.X - 1);
            }
            if ((State & StateFlags.Focused) != 0)
            {
                if (CanScroll(-1))
                {
                    B.FillChar(ldLeftScroll, GetColor(4), 1);
                }
                L = SelStart - FirstPos;
                R = SelEnd - FirstPos;
                if (L < 0)
                {
                    L = 0;
                }
                if (R > (Size.X - 2))
                {
                    R = (int)Size.X - 2;
                }
                if (L < R)
                {
                    B.FillChar('\x00', GetColor(3), R - L, L + 1);
                }
            }
            WriteLine(0, 0, (int)Size.X, (int)Size.Y, B);
            SetCursor(CurPos - FirstPos + 1, 0);
        }
コード例 #11
0
ファイル: MenuBox.cs プロジェクト: 10der/tvision
        public override void Draw()
        {
            uint       CNormal, CSelect, CNormDisabled, CSelDisabled, Color;
            int        Y;
            MenuItem   P;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            CNormal       = GetColor(0x0301);
            CSelect       = GetColor(0x0604);
            CNormDisabled = GetColor(0x0202);
            CSelDisabled  = GetColor(0x0505);

            Y     = 0;
            Color = CNormal;
            FrameLine(0, B, CNormal, Color);
            DrawLine(ref Y, B);
            if (Menu != null)
            {
                P = Menu.Items;
                while (P != null)
                {
                    Color = CNormal;
                    if (P.Name == "")
                    {
                        FrameLine(15, B, (byte)CNormal, (byte)Color);
                    }
                    else
                    {
                        if (P.Disabled)
                        {
                            if (P == Current)
                            {
                                Color = CSelDisabled;
                            }
                            else
                            {
                                Color = CNormDisabled;
                            }
                        }
                        else
                        if (P == Current)
                        {
                            Color = CSelect;
                        }
                        FrameLine(10, B, CNormal, Color);
                        B.FillCStr(P.Name, Color, 3);
                        if (P.Command == 0)
                        {
                            B.FillChar(ldSubMenuArrow, Color, 1, (int)Size.X - 4);
                        }
                        else
                        if (P.Param != "")
                        {
                            B.FillStr(P.Param, Color, (int)Size.X - 3 - P.Param.Length);
                        }
                    }
                    DrawLine(ref Y, B);
                    P = P.Next;
                }
            }
            Color = CNormal;
            FrameLine(5, B, CNormal, Color);
            DrawLine(ref Y, B);
        }
コード例 #12
0
ファイル: StatusLine.cs プロジェクト: 10der/tvision
        public void DrawSelect(StatusItem Selected)
        {
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            int        I, L;
            StatusItem T;
            uint       CSelect, CNormal, CSelDisabled, CNormDisabled;
            uint       Color;
            string     HintBuf;

            CNormal       = GetColor(0x0301);
            CSelect       = GetColor(0x0604);
            CNormDisabled = GetColor(0x0202);
            CSelDisabled  = GetColor(0x0505);

            B.FillChar(' ', CNormal, (int)Size.X);
            T = Items;
            I = 0;
            while (T != null)
            {
                if (T.Text != "")
                {
                    L = T.CTextLen();
                    if (((I + L) - 1) < Size.X)
                    {
                        if (CommandEnabled(T.Command))
                        {
                            if (T == Selected)
                            {
                                Color = CSelect;
                            }
                            else
                            {
                                Color = CNormal;
                            }
                        }
                        else
                        if (T == Selected)
                        {
                            Color = CSelDisabled;
                        }
                        else
                        {
                            Color = CNormDisabled;
                        }
                        B.FillCStr(T.Text, Color, I);
                        B.FillChar(' ', CNormal, 1, (int)I + L);
                    }
                    I += (L + 1);
                }
                T = T.Next;
            }
            if (I < (Size.X - 2))
            {
                HintBuf = Hint(HelpCtx);
                if (HintBuf != "")
                {
                    B.FillChar(ldVerticalBar, CNormal, 1, I);
                    I += 2;
                    if ((I + HintBuf.Length) > Size.X)
                    {
                        HintBuf = HintBuf.Substring(0, (int)Size.X);
                    }
                    B.FillStr(HintBuf, CNormal, I);
                }
            }
            WriteLine(0, 0, (int)Size.X, 1, B);
        }
コード例 #13
0
        public override void Draw()
        {
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            string     D;
            string     M;
            bool       PM;
            byte       Color;
            DateTime   Time;
            string     Path;
            string     FmtId;

            object[] Params = new object[8];
            string   Str;

            const string sDirectoryLine = " {0,-12} {1,12} {2,-20}";
            const string sFileLine      = " {0,-12} {1,12:G} {2,-20}";

            string[] Month = new string[12];

            Month[0]  = "Jan";
            Month[1]  = "Feb";
            Month[2]  = "Mar";
            Month[3]  = "Apr";
            Month[4]  = "May";
            Month[5]  = "Jun";
            Month[6]  = "Jul";
            Month[7]  = "Aug";
            Month[8]  = "Sep";
            Month[9]  = "Oct";
            Month[10] = "Nov";
            Month[11] = "Dec";

            D = "";

            Path  = (Owner as FileDialog).Directory + (Owner as FileDialog).WildCard;
            Color = (byte)GetColor(0x01);
            B.FillChar((char)' ', Color, (int)Size.X);
            B.FillStr(Path, Color, 1);
            WriteLine(0, 0, (int)Size.X, 1, B);
            B.FillChar((char)' ', Color, (int)Size.X);

            if ((S.Attributes & FileAttributes.Directory) != 0)
            {
                FmtId = sDirectoryLine;
                D     = "Directory";
            }
            else
            {
                FmtId     = sFileLine;
                Params[0] = S.Length;
            }
            Time      = S.CreationTime;
            M         = Month[Time.Month - 1];
            Params[2] = M;
            Params[3] = Time.Day;
            Params[4] = Time.Year;
            PM        = (Time.Hour >= 12);
            Time      = new DateTime(Time.Year, Time.Month, Time.Day, Time.Hour % 12, Time.Minute, Time.Second);
            if (Time.Hour == 0)
            {
                Time = new DateTime(Time.Year, Time.Month, Time.Day, 0, Time.Minute, Time.Second);
            }
            Params[5] = Time.Hour;
            Params[6] = Time.Minute;
            if (PM)
            {
                Params[7] = (byte)'p';
            }
            else
            {
                Params[7] = (byte)'a';
            }
            if ((S.Attributes & FileAttributes.Directory) != 0)
            {
                Str = string.Format(FmtId,
                                    (S.Name + "            ").Substring(0, 12), D, Time.ToString("dd.MM.yyyy hh:mm:ss"));
            }
            else
            {
                Str = string.Format(FmtId,
                                    (S.Name + "            ").Substring(0, 12), S.Length, Time.ToString("dd.MM.yyyy hh:mm:ss"));
            }
            B.FillStr(Str, Color, 0);
            WriteLine(0, 1, (int)Size.X, 1, B);
            B.FillChar(' ', Color, (int)Size.X, 0);
            WriteLine(0, 2, (int)Size.X, (int)(Size.Y - 2), B);
        }
コード例 #14
0
        public override void Draw()
        {
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            string     S1;

            byte[] Color = new byte[2];
            byte   ColorBack;

            byte[] Map = new byte[15];
            Map[0] = 0;
            Map[1] = 1;
            Map[2] = 0;
            Map[3] = 1;

            Map[4] = 1;
            Map[5] = 0;
            Map[6] = 1;
            Map[7] = 0;

            Map[8]  = 0;
            Map[9]  = 1;
            Map[10] = 0;
            Map[11] = 1;

            Map[12] = 1;
            Map[13] = 0;
            Map[14] = 1;

            Color[0]  = (byte)GetColor(1);
            Color[1]  = (byte)GetColor(2);
            ColorBack = (byte)GetColor(1);

            if (Solved)
            {
                Color[1] = Color[0];
            }
            else
            {
                Color[1] = (byte)GetColor(2);
            }
            for (int i = 0; i < 4; i++)
            {
                B.FillChar((char)' ', ColorBack, 18);
                if (i == 1)
                {
                    B.FillStr("Move", ColorBack, 13);
                }
                if (i == 2)
                {
                    S1 = string.Format("{0:G3}", Moves);
                    B.FillStr(S1, ColorBack, 14);
                }
                for (int j = 0; j < 4; j++)
                {
                    S1 = " " + (char)Board[i, j] + " ";
                    if (Board[i, j] == ' ')
                    {
                        B.FillStr(S1, Color[0], j * 3);
                    }
                    else
                    {
                        B.FillStr(S1, Color[Map[Board[i, j] - 65]], j * 3);
                    }
                }
                WriteLine(0, i, 18, 1, B);
            }
        }
コード例 #15
0
        public override void Draw()
        {
            int        Item;
            uint       NormalColor;
            uint       SelectedColor;
            uint       FocusedColor;
            uint       Color;
            int        ColWidth, CurCol, Indent;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            string     Text;
            byte       SCOff;

            FocusedColor = 0;
            if ((State & (StateFlags.Selected | StateFlags.Active)) == (StateFlags.Selected | StateFlags.Active))
            {
                NormalColor   = GetColor(1);
                FocusedColor  = GetColor(3);
                SelectedColor = GetColor(4);
            }
            else
            {
                NormalColor   = GetColor(2);
                SelectedColor = GetColor(4);
            }
            if (HScrollBar != null)
            {
                Indent = HScrollBar.Value;
            }
            else
            {
                Indent = 0;
            }
            ColWidth = (int)(Size.X / NumCols + 1);
            for (int i = 0; i < Size.Y; i++)
            {
                for (int j = 0; j < NumCols; j++)
                {
                    Item   = (int)(j * Size.Y + i + TopItem);
                    CurCol = j * ColWidth;
                    if (((State & (StateFlags.Selected | StateFlags.Active)) == (StateFlags.Selected | StateFlags.Active)) &&
                        (Focused == Item) && (Range > 0))
                    {
                        Color = FocusedColor;
                        SetCursor(CurCol + 1, i);
                        SCOff = 0;
                    }
                    else
                    if ((Item < Range) && IsSelected(Item))
                    {
                        Color = SelectedColor;
                        SCOff = 2;
                    }
                    else
                    {
                        Color = NormalColor;
                        SCOff = 4;
                    }
                    B.FillChar(' ', Color, ColWidth, CurCol);
                    if (Item < Range)
                    {
                        Text = GetText(Item, ColWidth + Indent);
                        Text = (Text + new string(' ', ColWidth)).Substring(Indent, ColWidth);
                        B.FillStr(Text, Color, (int)CurCol + 1);
                        if (ShowMarkers)
                        {
                            B.drawBuffer[CurCol].AsciiChar = SpecialChars[SCOff];
                            B.drawBuffer[CurCol + ColWidth - 2].AsciiChar = SpecialChars[SCOff + 1];
                        }
                    }
                    B.FillChar(ldVerticalBar, GetColor(5), 1, (int)CurCol + ColWidth - 1);
                }
                WriteLine(0, i, (int)Size.X, 1, B);
            }
        }