[gbrainy] New verbal analogies. Fixes in analogies backends and adds suport in player history



commit fb2fc6af206dd9a97d72d694c4627eeee60a8928
Author: Jordi Mas <jmas softcatala org>
Date:   Fri Sep 18 21:07:50 2009 +0200

    New verbal analogies. Fixes in analogies backends and adds suport in player history

 data/verbal_analogies.xml                          |   80 ++++++++++++++++++--
 src/Defines.cs.in                                  |    1 +
 src/Dialogs/CustomGameDialog.cs                    |   16 +----
 src/Dialogs/PlayerHistoryDialog.cs                 |   60 +++++++++++++--
 src/Game.cs                                        |   32 ++++++++
 src/GameManager.cs                                 |    3 +
 src/PlayerHistory.cs                               |    4 +-
 src/Preferences.cs                                 |    2 +-
 src/VerbalAnalogies/Analogies.cs                   |    4 +
 src/VerbalAnalogies/AnalogiesFactory.cs            |   18 +++-
 src/VerbalAnalogies/AnalogiesMultipleOptions.cs    |   15 ++--
 src/VerbalAnalogies/AnalogiesPairOfWordsCompare.cs |   15 ++--
 src/VerbalAnalogies/AnalogiesPairOfWordsOptions.cs |   15 ++--
 src/VerbalAnalogies/AnalogiesQuestionAnswer.cs     |   11 +--
 src/gbrainy.glade                                  |   29 ++++++-
 15 files changed, 232 insertions(+), 73 deletions(-)
---
diff --git a/data/verbal_analogies.xml b/data/verbal_analogies.xml
index edb4afd..a9577bd 100644
--- a/data/verbal_analogies.xml
+++ b/data/verbal_analogies.xml
@@ -11,7 +11,13 @@
 
 		You can look at VerbalAnalogies.cs source code file as reference.
 	-->
+	
+	<!--- Multiple options  -->
+
 	<analogy>
+		<!--
+			Translators, please check these recommendations when translating gbrainy: http://live.gnome.org/gbrainy/Localizing
+		-->
 		<_question type = "MultipleOptions">Which of the following sports is the odd one?</_question>
 		<_tip>Think of the items used in the game.</_tip>
 		<_answer>Water polo</_answer>
@@ -20,6 +26,7 @@
 		<_answer correct = "yes">Cycling</_answer>
 		<_rationale>It is the only one that does not use a ball in the game.</_rationale>
 	</analogy>
+
 	<analogy>
 		<_question type = "MultipleOptions">A terrier is to a dog like a?</_question>
 		<_answer correct ="yes">chicken / bird</_answer>
@@ -27,10 +34,59 @@
 		<_answer>ant / insect</_answer>
 		<_answer>dog / cat</_answer>
 	</analogy>
+
 	<analogy>
-		<_question>A restaurant is to a dinner like a park is to?</_question>
-		<_answer correct ="yes">picnic</_answer>
+		<_question type = "MultipleOptions">John's father's sister's sister-in-law is also?</_question>
+		<_answer correct ="yes">his mother</_answer>
+		<_answer>has no relation</_answer>
+		<_answer>cousin</_answer>
+		<_answer>son-in-law</_answer>
+	</analogy>
+
+	<analogy>
+	
+		<_question type = "MultipleOptions">The term taxidermist is used to define a person that?</_question>
+		<_answer correct ="yes">Works with dead animals</_answer>
+		<_answer>Specializes in skin diseases</_answer>
+		<_answer>Suffers a skin disease</_answer>
+		<_answer>Works with leather</_answer>
+	</analogy>
+
+	<analogy>
+		<_question type = "MultipleOptions">A car engine that is poorly designed and lacking of sophistication is?</_question>
+		<_answer correct ="yes">simplistic</_answer>
+		<_answer>erroneous</_answer>
+		<_answer>broken</_answer>
+		<_answer>unorthodox</_answer>
+	</analogy>
+
+	<analogy>
+		<_question type = "MultipleOptions">Which of the following words is the closest in meaning to 'censure'?</_question>
+		<_answer correct ="yes">condemn</_answer>
+		<_answer>hide</_answer>
+		<_answer>obscure</_answer>
+		<_answer>ignore</_answer>
+	</analogy>
+
+	<analogy>
+		<_question type = "MultipleOptions">An artist that has became an enduring icon is?</_question>
+		<_answer correct ="yes">emblem</_answer>
+		<_answer>innovator</_answer>
+		<_answer>pioneer</_answer>
+		<_answer>martyr</_answer>
+	</analogy>
+
+	<analogy>
+		<_question type = "MultipleOptions">Which of the following sentences defines better 'ostracism'?</_question>
+		<_answer correct ="yes">Person spelled from society</_answer>
+		<_answer>Loner</_answer>
+		<_answer>Connoisseur</_answer>
+		<_answer>Conspirator</_answer>
 	</analogy>
+
+
+	<!--- Pair of words options  
+
 	<analogy>
 		<_question type = "PairOfWordsOptions">moratorium / payment</_question>
 		<_answer correct ="yes">reprieve / punishment</_answer>
@@ -38,6 +94,11 @@
 		<_answer>date / meeting</_answer>
 		<_answer>sentence / prison</_answer>
 	</analogy>
+
+	-->
+
+	<!--- Pair of words compare  -->
+
 	<analogy>
 		<_question type = "PairOfWordsCompare">hungry / eat | tired</_question>
 		<_answer correct ="yes">sleep | rest</_answer>
@@ -155,10 +216,6 @@
 		<_answer correct ="yes">wild</_answer>
 	</analogy>
 	<analogy>
-		<_question type = "PairOfWordsCompare">train / whistle | ambulance</_question>
-		<_answer correct ="yes">siren</_answer>
-	</analogy>
-	<analogy>
 		<_question type = "PairOfWordsCompare">sugar / sweet | vinegar</_question>
 		<_answer correct ="yes">sour</_answer>
 	</analogy>
@@ -174,6 +231,17 @@
 		<_question type = "PairOfWordsCompare">elbow / knee | wrist</_question>
 		<_answer correct ="yes">ankle</_answer>
 	</analogy>
+
+<!---
+	QuestionAnswer
+	
+	<analogy>
+		<_question>A restaurant is to a dinner like a park is to?</_question>
+		<_answer correct ="yes">picnic</_answer>
+	</analogy>
+-->
+
+
 </analogies>
 
 
diff --git a/src/Defines.cs.in b/src/Defines.cs.in
index 1a5dc2f..a35eac1 100644
--- a/src/Defines.cs.in
+++ b/src/Defines.cs.in
@@ -25,6 +25,7 @@ public class Defines
 	public const string GNOME_LOCALE_DIR = "@prefix@/share/locale";
 	public const string DATA_DIR = "@prefix@/share/games/gbrainy/";
 	public const string VERBAL_ANALOGIES = "verbal_analogies.xml";
+	public const string CONFIG_DIR = "gbrainy"; // like .config/gbrainy
 }
 
 
diff --git a/src/Dialogs/CustomGameDialog.cs b/src/Dialogs/CustomGameDialog.cs
index 1352b03..ec7735f 100644
--- a/src/Dialogs/CustomGameDialog.cs
+++ b/src/Dialogs/CustomGameDialog.cs
@@ -81,21 +81,7 @@ public class CustomGameDialog : GtkDialog
 			for (int i = 0; i < games.Length; i++)
 			{	
 				game =  (Game) Activator.CreateInstance (games [i], true);
-				switch (game.Type) {
-				case Game.Types.LogicPuzzle:
-					type = Catalog.GetString ("Logic");
-					break;
-				case Game.Types.MemoryTrainer:
-					type = Catalog.GetString ("Memory");
-					break;
-				case Game.Types.MathTrainer:
-					type = Catalog.GetString ("Mental Calculation");
-					break;
-				default:
-					type = string.Empty;
-					break;
-				}
-				
+				type = Game.GetGameTypeDescription (game.Type);
 				games_store.AppendValues (game.Name, type, true, game);
 			}
 		}
diff --git a/src/Dialogs/PlayerHistoryDialog.cs b/src/Dialogs/PlayerHistoryDialog.cs
index 16da72d..f99d727 100644
--- a/src/Dialogs/PlayerHistoryDialog.cs
+++ b/src/Dialogs/PlayerHistoryDialog.cs
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Jordi Mas i Hernàndez <jmas softcatala org>
+ * Copyright (C) 2008-2009 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
@@ -30,17 +30,32 @@ public class PlayerHistoryDialog : GtkDialog
 	[Glade.Widget] Gtk.CheckButton checkbutton_memory;
 	[Glade.Widget] Gtk.CheckButton checkbutton_logic;
 	[Glade.Widget] Gtk.CheckButton checkbutton_calculation;
+	[Glade.Widget] Gtk.CheckButton checkbutton_verbal;
 
 	CairoPreview drawing_area;
 
 	public PlayerHistoryDialog () : base ("playerhistory")
 	{
-		label_playerhistory.Text = String.Format (Catalog.GetString ("The graphic below shows the player's game score evolution. It is built using the results of {0} last recorded games."), gbrainy.history.Games.Count);
+		string label;
+
+		label = Catalog.GetString ("The graphic below shows the player's game score evolution. ");
+		label +=  Catalog.GetPluralString ("You need more than one game recorded to see the score evolution.",
+			"It is built using the results of {0} last recorded games.", 
+			gbrainy.history.Games.Count < 2 ? 1 : 2);
+
+		label_playerhistory.Text = String.Format (label, gbrainy.history.Games.Count);
 
 		drawing_area = new CairoPreview (this);
 		history_preview.Add (drawing_area);
 		drawing_area.Visible = true;
- 		checkbutton_total.Active = checkbutton_memory.Active = checkbutton_logic.Active = checkbutton_calculation.Active = true;
+
+ 		checkbutton_total.Label = Catalog.GetString ("Total");
+ 		checkbutton_logic.Label = Game.GetGameTypeDescription (Game.Types.LogicPuzzle);
+ 		checkbutton_calculation.Label = Game.GetGameTypeDescription (Game.Types.MathTrainer);
+ 		checkbutton_memory.Label = Game.GetGameTypeDescription (Game.Types.MemoryTrainer);
+ 		checkbutton_verbal.Label = Game.GetGameTypeDescription (Game.Types.VerbalAnalogy);
+
+ 		checkbutton_total.Active = checkbutton_memory.Active = checkbutton_logic.Active = checkbutton_calculation.Active = checkbutton_verbal.Active = true;
 	}
 	
 	void OnTotalToggled (object sender, EventArgs args)
@@ -69,6 +84,7 @@ public class PlayerHistoryDialog : GtkDialog
 		Cairo.Color math_color = new Cairo.Color (0.56, 0.71, 0.20);    // 8fb735
 		Cairo.Color logic_color = new Cairo.Color (0.81, 0.54, 0.23);   // d18c3b
 		Cairo.Color memory_color = new Cairo.Color (0.73, 0.22, 0.51);  // bb3a84
+		Cairo.Color verbal_color = new Cairo.Color (0.68, 0.16, 0.17);  // af2b2c
 		Cairo.Color total_color = new Cairo.Color (0, 0, 0.6);
 		Cairo.Color text_color = new Cairo.Color (0, 0, 0);
 		Cairo.Color axis_color = new Cairo.Color (0.15, 0.15, 0.15);
