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)); */ }
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(); }