Ejemplo n.º 1
0
        public TerminalPad()
        {
            //FIXME look up most of these in GConf
            term = new Terminal ();
            term.ScrollOnKeystroke = true;
            term.CursorBlinks = true;
            term.MouseAutohide = true;
            term.FontFromString = "monospace 10";
            term.Encoding = "UTF-8";
            term.BackspaceBinding = TerminalEraseBinding.Auto;
            term.DeleteBinding = TerminalEraseBinding.Auto;
            term.Emulation = "xterm";

            Gdk.Color fgcolor = new Gdk.Color (0, 0, 0);
            Gdk.Color bgcolor = new Gdk.Color (0xff, 0xff, 0xff);
            Gdk.Colormap colormap = Gdk.Colormap.System;
            colormap.AllocColor (ref fgcolor, true, true);
            colormap.AllocColor (ref bgcolor, true, true);
            term.SetColors (fgcolor, bgcolor, fgcolor, 16);

            //FIXME: whats a good default here
            //term.SetSize (80, 5);

            // seems to want an array of "variable=value"
                    string[] envv = new string [Environment.GetEnvironmentVariables ().Count];
                    int i = 0;
            foreach (DictionaryEntry e in Environment.GetEnvironmentVariables ())
            {
                if (e.Key == "" || e.Value == "")
                    continue;
                envv[i] = String.Format ("{0}={1}", e.Key, e.Value);
                i ++;
            }

            term.ForkCommand (Environment.GetEnvironmentVariable ("SHELL"), Environment.GetCommandLineArgs (), envv, Environment.GetEnvironmentVariable ("HOME"), false, true, true);

            term.ChildExited += new EventHandler (OnChildExited);

            VScrollbar vscroll = new VScrollbar (term.Adjustment);

            HBox hbox = new HBox ();
            hbox.PackStart (term, true, true, 0);
            hbox.PackStart (vscroll, false, true, 0);

            frame.ShadowType = Gtk.ShadowType.In;
            ScrolledWindow sw = new ScrolledWindow ();
            sw.Add (hbox);
            frame.Add (sw);

            Control.ShowAll ();

            /*			Runtime.TaskService.CompilerOutputChanged += (EventHandler) Runtime.DispatchService.GuiDispatch (new EventHandler (SetOutput));
            projectService.StartBuild += (EventHandler) Runtime.DispatchService.GuiDispatch (new EventHandler (SelectMessageView));
            projectService.CombineClosed += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineClosed));
            projectService.CombineOpened += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineOpen));
            */
        }
Ejemplo n.º 2
0
    FoxTerm(string[] args)
    {
        program = new Program ("FoxTerm", "0.1", Modules.UI, args);
        app = new App ("FoxTerm", "Terminal");
        app.SetDefaultSize (600, 450);
        app.DeleteEvent += new DeleteEventHandler (OnAppDelete);

        GConf.Client gc_client = new GConf.Client();

        app.IconName = "terminal";

        Terminal term = new Terminal ();
        term.EncodingChanged += new EventHandler (OnEncodingChanged);
        term.CursorBlinks = true;
        term.MouseAutohide = true;
        term.ScrollOnKeystroke = true;
        term.ScrollbackLines = int.MaxValue;
        term.DeleteBinding = TerminalEraseBinding.Auto;
        term.BackspaceBinding = TerminalEraseBinding.Auto;
        term.Encoding = "UTF-8";

        term.FontFromString = (string)gc_client.Get("/desktop/gnome/interface/monospace_font_name");
        term.ChildExited += new EventHandler (OnChildExited);
        term.WindowTitleChanged += OnTitleChanged;

        ScrolledWindow scroll = new ScrolledWindow(null,term.Adjustment);
        scroll.Add(term);
        scroll.HscrollbarPolicy = PolicyType.Automatic;
        scroll.HScrollbar.Hide();

        string[] argv = Environment.GetCommandLineArgs ();
        // wants an array of "variable=value"
        string[] envv = new string[Environment.GetEnvironmentVariables ().Count];
        int i = 0;
        foreach (DictionaryEntry e in Environment.GetEnvironmentVariables ()) {
            if ((string)(e.Key) == "" || (string)(e.Value) == "")
                continue;
            string tmp = String.Format ("{0}={1}", e.Key, e.Value);
            envv[i] = tmp;
            i++;
        }

        int pid = term.ForkCommand (Environment.GetEnvironmentVariable ("SHELL"), argv, envv, Environment.CurrentDirectory, false, true, true);

        app.Contents = scroll;
        app.ShowAll ();
        program.Run ();
    }
        public RConsolePad()
            : base("R Console")
        {
            Frame frame = new Frame();
            ScrolledWindow scrolledWindow = new ScrolledWindow();
            HBox hbox = new HBox ();
            terminal = new Terminal();
            VScrollbar vscrollbar = new VScrollbar(terminal.Adjustment);
            hbox.PackStart(terminal, true, true, 0);
            hbox.PackStart(vscrollbar, false, true, 0);

            //scrolledWindow.AddWithViewport(hbox);
            frame.ShadowType = Gtk.ShadowType.In;
            scrolledWindow.Add(hbox);
            frame.Add(scrolledWindow);

            widget = frame;
            DefaultPlacement = "bottom";

            string[] environment = new string[Environment.GetEnvironmentVariables().Count];
            int index = 0;
            foreach (DictionaryEntry e in Environment.GetEnvironmentVariables ())
            {
                environment[index++] = String.Format ("{0}={1}", e.Key, e.Value);
            }
            terminal.ForkCommand(
                "R",
                new string[] {"--no-save"},
                environment,
                Environment.CurrentDirectory,
                false,
                false,
                false
            );

            frame.ShowAll();
            instance = this;
        }
