diff --git a/Terminal.Gui/Windows/AllowedType.cs b/Terminal.Gui/Windows/AllowedType.cs index 12eff9f78..29d04cd87 100644 --- a/Terminal.Gui/Windows/AllowedType.cs +++ b/Terminal.Gui/Windows/AllowedType.cs @@ -8,7 +8,7 @@ namespace Terminal.Gui { /// /// Describes a requirement on what can be selected - /// in a . + /// in a . /// public class AllowedType { diff --git a/Terminal.Gui/Windows/FileDialog2.cs b/Terminal.Gui/Windows/FileDialog.cs similarity index 98% rename from Terminal.Gui/Windows/FileDialog2.cs rename to Terminal.Gui/Windows/FileDialog.cs index 3c01a2f85..5380857b2 100644 --- a/Terminal.Gui/Windows/FileDialog2.cs +++ b/Terminal.Gui/Windows/FileDialog.cs @@ -20,19 +20,19 @@ namespace Terminal.Gui { /// Modal dialog for selecting files/directories. Has auto-complete and expandable /// navigation pane (Recent, Root drives etc). /// - public partial class FileDialog2 : Dialog { + public partial class FileDialog : Dialog { /// /// Gets settings for controlling how visual elements behave. Style changes should /// be made before the is loaded and shown to the user for the /// first time. /// - public FileDialog2Style Style { get; } = new FileDialog2Style (); + public FileDialogStyle Style { get; } = new FileDialogStyle (); /// - /// Stores style settings for . + /// Stores style settings for . /// - public class FileDialog2Style { + public class FileDialogStyle { /// /// Gets or sets the header text displayed in the Filename column of the files table. @@ -190,9 +190,9 @@ namespace Terminal.Gui { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public FileDialog2 () + public FileDialog () { var lblPath = new Label (">"); this.btnOk = new Button (Style.OkButtonText) { @@ -1415,7 +1415,7 @@ namespace Terminal.Gui { if (fsi is FileInfo fi) { this.MachineReadableLength = fi.Length; this.HumanReadableLength = GetHumanReadableFileSize (this.MachineReadableLength); - this.DateModified = FileDialog2.UseUtcDates ? File.GetLastWriteTimeUtc (fi.FullName) : File.GetLastWriteTime (fi.FullName); + this.DateModified = FileDialog.UseUtcDates ? File.GetLastWriteTimeUtc (fi.FullName) : File.GetLastWriteTime (fi.FullName); this.Type = fi.Extension; } else { this.HumanReadableLength = string.Empty; @@ -1461,7 +1461,7 @@ namespace Terminal.Gui { StringComparer.InvariantCultureIgnoreCase); } - internal object GetOrderByValue (FileDialog2 dlg, string columnName) + internal object GetOrderByValue (FileDialog dlg, string columnName) { if (dlg.Style.FilenameColumnName == columnName) return this.FileSystemInfo.Name; @@ -1520,7 +1520,7 @@ namespace Terminal.Gui { object oLockFound = new object (); CancellationTokenSource token = new CancellationTokenSource (); - public SearchState (DirectoryInfo dir, FileDialog2 parent, string searchTerms) : base (dir, parent) + public SearchState (DirectoryInfo dir, FileDialog parent, string searchTerms) : base (dir, parent) { parent.SearchMatcher.Initialize (searchTerms); Children = new FileSystemInfoStats [0]; @@ -1596,7 +1596,7 @@ namespace Terminal.Gui { } lock (oLockFound) { - if (found.Count >= FileDialog2.MaxSearchResults) { + if (found.Count >= FileDialog.MaxSearchResults) { finished = true; return; } @@ -1626,8 +1626,8 @@ namespace Terminal.Gui { internal class FileDialogState { public FileSystemInfoStats Selected { get; set; } - protected readonly FileDialog2 Parent; - public FileDialogState (DirectoryInfo dir, FileDialog2 parent) + protected readonly FileDialog Parent; + public FileDialogState (DirectoryInfo dir, FileDialog parent) { this.Directory = dir; Parent = parent; @@ -1816,7 +1816,7 @@ namespace Terminal.Gui { } var path = this.Text.ToString (); - var last = path.LastIndexOfAny (FileDialog2.separators); + var last = path.LastIndexOfAny (FileDialog.separators); if (last == -1 || suggestions.Length == 0 || last >= path.Length - 1) { this.currentFragment = null; @@ -1917,9 +1917,9 @@ namespace Terminal.Gui { internal class FileDialogHistory { private Stack back = new Stack (); private Stack forward = new Stack (); - private FileDialog2 dlg; + private FileDialog dlg; - public FileDialogHistory (FileDialog2 dlg) + public FileDialogHistory (FileDialog dlg) { this.dlg = dlg; } @@ -2026,13 +2026,13 @@ namespace Terminal.Gui { } private class FileDialogSorter { - private readonly FileDialog2 dlg; + private readonly FileDialog dlg; private TableView tableView; private DataColumn currentSort = null; private bool currentSortIsAsc = true; - public FileDialogSorter (FileDialog2 dlg, TableView tableView) + public FileDialogSorter (FileDialog dlg, TableView tableView) { this.dlg = dlg; this.tableView = tableView; diff --git a/Terminal.Gui/Windows/OpenDialog.cs b/Terminal.Gui/Windows/OpenDialog.cs index b81c56c2d..a689c3697 100644 --- a/Terminal.Gui/Windows/OpenDialog.cs +++ b/Terminal.Gui/Windows/OpenDialog.cs @@ -55,7 +55,7 @@ namespace Terminal.Gui { /// To select more than one file, users can use the spacebar, or control-t. /// /// - public class OpenDialog : FileDialog2 { + public class OpenDialog : FileDialog { /// /// Initializes a new . diff --git a/Terminal.Gui/Windows/SaveDialog.cs b/Terminal.Gui/Windows/SaveDialog.cs index b80337cb2..a860365da 100644 --- a/Terminal.Gui/Windows/SaveDialog.cs +++ b/Terminal.Gui/Windows/SaveDialog.cs @@ -27,7 +27,7 @@ namespace Terminal.Gui { /// null if the user canceled. /// /// - public class SaveDialog : FileDialog2 { + public class SaveDialog : FileDialog { /// /// Initializes a new . /// diff --git a/UICatalog/Resources/config.json b/UICatalog/Resources/config.json index d3ed6387d..a949b426d 100644 --- a/UICatalog/Resources/config.json +++ b/UICatalog/Resources/config.json @@ -3,7 +3,7 @@ "Application.QuitKey": { "Key": "Esc" }, - "FileDialog2.MaxSearchResults" : 10000, + "FileDialog.MaxSearchResults" : 10000, "AppSettings": { "UICatalog.StatusBar": true, "ConfigurationEditor.EditorColorScheme": { diff --git a/UICatalog/Scenarios/CsvEditor.cs b/UICatalog/Scenarios/CsvEditor.cs index 62b0323d2..5bfdaeea1 100644 --- a/UICatalog/Scenarios/CsvEditor.cs +++ b/UICatalog/Scenarios/CsvEditor.cs @@ -393,7 +393,7 @@ namespace UICatalog.Scenarios { private void Open () { - var ofd = new FileDialog2 () { + var ofd = new FileDialog () { AllowedTypes = new List { new AllowedType("Comma Separated Values (.csv)", ".csv") } }; ofd.Style.OkButtonText = "Open"; diff --git a/UICatalog/Scenarios/FileDialog2Examples.cs b/UICatalog/Scenarios/FileDialogExamples.cs similarity index 94% rename from UICatalog/Scenarios/FileDialog2Examples.cs rename to UICatalog/Scenarios/FileDialogExamples.cs index bb9372907..0c970c04b 100644 --- a/UICatalog/Scenarios/FileDialog2Examples.cs +++ b/UICatalog/Scenarios/FileDialogExamples.cs @@ -8,9 +8,9 @@ using Terminal.Gui.Graphs; using static Terminal.Gui.OpenDialog; namespace UICatalog.Scenarios { - [ScenarioMetadata (Name: "FileDialog2", Description: "Demonstrates how to the FileDialog2 class")] + [ScenarioMetadata (Name: "FileDialog", Description: "Demonstrates how to the FileDialog class")] [ScenarioCategory ("Dialogs")] - public class FileDialog2Examples : Scenario { + public class FileDialogExamples : Scenario { private CheckBox cbMustExist; private CheckBox cbIcons; private CheckBox cbUseColors; @@ -104,7 +104,7 @@ namespace UICatalog.Scenarios { private void SetupHandler (Button btn) { btn.Clicked += () => { - var fd = new FileDialog2() { + var fd = new FileDialog() { OpenMode = Enum.Parse( rgOpenMode.RadioLabels[rgOpenMode.SelectedItem].ToString()), MustExist = cbMustExist.Checked ?? false, @@ -154,7 +154,7 @@ namespace UICatalog.Scenarios { }; } - private class CaseSensitiveSearchMatcher : FileDialog2.ISearchMatcher { + private class CaseSensitiveSearchMatcher : FileDialog.ISearchMatcher { private string terms; public void Initialize (string terms) diff --git a/UnitTests/FileDialog2Tests.cs b/UnitTests/FileDialogTests.cs similarity index 85% rename from UnitTests/FileDialog2Tests.cs rename to UnitTests/FileDialogTests.cs index 416c9def9..cdaeac403 100644 --- a/UnitTests/FileDialog2Tests.cs +++ b/UnitTests/FileDialogTests.cs @@ -6,7 +6,7 @@ using Xunit; namespace Terminal.Gui.Core { - public class FileDialog2Tests { + public class FileDialogTests { [Fact, AutoInitShutdown] public void OnLoad_TextBoxIsFocused () @@ -14,14 +14,14 @@ namespace Terminal.Gui.Core { var dlg = GetInitializedFileDialog (); // First focused is ContentView :( Assert.NotNull (dlg.Focused.Focused); - Assert.IsType (dlg.Focused.Focused); + Assert.IsType (dlg.Focused.Focused); } [Fact, AutoInitShutdown] public void DirectTyping_Allowed () { var dlg = GetInitializedFileDialog (); - var tf = dlg.Subviews [0].Subviews.OfType ().Single (); + var tf = dlg.Subviews [0].Subviews.OfType ().Single (); tf.ClearAllSelection (); tf.CursorPosition = tf.Text.Length; Assert.True (tf.HasFocus); @@ -101,7 +101,7 @@ namespace Terminal.Gui.Core { [Fact, AutoInitShutdown] public void Autocomplete_NoSuggestion_WhenTextMatchesExactly () { - var tb = new FileDialog2.TextFieldWithAppendAutocomplete (); + var tb = new FileDialog.TextFieldWithAppendAutocomplete (); ForceFocus (tb); tb.Text = "/bob/fish"; @@ -117,7 +117,7 @@ namespace Terminal.Gui.Core { [Fact, AutoInitShutdown] public void Autocomplete_AcceptSuggstion () { - var tb = new FileDialog2.TextFieldWithAppendAutocomplete (); + var tb = new FileDialog.TextFieldWithAppendAutocomplete (); ForceFocus (tb); tb.Text = @"/bob/fi"; @@ -136,19 +136,19 @@ namespace Terminal.Gui.Core { hasFocus.SetValue (v, true); } - private FileDialog2.TextFieldWithAppendAutocomplete GetTextField (FileDialog2 dlg = null) + private FileDialog.TextFieldWithAppendAutocomplete GetTextField (FileDialog dlg = null) { if (dlg == null) { dlg = GetInitializedFileDialog (); } // First view of a Dialog is ContentView - return dlg.Subviews [0].Subviews.OfType ().Single (); + return dlg.Subviews [0].Subviews.OfType ().Single (); } - private FileDialog2 GetInitializedFileDialog () + private FileDialog GetInitializedFileDialog () { - var dlg = new FileDialog2 (); + var dlg = new FileDialog (); dlg.BeginInit (); dlg.EndInit (); Application.Begin (dlg); diff --git a/UnitTests/TopLevels/DialogTests.cs b/UnitTests/TopLevels/DialogTests.cs index d943348e2..3dea9ccb1 100644 --- a/UnitTests/TopLevels/DialogTests.cs +++ b/UnitTests/TopLevels/DialogTests.cs @@ -581,7 +581,7 @@ namespace Terminal.Gui.TopLevelTests { public void FileDialog_FileSystemWatcher () { for (int i = 0; i < 8; i++) { - var fd = new FileDialog2 (); + var fd = new FileDialog (); fd.Ready += () => Application.RequestStop (); Application.Run (fd); } diff --git a/UnitTests/TopLevels/ToplevelTests.cs b/UnitTests/TopLevels/ToplevelTests.cs index 9cd47ce4b..bb8af123a 100644 --- a/UnitTests/TopLevels/ToplevelTests.cs +++ b/UnitTests/TopLevels/ToplevelTests.cs @@ -667,7 +667,7 @@ namespace Terminal.Gui.TopLevelTests { public void FileDialog_FileSystemWatcher () { for (int i = 0; i < 8; i++) { - var fd = new FileDialog2 (); + var fd = new FileDialog (); fd.Ready += () => Application.RequestStop (); Application.Run (fd); }