[gbrainy/gbrainy-17x] Question + solution in the drawing area



commit 3655bf8857d1f3718de18ea5b579cc3313703ad9
Author: Jordi Mas <jmas softcatala org>
Date:   Wed Jan 5 00:27:40 2011 +0100

    Question + solution in the drawing area

 data/themes/themes.xml                             |    2 +-
 src/Clients/Classical/Dialogs/CustomGameDialog.cs  |   58 ++--------
 .../Classical/Dialogs/ui/CustomGameDialog.ui       |   48 ++------
 src/Clients/Classical/Makefile.am                  |    2 +-
 src/Clients/Classical/Widgets/GameDrawingArea.cs   |  125 ++++++++++++++++++++
 src/Clients/Classical/Widgets/SimpleLabel.cs       |  100 ----------------
 src/Clients/Classical/gbrainy.cs                   |   71 ++----------
 src/Clients/Classical/gbrainy.ui                   |   32 +----
 src/Core/Libraries/CairoContext.cs                 |   17 ++-
 src/Core/Main/Game.cs                              |    1 -
 src/Core/Main/Memory.cs                            |    1 -
 src/Core/Views/FinishView.cs                       |    1 -
 src/Core/Views/WelcomeView.cs                      |    1 -
 13 files changed, 171 insertions(+), 288 deletions(-)
---
diff --git a/data/themes/themes.xml b/data/themes/themes.xml
index d53fc06..b59001e 100644
--- a/data/themes/themes.xml
+++ b/data/themes/themes.xml
@@ -8,7 +8,7 @@
     <ink_color></ink_color>
   </Theme>
   <Theme>
-    <name>Blackboard</name>
+    <name>blackboard</name>
     <_localized_name>Blackboard</_localized_name>
     <background_image>blackboard_background.svg</background_image>
     <font_face></font_face>
diff --git a/src/Clients/Classical/Dialogs/CustomGameDialog.cs b/src/Clients/Classical/Dialogs/CustomGameDialog.cs
index 565d65d..b639db9 100644
--- a/src/Clients/Classical/Dialogs/CustomGameDialog.cs
+++ b/src/Clients/Classical/Dialogs/CustomGameDialog.cs
@@ -32,9 +32,7 @@ namespace gbrainy.Clients.Classical.Dialogs
 		static ListStore games_store;
 		[GtkBeans.Builder.Object] Gtk.TreeView treeview;
 		[GtkBeans.Builder.Object] Box preview_vbox;
-		[GtkBeans.Builder.Object] Gtk.Box question_vbox;
-		CairoPreview drawing_area;
-		SimpleLabel question_label;
+		GameDrawingArea drawing_area;
 		GameManager manager;
 		GameManager.GameLocator [] games;
 		bool selection_done;
@@ -53,15 +51,10 @@ namespace gbrainy.Clients.Classical.Dialogs
 			this.manager = manager;
 			games = manager.AvailableGames;
 
-			drawing_area = new CairoPreview ();
+			drawing_area = new GameDrawingArea ();
+			drawing_area.UseSolutionArea = false;
 			preview_vbox.Add (drawing_area);
 			drawing_area.Visible = true;
-
-			question_label = new SimpleLabel ();
-			question_label.HeightMargin = 2;
-			question_label.Visible = true;
-			question_vbox.Add (question_label);
-
 			treeview.HeadersClickable = true;
 
 			// Column: Game Name
@@ -107,9 +100,9 @@ namespace gbrainy.Clients.Classical.Dialogs
 				games_store.SetSortColumnId (COL_TYPE, order);
 			};
 
-			// Column: Enabled
+			// Column: Selected
 			CellRendererToggle toggle_cell = new CellRendererToggle();
-			TreeViewColumn toggle_column = new TreeViewColumn(Catalog.GetString("Enabled"), 
+			TreeViewColumn toggle_column = new TreeViewColumn(Catalog.GetString("Selected"),
 				toggle_cell, "active", COL_ENABLED);
 			toggle_cell.Activatable = true;
 			toggle_cell.Toggled += OnActiveToggled;
@@ -141,8 +134,8 @@ namespace gbrainy.Clients.Classical.Dialogs
 			game = (Game) Activator.CreateInstance (games [0].TypeOf, true);
 			game.Variant = 0;
 			game.Begin ();
-			drawing_area.puzzle = game;
-			question_label.Text = game.Question;
+			drawing_area.Drawable = game;
+			drawing_area.Question = game.Question;
 			treeview.ColumnsAutosize ();
 		}
 
