2003-05-07 Mike Kestner <mkestner@speakeasy.net>
* generator/ClassBase.cs (GenSignals): remove doc comment param * generator/GenBase.cs (CreateWriter): alter generated file comment * generator/InterfaceGen.cs (CreateWriter): remove doc comments * generator/ObjectGen.cs (Generate): use new GenSignals sig * generator/Signal.cs : make signal marshalers internal and remove doc comments. * generator/SignalHandler.cs : make signal marshalers internal and remove doc comments. * gnome/CanvasProxy.cs : use Gnome.voidObjectSignal since the gtk one is inaccessible now. svn path=/trunk/gtk-sharp/; revision=14385
This commit is contained in:
parent
9f3f9f149a
commit
9e325bd283
8 changed files with 42 additions and 49 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
2003-05-07 Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
|
||||||
|
* generator/ClassBase.cs (GenSignals): remove doc comment param
|
||||||
|
* generator/GenBase.cs (CreateWriter): alter generated file comment
|
||||||
|
* generator/InterfaceGen.cs (CreateWriter): remove doc comments
|
||||||
|
* generator/ObjectGen.cs (Generate): use new GenSignals sig
|
||||||
|
* generator/Signal.cs : make signal marshalers internal and remove
|
||||||
|
doc comments.
|
||||||
|
* generator/SignalHandler.cs : make signal marshalers internal and remove
|
||||||
|
doc comments.
|
||||||
|
* gnome/CanvasProxy.cs : use Gnome.voidObjectSignal since the gtk one is
|
||||||
|
inaccessible now.
|
||||||
|
|
||||||
2003-05-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
|
2003-05-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
|
||||||
|
|
||||||
* rsvg/Makefile.in:
|
* rsvg/Makefile.in:
|
||||||
|
|
|
@ -155,14 +155,14 @@ namespace GtkSharp.Generation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GenSignals (StreamWriter sw, ClassBase implementor, bool gen_docs)
|
public void GenSignals (StreamWriter sw, ClassBase implementor)
|
||||||
{
|
{
|
||||||
if (sigs == null)
|
if (sigs == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (Signal sig in sigs.Values) {
|
foreach (Signal sig in sigs.Values) {
|
||||||
if (sig.Validate ())
|
if (sig.Validate ())
|
||||||
sig.Generate (sw, implementor, gen_docs);
|
sig.Generate (sw, implementor);
|
||||||
else
|
else
|
||||||
Console.WriteLine(" in Object " + Name);
|
Console.WriteLine(" in Object " + Name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,8 +77,8 @@ namespace GtkSharp.Generation {
|
||||||
FileStream stream = new FileStream (filename, FileMode.Create, FileAccess.Write);
|
FileStream stream = new FileStream (filename, FileMode.Create, FileAccess.Write);
|
||||||
StreamWriter sw = new StreamWriter (stream);
|
StreamWriter sw = new StreamWriter (stream);
|
||||||
|
|
||||||
sw.WriteLine ("// Generated File. Do not modify.");
|
sw.WriteLine ("// This file was generated by the Gtk# code generator.");
|
||||||
sw.WriteLine ("// <c> 2001-2002 Mike Kestner");
|
sw.WriteLine ("// Any changes made will be lost if regenerated.");
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
sw.WriteLine ("namespace " + NS + " {");
|
sw.WriteLine ("namespace " + NS + " {");
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
|
|
|
@ -24,10 +24,6 @@ namespace GtkSharp.Generation {
|
||||||
sw.WriteLine ("\tusing System;");
|
sw.WriteLine ("\tusing System;");
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
|
|
||||||
sw.WriteLine("\t\t/// <summary> " + Name + " Interface</summary>");
|
|
||||||
sw.WriteLine("\t\t/// <remarks>");
|
|
||||||
sw.WriteLine("\t\t/// </remarks>");
|
|
||||||
|
|
||||||
sw.WriteLine ("#region Autogenerated code");
|
sw.WriteLine ("#region Autogenerated code");
|
||||||
sw.WriteLine ("\tpublic interface " + Name + " : GLib.IWrapper {");
|
sw.WriteLine ("\tpublic interface " + Name + " : GLib.IWrapper {");
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
|
|
|
@ -99,7 +99,7 @@ namespace GtkSharp.Generation {
|
||||||
if (has_sigs && Elem.HasAttribute("parent"))
|
if (has_sigs && Elem.HasAttribute("parent"))
|
||||||
{
|
{
|
||||||
sw.WriteLine("\t\tprivate Hashtable Signals = new Hashtable();");
|
sw.WriteLine("\t\tprivate Hashtable Signals = new Hashtable();");
|
||||||
GenSignals (sw, null, true);
|
GenSignals (sw, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
GenMethods (sw, null, null, true);
|
GenMethods (sw, null, null, true);
|
||||||
|
@ -122,7 +122,7 @@ namespace GtkSharp.Generation {
|
||||||
continue;
|
continue;
|
||||||
ClassBase igen = SymbolTable.GetClassGen (iface);
|
ClassBase igen = SymbolTable.GetClassGen (iface);
|
||||||
igen.GenMethods (sw, collisions, this, false);
|
igen.GenMethods (sw, collisions, this, false);
|
||||||
igen.GenSignals (sw, this, false);
|
igen.GenSignals (sw, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
public bool Validate ()
|
public bool Validate ()
|
||||||
{
|
{
|
||||||
marsh = SignalHandler.GetName(elem, container_type.NS, container_type.DoGenerate);
|
marsh = SignalHandler.GetName(elem, container_type.NS, false);
|
||||||
if ((Name == "") || (marsh == "")) {
|
if ((Name == "") || (marsh == "")) {
|
||||||
Console.Write ("bad signal " + Name);
|
Console.Write ("bad signal " + Name);
|
||||||
Statistics.ThrottledCount++;
|
Statistics.ThrottledCount++;
|
||||||
|
@ -59,22 +59,12 @@ namespace GtkSharp.Generation {
|
||||||
if (handler != "EventHandler")
|
if (handler != "EventHandler")
|
||||||
handler = container_type.NS + "Sharp." + handler;
|
handler = container_type.NS + "Sharp." + handler;
|
||||||
|
|
||||||
GenComments (sw);
|
|
||||||
if (elem.HasAttribute("new_flag") || (container_type != null && container_type.GetSignalRecursively (Name) != null))
|
if (elem.HasAttribute("new_flag") || (container_type != null && container_type.GetSignalRecursively (Name) != null))
|
||||||
sw.Write("new ");
|
sw.Write("new ");
|
||||||
|
|
||||||
sw.WriteLine ("\t\tevent " + handler + " " + Name + ";");
|
sw.WriteLine ("\t\tevent " + handler + " " + Name + ";");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenComments (StreamWriter sw)
|
|
||||||
{
|
|
||||||
sw.WriteLine();
|
|
||||||
sw.WriteLine("\t\t/// <summary> " + Name + " Event </summary>");
|
|
||||||
sw.WriteLine("\t\t/// <remarks>");
|
|
||||||
// FIXME: Generate some signal docs
|
|
||||||
sw.WriteLine("\t\t/// </remarks>");
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetHandlerName (out string argsname)
|
private string GetHandlerName (out string argsname)
|
||||||
{
|
{
|
||||||
if (marsh.EndsWith (".voidObjectSignal")) {
|
if (marsh.EndsWith (".voidObjectSignal")) {
|
||||||
|
@ -92,37 +82,28 @@ namespace GtkSharp.Generation {
|
||||||
if (handler == "EventHandler" || !container_type.DoGenerate)
|
if (handler == "EventHandler" || !container_type.DoGenerate)
|
||||||
return handler;
|
return handler;
|
||||||
|
|
||||||
|
string ns = container_type.NS;
|
||||||
char sep = Path.DirectorySeparatorChar;
|
char sep = Path.DirectorySeparatorChar;
|
||||||
string dir = ".." + sep + container_type.NS.ToLower() + sep + "generated";
|
string dir = ".." + sep + ns.ToLower() + sep + "generated";
|
||||||
|
|
||||||
if (!Directory.Exists (dir))
|
if (!Directory.Exists (dir))
|
||||||
Directory.CreateDirectory (dir);
|
Directory.CreateDirectory (dir);
|
||||||
|
|
||||||
string filename = dir + sep + container_type.NS + "Sharp." + handler + ".cs";
|
string filename = dir + sep + ns + "Sharp." + handler + ".cs";
|
||||||
|
|
||||||
FileStream stream = new FileStream (filename, FileMode.Create, FileAccess.Write);
|
FileStream stream = new FileStream (filename, FileMode.Create, FileAccess.Write);
|
||||||
StreamWriter sw = new StreamWriter (stream);
|
StreamWriter sw = new StreamWriter (stream);
|
||||||
|
|
||||||
sw.WriteLine ("// Generated File. Do not modify.");
|
sw.WriteLine ("// This file was generated by the Gtk# Code generator.");
|
||||||
sw.WriteLine ("// <c> 2001-2002 Mike Kestner");
|
sw.WriteLine ("// Any changes made will be lost if regenerated.");
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
sw.WriteLine ("namespace " + container_type.NS + "Sharp {");
|
sw.WriteLine ("namespace " + ns + "Sharp {");
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
sw.WriteLine ("\tusing System;");
|
sw.WriteLine ("\tusing System;");
|
||||||
|
|
||||||
sw.WriteLine ();
|
|
||||||
sw.WriteLine ("\t/// <summary> " + handler + " Delegate </summary>");
|
|
||||||
sw.WriteLine ("\t/// <remarks>");
|
|
||||||
sw.WriteLine ("\t///\tDelegate signature for " + Name + " Event handlers");
|
|
||||||
sw.WriteLine ("\t/// </remarks>");
|
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
sw.WriteLine ("\tpublic delegate void " + handler + "(object o, " + argsname + " args);");
|
sw.WriteLine ("\tpublic delegate void " + handler + "(object o, " + argsname + " args);");
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
sw.WriteLine ("\t/// <summary> " + argsname + " Class </summary>");
|
|
||||||
sw.WriteLine ("\t/// <remarks>");
|
|
||||||
sw.WriteLine ("\t///\tArguments for " + Name + " Event handlers");
|
|
||||||
sw.WriteLine ("\t/// </remarks>");
|
|
||||||
sw.WriteLine ();
|
|
||||||
sw.WriteLine ("\tpublic class " + argsname + " : GtkSharp.SignalArgs {");
|
sw.WriteLine ("\tpublic class " + argsname + " : GtkSharp.SignalArgs {");
|
||||||
if (parms != null) {
|
if (parms != null) {
|
||||||
for (int i = 1; i < parms.Count; i++) {
|
for (int i = 1; i < parms.Count; i++) {
|
||||||
|
@ -137,17 +118,20 @@ namespace GtkSharp.Generation {
|
||||||
sw.WriteLine ("\t}");
|
sw.WriteLine ("\t}");
|
||||||
sw.WriteLine ("}");
|
sw.WriteLine ("}");
|
||||||
sw.Close ();
|
sw.Close ();
|
||||||
argsname = container_type.NS + "Sharp." + argsname;
|
argsname = ns + "Sharp." + argsname;
|
||||||
return container_type.NS + "Sharp." + handler;
|
return ns + "Sharp." + handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Generate (StreamWriter sw, ClassBase implementor, bool gen_docs)
|
public void Generate (StreamWriter sw, ClassBase implementor)
|
||||||
{
|
{
|
||||||
string cname = "\"" + elem.GetAttribute("cname") + "\"";
|
string cname = "\"" + elem.GetAttribute("cname") + "\"";
|
||||||
string qual_marsh = marsh;
|
string ns;
|
||||||
|
if (implementor == null)
|
||||||
|
ns = container_type.NS;
|
||||||
|
else
|
||||||
|
ns = implementor.NS;
|
||||||
|
|
||||||
if (gen_docs)
|
string qual_marsh = SignalHandler.GetName(elem, ns, container_type.DoGenerate);
|
||||||
GenComments (sw);
|
|
||||||
|
|
||||||
string argsname;
|
string argsname;
|
||||||
string handler = GenHandler (out argsname);
|
string handler = GenHandler (out argsname);
|
||||||
|
|
|
@ -102,10 +102,10 @@ namespace GtkSharp.Generation {
|
||||||
sw.WriteLine("\tusing System.Runtime.InteropServices;");
|
sw.WriteLine("\tusing System.Runtime.InteropServices;");
|
||||||
sw.WriteLine("\tusing GtkSharp;");
|
sw.WriteLine("\tusing GtkSharp;");
|
||||||
sw.WriteLine();
|
sw.WriteLine();
|
||||||
sw.Write("\tpublic delegate " + p_ret + " ");
|
sw.Write("\tinternal delegate " + p_ret + " ");
|
||||||
sw.WriteLine(dname + "(" + pinv + ", int key);");
|
sw.WriteLine(dname + "(" + pinv + ", int key);");
|
||||||
sw.WriteLine();
|
sw.WriteLine();
|
||||||
sw.WriteLine("\tpublic class " + sname + " : SignalCallback {");
|
sw.WriteLine("\tinternal class " + sname + " : SignalCallback {");
|
||||||
sw.WriteLine();
|
sw.WriteLine();
|
||||||
sw.WriteLine("\t\tprivate static " + dname + " _Delegate;");
|
sw.WriteLine("\t\tprivate static " + dname + " _Delegate;");
|
||||||
sw.WriteLine();
|
sw.WriteLine();
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace Gnome {
|
||||||
public event EventHandler Realize {
|
public event EventHandler Realize {
|
||||||
add {
|
add {
|
||||||
if (EventList["realize"] == null)
|
if (EventList["realize"] == null)
|
||||||
Signals["realize"] = new GtkSharp.voidObjectSignal(this, Handle, "realize", value, System.Type.GetType("EventArgs"));
|
Signals["realize"] = new GnomeSharp.voidObjectSignal(this, Handle, "realize", value, System.Type.GetType("EventArgs"));
|
||||||
EventList.AddHandler("realize", value);
|
EventList.AddHandler("realize", value);
|
||||||
}
|
}
|
||||||
remove {
|
remove {
|
||||||
|
@ -54,7 +54,7 @@ namespace Gnome {
|
||||||
public event EventHandler Unrealize {
|
public event EventHandler Unrealize {
|
||||||
add {
|
add {
|
||||||
if (EventList["unrealize"] == null)
|
if (EventList["unrealize"] == null)
|
||||||
Signals["unrealize"] = new GtkSharp.voidObjectSignal(this, Handle, "unrealize", value, System.Type.GetType("EventArgs"));
|
Signals["unrealize"] = new GnomeSharp.voidObjectSignal(this, Handle, "unrealize", value, System.Type.GetType("EventArgs"));
|
||||||
EventList.AddHandler("unrealize", value);
|
EventList.AddHandler("unrealize", value);
|
||||||
}
|
}
|
||||||
remove {
|
remove {
|
||||||
|
@ -67,7 +67,7 @@ namespace Gnome {
|
||||||
public event EventHandler Map {
|
public event EventHandler Map {
|
||||||
add {
|
add {
|
||||||
if (EventList["map"] == null)
|
if (EventList["map"] == null)
|
||||||
Signals["map"] = new GtkSharp.voidObjectSignal(this, Handle, "map", value, System.Type.GetType("EventArgs"));
|
Signals["map"] = new GnomeSharp.voidObjectSignal(this, Handle, "map", value, System.Type.GetType("EventArgs"));
|
||||||
EventList.AddHandler("map", value);
|
EventList.AddHandler("map", value);
|
||||||
}
|
}
|
||||||
remove {
|
remove {
|
||||||
|
@ -80,7 +80,7 @@ namespace Gnome {
|
||||||
public event EventHandler Unmap {
|
public event EventHandler Unmap {
|
||||||
add {
|
add {
|
||||||
if (EventList["unmap"] == null)
|
if (EventList["unmap"] == null)
|
||||||
Signals["unmap"] = new GtkSharp.voidObjectSignal(this, Handle, "unmap", value, System.Type.GetType("EventArgs"));
|
Signals["unmap"] = new GnomeSharp.voidObjectSignal(this, Handle, "unmap", value, System.Type.GetType("EventArgs"));
|
||||||
EventList.AddHandler("unmap", value);
|
EventList.AddHandler("unmap", value);
|
||||||
}
|
}
|
||||||
remove {
|
remove {
|
||||||
|
|
Loading…
Reference in a new issue