@@ -81,7 +97,11 @@ public class PlayerHistoryDialog : GtkDialog
 
 		private void DrawLegend (CairoContextEx cr, double x, double y)
 		{
-			const double line_size = 0.05, offset_x = 0.01, second_row = 0.05;
+			const double line_size = 0.05, offset_x = 0.01, second_row = 0.05, space_hor = 0.4;
+			double old_width;
+
+			old_width = cr.LineWidth;
+			cr.LineWidth = 0.01;
 			
 			cr.Color = total_color;
 			cr.MoveTo (x, y);
@@ -98,17 +118,17 @@ public class PlayerHistoryDialog : GtkDialog
 			cr.Stroke ();
 			cr.Color = text_color;
 			cr.MoveTo (x + line_size + offset_x, y - 0.01 + second_row);
-			cr.ShowPangoText (Catalog.GetString ("Logic"));
+			cr.ShowPangoText (Game.GetGameTypeDescription (Game.Types.LogicPuzzle));
 			cr.Stroke ();
 
-			x += 0.5;
+			x += space_hor;
 			cr.Color = memory_color;
 			cr.MoveTo (x, y);
 			cr.LineTo (x + line_size, y);
 			cr.Stroke ();
 			cr.Color = text_color;
 			cr.MoveTo (x + line_size + offset_x, y - 0.01);
-			cr.ShowPangoText (Catalog.GetString ("Memory"));
+			cr.ShowPangoText (Game.GetGameTypeDescription (Game.Types.MemoryTrainer));
 			cr.Stroke ();
 
 			cr.Color = math_color;
@@ -117,8 +137,20 @@ public class PlayerHistoryDialog : GtkDialog
 			cr.Stroke ();
 			cr.Color = text_color;
 			cr.MoveTo (x + line_size + offset_x, y - 0.01 + second_row);
-			cr.ShowPangoText (Catalog.GetString ("Calculation"));
+			cr.ShowPangoText (Game.GetGameTypeDescription (Game.Types.MathTrainer));
 			cr.Stroke ();
+
+			x += space_hor;
+			cr.Color = verbal_color;
+			cr.MoveTo (x, y);
+			cr.LineTo (x + line_size, y);
+			cr.Stroke ();
+			cr.Color = text_color;
+			cr.MoveTo (x + line_size + offset_x, y - 0.01);
+			cr.ShowPangoText (Game.GetGameTypeDescription (Game.Types.VerbalAnalogy));
+			cr.Stroke ();
+
+			cr.LineWidth = old_width;
 		}
 
 		private void DrawLines (CairoContextEx cr, double x, double y)
@@ -168,6 +200,18 @@ public class PlayerHistoryDialog : GtkDialog
 				cr.Stroke ();
 			}
 
+			if (dlg.checkbutton_verbal.Active) { // Verbal
+				cr.Color = verbal_color;
+				cr.MoveTo (x, area_h - (area_h * history.Games[0].verbal_score / 100));
+				for (int i = 1; i < history.Games.Count; i++)
+				{
+					px = x + (ratio * i);
+					py = y + area_h - (area_h * history.Games[i].verbal_score / 100);
+					cr.LineTo (px, py);
+				}
+				cr.Stroke ();
+			}
+
 			if (dlg.checkbutton_total.Active) { // Total			
 				cr.Color = total_color;
 				cr.MoveTo (x, area_h - (area_h * history.Games[0].total_score / 100));
diff --git a/src/Game.cs b/src/Game.cs
index 97dfbe3..4f91948 100644
--- a/src/Game.cs
+++ b/src/Game.cs
@@ -22,6 +22,7 @@ using Mono.Unix;
 
 abstract public class Game
 {
+	// See: GetGameTypeDescription
 	public enum Types
 	{	
 		None			= 0,
@@ -124,6 +125,11 @@ abstract public class Game
 		set { draw_answer = value; }
 	}
 
+	// An initialized game cannot be playable (for example, missing external files)
+	public virtual bool IsPlayable {
+		get { return true;}
+	}
+
 	public virtual double DrawAreaX {
 		get {return 0.1;}
 	}
@@ -294,5 +300,31 @@ abstract public class Game
 		}
 		return rslt;
 	}
