Browse Source
Remaining problems: Application can hang after debugging. Selecting item in Errors list does not jump to text editor line.pull/39/merge
36 changed files with 2016 additions and 1480 deletions
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Windows.Input; |
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler.Core |
||||
{ |
||||
public class DelegateCommand : ICommand |
||||
{ |
||||
Action<object> execute; |
||||
Predicate<object> canExecute; |
||||
|
||||
public DelegateCommand(Action<object> execute, Predicate<object> canExecute) |
||||
{ |
||||
this.execute = execute; |
||||
this.canExecute = canExecute; |
||||
} |
||||
|
||||
public DelegateCommand(Action<object> execute) |
||||
: this(execute, null) |
||||
{ |
||||
} |
||||
|
||||
public event EventHandler CanExecuteChanged { |
||||
add { CommandManager.RequerySuggested += value; } |
||||
remove { CommandManager.RequerySuggested -= value; } |
||||
} |
||||
|
||||
public void Execute(object parameter) |
||||
{ |
||||
execute(parameter); |
||||
} |
||||
|
||||
public bool CanExecute(object parameter) |
||||
{ |
||||
if (canExecute != null) { |
||||
return canExecute(parameter); |
||||
} |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,96 @@
@@ -0,0 +1,96 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.AvalonEdit.Document; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.Collections.Specialized; |
||||
using ICSharpCode.SharpDevelop.Bookmarks; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler.Core |
||||
{ |
||||
/// <summary>
|
||||
/// Stores the entries in the icon bar margin. Multiple icon bar margins
|
||||
/// can use the same manager if split view is used.
|
||||
/// </summary>
|
||||
public class IconBarManager : IBookmarkMargin |
||||
{ |
||||
ObservableCollection<IBookmark> bookmarks = new ObservableCollection<IBookmark>(); |
||||
|
||||
public IconBarManager() |
||||
{ |
||||
bookmarks.CollectionChanged += bookmarks_CollectionChanged; |
||||
} |
||||
|
||||
public IList<IBookmark> Bookmarks { |
||||
get { return bookmarks; } |
||||
} |
||||
|
||||
void bookmarks_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) |
||||
{ |
||||
Redraw(); |
||||
} |
||||
|
||||
public void Redraw() |
||||
{ |
||||
if (RedrawRequested != null) |
||||
RedrawRequested(this, EventArgs.Empty); |
||||
} |
||||
|
||||
public event EventHandler RedrawRequested; |
||||
|
||||
[Obsolete("Please provide a TextDocument; this is necessary so that the bookmarks can move when lines are inserted/removed")] |
||||
public void UpdateClassMemberBookmarks(ParseInformation parseInfo) |
||||
{ |
||||
UpdateClassMemberBookmarks(parseInfo, null); |
||||
} |
||||
|
||||
public void UpdateClassMemberBookmarks(ParseInformation parseInfo, TextDocument document) |
||||
{ |
||||
for (int i = bookmarks.Count - 1; i >= 0; i--) { |
||||
if (IsClassMemberBookmark(bookmarks[i])) |
||||
bookmarks.RemoveAt(i); |
||||
} |
||||
if (parseInfo == null) |
||||
return; |
||||
foreach (IClass c in parseInfo.CompilationUnit.Classes) { |
||||
AddClassMemberBookmarks(c, document); |
||||
} |
||||
} |
||||
|
||||
void AddClassMemberBookmarks(IClass c, TextDocument document) |
||||
{ |
||||
if (c.IsSynthetic) return; |
||||
if (!c.Region.IsEmpty) { |
||||
bookmarks.Add(new ClassBookmark(c, document)); |
||||
} |
||||
foreach (IClass innerClass in c.InnerClasses) { |
||||
AddClassMemberBookmarks(innerClass, document); |
||||
} |
||||
foreach (IMethod m in c.Methods) { |
||||
if (m.Region.IsEmpty || m.IsSynthetic) continue; |
||||
bookmarks.Add(new ClassMemberBookmark(m, document)); |
||||
} |
||||
foreach (IProperty p in c.Properties) { |
||||
if (p.Region.IsEmpty || p.IsSynthetic) continue; |
||||
bookmarks.Add(new ClassMemberBookmark(p, document)); |
||||
} |
||||
foreach (IField f in c.Fields) { |
||||
if (f.Region.IsEmpty || f.IsSynthetic) continue; |
||||
bookmarks.Add(new ClassMemberBookmark(f, document)); |
||||
} |
||||
foreach (IEvent e in c.Events) { |
||||
if (e.Region.IsEmpty || e.IsSynthetic) continue; |
||||
bookmarks.Add(new ClassMemberBookmark(e, document)); |
||||
} |
||||
} |
||||
|
||||
static bool IsClassMemberBookmark(IBookmark b) |
||||
{ |
||||
return b is ClassMemberBookmark || b is ClassBookmark; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,259 @@
@@ -0,0 +1,259 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Windows; |
||||
using System.Windows.Input; |
||||
using System.Windows.Media; |
||||
|
||||
using ICSharpCode.AvalonEdit.Editing; |
||||
using ICSharpCode.AvalonEdit.Rendering; |
||||
using ICSharpCode.AvalonEdit.Utils; |
||||
using ICSharpCode.SharpDevelop.Bookmarks; |
||||
using ICSharpCode.SharpDevelop.Debugging; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler.Core |
||||
{ |
||||
/// <summary>
|
||||
/// Icon bar: contains breakpoints and other icons.
|
||||
/// </summary>
|
||||
public class IconBarMargin : AbstractMargin, IDisposable |
||||
{ |
||||
readonly IBookmarkMargin manager; |
||||
|
||||
public IconBarMargin(IBookmarkMargin manager) |
||||
{ |
||||
if (manager == null) |
||||
throw new ArgumentNullException("manager"); |
||||
this.manager = manager; |
||||
} |
||||
|
||||
#region OnTextViewChanged
|
||||
/// <inheritdoc/>
|
||||
protected override void OnTextViewChanged(TextView oldTextView, TextView newTextView) |
||||
{ |
||||
if (oldTextView != null) { |
||||
oldTextView.VisualLinesChanged -= OnRedrawRequested; |
||||
manager.RedrawRequested -= OnRedrawRequested; |
||||
} |
||||
base.OnTextViewChanged(oldTextView, newTextView); |
||||
if (newTextView != null) { |
||||
newTextView.VisualLinesChanged += OnRedrawRequested; |
||||
manager.RedrawRequested += OnRedrawRequested; |
||||
} |
||||
InvalidateVisual(); |
||||
} |
||||
|
||||
void OnRedrawRequested(object sender, EventArgs e) |
||||
{ |
||||
// Don't invalidate the IconBarMargin if it'll be invalidated again once the
|
||||
// visual lines become valid.
|
||||
if (this.TextView != null && this.TextView.VisualLinesValid) { |
||||
InvalidateVisual(); |
||||
} |
||||
} |
||||
|
||||
public virtual void Dispose() |
||||
{ |
||||
this.TextView = null; // detach from TextView (will also detach from manager)
|
||||
} |
||||
#endregion
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters) |
||||
{ |
||||
// accept clicks even when clicking on the background
|
||||
return new PointHitTestResult(this, hitTestParameters.HitPoint); |
||||
} |
||||
|
||||
/// <inheritdoc/>
|
||||
protected override Size MeasureOverride(Size availableSize) |
||||
{ |
||||
return new Size(18, 0); |
||||
} |
||||
|
||||
protected override void OnRender(DrawingContext drawingContext) |
||||
{ |
||||
Size renderSize = this.RenderSize; |
||||
drawingContext.DrawRectangle(SystemColors.ControlBrush, null, |
||||
new Rect(0, 0, renderSize.Width, renderSize.Height)); |
||||
drawingContext.DrawLine(new Pen(SystemColors.ControlDarkBrush, 1), |
||||
new Point(renderSize.Width - 0.5, 0), |
||||
new Point(renderSize.Width - 0.5, renderSize.Height)); |
||||
|
||||
TextView textView = this.TextView; |
||||
if (textView != null && textView.VisualLinesValid) { |
||||
// create a dictionary line number => first bookmark
|
||||
Dictionary<int, IBookmark> bookmarkDict = new Dictionary<int, IBookmark>(); |
||||
foreach (IBookmark bm in manager.Bookmarks) { |
||||
int line = bm.LineNumber; |
||||
IBookmark existingBookmark; |
||||
if (!bookmarkDict.TryGetValue(line, out existingBookmark) || bm.ZOrder > existingBookmark.ZOrder) |
||||
bookmarkDict[line] = bm; |
||||
} |
||||
Size pixelSize = PixelSnapHelpers.GetPixelSize(this); |
||||
foreach (VisualLine line in textView.VisualLines) { |
||||
int lineNumber = line.FirstDocumentLine.LineNumber; |
||||
IBookmark bm; |
||||
if (bookmarkDict.TryGetValue(lineNumber, out bm)) { |
||||
double lineMiddle = line.GetTextLineVisualYPosition(line.TextLines[0], VisualYPosition.TextMiddle) - textView.VerticalOffset; |
||||
Rect rect = new Rect(0, PixelSnapHelpers.Round(lineMiddle - 8, pixelSize.Height), 16, 16); |
||||
if (dragDropBookmark == bm && dragStarted) |
||||
drawingContext.PushOpacity(0.5); |
||||
drawingContext.DrawImage((bm.Image ?? BookmarkBase.DefaultBookmarkImage).ImageSource, rect); |
||||
if (dragDropBookmark == bm && dragStarted) |
||||
drawingContext.Pop(); |
||||
} |
||||
} |
||||
if (dragDropBookmark != null && dragStarted) { |
||||
Rect rect = new Rect(0, PixelSnapHelpers.Round(dragDropCurrentPoint - 8, pixelSize.Height), 16, 16); |
||||
drawingContext.DrawImage((dragDropBookmark.Image ?? BookmarkBase.DefaultBookmarkImage).ImageSource, rect); |
||||
} |
||||
} |
||||
} |
||||
|
||||
IBookmark dragDropBookmark; // bookmark being dragged (!=null if drag'n'drop is active)
|
||||
double dragDropStartPoint; |
||||
double dragDropCurrentPoint; |
||||
bool dragStarted; // whether drag'n'drop operation has started (mouse was moved minimum distance)
|
||||
|
||||
protected override void OnMouseDown(MouseButtonEventArgs e) |
||||
{ |
||||
CancelDragDrop(); |
||||
base.OnMouseDown(e); |
||||
int line = GetLineFromMousePosition(e); |
||||
if (!e.Handled && line > 0) { |
||||
IBookmark bm = GetBookmarkFromLine(line); |
||||
if (bm != null) { |
||||
bm.MouseDown(e); |
||||
if (!e.Handled) { |
||||
if (e.ChangedButton == MouseButton.Left && bm.CanDragDrop && CaptureMouse()) { |
||||
StartDragDrop(bm, e); |
||||
e.Handled = true; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
// don't allow selecting text through the IconBarMargin
|
||||
if (e.ChangedButton == MouseButton.Left) |
||||
e.Handled = true; |
||||
} |
||||
|
||||
IBookmark GetBookmarkFromLine(int line) |
||||
{ |
||||
IBookmark result = null; |
||||
foreach (IBookmark bm in manager.Bookmarks) { |
||||
if (bm.LineNumber == line) { |
||||
if (result == null || bm.ZOrder > result.ZOrder) |
||||
result = bm; |
||||
} |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
protected override void OnLostMouseCapture(MouseEventArgs e) |
||||
{ |
||||
CancelDragDrop(); |
||||
base.OnLostMouseCapture(e); |
||||
} |
||||
|
||||
void StartDragDrop(IBookmark bm, MouseEventArgs e) |
||||
{ |
||||
dragDropBookmark = bm; |
||||
dragDropStartPoint = dragDropCurrentPoint = e.GetPosition(this).Y; |
||||
if (TextView != null) { |
||||
TextArea area = TextView.Services.GetService(typeof(TextArea)) as TextArea; |
||||
if (area != null) |
||||
area.PreviewKeyDown += TextArea_PreviewKeyDown; |
||||
} |
||||
} |
||||
|
||||
void CancelDragDrop() |
||||
{ |
||||
if (dragDropBookmark != null) { |
||||
dragDropBookmark = null; |
||||
dragStarted = false; |
||||
if (TextView != null) { |
||||
TextArea area = TextView.Services.GetService(typeof(TextArea)) as TextArea; |
||||
if (area != null) |
||||
area.PreviewKeyDown -= TextArea_PreviewKeyDown; |
||||
} |
||||
ReleaseMouseCapture(); |
||||
InvalidateVisual(); |
||||
} |
||||
} |
||||
|
||||
void TextArea_PreviewKeyDown(object sender, KeyEventArgs e) |
||||
{ |
||||
// any key press cancels drag'n'drop
|
||||
CancelDragDrop(); |
||||
if (e.Key == Key.Escape) |
||||
e.Handled = true; |
||||
} |
||||
|
||||
int GetLineFromMousePosition(MouseEventArgs e) |
||||
{ |
||||
TextView textView = this.TextView; |
||||
if (textView == null) |
||||
return 0; |
||||
VisualLine vl = textView.GetVisualLineFromVisualTop(e.GetPosition(textView).Y + textView.ScrollOffset.Y); |
||||
if (vl == null) |
||||
return 0; |
||||
return vl.FirstDocumentLine.LineNumber; |
||||
} |
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e) |
||||
{ |
||||
base.OnMouseMove(e); |
||||
if (dragDropBookmark != null) { |
||||
dragDropCurrentPoint = e.GetPosition(this).Y; |
||||
if (Math.Abs(dragDropCurrentPoint - dragDropStartPoint) > SystemParameters.MinimumVerticalDragDistance) |
||||
dragStarted = true; |
||||
InvalidateVisual(); |
||||
} |
||||
} |
||||
|
||||
protected override void OnMouseUp(MouseButtonEventArgs e) |
||||
{ |
||||
base.OnMouseUp(e); |
||||
int line = GetLineFromMousePosition(e); |
||||
if (!e.Handled && dragDropBookmark != null) { |
||||
if (dragStarted) { |
||||
if (line != 0) |
||||
dragDropBookmark.Drop(line); |
||||
e.Handled = true; |
||||
} |
||||
CancelDragDrop(); |
||||
} |
||||
if (!e.Handled && line != 0) { |
||||
IBookmark bm = GetBookmarkFromLine(line); |
||||
if (bm != null) { |
||||
bm.MouseUp(e); |
||||
if (e.Handled) |
||||
return; |
||||
} |
||||
if (e.ChangedButton == MouseButton.Left && TextView != null) { |
||||
// no bookmark on the line: create a new breakpoint
|
||||
ITextEditor textEditor = TextView.Services.GetService(typeof(ITextEditor)) as ITextEditor; |
||||
if (textEditor != null) { |
||||
DebuggerService.ToggleBreakpointAt(textEditor, line, typeof(BreakpointBookmark)); |
||||
return; |
||||
} |
||||
|
||||
// create breakpoint for the other posible active contents
|
||||
var viewContent = WorkbenchSingleton.Workbench.ActiveContent as AbstractViewContentWithoutFile; |
||||
if (viewContent != null) { |
||||
textEditor = viewContent.Services.GetService(typeof(ITextEditor)) as ITextEditor; |
||||
if (textEditor != null) { |
||||
DebuggerService.ToggleBreakpointAt(textEditor, line, typeof(DecompiledBreakpointBookmark)); |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -1,48 +0,0 @@
@@ -1,48 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// </file>
|
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler.Core |
||||
{ |
||||
partial class SharpSnippetCompilerControl |
||||
{ |
||||
/// <summary>
|
||||
/// Designer variable used to keep track of non-visual components.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null; |
||||
|
||||
/// <summary>
|
||||
/// Disposes resources used by the control.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) |
||||
{ |
||||
if (disposing) { |
||||
if (components != null) { |
||||
components.Dispose(); |
||||
} |
||||
} |
||||
base.Dispose(disposing); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// This method is required for Windows Forms designer support.
|
||||
/// Do not change the method contents inside the source code editor. The Forms designer might
|
||||
/// not be able to load this method if it was changed manually.
|
||||
/// </summary>
|
||||
private void InitializeComponent() |
||||
{ |
||||
this.SuspendLayout(); |
||||
//
|
||||
// SharpSnippetCompilerControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||
this.Name = "SharpSnippetCompilerControl"; |
||||
this.Size = new System.Drawing.Size(491, 310); |
||||
this.ResumeLayout(false); |
||||
} |
||||
} |
||||
} |
||||
@ -1,51 +0,0 @@
@@ -1,51 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.ComponentModel; |
||||
using System.Drawing; |
||||
using System.IO; |
||||
using System.Reflection; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Debugging; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.TextEditor.Document; |
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler.Core |
||||
{ |
||||
public partial class SharpSnippetCompilerControl : UserControl |
||||
{ |
||||
SharpDevelopTextAreaControl textEditor; |
||||
|
||||
public SharpSnippetCompilerControl() |
||||
{ |
||||
InitializeComponent(); |
||||
|
||||
textEditor = new SharpDevelopTextAreaControl(); |
||||
textEditor.Dock = DockStyle.Fill; |
||||
this.Controls.Add(textEditor); |
||||
} |
||||
|
||||
public TextEditorControl TextEditor { |
||||
get { return textEditor; } |
||||
} |
||||
|
||||
public void LoadFile(string fileName) |
||||
{ |
||||
textEditor.LoadFile(fileName); |
||||
} |
||||
|
||||
public void Save() |
||||
{ |
||||
textEditor.SaveFile(textEditor.FileName); |
||||
} |
||||
} |
||||
} |
||||
@ -1,120 +0,0 @@
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<root> |
||||
<!-- |
||||
Microsoft ResX Schema |
||||
|
||||
Version 2.0 |
||||
|
||||
The primary goals of this format is to allow a simple XML format |
||||
that is mostly human readable. The generation and parsing of the |
||||
various data types are done through the TypeConverter classes |
||||
associated with the data types. |
||||
|
||||
Example: |
||||
|
||||
... ado.net/XML headers & schema ... |
||||
<resheader name="resmimetype">text/microsoft-resx</resheader> |
||||
<resheader name="version">2.0</resheader> |
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
||||
<value>[base64 mime encoded serialized .NET Framework object]</value> |
||||
</data> |
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
||||
<comment>This is a comment</comment> |
||||
</data> |
||||
|
||||
There are any number of "resheader" rows that contain simple |
||||
name/value pairs. |
||||
|
||||
Each data row contains a name, and value. The row also contains a |
||||
type or mimetype. Type corresponds to a .NET class that support |
||||
text/value conversion through the TypeConverter architecture. |
||||
Classes that don't support this are serialized and stored with the |
||||
mimetype set. |
||||
|
||||
The mimetype is used for serialized objects, and tells the |
||||
ResXResourceReader how to depersist the object. This is currently not |
||||
extensible. For a given mimetype the value must be set accordingly: |
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format |
||||
that the ResXResourceWriter will generate, however the reader can |
||||
read any of the formats listed below. |
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64 |
||||
value : The object must be serialized with |
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
||||
: and then encoded with base64 encoding. |
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64 |
||||
value : The object must be serialized with |
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
||||
: and then encoded with base64 encoding. |
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64 |
||||
value : The object must be serialized into a byte array |
||||
: using a System.ComponentModel.TypeConverter |
||||
: and then encoded with base64 encoding. |
||||
--> |
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
||||
<xsd:element name="root" msdata:IsDataSet="true"> |
||||
<xsd:complexType> |
||||
<xsd:choice maxOccurs="unbounded"> |
||||
<xsd:element name="metadata"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" use="required" type="xsd:string" /> |
||||
<xsd:attribute name="type" type="xsd:string" /> |
||||
<xsd:attribute name="mimetype" type="xsd:string" /> |
||||
<xsd:attribute ref="xml:space" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="assembly"> |
||||
<xsd:complexType> |
||||
<xsd:attribute name="alias" type="xsd:string" /> |
||||
<xsd:attribute name="name" type="xsd:string" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="data"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
||||
<xsd:attribute ref="xml:space" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="resheader"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" use="required" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:choice> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:schema> |
||||
<resheader name="resmimetype"> |
||||
<value>text/microsoft-resx</value> |
||||
</resheader> |
||||
<resheader name="version"> |
||||
<value>2.0</value> |
||||
</resheader> |
||||
<resheader name="reader"> |
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<resheader name="writer"> |
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
</root> |
||||
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Internal.Templates; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler.Core |
||||
{ |
||||
public class SharpSnippetProjectBinding : IProjectBinding |
||||
{ |
||||
public string Language{ |
||||
get { return "C#"; } |
||||
} |
||||
|
||||
public IProject LoadProject(ProjectLoadInformation loadInformation) |
||||
{ |
||||
return new SnippetCompilerProject(loadInformation); |
||||
} |
||||
|
||||
public IProject CreateProject(ProjectCreateInformation info) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
public bool HandlingMissingProject { get; private set; } |
||||
} |
||||
} |
||||
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using ICSharpCode.AvalonEdit; |
||||
using ICSharpCode.AvalonEdit.Highlighting; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Editor.AvalonEdit; |
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler.Core |
||||
{ |
||||
public class SharpSnippetTextEditorAdapter : AvalonEditTextEditorAdapter |
||||
{ |
||||
FileName fileName; |
||||
|
||||
public SharpSnippetTextEditorAdapter(TextEditor textEditor) |
||||
: base(textEditor) |
||||
{ |
||||
} |
||||
|
||||
public override FileName FileName { |
||||
get { return this.fileName; } |
||||
} |
||||
|
||||
public void LoadFile(string fileName) |
||||
{ |
||||
TextEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinitionByExtension(Path.GetExtension(fileName)); |
||||
TextEditor.Load(fileName); |
||||
this.fileName = new FileName(fileName); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
// SharpDevelop samples
|
||||
// Copyright (c) 2013, AlphaSierraPapa
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this list
|
||||
// of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||
// provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||
// endorse or promote products derived from this software without specific prior written
|
||||
// permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System; |
||||
using System.Threading; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler.Core |
||||
{ |
||||
public class StatusBarService : IStatusBarService |
||||
{ |
||||
public void SetCaretPosition(int x, int y, int charOffset) |
||||
{ |
||||
} |
||||
|
||||
public void SetMessage(string message, bool highlighted, ICSharpCode.SharpDevelop.IImage icon) |
||||
{ |
||||
} |
||||
|
||||
public IProgressMonitor CreateProgressMonitor(CancellationToken cancellationToken) |
||||
{ |
||||
return new DummyProgressMonitor(); |
||||
} |
||||
|
||||
public void AddProgress(ProgressCollector progress) |
||||
{ |
||||
|
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,306 @@
@@ -0,0 +1,306 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Diagnostics; |
||||
using System.Linq; |
||||
using System.Windows; |
||||
using System.Windows.Media; |
||||
using System.Windows.Threading; |
||||
|
||||
using ICSharpCode.AvalonEdit.Document; |
||||
using ICSharpCode.AvalonEdit.Rendering; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler.Core |
||||
{ |
||||
/// <summary>
|
||||
/// Handles the text markers for a code editor.
|
||||
/// </summary>
|
||||
public sealed class TextMarkerService : DocumentColorizingTransformer, IBackgroundRenderer, ITextMarkerService, ITextViewConnect |
||||
{ |
||||
TextSegmentCollection<TextMarker> markers; |
||||
TextDocument document; |
||||
|
||||
public TextMarkerService(TextDocument document) |
||||
{ |
||||
if (document == null) |
||||
throw new ArgumentNullException("document"); |
||||
this.document = document; |
||||
this.markers = new TextSegmentCollection<TextMarker>(document); |
||||
} |
||||
|
||||
#region ITextMarkerService
|
||||
public ITextMarker Create(int startOffset, int length) |
||||
{ |
||||
if (markers == null) |
||||
throw new InvalidOperationException("Cannot create a marker when not attached to a document"); |
||||
|
||||
int textLength = document.TextLength; |
||||
if (startOffset < 0 || startOffset > textLength) |
||||
throw new ArgumentOutOfRangeException("startOffset", startOffset, "Value must be between 0 and " + textLength); |
||||
if (length < 0 || startOffset + length > textLength) |
||||
throw new ArgumentOutOfRangeException("length", length, "length must not be negative and startOffset+length must not be after the end of the document"); |
||||
|
||||
TextMarker m = new TextMarker(this, startOffset, length); |
||||
markers.Add(m); |
||||
// no need to mark segment for redraw: the text marker is invisible until a property is set
|
||||
return m; |
||||
} |
||||
|
||||
public IEnumerable<ITextMarker> GetMarkersAtOffset(int offset) |
||||
{ |
||||
if (markers == null) |
||||
return Enumerable.Empty<ITextMarker>(); |
||||
else |
||||
return markers.FindSegmentsContaining(offset); |
||||
} |
||||
|
||||
public IEnumerable<ITextMarker> TextMarkers { |
||||
get { return markers ?? Enumerable.Empty<ITextMarker>(); } |
||||
} |
||||
|
||||
public void RemoveAll(Predicate<ITextMarker> predicate) |
||||
{ |
||||
if (predicate == null) |
||||
throw new ArgumentNullException("predicate"); |
||||
if (markers != null) { |
||||
foreach (TextMarker m in markers.ToArray()) { |
||||
if (predicate(m)) |
||||
Remove(m); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public void Remove(ITextMarker marker) |
||||
{ |
||||
if (marker == null) |
||||
throw new ArgumentNullException("marker"); |
||||
TextMarker m = marker as TextMarker; |
||||
if (markers != null && markers.Remove(m)) { |
||||
Redraw(m); |
||||
m.OnDeleted(); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Redraws the specified text segment.
|
||||
/// </summary>
|
||||
internal void Redraw(ISegment segment) |
||||
{ |
||||
foreach (var view in textViews) { |
||||
view.Redraw(segment, DispatcherPriority.Normal); |
||||
} |
||||
} |
||||
#endregion
|
||||
|
||||
#region DocumentColorizingTransformer
|
||||
protected override void ColorizeLine(DocumentLine line) |
||||
{ |
||||
if (markers == null) |
||||
return; |
||||
int lineStart = line.Offset; |
||||
int lineEnd = lineStart + line.Length; |
||||
foreach (TextMarker marker in markers.FindOverlappingSegments(lineStart, line.Length)) { |
||||
Brush foregroundBrush = null; |
||||
if (marker.ForegroundColor != null) { |
||||
foregroundBrush = new SolidColorBrush(marker.ForegroundColor.Value); |
||||
foregroundBrush.Freeze(); |
||||
} |
||||
ChangeLinePart( |
||||
Math.Max(marker.StartOffset, lineStart), |
||||
Math.Min(marker.EndOffset, lineEnd), |
||||
element => { |
||||
if (foregroundBrush != null) { |
||||
element.TextRunProperties.SetForegroundBrush(foregroundBrush); |
||||
} |
||||
} |
||||
); |
||||
} |
||||
} |
||||
#endregion
|
||||
|
||||
#region IBackgroundRenderer
|
||||
public KnownLayer Layer { |
||||
get { |
||||
// draw behind selection
|
||||
return KnownLayer.Selection; |
||||
} |
||||
} |
||||
|
||||
public void Draw(TextView textView, DrawingContext drawingContext) |
||||
{ |
||||
if (textView == null) |
||||
throw new ArgumentNullException("textView"); |
||||
if (drawingContext == null) |
||||
throw new ArgumentNullException("drawingContext"); |
||||
if (markers == null || !textView.VisualLinesValid) |
||||
return; |
||||
var visualLines = textView.VisualLines; |
||||
if (visualLines.Count == 0) |
||||
return; |
||||
int viewStart = visualLines.First().FirstDocumentLine.Offset; |
||||
int viewEnd = visualLines.Last().LastDocumentLine.EndOffset; |
||||
foreach (TextMarker marker in markers.FindOverlappingSegments(viewStart, viewEnd - viewStart)) { |
||||
if (marker.BackgroundColor != null) { |
||||
BackgroundGeometryBuilder geoBuilder = new BackgroundGeometryBuilder(); |
||||
geoBuilder.AlignToWholePixels = true; |
||||
geoBuilder.CornerRadius = 3; |
||||
geoBuilder.AddSegment(textView, marker); |
||||
Geometry geometry = geoBuilder.CreateGeometry(); |
||||
if (geometry != null) { |
||||
Color color = marker.BackgroundColor.Value; |
||||
SolidColorBrush brush = new SolidColorBrush(color); |
||||
brush.Freeze(); |
||||
drawingContext.DrawGeometry(brush, null, geometry); |
||||
} |
||||
} |
||||
if (marker.MarkerType != TextMarkerType.None) { |
||||
foreach (Rect r in BackgroundGeometryBuilder.GetRectsForSegment(textView, marker)) { |
||||
Point startPoint = r.BottomLeft; |
||||
Point endPoint = r.BottomRight; |
||||
|
||||
Pen usedPen = new Pen(new SolidColorBrush(marker.MarkerColor), 1); |
||||
usedPen.Freeze(); |
||||
switch (marker.MarkerType) { |
||||
case TextMarkerType.SquigglyUnderline: |
||||
double offset = 2.5; |
||||
|
||||
int count = Math.Max((int)((endPoint.X - startPoint.X) / offset) + 1, 4); |
||||
|
||||
StreamGeometry geometry = new StreamGeometry(); |
||||
|
||||
using (StreamGeometryContext ctx = geometry.Open()) { |
||||
ctx.BeginFigure(startPoint, false, false); |
||||
ctx.PolyLineTo(CreatePoints(startPoint, endPoint, offset, count).ToArray(), true, false); |
||||
} |
||||
|
||||
geometry.Freeze(); |
||||
|
||||
drawingContext.DrawGeometry(Brushes.Transparent, usedPen, geometry); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
IEnumerable<Point> CreatePoints(Point start, Point end, double offset, int count) |
||||
{ |
||||
for (int i = 0; i < count; i++) |
||||
yield return new Point(start.X + i * offset, start.Y - ((i + 1) % 2 == 0 ? offset : 0)); |
||||
} |
||||
#endregion
|
||||
|
||||
#region ITextViewConnect
|
||||
readonly List<TextView> textViews = new List<TextView>(); |
||||
|
||||
void ITextViewConnect.AddToTextView(TextView textView) |
||||
{ |
||||
if (textView != null && !textViews.Contains(textView)) { |
||||
Debug.Assert(textView.Document == document); |
||||
textViews.Add(textView); |
||||
} |
||||
} |
||||
|
||||
void ITextViewConnect.RemoveFromTextView(TextView textView) |
||||
{ |
||||
if (textView != null) { |
||||
Debug.Assert(textView.Document == document); |
||||
textViews.Remove(textView); |
||||
} |
||||
} |
||||
#endregion
|
||||
} |
||||
|
||||
public sealed class TextMarker : TextSegment, ITextMarker |
||||
{ |
||||
readonly TextMarkerService service; |
||||
|
||||
public TextMarker(TextMarkerService service, int startOffset, int length) |
||||
{ |
||||
if (service == null) |
||||
throw new ArgumentNullException("service"); |
||||
this.service = service; |
||||
this.StartOffset = startOffset; |
||||
this.Length = length; |
||||
this.markerType = TextMarkerType.None; |
||||
} |
||||
|
||||
public event EventHandler Deleted; |
||||
|
||||
public bool IsDeleted { |
||||
get { return !this.IsConnectedToCollection; } |
||||
} |
||||
|
||||
public void Delete() |
||||
{ |
||||
service.Remove(this); |
||||
} |
||||
|
||||
internal void OnDeleted() |
||||
{ |
||||
if (Deleted != null) |
||||
Deleted(this, EventArgs.Empty); |
||||
} |
||||
|
||||
void Redraw() |
||||
{ |
||||
service.Redraw(this); |
||||
} |
||||
|
||||
Color? backgroundColor; |
||||
|
||||
public Color? BackgroundColor { |
||||
get { return backgroundColor; } |
||||
set { |
||||
if (backgroundColor != value) { |
||||
backgroundColor = value; |
||||
Redraw(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
Color? foregroundColor; |
||||
|
||||
public Color? ForegroundColor { |
||||
get { return foregroundColor; } |
||||
set { |
||||
if (foregroundColor != value) { |
||||
foregroundColor = value; |
||||
Redraw(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public object Tag { get; set; } |
||||
|
||||
TextMarkerType markerType; |
||||
|
||||
public TextMarkerType MarkerType { |
||||
get { return markerType; } |
||||
set { |
||||
if (markerType != value) { |
||||
markerType = value; |
||||
Redraw(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
Color markerColor; |
||||
|
||||
public Color MarkerColor { |
||||
get { return markerColor; } |
||||
set { |
||||
if (markerColor != value) { |
||||
markerColor = value; |
||||
Redraw(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public object ToolTip { get; set; } |
||||
} |
||||
} |
||||
@ -0,0 +1,122 @@
@@ -0,0 +1,122 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.ComponentModel; |
||||
using System.Reflection; |
||||
using System.Threading; |
||||
using System.Windows.Threading; |
||||
|
||||
using ICSharpCode.SharpDevelop; |
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler.Core |
||||
{ |
||||
/// <summary>
|
||||
/// Implements the ISynchronizeInvoke interface by using a WPF dispatcher
|
||||
/// to perform the cross-thread call.
|
||||
/// </summary>
|
||||
sealed class WpfSynchronizeInvoke : ISynchronizeInvoke |
||||
{ |
||||
readonly Dispatcher dispatcher; |
||||
|
||||
public WpfSynchronizeInvoke(Dispatcher dispatcher) |
||||
{ |
||||
if (dispatcher == null) |
||||
throw new ArgumentNullException("dispatcher"); |
||||
this.dispatcher = dispatcher; |
||||
} |
||||
|
||||
public bool InvokeRequired { |
||||
get { |
||||
return !dispatcher.CheckAccess(); |
||||
} |
||||
} |
||||
|
||||
public IAsyncResult BeginInvoke(Delegate method, object[] args) |
||||
{ |
||||
DispatcherOperation op; |
||||
if (args == null || args.Length == 0) |
||||
op = dispatcher.BeginInvoke(DispatcherPriority.Normal, method); |
||||
else if (args.Length == 1) |
||||
op = dispatcher.BeginInvoke(DispatcherPriority.Normal, method, args[0]); |
||||
else |
||||
op = dispatcher.BeginInvoke(DispatcherPriority.Normal, method, args[0], args.Splice(1)); |
||||
return new AsyncResult(op); |
||||
} |
||||
|
||||
sealed class AsyncResult : IAsyncResult |
||||
{ |
||||
internal readonly DispatcherOperation op; |
||||
readonly object lockObj = new object(); |
||||
ManualResetEvent resetEvent; |
||||
|
||||
public AsyncResult(DispatcherOperation op) |
||||
{ |
||||
this.op = op; |
||||
} |
||||
|
||||
public bool IsCompleted { |
||||
get { |
||||
return op.Status == DispatcherOperationStatus.Completed; |
||||
} |
||||
} |
||||
|
||||
public WaitHandle AsyncWaitHandle { |
||||
get { |
||||
lock (lockObj) { |
||||
if (resetEvent == null) { |
||||
op.Completed += op_Completed; |
||||
resetEvent = new ManualResetEvent(false); |
||||
if (IsCompleted) |
||||
resetEvent.Set(); |
||||
} |
||||
return resetEvent; |
||||
} |
||||
} |
||||
} |
||||
|
||||
void op_Completed(object sender, EventArgs e) |
||||
{ |
||||
lock (lockObj) { |
||||
resetEvent.Set(); |
||||
} |
||||
} |
||||
|
||||
public object AsyncState { |
||||
get { return null; } |
||||
} |
||||
|
||||
public bool CompletedSynchronously { |
||||
get { return false; } |
||||
} |
||||
} |
||||
|
||||
public object EndInvoke(IAsyncResult result) |
||||
{ |
||||
AsyncResult r = result as AsyncResult; |
||||
if (r == null) |
||||
throw new ArgumentException("result must be the return value of a WpfSynchronizeInvoke.BeginInvoke call!"); |
||||
r.op.Wait(); |
||||
return r.op.Result; |
||||
} |
||||
|
||||
public object Invoke(Delegate method, object[] args) |
||||
{ |
||||
object result = null; |
||||
Exception exception = null; |
||||
dispatcher.Invoke( |
||||
DispatcherPriority.Normal, |
||||
(Action)delegate { |
||||
try { |
||||
result = method.DynamicInvoke(args); |
||||
} catch (TargetInvocationException ex) { |
||||
exception = ex.InnerException; |
||||
} |
||||
}); |
||||
// if an exception occurred, re-throw it on the calling thread
|
||||
if (exception != null) |
||||
throw new TargetInvocationException(exception); |
||||
return result; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,100 @@
@@ -0,0 +1,100 @@
|
||||
<AddIn name = "SharpSnippetCompiler" |
||||
author = "" |
||||
copyright = "prj:///doc/copyright.txt" |
||||
url = "http://www.icsharpcode.net" |
||||
description = "SharpSnippetCompiler main module" |
||||
addInManagerHidden = "true"> |
||||
|
||||
<Manifest> |
||||
<Identity name="SharpSnippetCompiler" version="0.1"/> |
||||
</Manifest> |
||||
|
||||
<Runtime> |
||||
<Import assembly=":ICSharpCode.SharpDevelop"> |
||||
<Doozer name="Pad" class="ICSharpCode.SharpDevelop.PadDoozer"/> |
||||
<Doozer name="ProjectBinding" class="ICSharpCode.SharpDevelop.ProjectBindingDoozer"/> |
||||
<Doozer name="Parser" class="ICSharpCode.SharpDevelop.ParserDoozer"/> |
||||
<Doozer name="Debugger" class="ICSharpCode.SharpDevelop.Debugging.DebuggerDoozer"/> |
||||
</Import> |
||||
<Import assembly=":SharpSnippetCompiler.Core"/> |
||||
</Runtime> |
||||
|
||||
<Path name="/SharpDevelop/Workbench/DisplayBindings"> |
||||
</Path> |
||||
|
||||
<Path name = "/SharpDevelop/Workbench/Pads"> |
||||
<Pad id = "CompilerMessageView" |
||||
category = "Main" |
||||
title = "${res:MainWindow.Windows.OutputWindow}" |
||||
icon = "PadIcons.Output" |
||||
class = "ICSharpCode.SharpDevelop.Gui.CompilerMessageView" |
||||
defaultPosition = "Bottom" /> |
||||
|
||||
<Pad id = "ErrorList" |
||||
category = "Main" |
||||
title = "${res:MainWindow.Windows.ErrorList}" |
||||
icon = "PadIcons.ErrorList" |
||||
class = "ICSharpCode.SharpDevelop.Gui.ErrorListPad" |
||||
defaultPosition = "Bottom" /> |
||||
</Path> |
||||
|
||||
<Path name="/SharpDevelop/Pads/ErrorList/Toolbar"> |
||||
</Path> |
||||
|
||||
<Path name="/SharpDevelop/Pads/CompilerMessageView/Toolbar"> |
||||
</Path> |
||||
|
||||
<Path path = "/SharpDevelop/Workbench/ProjectBindings"> |
||||
<ProjectBinding id = "C#" |
||||
guid = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" |
||||
supportedextensions = ".cs" |
||||
projectfileextension = ".csproj" |
||||
class = "ICSharpCode.SharpSnippetCompiler.Core.SharpSnippetProjectBinding" /> |
||||
</Path> |
||||
|
||||
<Path name = "/SharpDevelop/Pads/ErrorList/Toolbar"> |
||||
<ToolbarItem id = "Errors" |
||||
type = "CheckBox" |
||||
icon = "Icons.16x16.Error" |
||||
label = "${res:MainWindow.Windows.ErrorList.ErrorButton.Label}" |
||||
tooltip = "${res:MainWindow.Windows.ErrorList.ErrorButton.ToolTip}" |
||||
class = "ICSharpCode.SharpDevelop.Gui.ShowErrorsToggleButton"/> |
||||
|
||||
<ToolbarItem id = "ErrorsSeparator" type = "Separator"/> |
||||
|
||||
<ToolbarItem id = "Warnings" |
||||
type = "CheckBox" |
||||
icon = "Icons.16x16.Warning" |
||||
label = "${res:MainWindow.Windows.ErrorList.WarningButton.Label}" |
||||
tooltip = "${res:MainWindow.Windows.ErrorList.WarningButton.ToolTip}" |
||||
class = "ICSharpCode.SharpDevelop.Gui.ShowWarningsToggleButton"/> |
||||
<ToolbarItem id = "WarningsSeparator" type = "Separator"/> |
||||
|
||||
<ToolbarItem id = "Messages" |
||||
type = "CheckBox" |
||||
icon = "Icons.16x16.Information" |
||||
label = "${res:MainWindow.Windows.ErrorList.MessageButton.Label}" |
||||
tooltip = "${res:MainWindow.Windows.ErrorList.MessageButton.ToolTip}" |
||||
class = "ICSharpCode.SharpDevelop.Gui.ShowMessagesToggleButton"/> |
||||
</Path> |
||||
|
||||
<Path name = "/SharpDevelop/Pads/CompilerMessageView/Toolbar"> |
||||
<ToolbarItem id = "CategorySelect" |
||||
type = "ComboBox" |
||||
tooltip = "${res:MainWindow.Windows.CompilerMessageView.ShowOutputFromComboBox.ToolTip}" |
||||
class = "ICSharpCode.SharpDevelop.Gui.ShowOutputFromComboBox"/> |
||||
|
||||
<ToolbarItem id = "CategorySelectSeparator" type = "Separator"/> |
||||
|
||||
<ToolbarItem id = "Clear" |
||||
icon = "OutputPad.Toolbar.ClearOutputWindow" |
||||
tooltip = "${res:MainWindow.Windows.CompilerMessageView.ClearAllButton.ToolTip}" |
||||
class = "ICSharpCode.SharpDevelop.Gui.ClearOutputWindow"/> |
||||
|
||||
<ToolbarItem id = "ToggleWordWrap" |
||||
type = "CheckBox" |
||||
icon = "OutputPad.Toolbar.ToggleWordWrap" |
||||
tooltip = "${res:MainWindow.Windows.CompilerMessageView.ToggleWordWrapButton.ToolTip}" |
||||
class = "ICSharpCode.SharpDevelop.Gui.ToggleMessageViewWordWrap"/> |
||||
</Path> |
||||
</AddIn> |
||||
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
<Application x:Class="ICSharpCode.SharpSnippetCompiler.App" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
StartupUri="MainWindow.xaml"> |
||||
<Application.Resources> |
||||
</Application.Resources> |
||||
</Application> |
||||
@ -0,0 +1,37 @@
@@ -0,0 +1,37 @@
|
||||
// SharpDevelop samples
|
||||
// Copyright (c) 2013, AlphaSierraPapa
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this list
|
||||
// of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||
// provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||
// endorse or promote products derived from this software without specific prior written
|
||||
// permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
using System; |
||||
using System.Windows; |
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler |
||||
{ |
||||
public partial class App : Application |
||||
{ |
||||
} |
||||
} |
||||
@ -1,458 +0,0 @@
@@ -1,458 +0,0 @@
|
||||
// SharpDevelop samples
|
||||
// Copyright (c) 2008, AlphaSierraPapa
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this list
|
||||
// of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||
// provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||
// endorse or promote products derived from this software without specific prior written
|
||||
// permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler |
||||
{ |
||||
partial class MainForm |
||||
{ |
||||
/// <summary>
|
||||
/// Designer variable used to keep track of non-visual components.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null; |
||||
|
||||
/// <summary>
|
||||
/// Disposes resources used by the form.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) |
||||
{ |
||||
if (disposing) { |
||||
if (components != null) { |
||||
components.Dispose(); |
||||
} |
||||
} |
||||
base.Dispose(disposing); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// This method is required for Windows Forms designer support.
|
||||
/// Do not change the method contents inside the source code editor. The Forms designer might
|
||||
/// not be able to load this method if it was changed manually.
|
||||
/// </summary>
|
||||
private void InitializeComponent() |
||||
{ |
||||
this.mainMenuStrip = new System.Windows.Forms.MenuStrip(); |
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.fileNewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.fileOpenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.fileCloseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.fileExitToolStripSeparator = new System.Windows.Forms.ToolStripSeparator(); |
||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.redoSeparatorToolStripMenuItem = new System.Windows.Forms.ToolStripSeparator(); |
||||
this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.selectAllSeparatorToolStripMenuItem = new System.Windows.Forms.ToolStripSeparator(); |
||||
this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.buildtoolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.buildCurrentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.runToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.stopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.continueSeparatorToolStripMenuItem = new System.Windows.Forms.ToolStripSeparator(); |
||||
this.continueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.stepSeparatorToolStripMenuItem = new System.Windows.Forms.ToolStripSeparator(); |
||||
this.stepOverToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.stepIntoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.stepOutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.referencesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); |
||||
this.splitContainer = new System.Windows.Forms.SplitContainer(); |
||||
this.fileTabControl = new System.Windows.Forms.TabControl(); |
||||
this.tabControl = new System.Windows.Forms.TabControl(); |
||||
this.errorsTabPage = new System.Windows.Forms.TabPage(); |
||||
this.outputTabPage = new System.Windows.Forms.TabPage(); |
||||
this.mainMenuStrip.SuspendLayout(); |
||||
this.splitContainer.Panel1.SuspendLayout(); |
||||
this.splitContainer.Panel2.SuspendLayout(); |
||||
this.splitContainer.SuspendLayout(); |
||||
this.tabControl.SuspendLayout(); |
||||
this.SuspendLayout(); |
||||
//
|
||||
// mainMenuStrip
|
||||
//
|
||||
this.mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { |
||||
this.fileToolStripMenuItem, |
||||
this.editToolStripMenuItem, |
||||
this.buildtoolStripMenuItem, |
||||
this.debugToolStripMenuItem, |
||||
this.toolsToolStripMenuItem}); |
||||
this.mainMenuStrip.Location = new System.Drawing.Point(0, 0); |
||||
this.mainMenuStrip.Name = "mainMenuStrip"; |
||||
this.mainMenuStrip.Size = new System.Drawing.Size(757, 24); |
||||
this.mainMenuStrip.TabIndex = 0; |
||||
this.mainMenuStrip.Text = "menuStrip1"; |
||||
//
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { |
||||
this.fileNewToolStripMenuItem, |
||||
this.fileOpenToolStripMenuItem, |
||||
this.fileCloseToolStripMenuItem, |
||||
this.fileExitToolStripSeparator, |
||||
this.exitToolStripMenuItem}); |
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; |
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); |
||||
this.fileToolStripMenuItem.Text = "&File"; |
||||
//
|
||||
// fileNewToolStripMenuItem
|
||||
//
|
||||
this.fileNewToolStripMenuItem.Name = "fileNewToolStripMenuItem"; |
||||
this.fileNewToolStripMenuItem.Size = new System.Drawing.Size(152, 22); |
||||
this.fileNewToolStripMenuItem.Text = "&New..."; |
||||
this.fileNewToolStripMenuItem.Click += new System.EventHandler(this.FileNewToolStripMenuItemClick); |
||||
//
|
||||
// fileOpenToolStripMenuItem
|
||||
//
|
||||
this.fileOpenToolStripMenuItem.Name = "fileOpenToolStripMenuItem"; |
||||
this.fileOpenToolStripMenuItem.Size = new System.Drawing.Size(152, 22); |
||||
this.fileOpenToolStripMenuItem.Text = "&Open..."; |
||||
this.fileOpenToolStripMenuItem.Click += new System.EventHandler(this.FileOpenToolStripMenuItemClick); |
||||
//
|
||||
// fileCloseToolStripMenuItem
|
||||
//
|
||||
this.fileCloseToolStripMenuItem.Name = "fileCloseToolStripMenuItem"; |
||||
this.fileCloseToolStripMenuItem.Size = new System.Drawing.Size(152, 22); |
||||
this.fileCloseToolStripMenuItem.Text = "&Close"; |
||||
this.fileCloseToolStripMenuItem.Click += new System.EventHandler(this.FileCloseToolStripMenuItemClick); |
||||
//
|
||||
// fileExitToolStripSeparator
|
||||
//
|
||||
this.fileExitToolStripSeparator.Name = "fileExitToolStripSeparator"; |
||||
this.fileExitToolStripSeparator.Size = new System.Drawing.Size(149, 6); |
||||
//
|
||||
// exitToolStripMenuItem
|
||||
//
|
||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; |
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22); |
||||
this.exitToolStripMenuItem.Text = "E&xit"; |
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.ExitToolStripMenuItemClick); |
||||
//
|
||||
// editToolStripMenuItem
|
||||
//
|
||||
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { |
||||
this.undoToolStripMenuItem, |
||||
this.redoToolStripMenuItem, |
||||
this.redoSeparatorToolStripMenuItem, |
||||
this.cutToolStripMenuItem, |
||||
this.copyToolStripMenuItem, |
||||
this.pasteToolStripMenuItem, |
||||
this.deleteToolStripMenuItem, |
||||
this.selectAllSeparatorToolStripMenuItem, |
||||
this.selectAllToolStripMenuItem}); |
||||
this.editToolStripMenuItem.Name = "editToolStripMenuItem"; |
||||
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20); |
||||
this.editToolStripMenuItem.Text = "&Edit"; |
||||
//
|
||||
// undoToolStripMenuItem
|
||||
//
|
||||
this.undoToolStripMenuItem.Name = "undoToolStripMenuItem"; |
||||
this.undoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z))); |
||||
this.undoToolStripMenuItem.Size = new System.Drawing.Size(164, 22); |
||||
this.undoToolStripMenuItem.Text = "&Undo"; |
||||
this.undoToolStripMenuItem.Click += new System.EventHandler(this.UndoToolStripMenuItemClick); |
||||
//
|
||||
// redoToolStripMenuItem
|
||||
//
|
||||
this.redoToolStripMenuItem.Name = "redoToolStripMenuItem"; |
||||
this.redoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y))); |
||||
this.redoToolStripMenuItem.Size = new System.Drawing.Size(164, 22); |
||||
this.redoToolStripMenuItem.Text = "&Redo"; |
||||
this.redoToolStripMenuItem.Click += new System.EventHandler(this.RedoToolStripMenuItemClick); |
||||
//
|
||||
// redoSeparatorToolStripMenuItem
|
||||
//
|
||||
this.redoSeparatorToolStripMenuItem.Name = "redoSeparatorToolStripMenuItem"; |
||||
this.redoSeparatorToolStripMenuItem.Size = new System.Drawing.Size(161, 6); |
||||
//
|
||||
// cutToolStripMenuItem
|
||||
//
|
||||
this.cutToolStripMenuItem.Name = "cutToolStripMenuItem"; |
||||
this.cutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X))); |
||||
this.cutToolStripMenuItem.Size = new System.Drawing.Size(164, 22); |
||||
this.cutToolStripMenuItem.Text = "Cu&t"; |
||||
this.cutToolStripMenuItem.Click += new System.EventHandler(this.CutToolStripMenuItemClick); |
||||
//
|
||||
// copyToolStripMenuItem
|
||||
//
|
||||
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; |
||||
this.copyToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C))); |
||||
this.copyToolStripMenuItem.Size = new System.Drawing.Size(164, 22); |
||||
this.copyToolStripMenuItem.Text = "&Copy"; |
||||
this.copyToolStripMenuItem.Click += new System.EventHandler(this.CopyToolStripMenuItemClick); |
||||
//
|
||||
// pasteToolStripMenuItem
|
||||
//
|
||||
this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; |
||||
this.pasteToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V))); |
||||
this.pasteToolStripMenuItem.Size = new System.Drawing.Size(164, 22); |
||||
this.pasteToolStripMenuItem.Text = "&Paste"; |
||||
this.pasteToolStripMenuItem.Click += new System.EventHandler(this.PasteToolStripMenuItemClick); |
||||
//
|
||||
// deleteToolStripMenuItem
|
||||
//
|
||||
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; |
||||
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(164, 22); |
||||
this.deleteToolStripMenuItem.Text = "&Delete"; |
||||
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.DeleteToolStripMenuItemClick); |
||||
//
|
||||
// selectAllSeparatorToolStripMenuItem
|
||||
//
|
||||
this.selectAllSeparatorToolStripMenuItem.Name = "selectAllSeparatorToolStripMenuItem"; |
||||
this.selectAllSeparatorToolStripMenuItem.Size = new System.Drawing.Size(161, 6); |
||||
//
|
||||
// selectAllToolStripMenuItem
|
||||
//
|
||||
this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; |
||||
this.selectAllToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A))); |
||||
this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(164, 22); |
||||
this.selectAllToolStripMenuItem.Text = "Select &All"; |
||||
this.selectAllToolStripMenuItem.Click += new System.EventHandler(this.SelectAllToolStripMenuItemClick); |
||||
//
|
||||
// buildtoolStripMenuItem
|
||||
//
|
||||
this.buildtoolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { |
||||
this.buildCurrentToolStripMenuItem}); |
||||
this.buildtoolStripMenuItem.Name = "buildtoolStripMenuItem"; |
||||
this.buildtoolStripMenuItem.Size = new System.Drawing.Size(46, 20); |
||||
this.buildtoolStripMenuItem.Text = "&Build"; |
||||
//
|
||||
// buildCurrentToolStripMenuItem
|
||||
//
|
||||
this.buildCurrentToolStripMenuItem.Name = "buildCurrentToolStripMenuItem"; |
||||
this.buildCurrentToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) |
||||
| System.Windows.Forms.Keys.B))); |
||||
this.buildCurrentToolStripMenuItem.Size = new System.Drawing.Size(217, 22); |
||||
this.buildCurrentToolStripMenuItem.Text = "&Build Current"; |
||||
this.buildCurrentToolStripMenuItem.Click += new System.EventHandler(this.BuildCurrentToolStripMenuItemClick); |
||||
//
|
||||
// debugToolStripMenuItem
|
||||
//
|
||||
this.debugToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { |
||||
this.runToolStripMenuItem, |
||||
this.stopToolStripMenuItem, |
||||
this.continueSeparatorToolStripMenuItem, |
||||
this.continueToolStripMenuItem, |
||||
this.stepSeparatorToolStripMenuItem, |
||||
this.stepOverToolStripMenuItem, |
||||
this.stepIntoToolStripMenuItem, |
||||
this.stepOutToolStripMenuItem}); |
||||
this.debugToolStripMenuItem.Name = "debugToolStripMenuItem"; |
||||
this.debugToolStripMenuItem.Size = new System.Drawing.Size(54, 20); |
||||
this.debugToolStripMenuItem.Text = "&Debug"; |
||||
//
|
||||
// runToolStripMenuItem
|
||||
//
|
||||
this.runToolStripMenuItem.Name = "runToolStripMenuItem"; |
||||
this.runToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F5; |
||||
this.runToolStripMenuItem.Size = new System.Drawing.Size(177, 22); |
||||
this.runToolStripMenuItem.Text = "&Run"; |
||||
this.runToolStripMenuItem.Click += new System.EventHandler(this.RunToolStripMenuItemClick); |
||||
//
|
||||
// stopToolStripMenuItem
|
||||
//
|
||||
this.stopToolStripMenuItem.Name = "stopToolStripMenuItem"; |
||||
this.stopToolStripMenuItem.Size = new System.Drawing.Size(177, 22); |
||||
this.stopToolStripMenuItem.Text = "St&op"; |
||||
this.stopToolStripMenuItem.Click += new System.EventHandler(this.StopToolStripMenuItemClick); |
||||
//
|
||||
// continueSeparatorToolStripMenuItem
|
||||
//
|
||||
this.continueSeparatorToolStripMenuItem.Name = "continueSeparatorToolStripMenuItem"; |
||||
this.continueSeparatorToolStripMenuItem.Size = new System.Drawing.Size(174, 6); |
||||
//
|
||||
// continueToolStripMenuItem
|
||||
//
|
||||
this.continueToolStripMenuItem.Name = "continueToolStripMenuItem"; |
||||
this.continueToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F6; |
||||
this.continueToolStripMenuItem.Size = new System.Drawing.Size(177, 22); |
||||
this.continueToolStripMenuItem.Text = "&Continue"; |
||||
this.continueToolStripMenuItem.Click += new System.EventHandler(this.ContinueToolStripMenuItemClick); |
||||
//
|
||||
// stepSeparatorToolStripMenuItem
|
||||
//
|
||||
this.stepSeparatorToolStripMenuItem.Name = "stepSeparatorToolStripMenuItem"; |
||||
this.stepSeparatorToolStripMenuItem.Size = new System.Drawing.Size(174, 6); |
||||
//
|
||||
// stepOverToolStripMenuItem
|
||||
//
|
||||
this.stepOverToolStripMenuItem.Name = "stepOverToolStripMenuItem"; |
||||
this.stepOverToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F10; |
||||
this.stepOverToolStripMenuItem.Size = new System.Drawing.Size(177, 22); |
||||
this.stepOverToolStripMenuItem.Text = "Step O&ver"; |
||||
this.stepOverToolStripMenuItem.Click += new System.EventHandler(this.StepOverToolStripMenuItemClick); |
||||
//
|
||||
// stepIntoToolStripMenuItem
|
||||
//
|
||||
this.stepIntoToolStripMenuItem.Name = "stepIntoToolStripMenuItem"; |
||||
this.stepIntoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F11; |
||||
this.stepIntoToolStripMenuItem.Size = new System.Drawing.Size(177, 22); |
||||
this.stepIntoToolStripMenuItem.Text = "Step &Into"; |
||||
this.stepIntoToolStripMenuItem.Click += new System.EventHandler(this.StepIntoToolStripMenuItemClick); |
||||
//
|
||||
// stepOutToolStripMenuItem
|
||||
//
|
||||
this.stepOutToolStripMenuItem.Name = "stepOutToolStripMenuItem"; |
||||
this.stepOutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F11))); |
||||
this.stepOutToolStripMenuItem.Size = new System.Drawing.Size(177, 22); |
||||
this.stepOutToolStripMenuItem.Text = "Step O&ut"; |
||||
this.stepOutToolStripMenuItem.Click += new System.EventHandler(this.StepOutToolStripMenuItemClick); |
||||
//
|
||||
// toolsToolStripMenuItem
|
||||
//
|
||||
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { |
||||
this.referencesToolStripMenuItem}); |
||||
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem"; |
||||
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(48, 20); |
||||
this.toolsToolStripMenuItem.Text = "&Tools"; |
||||
//
|
||||
// referencesToolStripMenuItem
|
||||
//
|
||||
this.referencesToolStripMenuItem.Name = "referencesToolStripMenuItem"; |
||||
this.referencesToolStripMenuItem.Size = new System.Drawing.Size(140, 22); |
||||
this.referencesToolStripMenuItem.Text = "&References..."; |
||||
this.referencesToolStripMenuItem.Click += new System.EventHandler(this.ReferencesToolStripMenuItemClick); |
||||
//
|
||||
// splitContainer
|
||||
//
|
||||
this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill; |
||||
this.splitContainer.Location = new System.Drawing.Point(0, 24); |
||||
this.splitContainer.Name = "splitContainer"; |
||||
this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal; |
||||
//
|
||||
// splitContainer.Panel1
|
||||
//
|
||||
this.splitContainer.Panel1.Controls.Add(this.fileTabControl); |
||||
//
|
||||
// splitContainer.Panel2
|
||||
//
|
||||
this.splitContainer.Panel2.Controls.Add(this.tabControl); |
||||
this.splitContainer.Size = new System.Drawing.Size(757, 349); |
||||
this.splitContainer.SplitterDistance = 225; |
||||
this.splitContainer.TabIndex = 1; |
||||
//
|
||||
// fileTabControl
|
||||
//
|
||||
this.fileTabControl.Dock = System.Windows.Forms.DockStyle.Fill; |
||||
this.fileTabControl.Location = new System.Drawing.Point(0, 0); |
||||
this.fileTabControl.Name = "fileTabControl"; |
||||
this.fileTabControl.SelectedIndex = 0; |
||||
this.fileTabControl.Size = new System.Drawing.Size(757, 225); |
||||
this.fileTabControl.TabIndex = 0; |
||||
this.fileTabControl.SelectedIndexChanged += new System.EventHandler(this.FileTabControlSelectedIndexChanged); |
||||
//
|
||||
// tabControl
|
||||
//
|
||||
this.tabControl.Controls.Add(this.errorsTabPage); |
||||
this.tabControl.Controls.Add(this.outputTabPage); |
||||
this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill; |
||||
this.tabControl.Location = new System.Drawing.Point(0, 0); |
||||
this.tabControl.Name = "tabControl"; |
||||
this.tabControl.SelectedIndex = 0; |
||||
this.tabControl.Size = new System.Drawing.Size(757, 120); |
||||
this.tabControl.TabIndex = 0; |
||||
//
|
||||
// errorsTabPage
|
||||
//
|
||||
this.errorsTabPage.Location = new System.Drawing.Point(4, 22); |
||||
this.errorsTabPage.Name = "errorsTabPage"; |
||||
this.errorsTabPage.Padding = new System.Windows.Forms.Padding(3); |
||||
this.errorsTabPage.Size = new System.Drawing.Size(749, 94); |
||||
this.errorsTabPage.TabIndex = 0; |
||||
this.errorsTabPage.Text = "Errors"; |
||||
this.errorsTabPage.UseVisualStyleBackColor = true; |
||||
//
|
||||
// outputTabPage
|
||||
//
|
||||
this.outputTabPage.Location = new System.Drawing.Point(4, 22); |
||||
this.outputTabPage.Name = "outputTabPage"; |
||||
this.outputTabPage.Padding = new System.Windows.Forms.Padding(3); |
||||
this.outputTabPage.Size = new System.Drawing.Size(749, 94); |
||||
this.outputTabPage.TabIndex = 1; |
||||
this.outputTabPage.Text = "Output"; |
||||
this.outputTabPage.UseVisualStyleBackColor = true; |
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||
this.ClientSize = new System.Drawing.Size(757, 373); |
||||
this.Controls.Add(this.splitContainer); |
||||
this.Controls.Add(this.mainMenuStrip); |
||||
this.MainMenuStrip = this.mainMenuStrip; |
||||
this.Name = "MainForm"; |
||||
this.Text = "SharpSnippetCompiler"; |
||||
this.mainMenuStrip.ResumeLayout(false); |
||||
this.mainMenuStrip.PerformLayout(); |
||||
this.splitContainer.Panel1.ResumeLayout(false); |
||||
this.splitContainer.Panel2.ResumeLayout(false); |
||||
this.splitContainer.ResumeLayout(false); |
||||
this.tabControl.ResumeLayout(false); |
||||
this.ResumeLayout(false); |
||||
this.PerformLayout(); |
||||
} |
||||
private System.Windows.Forms.ToolStripSeparator fileExitToolStripSeparator; |
||||
private System.Windows.Forms.ToolStripMenuItem fileCloseToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem fileOpenToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem fileNewToolStripMenuItem; |
||||
private System.Windows.Forms.TabControl fileTabControl; |
||||
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripSeparator redoSeparatorToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripSeparator selectAllSeparatorToolStripMenuItem; |
||||
private System.Windows.Forms.TabPage outputTabPage; |
||||
private System.Windows.Forms.TabPage errorsTabPage; |
||||
private System.Windows.Forms.TabControl tabControl; |
||||
private System.Windows.Forms.SplitContainer splitContainer; |
||||
private System.Windows.Forms.ToolStripMenuItem referencesToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem redoToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem stepOutToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem stepIntoToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem stepOverToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripSeparator stepSeparatorToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem continueToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripSeparator continueSeparatorToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem stopToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem buildCurrentToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem buildtoolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem runToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem debugToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; |
||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; |
||||
private System.Windows.Forms.MenuStrip mainMenuStrip; |
||||
} |
||||
} |
||||
@ -1,378 +0,0 @@
@@ -1,378 +0,0 @@
|
||||
// SharpDevelop samples
|
||||
// Copyright (c) 2010, AlphaSierraPapa
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this list
|
||||
// of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||
// provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||
// endorse or promote products derived from this software without specific prior written
|
||||
// permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Commands; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.SharpDevelop.Project.Commands; |
||||
using ICSharpCode.SharpSnippetCompiler.Core; |
||||
using ICSharpCode.TextEditor; |
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler |
||||
{ |
||||
public partial class MainForm : Form |
||||
{ |
||||
public MainForm() |
||||
{ |
||||
//
|
||||
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||
//
|
||||
InitializeComponent(); |
||||
} |
||||
|
||||
public Control ErrorList { |
||||
get { |
||||
if (errorsTabPage.Controls.Count > 0) { |
||||
return errorsTabPage.Controls[0]; |
||||
} |
||||
return null; |
||||
} |
||||
set { |
||||
errorsTabPage.Controls.Clear(); |
||||
value.Dock = DockStyle.Fill; |
||||
errorsTabPage.Controls.Add(value); |
||||
} |
||||
} |
||||
|
||||
public Control OutputList { |
||||
get { |
||||
if (outputTabPage.Controls.Count > 0) { |
||||
return outputTabPage.Controls[0]; |
||||
} |
||||
return null; |
||||
} |
||||
set { |
||||
outputTabPage.Controls.Clear(); |
||||
value.Dock = DockStyle.Fill; |
||||
outputTabPage.Controls.Add(value); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the active text editor control.
|
||||
/// </summary>
|
||||
public TextEditorControl TextEditor { |
||||
get { |
||||
return ActiveSnippetTabPage.SnippetCompilerControl.TextEditor; |
||||
} |
||||
} |
||||
|
||||
public SnippetTabPage ActiveSnippetTabPage { |
||||
get { return fileTabControl.SelectedTab as SnippetTabPage; } |
||||
} |
||||
|
||||
public IViewContent LoadFile(string fileName) |
||||
{ |
||||
// Create a new tab page.
|
||||
SharpSnippetCompilerControl snippetControl = new SharpSnippetCompilerControl(); |
||||
snippetControl.Dock = DockStyle.Fill; |
||||
SnippetTabPage tabPage = new SnippetTabPage(snippetControl); |
||||
tabPage.Text = Path.GetFileName(fileName); |
||||
|
||||
fileTabControl.TabPages.Add(tabPage); |
||||
|
||||
// Load file
|
||||
snippetControl.LoadFile(fileName); |
||||
snippetControl.Focus(); |
||||
|
||||
WorkbenchWindow window = new WorkbenchWindow(fileTabControl, tabPage); |
||||
MainViewContent view = new MainViewContent(fileName, snippetControl, window); |
||||
WorkbenchSingleton.Workbench.ShowView(view); |
||||
|
||||
UpdateActiveView(view); |
||||
|
||||
return view; |
||||
} |
||||
|
||||
public void ActivateErrorList() |
||||
{ |
||||
tabControl.SelectedIndex = 0; |
||||
} |
||||
|
||||
public void ActivateOutputList() |
||||
{ |
||||
tabControl.SelectedIndex = 1; |
||||
} |
||||
|
||||
void ExitToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
SaveAll(); |
||||
Close(); |
||||
} |
||||
|
||||
void BuildCurrentToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
SaveAll(); |
||||
BuildSnippetCommand buildSnippet = new BuildSnippetCommand(ProjectService.CurrentProject); |
||||
buildSnippet.Run(); |
||||
} |
||||
|
||||
void RunToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
SaveAll(); |
||||
Execute execute = new Execute(); |
||||
execute.Run(); |
||||
} |
||||
|
||||
void ContinueToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
ContinueDebuggingCommand continueCommand = new ContinueDebuggingCommand(); |
||||
continueCommand.Run(); |
||||
} |
||||
|
||||
void StepOverToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
StepDebuggingCommand stepCommand = new StepDebuggingCommand(); |
||||
stepCommand.Run(); |
||||
} |
||||
|
||||
void StepIntoToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
StepIntoDebuggingCommand stepCommand = new StepIntoDebuggingCommand(); |
||||
stepCommand.Run(); |
||||
} |
||||
|
||||
void StepOutToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
StepOutDebuggingCommand stepCommand = new StepOutDebuggingCommand(); |
||||
stepCommand.Run(); |
||||
} |
||||
|
||||
void StopToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
StopDebuggingCommand stopCommand = new StopDebuggingCommand(); |
||||
stopCommand.Run(); |
||||
} |
||||
|
||||
void UndoToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
Undo undo = new Undo(); |
||||
undo.Run(); |
||||
} |
||||
|
||||
void RedoToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
Redo redo = new Redo(); |
||||
redo.Run(); |
||||
} |
||||
|
||||
void CutToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
Cut cut = new Cut(); |
||||
cut.Run(); |
||||
} |
||||
|
||||
void CopyToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
Copy copy = new Copy(); |
||||
copy.Run(); |
||||
} |
||||
|
||||
void PasteToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
Paste paste = new Paste(); |
||||
paste.Run(); |
||||
} |
||||
|
||||
void DeleteToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
Delete delete = new Delete(); |
||||
delete.Run(); |
||||
} |
||||
|
||||
void SelectAllToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
SelectAll selectAll = new SelectAll(); |
||||
selectAll.Run(); |
||||
} |
||||
|
||||
void ReferencesToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
IProject project = ProjectService.CurrentProject; |
||||
using (SelectReferenceDialog referenceDialog = new SelectReferenceDialog(project)) { |
||||
|
||||
// Add existing project references to dialog.
|
||||
List<ReferenceProjectItem> references = GetReferences(project); |
||||
AddReferences(referenceDialog as ISelectReferenceDialog, references); |
||||
|
||||
DialogResult result = referenceDialog.ShowDialog(); |
||||
if (result == DialogResult.OK) { |
||||
|
||||
ArrayList selectedReferences = referenceDialog.ReferenceInformations; |
||||
|
||||
// Remove any references removed in the select reference dialog.
|
||||
foreach (ReferenceProjectItem existingReference in references) { |
||||
if (!selectedReferences.Contains(existingReference)) { |
||||
ProjectService.RemoveProjectItem(project, existingReference); |
||||
} |
||||
} |
||||
|
||||
// Add new references.
|
||||
foreach (ReferenceProjectItem reference in referenceDialog.ReferenceInformations) { |
||||
ProjectService.AddProjectItem(project, reference); |
||||
} |
||||
project.Save(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
List<ReferenceProjectItem> GetReferences(IProject project) |
||||
{ |
||||
List<ReferenceProjectItem> references = new List<ReferenceProjectItem>(); |
||||
foreach (ProjectItem item in project.Items) { |
||||
ReferenceProjectItem reference = item as ReferenceProjectItem; |
||||
if (reference != null) { |
||||
references.Add(reference); |
||||
} |
||||
} |
||||
return references; |
||||
} |
||||
|
||||
void AddReferences(ISelectReferenceDialog dialog, List<ReferenceProjectItem> references) |
||||
{ |
||||
foreach (ReferenceProjectItem reference in references) { |
||||
dialog.AddReference(reference.Include, "Gac", reference.FileName, reference); |
||||
} |
||||
} |
||||
|
||||
void UpdateActiveView(IViewContent view) |
||||
{ |
||||
Workbench workbench = WorkbenchSingleton.Workbench as Workbench; |
||||
workbench.ActiveViewContent = view; |
||||
workbench.ActiveContent = view; |
||||
} |
||||
|
||||
void FileTabControlSelectedIndexChanged(object sender, EventArgs e) |
||||
{ |
||||
UpdateActiveView(); |
||||
} |
||||
|
||||
void UpdateActiveView() |
||||
{ |
||||
if (ActiveSnippetTabPage != null) { |
||||
SharpSnippetCompilerControl control = ActiveSnippetTabPage.SnippetCompilerControl; |
||||
foreach (IViewContent view in WorkbenchSingleton.Workbench.ViewContentCollection) { |
||||
if (view.Control == control) { |
||||
UpdateActiveView(view); |
||||
return; |
||||
} |
||||
} |
||||
} else { |
||||
UpdateActiveView(null); |
||||
} |
||||
} |
||||
|
||||
void SaveAll() |
||||
{ |
||||
foreach (SnippetTabPage tabPage in fileTabControl.TabPages) { |
||||
tabPage.SnippetCompilerControl.Save(); |
||||
} |
||||
} |
||||
|
||||
void FileNewToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
using (NewFileDialog dialog = new NewFileDialog()) { |
||||
dialog.FileName = GetNewFileName(); |
||||
if (dialog.ShowDialog() == DialogResult.OK) { |
||||
string fileName = dialog.FileName; |
||||
using (StreamWriter file = File.CreateText(fileName)) { |
||||
file.Write(String.Empty); |
||||
} |
||||
LoadFile(fileName); |
||||
AddFileToProject(fileName); |
||||
} |
||||
} |
||||
} |
||||
|
||||
string GetNewFileName() |
||||
{ |
||||
string fileName = SnippetCompilerProject.GetFullFileName("Snippet1.cs"); |
||||
string baseFolder = Path.GetDirectoryName(fileName); |
||||
int count = 1; |
||||
while (File.Exists(fileName)) { |
||||
count++; |
||||
fileName = Path.Combine(baseFolder, "Snippet" + count.ToString() + ".cs"); |
||||
} |
||||
return fileName; |
||||
} |
||||
|
||||
void FileOpenToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
using (OpenFileDialog dialog = new OpenFileDialog()) { |
||||
dialog.CheckFileExists = true; |
||||
if (dialog.ShowDialog() == DialogResult.OK) { |
||||
foreach (string fileName in dialog.FileNames) { |
||||
LoadFile(fileName); |
||||
AddFileToProject(fileName); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
void AddFileToProject(string fileName) |
||||
{ |
||||
IProject project = ProjectService.CurrentProject; |
||||
FileProjectItem item = new FileProjectItem(project, ItemType.Compile, fileName); |
||||
ProjectService.AddProjectItem(project, item); |
||||
project.Save(); |
||||
} |
||||
|
||||
void FileCloseToolStripMenuItemClick(object sender, EventArgs e) |
||||
{ |
||||
SnippetTabPage activeTabPage = ActiveSnippetTabPage; |
||||
if (activeTabPage != null) { |
||||
SharpSnippetCompilerControl snippetControl = activeTabPage.SnippetCompilerControl; |
||||
snippetControl.Save(); |
||||
string fileName = ActiveSnippetTabPage.SnippetCompilerControl.TextEditor.FileName; |
||||
IProject project = ProjectService.CurrentProject; |
||||
FileProjectItem item = project.FindFile(fileName); |
||||
if (item != null) { |
||||
ProjectService.RemoveProjectItem(project, item); |
||||
project.Save(); |
||||
|
||||
foreach (IViewContent view in WorkbenchSingleton.Workbench.ViewContentCollection) { |
||||
if (view.Control == snippetControl) { |
||||
WorkbenchSingleton.Workbench.CloseContent(view); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
fileTabControl.TabPages.Remove(activeTabPage); |
||||
activeTabPage.Dispose(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -1,123 +0,0 @@
@@ -1,123 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<root> |
||||
<!-- |
||||
Microsoft ResX Schema |
||||
|
||||
Version 2.0 |
||||
|
||||
The primary goals of this format is to allow a simple XML format |
||||
that is mostly human readable. The generation and parsing of the |
||||
various data types are done through the TypeConverter classes |
||||
associated with the data types. |
||||
|
||||
Example: |
||||
|
||||
... ado.net/XML headers & schema ... |
||||
<resheader name="resmimetype">text/microsoft-resx</resheader> |
||||
<resheader name="version">2.0</resheader> |
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
||||
<value>[base64 mime encoded serialized .NET Framework object]</value> |
||||
</data> |
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
||||
<comment>This is a comment</comment> |
||||
</data> |
||||
|
||||
There are any number of "resheader" rows that contain simple |
||||
name/value pairs. |
||||
|
||||
Each data row contains a name, and value. The row also contains a |
||||
type or mimetype. Type corresponds to a .NET class that support |
||||
text/value conversion through the TypeConverter architecture. |
||||
Classes that don't support this are serialized and stored with the |
||||
mimetype set. |
||||
|
||||
The mimetype is used for serialized objects, and tells the |
||||
ResXResourceReader how to depersist the object. This is currently not |
||||
extensible. For a given mimetype the value must be set accordingly: |
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format |
||||
that the ResXResourceWriter will generate, however the reader can |
||||
read any of the formats listed below. |
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64 |
||||
value : The object must be serialized with |
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
||||
: and then encoded with base64 encoding. |
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64 |
||||
value : The object must be serialized with |
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
||||
: and then encoded with base64 encoding. |
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64 |
||||
value : The object must be serialized into a byte array |
||||
: using a System.ComponentModel.TypeConverter |
||||
: and then encoded with base64 encoding. |
||||
--> |
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
||||
<xsd:element name="root" msdata:IsDataSet="true"> |
||||
<xsd:complexType> |
||||
<xsd:choice maxOccurs="unbounded"> |
||||
<xsd:element name="metadata"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" use="required" type="xsd:string" /> |
||||
<xsd:attribute name="type" type="xsd:string" /> |
||||
<xsd:attribute name="mimetype" type="xsd:string" /> |
||||
<xsd:attribute ref="xml:space" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="assembly"> |
||||
<xsd:complexType> |
||||
<xsd:attribute name="alias" type="xsd:string" /> |
||||
<xsd:attribute name="name" type="xsd:string" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="data"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
||||
<xsd:attribute ref="xml:space" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="resheader"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" use="required" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:choice> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:schema> |
||||
<resheader name="resmimetype"> |
||||
<value>text/microsoft-resx</value> |
||||
</resheader> |
||||
<resheader name="version"> |
||||
<value>2.0</value> |
||||
</resheader> |
||||
<resheader name="reader"> |
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<resheader name="writer"> |
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<metadata name="mainMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
||||
<value>17, 17</value> |
||||
</metadata> |
||||
</root> |
||||
@ -0,0 +1,315 @@
@@ -0,0 +1,315 @@
|
||||
// SharpDevelop samples
|
||||
// Copyright (c) 2013, AlphaSierraPapa
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this list
|
||||
// of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||
// provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||
// endorse or promote products derived from this software without specific prior written
|
||||
// permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.ComponentModel; |
||||
using System.IO; |
||||
using System.Windows; |
||||
using System.Windows.Input; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.SharpDevelop.Project.Commands; |
||||
using ICSharpCode.SharpSnippetCompiler.Core; |
||||
using Microsoft.Win32; |
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler |
||||
{ |
||||
public class MainViewModel : INotifyPropertyChanged |
||||
{ |
||||
ObservableCollection<MainViewContent> files = new ObservableCollection<MainViewContent>(); |
||||
ObservableCollection<PadViewModel> pads = new ObservableCollection<PadViewModel>(); |
||||
|
||||
public MainViewModel() |
||||
{ |
||||
ExitCommand = new DelegateCommand(param => Exit()); |
||||
NewFileCommand = new DelegateCommand(param => NewFile()); |
||||
BuildCurrentCommand = new DelegateCommand(param => BuildCurrentProject()); |
||||
RunCommand = new DelegateCommand(param => Run()); |
||||
StopCommand = new DelegateCommand(param => StopDebugging()); |
||||
ContinueCommand = new DelegateCommand(param => ContinueDebugging()); |
||||
StepOverCommand = new DelegateCommand(param => StepOver()); |
||||
StepIntoCommand = new DelegateCommand(param => StepInto()); |
||||
StepOutCommand = new DelegateCommand(param => StepOut()); |
||||
AddReferencesCommand = new DelegateCommand(param => AddReferences()); |
||||
OpenFileCommand = new DelegateCommand(param => OpenFile()); |
||||
CloseFileCommand = new DelegateCommand(param => CloseFile()); |
||||
} |
||||
|
||||
public ICommand ExitCommand { get; private set; } |
||||
public ICommand NewFileCommand { get; private set; } |
||||
public ICommand BuildCurrentCommand { get; private set; } |
||||
public ICommand RunCommand { get; private set; } |
||||
public ICommand StopCommand { get; private set; } |
||||
public ICommand ContinueCommand { get; private set; } |
||||
public ICommand StepOverCommand { get; private set; } |
||||
public ICommand StepIntoCommand { get; private set; } |
||||
public ICommand StepOutCommand { get; private set; } |
||||
public ICommand AddReferencesCommand { get; private set; } |
||||
public ICommand OpenFileCommand { get; private set; } |
||||
public ICommand CloseFileCommand { get; private set; } |
||||
|
||||
public ObservableCollection<MainViewContent> Files { |
||||
get { return files; } |
||||
} |
||||
|
||||
public ObservableCollection<PadViewModel> Pads { |
||||
get { return pads; } |
||||
} |
||||
|
||||
public MainViewContent SelectedFile { get; set; } |
||||
|
||||
public void AddInitialPads() |
||||
{ |
||||
AddPad(typeof(ErrorListPad)); |
||||
AddPad(typeof(CompilerMessageView)); |
||||
} |
||||
|
||||
void AddPad(Type type) |
||||
{ |
||||
PadDescriptor descriptor = WorkbenchSingleton.Workbench.GetPad(type); |
||||
Pads.Add(new PadViewModel(descriptor)); |
||||
} |
||||
|
||||
public IViewContent LoadFile(string fileName) |
||||
{ |
||||
var window = new WorkbenchWindow(); |
||||
var view = new MainViewContent(fileName, window); |
||||
WorkbenchSingleton.Workbench.ShowView(view); |
||||
|
||||
UpdateActiveView(view); |
||||
|
||||
files.Add(view); |
||||
|
||||
return view; |
||||
} |
||||
|
||||
void UpdateActiveView(IViewContent view) |
||||
{ |
||||
Workbench workbench = WorkbenchSingleton.Workbench as Workbench; |
||||
workbench.ActiveViewContent = view; |
||||
workbench.ActiveContent = view; |
||||
} |
||||
|
||||
void Exit() |
||||
{ |
||||
SaveAll(); |
||||
Application.Current.Shutdown(); |
||||
} |
||||
|
||||
void SaveAll() |
||||
{ |
||||
foreach (MainViewContent view in files) { |
||||
view.Save(); |
||||
} |
||||
} |
||||
|
||||
void NewFile() |
||||
{ |
||||
using (var dialog = new NewFileDialog()) { |
||||
dialog.FileName = GetNewFileName(); |
||||
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { |
||||
string fileName = dialog.FileName; |
||||
using (StreamWriter file = File.CreateText(fileName)) { |
||||
file.Write(String.Empty); |
||||
} |
||||
LoadFile(fileName); |
||||
AddFileToProject(fileName); |
||||
} |
||||
} |
||||
} |
||||
|
||||
string GetNewFileName() |
||||
{ |
||||
string fileName = SnippetCompilerProject.GetFullFileName("Snippet1.cs"); |
||||
string baseFolder = Path.GetDirectoryName(fileName); |
||||
int count = 1; |
||||
while (File.Exists(fileName)) { |
||||
count++; |
||||
fileName = Path.Combine(baseFolder, "Snippet" + count.ToString() + ".cs"); |
||||
} |
||||
return fileName; |
||||
} |
||||
|
||||
void AddFileToProject(string fileName) |
||||
{ |
||||
IProject project = ProjectService.CurrentProject; |
||||
var item = new FileProjectItem(project, ItemType.Compile, fileName); |
||||
ProjectService.AddProjectItem(project, item); |
||||
project.Save(); |
||||
} |
||||
|
||||
void BuildCurrentProject() |
||||
{ |
||||
SaveAll(); |
||||
var buildSnippet = new BuildSnippetCommand(ProjectService.CurrentProject); |
||||
buildSnippet.Run(); |
||||
} |
||||
|
||||
void Run() |
||||
{ |
||||
SaveAll(); |
||||
var execute = new Execute(); |
||||
execute.Run(); |
||||
} |
||||
|
||||
void ContinueDebugging() |
||||
{ |
||||
var continueCommand = new ContinueDebuggingCommand(); |
||||
continueCommand.Run(); |
||||
} |
||||
|
||||
void StopDebugging() |
||||
{ |
||||
var stopCommand = new StopDebuggingCommand(); |
||||
stopCommand.Run(); |
||||
} |
||||
|
||||
void StepOver() |
||||
{ |
||||
var stepCommand = new StepDebuggingCommand(); |
||||
stepCommand.Run(); |
||||
} |
||||
|
||||
void StepInto() |
||||
{ |
||||
var stepCommand = new StepIntoDebuggingCommand(); |
||||
stepCommand.Run(); |
||||
} |
||||
|
||||
void StepOut() |
||||
{ |
||||
var stepCommand = new StepOutDebuggingCommand(); |
||||
stepCommand.Run(); |
||||
} |
||||
|
||||
void AddReferences() |
||||
{ |
||||
IProject project = ProjectService.CurrentProject; |
||||
using (var referenceDialog = new SelectReferenceDialog(project)) { |
||||
|
||||
// Add existing project references to dialog.
|
||||
List<ReferenceProjectItem> references = GetReferences(project); |
||||
AddReferences(referenceDialog as ISelectReferenceDialog, references); |
||||
|
||||
System.Windows.Forms.DialogResult result = referenceDialog.ShowDialog(); |
||||
if (result == System.Windows.Forms.DialogResult.OK) { |
||||
|
||||
ArrayList selectedReferences = referenceDialog.ReferenceInformations; |
||||
|
||||
// Remove any references removed in the select reference dialog.
|
||||
foreach (ReferenceProjectItem existingReference in references) { |
||||
if (!selectedReferences.Contains(existingReference)) { |
||||
ProjectService.RemoveProjectItem(project, existingReference); |
||||
} |
||||
} |
||||
|
||||
// Add new references.
|
||||
foreach (ReferenceProjectItem reference in referenceDialog.ReferenceInformations) { |
||||
if (!references.Contains(reference)) { |
||||
ProjectService.AddProjectItem(project, reference); |
||||
} |
||||
} |
||||
project.Save(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
List<ReferenceProjectItem> GetReferences(IProject project) |
||||
{ |
||||
List<ReferenceProjectItem> references = new List<ReferenceProjectItem>(); |
||||
foreach (ProjectItem item in project.Items) { |
||||
ReferenceProjectItem reference = item as ReferenceProjectItem; |
||||
if (reference != null) { |
||||
references.Add(reference); |
||||
} |
||||
} |
||||
return references; |
||||
} |
||||
|
||||
void AddReferences(ISelectReferenceDialog dialog, List<ReferenceProjectItem> references) |
||||
{ |
||||
foreach (ReferenceProjectItem reference in references) { |
||||
dialog.AddReference(reference.Include, "Gac", reference.FileName, reference); |
||||
} |
||||
} |
||||
|
||||
void OpenFile() |
||||
{ |
||||
var dialog = new OpenFileDialog(); |
||||
dialog.CheckFileExists = true; |
||||
if (dialog.ShowDialog() == true) { |
||||
foreach (string fileName in dialog.FileNames) { |
||||
LoadFile(fileName); |
||||
AddFileToProject(fileName); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void CloseFile() |
||||
{ |
||||
if (SelectedFile != null) { |
||||
SelectedFile.Save(); |
||||
string fileName = SelectedFile.PrimaryFileName; |
||||
IProject project = ProjectService.CurrentProject; |
||||
FileProjectItem item = project.FindFile(fileName); |
||||
if (item != null) { |
||||
ProjectService.RemoveProjectItem(project, item); |
||||
project.Save(); |
||||
|
||||
files.Remove(SelectedFile); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public PadViewModel SelectedPad { get; set; } |
||||
|
||||
public void ActivateOutputList() |
||||
{ |
||||
SelectedPad = pads[1]; |
||||
NotifyPropertyChanged("SelectedPad"); |
||||
} |
||||
|
||||
public void ActivateErrorList() |
||||
{ |
||||
SelectedPad = pads[0]; |
||||
NotifyPropertyChanged("SelectedPad"); |
||||
} |
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
void NotifyPropertyChanged(string name) |
||||
{ |
||||
if (PropertyChanged != null) { |
||||
PropertyChanged(this, new PropertyChangedEventArgs(name)); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,106 @@
@@ -0,0 +1,106 @@
|
||||
<Window |
||||
x:Class="ICSharpCode.SharpSnippetCompiler.MainWindow" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:snippet="clr-namespace:ICSharpCode.SharpSnippetCompiler" |
||||
DataContext="{x:Static snippet:ViewModels.MainViewModel}" |
||||
Title="Sharp Snippet Compiler" |
||||
Height="480" |
||||
Width="640"> |
||||
|
||||
<Window.InputBindings> |
||||
<KeyBinding |
||||
Key="N" |
||||
Modifiers="Ctrl" |
||||
Command="{Binding NewFileCommand}"/> |
||||
<KeyBinding |
||||
Key="B" |
||||
Modifiers="Ctrl+Shift" |
||||
Command="{Binding BuildCurrentCommand}"/> |
||||
<KeyBinding |
||||
Key="F5" |
||||
Command="{Binding RunCommand}"/> |
||||
<KeyBinding |
||||
Key="F6" |
||||
Command="{Binding ContinueCommand}"/> |
||||
<KeyBinding |
||||
Key="F10" |
||||
Command="{Binding StepOverCommand}"/> |
||||
<KeyBinding |
||||
Key="F11" |
||||
Command="{Binding StepIntoCommand}"/> |
||||
<KeyBinding |
||||
Key="F11" |
||||
Modifiers="Shift" |
||||
Command="{Binding StepOutCommand}"/> |
||||
</Window.InputBindings> |
||||
|
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"/> |
||||
<RowDefinition Height="2*"/> |
||||
<RowDefinition Height="*"/> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<Menu IsMainMenu="True"> |
||||
<MenuItem Header="_File"> |
||||
<MenuItem Header="_New..." Command="{Binding NewFileCommand}" InputGestureText="Ctrl+N"/> |
||||
<MenuItem Header="_Open..." Command="{Binding OpenFileCommand}"/> |
||||
<MenuItem Header="_Close" Command="{Binding CloseFileCommand}"/> |
||||
<Separator /> |
||||
<MenuItem Header="E_xit" Command="{Binding ExitCommand}"/> |
||||
</MenuItem> |
||||
<MenuItem Header="_Edit"> |
||||
<MenuItem Header="_Undo"/> |
||||
<MenuItem Header="_Redo"/> |
||||
<Separator /> |
||||
<MenuItem Header="Cu_t" Command="ApplicationCommands.Cut"/> |
||||
<MenuItem Header="_Copy" Command="ApplicationCommands.Copy"/> |
||||
<MenuItem Header="_Paste" Command="ApplicationCommands.Paste"/> |
||||
<MenuItem Header="_Delete" Command="ApplicationCommands.Delete"/> |
||||
<Separator /> |
||||
<MenuItem Header="Select _All" Command="ApplicationCommands.SelectAll"/> |
||||
</MenuItem> |
||||
<MenuItem Header="_Build"> |
||||
<MenuItem Header="Build Current" Command="{Binding BuildCurrentCommand}" InputGestureText="Ctrl+Shift+B"/> |
||||
</MenuItem> |
||||
<MenuItem Header="_Debug"> |
||||
<MenuItem Header="_Run" Command="{Binding RunCommand}" InputGestureText="F5"/> |
||||
<MenuItem Header="St_op"/> |
||||
<Separator /> |
||||
<MenuItem Header="_Continue" Command="{Binding ContinueCommand}" InputGestureText="F6"/> |
||||
<Separator /> |
||||
<MenuItem Header="Step O_ver" Command="{Binding StepOverCommand}" InputGestureText="F10"/> |
||||
<MenuItem Header="Step _Into" Command="{Binding StepIntoCommand}" InputGestureText="F11"/> |
||||
<MenuItem Header="Step O_ut" Command="{Binding StepOutCommand}" InputGestureText="Shift+F11"/> |
||||
</MenuItem> |
||||
<MenuItem Header="_Tools"> |
||||
<MenuItem Header="_References..." Command="{Binding AddReferencesCommand}"/> |
||||
</MenuItem> |
||||
</Menu> |
||||
|
||||
<TabControl |
||||
Grid.Row="1" |
||||
SelectedItem="{Binding SelectedFile}" |
||||
ItemsSource="{Binding Files}"> |
||||
<TabControl.ItemContainerStyle> |
||||
<Style TargetType="TabItem"> |
||||
<Setter Property="Header" Value="{Binding TabPageText}"/> |
||||
<Setter Property="Content" Value="{Binding Control}"/> |
||||
</Style> |
||||
</TabControl.ItemContainerStyle> |
||||
</TabControl> |
||||
|
||||
<TabControl |
||||
Grid.Row="2" |
||||
SelectedItem="{Binding SelectedPad}" |
||||
ItemsSource="{Binding Pads}"> |
||||
<TabControl.ItemContainerStyle> |
||||
<Style TargetType="TabItem"> |
||||
<Setter Property="Header" Value="{Binding Title}"/> |
||||
<Setter Property="Content" Value="{Binding Control}"/> |
||||
</Style> |
||||
</TabControl.ItemContainerStyle> |
||||
</TabControl> |
||||
</Grid> |
||||
</Window> |
||||
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Windows; |
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler |
||||
{ |
||||
public partial class MainWindow : Window |
||||
{ |
||||
public MainWindow() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,63 @@
@@ -0,0 +1,63 @@
|
||||
// SharpDevelop samples
|
||||
// Copyright (c) 2013, AlphaSierraPapa
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this list
|
||||
// of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||
// provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||
// endorse or promote products derived from this software without specific prior written
|
||||
// permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Forms.Integration; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
|
||||
namespace ICSharpCode.SharpSnippetCompiler |
||||
{ |
||||
public class PadViewModel |
||||
{ |
||||
PadDescriptor padDescriptor; |
||||
object control; |
||||
|
||||
public PadViewModel(PadDescriptor padDescriptor) |
||||
{ |
||||
this.padDescriptor = padDescriptor; |
||||
this.padDescriptor.CreatePad(); |
||||
|
||||
this.control = padDescriptor.PadContent.Control; |
||||
if (control is System.Windows.Forms.Control) { |
||||
var host = new WindowsFormsHost(); |
||||
host.Child = (System.Windows.Forms.Control)padDescriptor.PadContent.Control; |
||||
this.control = host; |
||||
} |
||||
} |
||||
|
||||
public object Control { |
||||
get { return control; } |
||||
} |
||||
|
||||
public string Title { |
||||
get { return StringParser.Parse(padDescriptor.Title); } |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue