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);
34 window.KeyReleaseEvent += display.KeyRelease;
36 window.DeleteEvent += delegate(object o, DeleteEventArgs e) {
43 static void SelectInput(IKeyPress w) {
44 window.KeyPressEvent -= display.KeyPress;
45 window.KeyPressEvent += w.KeyPress;
48 [GLib.ConnectBefore ()]
49 static void KeyPress(object o, KeyPressEventArgs args) {
51 if ((args.Event.State & Gdk.ModifierType.ControlMask) != 0) {
52 switch(args.Event.Key) {
54 doc = new TextDocument();
55 display.SetDocument(doc);
58 input = new FileSelector();
62 input.Selected += delegate(object o2, TextInputEventArgs t) {
63 if (t.Value != null) {
64 doc = new TextDocument(t.Value);
65 display.SetDocument(doc);
73 if (doc.filename == null) {
74 input = new FileSelector();
78 input.Selected += delegate(object o2, TextInputEventArgs t) {
79 if (t.Value != null) {
94 } else if ((args.Event.State & Gdk.ModifierType.Mod1Mask) != 0) {
95 switch(args.Event.Key) {
98 ((Window)o).Unfullscreen();
100 ((Window)o).Fullscreen();
101 fullscreened = ! fullscreened;