f-spot r3968 - trunk/src



Author: sdelcroix
Date: Wed May 21 14:14:14 2008
New Revision: 3968
URL: http://svn.gnome.org/viewvc/f-spot?rev=3968&view=rev

Log:
removing the extern MCairo hack

Modified:
   trunk/src/ControlOverlay.cs
   trunk/src/Loupe.cs
   trunk/src/Makefile.am
   trunk/src/PrintOperation.cs

Modified: trunk/src/ControlOverlay.cs
==============================================================================
--- trunk/src/ControlOverlay.cs	(original)
+++ trunk/src/ControlOverlay.cs	Wed May 21 14:14:14 2008
@@ -8,11 +8,7 @@
  *
  * See COPYING for license information.
  */
-#if CAIRO_1_2_5
-	extern alias MCairo;
-#else
-	using Cairo;
-#endif		
+using Cairo;
 
 using System;
 using Gtk;
@@ -134,29 +130,16 @@
 			Visibility = VisibilityType.None;
 			return false;
 		}
-#if CAIRO_1_2_5		
-		protected virtual void ShapeSurface (MCairo::Cairo.Context cr, MCairo::Cairo.Color color)
-		{
-			cr.Operator = MCairo::Cairo.Operator.Source;
-			MCairo::Cairo.Pattern p = new MCairo::Cairo.SolidPattern (new MCairo::Cairo.Color (0, 0, 0, 0));
-#else
 		protected virtual void ShapeSurface (Context cr, Cairo.Color color)
 		{
 			cr.Operator = Operator.Source;
 			Cairo.Pattern p = new Cairo.SolidPattern (new Cairo.Color (0, 0, 0, 0));
-#endif						
 			cr.Source = p;
 			p.Destroy ();
 			cr.Paint ();
-#if CAIRO_1_2_5			
-			cr.Operator = MCairo::Cairo.Operator.Over;
-
-			MCairo::Cairo.Pattern r = new MCairo::Cairo.SolidPattern (color);
-#else
 			cr.Operator = Operator.Over;
 
 			Cairo.Pattern r = new SolidPattern (color);
-#endif						
 			cr.Source = r;
 			r.Destroy ();
 			cr.MoveTo (round, 0);
@@ -201,16 +184,13 @@
 							    Allocation.Height, 1);
 
 #if CAIRO_1_2_5			
-			MCairo::Cairo.Context cr = Gdk.CairoHelper.Create (bitmap);
-			ShapeCombineMask (bitmap, 0, 0);
-			ShapeSurface (cr, new MCairo::Cairo.Color (1, 1, 1));
+			Context cr = Gdk.CairoHelper.Create (bitmap);
 #else			
 			Context cr = CairoUtils.CreateContext (bitmap);
-			ShapeCombineMask (bitmap, 0, 0);
-			ShapeSurface (cr, new Cairo.Color (1, 1, 1));
-
 #endif			
 			ShapeCombineMask (bitmap, 0, 0);
+			ShapeSurface (cr, new Color (1, 1, 1));
+			ShapeCombineMask (bitmap, 0, 0);
 			((IDisposable)cr).Dispose ();
 			bitmap.Dispose ();
 
@@ -220,21 +200,15 @@
 		{
 			Gdk.Color c = Style.Background (State);
 #if CAIRO_1_2_5			
-			MCairo::Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow);
-
-			ShapeSurface (cr, new MCairo::Cairo.Color (c.Red / (double) ushort.MaxValue,
-							   c.Blue / (double) ushort.MaxValue, 
-							   c.Green / (double) ushort.MaxValue,
-							   0.8));
+			Context cr = Gdk.CairoHelper.Create (GdkWindow);
 #else
-			Cairo.Context cr = CairoUtils.CreateContext (GdkWindow);
+			Context cr = CairoUtils.CreateContext (GdkWindow);
+#endif						
 
 			ShapeSurface (cr, new Cairo.Color (c.Red / (double) ushort.MaxValue,
 							   c.Blue / (double) ushort.MaxValue, 
 							   c.Green / (double) ushort.MaxValue,
 							   0.8));
-			
-#endif						
 
 			((IDisposable)cr).Dispose ();
 			return base.OnExposeEvent (args);

Modified: trunk/src/Loupe.cs
==============================================================================
--- trunk/src/Loupe.cs	(original)
+++ trunk/src/Loupe.cs	Wed May 21 14:14:14 2008
@@ -1,8 +1,4 @@
-#if CAIRO_1_2_5
-extern alias MCairo;
-#else
 using Cairo;
-#endif
 
 using Gtk;
 using Gdk;
@@ -309,7 +305,7 @@
 							    Allocation.Height, 1);
 			
 #if CAIRO_1_2_5
-			MCairo::Cairo.Context g = CairoHelper.Create (bitmap);
+			Context g = CairoHelper.Create (bitmap);
 #else			
 			Context g = CairoUtils.CreateContext (bitmap);
 #endif			
@@ -321,7 +317,7 @@
 				ShapeCombineMask (bitmap, 0, 0);
 			else {
 #if CAIRO_1_2_5			 
-				MCairo::Cairo.Context rgba = CairoHelper.Create (GdkWindow);
+				Cairo.Context rgba = CairoHelper.Create (GdkWindow);
 #else				
 				Context rgba = CairoUtils.CreateContext (GdkWindow);
 #endif				
@@ -356,23 +352,14 @@
 			hotspot.Y = (int) Math.Ceiling (Center.Y + y_proj);
 		}
 	
-#if CAIRO_1_2_5		
-		private void DrawShape (MCairo::Cairo.Context g, int width, int height)
-#else
 		private void DrawShape (Context g, int width, int height)
-#endif				
 		{
 			int inner_x = radius + border + inner;
 			int cx = Center.X;
 			int cy = Center.Y;
 		
-#if CAIRO_1_2_5			
-			g.Operator = MCairo::Cairo.Operator.Source;
-			g.Source = new MCairo::Cairo.SolidPattern (new MCairo::Cairo.Color (0,0,0,0));
-#else
 			g.Operator = Operator.Source;
 			g.Source = new SolidPattern (new Cairo.Color (0,0,0,0));
-#endif						
 			g.Rectangle (0, 0, width, height);
 			g.Paint ();
 
@@ -380,25 +367,15 @@
 			g.Translate (cx, cy);
 			g.Rotate (angle);
 
-#if CAIRO_1_2_5			
-			g.Source = new MCairo::Cairo.SolidPattern (new MCairo::Cairo.Color (0.2, 0.2, 0.2, .6));
-			g.Operator = MCairo::Cairo.Operator.Over;
-#else
 			g.Source = new SolidPattern (new Cairo.Color (0.2, 0.2, 0.2, .6));
 			g.Operator = Operator.Over;
-#endif						
 			g.Rectangle (0, - (border + inner), inner_x, 2 * (border + inner));
 			g.Arc (inner_x, 0, inner + border, 0, 2 * Math.PI);
 			g.Arc (0, 0, radius + border, 0, 2 * Math.PI);
 			g.Fill ();
 
-#if CAIRO_1_2_5
-			g.Source = new MCairo::Cairo.SolidPattern (new MCairo::Cairo.Color (0, 0, 0, 1.0));
-			g.Operator = MCairo::Cairo.Operator.DestOut;
-#else
 			g.Source = new SolidPattern (new Cairo.Color (0, 0, 0, 1.0));
 			g.Operator = Operator.DestOut;
-#endif						
 			g.Arc (inner_x, 0, inner, 0, 2 * Math.PI);
 #if true			
 			g.Fill ();
@@ -414,19 +391,14 @@
 			g.Fill ();
 			rg.Destroy ();
 #endif
-#if CAIRO_1_2_5			
-			g.Operator = MCairo::Cairo.Operator.Over;
-			g.Matrix = new MCairo::Cairo.Matrix ();
-#else			
 			g.Operator = Operator.Over;
 			g.Matrix = new Matrix ();
-#endif			
 			g.Translate (cx, cy);
 			if (source != null)
 #if CAIRO_1_2_5			 
-				CairoHelper.SetSourcePixbuf (g, source, -source.Width / 2, -source.Height / 2);
+			CairoHelper.SetSourcePixbuf (g, source, -source.Width / 2, -source.Height / 2);
 #else
-				SetSourcePixbuf (g, source, -source.Width / 2, -source.Height / 2);
+			SetSourcePixbuf (g, source, -source.Width / 2, -source.Height / 2);
 #endif								
 
 			g.Arc (0, 0, radius, 0, 2 * Math.PI);
@@ -442,11 +414,7 @@
 				g.Arc (0, 0, radius, angle, angle + Math.PI);
 				g.ClosePath ();
 				g.FillPreserve ();
-#if CAIRO_1_2_5				
-				g.Source = new MCairo::Cairo.SolidPattern (new MCairo::Cairo.Color (1.0, 1.0, 1.0, 1.0));
-#else
 				g.Source = new SolidPattern (new Cairo.Color (1.0, 1.0, 1.0, 1.0));
-#endif								
 				g.Stroke ();
 			}
 		}
@@ -468,7 +436,7 @@
 		protected override bool OnExposeEvent (Gdk.EventExpose args)
 		{
 #if CAIRO_1_2_5		 
-			MCairo::Cairo.Context g = CairoHelper.Create (GdkWindow);
+			Context g = CairoHelper.Create (GdkWindow);
 #else
 			Context g = CairoUtils.CreateContext (GdkWindow);			
 #endif						
@@ -483,11 +451,7 @@
                 [DllImport ("libcairo-2.dll")]
                 static extern void cairo_user_to_device (IntPtr cr, ref double x, ref double y);
 
-#if CAIRO_1_2_5
-		static void UserToDevice (MCairo::Cairo.Context ctx, ref double x, ref double y)
-#else		
 		static void UserToDevice (Context ctx, ref double x, ref double y)
-#endif		
 		{
 			cairo_user_to_device (ctx.Handle, ref x, ref y);
 		}

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Wed May 21 14:14:14 2008
@@ -269,7 +269,7 @@
 	-pkg:gtk-sharp-2.0			\
 	-pkg:gnome-sharp-2.0			\
 	-r:Mono.Posix				\
-	-r:MCairo=Mono.Cairo			\
+	-r:Mono.Cairo				\
 	$(GCONF_PKG)				\
 	$(LINK_DBUS)
 
@@ -299,7 +299,6 @@
 	-r:Mono.Data.SqliteClient		\
 	-r:Mono.Posix				\
 	-r:Mono.Security			\
-	-r:MCairo=Mono.Cairo			\
 	-r:Mono.Cairo				\
 	-r:ICSharpCode.SharpZipLib		\
 	-r:FSpot.Core.dll			\

Modified: trunk/src/PrintOperation.cs
==============================================================================
--- trunk/src/PrintOperation.cs	(original)
+++ trunk/src/PrintOperation.cs	Wed May 21 14:14:14 2008
@@ -8,7 +8,7 @@
  */
 
 #if GTK_2_10
-extern alias MCairo;
+using Cairo;
 using System;
 using System.Runtime.InteropServices;
 
@@ -60,9 +60,9 @@
 		protected void OnCustomWidgetChanged (Gtk.Widget widget)
 		{
 			OnCustomWidgetApply (widget);
-			using (MCairo::Cairo.ImageSurface surface = new MCairo::Cairo.ImageSurface (MCairo::Cairo.Format.ARGB32, 360, 254)) {
-				using (MCairo::Cairo.Context gr = new MCairo::Cairo.Context (surface)) {
-					gr.Color = new MCairo::Cairo.Color (1, 1, 1);
+			using (ImageSurface surface = new ImageSurface (Format.ARGB32, 360, 254)) {
+				using (Context gr = new Context (surface)) {
+					gr.Color = new Color (1, 1, 1);
 					gr.Rectangle (0, 0, 360, 254);
 					gr.Fill ();
 					using (Gdk.Pixbuf pixbuf = Gdk.Pixbuf.LoadFromResource ("flower.png")) {
@@ -76,7 +76,7 @@
 		protected override void OnDrawPage (Gtk.PrintContext context, int page_nr)
 		{
 			base.OnDrawPage (context, page_nr);
-			MCairo::Cairo.Context cr = context.CairoContext;	
+			Context cr = context.CairoContext;	
 
 			int ppx, ppy;
 			switch (photos_per_page) {
@@ -131,10 +131,10 @@
 			base.OnRequestPageSetup (context, page_nr, setup);
 		}
 
-		private void DrawCropMarks (MCairo::Cairo.Context cr, double x, double y, double length)
+		private void DrawCropMarks (Context cr, double x, double y, double length)
 		{
 			cr.Save ();
-			cr.Color = new MCairo::Cairo.Color (0, 0, 0);
+			cr.Color = new Color (0, 0, 0);
 			cr.MoveTo (x - length/2, y);
 			cr.LineTo (x + length/2, y);
 			cr.MoveTo (x, y - length/2);
@@ -150,7 +150,7 @@
 			if (comment == null || comment == String.Empty)
 				return;
 
-			MCairo::Cairo.Context cr = context.CairoContext;
+			Context cr = context.CairoContext;
 			cr.Save ();
 			Pango.Layout layout = context.CreatePangoLayout ();
 			Pango.FontDescription desc = Pango.FontDescription.FromString ("sans 14");
@@ -171,7 +171,7 @@
 		}
 	
 
-		private void DrawImage (MCairo::Cairo.Context cr, Gdk.Pixbuf pixbuf, double x, double y, double w, double h)
+		private void DrawImage (Context cr, Gdk.Pixbuf pixbuf, double x, double y, double w, double h)
 		{
 			double scalex, scaley;
 			switch (fit) {
@@ -205,7 +205,7 @@
 
 			if (white_borders) {
 				cr.Rectangle (0, 0 ,rectw, recth);
-				cr.Color = new MCairo::Cairo.Color (0, 0, 0);
+				cr.Color = new Color (0, 0, 0);
 				cr.LineWidth = 1 / scalex;
 				cr.Stroke ();
 			}
@@ -215,7 +215,7 @@
 		[DllImport("libfspot")]
 		static extern IntPtr f_pixbuf_from_cairo_surface (IntPtr handle);
 		
-		private static Gdk.Pixbuf CreatePixbuf (MCairo::Cairo.Surface s)
+		private static Gdk.Pixbuf CreatePixbuf (Surface s)
 		{
 			IntPtr result = f_pixbuf_from_cairo_surface (s.Handle);
 			return (Gdk.Pixbuf) GLib.Object.GetObject (result, true);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]