+
+	// Type enum to string representation
+	static public string GetGameTypeDescription (Types type)
+	{
+		string str;
+
+		switch (type) 
+		{
+			case Game.Types.LogicPuzzle:
+				str = Catalog.GetString ("Logic");
+				break;
+			case Game.Types.MemoryTrainer:
+				str = Catalog.GetString ("Memory");
+				break;
+			case Game.Types.MathTrainer:
+				str = Catalog.GetString ("Mental Calculation");
+				break;
+			case Game.Types.VerbalAnalogy:
+				str = Catalog.GetString ("Verbal");
+				break;
+			default:
+				str = string.Empty;
+				break;
+		}
+		return str;
+	}
 }
 
diff --git a/src/GameManager.cs b/src/GameManager.cs
index 3c92f93..30c266e 100644
--- a/src/GameManager.cs
+++ b/src/GameManager.cs
@@ -353,6 +353,9 @@ public class GameManager
 			//puzzle =  (Game) Activator.CreateInstance (LogicPuzzles [37], true);
 			if (first != null && first.GetType () == puzzle.GetType ())
 				break;
+
+			if (puzzle.IsPlayable == false)
+				continue;
 				
 			if (first == null)
 				first = puzzle;
diff --git a/src/PlayerHistory.cs b/src/PlayerHistory.cs
index 92f8ebc..e6d996c 100644
--- a/src/PlayerHistory.cs
+++ b/src/PlayerHistory.cs
@@ -37,12 +37,13 @@ public class PlayerHistory
 		public int math_score;
 		public int logic_score;
 		public int memory_score;
+		public int verbal_score;
 	}
 
 	public PlayerHistory ()
 	{
 		config_path = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData);
-		config_path = Path.Combine (config_path, "gbrainy");
+		config_path = Path.Combine (config_path, Defines.CONFIG_DIR);
 		file = Path.Combine (config_path, "PlayerHistory.xml");
 	}
 
@@ -77,6 +78,7 @@ public class PlayerHistory
 		history.logic_score = session.LogicScore;
 		history.memory_score = session.MemoryScore;
 		history.total_score = session.TotalScore;
+		history.verbal_score = session.VerbalScore;
 
 		if (Games.Count >= gbrainy.preferences.GetIntValue (Preferences.MaxStoredGamesKey))
 			Games.RemoveAt (0);
diff --git a/src/Preferences.cs b/src/Preferences.cs
index 4780d9e..de8a6a4 100644
--- a/src/Preferences.cs
+++ b/src/Preferences.cs
@@ -109,7 +109,7 @@ public class Preferences
 	{
 		properties = new SerializableDictionary <string, string> ();
 		config_path = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData);
-		config_path = Path.Combine (config_path, "gbrainy");
+		config_path = Path.Combine (config_path, Defines.CONFIG_DIR);
 		file = Path.Combine (config_path, "Preferences.xml");
 		Load ();
 	}
diff --git a/src/VerbalAnalogies/Analogies.cs b/src/VerbalAnalogies/Analogies.cs
index d488789..647e676 100644
--- a/src/VerbalAnalogies/Analogies.cs
+++ b/src/VerbalAnalogies/Analogies.cs
@@ -48,6 +48,10 @@ public abstract class Analogies : Game
 		}
 	}
 
