Revision: 1763
http://svn.sourceforge.net/vexi/?rev=1763&view=rev
Author: clrg
Date: 2007-03-29 08:38:11 -0700 (Thu, 29 Mar 2007)
Log Message:
-----------
Move source files to appropriate folder
Added Paths:
-----------
some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/board.t
some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/gamelink.t
some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/main.t
some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/number.t
some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/sector.t
Removed Paths:
-------------
some_apps/trunk/org.vexi.simplysudoku/board.t
some_apps/trunk/org.vexi.simplysudoku/gamelink.t
some_apps/trunk/org.vexi.simplysudoku/main.t
some_apps/trunk/org.vexi.simplysudoku/number.t
some_apps/trunk/org.vexi.simplysudoku/sector.t
Deleted: some_apps/trunk/org.vexi.simplysudoku/board.t
===================================================================
--- some_apps/trunk/org.vexi.simplysudoku/board.t 2007-03-29 14:31:50 UTC
(rev 1762)
+++ some_apps/trunk/org.vexi.simplysudoku/board.t 2007-03-29 15:38:11 UTC
(rev 1763)
@@ -1,140 +0,0 @@
-<!-- GPL v2 -->
-
-<vexi xmlns:wi="vexi.widget" xmlns:ui="vexi://ui">
- <wi:border border="black" depth="2" shrink="true">
- <ui:box id="sectors" cols="3">
- <sector />
- <sector />
- <sector />
- <sector />
- <sector />
- <sector />
- <sector />
- <sector />
- <sector />
- </ui:box>
-
- thisbox.completed = 0;
-
- var complFunc = function(v)
- {
- if (v > 9) throw "More than 9 completed numbers not possible";
- if (v == 9) completed ++;
- else if (trapee.completed == 9) completed --;
- }
-
- var sectorMove = function(s, v, ni)
- {
- var i = $sectors.indexof(s);
- switch(v)
- {
- case "up":
- if (3 > i) true; // do nothing
- else $sectors[i-3][ni].focused = true;
- break;
- case "down":
- if (i > 5) true; // do nothing
- else $sectors[i+3][ni].focused = true;
- break;
- case "left":
- if (i%3 == 0) true; // do nothing
- else $sectors[i-1][ni].focused = true;
- break;
- case "right":
- if (i%3 == 2) true; // do nothing
- else $sectors[i+1][ni].focused = true;
- break;
- }
- }
-
- var numberCheck = function(s, ni, n)
- {
- var si = $sectors.indexof(s);
-
- // clear number
- if (n == "")
- {
- if ($sectors[si][ni].value == null) return false;
- $sectors[si][ni].value = null;
- return true;
- }
-
- // already filled in with this number
- if ($sectors[si][ni].value == n) return false;
-
- // check row for number
- for (var i=0; 9>i; i++)
- {
- if (i-(i%3) != si-(si%3)) continue;
- for (var j=0; 9>j; j++)
- {
- if (si == i and ni == j) continue;
- if (j-(j%3) != ni-(ni%3)) continue;
- if ($sectors[i][j].value != n) continue;
- $sectors[i][j].highlight();
- return false;
- }
- }
-
- // check column for number
- for (var i=0; 9>i; i++)
- {
- if (i%3 != si%3) continue;
- for (var j=0; 9>j; j++)
- {
- if (j%3 != ni%3) continue;
- if (si == i and ni == j) continue;
- if ($sectors[i][j].value != n) continue;
- $sectors[i][j].highlight();
- return false;
- }
- }
-
- // check sector for number
- for (var i=0; 9>i; i++)
- {
- if (i == ni) continue;
- if ($sectors[si][i].value == null) continue;
- if ($sectors[si][i].value != n) continue;
- $sectors[si][i].highlight();
- return false;
- }
-
- // all tests passed
- $sectors[si][ni].value = n;
- return true;
- }
-
- // assign functions
- for (var i=0; 9>i; i++)
- {
- $sectors[i].completed ++= complFunc;
- $sectors[i].move = sectorMove;
- $sectors[i].check = numberCheck;
- }
-
- // only clear player-entered values
- thisbox.clear = function()
- {
- for (var i=0; 9>i; i++) $sectors[i].clear();
- }
-
- // reset entire board
- thisbox.reset = function()
- {
- for (var i=0; 9>i; i++) $sectors[i].reset();
- }
-
- thisbox.setupBoard = function(board)
- {
- for (var i=0; 9>i; i++)
- for (var j=0; 9>j; j++)
- if (board[i][j] > -1)
- {
- $sectors[i][j].value = board[i][j];
- $sectors[i][j].numset = true;
- }
- }
-
- </wi:border>
-</vexi>
\ No newline at end of file
Deleted: some_apps/trunk/org.vexi.simplysudoku/gamelink.t
===================================================================
--- some_apps/trunk/org.vexi.simplysudoku/gamelink.t 2007-03-29 14:31:50 UTC
(rev 1762)
+++ some_apps/trunk/org.vexi.simplysudoku/gamelink.t 2007-03-29 15:38:11 UTC
(rev 1763)
@@ -1,9 +0,0 @@
-<!-- GPL v2 -->
-
-<vexi xmlns:ui="vexi://ui">
- <org.vexi.lib.role.clickable />
- <ui:box enabled="true" fontsize="20" shrink="true">
- hover ++= function(v) { textcolor = "red"; }
- normal ++= function(v) { textcolor = "black"; }
- </ui:box>
-</vexi>
\ No newline at end of file
Deleted: some_apps/trunk/org.vexi.simplysudoku/main.t
===================================================================
--- some_apps/trunk/org.vexi.simplysudoku/main.t 2007-03-29 14:31:50 UTC
(rev 1762)
+++ some_apps/trunk/org.vexi.simplysudoku/main.t 2007-03-29 15:38:11 UTC
(rev 1763)
@@ -1,67 +0,0 @@
-<!-- GPL v2 -->
-
-<vexi xmlns:wi="vexi.widget" xmlns:ui="vexi://ui">
- <wi:surface />
- <wi:cardpane fill="white" titlebar="Simply Sudoku!">
- <ui:box id="menu" cols="1">
- <ui:box text="Simply Sudoku!" fontsize="20" textcolor="green"
vshrink="true" />
- <ui:box vshrink="true">
- <gamelink id="start" text="Start Game" />
- </ui:box>
- <ui:box cols="1" vshrink="true">
- <ui:box text="Game Type" fontsize="16" textcolor="gray" />
- <gamelink id="gametype" text="Empty Board">
- var inc = 0;
- action ++= function(v)
- {
- inc++;
- switch(inc%2)
- {
- case 0: text = "Empty Board"; break;
- case 1: text = "Example"; break;
- }
- }
- </gamelink>
- </ui:box>
- <ui:box vshrink="true">
- <ui:box id="options" />
- </ui:box>
- </ui:box>
- <ui:box id="board" cols="1" hshrink="true">
- <ui:box>
- <ui:box text="Player1" align="left" />
- <ui:box text="Time: --:--" align="right" />
- </ui:box>
- <board id="sudoku" />
- <ui:box>
- <gamelink id="clear" fontsize="12" text="Clear" align="left" />
- <gamelink id="exit" fontsize="12" text="Exit" align="right" />
- </ui:box>
- </ui:box>
-
- vexi.ui.frame = thisbox;
-
- var exboard = [[-1,3,-1,-1,2,-1,4,7,1], [-1,9,-1,-1,-1,5,-1,-1,-1],
[7,2,-1,-1,1,-1,8,9,5],
- [-1,-1,-1,6,8,-1,-1,-1,7], [-1,-1,-1,-1,-1,9,-1,-1,-1],
[-1,-1,7,4,5,-1,2,-1,6],
- [7,6,-1,-1,1,9,-1,-1,5], [9,-1,2,4,-1,7,-1,-1,3],
[-1,-1,-1,-1,-1,-1,-1,-1,-1]];
-
- $start.action ++= function(v)
- {
- switch ($gametype.text)
- {
- case "Empty Board":
- $sudoku.reset();
- break;
- case "Example":
- $sudoku.reset();
- $sudoku.setupBoard(exboard);
- break;
- }
- show = $board;
- }
-
- $exit.action ++= function(v) { show = $menu; $sudoku.reset(); }
- $clear.action ++= function(v) { $sudoku.clear(); }
-
- </wi:cardpane>
-</vexi>
\ No newline at end of file
Deleted: some_apps/trunk/org.vexi.simplysudoku/number.t
===================================================================
--- some_apps/trunk/org.vexi.simplysudoku/number.t 2007-03-29 14:31:50 UTC
(rev 1762)
+++ some_apps/trunk/org.vexi.simplysudoku/number.t 2007-03-29 15:38:11 UTC
(rev 1763)
@@ -1,116 +0,0 @@
-<!-- GPL v2 -->
-
-<vexi xmlns:wi="vexi.widget" xmlns:ui="vexi://ui">
- <wi:border border="grey" depth="1" enabled="true">
- <ui:box id="control" packed="false" display="false" fill="#FFAAAA" />
- <ui:box id="content" packed="false" fontsize="16" />
- <wi:pad id="notes" packed="false" fontsize="8" padding="0 1 1 1" />
-
- minheight = vexi.ui.font.height($content.font, $content.fontsize,
"dy") + 12;
- minwidth = minheight;
-
- thisbox.focused ++= function(v) { $control.display = v; }
- thisbox.value ++= function(v) { $content.text = v; }
- thisbox.value ++= function() { return $content.text; }
- thisbox.numset ++= function(v) { $content.textcolor = v ? "#666666" :
"black"; }
-
- var notes = null;
- var tip = false;
-
- thisbox.addnote = function(v)
- {
- for (var i = 0; $notes.numchildren > i; i++)
- {
- if ($notes[i].text == v)
- {
- $notes[i] = null;
- return;
- }
- }
- var b = vexi.box;
- b.textcolor = "#666666";
- b.fontsize = $notes.fontsize;
- b.packed = false;
- b.shrink = true;
- b.text = v;
- switch (v)
- {
- case '1': b.align = "topleft"; break;
- case '2': b.align = "top"; break;
- case '3': b.align = "topright"; break;
- case '4': b.align = "left"; break;
- case '5': b.align = "center"; break;
- case '6': b.align = "right"; break;
- case '7': b.align = "bottomleft"; break;
- case '8': b.align = "bottom"; break;
- case '9': b.align = "bottomright"; break;
- }
- $notes[$notes.numchildren] = b;
- }
-
- thisbox.highlight = function(v)
- {
- if (tip) return;
- tip = true;
- $content.textcolor = "red";
- vexi.thread = function(v)
- {
- vexi.thread.sleep(2000);
- $content.textcolor = numset ? "#666666" : "black";
- }
- }
-
- //thisbox.check = function(n, v) { vexi.log.info("Implement
number.check()"); }
- //thisbox.move = function(n, v) { vexi.log.info("Implement
number.move()"); }
-
- KeyPressed ++= function(v)
- {
- switch (v)
- {
- case 'C-1': addnote('1'); break;
- case 'C-2': addnote('2'); break;
- case 'C-3': addnote('3'); break;
- case 'C-4': addnote('4'); break;
- case 'C-5': addnote('5'); break;
- case 'C-6': addnote('6'); break;
- case 'C-7': addnote('7'); break;
- case 'C-8': addnote('8'); break;
- case 'C-9': addnote('9'); break;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (numset) break;
- if (check(thisbox, v))
- {
- $content.text = v;
- $notes.display = false;
- }
- break;
- case "C-delete":
- case "C-back_space":
- while($notes.numchildren) $notes[0] = null;
- break;
- case "delete":
- case "back_space":
- if (numset) break;
- check(thisbox, "");
- $content.text = "";
- $notes.display = true;
- break;
- case "left":
- case "right":
- case "up":
- case "down":
- move(thisbox, v);
- }
- }
-
- </wi:border>
- <org.vexi.lib.role.focusable />
-</vexi>
\ No newline at end of file
Deleted: some_apps/trunk/org.vexi.simplysudoku/sector.t
===================================================================
--- some_apps/trunk/org.vexi.simplysudoku/sector.t 2007-03-29 14:31:50 UTC
(rev 1762)
+++ some_apps/trunk/org.vexi.simplysudoku/sector.t 2007-03-29 15:38:11 UTC
(rev 1763)
@@ -1,79 +0,0 @@
-<!-- GPL v2 -->
-
-<vexi xmlns:wi="vexi.widget" xmlns:ui="vexi://ui">
- <ui:box redirect="$numbers">
- <wi:border border="black" depth="1">
- <ui:box cols="3" id="numbers">
- <number />
- <number />
- <number />
- <number />
- <number />
- <number />
- <number />
- <number />
- <number />
- </ui:box>
- </wi:border>
-
- thisbox.completed = 0;
-
- //thisbox.check = function(s, ni, v) { vexi.log.info("Implement
sector.check()"); }
- //thisbox.move = function(s, v, i) { vexi.log.info("Implement
sector.move()"); }
-
- var numberMove = function(n, v)
- {
- var i = $numbers.indexof(n);
- if (i == -1) throw "Illegal number index";
- switch(v)
- {
- case "up":
- if (3 > i) move(thisbox, v, i+6);
- else $numbers[i-3].focused = true;
- break;
- case "down":
- if (i > 5) move(thisbox, v, i-6);
- else $numbers[i+3].focused = true;
- break;
- case "left":
- if (i%3 == 0) move(thisbox, v, i+2);
- else $numbers[i-1].focused = true;
- break;
- case "right":
- if (i%3 == 2) move(thisbox, v, i-2);
- else $numbers[i+1].focused = true;
- break;
- }
- }
-
- var numberCheck = function(n, v)
- {
- var ret = check(thisbox, $numbers.indexof(n), v);
- if (ret and v != "" and $numbers.value == "") completed++;
- if (ret and v == "") completed--;
- return ret;
- }
-
- for (var i=0; 9>i; i++)
- {
- $numbers[i].move = numberMove;
- $numbers[i].check = numberCheck;
- }
-
- thisbox.clear = function()
- {
- for (var i=0; 9>i; i++)
- if (!$numbers[i].numset) $numbers[i].value = "";
- }
-
- thisbox.reset = function()
- {
- for (var i=0; 9>i; i++)
- {
- $numbers[i].numset = false;
- $numbers[i].value = "";
- }
- }
-
- </ui:box>
-</vexi>
\ No newline at end of file
Added: some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/board.t
===================================================================
--- some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/board.t
(rev 0)
+++ some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/board.t
2007-03-29 15:38:11 UTC (rev 1763)
@@ -0,0 +1,140 @@
+<!-- GPL v2 -->
+
+<vexi xmlns:wi="vexi.widget" xmlns:ui="vexi://ui">
+ <wi:border border="black" depth="2" shrink="true">
+ <ui:box id="sectors" cols="3">
+ <sector />
+ <sector />
+ <sector />
+ <sector />
+ <sector />
+ <sector />
+ <sector />
+ <sector />
+ <sector />
+ </ui:box>
+
+ thisbox.completed = 0;
+
+ var complFunc = function(v)
+ {
+ if (v > 9) throw "More than 9 completed numbers not possible";
+ if (v == 9) completed ++;
+ else if (trapee.completed == 9) completed --;
+ }
+
+ var sectorMove = function(s, v, ni)
+ {
+ var i = $sectors.indexof(s);
+ switch(v)
+ {
+ case "up":
+ if (3 > i) true; // do nothing
+ else $sectors[i-3][ni].focused = true;
+ break;
+ case "down":
+ if (i > 5) true; // do nothing
+ else $sectors[i+3][ni].focused = true;
+ break;
+ case "left":
+ if (i%3 == 0) true; // do nothing
+ else $sectors[i-1][ni].focused = true;
+ break;
+ case "right":
+ if (i%3 == 2) true; // do nothing
+ else $sectors[i+1][ni].focused = true;
+ break;
+ }
+ }
+
+ var numberCheck = function(s, ni, n)
+ {
+ var si = $sectors.indexof(s);
+
+ // clear number
+ if (n == "")
+ {
+ if ($sectors[si][ni].value == null) return false;
+ $sectors[si][ni].value = null;
+ return true;
+ }
+
+ // already filled in with this number
+ if ($sectors[si][ni].value == n) return false;
+
+ // check row for number
+ for (var i=0; 9>i; i++)
+ {
+ if (i-(i%3) != si-(si%3)) continue;
+ for (var j=0; 9>j; j++)
+ {
+ if (si == i and ni == j) continue;
+ if (j-(j%3) != ni-(ni%3)) continue;
+ if ($sectors[i][j].value != n) continue;
+ $sectors[i][j].highlight();
+ return false;
+ }
+ }
+
+ // check column for number
+ for (var i=0; 9>i; i++)
+ {
+ if (i%3 != si%3) continue;
+ for (var j=0; 9>j; j++)
+ {
+ if (j%3 != ni%3) continue;
+ if (si == i and ni == j) continue;
+ if ($sectors[i][j].value != n) continue;
+ $sectors[i][j].highlight();
+ return false;
+ }
+ }
+
+ // check sector for number
+ for (var i=0; 9>i; i++)
+ {
+ if (i == ni) continue;
+ if ($sectors[si][i].value == null) continue;
+ if ($sectors[si][i].value != n) continue;
+ $sectors[si][i].highlight();
+ return false;
+ }
+
+ // all tests passed
+ $sectors[si][ni].value = n;
+ return true;
+ }
+
+ // assign functions
+ for (var i=0; 9>i; i++)
+ {
+ $sectors[i].completed ++= complFunc;
+ $sectors[i].move = sectorMove;
+ $sectors[i].check = numberCheck;
+ }
+
+ // only clear player-entered values
+ thisbox.clear = function()
+ {
+ for (var i=0; 9>i; i++) $sectors[i].clear();
+ }
+
+ // reset entire board
+ thisbox.reset = function()
+ {
+ for (var i=0; 9>i; i++) $sectors[i].reset();
+ }
+
+ thisbox.setupBoard = function(board)
+ {
+ for (var i=0; 9>i; i++)
+ for (var j=0; 9>j; j++)
+ if (board[i][j] > -1)
+ {
+ $sectors[i][j].value = board[i][j];
+ $sectors[i][j].numset = true;
+ }
+ }
+
+ </wi:border>
+</vexi>
\ No newline at end of file
Added:
some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/gamelink.t
===================================================================
--- some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/gamelink.t
(rev 0)
+++ some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/gamelink.t
2007-03-29 15:38:11 UTC (rev 1763)
@@ -0,0 +1,9 @@
+<!-- GPL v2 -->
+
+<vexi xmlns:ui="vexi://ui">
+ <org.vexi.lib.role.clickable />
+ <ui:box enabled="true" fontsize="20" shrink="true">
+ hover ++= function(v) { textcolor = "red"; }
+ normal ++= function(v) { textcolor = "black"; }
+ </ui:box>
+</vexi>
\ No newline at end of file
Added: some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/main.t
===================================================================
--- some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/main.t
(rev 0)
+++ some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/main.t
2007-03-29 15:38:11 UTC (rev 1763)
@@ -0,0 +1,67 @@
+<!-- GPL v2 -->
+
+<vexi xmlns:wi="vexi.widget" xmlns:ui="vexi://ui">
+ <wi:surface />
+ <wi:cardpane fill="white" titlebar="Simply Sudoku!">
+ <ui:box id="menu" cols="1">
+ <ui:box text="Simply Sudoku!" fontsize="20" textcolor="green"
vshrink="true" />
+ <ui:box vshrink="true">
+ <gamelink id="start" text="Start Game" />
+ </ui:box>
+ <ui:box cols="1" vshrink="true">
+ <ui:box text="Game Type" fontsize="16" textcolor="gray" />
+ <gamelink id="gametype" text="Empty Board">
+ var inc = 0;
+ action ++= function(v)
+ {
+ inc++;
+ switch(inc%2)
+ {
+ case 0: text = "Empty Board"; break;
+ case 1: text = "Example"; break;
+ }
+ }
+ </gamelink>
+ </ui:box>
+ <ui:box vshrink="true">
+ <ui:box id="options" />
+ </ui:box>
+ </ui:box>
+ <ui:box id="board" cols="1" hshrink="true">
+ <ui:box>
+ <ui:box text="Player1" align="left" />
+ <ui:box text="Time: --:--" align="right" />
+ </ui:box>
+ <board id="sudoku" />
+ <ui:box>
+ <gamelink id="clear" fontsize="12" text="Clear" align="left" />
+ <gamelink id="exit" fontsize="12" text="Exit" align="right" />
+ </ui:box>
+ </ui:box>
+
+ vexi.ui.frame = thisbox;
+
+ var exboard = [[-1,3,-1,-1,2,-1,4,7,1], [-1,9,-1,-1,-1,5,-1,-1,-1],
[7,2,-1,-1,1,-1,8,9,5],
+ [-1,-1,-1,6,8,-1,-1,-1,7], [-1,-1,-1,-1,-1,9,-1,-1,-1],
[-1,-1,7,4,5,-1,2,-1,6],
+ [7,6,-1,-1,1,9,-1,-1,5], [9,-1,2,4,-1,7,-1,-1,3],
[-1,-1,-1,-1,-1,-1,-1,-1,-1]];
+
+ $start.action ++= function(v)
+ {
+ switch ($gametype.text)
+ {
+ case "Empty Board":
+ $sudoku.reset();
+ break;
+ case "Example":
+ $sudoku.reset();
+ $sudoku.setupBoard(exboard);
+ break;
+ }
+ show = $board;
+ }
+
+ $exit.action ++= function(v) { show = $menu; $sudoku.reset(); }
+ $clear.action ++= function(v) { $sudoku.clear(); }
+
+ </wi:cardpane>
+</vexi>
\ No newline at end of file
Added: some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/number.t
===================================================================
--- some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/number.t
(rev 0)
+++ some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/number.t
2007-03-29 15:38:11 UTC (rev 1763)
@@ -0,0 +1,116 @@
+<!-- GPL v2 -->
+
+<vexi xmlns:wi="vexi.widget" xmlns:ui="vexi://ui">
+ <wi:border border="grey" depth="1" enabled="true">
+ <ui:box id="control" packed="false" display="false" fill="#FFAAAA" />
+ <ui:box id="content" packed="false" fontsize="16" />
+ <wi:pad id="notes" packed="false" fontsize="8" padding="0 1 1 1" />
+
+ minheight = vexi.ui.font.height($content.font, $content.fontsize,
"dy") + 12;
+ minwidth = minheight;
+
+ thisbox.focused ++= function(v) { $control.display = v; }
+ thisbox.value ++= function(v) { $content.text = v; }
+ thisbox.value ++= function() { return $content.text; }
+ thisbox.numset ++= function(v) { $content.textcolor = v ? "#666666" :
"black"; }
+
+ var notes = null;
+ var tip = false;
+
+ thisbox.addnote = function(v)
+ {
+ for (var i = 0; $notes.numchildren > i; i++)
+ {
+ if ($notes[i].text == v)
+ {
+ $notes[i] = null;
+ return;
+ }
+ }
+ var b = vexi.box;
+ b.textcolor = "#666666";
+ b.fontsize = $notes.fontsize;
+ b.packed = false;
+ b.shrink = true;
+ b.text = v;
+ switch (v)
+ {
+ case '1': b.align = "topleft"; break;
+ case '2': b.align = "top"; break;
+ case '3': b.align = "topright"; break;
+ case '4': b.align = "left"; break;
+ case '5': b.align = "center"; break;
+ case '6': b.align = "right"; break;
+ case '7': b.align = "bottomleft"; break;
+ case '8': b.align = "bottom"; break;
+ case '9': b.align = "bottomright"; break;
+ }
+ $notes[$notes.numchildren] = b;
+ }
+
+ thisbox.highlight = function(v)
+ {
+ if (tip) return;
+ tip = true;
+ $content.textcolor = "red";
+ vexi.thread = function(v)
+ {
+ vexi.thread.sleep(2000);
+ $content.textcolor = numset ? "#666666" : "black";
+ }
+ }
+
+ //thisbox.check = function(n, v) { vexi.log.info("Implement
number.check()"); }
+ //thisbox.move = function(n, v) { vexi.log.info("Implement
number.move()"); }
+
+ KeyPressed ++= function(v)
+ {
+ switch (v)
+ {
+ case 'C-1': addnote('1'); break;
+ case 'C-2': addnote('2'); break;
+ case 'C-3': addnote('3'); break;
+ case 'C-4': addnote('4'); break;
+ case 'C-5': addnote('5'); break;
+ case 'C-6': addnote('6'); break;
+ case 'C-7': addnote('7'); break;
+ case 'C-8': addnote('8'); break;
+ case 'C-9': addnote('9'); break;
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (numset) break;
+ if (check(thisbox, v))
+ {
+ $content.text = v;
+ $notes.display = false;
+ }
+ break;
+ case "C-delete":
+ case "C-back_space":
+ while($notes.numchildren) $notes[0] = null;
+ break;
+ case "delete":
+ case "back_space":
+ if (numset) break;
+ check(thisbox, "");
+ $content.text = "";
+ $notes.display = true;
+ break;
+ case "left":
+ case "right":
+ case "up":
+ case "down":
+ move(thisbox, v);
+ }
+ }
+
+ </wi:border>
+ <org.vexi.lib.role.focusable />
+</vexi>
\ No newline at end of file
Added: some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/sector.t
===================================================================
--- some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/sector.t
(rev 0)
+++ some_apps/trunk/org.vexi.simplysudoku/src/org/vexi/simplysudoku/sector.t
2007-03-29 15:38:11 UTC (rev 1763)
@@ -0,0 +1,79 @@
+<!-- GPL v2 -->
+
+<vexi xmlns:wi="vexi.widget" xmlns:ui="vexi://ui">
+ <ui:box redirect="$numbers">
+ <wi:border border="black" depth="1">
+ <ui:box cols="3" id="numbers">
+ <number />
+ <number />
+ <number />
+ <number />
+ <number />
+ <number />
+ <number />
+ <number />
+ <number />
+ </ui:box>
+ </wi:border>
+
+ thisbox.completed = 0;
+
+ //thisbox.check = function(s, ni, v) { vexi.log.info("Implement
sector.check()"); }
+ //thisbox.move = function(s, v, i) { vexi.log.info("Implement
sector.move()"); }
+
+ var numberMove = function(n, v)
+ {
+ var i = $numbers.indexof(n);
+ if (i == -1) throw "Illegal number index";
+ switch(v)
+ {
+ case "up":
+ if (3 > i) move(thisbox, v, i+6);
+ else $numbers[i-3].focused = true;
+ break;
+ case "down":
+ if (i > 5) move(thisbox, v, i-6);
+ else $numbers[i+3].focused = true;
+ break;
+ case "left":
+ if (i%3 == 0) move(thisbox, v, i+2);
+ else $numbers[i-1].focused = true;
+ break;
+ case "right":
+ if (i%3 == 2) move(thisbox, v, i-2);
+ else $numbers[i+1].focused = true;
+ break;
+ }
+ }
+
+ var numberCheck = function(n, v)
+ {
+ var ret = check(thisbox, $numbers.indexof(n), v);
+ if (ret and v != "" and $numbers.value == "") completed++;
+ if (ret and v == "") completed--;
+ return ret;
+ }
+
+ for (var i=0; 9>i; i++)
+ {
+ $numbers[i].move = numberMove;
+ $numbers[i].check = numberCheck;
+ }
+
+ thisbox.clear = function()
+ {
+ for (var i=0; 9>i; i++)
+ if (!$numbers[i].numset) $numbers[i].value = "";
+ }
+
+ thisbox.reset = function()
+ {
+ for (var i=0; 9>i; i++)
+ {
+ $numbers[i].numset = false;
+ $numbers[i].value = "";
+ }
+ }
+
+ </ui:box>
+</vexi>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn