From d2cc76d84cc00bdc7cadcc6c42436813c66e4cbb Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Sat, 19 Mar 2022 14:46:22 -0400 Subject: [PATCH] improve handling of project properties dialog --- .../Panels/SolutionExplorerPanel.cs | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/Libraries/UniversalEditor.UserInterface/Panels/SolutionExplorerPanel.cs b/Libraries/UniversalEditor.UserInterface/Panels/SolutionExplorerPanel.cs index 2ff009fe..b426b3d9 100644 --- a/Libraries/UniversalEditor.UserInterface/Panels/SolutionExplorerPanel.cs +++ b/Libraries/UniversalEditor.UserInterface/Panels/SolutionExplorerPanel.cs @@ -183,6 +183,7 @@ namespace UniversalEditor.UserInterface.Panels tmSolutionExplorer = new DefaultTreeModel(new Type[] { typeof(string) }); tvSolutionExplorer.Model = tmSolutionExplorer; tvSolutionExplorer.BeforeContextMenu += tvSolutionExplorer_BeforeContextMenu; + tvSolutionExplorer.SelectionChanged += tvSolutionExplorer_SelectionChanged; tvSolutionExplorer.RowActivated += tvSolutionExplorer_RowActivated; // (UniversalEditor.exe:24867): Gtk-CRITICAL **: 21:28:56.913: gtk_tree_store_set_value: assertion 'G_IS_VALUE (value)' failed @@ -250,6 +251,31 @@ namespace UniversalEditor.UserInterface.Panels Application.Instance.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Folder_Add_NewFolder", mnuContextFolderAddNewFolder_Click); } + private void tvSolutionExplorer_SelectionChanged(object sender, EventArgs e) + { + bool hasSettingsProvider = false; + if (tvSolutionExplorer.LastHitTest.Row != null) + { + ProjectObjectModel project = tvSolutionExplorer.LastHitTest.Row.GetExtraData("project"); + SolutionObjectModel solution = tvSolutionExplorer.LastHitTest.Row.GetExtraData("solution"); + ProjectFolder folder = tvSolutionExplorer.LastHitTest.Row.GetExtraData("folder"); + ProjectFile file = tvSolutionExplorer.LastHitTest.Row.GetExtraData("file"); + + if (project != null) + { + for (int i = 0; i < project.ProjectTypes.Count; i++) + { + if (project.ProjectTypes[i].SettingsProvider != null) + { + hasSettingsProvider = true; + break; + } + } + } + } + Application.Instance.FindCommand("FileProperties").Enabled = hasSettingsProvider; + } + private void mnuContextFileOpen_Click(object sender, EventArgs e) { } @@ -476,14 +502,7 @@ namespace UniversalEditor.UserInterface.Panels if (project != null) { - SettingsDialog dlg = new SettingsDialog(); - dlg.SettingsProviders.Clear(); - dlg.Text = String.Format("{0} Properties", project.Title); - - if (dlg.ShowDialog() == DialogResult.OK) - { - - } + ((EditorApplication)Application.Instance).ShowProjectSettings(project); return; } if (file != null)