コード例 #1
0
        public override void Draw()
        {
            byte C;

            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            B.FillChar((char)' ', 0x70, (int)Size.X);
            for (int i = 0; i <= Size.Y; i++)
            {
                if (i < 4)
                {
                    for (int j = 0; j <= 3; j++)
                    {
                        C = (byte)(i * 4 + j);
                        B.FillChar((char)ldBlockFull, C, 3, j * 3);
                        if (C == Color)
                        {
                            B.drawBuffer[j * 3 + 1].AsciiChar = '\x08';
                            if (C == 0)
                            {
                                B.drawBuffer[j * 3 + 1].Attribute = '\x70';
                            }
                        }
                    }
                }
                WriteLine(0, i, (int)Size.X, 1, B);
            }
        }
コード例 #2
0
        public override void Draw()
        {
            int        X, L;
            uint       CNormal, CSelect, CNormDisabled, CSelDisabled, Color;
            MenuItem   P;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            CNormal       = GetColor(0x0301);
            CSelect       = GetColor(0x0604);
            CNormDisabled = GetColor(0x0202);
            CSelDisabled  = GetColor(0x0505);
            B.FillChar(' ', CNormal, (byte)Size.X);
            if (Menu != null)
            {
                X = 1;
                P = Menu.Items;
                while (P != null)
                {
                    if (P.Name != "")
                    {
                        L = P.CNameLen();
                        if ((X + L) < Size.X)
                        {
                            if (P.Disabled)
                            {
                                if (P == Current)
                                {
                                    Color = CSelect;
                                }
                                else
                                {
                                    Color = CNormDisabled;
                                }
                            }
                            else
                            if (P == Current)
                            {
                                Color = CSelect;
                            }
                            else
                            {
                                Color = CNormal;
                            }
                            B.FillChar(' ', Color, 1, X);
                            B.FillCStr(P.Name, Color, X + 1);
                            B.FillChar(' ', Color, 1, X + L + 1);
                        }
                        X += L + 2;
                    }
                    P = P.Next;
                }
            }
            WriteBuf(0, 0, (byte)Size.X, 1, B);
        }
コード例 #3
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);
        }
コード例 #4
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));
        }
コード例 #5
0
        public override void Draw()
        {
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            B.FillChar((char)pattern, (byte)GetColor(1), (int)Size.X);
            WriteLine(0, 0, (int)Size.X, (int)Size.Y, B);
        }
コード例 #6
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);
        }
コード例 #7
0
ファイル: Label.cs プロジェクト: 10der/tvision
        public override void Draw()
        {
            uint       Color;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            byte       SCOff;

            if (Light)
            {
                Color = GetColor(0x0402);
                SCOff = 0;
            }
            else
            {
                Color = GetColor(0x0301);
                SCOff = 4;
            }
            B.FillChar(' ', Color, (int)Size.X);
            if (Text != "")
            {
                B.FillCStr(Text, Color, 0);
            }
            if (ShowMarkers)
            {
                B.drawBuffer[0].AsciiChar = (char)SpecialChars[SCOff];
            }
            WriteLine(0, 0, (int)Size.X, 1, B);
        }
コード例 #8
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);
            }
        }
コード例 #9
0
ファイル: Table.cs プロジェクト: 10der/tvision
        public override void Draw()
        {
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            uint Color = GetColor(6);

            for (int Y = 0; Y <= Size.Y - 1; Y++)
            {
                B.FillChar((char)' ', (byte)Color, (int)Size.X);
                for (int X = 0; X <= Size.X - 1; X++)
                {
                    B.FillChar((char)(32 * Y + X), (byte)Color, 1, X);
                }
                WriteLine(0, Y, (int)Size.X, 1, B);
            }
            ShowCursor();
        }
コード例 #10
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);
        }
コード例 #11
0
ファイル: ScrollBar.cs プロジェクト: 10der/tvision
        public void DrawPos(long Pos)
        {
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            long       S = GetSize() - 1;

            B.FillChar(chars[0], GetColor(2), 1, 0);
            if (Max == Min)
            {
                B.FillChar(chars[4], GetColor(1), (int)(S - 1), 1);
            }
            else
            {
                B.FillChar(chars[2], GetColor(1), (int)(S - 1), 1);
                B.FillChar(chars[3], GetColor(3), 1, (int)(Pos));
            }
            B.FillChar(chars[1], GetColor(2), 1, (int)S);
            WriteBuf(0, 0, (int)Size.X, (int)Size.Y, B);
        }