@@ -181,8 +174,8 @@ namespace gbrainy.Clients.Classical.Dialogs
 				game.Begin ();
 			}
 
-			question_label.Text = game.Question;
-			drawing_area.puzzle = game;
+			drawing_area.Drawable = game;
+			drawing_area.Question = game.Question;
 			drawing_area.QueueDraw ();
 		}
 
@@ -233,38 +226,5 @@ namespace gbrainy.Clients.Classical.Dialogs
 			if (selection_done == true)
 				manager.PlayList = play_list.ToArray ();
 		}
-
-		class CairoPreview : DrawingArea 
-		{
-			public Game puzzle;
-
-			protected override bool OnExposeEvent (Gdk.EventExpose args)
-			{
-				if(!IsRealized)
-					return false;
-
-				int w, h, nw, nh;
-				double x = 0, y = 0;
-				Cairo.Context cc = Gdk.CairoHelper.Create (args.Window);
-				CairoContextEx cr = new CairoContextEx (cc.Handle, this);
-				args.Window.GetSize (out w, out h);
-
-				nh = nw = Math.Min (w, h);
-
-				if (nw < w) {
-					x = (w - nw) / 2;
-				}
-
-				if (nh < h) {
-					y = (h - nh) / 2;
-				}
-
-				cr.Translate (x, y);
-				puzzle.DrawPreview (cr, nw, nh, Direction == Gtk.TextDirection.Rtl);
-				((IDisposable)cc).Dispose();
-				((IDisposable)cr).Dispose();
-	   			return base.OnExposeEvent(args);
-			}
-		}	
 	}
 }
diff --git a/src/Clients/Classical/Dialogs/ui/CustomGameDialog.ui b/src/Clients/Classical/Dialogs/ui/CustomGameDialog.ui
index 05b2fbf..36ec7ea 100644
--- a/src/Clients/Classical/Dialogs/ui/CustomGameDialog.ui
+++ b/src/Clients/Classical/Dialogs/ui/CustomGameDialog.ui
@@ -1,33 +1,28 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 2.12 -->
   <!-- interface-naming-policy toplevel-contextual -->
   <object class="GtkDialog" id="customgame">
-    <property name="width_request">750</property>
-    <property name="height_request">480</property>
+    <property name="width_request">840</property>
+    <property name="height_request">550</property>
     <property name="visible">True</property>
     <property name="border_width">7</property>
     <property name="title" translatable="yes">Custom Game</property>
-    <property name="default_width">470</property>
-    <property name="default_height">280</property>
     <property name="type_hint">dialog</property>
-    <property name="has_separator">False</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox2">
         <property name="visible">True</property>
-        <property name="orientation">vertical</property>
         <child>
-          <object class="GtkHBox" id="hbox8">
+          <object class="GtkHBox" id="all_hbox">
             <property name="visible">True</property>
             <property name="border_width">5</property>
             <property name="spacing">12</property>
             <child>
-              <object class="GtkVBox" id="vbox8">
+              <object class="GtkVBox" id="gamelist_container">
                 <property name="visible">True</property>
-                <property name="orientation">vertical</property>
                 <child>
-                  <object class="GtkScrolledWindow" id="scrolledwindow1">
-                    <property name="width_request">400</property>
+                  <object class="GtkScrolledWindow" id="tree_scrolledwindow">
+                    <property name="width_request">360</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hscrollbar_policy">automatic</property>
@@ -45,7 +40,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkHButtonBox" id="hbuttonbox1">
+                  <object class="GtkHButtonBox" id="selection_hbuttonbox">
                     <property name="height_request">35</property>
                     <property name="visible">True</property>
                     <child>
@@ -93,33 +88,10 @@
               </packing>
             </child>
             <child>
-              <object class="GtkVBox" id="puzzle_vbox">
+              <object class="GtkVBox" id="preview_vbox">
                 <property name="visible">True</property>
-                <property name="orientation">vertical</property>
                 <child>
-                  <object class="GtkVBox" id="question_vbox">
-                    <property name="height_request">60</property>
-                    <property name="visible">True</property>
-                    <property name="orientation">vertical</property>
-                    <child>
-                      <placeholder/>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkVBox" id="preview_vbox">
-                    <property name="visible">True</property>
-                    <child>
-                      <placeholder/>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="position">1</property>
-                  </packing>
+                  <placeholder/>
                 </child>
               </object>
               <packing>
