[gbrainy] Some code fixes
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy] Some code fixes
- Date: Fri, 10 Sep 2010 18:36:05 +0000 (UTC)
commit a67676c96892c6945159694f3bf22d9a6a02d0ea
Author: Jordi Mas <jmas softcatala org>
Date: Fri Sep 10 20:37:53 2010 +0200
Some code fixes
src/Clients/Classical/SimpleLabel.cs | 29 +++++++++-----------
src/Core/Main/CairoContextEx.cs | 5 +---
src/Core/Main/Game.cs | 2 +-
.../Calculation/CalculationGreatestDivisor.cs | 2 +-
src/Games/Calculation/CalculationProportions.cs | 2 +-
src/Games/Logic/PuzzleQuadrilaterals.cs | 2 +-
6 files changed, 18 insertions(+), 24 deletions(-)
---
diff --git a/src/Clients/Classical/SimpleLabel.cs b/src/Clients/Classical/SimpleLabel.cs
index cce2645..ac640b4 100644
--- a/src/Clients/Classical/SimpleLabel.cs
+++ b/src/Clients/Classical/SimpleLabel.cs
@@ -71,23 +71,20 @@ namespace gbrainy.Clients.Classical
if (String.IsNullOrEmpty (text))
return base.OnExposeEvent (args);
- using (Cairo.Context cr = Gdk.CairoHelper.Create (args.Window))
- {
- int winWidth, winHeight;
- Gdk.GC light = Style.ForegroundGC (StateType.Normal);
- args.Window.GetSize (out winWidth, out winHeight);
+ int winWidth, winHeight;
+ Gdk.GC light = Style.ForegroundGC (StateType.Normal);
+ args.Window.GetSize (out winWidth, out winHeight);
- using (Pango.Layout layout = new Pango.Layout (this.PangoContext))
- {
- if (Direction == Gtk.TextDirection.Rtl)
- layout.Alignment = Pango.Alignment.Right;
- else
- layout.Alignment = Pango.Alignment.Left;
-
- layout.Width = (winWidth - width_margin * 2) * (int) Pango.Scale.PangoScale;
- layout.SetMarkup (text);
- args.Window.DrawLayout (light, width_margin, height_margin, layout);
- }
+ using (Pango.Layout layout = new Pango.Layout (this.PangoContext))
+ {
+ if (Direction == Gtk.TextDirection.Rtl)
+ layout.Alignment = Pango.Alignment.Right;
+ else
+ layout.Alignment = Pango.Alignment.Left;
+
+ layout.Width = (winWidth - width_margin * 2) * (int) Pango.Scale.PangoScale;
+ layout.SetMarkup (text);
+ args.Window.DrawLayout (light, width_margin, height_margin, layout);
}
return base.OnExposeEvent (args);
diff --git a/src/Core/Main/CairoContextEx.cs b/src/Core/Main/CairoContextEx.cs
index 669cdf3..681b985 100644
--- a/src/Core/Main/CairoContextEx.cs
+++ b/src/Core/Main/CairoContextEx.cs
@@ -27,10 +27,7 @@ namespace gbrainy.Core.Main
// Implements functionality specific to gbrainy
public class CairoContextEx : CairoContext
{
- static SVGImage image = null;
-
- const double width_margin = 0.04;
- const double line_spacing = 0.018;
+ static SVGImage image;
public CairoContextEx (IntPtr state, Gtk.Widget widget) : base (state, widget)
{
diff --git a/src/Core/Main/Game.cs b/src/Core/Main/Game.cs
index b884ea6..465f213 100644
--- a/src/Core/Main/Game.cs
+++ b/src/Core/Main/Game.cs
@@ -153,7 +153,7 @@ namespace gbrainy.Core.Main
if (String.IsNullOrEmpty (Rationale))
return str;
- return str += " " + Rationale;
+ return str + " " + Rationale;
}
}
diff --git a/src/Games/Calculation/CalculationGreatestDivisor.cs b/src/Games/Calculation/CalculationGreatestDivisor.cs
index 9a055cf..ed0bc8b 100644
--- a/src/Games/Calculation/CalculationGreatestDivisor.cs
+++ b/src/Games/Calculation/CalculationGreatestDivisor.cs
@@ -69,7 +69,7 @@ namespace gbrainy.Games.Calculation
numbers = new int [num_answ_ques];
answers = new int [num_answ_ques];
- // Common multiplayers for all numbers
+ // Common multipliers for all numbers
for (m = 0; m < mult.Length; m++) {
mult[m] = GetMultiplier (mult);
}
diff --git a/src/Games/Calculation/CalculationProportions.cs b/src/Games/Calculation/CalculationProportions.cs
index d89f9e8..3bc5ca7 100644
--- a/src/Games/Calculation/CalculationProportions.cs
+++ b/src/Games/Calculation/CalculationProportions.cs
@@ -79,7 +79,7 @@ namespace gbrainy.Games.Calculation
options [options_next++] = correct;
options [options_next++] = percentage / 70d * num / den;
options [options_next++] = percentage / 120d * num / den;
- options [options_next++] = percentage / 150d * num / den;;
+ options [options_next++] = percentage / 150d * num / den;
random_indices = new ArrayListIndicesRandom (options_cnt);
random_indices.Initialize ();
diff --git a/src/Games/Logic/PuzzleQuadrilaterals.cs b/src/Games/Logic/PuzzleQuadrilaterals.cs
index 47804e5..3c1680f 100644
--- a/src/Games/Logic/PuzzleQuadrilaterals.cs
+++ b/src/Games/Logic/PuzzleQuadrilaterals.cs
@@ -115,7 +115,7 @@ namespace gbrainy.Games.Logic
gr.LineTo (x + figure_size - 0.04, y);
gr.LineTo (x + figure_size - 0.04, y + figure_size * 1.2);
gr.LineTo (x , y + figure_size * 1.2);
- gr.LineTo (x + 0.03, y);;
+ gr.LineTo (x + 0.03, y);
break;
case Figures.FigureF:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]