コード例 #12
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);
        }
コード例 #13
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);
        }
コード例 #14
0
ファイル: ClickTester.cs プロジェクト: 10der/tvision
        public override void Draw()
        {
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            byte       C;

            if (Clicked)
            {
                C = (byte)GetColor(2);
            }
            else
            {
                C = (byte)GetColor(1);
            }

            B.FillChar((char)' ', C, (int)Size.X);
            B.FillCStr(Text, C, 0);
            WriteLine(0, 0, (int)Size.X, 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);
            }
        }
コード例 #16
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);
        }
コード例 #17
0
ファイル: MenuBox.cs プロジェクト: 10der/tvision
 internal void FrameLine(int N, DrawBuffer B, uint CNormal, uint Color)
 {
     B.FillBuf(ldMenuFrameChars.Substring(N, 2), CNormal, 2);
     B.FillChar((char)ldMenuFrameChars[N + 2], Color, (int)(Size.X - 4), 2);
     B.FillBuf(ldMenuFrameChars.Substring(N + 3, 2), CNormal, 2, (int)(Size.X - 2));
 }
コード例 #18
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);
        }
コード例 #19
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);
        }
コード例 #20
0
        public override void Draw()
        {
            uint       Color;
            bool       Center;
            int        I, J, L, P, Y;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            string     S;

            Color = GetColor(1);
            S     = Text;
            L     = S.Length - 1;

            P = 0;
            Y = 0;

            Center = false;

            while (Y < Size.Y)
            {
                B.FillChar(' ', Color, Size.X);
                if (P <= L)
                {
                    if (S[P] == 0x03)
                    {
                        Center = true;
                        P++;
                    }
                    I = P;
                    do
                    {
                        J = P;
                        while ((P <= L) && (S[P] == ' '))
                        {
                            P++;
                        }
                        while ((P <= L) && (S[P] != ' ') && (S[P] != 0x0D))
                        {
                            P++;
                        }
                    }while(!((P > L) || (P >= (I + Size.X)) || (S[P] == 0x0D)));
                    if (P > I + Size.X)
                    {
                        if (J > I)
                        {
                            P = J;
                        }
                        else
                        {
                            P = I + Size.X;
                        }
                    }
                    if (Center)
                    {
                        J = (Size.X - P + I) / 2;
                    }
                    else
                    {
                        J = 0;
                    }
                    B.FillBuf(S.Substring(I), Color, (byte)(P - I), J);
                    while ((P <= L) && (S[P] == ' '))
                    {
                        P++;
                    }
                    if ((P <= L) && (S[P] == 0x0D))
                    {
                        Center = false;
                        P++;
                        if ((P <= L) && (S[P] == 0x0A))
                        {
                            P++;
                        }
                    }
                }
                WriteLine(0, Y, Size.X, 1, B);
                Y++;
            }
        }
