Example #1
0
        public void ShowCaret(System.Drawing.Graphics CurGraphics)
        {
            //prntSome.printSome("ShowCaret");
            System.Int32 X = this.Caret.Pos.X;
            System.Int32 Y = this.Caret.Pos.Y;

            if (this.Caret.IsOff == true)
            {
                return;
            }

            // paint a rectangle over the cursor position
            CurGraphics.DrawImageUnscaled(
                this.Caret.Bitmap,
                X * (int)this.CharSize.Width,
                Y * (int)this.CharSize.Height);

            // if we don't have a char to redraw then leave
            if (this.CharGrid[Y][X] == '\0')
            {
                return;
            }

            CharAttribs CurAttribs = new CharAttribs();

            CurAttribs.UseAltColor = true;

            CurAttribs.GL = this.AttribGrid[Y][X].GL;
            CurAttribs.GR = this.AttribGrid[Y][X].GR;
            CurAttribs.GS = this.AttribGrid[Y][X].GS;

            if (this.AttribGrid[Y][X].UseAltBGColor == false)
            {
                CurAttribs.AltColor = this.BackColor;
            }
            else if (this.AttribGrid[Y][X].UseAltBGColor == true)
            {
                CurAttribs.AltColor = this.AttribGrid[Y][X].AltBGColor;
            }

            CurAttribs.IsUnderscored = this.AttribGrid[Y][X].IsUnderscored;
            CurAttribs.IsDECSG       = this.AttribGrid[Y][X].IsDECSG;

            // redispay the current char in the background colour
            this.ShowChar(
                CurGraphics,
                this.CharGrid[Y][X],
                Caret.Pos.Y * this.CharSize.Height,
                Caret.Pos.X * this.CharSize.Width,
                CurAttribs);
        }
Example #2
0
        public void AssignColors(
            CharAttribs          CurAttribs,
            ref System.Drawing.Color CurFGColor,
            ref System.Drawing.Color CurBGColor)
        {
            //prntSome.printSome("AssignColors");
            CurFGColor = this.FGColor;
            CurBGColor = this.BackColor;

            if (CurAttribs.IsBlinking == true)
            {
                CurFGColor = this.BlinkColor;
            }

            // bold takes precedence over the blink color
            if (CurAttribs.IsBold == true)
            {
                CurFGColor = this.BoldColor;
            }

            if (CurAttribs.UseAltColor == true)
            {
                CurFGColor = CurAttribs.AltColor;
            }

            // alternate color takes precedence over the bold color
            if (CurAttribs.UseAltBGColor == true)
            {
                CurBGColor = CurAttribs.AltBGColor;
            }

            if (CurAttribs.IsInverse == true)
            {
                System.Drawing.Color TmpColor = CurBGColor;

                CurBGColor = CurFGColor;
                CurFGColor = TmpColor;
            }

            // If light background is on and we're not using alt colors
            // reverse the colors
            if ((this.Modes.Flags & uc_Mode.LightBackground) > 0 &&
                CurAttribs.UseAltColor == false && CurAttribs.UseAltBGColor == false)
            {

                System.Drawing.Color TmpColor = CurBGColor;

                CurBGColor = CurFGColor;
                CurFGColor = TmpColor;
            }
        }
Example #3
0
        public void AssignColors(
            CharAttribs CurAttribs,
            ref System.Drawing.Color CurFGColor,
            ref System.Drawing.Color CurBGColor)
        {
            //prntSome.printSome("AssignColors");
            CurFGColor = this.FGColor;
            CurBGColor = this.BackColor;

            if (CurAttribs.IsBlinking == true)
            {
                CurFGColor = this.BlinkColor;
            }

            // bold takes precedence over the blink color
            if (CurAttribs.IsBold == true)
            {
                CurFGColor = this.BoldColor;
            }

            if (CurAttribs.UseAltColor == true)
            {
                CurFGColor = CurAttribs.AltColor;
            }

            // alternate color takes precedence over the bold color
            if (CurAttribs.UseAltBGColor == true)
            {
                CurBGColor = CurAttribs.AltBGColor;
            }

            if (CurAttribs.IsInverse == true)
            {
                System.Drawing.Color TmpColor = CurBGColor;

                CurBGColor = CurFGColor;
                CurFGColor = TmpColor;
            }

            // If light background is on and we're not using alt colors
            // reverse the colors
            if ((this.Modes.Flags & uc_Mode.LightBackground) > 0 &&
                CurAttribs.UseAltColor == false && CurAttribs.UseAltBGColor == false)
            {
                System.Drawing.Color TmpColor = CurBGColor;

                CurBGColor = CurFGColor;
                CurFGColor = TmpColor;
            }
        }
