public TextBuf GetOut()
        {
            TextBuf tb = new TextBuf(length, 1);

            tb.BG = DrawColors.overlay_bg;
            tb.FG = DrawColors.edit_text;
            int i;

            if (inp.Length > length)
            {
                for (i = 0; i < length - 3; i++)
                {
                    tb.Append(inp[i]);
                }
                tb.Append('.');
                tb.Append('.');
                tb.Append('.');
            }
            else
            {
                for (i = 0; i < inp.Length; i++)
                {
                    tb.Append(inp[i]);
                }
                for (i = 0; i < length - inp.Length; i++)
                {
                    tb.Append(' ');
                }
            }
            return(tb);
        }
Beispiel #2
0
        public TextBuf DrawTextBuf()
        {
            TextBuf tb = new TextBuf(width, height);

            if (active)
            {
                tb.BG = DrawColors.edit_bg;
            }
            else
            {
                tb.BG = DrawColors.wind_bg;
            }
            tb.FG       = DrawColors.edit_text;
            lines[pc_y] = linesb.ToString();
            int    i, j;
            string s;

            for (i = view0_y; i < view0_y + height; i++)
            {
                if (i >= lines.Count)
                {
                    for (j = 0; j < width; j++)
                    {
                        tb.Append(' ');
                    }
                    continue;
                }
                if (view0_x >= lines[i].Length)
                {
                    for (j = 0; j < width; j++)
                    {
                        tb.Append(' ');
                    }
                    continue;
                }
                if (view0_x + width >= lines[i].Length)
                {
                    s  = lines[i].Substring(view0_x);
                    s += new string (' ', width - s.Length);
                }
                else
                {
                    s = lines[i].Substring(view0_x, width);
                }
                foreach (char c in s)
                {
                    tb.Append(c);
                }
            }
            if (active)
            {
                var van = tb[pc_x - view0_x, pc_y - view0_y];
                tb[pc_x - view0_x, pc_y - view0_y] = new Tuple <char, ConsoleColor, ConsoleColor> (van.Item1, ConsoleColor.Black, ConsoleColor.White);
            }
            return(tb);
        }
Beispiel #3
0
        /// <summary>
        /// Draws this TextBuf over another TextBuf
        /// </summary>
        /// <param name="tb">Textbuf to be drawn over.</param>
        /// <param name="start_x">The x coordinate where the TextBuf should start</param>
        /// <param name="start_y">The y coordinate where the TextBuf should start</param>
        public void DrawOver(TextBuf tb, int start_x, int start_y)
        {
            int i, j;

            for (i = 0; i < m_height; i++)
            {
                for (j = 0; j < m_width; j++)
                {
                    tb.cc[i + start_y, j + start_x, 0] = cc[i, j, 0];
                    tb.cc[i + start_y, j + start_x, 1] = cc[i, j, 1];
                    tb.buf[i + start_y, j + start_x]   = buf[i, j];
                }
            }
        }
        public TextBuf DrawTextBuf()
        {
            TextBuf tb = new TextBuf(8, 1);

            tb.BG = DrawColors.edit_bg;
            tb.FG = DrawColors.edit_text;
            int i;

            for (i = 0; i < outBuild.Length; i++)
            {
                tb.Append(outBuild[i]);
            }
            return(tb);
        }
Beispiel #5
0
        public TextBuf DrawTextBuf()
        {
            TextBuf tb = new TextBuf(text.Length + 4, 1);

            if (active)
            {
                if (focused)
                {
                    tb.BG = DrawColors.select_bg;
                    tb.FG = DrawColors.select_text;
                }
                else
                {
                    tb.BG = DrawColors.wind_bg;
                    tb.FG = DrawColors.edit_text;
                }
            }
            else
            {
                tb.BG = DrawColors.wind_bg;
                tb.FG = DrawColors.inactive_text;
            }
            tb.Append('[');
            if (selected)
            {
                tb.Append('X');
            }
            else
            {
                tb.Append(' ');
            }
            tb.Append(']');
            if (active)
            {
                tb.BG = DrawColors.wind_bg;
                tb.FG = DrawColors.edit_text;
            }
            else
            {
                tb.BG = DrawColors.wind_bg;
                tb.FG = DrawColors.inactive_text;
            }
            tb.Append(' ');
            foreach (char c in text)
            {
                tb.Append(c);
            }
            return(tb);
        }
Beispiel #6
0
 public TextBuf DrawTextBuf()
 {
     lock (this)
     {
         TextBuf tb = new TextBuf(1, 1);
         if (focused)
         {
             tb[0, 0] = new Tuple <char, ConsoleColor, ConsoleColor> ('X', ConsoleColor.Green, ConsoleColor.Blue);
         }
         else
         {
             tb[0, 0] = new Tuple <char, ConsoleColor, ConsoleColor> ('X', ConsoleColor.Red, ConsoleColor.Black);
         }
         return(tb);
     }
 }