+	public override bool IsPlayable {
+		get { return List.Count > 0;}
+	}
+
 	public override string Answer {
 		get {
 			if (current == null)
diff --git a/src/VerbalAnalogies/AnalogiesFactory.cs b/src/VerbalAnalogies/AnalogiesFactory.cs
index 61c5dcc..f60359d 100644
--- a/src/VerbalAnalogies/AnalogiesFactory.cs
+++ b/src/VerbalAnalogies/AnalogiesFactory.cs
@@ -137,8 +137,11 @@ static public class AnalogiesFactory
 			for (int i = 0; i < (int) Analogy.Type.Last; i++) 
 			{
 				cnt += analogies_arrays[i].Count;
-				Console.WriteLine (Catalog.GetString ("Read {0} verbal analogies of type {1}"), analogies_arrays[i].Count, 
-					analogies_arrays[i].Count > 0 ? analogies_arrays[i][0].type : Analogy.Type.Last);
+
+				if (analogies_arrays[i].Count > 0) {
+					Console.WriteLine (Catalog.GetString ("Read {0} verbal analogies of type {1}"), analogies_arrays[i].Count, 
+						analogies_arrays[i][0].type.ToString ());
+				}
 			}
 			
 			Console.WriteLine (Catalog.GetString ("Read a total of {0} verbal analogies"), cnt);
@@ -159,12 +162,17 @@ static public class AnalogiesFactory
 	{
 		Analogy empty = new Analogy ();
 		empty.question = Catalog.GetString ("There are no verbal analogies available.");
+		bool all_empty = true;
 
 		for (int i = 0; i < (int) Analogy.Type.Last; i++)
 		{
-			if (analogies_arrays[i].Count == 0)
-				analogies_arrays[i].Add (0, empty);
+			if (analogies_arrays[i].Count > 0) {
+				all_empty = false;
+				break;	
+			}
 		}
-	}
 
+		if (all_empty == true)
+			analogies_arrays[0].Add (0, empty);
+	}
 }
diff --git a/src/VerbalAnalogies/AnalogiesMultipleOptions.cs b/src/VerbalAnalogies/AnalogiesMultipleOptions.cs
index 76dcf58..5860deb 100644
--- a/src/VerbalAnalogies/AnalogiesMultipleOptions.cs
+++ b/src/VerbalAnalogies/AnalogiesMultipleOptions.cs
@@ -33,17 +33,21 @@ public class AnalogiesMultipleOptions : Analogies
 
 	public AnalogiesMultipleOptions ()
 	{
-
+		if (analogies == null)
+			analogies = AnalogiesFactory. Get (Analogy.Type.MultipleOptions);
 	}
 
 	public override string Name {
-		get { return "AnalogiesMultipleOptions";}
+		get { return "Multiple options";}
 	}
 
 	public override string Question {
 		get {
 			string str = string.Empty;
 
+			if (current == null)
+				return string.Empty;
+
 			if (current.answers == null)
 				return current.question;
 
@@ -80,17 +84,12 @@ public class AnalogiesMultipleOptions : Analogies
 
 	public override void Initialize ()
 	{
-		if (analogies == null) {
-			analogies = AnalogiesFactory. Get (Analogy.Type.MultipleOptions);
-		}
-
 		current = GetNext ();
 
 		if (current == null || current.answers == null)
 			return;
 
 		right_answer = GetPossibleAnswer (current.right);
-		Console.WriteLine ("Name:" + Name + " " + current.ToString ());
 	}
 	
 	public override void Draw (CairoContextEx gr, int area_width, int area_height)
@@ -107,7 +106,7 @@ public class AnalogiesMultipleOptions : Analogies
 		gr.ShowPangoText (Catalog.GetString ("Possible answers are:"));
 
 		y += 0.12;
-		x += 0.1;
+		x += 0.05;
 		for (int n = 0; n < current.answers.Length; n++)
 		{
 			gr.MoveTo (x, y);
diff --git a/src/VerbalAnalogies/AnalogiesPairOfWordsCompare.cs b/src/VerbalAnalogies/AnalogiesPairOfWordsCompare.cs
index 6ceeccd..5e138e7 100644
--- a/src/VerbalAnalogies/AnalogiesPairOfWordsCompare.cs
+++ b/src/VerbalAnalogies/AnalogiesPairOfWordsCompare.cs
@@ -35,11 +35,12 @@ public class AnalogiesPairOfWordsCompare : Analogies
 
 	public AnalogiesPairOfWordsCompare ()
 	{
-
+		if (analogies == null)
+			analogies = AnalogiesFactory. Get (Analogy.Type.PairOfWordsCompare);
 	}
 
 	public override string Name {
-		get { return "AnalogiesPairOfWordsCompare";}
+		get { return "Pair of words compare";}
 	}
 
 	public override ArrayListIndicesRandom Indices {
@@ -58,6 +59,9 @@ public class AnalogiesPairOfWordsCompare : Analogies
 
 	public override string Question {
 		get {
+			if (current == null)
+				return string.Empty;
+
 			if (current.answers == null)
 				return current.question;
 
@@ -69,10 +73,6 @@ public class AnalogiesPairOfWordsCompare : Analogies
 
 	public override void Initialize ()
 	{
-		if (analogies == null) {
-			analogies = AnalogiesFactory. Get (Analogy.Type.PairOfWordsCompare);
-		}
-
 		current = GetNext ();
 
 		if (current == null || current.answers == null)
@@ -89,7 +89,6 @@ public class AnalogiesPairOfWordsCompare : Analogies
 
 		samples = items [0].Trim ();
 		right_answer = current.answers [current.right];
-		Console.WriteLine ("Name:" + Name + " " + current.ToString ());
 	}
 	
 	public override void Draw (CairoContextEx gr, int area_width, int area_height)
@@ -103,6 +102,6 @@ public class AnalogiesPairOfWordsCompare : Analogies
 
 		gr.SetPangoLargeFontSize ();
 		gr.DrawTextCentered (0.5, y + 0.25,
-			String.Format (Catalog.GetString ("Pair of words: {0}"), samples));
+			String.Format (Catalog.GetString ("Words: {0}"), samples));
 	}
 }
diff --git a/src/VerbalAnalogies/AnalogiesPairOfWordsOptions.cs b/src/VerbalAnalogies/AnalogiesPairOfWordsOptions.cs
index d1952b7..1554c1f 100644
--- a/src/VerbalAnalogies/AnalogiesPairOfWordsOptions.cs
+++ b/src/VerbalAnalogies/AnalogiesPairOfWordsOptions.cs
@@ -33,11 +33,12 @@ public class AnalogiesPairOfWordsOptions : Analogies
 
 	public AnalogiesPairOfWordsOptions ()
 	{
-
+		if (analogies == null)
+			analogies = AnalogiesFactory. Get (Analogy.Type.PairOfWordsOptions);
 	}
 
 	public override string Name {
-		get { return "AnalogiesPairOfWordsOptions";}
+		get { return "Pair of words";}
 	}
 
 	public override ArrayListIndicesRandom Indices {
@@ -57,6 +58,9 @@ public class AnalogiesPairOfWordsOptions : Analogies
 	public override string Question {
 		get {
 			string str = string.Empty;
+	
+			if (current == null)
+				return string.Empty;
 
 			if (current.answers == null)
 				return current.question;
@@ -81,17 +85,12 @@ public class AnalogiesPairOfWordsOptions : Analogies
 
 	public override void Initialize ()
 	{
-		if (analogies == null) {
-			analogies = AnalogiesFactory. Get (Analogy.Type.PairOfWordsOptions);
-		}
-
 		current = GetNext ();
 
 		if (current == null || current.answers == null)
 			return;
 
 		right_answer = GetPossibleAnswer (current.right);
-		Console.WriteLine ("Name:" + Name + " " + current.ToString ());
 	}
 
 	public override void Draw (CairoContextEx gr, int area_width, int area_height)
@@ -107,7 +106,7 @@ public class AnalogiesPairOfWordsOptions : Analogies
 		gr.MoveTo (0.1, y);
 		gr.ShowPangoText (Catalog.GetString ("Possible answers are:"));
 		y += 0.12;
-		x += 0.1;
+		x += 0.05;
 		for (int n = 0; n < current.answers.Length; n++)
 		{
 			gr.MoveTo (x, y);
diff --git a/src/VerbalAnalogies/AnalogiesQuestionAnswer.cs b/src/VerbalAnalogies/AnalogiesQuestionAnswer.cs
index ff17d0b..1228e10 100644
--- a/src/VerbalAnalogies/AnalogiesQuestionAnswer.cs
+++ b/src/VerbalAnalogies/AnalogiesQuestionAnswer.cs
@@ -31,11 +31,12 @@ public class AnalogiesQuestionAnswer : Analogies
 
 	public AnalogiesQuestionAnswer ()
 	{
-
+		if (analogies == null)
+			analogies = AnalogiesFactory.Get (Analogy.Type.QuestionAnswer);
 	}
 
 	public override string Name {
-		get { return "AnalogiesQuestionAnswer";}
+		get { return "Question and answer";}
 	}
 
 	public override ArrayListIndicesRandom Indices {
@@ -54,10 +55,6 @@ public class AnalogiesQuestionAnswer : Analogies
 
 	public override void Initialize ()
 	{
-		if (analogies == null) {
-			analogies = AnalogiesFactory.Get (Analogy.Type.QuestionAnswer);
-		}
-
 		current = GetNext ();
 
 		if (current == null)
@@ -65,7 +62,5 @@ public class AnalogiesQuestionAnswer : Analogies
 
 		if (current.answers != null) 
 			right_answer = current.answers [current.right];
-
-		Console.WriteLine ("Name:" + Name + " " + current.ToString ());
 	}
 }
diff --git a/src/gbrainy.glade b/src/gbrainy.glade
index 9551207..bf9e99e 100644
--- a/src/gbrainy.glade
+++ b/src/gbrainy.glade
@@ -677,7 +677,7 @@
 		  <property name="width_request">350</property>
 		  <property name="visible">True</property>
 		  <property name="can_focus">True</property>
-		  <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+		  <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
 		  <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
 		  <property name="shadow_type">GTK_SHADOW_IN</property>
 		  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
@@ -1447,7 +1447,7 @@
 		<widget class="GtkCheckButton" id="checkbutton_total">
 		  <property name="visible">True</property>
 		  <property name="can_focus">True</property>
-		  <property name="label" translatable="yes">Total</property>
+		  <property name="label" translatable="yes"></property>
 		  <property name="use_underline">True</property>
 		  <property name="relief">GTK_RELIEF_NORMAL</property>
 		  <property name="focus_on_click">True</property>
@@ -1467,7 +1467,7 @@
 		<widget class="GtkCheckButton" id="checkbutton_logic">
 		  <property name="visible">True</property>
 		  <property name="can_focus">True</property>
-		  <property name="label" translatable="yes">Logic</property>
+		  <property name="label" translatable="yes"></property>
 		  <property name="use_underline">True</property>
 		  <property name="relief">GTK_RELIEF_NORMAL</property>
 		  <property name="focus_on_click">True</property>
@@ -1487,7 +1487,7 @@
 		<widget class="GtkCheckButton" id="checkbutton_memory">
 		  <property name="visible">True</property>
 		  <property name="can_focus">True</property>
-		  <property name="label" translatable="yes">Memory</property>
+		  <property name="label" translatable="yes"></property>
 		  <property name="use_underline">True</property>
 		  <property name="relief">GTK_RELIEF_NORMAL</property>
 		  <property name="focus_on_click">True</property>
@@ -1507,7 +1507,7 @@
 		<widget class="GtkCheckButton" id="checkbutton_calculation">
 		  <property name="visible">True</property>
 		  <property name="can_focus">True</property>
-		  <property name="label" translatable="yes">Calculation</property>
+		  <property name="label" translatable="yes"></property>
 		  <property name="use_underline">True</property>
 		  <property name="relief">GTK_RELIEF_NORMAL</property>
 		  <property name="focus_on_click">True</property>
@@ -1522,6 +1522,25 @@
 		  <property name="fill">False</property>
 		</packing>
 	      </child>
+
+	      <child>
+		<widget class="GtkCheckButton" id="checkbutton_verbal">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes"></property>
+		  <property name="use_underline">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
 	    </widget>
 	    <packing>
 	      <property name="padding">0</property>



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