2 using System.Reflection;
3 using System.Runtime.InteropServices;
8 static Gtk.Window window;
10 static TextDisplay display;
11 static TextDocument doc;
12 static bool fullscreened = false;
14 static void Main (string[] args) {
16 window = new Gtk.Window("Nebula");
17 stack = new VBox(false, 0);
19 if (args.Length > 0) {
20 doc = new TextDocument(args[0]);
22 doc = new TextDocument();
24 display = new TextDisplay();
25 display.SetDocument(doc);
30 window.Resize(640,480);
33 window.KeyPressEvent += new KeyPressEventHandler(KeyPress);
35 window.DeleteEvent += delegate(object o, DeleteEventArgs e) {
42 static void SelectInput(IKeyPress w) {
43 window.KeyPressEvent -= display.KeyPress;
44 window.KeyPressEvent += w.KeyPress;
47 [GLib.ConnectBefore ()]
48 static void KeyPress(object o, KeyPressEventArgs args) {
49 if ((args.Event.State & Gdk.ModifierType.ControlMask) != 0) {
50 switch(args.Event.Key) {
52 doc = new TextDocument();
53 display.SetDocument(doc);
56 TextInput filename = new FileSelector();
57 stack.PackEnd(filename);
58 SelectInput(filename);
60 filename.Selected += delegate(object o2, TextInputEventArgs t) {
61 if (t.Value != null) {
62 doc = new TextDocument(t.Value);
63 display.SetDocument(doc);
66 stack.Remove(filename);
74 } else if ((args.Event.State & Gdk.ModifierType.Mod1Mask) != 0) {
75 switch(args.Event.Key) {
78 ((Window)o).Unfullscreen();
80 ((Window)o).Fullscreen();
81 fullscreened = ! fullscreened;