Beispiel #7
0
        public TextBuf DrawTextBuf()
        {
            TextBuf tb;

            lock (this)
            {
                tb    = new TextBuf(Console.WindowWidth, Console.WindowHeight);
                tb.FG = DrawColors.edit_text;
                tb.BG = DrawColors.scr_bg;
                foreach (WidgetContainer wc in liw)
                {
                    wc.iw.DrawTextBuf().DrawOver(tb, wc.x, wc.y);
                }
            }
            return(tb);
        }
Beispiel #8
0
        public TextBuf DrawTextBuf()
        {
            TextBuf tb = new TextBuf(width, 1);

            if (!active)
            {
                tb.BG = DrawColors.button_inactive_bg;
                tb.FG = DrawColors.button_inactive_fg;
            }
            else
            {
                if (focused)
                {
                    tb.BG = DrawColors.button_selected_bg;
                    tb.FG = DrawColors.button_selected_fg;
                }
                else
                {
                    tb.BG = DrawColors.button_simple_bg;
                    tb.FG = DrawColors.button_simple_fg;
                }
            }
            if (focused)
            {
                tb.Append('>');
            }
            else
            {
                tb.Append(' ');
            }
            tb.Append(' ');
            foreach (char c in text)
            {
                tb.Append(c);
            }
            tb.Append(' ');
            if (focused)
            {
                tb.Append('<');
            }
            else
            {
                tb.Append(' ');
            }
            return(tb);
        }
Beispiel #9
0
        public TextBuf DrawTextBuf()
        {
            TextBuf tb, taa;

            tb  = new TextBuf(width + 1, height + 1);
            taa = new TextBuf(a_width, a_height);
            TextBuf vertScroll  = new TextBuf(1, height);
            TextBuf horizScroll = new TextBuf(width, 1);
            TextBuf corner      = new TextBuf(1, 1);

            corner.Append(BoxGraphics.Square);
            wid.DrawTextBuf().DrawOver(taa, 0, 0);
            vertScroll.DrawOver(tb, width + 1, 0);
            horizScroll.DrawOver(tb, 0, height + 1);
            corner.DrawOver(tb, width + 1, height + 1);
            return(tb);
        }
Beispiel #10
0
        public TextBuf DrawTextBuf()
        {
            TextBuf tb;

            lock (this)
            {
                tb    = new TextBuf(width + 2, height + 4);
                tb.FG = DrawColors.edit_text;
                tb.BG = DrawColors.wind_bg;
                int i, j;

                tb.Append(BoxGraphics.DoubleULCorner);
                for (i = 0; i < width; i++)
                {
                    tb.Append(BoxGraphics.DoubleHorizLine);
                }
                tb.Append(BoxGraphics.DoubleURCorner);
                if (focused)
                {
                    tb[1, 0] = new Tuple <char, ConsoleColor, ConsoleColor> (BoxGraphics.Square, ConsoleColor.Green, DrawColors.wind_bg);
                }
                tb.Append(BoxGraphics.DoubleVertLine);
                if (title.Length > width)
                {
                    for (i = 0; i < width - 3; i++)
                    {
                        tb.Append(title[i]);
                    }
                    tb.Append('.');
                    tb.Append('.');
                    tb.Append('.');
                }
                else
                {
                    for (i = 0; i < title.Length; i++)
                    {
                        tb.Append(title[i]);
                    }
                    for (i = 0; i < width - title.Length; i++)
                    {
                        tb.Append(' ');
                    }
                }
                tb.Append(BoxGraphics.DoubleVertLine);
                tb.Append(BoxGraphics.DoubleTLeft);
                for (i = 0; i < width; i++)
                {
                    tb.Append(BoxGraphics.DoubleHorizLine);
                }
                tb.Append(BoxGraphics.DoubleTRight);
                for (i = 0; i < height; i++)
                {
                    tb.Append(BoxGraphics.DoubleVertLine);
                    for (j = 0; j < width; j++)
                    {
                        tb.Append(' ');
                    }
                    tb.Append(BoxGraphics.DoubleVertLine);
                }
                tb.Append(BoxGraphics.DoubleLLCorner);
                for (i = 0; i < width; i++)
                {
                    tb.Append(BoxGraphics.DoubleHorizLine);
                }
                tb.Append(BoxGraphics.DoubleLRCorner);
            }


            foreach (WidgetContainer wc in liw)
            {
                wc.iw.DrawTextBuf().DrawOver(tb, wc.x, wc.y);
            }
            return(tb);
        }
        public TextBuf GetOut()
        {
            TextBuf tb = new TextBuf(width, height);
            int     i, j;

            if (active)
            {
                tb.BG = DrawColors.edit_bg;
            }
            else
            {
                tb.BG = DrawColors.wind_bg;
            }
            tb.FG = DrawColors.edit_text;

            /*tb.Append (BoxGraphics.ULCorner);
             * for (i = 0; i < length; i++)
             *      tb.Append (BoxGraphics.HorizLine);
             * tb.Append (BoxGraphics.URCorner);
             * tb.Append (BoxGraphics.VertLine);
             * tb.FG = DrawColors.text;
             */
            int pc = 0;

            for (i = 0; i < v_y; i++)
            {
                for (; pc < inp.Length; pc++)
                {
                    if (inp[pc] == '\n')
                    {
                        continue;
                    }
                }
            }
            for (i = 0; i < height; i++)
            {
                pc += v_x;
                if (pc >= inp.Length)
                {
                    for (j = 0; j < width; j++)
                    {
                        tb.Append(' ');
                    }
                    break;
                }
                for (j = 0; j < width; j++)
                {
                    tb.Append(inp[pc]);
                    pc++;
                    if (pc == inp.Length)
                    {
                        break;
                    }
                    if (inp[pc] == '\n')
                    {
                        break;
                    }
                }
                for (j++; j < width; j++)
                {
                    tb.Append(' ');
                }
                if (pc >= inp.Length)
                {
                    break;
                }
                if (inp[pc] == '\n')
                {
                    pc++;
                    continue;
                }
                for (; pc < inp.Length; pc++)
                {
                    if (inp[pc] == '\n')
                    {
                        break;
                    }
                }
            }
            for (i++; i < height; i++)
            {
                for (j = 0; j < width; j++)
                {
                    tb.Append(' ');
                }
            }

            /*if (inp.Length > length)
             * {
             *      for (i = 0; i < length - 3; i++)
             *              tb.Append (inp[i]);
             *      tb.Append ('.');
             *      tb.Append ('.');
             *      tb.Append ('.');
             * }
             * else
             * {
             *      for (i = 0; i < inp.Length; i++)
             *              tb.Append (inp[i]);
             *      for (i = 0; i < length - inp.Length; i++)
             *              tb.Append (' ');
             * }*/
            /*if (focused)
             * {
             *      var van = tb[pos_c, 0];
             *      tb[pos_c, 0] = new Tuple<char, ConsoleColor, ConsoleColor> (van.Item1, ConsoleColor.Black, ConsoleColor.White);
             * }*/
            /*if (active)
             *      tb.FG = DrawColors.active_fence;
             * else
             *      tb.FG = DrawColors.inactive_fence;
             * tb.Append (BoxGraphics.VertLine);
             * tb.Append (BoxGraphics.LLCorner);
             * for (i = 0; i < length; i++)
             *      tb.Append (BoxGraphics.HorizLine);
             * tb.Append (BoxGraphics.LRCorner);
             */
            if (active)
            {
                var van = tb[pc_x, pc_y];
                tb[pc_x, pc_y] = new Tuple <char, ConsoleColor, ConsoleColor> (van.Item1, ConsoleColor.Black, ConsoleColor.White);
            }
            return(tb);
        }