コード例 #21
0
        public override void Draw()
        {
            uint       CFrame, CTitle;
            int        F, I, L, Width;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            string     Title;
            Point      Min, Max;

            if ((State & StateFlags.Dragging) != 0)
            {
                CFrame = 0x0505;
                CTitle = 0x0005;
                F      = 0;
            }
            else
            if ((State & StateFlags.Active) == 0)
            {
                CFrame = 0x0101;
                CTitle = 0x0002;
                F      = 0;
            }
            else
            {
                CFrame = 0x0503;
                CTitle = 0x0004;
                F      = 9;
            }
            CFrame = GetColor(CFrame);
            CTitle = GetColor(CTitle);
            Width  = (int)Size.X;
            L      = Width - 10;
            if (((Owner as Window).Flags & (WindowFlags.wfClose | WindowFlags.wfZoom)) != 0)
            {
                L -= 6;
            }
            FrameLine(B, 0, F, (byte)CFrame);
            if (((Owner as Window).Number != wnNoNumber) && ((Owner as Window).Number) < 10)
            {
                L -= 4;
                if (((Owner as Window).Flags & WindowFlags.wfZoom) != 0)
                {
                    I = 7;
                }
                else
                {
                    I = 3;
                }
                B.drawBuffer[Width - I].AsciiChar = (char)((Owner as Window).Number + 0x30);
            }
            if (Owner != null)
            {
                Title = (Owner as Window).GetTitle(L);
            }
            else
            {
                Title = "";
            }
            if (Title != "")
            {
                L = Title.Length;
                if (L > (Width - 10))
                {
                    L = Width - 10;
                }
                if (L < 0)
                {
                    L = 0;
                }
                I = (Width - L) >> 1;
                B.FillChar(' ', CTitle, 1, I - 1);
                B.FillBuf(Title, CTitle, (uint)L, I);
                B.FillChar(' ', CTitle, 1, I + L);
            }
            if ((State & StateFlags.Active) != 0)
            {
                if (((Owner as Window).Flags & WindowFlags.wfClose) != 0)
                {
                    if ((FrameMode & FrameModes.fmCloseClicked) == 0)
                    {
                        B.FillCStr(ldCloseWindow, CFrame, 2);
                    }
                    else
                    {
                        B.FillCStr(ldCloseClicked, CFrame, 2);
                    }
                }
                if (((Owner as Window).Flags & WindowFlags.wfZoom) != 0)
                {
                    B.FillCStr(ldMaximize, CFrame, Width - 5);
                    Owner.SizeLimits(out Min, out Max);
                    if ((FrameMode & FrameModes.fmZoomClicked) != 0)
                    {
                        B.drawBuffer[Width - 4].AsciiChar = '☼';
                    }
                    else
                    if ((Owner.Size.X == Max.X) && (Owner.Size.Y == Max.Y))
                    {
                        B.drawBuffer[Width - 4].AsciiChar = '↕';
                    }
                }
            }
            WriteLine(0, 0, (int)Size.X, 1, B);
            for (I = 1; I <= Size.Y - 2; I++)
            {
                FrameLine(B, I, F + 3, (byte)CFrame);
                WriteLine(0, I, (int)Size.X, 1, B);
            }
            FrameLine(B, (int)Size.Y - 1, F + 6, (byte)CFrame);
            if ((State & StateFlags.Active) != 0)
            {
                if (((Owner as Window).Flags & WindowFlags.wfGrow) != 0)
                {
                    B.FillCStr(ldBottomRight, CFrame, Width - 2);
                }
            }
            WriteLine(0, (int)Size.Y - 1, (int)Size.X, 1, B);
        }
コード例 #22
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);
            }
        }
コード例 #23
0
        public void DrawState(bool Down)
        {
            uint       CButton;
            uint       CShadow;
            char       Ch;
            int        I, S, Y, T;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            Ch = '\x00';
            if ((State & StateFlags.Disabled) != 0)
            {
                CButton = GetColor(0x0404);
            }
            else
            {
                CButton = GetColor(0x0501);
                if ((State & StateFlags.Active) != 0)
                {
                    if ((State & StateFlags.Selected) != 0)
                    {
                        CButton = GetColor(0x0703);
                    }
                    else
                    if (AmDefault)
                    {
                        CButton = GetColor(0x0602);
                    }
                }
            }
            CShadow = GetColor(8);
            S       = (int)(Size.X - 1);
            T       = (int)((Size.Y / 2) - 1);
            for (Y = 0; Y < Size.Y - 1; Y++)
            {
                B.FillChar((char)' ', CButton, (int)Size.X);
                B.drawBuffer[0].Attribute = CShadow;
                if (Down)
                {
                    B.drawBuffer[1].Attribute = CShadow;
                    Ch = ' ';
                    I  = 2;
                }
                else
                {
                    B.drawBuffer[S].Attribute = CShadow;
                    if (ShowMarkers)
                    {
                        Ch = ' ';
                    }
                    else
                    {
                        if (Y == 0)
                        {
                            B.drawBuffer[S].AsciiChar = ldBlockBottom;
                        }
                        else
                        {
                            B.drawBuffer[S].AsciiChar = ldBlockFull;
                        }
                        Ch = ldBlockTop;
                    }
                    I = 1;
                }
                if ((Y == T) && (Title != ""))
                {
                    DrawTitle(B, ref I, ref S, CButton, Down);
                }
                if (ShowMarkers && (!Down))
                {
                    B.drawBuffer[1].AsciiChar     = '[';
                    B.drawBuffer[S - 1].AsciiChar = ']';
                }
                WriteLine(0, Y, (int)Size.X, 1, B);
            }
            B.FillChar(' ', (byte)CShadow, 2, 0);
            B.FillChar(Ch, (byte)CShadow, S - 1, 2);
            WriteLine(0, (int)(Size.Y - 1), (int)(Size.X), 1, B);
        }