Browse Source

Applied Forms Designer patch by Robert Zaunere.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1260 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
52e68ef768
  1. 44
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs
  2. 12
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/CodeDOMGenerator.cs

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

@ -50,6 +50,12 @@ namespace ICSharpCode.FormsDesigner
} }
} }
public FormsDesignerViewContent ViewContent {
get {
return viewContent;
}
}
public void Attach(FormsDesignerViewContent viewContent) public void Attach(FormsDesignerViewContent viewContent)
{ {
this.viewContent = viewContent; this.viewContent = viewContent;
@ -130,7 +136,7 @@ namespace ICSharpCode.FormsDesigner
protected abstract DomRegion GetReplaceRegion(ICSharpCode.TextEditor.Document.IDocument document, IMethod method); protected abstract DomRegion GetReplaceRegion(ICSharpCode.TextEditor.Document.IDocument document, IMethod method);
public void MergeFormChanges(CodeCompileUnit unit) public virtual void MergeFormChanges(CodeCompileUnit unit)
{ {
Reparse(); Reparse();
@ -246,8 +252,32 @@ namespace ICSharpCode.FormsDesigner
} }
IDocument document; IDocument document;
string saveDocumentToFile; // only set when InitializeComponent was loaded from code-behind file that was not opened string saveDocumentToFile;
string designerFile; // file that contains InitializeComponents string designerFile;
/// <summary>
/// The document containing the content of the <see cref="DesignerFile"/>. Can be a
/// text editor document or independent of a text editor if partial classes are used.
/// </summary>
protected IDocument Document {
get { return document; }
set { document = value; }
}
/// <summary>
/// only set when InitializeComponent was loaded from code-behind file that was not open,
/// is normally either null or the same value as <see cref="DesignerFile"/>.
/// </summary>
protected string SaveDocumentToFile {
get { return saveDocumentToFile; }
set { saveDocumentToFile = value; }
}
/// <summary>
/// file that contains InitializeComponents
/// </summary>
protected string DesignerFile {
get { return designerFile; }
set { designerFile = value; }
}
void SaveDocument() void SaveDocument()
{ {
@ -319,7 +349,7 @@ namespace ICSharpCode.FormsDesigner
/// <param name="component"></param> /// <param name="component"></param>
/// <param name="edesc"></param> /// <param name="edesc"></param>
/// <returns></returns> /// <returns></returns>
public bool InsertComponentEvent(IComponent component, EventDescriptor edesc, string eventMethodName, string body, out string file, out int position) public virtual bool InsertComponentEvent(IComponent component, EventDescriptor edesc, string eventMethodName, string body, out string file, out int position)
{ {
if (this.failedDesignerInitialize) { if (this.failedDesignerInitialize) {
position = 0; position = 0;
@ -354,7 +384,7 @@ namespace ICSharpCode.FormsDesigner
return c.Region.EndLine; return c.Region.EndLine;
} }
public ICollection GetCompatibleMethods(EventDescriptor edesc) public virtual ICollection GetCompatibleMethods(EventDescriptor edesc)
{ {
Reparse(); Reparse();
ArrayList compatibleMethods = new ArrayList(); ArrayList compatibleMethods = new ArrayList();
@ -379,7 +409,7 @@ namespace ICSharpCode.FormsDesigner
return compatibleMethods; return compatibleMethods;
} }
public ICollection GetCompatibleMethods(EventInfo edesc) public virtual ICollection GetCompatibleMethods(EventInfo edesc)
{ {
Reparse(); Reparse();
ArrayList compatibleMethods = new ArrayList(); ArrayList compatibleMethods = new ArrayList();
@ -403,7 +433,7 @@ namespace ICSharpCode.FormsDesigner
return compatibleMethods; return compatibleMethods;
} }
IField GetField(IClass c, string name) protected IField GetField(IClass c, string name)
{ {
foreach (IField field in c.Fields) { foreach (IField field in c.Fields) {
if (field.Name == name) { if (field.Name == name) {

12
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/CodeDOMGenerator.cs

@ -38,13 +38,23 @@ namespace ICSharpCode.FormsDesigner
CodeDOMGeneratorUtility codeDOMGeneratorUtility = new CodeDOMGeneratorUtility(); CodeDOMGeneratorUtility codeDOMGeneratorUtility = new CodeDOMGeneratorUtility();
string indentation; string indentation;
protected CodeDomProvider CodeDomProvider {
get { return codeProvider; }
}
protected CodeDOMGeneratorUtility CodeDOMGeneratorUtility {
get { return codeDOMGeneratorUtility; }
}
protected string Indentation {
get { return indentation; }
}
public CodeDOMGenerator(CodeDomProvider codeProvider, string indentation) public CodeDOMGenerator(CodeDomProvider codeProvider, string indentation)
{ {
this.codeProvider = codeProvider; this.codeProvider = codeProvider;
this.indentation = indentation; this.indentation = indentation;
} }
public void ConvertContentDefinition(CodeMemberMethod method, TextWriter writer) public virtual void ConvertContentDefinition(CodeMemberMethod method, TextWriter writer)
{ {
LoggingService.Info("Generate code for: "+method.Name); LoggingService.Info("Generate code for: "+method.Name);

Loading…
Cancel
Save