diff --git a/src/Clients/Classical/Makefile.am b/src/Clients/Classical/Makefile.am
index cd70a75..0bbfaf6 100644
--- a/src/Clients/Classical/Makefile.am
+++ b/src/Clients/Classical/Makefile.am
@@ -18,7 +18,7 @@ GBRAINY_CSDISTFILES =					\
 	$(srcdir)/Dialogs/PlayerHistoryDialog.cs	\
 	$(srcdir)/Dialogs/PreferencesDialog.cs		\
 	$(srcdir)/Dialogs/PdfExportDialog.cs		\
-	$(srcdir)/Widgets/SimpleLabel.cs		\
+	$(srcdir)/Widgets/GameDrawingArea.cs		\
 	$(srcdir)/Widgets/BrowseFile.cs
 
 
diff --git a/src/Clients/Classical/Widgets/GameDrawingArea.cs b/src/Clients/Classical/Widgets/GameDrawingArea.cs
new file mode 100644
index 0000000..e846577
--- /dev/null
+++ b/src/Clients/Classical/Widgets/GameDrawingArea.cs
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2011 Jordi Mas i Hernàndez <jmas softcatala org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+using System;
+using Gtk;
+using Cairo;
+
+using gbrainy.Core.Main;
+//using gbrainy.Core.Platform;
+
+namespace gbrainy.Clients.Classical.Widgets
+{
+	// This client code because every client can decide how to composite its game view
+	// For example, asking the question in another area, or using the same space for
+	// question or answer, etc.
+	public class GameDrawingArea : DrawingArea
+	{
+		public IDrawable Drawable { get; set; }
+		public string Question { get; set; }
+		public string Solution { get; set; }
+		public int DrawingSquare { get; private set; }
+		public int OffsetX { get; private set; }
+		public int OffsetY { get; private set; }
+		public bool UseSolutionArea { get; set; }
+
+		public GameDrawingArea ()
+		{
+			UseSolutionArea = true;
+		}
+
+		protected override bool OnExposeEvent (Gdk.EventExpose args)
+		{
+			if (!IsRealized)
+				return false;
+
+			int w, h, total_w, total_h;
+			const int question_high = 55;
+			const int solution_high = 55;
+			const int total_margin = 0; // Margin applied as in-box for themes
+
+			Cairo.Context cc = Gdk.CairoHelper.Create (args.Window);
+			CairoContextEx cr = new CairoContextEx (cc.Handle, this);
+
+			args.Window.GetSize (out total_w, out total_h);
+
+			h = total_h - question_high - total_margin * 2;
+			if (UseSolutionArea)
+				h -= solution_high;
+
+			w = total_w - total_margin * 2;
+
+			// We want a square drawing area for the puzzles then the figures are shown as designed.
+			// For example, squares are squares. This also makes sure that proportions are kept when resizing
+			DrawingSquare = Math.Min (w, h);
+
+			if (DrawingSquare < w)
+				OffsetX = (w - DrawingSquare) / 2;
+			else
+				OffsetX = 0;
+
+			if (DrawingSquare < h)
+				OffsetY = (h - DrawingSquare) / 2;
+			else
+				OffsetY = 0;
+
+			// Draw a background taking all the area
+			cr.Save ();
+			{
+				const double text_margin = 0.015;
+				double scaled_margin;
+				double max_width;
+
+				cr.Scale (total_w, total_h);
+				cr.DrawBackground ();
+				cr.FontLineSpace = 0.004;
+				cr.SetPangoFontSize (0.018);
+
+				scaled_margin = (double) total_margin / (double) total_w;
+				max_width = 1 - (scaled_margin * 2) - (text_margin * 2);
+				cr.UseMarkup = true;
+
+				if (String.IsNullOrEmpty (Question) == false)
+				{
+					// Question drawing
+					cr.DrawStringWithWrapping (scaled_margin + text_margin, scaled_margin + text_margin, Question, max_width);
+				}
+
+				if (UseSolutionArea && String.IsNullOrEmpty (Solution) == false)
+				{
+					// Solution drawing
+					cr.DrawStringWithWrapping (scaled_margin + text_margin, 1 - 0.12 - scaled_margin - text_margin, Solution, max_width);
+				}
+				cr.Stroke ();
+			}
+
+			cr.FontLineSpace = 0.018;
+			cr.Restore ();
+
+			// Draw the game area
+			cr.Translate (OffsetX, OffsetY + question_high + total_margin);
+			cr.SetPangoNormalFontSize ();
+			Drawable.Draw (cr, DrawingSquare, DrawingSquare, Direction == Gtk.TextDirection.Rtl);
+
+			((IDisposable)cc).Dispose();
+			((IDisposable)cr).Dispose();
+			return true;
+		}
+	}
+}
diff --git a/src/Clients/Classical/gbrainy.cs b/src/Clients/Classical/gbrainy.cs
index f6e6a1a..bfcac6b 100755
--- a/src/Clients/Classical/gbrainy.cs
+++ b/src/Clients/Classical/gbrainy.cs
@@ -50,8 +50,6 @@ namespace gbrainy.Clients.Classical
 		[GtkBeans.Builder.Object] Box drawing_vbox;
 		[GtkBeans.Builder.Object] Gtk.HBox main_hbox;
 		[GtkBeans.Builder.Object] Gtk.VBox framework_vbox;
