Enlightenment CVS committal
Author : dj2
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/bin/tests/puzzle
Modified Files:
ewl_puzzle_test.c
Log Message:
- tabs are a tricky beast. looks like I missed some.
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/puzzle/ewl_puzzle_test.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_puzzle_test.c 6 May 2008 20:18:56 -0000 1.2
+++ ewl_puzzle_test.c 7 May 2008 13:38:19 -0000 1.3
@@ -76,7 +76,7 @@
*/
w = ewl_image_new();
ewl_image_file_path_set(EWL_IMAGE(w), PACKAGE_DATA_DIR
- "/ewl/images/e-logo.png");
+ "/ewl/images/e-logo.png");
ewl_image_proportional_set(EWL_IMAGE(w), FALSE);
ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
ewl_container_child_append(EWL_CONTAINER(hbox), w);
@@ -97,9 +97,9 @@
ewl_text_wrap_set(EWL_TEXT(w), TRUE);
ewl_object_w_request(EWL_OBJECT(w), 400);
ewl_text_text_append(EWL_TEXT(w),
- "The rules are really simple. Just try "
- "to have the same image on your left "
- "like you have on your right hand.");
+ "The rules are really simple. Just try "
+ "to have the same image on your left "
+ "like you have on your right hand.");
ewl_container_child_append(EWL_CONTAINER(hbox), w);
ewl_widget_show(w);
@@ -121,12 +121,12 @@
Ewl_Widget *w;
int i, random;
int unsort[6][15] =
- {{4, 2, 5, 14, 0, 11, 6, 13, 10, 12, 1, 9, 8, 7, 3},
- {0, 2, 3, 7, 8, 4, 1, 6, 12, 5, 10, 11, 9, 13, 14},
- {1, 2, 6, 3, 13, 7, 10, 11, 0, 5, 12, 14, 4, 8, 9},
- {1, 10, 2, 3, 7, 9, 11, 6, 0, 8, 12, 5, 14, 4, 13},
- {0, 5, 1, 2, 9, 3, 7, 10, 4, 6, 11, 14, 8, 12, 13},
- {1, 3, 11, 14, 0, 7, 2, 13, 8, 12, 6, 10, 4, 9, 5}};
+ {{4, 2, 5, 14, 0, 11, 6, 13, 10, 12, 1, 9, 8, 7, 3},
+ {0, 2, 3, 7, 8, 4, 1, 6, 12, 5, 10, 11, 9, 13, 14},
+ {1, 2, 6, 3, 13, 7, 10, 11, 0, 5, 12, 14, 4, 8, 9},
+ {1, 10, 2, 3, 7, 9, 11, 6, 0, 8, 12, 5, 14, 4, 13},
+ {0, 5, 1, 2, 9, 3, 7, 10, 4, 6, 11, 14, 8, 12, 13},
+ {1, 3, 11, 14, 0, 7, 2, 13, 8, 12, 6, 10, 4, 9, 5}};
/* a really stupid randomizer */
random = time(NULL) % 6;
@@ -136,23 +136,23 @@
*/
for (i = 0; i < 15; i++)
{
- char buf[PATH_MAX];
+ char buf[PATH_MAX];
- snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR
- "/ewl/images/e-logo-%i.png", unsort[random][i]);
+ snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR
+ "/ewl/images/e-logo-%i.png",
unsort[random][i]);
- w = ewl_image_new();
- ewl_image_file_path_set(EWL_IMAGE(w), buf);
- ewl_image_proportional_set(EWL_IMAGE(w), FALSE);
- ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
- ewl_container_child_append(EWL_CONTAINER(grid), w);
- ewl_grid_child_position_set(EWL_GRID(grid), w,
- i % 4, i % 4, i / 4, i / 4);
- ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP,
- puzzle_mouse_up_cb, grid);
- ewl_widget_show(w);
+ w = ewl_image_new();
+ ewl_image_file_path_set(EWL_IMAGE(w), buf);
+ ewl_image_proportional_set(EWL_IMAGE(w), FALSE);
+ ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
+ ewl_container_child_append(EWL_CONTAINER(grid), w);
+ ewl_grid_child_position_set(EWL_GRID(grid), w,
+ i % 4, i % 4, i / 4, i / 4);
+ ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP,
+ puzzle_mouse_up_cb, grid);
+ ewl_widget_show(w);
- childs[i % 4][i / 4] = w;
+ childs[i % 4][i / 4] = w;
}
free_col = free_row = 3;
}
@@ -183,51 +183,51 @@
ch = ewl_object_current_h_get(EWL_OBJECT(w));
if (ev->x > cx && ev->y > cy && ev->x < cx + cw && ev->y < cy + ch)
- return;
+ return;
ewl_grid_child_position_get(EWL_GRID(g), w, &col, NULL, &row, NULL);
if (col == free_col && ev->x > cx && ev->x < cx + cw) {
- int direction, i;
+ int direction, i;
- if (ev->y < cy)
- direction = -1;
- else
- direction = 1;
-
- if (sign(free_row - row) != direction)
- return;
-
- for (i = free_row; i != row; i -= direction) {
- Ewl_Widget *move;
-
- move = childs[col][i - direction];
- ewl_grid_child_position_set(EWL_GRID(g),
- move, col, col, i, i);
- childs[col][i] = move;
- }
- free_row = row;
+ if (ev->y < cy)
+ direction = -1;
+ else
+ direction = 1;
+
+ if (sign(free_row - row) != direction)
+ return;
+
+ for (i = free_row; i != row; i -= direction) {
+ Ewl_Widget *move;
+
+ move = childs[col][i - direction];
+ ewl_grid_child_position_set(EWL_GRID(g),
+ move, col, col, i, i);
+ childs[col][i] = move;
+ }
+ free_row = row;
}
else if (row == free_row && ev->y > cy && ev->y < cy + ch) {
- int direction, i;
+ int direction, i;
- if (ev->x < cx)
- direction = -1;
- else
- direction = 1;
-
- if (sign(free_col - col) != direction)
- return;
-
- for (i = free_col; i != col; i -= direction) {
- Ewl_Widget *move;
-
- move = childs[i - direction][row];
- ewl_grid_child_position_set(EWL_GRID(g),
- move, i, i, row, row);
- childs[i][row] = move;
- }
- free_col = col;
+ if (ev->x < cx)
+ direction = -1;
+ else
+ direction = 1;
+
+ if (sign(free_col - col) != direction)
+ return;
+
+ for (i = free_col; i != col; i -= direction) {
+ Ewl_Widget *move;
+
+ move = childs[i - direction][row];
+ ewl_grid_child_position_set(EWL_GRID(g),
+ move, i, i, row, row);
+ childs[i][row] = move;
+ }
+ free_col = col;
}
}
@@ -235,9 +235,9 @@
sign(int x)
{
if (x > 0)
- return 1;
+ return 1;
if (x < 0)
- return -1;
+ return -1;
return 0;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs