[Gtk-sharp-list] GnomeCanvas questions

Owen Fraser-Green owen@discobabe.net
Wed, 28 Apr 2004 16:56:54 +0200


--=-liEQygy6nuv21EE0Bve8
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Hi,

There's a public constructor missing from CanvasGroup. The attached
patch adds one so you can do, for example:

CanvasGroup group = new CanvasGroup(canvas.Root());

OK to commit?

Cheers,
Owen

On Mon, 2004-04-26 at 19:41, Jorge García wrote:
> Hi,
> 
> does someone know how is the best method for declare a CanvasGroup?
> 
> With this sentence I get the following error:
> CanvasGroup group = new CanvasGroup(canvas.Root(),CanvasGroup.GType);		
> 
> ui.cs(196) error CS1501: No overload for method `Gnome.CanvasGroup'
> takes `2' arguments
> 
> But if I make like samples/Fifteen.cs example and I define a subclass of
> CanvasGroup then it works:
> 
> MyGroup group = new MyGroup(canvas.Root());
> 
> ...
> 
> public class MyGroup: Gnome.CanvasGroup{
> 		public MyGroup (CanvasGroup group)
> 			: base (group, CanvasGroup.GType)
> 			{
> 				
> 			}
> }
> 
> 
> 
> Another question that I have is how to write lines fast. I use this
> function (ported from George Lebl's DeveloperWorks article):
> 
> void DrawALine(CanvasGroup group,double x1, double y1, double x2, double
> y2, string color){
> 
> 	double[] coords = {x1, y1, x2, y2};
> 	/* allocate a new points array */
> 	CanvasPoints points = new CanvasPoints(coords);
> 
> 	/* draw the line */
> 	CanvasLine item = new CanvasLine(group);
> 	item.Points = points;
> 	item.FillColor = color;
> 	item.WidthUnits = 1.0;
> 	item.CanvasEvent += new Gnome.CanvasEventHandler (Item_Event);
> }
> 
> The problem with this function is that each time that it calls to
> "new CanvasPoints(coords)" the coordinates are showed by the console,
> and its makes veeeery slow my program (that uses thousands of lines)
> 
> 
> Thank you very much in advance,
> 
> Jorge
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

--=-liEQygy6nuv21EE0Bve8
Content-Disposition: attachment; filename=CanvasGroup.patch
Content-Type: text/x-diff; name=CanvasGroup.patch; charset=utf-8
Content-Transfer-Encoding: 7bit

Index: CanvasGroup.custom
===================================================================
RCS file: /cvs/public/gtk-sharp/gnome/CanvasGroup.custom,v
retrieving revision 1.3
diff -u -r1.3 CanvasGroup.custom
--- CanvasGroup.custom	15 Dec 2003 16:59:24 -0000	1.3
+++ CanvasGroup.custom	28 Apr 2004 14:13:14 -0000
@@ -7,8 +7,13 @@
 //
 // This code is inserted after the automatically generated code.
 //
+
+public CanvasGroup (Gnome.CanvasGroup group) : base (group, GType)
+{
+}
 	
 protected CanvasGroup (Gnome.CanvasGroup group, GLib.GType type) : base (group, type)
 {
 }
+
 

--=-liEQygy6nuv21EE0Bve8--