[Monodevelop-patches-list] r1148 - in trunk/MonoDevelop: build/data/templates/project/CSharp src/Main/Base/Gui/Pads/HelpBrowser src/Main/Base/Internal/Templates/ProjectTemplates
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Thu Mar 11 16:50:12 EST 2004
Author: tberman
Date: 2004-03-11 16:50:12 -0500 (Thu, 11 Mar 2004)
New Revision: 1148
Modified:
trunk/MonoDevelop/build/data/templates/project/CSharp/GladeSharpProject.xpt
trunk/MonoDevelop/src/Main/Base/Gui/Pads/HelpBrowser/HelpViewer.cs
trunk/MonoDevelop/src/Main/Base/Internal/Templates/ProjectTemplates/ProjectDescriptor.cs
Log:
this makes erik's project work by default.
now we can use embed resources in project templates
Modified: trunk/MonoDevelop/build/data/templates/project/CSharp/GladeSharpProject.xpt
===================================================================
--- trunk/MonoDevelop/build/data/templates/project/CSharp/GladeSharpProject.xpt 2004-03-11 21:19:19 UTC (rev 1147)
+++ trunk/MonoDevelop/build/data/templates/project/CSharp/GladeSharpProject.xpt 2004-03-11 21:50:12 UTC (rev 1148)
@@ -35,7 +35,42 @@
<Reference type="Gac" refto="System.Drawing.dll" />
<Reference type="Gac" refto="glade-sharp.dll" />
</References>
-
+
+ <Resources>
+<File name="file.glade"><![CDATA[<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+<requires lib="gnome"/>
+
+<widget class="GtkWindow" id="window1">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Glade Window</property>
+ <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="modal">False</property>
+ <property name="default_width">256</property>
+ <property name="default_height">256</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <signal name="delete_event" handler="OnWindowDeleteEvent" last_modification_time="${Date} ${Time}"/>
+
+ <child>
+ <widget class="GtkButton" id="button1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Hello !</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="OnButtonClickedEvent" last_modification_time="${Date} ${Time}"/>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
+
+]]></File>
+ </Resources>
<Files>
<File name="Main.cs">
<![CDATA[// project created on ${Date} at ${Time}
@@ -87,41 +122,7 @@
]]>
</File>
-<File name="file.glade"><![CDATA[<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-<requires lib="gnome"/>
-
-<widget class="GtkWindow" id="window1">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Glade Window</property>
- <property name="window_position">GTK_WIN_POS_CENTER</property>
- <property name="modal">False</property>
- <property name="default_width">256</property>
- <property name="default_height">256</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <signal name="delete_event" handler="OnWindowDeleteEvent" last_modification_time="${Date} ${Time}"/>
-
- <child>
- <widget class="GtkButton" id="button1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Hello !</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <signal name="clicked" handler="OnButtonClickedEvent" last_modification_time="${Date} ${Time}"/>
- </widget>
- </child>
-</widget>
-
-</glade-interface>
-
-]]></File>
-
- <File name="AssemblyInfo.cs"><![CDATA[using System.Reflection;
+<File name="AssemblyInfo.cs"><![CDATA[using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Pads/HelpBrowser/HelpViewer.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Pads/HelpBrowser/HelpViewer.cs 2004-03-11 21:19:19 UTC (rev 1147)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Pads/HelpBrowser/HelpViewer.cs 2004-03-11 21:50:12 UTC (rev 1148)
@@ -26,9 +26,48 @@
public HelpViewer ()
{
+ //html_viewer.LinkClicked += new LinkClickedHandler (LinkClicked);
+ //html_viewer.UrlRequested += new UrlRequestedHandler (UrlRequested);
scroller.Add (html_viewer);
}
+ /*void UrlRequested (object sender, UrlRequestedArgs args)
+ {
+ Console.WriteLine ("Image requested: " + args.Url);
+ Stream s = help_tree.GetImage (args.Url);
+
+ if (s == null)
+ s = GetResourceImage ("monodoc.png");
+ byte [] buffer = new byte [8192];
+ int n;
+
+ while ((n = s.Read (buffer, 0, 8192)) != 0) {
+ args.Handle.Write (buffer, n);
+ }
+ args.Handle.Close (HTMLStreamStatus.Ok);
+ }
+
+ void LinkClicked (object o, LinkClickedArgs args)
+ {
+ LoadUrl (args.Url);
+ }
+
+ public void LoadUrl (string url)
+ {
+ if (url.StartsWith("#"))
+ {
+ html_viewer.JumpToAnchor(url.Substring(1));
+ return;
+ }
+
+ Node node;
+
+ string res = help_tree.RenderUrl (url, out node);
+ if (res != null) {
+ Render (res, node, url);
+ }
+ }*/
+
public void Render (string text, Node matched_node, string url)
{
CurrentUrl = url;
Modified: trunk/MonoDevelop/src/Main/Base/Internal/Templates/ProjectTemplates/ProjectDescriptor.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Internal/Templates/ProjectTemplates/ProjectDescriptor.cs 2004-03-11 21:19:19 UTC (rev 1147)
+++ trunk/MonoDevelop/src/Main/Base/Internal/Templates/ProjectTemplates/ProjectDescriptor.cs 2004-03-11 21:50:12 UTC (rev 1148)
@@ -30,6 +30,7 @@
ArrayList files = new ArrayList(); // contains FileTemplate classes
ArrayList references = new ArrayList();
+ ArrayList resources = new ArrayList ();
XmlElement projectOptions = null;
@@ -52,6 +53,12 @@
}
}
+ public ArrayList Resources {
+ get {
+ return resources;
+ }
+ }
+
public XmlElement ProjectOptions {
get {
return projectOptions;
@@ -93,7 +100,34 @@
foreach (ProjectReference projectReference in references) {
project.ProjectReferences.Add(projectReference);
}
-
+
+ foreach (FileDescriptionTemplate file in resources) {
+ string fileName = fileUtilityService.GetDirectoryNameWithSeparator(projectCreateInformation.ProjectBasePath) + stringParserService.Parse(file.Name, new string[,] { {"ProjectName", projectCreateInformation.ProjectName} });
+
+ ProjectFile resource = new ProjectFile (fileName);
+ resource.BuildAction = BuildAction.EmbedAsResource;
+ project.ProjectFiles.Add(resource);
+
+ if (File.Exists(fileName)) {
+ IMessageService messageService =(IMessageService)ServiceManager.Services.GetService(typeof(IMessageService));
+ if (!messageService.AskQuestion("File " + fileName + " already exists, do you want to overwrite\nthe existing file ?", "File already exists")) {
+ continue;
+ }
+ }
+
+ try {
+ if (!Directory.Exists(Path.GetDirectoryName(fileName))) {
+ Directory.CreateDirectory(Path.GetDirectoryName(fileName));
+ }
+ StreamWriter sr = File.CreateText(fileName);
+ sr.Write(stringParserService.Parse(file.Content, new string[,] { {"ProjectName", projectCreateInformation.ProjectName}, {"FileName", fileName}}));
+ sr.Close();
+ } catch (Exception ex) {
+ IMessageService messageService =(IMessageService)ServiceManager.Services.GetService(typeof(IMessageService));
+ messageService.ShowError(ex, "File " + fileName + " could not be written.");
+ }
+ }
+
// Add Files
foreach (FileDescriptionTemplate file in files) {
string fileName = fileUtilityService.GetDirectoryNameWithSeparator(projectCreateInformation.ProjectBasePath) + stringParserService.Parse(file.Name, new string[,] { {"ProjectName", projectCreateInformation.ProjectName} });
@@ -151,6 +185,13 @@
}
}
}
+ if (element["Resources"] != null) {
+ foreach (XmlNode node in element["Resources"].ChildNodes) {
+ if (node != null && node.Name == "File") {
+ projectDescriptor.resources.Add (new FileDescriptionTemplate (node.Attributes["name"].InnerText, node.InnerText));
+ }
+ }
+ }
if (element["References"] != null) {
foreach (XmlNode node in element["References"].ChildNodes) {
if (node != null && node.Name == "Reference") {
More information about the Monodevelop-patches-list
mailing list