Browse Source

Fixed project creation (don't create both AnyCPU and x86 platforms)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4894 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
ef2cbabe03
  1. 4
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerGenerator.cs
  2. 4
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockDesignerGenerator.cs
  3. 4
      src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesignerGenerator.cs
  4. 1
      src/AddIns/DisplayBindings/FormsDesigner/Project/FormsDesigner.csproj
  5. 4
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs
  6. 4
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/IDesignerGenerator.cs
  7. 226
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/XmlDesignerGenerator.cs
  8. 4
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs
  9. 2
      src/Main/Base/Project/Src/Internal/Templates/Project/ProjectCreateInformation.cs
  10. 2
      src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs

4
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerGenerator.cs

@ -73,6 +73,10 @@ namespace ICSharpCode.PythonBinding @@ -73,6 +73,10 @@ namespace ICSharpCode.PythonBinding
{
}
public void NotifyFormRenamed(string newName)
{
}
/// <summary>
/// Updates the InitializeComponent method's body with the generated code.
/// </summary>

4
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockDesignerGenerator.cs

@ -63,6 +63,10 @@ namespace PythonBinding.Tests.Utils @@ -63,6 +63,10 @@ namespace PythonBinding.Tests.Utils
{
}
public void NotifyFormRenamed(string newName)
{
}
public void MergeRootComponentChanges(IDesignerHost host, IDesignerSerializationManager serializationManager)
{
mergeChangesHost = host;

4
src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesignerGenerator.cs

@ -100,6 +100,10 @@ namespace ICSharpCode.WixBinding @@ -100,6 +100,10 @@ namespace ICSharpCode.WixBinding
{
}
public void NotifyFormRenamed(string newName)
{
}
public bool InsertComponentEvent(IComponent component, EventDescriptor edesc, string eventMethodName, string body, out string file, out int position)
{
file = null;

1
src/AddIns/DisplayBindings/FormsDesigner/Project/FormsDesigner.csproj

@ -60,7 +60,6 @@ @@ -60,7 +60,6 @@
<Compile Include="Src\DesignerGenerator\CodeDOMGenerator.cs" />
<Compile Include="Src\DesignerGenerator\CSharpDesignerGenerator.cs" />
<Compile Include="Src\DesignerGenerator\IDesignerGenerator.cs" />
<Compile Include="Src\DesignerGenerator\XmlDesignerGenerator.cs" />
<Compile Include="Src\DesignerLoader\AbstractCodeDomDesignerLoader.cs" />
<Compile Include="Src\DesignerLoader\NRefactoryDesignerLoader.cs" />
<Compile Include="Src\DesignerSourceCodeStorage.cs" />

4
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs

@ -24,7 +24,7 @@ using ReflectionLayer = ICSharpCode.SharpDevelop.Dom.ReflectionLayer; @@ -24,7 +24,7 @@ using ReflectionLayer = ICSharpCode.SharpDevelop.Dom.ReflectionLayer;
namespace ICSharpCode.FormsDesigner
{
public abstract class AbstractDesignerGenerator : IDesignerGenerator2
public abstract class AbstractDesignerGenerator : IDesignerGenerator
{
/// <summary>The currently open part of the class being designed.</summary>
IClass currentClassPart;
@ -471,6 +471,8 @@ namespace ICSharpCode.FormsDesigner @@ -471,6 +471,8 @@ namespace ICSharpCode.FormsDesigner
/// <returns></returns>
public virtual bool InsertComponentEvent(IComponent component, EventDescriptor edesc, string eventMethodName, string body, out string file, out int position)
{
if (edesc == null)
throw new ArgumentNullException("edesc");
Reparse();
LoggingService.Debug("Forms designer: AbstractDesignerGenerator.InsertComponentEvent: eventMethodName=" + eventMethodName);

4
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/IDesignerGenerator.cs

@ -36,10 +36,6 @@ namespace ICSharpCode.FormsDesigner @@ -36,10 +36,6 @@ namespace ICSharpCode.FormsDesigner
void MergeFormChanges(CodeCompileUnit unit);
bool InsertComponentEvent(IComponent component, EventDescriptor edesc, string eventMethodName, string body, out string file, out int position);
ICollection GetCompatibleMethods(EventDescriptor edesc);
}
public interface IDesignerGenerator2 : IDesignerGenerator
{
void NotifyFormRenamed(string newName);
}
}

226
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/XmlDesignerGenerator.cs

@ -1,226 +0,0 @@ @@ -1,226 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using System.Xml;
using ICSharpCode.SharpDevelop;
namespace ICSharpCode.FormsDesigner
{
public class XmlDesignerGenerator : IDesignerGenerator
{
FormsDesignerViewContent viewContent;
public CodeDomProvider CodeDomProvider {
get {
return new Microsoft.CSharp.CSharpCodeProvider();
}
}
public FormsDesignerViewContent ViewContent {
get { return this.viewContent; }
}
public void Attach(FormsDesignerViewContent viewContent)
{
this.viewContent = viewContent;
}
public void Detach()
{
this.viewContent = null;
}
public IEnumerable<OpenedFile> GetSourceFiles(out OpenedFile designerCodeFile)
{
designerCodeFile = this.viewContent.PrimaryFile;
return new [] {designerCodeFile};
}
public void MergeFormChanges(CodeCompileUnit unit)
{
StringWriter writer = new StringWriter();
XmlTextWriter xml = new XmlTextWriter(writer);
xml.Formatting = Formatting.Indented;
//xml.WriteStartDocument();
XmlElement el = GetElementFor(new XmlDocument(), viewContent.Host);
xml.WriteStartElement(el.Name);
xml.WriteAttributeString("version", "1.0");
foreach (XmlNode node in el.ChildNodes) {
node.WriteTo(xml);
}
xml.WriteEndElement();
//xml.WriteEndDocument();
viewContent.DesignerCodeFileContent = writer.ToString();
}
public bool InsertComponentEvent(IComponent component, EventDescriptor edesc, string eventMethodName, string body, out string file, out int position)
{
position = 0;
file = this.viewContent.PrimaryFileName;
return false;
}
public ICollection GetCompatibleMethods(EventDescriptor edesc)
{
return new object[] {};
}
public ICollection GetCompatibleMethods(EventInfo edesc)
{
return new object[] {};
}
public XmlElement GetElementFor(XmlDocument doc, object o, Hashtable visitedControls)
{
if (doc == null) {
throw new ArgumentNullException("doc");
}
if (o == null) {
throw new ArgumentNullException("o");
}
visitedControls[o] = null;
try {
XmlElement el = doc.CreateElement(XmlConvert.EncodeName(o.GetType().FullName));
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(o);
Control ctrl = o as Control;
bool nameInserted = false;
if (ctrl != null) {
XmlElement childEl = doc.CreateElement("Name");
XmlAttribute valueAttribute = doc.CreateAttribute("value");
valueAttribute.InnerText = ctrl.Name;
childEl.Attributes.Append(valueAttribute);
el.AppendChild(childEl);
nameInserted = true;
}
// add collections as last child elements in the xml (because it is better
// to set the properties first and then add items to controls (looks nicer
// in XML and CODE))
ArrayList childNodes = new ArrayList();
// the Controls collection should be generated as the last
// element because properties like 'anchor' in the child elements
// must be applied after the size has set.
foreach (PropertyDescriptor pd in properties) {
// if (!pd.ShouldSerializeValue(o)) {
// continue;
// }
if (pd.Name == "Name" && nameInserted) {
continue;
}
if (pd.Name == "DataBindings" || pd.Name == "FlatAppearance" ||
// TabControl duplicate TabPages Workaround (TabPages got inserted twice : In Controls and in TabPages)
(o.GetType().FullName == "System.Windows.Forms.TabControl" && pd.Name == "Controls")) {
continue;
}
XmlElement childEl = null;
if (pd.Name == "Size" && ctrl != null && (ctrl is UserControl || ctrl is Form)) {
childEl = doc.CreateElement("ClientSize");
childEl.SetAttribute("value", ctrl.ClientSize.ToString());
childNodes.Insert(0, childEl);
continue;
}
childEl = doc.CreateElement(XmlConvert.EncodeName(pd.Name));
object propertyValue = null;
try {
propertyValue = pd.GetValue(o);
} catch (Exception e) {
ICSharpCode.Core.LoggingService.Warn(e);
continue;
}
// lists are other than normal properties
if (propertyValue is IList && !(ctrl is PropertyGrid)) {
foreach (object listObject in (IList)propertyValue) {
XmlElement newEl = GetElementFor(doc, listObject, visitedControls);
if (newEl != null && !newEl.Name.StartsWith("System.Windows.Forms.Design.")) {
childEl.AppendChild(newEl);
}
}
// only insert lists that contain elements (no empty lists!)
if (childEl.ChildNodes.Count > 0) {
childNodes.Add(childEl);
}
} else if (pd.ShouldSerializeValue(o) && pd.IsBrowsable) {
XmlAttribute valueAttribute = doc.CreateAttribute("value");
if (propertyValue == null) {
valueAttribute.InnerText = null;
} else if (propertyValue is Color) {
valueAttribute.InnerText = propertyValue.ToString();
} else {
TypeConverter typeConv = TypeDescriptor.GetConverter(pd.PropertyType);
valueAttribute.InnerText = typeConv.ConvertToInvariantString(propertyValue);
}
childEl.Attributes.Append(valueAttribute);
childNodes.Insert(0, childEl);
}
}
foreach (XmlElement childEl in childNodes) {
el.AppendChild(childEl);
}
// fallback to ToString, if no members can be generated (for example
// handling System.String)
if (el.ChildNodes.Count == 0) {
XmlAttribute valueAttribute = doc.CreateAttribute("value");
valueAttribute.InnerText = o.ToString();
el.Attributes.Append(valueAttribute);
}
return el;
} catch (Exception e) {
ICSharpCode.Core.MessageService.ShowException(e);
}
return null;
}
public XmlElement GetElementFor(XmlDocument doc, IDesignerHost host)
{
XmlElement componentsElement = doc.CreateElement("Components");
XmlAttribute versionAttribute = doc.CreateAttribute("version");
versionAttribute.InnerText = "1.0";
componentsElement.Attributes.Append(versionAttribute);
Hashtable visitedControls = new Hashtable();
// insert root element
componentsElement.AppendChild(GetElementFor(doc, host.RootComponent, visitedControls));
// insert any non gui (=tray components)
foreach (IComponent component in host.Container.Components) {
if (!(component is Control) && !visitedControls.ContainsKey(component)) {
componentsElement.AppendChild(GetElementFor(doc, component, visitedControls));
}
}
return componentsElement;
}
}
}

4
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs

@ -369,9 +369,7 @@ namespace ICSharpCode.FormsDesigner @@ -369,9 +369,7 @@ namespace ICSharpCode.FormsDesigner
&& !object.Equals(e.OldValue, e.NewValue))
{
// changing the name of the form
IDesignerGenerator2 gen2 = generator as IDesignerGenerator2;
if (gen2 != null)
gen2.NotifyFormRenamed((string)e.NewValue);
generator.NotifyFormRenamed((string)e.NewValue);
}
} catch (Exception ex) {
MessageService.ShowException(ex);

2
src/Main/Base/Project/Src/Internal/Templates/Project/ProjectCreateInformation.cs

@ -25,7 +25,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -25,7 +25,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
internal List<IProject> createdProjects = new List<IProject>();
public ProjectCreateInformation() {
Platform = "AnyCPU";
Platform = "x86";
}
public ReadOnlyCollection<IProject> CreatedProjects {

2
src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs

@ -195,7 +195,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -195,7 +195,7 @@ namespace ICSharpCode.SharpDevelop.Project
this.ActiveConfiguration = "Debug";
this.ActivePlatform = information.Platform;
SetProperty(null, "x86", "PlatformTarget", "x86", PropertyStorageLocations.PlatformSpecific, false);
SetProperty(null, information.Platform, "PlatformTarget", "x86", PropertyStorageLocations.PlatformSpecific, false);
}
/// <summary>

Loading…
Cancel
Save