diff --git a/Content/UniversalEditor.Content.PlatformIndependent/Editors/Database/Commands.uexml b/Content/UniversalEditor.Content.PlatformIndependent/Editors/Database/Commands.uexml index f909936e..41ee24ed 100644 --- a/Content/UniversalEditor.Content.PlatformIndependent/Editors/Database/Commands.uexml +++ b/Content/UniversalEditor.Content.PlatformIndependent/Editors/Database/Commands.uexml @@ -1,6 +1,6 @@  - + diff --git a/Content/UniversalEditor.Content.PlatformIndependent/Editors/Database/ContextMenu_Columns.uexml b/Content/UniversalEditor.Content.PlatformIndependent/Editors/Database/ContextMenu_Columns.uexml new file mode 100644 index 00000000..e4a0f185 --- /dev/null +++ b/Content/UniversalEditor.Content.PlatformIndependent/Editors/Database/ContextMenu_Columns.uexml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj b/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj index e7a59c79..749de05e 100644 --- a/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj +++ b/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj @@ -317,6 +317,7 @@ + diff --git a/Libraries/UniversalEditor.UserInterface/Editor.cs b/Libraries/UniversalEditor.UserInterface/Editor.cs index 7246161a..c24dfe53 100644 --- a/Libraries/UniversalEditor.UserInterface/Editor.cs +++ b/Libraries/UniversalEditor.UserInterface/Editor.cs @@ -64,6 +64,10 @@ namespace UniversalEditor.UserInterface private void Selections_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { + Application.Instance.Commands["EditCut"].Enabled = (Selections.Count > 0); + Application.Instance.Commands["EditCopy"].Enabled = (Selections.Count > 0); + Application.Instance.Commands["EditDelete"].Enabled = (Selections.Count > 0); + OnSelectionsChanged(e); } @@ -583,6 +587,9 @@ namespace UniversalEditor.UserInterface OnDocumentEdited(EventArgs.Empty); mvarEditing--; + + Application.Instance.Commands["EditUndo"].Enabled = undo.Count > 0; + Application.Instance.Commands["EditRedo"].Enabled = redo.Count > 0; } /// @@ -632,6 +639,9 @@ namespace UniversalEditor.UserInterface redo.Push(newedi); ProcessingUndoRedo = false; + + Application.Instance.Commands["EditUndo"].Enabled = undo.Count > 0; + Application.Instance.Commands["EditRedo"].Enabled = redo.Count > 0; } /// @@ -675,6 +685,9 @@ namespace UniversalEditor.UserInterface undo.Push(newedi); ProcessingUndoRedo = false; + + Application.Instance.Commands["EditUndo"].Enabled = undo.Count > 0; + Application.Instance.Commands["EditRedo"].Enabled = redo.Count > 0; } #endregion diff --git a/Libraries/UniversalEditor.UserInterface/Editors/Database/DatabaseEditor.cs b/Libraries/UniversalEditor.UserInterface/Editors/Database/DatabaseEditor.cs index aa1466f6..a00817ee 100644 --- a/Libraries/UniversalEditor.UserInterface/Editors/Database/DatabaseEditor.cs +++ b/Libraries/UniversalEditor.UserInterface/Editors/Database/DatabaseEditor.cs @@ -26,10 +26,11 @@ using MBS.Framework.UserInterface; using MBS.Framework.UserInterface.Controls; using MBS.Framework.UserInterface.Dialogs; using MBS.Framework.UserInterface.Layouts; +using UniversalEditor.UserInterface.Editors.Database.Dialogs; using UniversalEditor.ObjectModels.Database; using UniversalEditor.UserInterface; -namespace UniversalEditor.Editors.Database +namespace UniversalEditor.UserInterface.Editors.Database { /// /// Provides a UWT-based for manipulating database files. @@ -158,6 +159,15 @@ namespace UniversalEditor.Editors.Database } } + private void DatabaseEditor_ContextMenu_Columns_Add(object sender, EventArgs e) + { + ColumnPropertiesDialog dlg = new ColumnPropertiesDialog(); + if (dlg.ShowDialog() == DialogResult.OK) + { + + } + } + protected override void OnCreated(EventArgs e) { base.OnCreated(e); @@ -165,6 +175,8 @@ namespace UniversalEditor.Editors.Database DocumentExplorer.BeforeContextMenu += DocumentExplorer_BeforeContextMenu; OnObjectModelChanged(EventArgs.Empty); + Context.AttachCommandEventHandler("DatabaseEditor_ContextMenu_Columns_Add", DatabaseEditor_ContextMenu_Columns_Add); + Context.AttachCommandEventHandler("DatabaseEditor_ContextMenu_Table_NewTable", delegate (object sender, EventArgs ee) { DatabaseObjectModel db = (ObjectModel as DatabaseObjectModel); diff --git a/Libraries/UniversalEditor.UserInterface/Editors/Database/Dialogs/ColumnPropertiesDialog.cs b/Libraries/UniversalEditor.UserInterface/Editors/Database/Dialogs/ColumnPropertiesDialog.cs new file mode 100644 index 00000000..ab537ee2 --- /dev/null +++ b/Libraries/UniversalEditor.UserInterface/Editors/Database/Dialogs/ColumnPropertiesDialog.cs @@ -0,0 +1,43 @@ +// +// ColumnPropertiesDialog.cs +// +// Author: +// Michael Becker +// +// Copyright (c) 2021 Mike Becker's Software +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System; +using MBS.Framework.UserInterface; +using MBS.Framework.UserInterface.Controls; + +namespace UniversalEditor.UserInterface.Editors.Database.Dialogs +{ + [ContainerLayout(typeof(ColumnPropertiesDialog), "UniversalEditor.UserInterface.Editors.Database.Dialogs.ColumnPropertiesDialog.glade")] + public class ColumnPropertiesDialog : CustomDialog + { + private Button cmdOK; + private Button cmdCancel; + private TextBox txtColumnName; + private ComboBox cboDataType; + private TextBox txtDescription; + private GroupBox fraDataTypeSpecificProperties; + + protected override void OnCreated(EventArgs e) + { + base.OnCreated(e); + DefaultButton = cmdOK; + } + } +} diff --git a/Libraries/UniversalEditor.UserInterface/Editors/Database/Dialogs/ColumnPropertiesDialog.glade b/Libraries/UniversalEditor.UserInterface/Editors/Database/Dialogs/ColumnPropertiesDialog.glade new file mode 100644 index 00000000..3832f196 --- /dev/null +++ b/Libraries/UniversalEditor.UserInterface/Editors/Database/Dialogs/ColumnPropertiesDialog.glade @@ -0,0 +1,246 @@ + + + + + + + + + + + + 500 + 400 + False + Column Properties + dialog + + + + + + False + vertical + 2 + + + False + end + + + gtk-ok + True + True + True + True + + + + True + True + 0 + + + + + gtk-cancel + True + True + True + True + + + True + True + 1 + + + + + False + False + 0 + + + + + True + False + 16 + 16 + 16 + 16 + vertical + + + True + False + 8 + 8 + + + True + False + _Name + True + 0 + + + 0 + 0 + + + + + True + True + True + + + 1 + 0 + + + + + True + False + Data _type + True + 0 + + + 0 + 1 + + + + + True + False + True + tmDataType + + + + 0 + + + + + 1 + 1 + + + + + True + False + start + _Description + True + 0 + + + 0 + 2 + + + + + True + True + True + in + + + True + True + + + + + 1 + 2 + + + + + False + True + 0 + + + + + True + False + 16 + 0 + in + + + True + False + 12 + + + True + False + 8 + 8 + 8 + 8 + + + + + + + + + + + + + + + + + + + + + + + + + True + False + 8 + 8 + 8 + 8 + Data type specific properties + + + + + True + True + 1 + + + + + True + True + 1 + + + + + + diff --git a/Libraries/UniversalEditor.UserInterface/Editors/Database/ScriptTableMode.cs b/Libraries/UniversalEditor.UserInterface/Editors/Database/ScriptTableMode.cs index 1d96d23f..1c1358fb 100644 --- a/Libraries/UniversalEditor.UserInterface/Editors/Database/ScriptTableMode.cs +++ b/Libraries/UniversalEditor.UserInterface/Editors/Database/ScriptTableMode.cs @@ -19,7 +19,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . using System; -namespace UniversalEditor.Editors.Database +namespace UniversalEditor.UserInterface.Editors.Database { public enum ScriptTableMode { diff --git a/Libraries/UniversalEditor.UserInterface/Editors/Database/ScriptTableTo.cs b/Libraries/UniversalEditor.UserInterface/Editors/Database/ScriptTableTo.cs index 1a53e1fb..b3461c8d 100644 --- a/Libraries/UniversalEditor.UserInterface/Editors/Database/ScriptTableTo.cs +++ b/Libraries/UniversalEditor.UserInterface/Editors/Database/ScriptTableTo.cs @@ -19,7 +19,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . using System; -namespace UniversalEditor.Editors.Database +namespace UniversalEditor.UserInterface.Editors.Database { public enum ScriptTableTo { diff --git a/Libraries/UniversalEditor.UserInterface/Editors/Database/Views/DesignView.cs b/Libraries/UniversalEditor.UserInterface/Editors/Database/Views/DesignView.cs index 401fc953..9f0b6c7b 100644 --- a/Libraries/UniversalEditor.UserInterface/Editors/Database/Views/DesignView.cs +++ b/Libraries/UniversalEditor.UserInterface/Editors/Database/Views/DesignView.cs @@ -24,7 +24,7 @@ using MBS.Framework.UserInterface.Controls; using UniversalEditor.ObjectModels.Database; using UniversalEditor.UserInterface; -namespace UniversalEditor.Editors.Database.Views +namespace UniversalEditor.UserInterface.Editors.Database.Views { [ContainerLayout("~/Editors/Database/Views/DesignView.glade")] public class DesignView : View @@ -39,7 +39,7 @@ namespace UniversalEditor.Editors.Database.Views private bool _InhibitEditing = false; - [EventHandler(nameof(txtName), "Changed")] + [EventHandler(nameof(txtName), nameof(TextBox.Changed))] private void txtName_Changed(object sender, EventArgs e) { if (_InhibitEditing) return; @@ -52,6 +52,12 @@ namespace UniversalEditor.Editors.Database.Views Editor.EndEdit(); } + [EventHandler(nameof(tvColumns), nameof(Control.BeforeContextMenu))] + private void tvColumns_BeforeContextMenu(object sender, EventArgs e) + { + tvColumns.ContextMenuCommandID = "DatabaseEditor_ContextMenu_Columns"; + } + protected override void OnObjectModelChanged(EventArgs e) { base.OnObjectModelChanged(e); diff --git a/Libraries/UniversalEditor.UserInterface/Editors/Database/Views/ScriptView.cs b/Libraries/UniversalEditor.UserInterface/Editors/Database/Views/ScriptView.cs index 788fca78..3355d69d 100644 --- a/Libraries/UniversalEditor.UserInterface/Editors/Database/Views/ScriptView.cs +++ b/Libraries/UniversalEditor.UserInterface/Editors/Database/Views/ScriptView.cs @@ -28,7 +28,7 @@ using MBS.Framework.UserInterface.Dialogs; using UniversalEditor.ObjectModels.Database; using UniversalEditor.UserInterface; -namespace UniversalEditor.Editors.Database.Views +namespace UniversalEditor.UserInterface.Editors.Database.Views { [ContainerLayout("~/Editors/Database/Views/ScriptView.glade")] public class ScriptView : View diff --git a/Libraries/UniversalEditor.UserInterface/Editors/FileSystem/FileSystemEditor.cs b/Libraries/UniversalEditor.UserInterface/Editors/FileSystem/FileSystemEditor.cs index 69024db4..119392ee 100644 --- a/Libraries/UniversalEditor.UserInterface/Editors/FileSystem/FileSystemEditor.cs +++ b/Libraries/UniversalEditor.UserInterface/Editors/FileSystem/FileSystemEditor.cs @@ -111,6 +111,28 @@ namespace UniversalEditor.Editors.FileSystem { Application.Instance.Contexts.Remove(ctxTreeView); } + [EventHandler(nameof(tv), nameof(ListViewControl.SelectionChanged))] + private void tv_SelectionChanged(object sender, EventArgs e) + { + Selections.Clear(); + + IFileSystemObject[] sels = GetSelectedItems(); + if (sels.Length > 0) + { + Selections.Add(new FileSystemSelection(this, GetSelectedItems())); + } + } + + private IFileSystemObject[] GetSelectedItems() + { + List list = new List(); + for (int i = 0; i < tv.SelectedRows.Count; i++) + { + IFileSystemObject fso = tv.SelectedRows[i].GetExtraData("item"); + list.Add(fso); + } + return list.ToArray(); + } /// /// Navigates to the specified . diff --git a/Libraries/UniversalEditor.UserInterface/Pages/EditorPage.cs b/Libraries/UniversalEditor.UserInterface/Pages/EditorPage.cs index 3c9bc0d8..6a83d1af 100644 --- a/Libraries/UniversalEditor.UserInterface/Pages/EditorPage.cs +++ b/Libraries/UniversalEditor.UserInterface/Pages/EditorPage.cs @@ -105,8 +105,8 @@ namespace UniversalEditor.UserInterface.Pages return true; } - private EditorReference DefaultBinaryEditor = new EditorReference(typeof(Editors.Binary.BinaryEditor)); - private EditorReference DefaultTextEditor = new EditorReference(typeof(Editors.Text.Plain.PlainTextEditor)); + private EditorReference DefaultBinaryEditor = new EditorReference(typeof(UniversalEditor.Editors.Binary.BinaryEditor)); + private EditorReference DefaultTextEditor = new EditorReference(typeof(UniversalEditor.Editors.Text.Plain.PlainTextEditor)); private Document mvarDocument = null; public Document Document diff --git a/Libraries/UniversalEditor.UserInterface/UniversalEditor.UserInterface.csproj b/Libraries/UniversalEditor.UserInterface/UniversalEditor.UserInterface.csproj index 025307ab..f5b94d8e 100644 --- a/Libraries/UniversalEditor.UserInterface/UniversalEditor.UserInterface.csproj +++ b/Libraries/UniversalEditor.UserInterface/UniversalEditor.UserInterface.csproj @@ -135,6 +135,7 @@ + @@ -193,12 +194,14 @@ + +