[gnome-tetravex] Code cleanup
- From: Sahil Sareen <ssareen src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tetravex] Code cleanup
- Date: Sat, 28 Feb 2015 09:35:29 +0000 (UTC)
commit 55a55efab512bf39535b75532dc1c17399ae6cfd
Author: Sahil Sareen <sahil sareen hotmail com>
Date: Thu Feb 26 20:36:41 2015 +0530
Code cleanup
src/puzzle-view.vala | 26 +++++++++++++-------------
src/score-dialog.vala | 2 +-
src/theme.vala | 8 ++++----
3 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/src/puzzle-view.vala b/src/puzzle-view.vala
index 002b379..70edc88 100644
--- a/src/puzzle-view.vala
+++ b/src/puzzle-view.vala
@@ -72,7 +72,7 @@ public class PuzzleView : Gtk.DrawingArea
queue_resize ();
}
}
-
+
/* Theme */
private Theme theme;
@@ -98,7 +98,7 @@ public class PuzzleView : Gtk.DrawingArea
set_events (Gdk.EventMask.EXPOSURE_MASK | Gdk.EventMask.BUTTON_PRESS_MASK |
Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK);
tiles = new HashTable <Tile, TileImage> (direct_hash, direct_equal);
-
+
theme = new Theme ();
animation_timer = new Timer ();
@@ -123,13 +123,13 @@ public class PuzzleView : Gtk.DrawingArea
return false;
}
}
-
+
private void redraw_tile (TileImage image)
{
uint x_offset, y_offset, size, gap;
get_dimensions (out x_offset, out y_offset, out size, out gap);
- queue_draw_area ((int) (image.x + 0.5), (int) (image.y + 0.5), (int) size, (int) size);
+ queue_draw_area ((int) (image.x + 0.5), (int) (image.y + 0.5), (int) size, (int) size);
}
private void move_tile_to_location (TileImage image, uint x, uint y, double duration = 0)
@@ -148,7 +148,7 @@ public class PuzzleView : Gtk.DrawingArea
{
if (image.x == x && image.y == y)
return;
-
+
image.source_x = image.x;
image.source_y = image.y;
image.source_time = animation_timer.elapsed ();
@@ -169,12 +169,12 @@ public class PuzzleView : Gtk.DrawingArea
/* Start animation (maximum of 100fps) */
if (animation_timeout == 0)
animation_timeout = Timeout.add (10, animate_cb);
- }
-
+ }
+
private bool animate_cb ()
{
var t = animation_timer.elapsed ();
-
+
uint x_offset, y_offset, size, gap;
get_dimensions (out x_offset, out y_offset, out size, out gap);
@@ -234,7 +234,7 @@ public class PuzzleView : Gtk.DrawingArea
size = (int) ((puzzle.size + 1) * minimum_size);
minimum = natural = int.max (size, 300);
}
-
+
private void get_dimensions (out uint x, out uint y, out uint size, out uint gap)
{
/* Fit in with a half tile border and spacing between boards */
@@ -250,7 +250,7 @@ public class PuzzleView : Gtk.DrawingArea
{
move_tile_to_location (tiles.lookup (tile), x, y, 0.2);
}
-
+
public override bool configure_event (Gdk.EventConfigure event)
{
/* Move everything to its correct location */
@@ -363,7 +363,7 @@ public class PuzzleView : Gtk.DrawingArea
return false;
}
-
+
private void pick_tile (double x, double y)
{
if (selected_tile != null)
@@ -395,7 +395,7 @@ public class PuzzleView : Gtk.DrawingArea
}
}
}
-
+
private bool selection_timeout_cb ()
{
selection_timeout = 0;
@@ -501,7 +501,7 @@ public class PuzzleView : Gtk.DrawingArea
{
if (event.button == 1 && selected_tile != null && selection_timeout == 0)
drop_tile (event.x, event.y);
-
+
if (selection_timeout != 0)
Source.remove (selection_timeout);
selection_timeout = 0;
diff --git a/src/score-dialog.vala b/src/score-dialog.vala
index 3e7f13c..4ef7019 100644
--- a/src/score-dialog.vala
+++ b/src/score-dialog.vala
@@ -104,7 +104,7 @@ public class ScoreDialog : Gtk.Dialog
Gtk.TreeIter iter;
score_model.append (out iter);
score_model.set (iter, 0, date_label, 1, time_label, 2, weight);
-
+
if (entry == selected_entry)
{
var piter = iter;
diff --git a/src/theme.vala b/src/theme.vala
index 3a665ec..d1d900f 100644
--- a/src/theme.vala
+++ b/src/theme.vala
@@ -28,7 +28,7 @@ public class Theme : Object
tile_colors[7] = make_color_pattern ("#75507B");
tile_colors[8] = make_color_pattern ("#BABDB6");
tile_colors[9] = make_color_pattern ("#FFFFFF");
-
+
paused_color = make_color_pattern ("#CCCCCC");
text_colors[0] = new Cairo.Pattern.rgb (1, 1, 1);
@@ -70,7 +70,7 @@ public class Theme : Object
var depth = uint.min ((uint) (size * 0.025), 2);
var dx = 1.4142 * depth;
var dy = 6.1623 * depth;
-
+
/* Background */
context.move_to (0, 0);
context.line_to (w, h * 0.5);
@@ -97,7 +97,7 @@ public class Theme : Object
context.line_to (w - depth, -h * 0.5 + dy);
context.close_path ();
context.set_source_rgba (0, 0, 0, 0.25);
- context.fill ();
+ context.fill ();
}
public void draw_socket (Cairo.Context context, uint size)
@@ -131,7 +131,7 @@ public class Theme : Object
context.set_source_rgba (1, 1, 1, 0.125);
context.fill ();
}
-
+
public void draw_paused_tile (Cairo.Context context, uint size)
{
draw_tile_background (context, size, paused_color, paused_color, paused_color, paused_color);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]