diff --git a/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/Dialogs/DataFormatOptionsDialog.cs b/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/Dialogs/DataFormatOptionsDialog.cs index 7c15d6ef..1ee6fd7e 100644 --- a/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/Dialogs/DataFormatOptionsDialog.cs +++ b/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/Dialogs/DataFormatOptionsDialog.cs @@ -30,40 +30,18 @@ namespace UniversalEditor.Engines.GTK.Dialogs this.Build(); } - public static bool ShowDialog(ref DataFormat df, DataFormatOptionsDialogType type) + public static bool ShowDialog(ref CustomOption.CustomOptionCollection customOptions, string title, EventHandler aboutButtonClicked) { - DataFormatReference dfr = df.MakeReference(); - switch (type) - { - case DataFormatOptionsDialogType.Export: + if (customOptions.Count > 0) + { + DataFormatOptionsDialog dlg = new DataFormatOptionsDialog(); + dlg.Title = title; + switch ((Gtk.ResponseType)dlg.Run()) { - if (dfr.ExportOptions.Count > 0) - { - DataFormatOptionsDialog dlg = new DataFormatOptionsDialog(); - switch ((Gtk.ResponseType)dlg.Run()) - { - case Gtk.ResponseType.Cancel: - { - return false; - } - } + case Gtk.ResponseType.Cancel: + { + return false; } - break; - } - case DataFormatOptionsDialogType.Import: - { - if (dfr.ImportOptions.Count > 0) - { - DataFormatOptionsDialog dlg = new DataFormatOptionsDialog(); - switch ((Gtk.ResponseType)dlg.Run()) - { - case Gtk.ResponseType.Cancel: - { - return false; - } - } - } - break; } } return true; diff --git a/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/GTKEngine.cs b/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/GTKEngine.cs index f7889ee7..f9be632e 100644 --- a/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/GTKEngine.cs +++ b/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/GTKEngine.cs @@ -20,7 +20,7 @@ namespace UniversalEditor.Engines.GTK Application.Quit (); } - protected override UniversalEditor.UserInterface.IHostApplicationWindow OpenWindowInternal (params string[] FileNames) + protected override UniversalEditor.UserInterface.IHostApplicationWindow OpenWindowInternal(params Document[] documents) { MainWindow mw = new MainWindow(); mw.Show (); @@ -29,13 +29,20 @@ namespace UniversalEditor.Engines.GTK public override void ShowAboutDialog() { - Dialogs.AboutDialog dlg = new Dialogs.AboutDialog(); - dlg.Run(); - dlg.Destroy(); + ShowAboutDialog(null); } - public override bool ShowDataFormatOptionsDialog(ref DataFormat df, UniversalEditor.UserInterface.DataFormatOptionsDialogType type) + public override void ShowAboutDialog(DataFormatReference dfr) { - return Dialogs.DataFormatOptionsDialog.ShowDialog(ref df, type); + if (dfr == null) + { + Dialogs.AboutDialog dlg = new Dialogs.AboutDialog(); + dlg.Run(); + dlg.Destroy(); + } + } + public override bool ShowCustomOptionDialog(ref CustomOption.CustomOptionCollection customOptions, string title, EventHandler aboutButtonClicked) + { + return Dialogs.DataFormatOptionsDialog.ShowDialog(ref customOptions, title, aboutButtonClicked); } protected override void ShowCrashDialog(Exception ex) { diff --git a/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/MainWindow.cs b/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/MainWindow.cs index 5fc310df..79c52508 100644 --- a/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/MainWindow.cs +++ b/CSharp/Engines/GTK/UniversalEditor.Engines.GTK/MainWindow.cs @@ -241,21 +241,33 @@ namespace UniversalEditor.Engines.GTK dlg.Destroy(); } - - public void OpenFile (params string[] FileNames) + + public void OpenFile (params string[] fileNames) { - foreach (string FileName in FileNames) + Document[] documents = new Document[fileNames.Length]; + for (int i = 0; i < documents.Length; i++) { - OpenFileInternal(FileName); + documents[i] = new Document(null, null, new FileAccessor(fileNames[i])); + } + OpenFile(documents); + } + public void OpenFile(params Document[] documents) + { + foreach (Document doc in documents) + { + OpenFile(doc, false); } } - - private void OpenFileInternal(string FileName) + public void OpenFile(Document document, bool reuseTab) { - DataFormatReference[] dfrs = UniversalEditor.Common.Reflection.GetAvailableDataFormats(FileName); - DataFormat df = dfrs[0].Create (); - - FileAccessor fa = new FileAccessor(FileName); + OpenFileInternal(document, reuseTab); + } + + private void OpenFileInternal(Document document, bool reuseTab) + { + // DataFormatReference[] dfrs = UniversalEditor.Common.Reflection.GetAvailableDataFormats(FileName); + // DataFormat df = dfrs[0].Create (); + DataFormat df = document.DataFormat; ObjectModelReference[] omrs = UniversalEditor.Common.Reflection.GetAvailableObjectModels(df.MakeReference ()); foreach (ObjectModelReference omr in omrs) @@ -267,13 +279,12 @@ namespace UniversalEditor.Engines.GTK Editor editor = (ieditors[0].Create() as Editor); if (editor == null) continue; - Document doc = new Document(om, df, fa); - doc.InputAccessor.Open (); - doc.Load (); + document.InputAccessor.Open (); + document.Load (); editor.ObjectModel = om; - AddDocumentTab(editor, FileName, doc); + AddDocumentTab(editor, document.Title, document); break; } else if (ieditors.Length > 1) @@ -289,7 +300,7 @@ namespace UniversalEditor.Engines.GTK tabLabel.LabelProp = editor.Title; tbsEditors.InsertPage(editor, tabLabel, -1); } - AddDocumentTab(tbsEditors, FileName); + AddDocumentTab(tbsEditors, document.Title); } else { @@ -398,6 +409,11 @@ namespace UniversalEditor.Engines.GTK { throw new System.NotImplementedException (); } + + public void CloseProject() + { + throw new System.NotImplementedException(); + } public bool ShowOptionsDialog () { diff --git a/CSharp/Libraries/UniversalEditor.UserInterface/Common/Reflection.cs b/CSharp/Libraries/UniversalEditor.UserInterface/Common/Reflection.cs index e9834b9a..697c5ed9 100644 --- a/CSharp/Libraries/UniversalEditor.UserInterface/Common/Reflection.cs +++ b/CSharp/Libraries/UniversalEditor.UserInterface/Common/Reflection.cs @@ -45,7 +45,7 @@ namespace UniversalEditor.UserInterface.Common Type[] interfaces = type.GetInterfaces(); foreach (Type typeInt in interfaces) { - if (type.IsAbstract) continue; + if (typeInt.IsAbstract) continue; #region Initializing Editors if (typeInt == typeof(IEditorImplementation)) diff --git a/CSharp/Libraries/UniversalEditor.UserInterface/Engine.cs b/CSharp/Libraries/UniversalEditor.UserInterface/Engine.cs index 3a892c33..f6eecc83 100644 --- a/CSharp/Libraries/UniversalEditor.UserInterface/Engine.cs +++ b/CSharp/Libraries/UniversalEditor.UserInterface/Engine.cs @@ -338,7 +338,12 @@ namespace UniversalEditor.UserInterface { return false; } - + + for (int i = 0; i < engines.Length; i++) + { + Console.WriteLine("Found engine " + engines[i].GetType().FullName); + } + if (engines.Length < 1) { return false; @@ -349,7 +354,12 @@ namespace UniversalEditor.UserInterface } else { - mvarCurrentEngine = engines[0]; + mvarCurrentEngine = engines[1]; + } + + if (mvarCurrentEngine != null) + { + Console.WriteLine("Using engine " + mvarCurrentEngine.GetType().FullName); } #if !DEBUG