Ejemplo n.º 4
0
    T(string[] args)
    {
        Application.Init();
        window = new Gtk.Window("Test for vte widget");
        window.SetDefaultSize(600, 450);
        window.DeleteEvent += new DeleteEventHandler (OnAppDelete);

        HBox hbox = new HBox ();
        Terminal term = new Terminal ();
        term.EncodingChanged += new EventHandler (OnEncodingChanged);
        term.CursorBlinks = true;
        term.MouseAutohide = true;
        term.ScrollOnKeystroke = true;
        term.DeleteBinding = TerminalEraseBinding.Auto;
        term.BackspaceBinding = TerminalEraseBinding.Auto;
        term.Encoding = "UTF-8";
        term.FontFromString = "Monospace 12";
        term.TextDeleted += new EventHandler (OnTextDeleted);
        term.ChildExited += new EventHandler (OnChildExited);

        VScrollbar vscroll = new VScrollbar (term.Adjustment);
        hbox.PackStart (term);
        hbox.PackStart (vscroll);

        Gdk.Color white = new Gdk.Color ();
        Gdk.Color.Parse ("white", ref white);
        // FIXME: following line is broken
        //term.ColorBackground = white;

        Gdk.Color black = new Gdk.Color ();
        Gdk.Color.Parse ("black", ref black);
        // FIXME: following line is broken
        //term.ColorForeground = black;

        // Create a palette with 0 colors. this could be replaced with
        // a palette of colors with a size of 0, 8, 16, or 24.
        Gdk.Color[] palette = new Gdk.Color[0];

        term.SetColors (black, white, palette, palette.Length);

        //Console.WriteLine (term.UsingXft);
        //Console.WriteLine (term.Encoding);
        //Console.WriteLine (term.StatusLine);

        string[] argv = Environment.GetCommandLineArgs ();
        // seems to want an array of "variable=value"
        string[] envv = new string [Environment.GetEnvironmentVariables ().Count];
        int i = 0;
        foreach (DictionaryEntry e in Environment.GetEnvironmentVariables ())
        {
            if (e.Key == "" || e.Value == "")
                continue;
            string tmp = String.Format ("{0}={1}", e.Key, e.Value);
            envv[i] = tmp;
            i ++;
        }

        int pid = term.ForkCommand (Environment.GetEnvironmentVariable ("SHELL"), argv, envv, Environment.CurrentDirectory, false, true, true);
        Console.WriteLine ("Child pid: {0}", pid);

        window.Add(hbox);
        window.ShowAll();
        Application.Run();
    }