From: Gustavo Martin Morcuende Date: Sat, 10 Jan 2015 19:27:56 +0000 (+0100) Subject: MonoDevelop Addins: hello world X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=a4fcf3fee7f61c8c4b0a88f4f8761fe20fe93a8e;p=CSharpForFun%2F.git MonoDevelop Addins: hello world --- diff --git a/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld.sln b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld.sln new file mode 100644 index 0000000..964b69a --- /dev/null +++ b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld.sln @@ -0,0 +1,21 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.HelloWorld", "MonoDevelop.HelloWorld\MonoDevelop.HelloWorld.csproj", "{809465B8-CF04-41ED-B1C5-2C8EF6C5E73B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {809465B8-CF04-41ED-B1C5-2C8EF6C5E73B}.Debug|x86.ActiveCfg = Debug|x86 + {809465B8-CF04-41ED-B1C5-2C8EF6C5E73B}.Debug|x86.Build.0 = Debug|x86 + {809465B8-CF04-41ED-B1C5-2C8EF6C5E73B}.Release|x86.ActiveCfg = Release|x86 + {809465B8-CF04-41ED-B1C5-2C8EF6C5E73B}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + description = Just a simple Addin for MonoDevelopment IDE + version = 1.0 + EndGlobalSection +EndGlobal diff --git a/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/Commands.cs b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/Commands.cs new file mode 100644 index 0000000..9df0db6 --- /dev/null +++ b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/Commands.cs @@ -0,0 +1,28 @@ +using System; +using System.Linq; +using MonoDevelop.Components.Commands; +using MonoDevelop.Ide; +using MonoDevelop.Projects; + + +namespace MonoDevelop.HelloWorld +{ + public enum Commands + { + ShowFiles, + } + + public class ShowFilesCommandHandler : CommandHandler + { + protected override void Run() + { + var proj = IdeApp.Workspace.GetAllProjects ().FirstOrDefault (); + if (proj != null) + { + var dlg = new ShowFilesDialog (proj); + MessageService.ShowCustomDialog (dlg); + } + } + } +} + diff --git a/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld.addin.xml b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld.addin.xml new file mode 100644 index 0000000..f01bbae --- /dev/null +++ b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld.addin.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + diff --git a/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld.csproj b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld.csproj new file mode 100644 index 0000000..c87221f --- /dev/null +++ b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld.csproj @@ -0,0 +1,77 @@ + + + + Debug + x86 + {809465B8-CF04-41ED-B1C5-2C8EF6C5E73B} + Library + MonoDevelop.HelloWorld + MonoDevelop.HelloWorld + v4.5 + Just a simple Addin for MonoDevelopment IDE + 1.0 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + x86 + + + true + bin\Release + prompt + 4 + false + x86 + + + + + False + + + False + + + False + + + False + + + False + + + False + + + + + monodevelop + + + monodevelop + + + + + gui.stetic + + + + + + + + + + + + + \ No newline at end of file diff --git a/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/Properties/AddinInfo.cs b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/Properties/AddinInfo.cs new file mode 100644 index 0000000..14c7ea1 --- /dev/null +++ b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/Properties/AddinInfo.cs @@ -0,0 +1,17 @@ +using Mono.Addins; + +[assembly:Addin ( + "MonoDevelop.HelloWorld", + Namespace = "MonoDevelop.HelloWorld", + Version = "1.0", + Category = "HelloWorld Category" +)] + +[assembly:AddinName ("HelloWorld")] +[assembly:AddinCategory ("HelloWorld Category")] +[assembly:AddinDescription ("Just a simple Addin for MonoDevelopment IDE")] +[assembly:AddinAuthor ("Gustavo Martin Morcuende")] + +[assembly:AddinDependency ("::MonoDevelop.Core", MonoDevelop.BuildInfo.Version)] +[assembly:AddinDependency ("::MonoDevelop.Ide", MonoDevelop.BuildInfo.Version)] + diff --git a/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/Properties/AssemblyInfo.cs b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8095fba --- /dev/null +++ b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/Properties/AssemblyInfo.cs @@ -0,0 +1,27 @@ +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 ("MonoDevelop.HelloWorld")] +[assembly: AssemblyDescription ("Just a simple Addin for MonoDevelopment IDE")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("gumartinm.name")] +[assembly: AssemblyProduct ("Hello World MonoDevelopment Addin")] +[assembly: AssemblyCopyright ("gumartinm.name")] +[assembly: AssemblyTrademark ("Apache License, Version 2")] +[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/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/ShowFilesDialog.cs b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/ShowFilesDialog.cs new file mode 100644 index 0000000..eff622e --- /dev/null +++ b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/ShowFilesDialog.cs @@ -0,0 +1,41 @@ +using System; +using MonoDevelop.Projects; +using System.Text; + +namespace MonoDevelop.HelloWorld +{ + public partial class ShowFilesDialog : Gtk.Dialog + { + readonly Project project; + + public ShowFilesDialog (Project project) + { + this.project = project; + this.Build (); + + var fileNames = new StringBuilder (); + fileNames.Append ("Project name: " + project.Name); + fileNames.Append (Environment.NewLine); + foreach (var file in project.Files) + { + fileNames.Append(file.Name); + fileNames.Append (Environment.NewLine); + } + this.ShowFilesTextView.Buffer.Text = fileNames.ToString (); + } + + protected void OnButtonShowFilesClickEvent (object sender, EventArgs e) + { + var fileNames = new StringBuilder (); + fileNames.Append ("Project name: " + project.Name); + fileNames.Append (Environment.NewLine); + foreach (var file in project.Files) + { + fileNames.Append(file.Name); + fileNames.Append (Environment.NewLine); + } + this.ShowFilesTextView.Buffer.Text = fileNames.ToString (); + } + } +} + diff --git a/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/gtk-gui/MonoDevelop.HelloWorld.ShowFilesDialog.cs b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/gtk-gui/MonoDevelop.HelloWorld.ShowFilesDialog.cs new file mode 100644 index 0000000..97a0bbb --- /dev/null +++ b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/gtk-gui/MonoDevelop.HelloWorld.ShowFilesDialog.cs @@ -0,0 +1,116 @@ + +// This file has been generated by the GUI designer. Do not modify. +namespace MonoDevelop.HelloWorld +{ + public partial class ShowFilesDialog + { + private global::Gtk.VBox vbox2; + + private global::Gtk.ScrolledWindow GtkScrolledWindow; + + private global::Gtk.TextView textview1; + + private global::Gtk.ScrolledWindow GtkScrolledWindow1; + + private global::Gtk.TextView ShowFilesTextView; + + private global::Gtk.Button ShowFilesButton; + + private global::Gtk.Button buttonCancel; + + private global::Gtk.Button buttonOk; + + protected virtual void Build () + { + global::Stetic.Gui.Initialize (this); + // Widget MonoDevelop.HelloWorld.ShowFilesDialog + this.Name = "MonoDevelop.HelloWorld.ShowFilesDialog"; + this.WindowPosition = ((global::Gtk.WindowPosition)(4)); + // Internal child MonoDevelop.HelloWorld.ShowFilesDialog.VBox + global::Gtk.VBox w1 = this.VBox; + w1.Name = "dialog1_VBox"; + w1.BorderWidth = ((uint)(2)); + // Container child dialog1_VBox.Gtk.Box+BoxChild + this.vbox2 = new global::Gtk.VBox (); + this.vbox2.Name = "vbox2"; + this.vbox2.Spacing = 6; + // Container child vbox2.Gtk.Box+BoxChild + this.GtkScrolledWindow = new global::Gtk.ScrolledWindow (); + this.GtkScrolledWindow.Name = "GtkScrolledWindow"; + this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1)); + // Container child GtkScrolledWindow.Gtk.Container+ContainerChild + this.textview1 = new global::Gtk.TextView (); + this.textview1.Buffer.Text = "Hello World Addin"; + this.textview1.CanFocus = true; + this.textview1.Name = "textview1"; + this.GtkScrolledWindow.Add (this.textview1); + this.vbox2.Add (this.GtkScrolledWindow); + global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.GtkScrolledWindow])); + w3.Position = 0; + // Container child vbox2.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.ShowFilesTextView = new global::Gtk.TextView (); + this.ShowFilesTextView.CanFocus = true; + this.ShowFilesTextView.Name = "ShowFilesTextView"; + this.GtkScrolledWindow1.Add (this.ShowFilesTextView); + this.vbox2.Add (this.GtkScrolledWindow1); + global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.GtkScrolledWindow1])); + w5.Position = 1; + w1.Add (this.vbox2); + global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(w1 [this.vbox2])); + w6.Position = 0; + // Internal child MonoDevelop.HelloWorld.ShowFilesDialog.ActionArea + global::Gtk.HButtonBox w7 = this.ActionArea; + w7.Name = "dialog1_ActionArea"; + w7.Spacing = 10; + w7.BorderWidth = ((uint)(5)); + w7.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); + // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild + this.ShowFilesButton = new global::Gtk.Button (); + this.ShowFilesButton.CanFocus = true; + this.ShowFilesButton.Name = "ShowFilesButton"; + this.ShowFilesButton.UseUnderline = true; + this.ShowFilesButton.Label = global::Mono.Unix.Catalog.GetString ("ShowFiles"); + this.AddActionWidget (this.ShowFilesButton, 0); + global::Gtk.ButtonBox.ButtonBoxChild w8 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w7 [this.ShowFilesButton])); + w8.Expand = false; + w8.Fill = false; + // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild + this.buttonCancel = new global::Gtk.Button (); + this.buttonCancel.CanDefault = true; + this.buttonCancel.CanFocus = true; + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.UseStock = true; + this.buttonCancel.UseUnderline = true; + this.buttonCancel.Label = "gtk-cancel"; + this.AddActionWidget (this.buttonCancel, -6); + global::Gtk.ButtonBox.ButtonBoxChild w9 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w7 [this.buttonCancel])); + w9.Position = 1; + w9.Expand = false; + w9.Fill = false; + // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild + this.buttonOk = new global::Gtk.Button (); + this.buttonOk.CanDefault = true; + this.buttonOk.CanFocus = true; + this.buttonOk.Name = "buttonOk"; + this.buttonOk.UseStock = true; + this.buttonOk.UseUnderline = true; + this.buttonOk.Label = "gtk-ok"; + this.AddActionWidget (this.buttonOk, -5); + global::Gtk.ButtonBox.ButtonBoxChild w10 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w7 [this.buttonOk])); + w10.Position = 2; + w10.Expand = false; + w10.Fill = false; + if ((this.Child != null)) { + this.Child.ShowAll (); + } + this.DefaultWidth = 400; + this.DefaultHeight = 300; + this.Show (); + this.ShowFilesButton.Clicked += new global::System.EventHandler (this.OnButtonShowFilesClickEvent); + } + } +} diff --git a/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/gtk-gui/generated.cs b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/gtk-gui/generated.cs new file mode 100644 index 0000000..9ef3363 --- /dev/null +++ b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/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/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/gtk-gui/gui.stetic b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/gtk-gui/gui.stetic new file mode 100644 index 0000000..39656b9 --- /dev/null +++ b/MonoDevelop/addins/MonoDevelop.HelloWorld/MonoDevelop.HelloWorld/gtk-gui/gui.stetic @@ -0,0 +1,127 @@ + + + + .. + + + + + + + + + CenterOnParent + 3 + False + + + + 2 + + + + 6 + + + + In + + + + True + True + Hello World Addin + + + + + 0 + True + + + + + + In + + + + True + True + + + + + + 1 + True + + + + + 0 + True + + + + + + + + 10 + 5 + 3 + End + + + + True + TextOnly + ShowFiles + True + 0 + + + + False + False + + + + + + True + True + True + StockItem + gtk-cancel + -6 + gtk-cancel + + + 1 + False + False + + + + + + True + True + True + StockItem + gtk-ok + -5 + gtk-ok + + + 2 + False + False + + + + + + \ No newline at end of file