diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2011-11-15 00:23:26 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2011-11-15 00:23:26 +0400 |
commit | 3b6fda215c294ec2114eee8f2cca24ba93c98d9f (patch) | |
tree | 9584e3e27ce08c4bec3cb8b094861db5e8184241 /ICSharpCode.NRefactory.GtkDemo | |
parent | 057c0beee22c24d814c59575019cf6a505e65127 (diff) |
Added gtk demo & fixed code completion bug.
Diffstat (limited to 'ICSharpCode.NRefactory.GtkDemo')
14 files changed, 690 insertions, 0 deletions
diff --git a/ICSharpCode.NRefactory.GtkDemo/AssemblyInfo.cs b/ICSharpCode.NRefactory.GtkDemo/AssemblyInfo.cs new file mode 100644 index 00000000..ef4160b7 --- /dev/null +++ b/ICSharpCode.NRefactory.GtkDemo/AssemblyInfo.cs @@ -0,0 +1,52 @@ +// +// AssemblyInfo.cs +// +// Author: +// Mike Krüger <mkrueger@xamarin.com> +// +// Copyright (c) 2011 Xamarin Inc. (http://xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("ICSharpCode.NRefactory.GtkDemo")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Xamarin")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Xamarin Inc. (http://xamarin.com)")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/ICSharpCode.NRefactory.GtkDemo/CSharpDemo.cs b/ICSharpCode.NRefactory.GtkDemo/CSharpDemo.cs new file mode 100644 index 00000000..08b666b5 --- /dev/null +++ b/ICSharpCode.NRefactory.GtkDemo/CSharpDemo.cs @@ -0,0 +1,23 @@ +// CSharpDemo.cs +using System; +using System.Linq; + +namespace Demo +{ + #region Demo + public class CSharpDemo + { + static void TestMe (int i) + { + Console.WriteLine (i); + NotDefined (); + } + + public static void Main (string[] args) + { + TestMe (args.Count ()); + } + } + #endregion +} + diff --git a/ICSharpCode.NRefactory.GtkDemo/ICSharpCode.NRefactory.GtkDemo.csproj b/ICSharpCode.NRefactory.GtkDemo/ICSharpCode.NRefactory.GtkDemo.csproj new file mode 100644 index 00000000..3fef8f51 --- /dev/null +++ b/ICSharpCode.NRefactory.GtkDemo/ICSharpCode.NRefactory.GtkDemo.csproj @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>10.0.0</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{A7EEF7F8-238F-459D-95A9-96467539641D}</ProjectGuid> + <OutputType>WinExe</OutputType> + <RootNamespace>ICSharpCode.NRefactory.GtkDemo</RootNamespace> + <AssemblyName>ICSharpCode.NRefactory.GtkDemo</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ConsolePause>false</ConsolePause> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>none</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ConsolePause>false</ConsolePause> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <Reference Include="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <Reference Include="Mono.Posix" /> + <Reference Include="Mono.TextEditor"> + <HintPath>..\..\StandAloneTextEditor\StandAloneTextEditor\bin\Debug\Mono.TextEditor.dll</HintPath> + </Reference> + <Reference Include="System.Core" /> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="gtk-gui\gui.stetic"> + <LogicalName>gui.stetic</LogicalName> + </EmbeddedResource> + <EmbeddedResource Include="pixbuf\comment.png"> + <LogicalName>comment.png</LogicalName> + </EmbeddedResource> + <EmbeddedResource Include="pixbuf\element-class-16.png"> + <LogicalName>class.png</LogicalName> + </EmbeddedResource> + <EmbeddedResource Include="pixbuf\element-field-16.png"> + <LogicalName>expression.png</LogicalName> + </EmbeddedResource> + <EmbeddedResource Include="pixbuf\element-literal-16.png"> + <LogicalName>token.png</LogicalName> + </EmbeddedResource> + <EmbeddedResource Include="pixbuf\element-method-16.png"> + <LogicalName>statement.png</LogicalName> + </EmbeddedResource> + <EmbeddedResource Include="pixbuf\element-namespace-16.png"> + <LogicalName>namespace.png</LogicalName> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <Compile Include="gtk-gui\generated.cs" /> + <Compile Include="Main.cs" /> + <Compile Include="AssemblyInfo.cs" /> + <Compile Include="MainWindow.cs" /> + <Compile Include="gtk-gui\ICSharpCode.NRefactory.GtkDemo.MainWindow.cs" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <ItemGroup> + <ProjectReference Include="..\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj"> + <Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project> + <Name>ICSharpCode.NRefactory</Name> + </ProjectReference> + <ProjectReference Include="..\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory.CSharp.csproj"> + <Project>{53DCA265-3C3C-42F9-B647-F72BA678122B}</Project> + <Name>ICSharpCode.NRefactory.CSharp</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <None Include="CSharpDemo.cs" /> + </ItemGroup> + <ItemGroup> + <Folder Include="pixbuf\" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/ICSharpCode.NRefactory.GtkDemo/Main.cs b/ICSharpCode.NRefactory.GtkDemo/Main.cs new file mode 100644 index 00000000..d59c072d --- /dev/null +++ b/ICSharpCode.NRefactory.GtkDemo/Main.cs @@ -0,0 +1,41 @@ +// +// Main.cs +// +// Author: +// Mike Krüger <mkrueger@xamarin.com> +// +// Copyright (c) 2011 Xamarin Inc. (http://xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using Gtk; + +namespace ICSharpCode.NRefactory.GtkDemo +{ + class MainClass + { + public static void Main (string[] args) + { + Application.Init (); + MainWindow win = new MainWindow (); + win.Show (); + Application.Run (); + } + } +} diff --git a/ICSharpCode.NRefactory.GtkDemo/MainWindow.cs b/ICSharpCode.NRefactory.GtkDemo/MainWindow.cs new file mode 100644 index 00000000..d3fcb929 --- /dev/null +++ b/ICSharpCode.NRefactory.GtkDemo/MainWindow.cs @@ -0,0 +1,262 @@ +// +// MainWindow.cs +// +// Author: +// Mike Krüger <mkrueger@xamarin.com> +// +// Copyright (c) 2011 Xamarin Inc. (http://xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using ICSharpCode.NRefactory.CSharp; +using Gtk; +using System.IO; +using System.Text; +using System.Reflection; +using Mono.TextEditor; +using ICSharpCode.NRefactory.CSharp.Resolver; +using ICSharpCode.NRefactory.Semantics; +using System.Collections.Generic; +using ICSharpCode.NRefactory.TypeSystem; +using System.Threading.Tasks; +using ICSharpCode.NRefactory.TypeSystem.Implementation; +using Gdk; + +namespace ICSharpCode.NRefactory.GtkDemo +{ + public partial class MainWindow : Gtk.Window + { + TreeStore store = new TreeStore (typeof (string), typeof (string), typeof (AstNode), typeof (Pixbuf)); + Dictionary<AstNode, TreeIter> iterDict = new Dictionary<AstNode, TreeIter> (); + TextEditor editor = new TextEditor (); + CompilationUnit unit; + + Pixbuf comment = new Pixbuf (typeof (MainWindow).Assembly, "comment.png"); + Pixbuf classPixbuf = new Pixbuf (typeof (MainWindow).Assembly, "class.png"); + Pixbuf tokenPixbuf = new Pixbuf (typeof (MainWindow).Assembly, "token.png"); + Pixbuf statementPixbuf = new Pixbuf (typeof (MainWindow).Assembly, "statement.png"); + Pixbuf expressionPixbuf = new Pixbuf (typeof (MainWindow).Assembly, "expression.png"); + Pixbuf namespacePixbuf = new Pixbuf (typeof (MainWindow).Assembly, "namespace.png"); + + public MainWindow () : + base(Gtk.WindowType.Toplevel) + { + this.Build (); + this.BorderWidth = 12; + this.treeviewNodes.Model = store; + var col =new TreeViewColumn (); + col.Title ="Node"; + var pb = new CellRendererPixbuf (); + col.PackStart (pb, false); + col.AddAttribute (pb, "pixbuf", 3); + + var text = new CellRendererText (); + col.PackStart (text, true); + col.AddAttribute (text, "text", 0); + + this.treeviewNodes.AppendColumn (col); + this.treeviewNodes.AppendColumn ("ResolveResult", new CellRendererText (), "text", 1); + this.treeviewNodes.Selection.Changed += SelectionChanged; +// this.treeviewNodes.HeadersVisible = false; + this.scrolledwindow1.Child = editor; + this.scrolledwindow1.Child.ShowAll (); + this.editor.Document.MimeType = "text/x-csharp"; + this.editor.Options.FontName = "Mono 14"; + this.editor.Caret.PositionChanged += HandlePositionChanged; + this.editor.Text = File.ReadAllText ("/Users/mike/work/NRefactory/ICSharpCode.NRefactory.GtkDemo/CSharpDemo.cs"); + buttonParse.Clicked += HandleClicked; + buttonGenerate.Clicked += CSharpGenerateCodeButtonClick; + HandleClicked (this, EventArgs.Empty); + } + + void HandlePositionChanged (object sender, DocumentLocationEventArgs e) + { + var node = unit.GetNodeAt (editor.Caret.Line, editor.Caret.Column); + if (node == null) + return; + TreeIter iter; + if (!iterDict.TryGetValue (node, out iter)) + return; + this.treeviewNodes.Selection.Changed -= SelectionChanged; + treeviewNodes.Selection.SelectIter (iter); + + treeviewNodes.ScrollToCell (store.GetPath (iter), null, true, 0, 0); + this.treeviewNodes.Selection.Changed += SelectionChanged; + } + + void CSharpGenerateCodeButtonClick(object sender, EventArgs e) + { + var w = new StringWriter(); + var output = new CSharpOutputVisitor (w, new CSharpFormattingOptions()); + unit.AcceptVisitor (output, null); + editor.Text = w.ToString(); + } + + void SelectionChanged (object sender, EventArgs e) + { + TreeIter iter; + + if (!this.treeviewNodes.Selection.GetSelected (out iter)) + return; + var node = store.GetValue (iter, 2) as AstNode; + if (node == null) + return; + this.editor.Caret.PositionChanged -= HandlePositionChanged; + this.editor.SetCaretTo (node.StartLocation.Line, node.StartLocation.Column); + this.editor.SetSelection (node.StartLocation.Line, node.StartLocation.Column, node.EndLocation.Line, node.EndLocation.Column); + this.editor.Caret.PositionChanged += HandlePositionChanged; + } + + public void ShowUnit (CompilationUnit unit, ResolveVisitor visitor) + { + this.unit = unit; + store.Clear (); + iterDict.Clear (); + if (unit == null) + return; + var iter = store.AppendValues (GetNodeTitle (unit), "", unit, GetIcon (unit)); + AddChildren (unit, visitor, iter); + treeviewNodes.ExpandAll (); + } + + public Pixbuf GetIcon (AstNode child) + { + if (child is Comment) + return comment; + if (child is PreProcessorDirective) + return comment; + if (child is AttributedNode) + return classPixbuf; + if (child is CSharpTokenNode) + return tokenPixbuf; + if (child is Identifier) + return tokenPixbuf; + if (child is Statement) + return statementPixbuf; + if (child is Expression) + return expressionPixbuf; + if (child is UsingDeclaration) + return namespacePixbuf; + if (child is NamespaceDeclaration) + return namespacePixbuf; + + return null; + } + + public void AddChildren (AstNode node, ResolveVisitor visitor, TreeIter iter) + { + if (node == null) + return; + iterDict [node] = iter; + foreach (var child in node.Children) { + ResolveResult result = null; + try { + if (child is Expression) + result = visitor.GetResolveResult (child); + } catch (Exception){ + result = null; + } + + var childIter = store.AppendValues (iter, GetNodeTitle (child), result != null ? result.ToString () : "", child, GetIcon (child)); + AddChildren (child, visitor, childIter); + } + } + + string GetNodeTitle(AstNode node) + { + var b = new StringBuilder(); + b.Append(node.Role.ToString()); + b.Append(": "); + b.Append(node.GetType().Name); + bool hasProperties = false; + foreach (PropertyInfo p in node.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) { + if (p.Name == "NodeType" || p.Name == "IsNull") + continue; + if (p.PropertyType == typeof(string) || p.PropertyType.IsEnum || p.PropertyType == typeof(bool)) { + if (!hasProperties) { + hasProperties = true; + b.Append(" ("); + } else { + b.Append(", "); + } + b.Append(p.Name); + b.Append(" = "); + try { + object val = p.GetValue(node, null); + b.Append(val != null ? val.ToString() : "**null**"); + } catch (TargetInvocationException ex) { + b.Append("**" + ex.InnerException.GetType().Name + "**"); + } + } + } + if (hasProperties) + b.Append(")"); +// b.Append(" Start " + node.StartLocation); +// b.Append(" End " + node.EndLocation); + return b.ToString(); + } + + void HandleClicked (object sender, EventArgs e) + { + var parser = new CSharpParser (); + var unit = parser.Parse (editor.Text); + + var project = new SimpleProjectContent(); + var parsedFile = new TypeSystemConvertVisitor(project, "dummy.cs").Convert (unit); + project.UpdateProjectContent(null, parsedFile); + + var projects = new List<ITypeResolveContext>(); + projects.Add(project); + projects.AddRange(builtInLibs.Value); + + using (var context = new CompositeTypeResolveContext(projects).Synchronize()) { + var resolver = new CSharpResolver(context); + + IResolveVisitorNavigator navigator = null; +// if (csharpTreeView.SelectedNode != null) { +// navigator = new NodeListResolveVisitorNavigator(new[] { (AstNode)csharpTreeView.SelectedNode.Tag }); +// } + + var visitor = new ResolveVisitor (resolver, parsedFile, navigator); + visitor.Scan(unit); + ShowUnit (unit, visitor); + } + + } + + Lazy<IList<IProjectContent>> builtInLibs = new Lazy<IList<IProjectContent>>( + delegate { + Assembly[] assemblies = new Assembly[] { // Compiler error ? + typeof(object).Assembly, // mscorlib + typeof(Uri).Assembly, // System.dll + typeof(System.Linq.Enumerable).Assembly, + typeof(ICSharpCode.NRefactory.TypeSystem.IProjectContent).Assembly + }; + IProjectContent[] projectContents = new IProjectContent[assemblies.Length]; + Parallel.For( + 0, assemblies.Length, + delegate (int i) { + CecilLoader loader = new CecilLoader(); + projectContents[i] = loader.LoadAssemblyFile(assemblies[i].Location); + }); + return projectContents; + }); + } +} + diff --git a/ICSharpCode.NRefactory.GtkDemo/gtk-gui/ICSharpCode.NRefactory.GtkDemo.MainWindow.cs b/ICSharpCode.NRefactory.GtkDemo/gtk-gui/ICSharpCode.NRefactory.GtkDemo.MainWindow.cs new file mode 100644 index 00000000..96f548aa --- /dev/null +++ b/ICSharpCode.NRefactory.GtkDemo/gtk-gui/ICSharpCode.NRefactory.GtkDemo.MainWindow.cs @@ -0,0 +1,86 @@ + +// This file has been generated by the GUI designer. Do not modify. +namespace ICSharpCode.NRefactory.GtkDemo +{ + public partial class MainWindow + { + private global::Gtk.VBox vbox1; + private global::Gtk.ScrolledWindow scrolledwindow1; + private global::Gtk.HBox hbox1; + private global::Gtk.Button buttonParse; + private global::Gtk.Button buttonGenerate; + private global::Gtk.ScrolledWindow GtkScrolledWindow1; + private global::Gtk.TreeView treeviewNodes; + + protected virtual void Build () + { + global::Stetic.Gui.Initialize (this); + // Widget ICSharpCode.NRefactory.GtkDemo.MainWindow + this.Name = "ICSharpCode.NRefactory.GtkDemo.MainWindow"; + this.Title = global::Mono.Unix.Catalog.GetString ("MainWindow"); + this.WindowPosition = ((global::Gtk.WindowPosition)(4)); + // Container child ICSharpCode.NRefactory.GtkDemo.MainWindow.Gtk.Container+ContainerChild + this.vbox1 = new global::Gtk.VBox (); + this.vbox1.Name = "vbox1"; + this.vbox1.Spacing = 6; + // Container child vbox1.Gtk.Box+BoxChild + this.scrolledwindow1 = new global::Gtk.ScrolledWindow (); + this.scrolledwindow1.CanFocus = true; + this.scrolledwindow1.Name = "scrolledwindow1"; + this.scrolledwindow1.ShadowType = ((global::Gtk.ShadowType)(1)); + this.vbox1.Add (this.scrolledwindow1); + global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.scrolledwindow1])); + w1.Position = 0; + // Container child vbox1.Gtk.Box+BoxChild + this.hbox1 = new global::Gtk.HBox (); + this.hbox1.Name = "hbox1"; + this.hbox1.Spacing = 6; + // Container child hbox1.Gtk.Box+BoxChild + this.buttonParse = new global::Gtk.Button (); + this.buttonParse.CanFocus = true; + this.buttonParse.Name = "buttonParse"; + this.buttonParse.UseUnderline = true; + this.buttonParse.Label = global::Mono.Unix.Catalog.GetString ("Parse"); + this.hbox1.Add (this.buttonParse); + global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.buttonParse])); + w2.Position = 0; + w2.Expand = false; + w2.Fill = false; + // Container child hbox1.Gtk.Box+BoxChild + this.buttonGenerate = new global::Gtk.Button (); + this.buttonGenerate.CanFocus = true; + this.buttonGenerate.Name = "buttonGenerate"; + this.buttonGenerate.UseUnderline = true; + this.buttonGenerate.Label = global::Mono.Unix.Catalog.GetString ("Generate"); + this.hbox1.Add (this.buttonGenerate); + global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.buttonGenerate])); + w3.Position = 1; + w3.Expand = false; + w3.Fill = false; + this.vbox1.Add (this.hbox1); + global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hbox1])); + w4.Position = 1; + w4.Expand = false; + w4.Fill = false; + // Container child vbox1.Gtk.Box+BoxChild + this.GtkScrolledWindow1 = new global::Gtk.ScrolledWindow (); + this.GtkScrolledWindow1.Name = "GtkScrolledWindow1"; + this.GtkScrolledWindow1.ShadowType = ((global::Gtk.ShadowType)(1)); + // Container child GtkScrolledWindow1.Gtk.Container+ContainerChild + this.treeviewNodes = new global::Gtk.TreeView (); + this.treeviewNodes.CanFocus = true; + this.treeviewNodes.Name = "treeviewNodes"; + this.GtkScrolledWindow1.Add (this.treeviewNodes); + this.vbox1.Add (this.GtkScrolledWindow1); + global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.GtkScrolledWindow1])); + w6.Position = 2; + this.Add (this.vbox1); + if ((this.Child != null)) { + this.Child.ShowAll (); + } + this.DefaultWidth = 400; + this.DefaultHeight = 300; + this.Show (); + } + } +} diff --git a/ICSharpCode.NRefactory.GtkDemo/gtk-gui/generated.cs b/ICSharpCode.NRefactory.GtkDemo/gtk-gui/generated.cs new file mode 100644 index 00000000..9636f6fc --- /dev/null +++ b/ICSharpCode.NRefactory.GtkDemo/gtk-gui/generated.cs @@ -0,0 +1,29 @@ + +// This file has been generated by the GUI designer. Do not modify. +namespace Stetic +{ + internal class Gui + { + private static bool initialized; + + internal static void Initialize (Gtk.Widget iconRenderer) + { + if ((Stetic.Gui.initialized == false)) { + Stetic.Gui.initialized = true; + } + } + } + + internal class ActionGroups + { + public static Gtk.ActionGroup GetActionGroup (System.Type type) + { + return Stetic.ActionGroups.GetActionGroup (type.FullName); + } + + public static Gtk.ActionGroup GetActionGroup (string name) + { + return null; + } + } +} diff --git a/ICSharpCode.NRefactory.GtkDemo/gtk-gui/gui.stetic b/ICSharpCode.NRefactory.GtkDemo/gtk-gui/gui.stetic new file mode 100644 index 00000000..ef905a55 --- /dev/null +++ b/ICSharpCode.NRefactory.GtkDemo/gtk-gui/gui.stetic @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="utf-8"?> +<stetic-interface> + <configuration> + <images-root-path>../../ICSharpCode.NRefactory.GtkDemo</images-root-path> + <target-gtk-version>2.12</target-gtk-version> + </configuration> + <import> + <widget-library name="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <widget-library name="../../../StandAloneTextEditor/StandAloneTextEditor/bin/Debug/Mono.TextEditor.dll" /> + <widget-library name="../bin/Debug/ICSharpCode.NRefactory.GtkDemo.exe" internal="true" /> + </import> + <widget class="Gtk.Window" id="ICSharpCode.NRefactory.GtkDemo.MainWindow" design-size="400 300"> + <property name="MemberName" /> + <property name="Title" translatable="yes">MainWindow</property> + <property name="WindowPosition">CenterOnParent</property> + <child> + <widget class="Gtk.VBox" id="vbox1"> + <property name="MemberName" /> + <property name="Spacing">6</property> + <child> + <widget class="Gtk.ScrolledWindow" id="scrolledwindow1"> + <property name="MemberName" /> + <property name="CanFocus">True</property> + <property name="ShadowType">In</property> + <child> + <widget class="Gtk.Viewport" id="GtkViewport"> + <property name="MemberName" /> + <property name="ShadowType">None</property> + <child> + <placeholder /> + </child> + </widget> + </child> + </widget> + <packing> + <property name="Position">0</property> + <property name="AutoSize">True</property> + </packing> + </child> + <child> + <widget class="Gtk.HBox" id="hbox1"> + <property name="MemberName" /> + <property name="Spacing">6</property> + <child> + <widget class="Gtk.Button" id="buttonParse"> + <property name="MemberName" /> + <property name="CanFocus">True</property> + <property name="Type">TextOnly</property> + <property name="Label" translatable="yes">Parse</property> + <property name="UseUnderline">True</property> + </widget> + <packing> + <property name="Position">0</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + <child> + <widget class="Gtk.Button" id="buttonGenerate"> + <property name="MemberName" /> + <property name="CanFocus">True</property> + <property name="Type">TextOnly</property> + <property name="Label" translatable="yes">Generate</property> + <property name="UseUnderline">True</property> + </widget> + <packing> + <property name="Position">1</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + <child> + <placeholder /> + </child> + </widget> + <packing> + <property name="Position">1</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + <child> + <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow1"> + <property name="MemberName" /> + <property name="ShadowType">In</property> + <child> + <widget class="Gtk.TreeView" id="treeviewNodes"> + <property name="MemberName" /> + <property name="CanFocus">True</property> + <property name="ShowScrollbars">True</property> + </widget> + </child> + </widget> + <packing> + <property name="Position">2</property> + <property name="AutoSize">True</property> + </packing> + </child> + </widget> + </child> + </widget> +</stetic-interface>
\ No newline at end of file diff --git a/ICSharpCode.NRefactory.GtkDemo/pixbuf/comment.png b/ICSharpCode.NRefactory.GtkDemo/pixbuf/comment.png Binary files differnew file mode 100644 index 00000000..066f1a05 --- /dev/null +++ b/ICSharpCode.NRefactory.GtkDemo/pixbuf/comment.png diff --git a/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-class-16.png b/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-class-16.png Binary files differnew file mode 100644 index 00000000..4b262cb7 --- /dev/null +++ b/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-class-16.png diff --git a/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-field-16.png b/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-field-16.png Binary files differnew file mode 100644 index 00000000..7e471c99 --- /dev/null +++ b/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-field-16.png diff --git a/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-literal-16.png b/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-literal-16.png Binary files differnew file mode 100644 index 00000000..ebfe0535 --- /dev/null +++ b/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-literal-16.png diff --git a/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-method-16.png b/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-method-16.png Binary files differnew file mode 100644 index 00000000..cd51507e --- /dev/null +++ b/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-method-16.png diff --git a/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-namespace-16.png b/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-namespace-16.png Binary files differnew file mode 100644 index 00000000..2bc1624c --- /dev/null +++ b/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-namespace-16.png |