-		[GtkBeans.Builder.Object] Gtk.VBox question_vbox;
-		[GtkBeans.Builder.Object] Gtk.VBox solution_vbox;
 		[GtkBeans.Builder.Object] Gtk.Entry answer_entry;
 		[GtkBeans.Builder.Object] Gtk.Button answer_button;
 		[GtkBeans.Builder.Object] Gtk.Button tip_button;
@@ -73,16 +71,11 @@ namespace gbrainy.Clients.Classical
 
 		Gtk.Toolbar toolbar;
 
-		DrawingArea drawing_area;
+		GameDrawingArea drawing_area;
 		GameSession session;
 		ToolButton all_tbbutton, logic_tbbutton, calculation_tbbutton, memory_tbbutton, verbal_tbbutton, pause_tbbutton, finish_tbbutton;
 		bool low_res;
 		bool full_screen;
-		SimpleLabel question_label;
-		SimpleLabel solution_label;
-		bool margins = false;
-		double offset_x, offset_y;
-		int drawing_square;
 		GameSession.Types initial_session;
 		bool init_completed = false;
 
@@ -182,8 +175,8 @@ namespace gbrainy.Clients.Classical
 			BuildToolBar ();
 			AttachToolBar ();
 
-			drawing_area = new DrawingArea ();
-			drawing_area.ExposeEvent += OnDrawingAreaExposeEvent;
+			drawing_area = new GameDrawingArea ();
+			drawing_area.Drawable = session;
 			GameSensitiveUI ();
 
 			// For low resolutions, hide the toolbar and made the drawing area smaller
@@ -194,14 +187,6 @@ namespace gbrainy.Clients.Classical
 				}
 			}
 
-			question_label = new SimpleLabel ();
-			question_label.HeightMargin = 2;
-			question_vbox.Add (question_label);
-
-			solution_label = new SimpleLabel ();
-			solution_label.HeightMargin = 2;
-			solution_vbox.Add (solution_label);
-
 			EventBox eb = new EventBox (); // Provides a window for drawing area windowless widget
 
 			eb.Events = Gdk.EventMask.PointerMotionMask;
@@ -276,38 +261,6 @@ namespace gbrainy.Clients.Classical
 			drawing_area.QueueDraw ();
 		}
 