Beispiel #12
0
        public TextBuf DrawTextBuf()
        {
            TextBuf tb = new TextBuf(width + 2, height + 2);
            int     i, j;

            if (active)
            {
                tb.FG = DrawColors.active_fence;
            }
            else
            {
                tb.FG = DrawColors.inactive_fence;
            }
            tb.BG = DrawColors.wind_bg;
            tb.Append(BoxGraphics.ULCorner);
            for (i = 0; i < width; i++)
            {
                tb.Append(BoxGraphics.HorizLine);
            }
            tb.Append(BoxGraphics.URCorner);
            tb.BG = DrawColors.edit_bg;
            tb.FG = DrawColors.edit_text;
            for (i = 0; i < elm.Count; i++)
            {
                if (i == SelectedElement)
                {
                    tb.BG = DrawColors.select_bg;
                    tb.FG = DrawColors.select_ar;
                    tb.Append('>');
                    tb.FG = DrawColors.select_text;
                }
                else
                {
                    tb.Append(' ');
                }
                if (elm[i].Length > width)
                {
                    for (j = 0; j < width - 3; j++)
                    {
                        tb.Append(elm[i][j]);
                    }
                    tb.Append('.');
                    tb.Append('.');
                    tb.Append('.');
                }
                else
                {
                    for (j = 0; j < elm[i].Length; j++)
                    {
                        tb.Append(elm[i][j]);
                    }
                    for (j = 0; j < width - elm[i].Length; j++)
                    {
                        tb.Append(' ');
                    }
                }
                if (i == SelectedElement)
                {
                    tb.FG = DrawColors.select_ar;
                    tb.Append('<');
                    tb.BG = DrawColors.edit_bg;
                    tb.FG = DrawColors.edit_text;
                }
                else
                {
                    tb.Append(' ');
                }
            }
            for (; i < height; i++)
            {
                for (j = 0; j < width + 2; j++)
                {
                    tb.Append(' ');
                }
            }
            if (active)
            {
                tb.FG = DrawColors.active_fence;
            }
            else
            {
                tb.FG = DrawColors.inactive_fence;
            }
            tb.BG = DrawColors.wind_bg;
            tb.Append(BoxGraphics.LLCorner);
            for (i = 0; i < width; i++)
            {
                tb.Append(BoxGraphics.HorizLine);
            }
            tb.Append(BoxGraphics.LRCorner);
            if (focused)
            {
                tb[1, 0] = new Tuple <char, ConsoleColor, ConsoleColor> (BoxGraphics.Square, ConsoleColor.Green, DrawColors.wind_bg);
            }
            if (searching)
            {
                searchBox.DrawTextBuf().DrawOver(tb, 0, height);
            }
            return(tb);
        }