public static void Main(string[] args) { string rootPath; if (args.Length == 0) { string env = Environment.GetEnvironmentVariable("DI_PROJECT"); if (string.IsNullOrEmpty(env)) { rootPath = Environment.CurrentDirectory; } else { rootPath = env; } } else { rootPath = args[0]; } Application.Init(); var model = new Model.Main(Karl.Fs.Directory.Get(rootPath)); var ctl = new Controller.Main(model); var view = new View.Main(ctl); Session.Main.Load(model.SessionFile, ctl, view); view.ShowAll(); ctl.Ready.Handler(); Application.Run(); }
public WindowView(Main _view, Controller.Window _ctl) { View = _view; Window = _ctl; Homogeneous = false; Spacing = 0; BorderWidth = 0; var topLevelBox = new Gtk.VBox(); topLevelBox.Homogeneous = false; topLevelBox.Spacing = 0; topLevelBox.BorderWidth = 0; textView = new WindowTextView(Window); scroll = new Gtk.ScrolledWindow { HscrollbarPolicy = Gtk.PolicyType.Automatic, VscrollbarPolicy = Gtk.PolicyType.Automatic }; scroll.Add(textView); Window.CursorMovedByCommand.Add(i => { textView.ScrollToIter(i.GtkIter, 0, false, 0, 0); }); topLevelBox.PackStart(scroll, true, true, 0); status = new Gtk.Statusbar(); status.HasResizeGrip = false; status.Push(StatusbarMode, Window.CurrentMode.GetName()); Window.CurrentMode.Event.Changed += m => { status.Pop(StatusbarMode); status.Push(StatusbarMode, Window.CurrentMode.GetName()); }; Window.Model.Changed += m => { textView.Buffer = m; }; topLevelBox.PackStart(status, false, false, 0); // Wrap the topLevelBox with borders on the left and right var hlBox = new Gtk.DrawingArea(); NormalColor = hlBox.Style.Background(Gtk.StateType.Normal); hlBox.WidthRequest = 10; var borderBox = new Gtk.HBox(); borderBox.Homogeneous = false; borderBox.Spacing = 0; borderBox.BorderWidth = 0; borderBox.PackStart(hlBox, false, false, 0); borderBox.PackStart(topLevelBox, true, true, 0); textView.FocusInEvent += (object o, Gtk.FocusInEventArgs args) => { Window.Controller.FocusedWindow.Value = Window; hlBox.ModifyBg(Gtk.StateType.Normal, HighlightColor); }; textView.FocusOutEvent += (object o, Gtk.FocusOutEventArgs args) => { hlBox.ModifyBg(Gtk.StateType.Normal, NormalColor); }; Add(borderBox); }
public WindowView(Main _view, Controller.Window _ctl) { View = _view; Window = _ctl; Homogeneous = false; Spacing = 0; BorderWidth = 0; var topLevelBox = new Gtk.VBox(); topLevelBox.Homogeneous = false; topLevelBox.Spacing = 0; topLevelBox.BorderWidth = 0; textView = new WindowTextView(Window); scroll = new Gtk.ScrolledWindow { HscrollbarPolicy = Gtk.PolicyType.Automatic, VscrollbarPolicy = Gtk.PolicyType.Automatic }; scroll.Add(textView); Window.CursorMovedByCommand.Add(i => { textView.ScrollToIter(i.GtkIter, 0, false, 0, 0); }); topLevelBox.PackStart(scroll, true, true, 0); status = new MultiStatusbar(); status.Add(StatusbarItem.Create(100, () => Window.CurrentMode.GetName(), Window.CurrentMode.Changed)); status.Add(StatusbarItem.Create(50, Window.Model.Value.HasUnsavedChanges, b => b ? "" : "Saved")); status.AddLast(StatusbarItem.Create(400, Window.Model.Value.File.ProjectRelativeFullName())); topLevelBox.PackStart(status, false, false, 0); Window.Model.Changed += m => { textView.Buffer = m; }; // Wrap the topLevelBox with borders on the left and right var hlBox = new Gtk.DrawingArea(); NormalColor = hlBox.Style.Background(Gtk.StateType.Normal); hlBox.WidthRequest = 10; var borderBox = new Gtk.HBox(); borderBox.Homogeneous = false; borderBox.Spacing = 0; borderBox.BorderWidth = 0; borderBox.PackStart(hlBox, false, false, 0); borderBox.PackStart(topLevelBox, true, true, 0); textView.FocusInEvent += (object o, Gtk.FocusInEventArgs args) => { Window.Controller.Windows.Current = Window; hlBox.ModifyBg(Gtk.StateType.Normal, HighlightColor); }; textView.FocusOutEvent += (object o, Gtk.FocusOutEventArgs args) => { hlBox.ModifyBg(Gtk.StateType.Normal, NormalColor); }; Add(borderBox); }