-		void OnDrawingAreaExposeEvent (object o, ExposeEventArgs ar)
-		{
-			Gdk.EventExpose args = ar.Event;
-
-			int w, h;
-			args.Window.GetSize (out w, out h);
-
-			Cairo.Context cc = Gdk.CairoHelper.Create (args.Window);
-			CairoContextEx cr = new CairoContextEx (cc.Handle, drawing_area);
-
-			// We want a square drawing area for the puzzles then the figures are shown as designed.
-			// For example, squares are squares. This also makes sure that proportions are kept when resizing
-			drawing_square = Math.Min (w, h);
-
-			if (drawing_square < w)
-				offset_x = (w - drawing_square) / 2;
-
-			if (drawing_square < h)
-				offset_y = (h - drawing_square) / 2;
-
-			if (margins)
-				SetMargin ((int) offset_x);
-			else
-				SetMargin (2);
-
-			cr.Translate (offset_x, offset_y);
-			session.Draw (cr, drawing_square, drawing_square, drawing_area.Direction == Gtk.TextDirection.Rtl);
-
-			((IDisposable)cc).Dispose();
-			((IDisposable)cr).Dispose();
-		}
-
 		void OnMouseMotionEvent (object o, MotionNotifyEventArgs ev_args)
 		{
 			SendMouseEvent (ev_args.Event.X, ev_args.Event.Y, MouseEventType.Move);
@@ -324,9 +277,10 @@ namespace gbrainy.Clients.Classical
 		void SendMouseEvent (double ev_x, double ev_y, MouseEventType type)
 		{
 			double x, y;
+			int drawing_square = drawing_area.DrawingSquare;
 
-			x = ev_x - offset_x;
-			y = ev_y - offset_y;
+			x = ev_x - drawing_area.OffsetX;
+			y = ev_y - drawing_area.OffsetY;
 
 			if (x < 0 || y < 0 || x > drawing_square || y > drawing_square)
 				return;
@@ -391,7 +345,7 @@ namespace gbrainy.Clients.Classical
 
 		public void UpdateQuestion (string question)
 		{
-			question_label.Text = question;
+			drawing_area.Question = question;
 		}
 
 		public void QueueDraw ()
@@ -399,15 +353,10 @@ namespace gbrainy.Clients.Classical
 			drawing_area.QueueDraw ();
 		}
 
-		public void SetMargin (int margin)
-		{
-			question_label.WidthMargin = margin;
-			solution_label.WidthMargin = margin;
-		}
-
 		void UpdateSolution (string solution)
 		{
-			solution_label.Text = solution;
+			drawing_area.Solution = solution;
+			QueueDraw ();
 		}
 
 		void BuildToolBar ()
@@ -791,11 +740,9 @@ namespace gbrainy.Clients.Classical
 		void OnFullscreen (object sender, EventArgs args)
 		{
 			if (full_screen == false) {
-				margins = true;
 				app_window.Fullscreen ();
 			}
 			else {
-				margins = false;
 				app_window.Unfullscreen ();
 			}
 
diff --git a/src/Clients/Classical/gbrainy.ui b/src/Clients/Classical/gbrainy.ui
index cfb6fbd..b76bf26 100644
--- a/src/Clients/Classical/gbrainy.ui
+++ b/src/Clients/Classical/gbrainy.ui
@@ -311,22 +311,11 @@
               <object class="GtkVBox" id="main_vbox">
                 <property name="visible">True</property>
                 <child>
-                  <object class="GtkVBox" id="question_vbox">
-                    <property name="height_request">55</property>
-                    <property name="visible">True</property>
-                    <property name="spacing">1</property>
-                    <child>
-                      <placeholder/>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">2</property>
-                  </packing>
+                  <placeholder/>
                 </child>
                 <child>
                   <object class="GtkVBox" id="drawing_vbox">
-                    <property name="height_request">400</property>
+                    <property name="height_request">510</property>
                     <property name="visible">True</property>
                     <child>
                       <placeholder/>
@@ -337,22 +326,11 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkVBox" id="solution_vbox">
-                    <property name="height_request">55</property>
-                    <property name="visible">True</property>
-                    <property name="spacing">1</property>
-                    <child>
-                      <placeholder/>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">4</property>
-                  </packing>
+                  <placeholder/>
                 </child>
                 <child>
-                  <object class="GtkVBox" id="vbox5">
-                    <property name="width_request">500</property>
+                  <object class="GtkVBox" id="controls_vbox">
+                    <property name="width_request">610</property>
                     <property name="visible">True</property>
                     <child>
                       <object class="GtkTable" id="table4">
diff --git a/src/Core/Libraries/CairoContext.cs b/src/Core/Libraries/CairoContext.cs
index 33ae637..b351c88 100644
--- a/src/Core/Libraries/CairoContext.cs
+++ b/src/Core/Libraries/CairoContext.cs
@@ -33,9 +33,8 @@ namespace gbrainy.Core.Libraries
 	{
 		Pango.Layout layout;
 		double font_size;
-
+		const double def_linespace = 0.018;
 		const double width_margin = 0.04;
-		const double line_spacing = 0.018;
 
 		public CairoContext (IntPtr state, Gtk.Widget widget) : base (state)
 		{
@@ -44,6 +43,7 @@ namespace gbrainy.Core.Libraries
 			// We do not honor DPI settings or font sizes (just font name)
 			// User should resize the window
 			layout.FontDescription = widget.PangoContext.FontDescription.Copy ();
+			FontLineSpace = def_linespace;
 		}
 
 		// Used by GeneratePDF
@@ -57,15 +57,20 @@ namespace gbrainy.Core.Libraries
 				Pango.CairoHelper.ContextSetResolution (c, dpis);
 				c.Dispose ();
 			}
+			FontLineSpace = def_linespace;
 		}
 
 		public string FontFace {
 			set {
-				if (String.IsNullOrEmpty (value) == false)
-					layout.FontDescription = Pango.FontDescription.FromString (value);
+				if (String.IsNullOrEmpty (value) == true)
+					return;
+
+				layout.FontDescription = Pango.FontDescription.FromString (value);
 			}
 		}
 
+		public double FontLineSpace { get; set; }
+
 		// True if we want Pango to process XML entites and formatting attributes
 		public bool UseMarkup  { get; set; }
 
@@ -205,7 +210,7 @@ namespace gbrainy.Core.Libraries
 
 			spacing = layout.Spacing;
 			layout.Width = (int) (max_width * old.Xx * Pango.Scale.PangoScale);
-			layout.Spacing = (int) (line_spacing * (old.Yy * Pango.Scale.PangoScale));
+			layout.Spacing = (int) (FontLineSpace * (old.Yy * Pango.Scale.PangoScale));
 
 			layout.SingleParagraphMode = false;
 			SetText (str);
@@ -229,7 +234,7 @@ namespace gbrainy.Core.Libraries
 
 			spacing = layout.Spacing;
 			layout.Width = (int) (max_width * old.Xx * Pango.Scale.PangoScale);
-			layout.Spacing = (int) (line_spacing * (old.Xx * Pango.Scale.PangoScale));
+			layout.Spacing = (int) (FontLineSpace * (old.Xx * Pango.Scale.PangoScale));
 
 			layout.SingleParagraphMode = !wrapping;
 			SetText (str);
diff --git a/src/Core/Main/Game.cs b/src/Core/Main/Game.cs
index d8ae719..dfed7d2 100644
--- a/src/Core/Main/Game.cs
+++ b/src/Core/Main/Game.cs
@@ -342,7 +342,6 @@ namespace gbrainy.Core.Main
 		protected void InitDraw (CairoContextEx gr, int width, int height, bool rtl)
 		{
 			gr.Scale (width, height);
-			gr.DrawBackground ();
 			gr.Color = default_color;
 			gr.LineWidth = LineWidth;
 			// Not all Cairo surfaces have a default font size (like PDF)
diff --git a/src/Core/Main/Memory.cs b/src/Core/Main/Memory.cs
index 3afb5c4..56d1e9d 100644
--- a/src/Core/Main/Memory.cs
+++ b/src/Core/Main/Memory.cs
@@ -186,7 +186,6 @@ namespace gbrainy.Core.Main
 		public override void DrawPreview (CairoContextEx gr, int width, int height, bool rtl)
 		{
 			gr.Scale (width, height);
-			gr.DrawBackground ();
 			gr.Color = new Cairo.Color (0, 0, 0);
 			gr.LineWidth = LineWidth;
 			DrawObjectToMemorize (gr, width, height, rtl);
diff --git a/src/Core/Views/FinishView.cs b/src/Core/Views/FinishView.cs
index 563da37..c41c66f 100644
--- a/src/Core/Views/FinishView.cs
+++ b/src/Core/Views/FinishView.cs
@@ -134,7 +134,6 @@ namespace gbrainy.Core.Views
 			double width, height;
 
 			gr.Scale (area_width, area_height);
-			gr.DrawBackground ();
 			gr.Color = new Cairo.Color (0, 0, 0, 1);
 
 			gr.MoveTo (x, y);
diff --git a/src/Core/Views/WelcomeView.cs b/src/Core/Views/WelcomeView.cs
index 1603542..a06a139 100644
--- a/src/Core/Views/WelcomeView.cs
+++ b/src/Core/Views/WelcomeView.cs
@@ -131,7 +131,6 @@ namespace gbrainy.Core.Views
 			double y = 0.03;
 
 			gr.Scale (area_width, area_height);
-			gr.DrawBackground ();
 			gr.LineWidth = 0.005;
 
 			gr.Color = new Cairo.Color (0, 0, 0, 1);



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