Example #4
0
 public uc_CaretAttribs(
     System.Drawing.Point p1,
     uc_Chars.Sets p2,
     uc_Chars.Sets p3,
     uc_Chars.Sets p4,
     uc_Chars.Sets p5,
     CharAttribs p6)
 {
     //prntSome.printSome("uc_CaretAttribs");
     this.Pos     = p1;
     this.G0Set   = p2;
     this.G1Set   = p3;
     this.G2Set   = p4;
     this.G3Set   = p5;
     this.Attribs = p6;
 }
Example #5
0
        public void ShowChar(
            System.Drawing.Graphics CurGraphics,
            System.Char             CurChar,
            System.Int32            Y,
            System.Int32            X,
            CharAttribs             CurAttribs)
        {
            //prntSome.printSome("ShowChar");
            if (CurChar == '\0')
            {
                return;
            }

            System.Drawing.Color CurFGColor = System.Drawing.Color.White;
            System.Drawing.Color CurBGColor = System.Drawing.Color.Black;

            this.AssignColors (CurAttribs, ref CurFGColor, ref CurBGColor);

            if ((CurBGColor != this.BackColor && (this.Modes.Flags & uc_Mode.LightBackground) == 0) ||
                (CurBGColor != this.FGColor   && (this.Modes.Flags & uc_Mode.LightBackground) > 0))
            {

                // Erase the current Character underneath the cursor postion
                this.EraseBuffer.Clear (CurBGColor);

                // paint a rectangle over the cursor position in the character's BGColor
                CurGraphics.DrawImageUnscaled (
                    this.EraseBitmap,
                    X,
                    Y);
            }

            if (CurAttribs.IsUnderscored)
            {
                CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1),
                    X,                       Y + this.UnderlinePos,
                    X + this.CharSize.Width, Y + this.UnderlinePos);
            }

            /*VT220*/
            /*
            if ((CurAttribs.IsDECSG == true) &&
                (CurChar == 'l' ||
                 CurChar == 'q' ||
                 CurChar == 'w' ||
                 CurChar == 'k' ||
                 CurChar == 'x' ||
                 CurChar == 't' ||
                 CurChar == 'n' ||
                 CurChar == 'u' ||
                 CurChar == 'm' ||
                 CurChar == 'v' ||
                 CurChar == 'j' ||
                 CurChar == '`'))
            {
                this.ShowSpecialChar (
                    CurGraphics,
                    CurChar,
                    Y,
                    X,
                    CurFGColor,
                    CurBGColor);

                return;
            }*/
            /**/
            //ANSI
            if ((CurAttribs.IsDECSG == true) &&
                (CurChar == 'Z' ||
                 CurChar == 'l' ||
                 CurChar == 'q' ||
                 CurChar == 'D' ||
                 CurChar == 'B' ||
                 CurChar == '?' ||
                 CurChar == '3' ||
                 CurChar == 'C' ||
                 CurChar == 'E' ||
                 CurChar == '4' ||
                 CurChar == '@' ||
                 CurChar == 'A' ||
                 CurChar == 'Y' ||
                 CurChar == '`'))
            {
                this.ShowSpecialChar(
                    CurGraphics,
                    CurChar,
                    Y,
                    X,
                    CurFGColor,
                    CurBGColor);

                return;
            }
            /**/
            //prntSome.add2stringrdb(CurChar.ToString());
            CurGraphics.DrawString (
                 CurChar.ToString (),
                 this.Font,
                 new System.Drawing.SolidBrush (CurFGColor),
                 X - this.DrawStringOffset.X,
                 Y - this.DrawStringOffset.Y);
        }
