diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin
index e99bb17330..642ebd6b39 100644
--- a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin
@@ -76,9 +76,7 @@
-
+
diff --git a/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.cs b/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.cs
index 147b30c4c9..be98f3ac74 100644
--- a/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.cs
+++ b/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.cs
@@ -23,7 +23,7 @@ namespace ICSharpCode.CppBinding.Project
///
/// Application settings panel for c++ project.
///
- public class ApplicationOptions : ICSharpCode.SharpDevelop.Gui.OptionPanels.ApplicationSettings
+ public class ApplicationOptions : ICSharpCode.SharpDevelop.Gui.OptionPanels.old_ApplicationSettings
{
public override void LoadPanelContents()
{
diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
index 6411f91370..df94e51a83 100644
--- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
+++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
@@ -269,8 +269,8 @@
TaskListOptionsl.xaml
Code
-
- ApplicationSettingsXaml.xaml
+
+ ApplicationSettings.xaml
Code
@@ -727,10 +727,10 @@
-
+
UserControl
-
+
@@ -890,7 +890,7 @@
-
+
diff --git a/src/Main/Base/Project/Resources/ProjectOptions/ApplicationSettings.xfrm b/src/Main/Base/Project/Resources/ProjectOptions/old_ApplicationSettings.xfrm
similarity index 100%
rename from src/Main/Base/Project/Resources/ProjectOptions/ApplicationSettings.xfrm
rename to src/Main/Base/Project/Resources/ProjectOptions/old_ApplicationSettings.xfrm
diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettingsXaml.xaml b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml
similarity index 98%
rename from src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettingsXaml.xaml
rename to src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml
index 7319b0c9f9..ecd987d0a4 100644
--- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettingsXaml.xaml
+++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml
@@ -1,6 +1,6 @@
-
diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml.cs b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml.cs
new file mode 100644
index 0000000000..2a543722b3
--- /dev/null
+++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml.cs
@@ -0,0 +1,329 @@
+/*
+ * Created by SharpDevelop.
+ * User: Peter Forstmeier
+ * Date: 01.04.2012
+ * Time: 17:16
+ * To change this template use Tools | Options | Coding | Edit Standard Headers.
+ */
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+
+using ICSharpCode.Core;
+using ICSharpCode.SharpDevelop.Dom;
+using ICSharpCode.SharpDevelop.Editor;
+using ICSharpCode.SharpDevelop.Project;
+using Microsoft.Win32;
+
+//using System.Windows.Forms;
+
+
+
+
+
+namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
+{
+ ///
+ /// Interaction logic for ApplicationSettingsXaml.xaml
+ ///
+ public partial class ApplicationSettings : ProjectOptionPanel
+ {
+ private const string iconsfilter = "${res:SharpDevelop.FileFilter.Icons}|*.ico|${res:SharpDevelop.FileFilter.AllFiles}|*.*";
+ private const string manifestFilter = "${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.ManifestFiles}|*.manifest|${res:SharpDevelop.FileFilter.AllFiles}|*.*";
+ private const string win32filter = "Win32 Resource files|*.res|${res:SharpDevelop.FileFilter.AllFiles}|*.*";
+ MSBuildBasedProject project;
+
+ public ApplicationSettings()
+ {
+ InitializeComponent();
+ }
+
+
+ private void Initialize()
+ {
+
+//
+// http://www.beacosta.com/blog/?p=52
+ foreach (IClass c in GetPossibleStartupObjects(project)) {
+ startupObjectComboBox.Items.Add(c.FullyQualifiedName);
+ }
+
+ this.outputTypeComboBox.SelectedValue = OutputType.Value.ToString();
+
+ FillManifestCombo();
+
+ // embedding manifests requires the project to target MSBuild 3.5 or higher
+ project_MinimumSolutionVersionChanged(null, null);
+ // re-evaluate if the project has the minimum version whenever this options page gets visible
+ // because the "convert project" button on the compiling tab page might have updated the MSBuild version.
+ project.MinimumSolutionVersionChanged += project_MinimumSolutionVersionChanged;
+
+ projectFolderTextBox.Text = project.Directory;
+ projectFileTextBox.Text = Path.GetFileName(project.FileName);
+
+ //OptionBinding
+ RefreshStartupObjectEnabled(this, EventArgs.Empty);
+ RefreshOutputNameTextBox(this, null);
+
+ ApplicationIconTextBox_TextChanged(this,null);
+ this.startupObjectComboBox.SelectionChanged += (s,e) => {IsDirty = true;};
+ }
+
+
+ void FillManifestCombo()
+ {
+ applicationManifestComboBox.Items.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.EmbedDefault}"));
+ applicationManifestComboBox.Items.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.DoNotEmbedManifest}"));
+ foreach (string fileName in Directory.GetFiles(project.Directory, "*.manifest")) {
+ applicationManifestComboBox.Items.Add(Path.GetFileName(fileName));
+ }
+ applicationManifestComboBox.Items.Add(StringParser.Parse("<${res:Global.CreateButtonText}...>"));
+ applicationManifestComboBox.Items.Add(StringParser.Parse("<${res:Global.BrowseText}...>"));
+ applicationManifestComboBox.SelectedIndex = 0;
+ }
+
+
+ public ProjectProperty AssemblyName {
+ get { return GetProperty("AssemblyName", "", TextBoxEditMode.EditRawProperty); }
+ }
+
+ public ProjectProperty RootNamespace {
+ get { return GetProperty("RootNamespace", "", TextBoxEditMode.EditRawProperty); }
+ }
+
+
+ public ProjectProperty OutputType {
+ get {return GetProperty("OutputType", ICSharpCode.SharpDevelop.Project.OutputType.Exe); }
+ }
+
+
+ public ProjectProperty ApplicationIcon {
+ get { return GetProperty("ApplicationIcon", "", TextBoxEditMode.EditRawProperty); }
+ }
+
+
+ public ProjectProperty ApplicationManifest {
+ get { return GetProperty("ApplicationManifest", "", TextBoxEditMode.EditRawProperty); }
+ }
+
+
+ public ProjectProperty Win32Resource {
+ get { return GetProperty("Win32Resource", "", TextBoxEditMode.EditRawProperty); }
+ }
+
+
+ #region overrides
+
+
+ protected override void Load(MSBuildBasedProject project, string configuration, string platform)
+ {
+ base.Load(project, configuration, platform);
+ this.project = project;
+ Initialize();
+ }
+
+
+ protected override bool Save(MSBuildBasedProject project, string configuration, string platform)
+ {
+ return base.Save(project, configuration, platform);
+ }
+
+ #endregion
+
+
+ public static IList GetPossibleStartupObjects(IProject project)
+ {
+ List results = new List();
+ IProjectContent pc = ParserService.GetProjectContent(project);
+ if (pc != null) {
+ foreach(IClass c in pc.Classes) {
+ foreach (IMethod m in c.Methods) {
+ if (m.IsStatic && m.Name == "Main") {
+ results.Add(c);
+ }
+ }
+ }
+ }
+ return results;
+ }
+
+ void project_MinimumSolutionVersionChanged(object sender, EventArgs e)
+ {
+ // embedding manifests requires the project to target MSBuild 3.5 or higher
+ applicationManifestComboBox.IsEnabled = project.MinimumSolutionVersion >= Solution.SolutionVersionVS2008;
+ }
+
+ #region refresh Outputpath + StartupOptions
+
+ void RefreshOutputNameTextBox (object sender, TextChangedEventArgs e)
+ {
+ if (this.outputTypeComboBox.SelectedValue != null) {
+ var enmType = (OutputType) Enum.Parse(typeof(OutputType),this.outputTypeComboBox.SelectedValue.ToString());
+ this.outputNameTextBox.Text = this.assemblyNameTextBox.Text + CompilableProject.GetExtension(enmType);
+ }
+ }
+
+
+ void RefreshStartupObjectEnabled(object sender, EventArgs e)
+ {
+ if (this.outputTypeComboBox.SelectedValue != null) {
+ var enmType = (OutputType) Enum.Parse(typeof(OutputType),this.outputTypeComboBox.SelectedValue.ToString());
+ bool isLibrary = ICSharpCode.SharpDevelop.Project.OutputType.Library == enmType;
+ startupObjectComboBox.IsEnabled = !isLibrary;
+ }
+ }
+
+
+ void OutputTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ RefreshOutputNameTextBox(this,null);
+ RefreshStartupObjectEnabled(this,null);
+ }
+
+
+ #endregion
+
+ #region ApplicationIcon
+
+ void ApplicationIconButton_Click(object sender, RoutedEventArgs e)
+ {
+ var filter = StringParser.Parse(iconsfilter);
+ string fileName = BrowseForFile(filter);
+ if (!String.IsNullOrEmpty(fileName))
+ {
+ this.applicationIconTextBox.Text = fileName;
+ }
+ }
+
+
+ void ApplicationIconTextBox_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ if (project != null) {
+ if(FileUtility.IsValidPath(this.applicationIconTextBox.Text))
+ {
+ string appIconPath = Path.Combine(project.Directory, this.applicationIconTextBox.Text);
+ Console.WriteLine(appIconPath);
+ var b = File.Exists(appIconPath);
+ if (File.Exists(appIconPath)) {
+
+ try {
+
+ FileStream stream = new FileStream(appIconPath, FileMode.Open, FileAccess.Read);
+ Image image = new Image();
+ BitmapImage src = new BitmapImage();
+ src.BeginInit();
+ src.StreamSource = stream;
+ src.EndInit();
+
+ image.Source = src;
+ image.Stretch = Stretch.Uniform;
+
+ this.applicationIconImage.Source = image.Source;
+ this.applicationIconImage.Stretch = Stretch.Fill;
+
+ } catch (OutOfMemoryException) {
+ this.applicationIconImage.Source = null;
+ MessageService.ShowErrorFormatted("${res:Dialog.ProjectOptions.ApplicationSettings.InvalidIconFile}",
+ FileUtility.NormalizePath(appIconPath));
+ }
+ } else {
+ this.applicationIconImage.Source = null;
+ }
+ }
+ }
+ }
+
+ #endregion
+
+ #region manifest
+
+ void ApplicationManifestComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (applicationManifestComboBox.SelectedIndex == applicationManifestComboBox.Items.Count - 2) {
+ CreateManifest();
+ } else if (applicationManifestComboBox.SelectedIndex == applicationManifestComboBox.Items.Count - 1) {
+ BrowseForManifest();
+ }
+ }
+
+
+ void BrowseForManifest()
+ {
+ applicationManifestComboBox.SelectedIndex = -1;
+ var fileName = BrowseForFile(manifestFilter);
+ if (!String.IsNullOrEmpty(fileName)) {
+ this.applicationManifestComboBox.Items.Insert(0,fileName);
+ this.applicationManifestComboBox.SelectedIndex = 0;
+ }
+ }
+
+ void CreateManifest()
+ {
+ string manifestFile = Path.Combine(project.Directory, "app.manifest");
+ if (!File.Exists(manifestFile)) {
+ string defaultManifest;
+ using (Stream stream = typeof(ApplicationSettings).Assembly.GetManifestResourceStream("Resources.DefaultManifest.manifest")) {
+ if (stream == null)
+ throw new ResourceNotFoundException("DefaultManifest.manifest");
+ using (StreamReader r = new StreamReader(stream)) {
+ defaultManifest = r.ReadToEnd();
+ }
+ }
+ defaultManifest = defaultManifest.Replace("\t", EditorControlService.GlobalOptions.IndentationString);
+ File.WriteAllText(manifestFile, defaultManifest, System.Text.Encoding.UTF8);
+ FileService.FireFileCreated(manifestFile, false);
+ }
+
+ if (!project.IsFileInProject(manifestFile)) {
+ FileProjectItem newItem = new FileProjectItem(project, ItemType.None);
+ newItem.Include = "app.manifest";
+ ProjectService.AddProjectItem(project, newItem);
+ ProjectBrowserPad.RefreshViewAsync();
+ }
+
+ FileService.OpenFile(manifestFile);
+
+ this.applicationManifestComboBox.Items.Insert(0,"app.manifest");
+ this.applicationManifestComboBox.SelectedIndex = 0;
+ }
+
+ #endregion
+
+ #region openFile
+
+ string BrowseForFile (string filter)
+ {
+ OpenFileDialog fileDialog = new OpenFileDialog {
+ Filter = filter,
+ Multiselect = false
+ };
+
+ if (fileDialog.ShowDialog() != true || fileDialog.FileNames.Length == 0)
+ return String.Empty;
+ return fileDialog.FileName;
+ }
+
+ #endregion
+
+
+ #region Win32ResourceFile
+
+ void Win32ResourceComboButton_Click(object sender, RoutedEventArgs e)
+ {
+ var filter = StringParser.Parse(win32filter);
+ string fileName = BrowseForFile(filter);
+ if (!String.IsNullOrEmpty(fileName))
+ {
+ this.win32ResourceFileTextBox.Text = fileName;
+ }
+ }
+
+ #endregion
+
+
+ }
+}
diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.cs b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/old_ApplicationSettings.cs
similarity index 98%
rename from src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.cs
rename to src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/old_ApplicationSettings.cs
index 13f89ea282..a063443f16 100644
--- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.cs
+++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/old_ApplicationSettings.cs
@@ -14,13 +14,13 @@ using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
{
- public class ApplicationSettings : AbstractXmlFormsProjectOptionPanel
+ public class old_ApplicationSettings : AbstractXmlFormsProjectOptionPanel
{
ComboBox applicationManifestComboBox;
public override void LoadPanelContents()
{
- SetupFromXmlResource("ProjectOptions.ApplicationSettings.xfrm");
+ SetupFromXmlResource("ProjectOptions.old_ApplicationSettings.xfrm");
InitializeHelper();