[Monodevelop-patches-list] r492 - trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/Wizard

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Thu Jan 15 17:34:51 EST 2004


Author: jluke
Date: 2004-01-15 17:34:51 -0500 (Thu, 15 Jan 2004)
New Revision: 492

Modified:
   trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/Wizard/StatusPanel.cs
Log:
only make the Gdk.GC and Pango.Layout on Realized,
not everytime its exposed


Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/Wizard/StatusPanel.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/Wizard/StatusPanel.cs	2004-01-15 21:53:56 UTC (rev 491)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/Wizard/StatusPanel.cs	2004-01-15 22:34:51 UTC (rev 492)
@@ -15,16 +15,20 @@
 
 using ICSharpCode.Core.Services;
 using ICSharpCode.Core.AddIns;
-
 using ICSharpCode.Core.Properties;
 using ICSharpCode.Core.AddIns.Codons;
 
+using Gtk;
+using Gdk;
+
 namespace ICSharpCode.SharpDevelop.Gui.Dialogs
 {
 	public class StatusPanel : Gtk.DrawingArea
 	{
 		WizardDialog wizard;
-		Gdk.Pixbuf bitmap = null;
+		Pixbuf bitmap = null;
+		Gdk.GC gc;
+		Pango.Layout ly;
 		
 		Pango.FontDescription smallFont;
 		Pango.FontDescription normalFont;
@@ -46,14 +50,19 @@
 
 			AddEvents ((int) (Gdk.EventMask.ExposureMask));
 			ExposeEvent += new GtkSharp.ExposeEventHandler (OnPaint);
+			Realized += new EventHandler (OnRealized);
 		}
+
+		protected void OnRealized (object o, EventArgs args)
+		{
+			gc = new Gdk.GC (GdkWindow);
+			ly = new Pango.Layout(PangoContext);
+		}
 		
 		protected void OnPaint(object o, GtkSharp.ExposeEventArgs e)
 		{
 			GdkWindow.BeginPaintRect (e.Event.area);
-			using (Gdk.GC gc = new Gdk.GC (GdkWindow)) {
 				GdkWindow.DrawPixbuf (gc, bitmap, 0, 0, 0, 0, -1, -1, Gdk.RgbDither.None, 0, 0);
-				Pango.Layout ly = new Pango.Layout(PangoContext);
 				smallFont.Weight = Pango.Weight.Normal;
 				ly.FontDescription = smallFont;
 				ly.SetText (resourceService.GetString("SharpDevelop.Gui.Dialogs.WizardDialog.StepsLabel"));
@@ -75,7 +84,6 @@
 					GdkWindow.DrawLayout(gc, 10, 40 + curNumber * smallFontHeight, ly);
 					++curNumber;
 				}
-			}
 			GdkWindow.EndPaint ();
 		}
 		




More information about the Monodevelop-patches-list mailing list