diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
index ee778929a9..90310508d9 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 0000000000..9794e5df56
--- /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 0000000000..52358718c4
--- /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 0000000000..6ccec7493d
--- /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 0000000000..293af78a91
--- /dev/null
+++ b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileWindow.xaml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/NewFileWindow.xaml.cs b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileWindow.xaml.cs
new file mode 100644
index 0000000000..f767694d28
--- /dev/null
+++ b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileWindow.xaml.cs
@@ -0,0 +1,92 @@
+/*
+ * 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 System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using ICSharpCode.Core;
+using ICSharpCode.SharpDevelop.Project;
+using ICSharpCode.SharpDevelop.Templates;
+
+namespace ICSharpCode.SharpDevelop.Gui
+{
+ ///
+ /// Interaction logic for NewFileWindow.xaml
+ ///
+ public partial class NewFileWindow : Window
+ {
+ public NewFileViewModel ViewModel
+ {
+ get
+ {
+ return (NewFileViewModel)DataContext;
+ }
+ }
+ public NewFileWindow()
+ {
+ InitializeComponent();
+ }
+ public NewFileWindow(IProject project, DirectoryName basePath, IEnumerable templateCategories)
+ {
+ DataContext = new NewFileViewModel();
+ InitializeComponent();
+ ViewModel.Project = project;
+ ViewModel.BasePath = basePath;
+ ViewModel.AllowUntitledFiles = basePath == null;
+ InitializeTemplates(templateCategories, ViewModel.Categories);
+ }
+
+ void InitializeTemplates(IEnumerable templateCategories, ObservableCollection categories)
+ {
+ foreach (var templateCategory in Sorted(templateCategories)) {
+ var cat = CreateCategory(templateCategory);
+ categories.Add(cat);
+ }
+ }
+
+ IEnumerable Sorted(IEnumerable templateCategories)
+ {
+ return templateCategories.OrderByDescending(c => c.SortOrder).ThenBy(c => StringParser.Parse(c.DisplayName));
+ }
+
+ NewFileCategory CreateCategory(TemplateCategory templateCategory)
+ {
+ var node = new NewFileCategory(templateCategory.DisplayName);
+ foreach (var subcategory in Sorted(templateCategory.Subcategories))
+ {
+ var subnode = CreateCategory(subcategory);
+ node.Children.Add(subnode);
+ }
+ foreach (var template in templateCategory.Templates.OfType())
+ {
+ if (!template.IsVisible(ViewModel.Project))
+ continue;
+ var titem = new NewFileTemplateItem(template);
+ if (titem.Template.Icon != null)
+ {
+ ViewModel.Icons[titem.Template.Icon] = 0; // "create template icon"
+ }
+ ViewModel.AllTemplate.Add(titem);
+ node.Templates.Add(titem);
+ }
+ return node;
+ }
+ private void okButtonClick(object sender, RoutedEventArgs e)
+ {
+ Close();
+ }
+
+ private void cancelButtonClick(object sender, RoutedEventArgs e)
+ {
+ Close();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Main/ICSharpCode.Core.WinForms/ICSharpCode.Core.WinForms.csproj b/src/Main/ICSharpCode.Core.WinForms/ICSharpCode.Core.WinForms.csproj
index d6aabfe10f..9aa51cd8b0 100644
--- a/src/Main/ICSharpCode.Core.WinForms/ICSharpCode.Core.WinForms.csproj
+++ b/src/Main/ICSharpCode.Core.WinForms/ICSharpCode.Core.WinForms.csproj
@@ -63,19 +63,29 @@
Properties\GlobalAssemblyInfo.cs
-
+
+ Component
+
Component
-
-
+
+ Component
+
+
+ Component
+
Form
-
-
+
+ Form
+
+
+ Form
+
Form
@@ -84,11 +94,15 @@
Component
-
+
+ Component
+
Component
-
+
+ Component
+
Component
diff --git a/src/Main/SharpDevelop/Services/UIService.cs b/src/Main/SharpDevelop/Services/UIService.cs
index 66a96bb013..38bfdfc017 100644
--- a/src/Main/SharpDevelop/Services/UIService.cs
+++ b/src/Main/SharpDevelop/Services/UIService.cs
@@ -16,6 +16,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
+//#define EXPERIMENTAL_NEW_FILE
+
using System;
using System.Collections.Generic;
using System.Linq;
@@ -49,6 +51,17 @@ namespace ICSharpCode.SharpDevelop
#if DEBUG
SD.Templates.UpdateTemplates();
#endif
+ #if EXPERIMENTAL_NEW_FILE
+ var nfdWpf = new NewFileWindow(project, directory, templates ?? SD.Templates.TemplateCategories);
+ if (nfdWpf.ShowDialog() ?? false)
+ {
+ return nfdWpf.ViewModel.Result;
+ }
+ else
+ {
+ return null;
+ }
+ #endif
using (NewFileDialog nfd = new NewFileDialog(project, directory, templates ?? SD.Templates.TemplateCategories)) {
if (nfd.ShowDialog(SD.WinForms.MainWin32Window) == DialogResult.OK)
return nfd.result;