Example #6
0
        public void ShowChar(
            System.Drawing.Graphics CurGraphics,
            System.Char CurChar,
            System.Int32 Y,
            System.Int32 X,
            CharAttribs CurAttribs)
        {
            //prntSome.printSome("ShowChar");
            if (CurChar == '\0')
            {
                return;
            }

            System.Drawing.Color CurFGColor = System.Drawing.Color.White;
            System.Drawing.Color CurBGColor = System.Drawing.Color.Black;

            this.AssignColors(CurAttribs, ref CurFGColor, ref CurBGColor);

            if ((CurBGColor != this.BackColor && (this.Modes.Flags & uc_Mode.LightBackground) == 0) ||
                (CurBGColor != this.FGColor && (this.Modes.Flags & uc_Mode.LightBackground) > 0))
            {
                // Erase the current Character underneath the cursor postion
                this.EraseBuffer.Clear(CurBGColor);

                // paint a rectangle over the cursor position in the character's BGColor
                CurGraphics.DrawImageUnscaled(
                    this.EraseBitmap,
                    X,
                    Y);
            }

            if (CurAttribs.IsUnderscored)
            {
                CurGraphics.DrawLine(new System.Drawing.Pen(CurFGColor, 1),
                                     X, Y + this.UnderlinePos,
                                     X + this.CharSize.Width, Y + this.UnderlinePos);
            }

            /*VT220*/

            /*
             * if ((CurAttribs.IsDECSG == true) &&
             *  (CurChar == 'l' ||
             *   CurChar == 'q' ||
             *   CurChar == 'w' ||
             *   CurChar == 'k' ||
             *   CurChar == 'x' ||
             *   CurChar == 't' ||
             *   CurChar == 'n' ||
             *   CurChar == 'u' ||
             *   CurChar == 'm' ||
             *   CurChar == 'v' ||
             *   CurChar == 'j' ||
             *   CurChar == '`'))
             * {
             *  this.ShowSpecialChar (
             *      CurGraphics,
             *      CurChar,
             *      Y,
             *      X,
             *      CurFGColor,
             *      CurBGColor);
             *
             *  return;
             * }*/
            /**/
            //ANSI
            if ((CurAttribs.IsDECSG == true) &&
                (CurChar == 'Z' ||
                 CurChar == 'l' ||
                 CurChar == 'q' ||
                 CurChar == 'D' ||
                 CurChar == 'B' ||
                 CurChar == '?' ||
                 CurChar == '3' ||
                 CurChar == 'C' ||
                 CurChar == 'E' ||
                 CurChar == '4' ||
                 CurChar == '@' ||
                 CurChar == 'A' ||
                 CurChar == 'Y' ||
                 CurChar == '`'))
            {
                this.ShowSpecialChar(
                    CurGraphics,
                    CurChar,
                    Y,
                    X,
                    CurFGColor,
                    CurBGColor);

                return;
            }
            /**/
            //prntSome.add2stringrdb(CurChar.ToString());
            CurGraphics.DrawString(
                CurChar.ToString(),
                this.Font,
                new System.Drawing.SolidBrush(CurFGColor),
                X - this.DrawStringOffset.X,
                Y - this.DrawStringOffset.Y);
        }
        public string retrieveStrData(System.Char[][] p1, CharAttribs[][] p2, int startval, int endval, int y)
        {
            string outStr = "";
            int jj = startval;

            System.Text.StringBuilder sb = new System.Text.StringBuilder(100);

            if ((endval == 0) || (endval > this.rColumns+1))
                return outStr;

            try
            {
                for (; jj < endval; jj++)
                {
                    if (p1[y][jj] == '\0' || p2[y][jj].IsDECSG == true)
                    {
                        //sb.Clear();
                        if (rdbp3[rdbp1.Y][jj].IsDECSG == true)
                        {
                            //Search Main Header Strings
                        }
                        continue;
                    }
                    sb.Append(p1[y][jj]);
                }
                outStr = sb.ToString();
            }
            catch (System.Exception e)
            {
                outStr += e.Message + string.Format("jj:{0}, y:{1}", jj, y);
                string tmpstr = "";

                for (int ii = 0; ii < p1.Length; ii++)
                {
                    var str = new string(p1[ii]);
                    tmpstr += str + "\n";
                }

                prntSome.printSome(outStr + "\n\n\n" + tmpstr, "chargrid-rdb", counttxtscrnrdb);
                counttxtscrnrdb++;
            }

            sb.Clear();
            return outStr;
        }