Ejemplo n.º 1
0
        private Widget CreateTextView()
        {
            textView   = new ThemedTextView();
            textWriter = new TextViewWriter(textView);
            Console.SetOut(textWriter);
            Console.SetError(textWriter);
            var menu    = new Menu();
            var shCopy  = new Shortcut(Modifiers.Control, Key.C);
            var command = new Command
            {
                Shortcut = shCopy,
                Text     = "Copy All",
            };

            menu.Add(command);
            textView.Updated += (dt) => {
                if (textView.Input.WasKeyPressed(Key.Mouse1))
                {
                    menu.Popup();
                }
                if (command.WasIssued())
                {
                    command.Consume();
                    Clipboard.Text = textView.Text;
                }
            };

            return(textView);
        }
Ejemplo n.º 2
0
        private Widget CreateTextView()
        {
            textView = new ThemedTextView {
                SquashDuplicateLines = true
            };
            textWriter = new TextViewWriter(textView);
            System.Console.SetOut(textWriter);
            System.Console.SetError(textWriter);
            var menu = new Menu();

            menu.Add(Command.Copy);
            textView.Updated += (dt) => {
                if (textView.Input.WasKeyPressed(Key.Mouse0))
                {
                    textView.SetFocus();
                }
                if (textView.Input.WasKeyPressed(Key.Mouse1))
                {
                    menu.Popup();
                }
                if (textView.IsFocused() && Command.Copy.WasIssued())
                {
                    Command.Copy.Consume();
                    Clipboard.Text = textView.Text;
                }
                var i = textView.Content.Nodes.Count;
                // numbers choosen by guess
                if (i >= 500)
                {
                    textView.Content.Nodes.RemoveRange(0, 250);
                }
            };

            return(textView);
        }
Ejemplo n.º 3
0
 private Widget CreateTextView()
 {
     textView = new ThemedTextView {
         SquashDuplicateLines = true
     };
     textWriter = new TextViewWriter(textView)
     {
         SystemOut = System.Console.Out,
     };
     System.Console.SetOut(textWriter);
     System.Console.SetError(textWriter);
     textView.Tasks.Add(ManageTextViewTask);
     return(textView);
 }
Ejemplo n.º 4
0
 public TextViewWriter(ThemedTextView textView)
 {
     this.textView    = textView;
     Project.Opening += path => {
         var logDir = Path.GetDirectoryName(path);
         if (!Directory.Exists(logDir))
         {
             Directory.CreateDirectory(logDir);
         }
         LogFilePath = Path.Combine(logDir, "TangerineLog.txt");
         if (file != null)
         {
             file.Close();
         }
         File.WriteAllText(LogFilePath, logBeforeProjectOpened.ToString());
         file = new StreamWriter(File.Open(LogFilePath, FileMode.Append, FileAccess.Write));
         logBeforeProjectOpened.Clear();
     };
 }
Ejemplo n.º 5
0
 public TextViewWriter(ThemedTextView textView)
 {
     this.textView = textView;
 }
Ejemplo n.º 6
0
 public TextViewWriter(ThemedTextView textView, TextWriter consoleOutput)
 {
     this.consoleOutput = consoleOutput;
     this.textView      = textView;
     this.textView.Behaviour.Content.Gestures.Add(new DragGesture());
 }