/// <summary>
        /// Clears the zone and sets cursor at innerHeight position -- and returns cursor position before the call
        /// </summary>
        /// <param name="zone">The zone.</param>
        /// <returns></returns>
        public static selectRange ClearZoneAndSet(this cursorZone zone)
        {
            selectRange output = new selectRange(Console.CursorLeft, Console.CursorTop);

            selectRangeArea range = zone.selectRangeArea(textCursorZone.innerBoxedZone);

            Console.CursorLeft = zone.x;
            Console.CursorTop  = zone.y;

            range.PrintRange(" ");

            return(output);
        }
Beispiel #2
0
        public override void prepareBuilder()
        {
            // base.prepareBuilder();
            tabLevel = 0;

            settings.api = reportAPI.textBuilder;
            settings.cursorBehaviour.cursorMode = textCursorMode.scroll;
            settings.formats      = reportOutputSupport.getFormatSupportFor(reportAPI.imbMarkdown, "output");
            formats.defaultFormat = reportOutputFormatName.textMdFile;
            _zone = new cursorZone();
            _zone.setPresetSpatialSettings(cursorZoneSpatialPreset.console);
            _zone.setZoneStructure(cursorZoneLayoutPreset.oneFullPage);
            _c = new cursor(_zone, textCursorMode.scroll, textCursorZone.innerZone, this.GetType().Name);
        }
Beispiel #3
0
        public static selectRange ClearAndPrint(this cursorZone zone, cursor c, String content)
        {
            selectRange before = null;

            before = zone.ClearZoneAndSet();

            Console.CursorLeft = zone.x;
            Console.CursorTop  = zone.innerHeight;

            consoleWriteLine(content);

            Console.CursorLeft = zone.innerLeftPosition + c.x;
            Console.CursorTop  = zone.innerHeight + c.y;

            return(before);
        }
        public aceCommandActiveInput(commandTree __comTree, List <String> __history, String __current, String __prefix = "")
        {
            comTree      = __comTree;
            prefix       = __prefix.or("_>_");
            history      = __history;
            historyIndex = history.Count();

            zone                = new cursorZone(80, 1, 1);
            zone.padding.top    = 1;
            zone.padding.bottom = 1;
            zone.margin.top     = Console.WindowHeight - zone.height;
            zone.margin.left    = prefix.Length;

            c = new cursor(zone, textCursorMode.fixedZone, textCursorZone.innerZone, "themeCursor");

            c.switchToZone(textCursorZone.innerZone);
            active = true;

            current = __current;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="styleTheme"/> class.
        /// </summary>
        /// <param name="h1Size">Size of the h1.</param>
        /// <param name="pSize">Size of the p.</param>
        /// <param name="margin">The margin.</param>
        /// <param name="padding">The padding.</param>
        /// <param name="pageFontName">Name of the page font.</param>
        /// <param name="headingFontName">Name of the heading font.</param>
        public styleTheme(aceBaseColorSetEnum colorSet, Int32 h1Size, Int32 pSize, fourSideSetting margin, fourSideSetting padding,
                          aceFont pageFontName, aceFont headingFontName = aceFont.none)
        {
            palletes = new acePaletteProvider(colorSet.getSetOfColors());

            textShotProvider       = new styleTextShotProvider(this);
            styleContainerProvider = new styleContainerShotProvider(this);
            borderProvider         = new styleBorderProvider(this);
            styler = new stylerForRange(this);

            zoneMain = new cursorZone(80, 2, 2);
            cMain    = new cursor(zoneMain, textCursorMode.scroll, textCursorZone.innerZone, "themeCursor");

            body = new stylePage();
            //body.maxSize

            fontForText     = new styleTextFont(pageFontName);
            fontForHeadings = new styleTextFont(headingFontName);
            fontSize        = new styleTextSizeSet(h1Size, pSize, margin, padding);
        }
        public void run()
        {
            Console.CursorVisible = true;

            //ConsoleKey output = ConsoleKey.NoName; // = new Boolean();

            zone = new cursorZone(Console.BufferWidth, 1, 0);

            //Console.WriteLine();

            DateTime startTime    = DateTime.Now;
            DateTime lastReminder = DateTime.Now;

            doRedraw();

            while (active)
            {
                String input = "";

                Boolean redraw = false;

                if (Console.KeyAvailable == false)
                {
                    Thread.Sleep(100);
                    continue;
                }

                if (Console.KeyAvailable)
                {
                    redraw = true;
                    ConsoleKeyInfo cki = Console.ReadKey(false);

                    if (cki.Modifiers.HasFlag(ConsoleModifiers.Alt))
                    {
                        input = "ALT+";
                    }
                    if (cki.Modifiers.HasFlag(ConsoleModifiers.Control))
                    {
                        input = "CTRL+";
                    }
                    if (cki.Modifiers.HasFlag(ConsoleModifiers.Shift))
                    {
                        input = "SHIFT+";
                    }

                    input += cki.Key.ToString();

                    switch (cki.Key)
                    {
                    case ConsoleKey.F1:
                    case ConsoleKey.F2:
                    case ConsoleKey.F3:
                    case ConsoleKey.F4:
                    case ConsoleKey.F5:
                    case ConsoleKey.F6:
                    case ConsoleKey.F7:
                    case ConsoleKey.F8:
                    case ConsoleKey.F9:
                    case ConsoleKey.F10:
                    case ConsoleKey.F11:
                    case ConsoleKey.F12:
                    case ConsoleKey.Escape:
                        current     = input + cki.Key.ToString();
                        specialCall = cki.Key;
                        active      = false;
                        break;

                    case ConsoleKey.DownArrow:
                        if (historyIndex > 0)
                        {
                            historyIndex--;
                        }

                        break;

                    case ConsoleKey.UpArrow:
                        if (historyIndex < history.Count())
                        {
                            historyIndex--;
                        }
                        break;

                    case ConsoleKey.Tab:
                        break;

                    case ConsoleKey.Enter:
                        active = false;
                        break;

                    case ConsoleKey.Home:
                        c.x = 0;
                        break;

                    case ConsoleKey.End:
                        c.moveTo(current.Length, c.y);
                        break;

                    case ConsoleKey.LeftArrow:
                        c.prev();
                        break;

                    case ConsoleKey.RightArrow:
                        c.next();

                        break;

                    case ConsoleKey.Delete:
                        if (c.x < current.Length)
                        {
                            current = current.Remove(c.x, 1);
                        }
                        break;

                    case ConsoleKey.Backspace:
                        c.prev(1);

                        if (c.x < current.Length)
                        {
                            current = current.Remove(c.x, 1);
                        }

                        break;

                    case ConsoleKey.Spacebar:
                    default:
                        if (cki.KeyChar != char.MinValue)
                        {
                            if (c.x < current.Length)
                            {
                                current = current.Insert(c.x, cki.KeyChar.ToString());
                            }
                            else
                            {
                                current = current + cki.KeyChar.ToString();
                            }
                            c.next(false);
                        }
                        break;
                    }
                }
                else
                {
                    if (startTime.Subtract(lastReminder).TotalSeconds > 5)
                    {
                        lastReminder = DateTime.Now;
                        redraw       = true;
                    }
                    else
                    {
                        //Thread.Sleep(500);
                    }
                }

                if (redraw)
                {
                    doRedraw();
                    // Loop until input is entered.
                }
            }

            zone.ClearZoneAndSet();
            Console.CursorLeft = 0;
        }