From 1251b8b91191030158c90137599b416e1a3637c8 Mon Sep 17 00:00:00 2001 From: Ciprian Khlud Date: Sun, 20 Jul 2014 11:37:27 +0300 Subject: [PATCH 01/39] Addeed first version of WPF NewFileWindow. Needs more revisions to have parity with original. Categories do work --- .../Project/ICSharpCode.SharpDevelop.csproj | 100 ++++++++---------- .../Src/Gui/Dialogs/NewFileCategory.cs | 35 ++++++ .../Src/Gui/Dialogs/NewFileTemplateItem.cs | 15 +++ .../Src/Gui/Dialogs/NewFileViewModel.cs | 65 ++++++++++++ .../Src/Gui/Dialogs/NewFileWindow.xaml | 81 ++++++++++++++ .../Src/Gui/Dialogs/NewFileWindow.xaml.cs | 92 ++++++++++++++++ .../ICSharpCode.Core.WinForms.csproj | 28 +++-- src/Main/SharpDevelop/Services/UIService.cs | 13 +++ 8 files changed, 369 insertions(+), 60 deletions(-) create mode 100644 src/Main/Base/Project/Src/Gui/Dialogs/NewFileCategory.cs create mode 100644 src/Main/Base/Project/Src/Gui/Dialogs/NewFileTemplateItem.cs create mode 100644 src/Main/Base/Project/Src/Gui/Dialogs/NewFileViewModel.cs create mode 100644 src/Main/Base/Project/Src/Gui/Dialogs/NewFileWindow.xaml create mode 100644 src/Main/Base/Project/Src/Gui/Dialogs/NewFileWindow.xaml.cs diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj index ee778929a92..90310508d95 100644 --- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj +++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj @@ -272,7 +272,9 @@ Code - + + UserControl + StringListEditorDialog.xaml @@ -281,15 +283,26 @@ Code - + + Form + AsynchronousWaitDialog.cs - + + Form + AbstractAttachToProcessForm.cs + + + + + NewFileWindow.xaml + Code + OutputWindowOptionsPanel.xaml Code @@ -410,10 +423,10 @@ ExtractInterfaceDialog.cs - + + Form - NewProjectDialog.cs @@ -536,11 +549,15 @@ - + + Form + ToolNotFoundDialog.cs - + + UserControl + TabbedOptionsDialog.xaml Code @@ -657,11 +674,9 @@ UserControl - - UserControl - + - Form + UserControl Form @@ -669,9 +684,7 @@ UserControl - - Form - + Form @@ -682,7 +695,7 @@ Component - Component + UserControl Component @@ -807,7 +820,6 @@ - UserControl BuildEvents.xaml @@ -831,12 +843,18 @@ - + + Component + - - + + Form + + + UserControl + @@ -844,8 +862,12 @@ - - + + Form + + + Component + @@ -861,7 +883,9 @@ - + + Component + @@ -878,22 +902,13 @@ - - - - - - - - - - + @@ -950,27 +965,6 @@ ICSharpCode.Core False - - - - - - - - - - - - - - - - - - - - - {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9} ICSharpCode.Core.Presentation diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/NewFileCategory.cs b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileCategory.cs new file mode 100644 index 00000000000..9794e5df566 --- /dev/null +++ b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileCategory.cs @@ -0,0 +1,35 @@ +using System.Collections.ObjectModel; +using ICSharpCode.SharpDevelop.Widgets; + +namespace ICSharpCode.SharpDevelop.Gui +{ + public class NewFileCategory : ViewModelBase + { + private string _displayName; + + public NewFileCategory(string displayName) + { + Children = new ObservableCollection(); + Templates = new ObservableCollection(); + DisplayName = displayName; + } + + public ObservableCollection Children { get; set; } + public ObservableCollection Templates { get; set; } + + public string DisplayName + { + get { return _displayName; } + set + { + _displayName = value; + OnPropertyChanged(); + } + } + + public bool IsEmpty + { + get { return Children.Count == 0; } + } + } +} \ No newline at end of file diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/NewFileTemplateItem.cs b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileTemplateItem.cs new file mode 100644 index 00000000000..52358718c44 --- /dev/null +++ b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileTemplateItem.cs @@ -0,0 +1,15 @@ +using ICSharpCode.SharpDevelop.Templates; +using ICSharpCode.SharpDevelop.Widgets; + +namespace ICSharpCode.SharpDevelop.Gui +{ + public class NewFileTemplateItem : ViewModelBase + { + public NewFileTemplateItem(FileTemplate template) + { + Template = template; + } + + public FileTemplate Template { get; private set; } + } +} \ No newline at end of file diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/NewFileViewModel.cs b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileViewModel.cs new file mode 100644 index 00000000000..6ccec7493d5 --- /dev/null +++ b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileViewModel.cs @@ -0,0 +1,65 @@ +/* + * Created by SharpDevelop. + * User: Ciprian Khlud + * Date: 7/19/2014 + * Time: 10:52 PM + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using ICSharpCode.Core; +using ICSharpCode.SharpDevelop.Templates; +using ICSharpCode.SharpDevelop.Widgets; +using ICSharpCode.SharpDevelop.Project; + +namespace ICSharpCode.SharpDevelop.Gui +{ + public class NewFileViewModel : ViewModelBase + { + public NewFileViewModel() + { + AllTemplate = new ObservableCollection(); + Templates = new ObservableCollection() + { + new NewFileCategory("Empty file") + }; + Icons= new Dictionary(); + Categories = new ObservableCollection(); + } + public IProject Project + { + get; + set; + } + + public DirectoryName BasePath + { + get; + set; + } + + public bool AllowUntitledFiles + { + get; + set; + } + + public FileTemplateResult Result { get; set; } + + public string SearchFor { get; set; } + public string Description { get; set; } + public ObservableCollection AllTemplate { get; set; } + + public Dictionary Icons { + get; + set; + } + + public ObservableCollection Categories { get; set; } + + public ObservableCollection Templates { get; set; } + } +} + diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/NewFileWindow.xaml b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileWindow.xaml new file mode 100644 index 00000000000..293af78a910 --- /dev/null +++ b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileWindow.xaml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +