[Picross-commit] SF.net SVN: picross: [12] trunk/src/picross/grid
Status: Pre-Alpha
Brought to you by:
yvan_norsa
|
From: <yva...@us...> - 2007-06-06 12:07:45
|
Revision: 12
http://picross.svn.sourceforge.net/picross/?rev=12&view=rev
Author: yvan_norsa
Date: 2007-06-06 05:07:47 -0700 (Wed, 06 Jun 2007)
Log Message:
-----------
allows to directly cross a checked box and vice-versa
Modified Paths:
--------------
trunk/src/picross/grid/PicrossGridController.java
trunk/src/picross/grid/PicrossGridModel.java
Modified: trunk/src/picross/grid/PicrossGridController.java
===================================================================
--- trunk/src/picross/grid/PicrossGridController.java 2007-06-06 11:42:57 UTC (rev 11)
+++ trunk/src/picross/grid/PicrossGridController.java 2007-06-06 12:07:47 UTC (rev 12)
@@ -172,6 +172,8 @@
int column = this.view.getColumn(point);
int type = PicrossGridController.modifiersToType(modifiers);
+ //PicrossGridController.log.debug("type : " + type);
+
this.fireEventPerformed(PicrossGridController.FILL_CMD,
new FillCommand(row, column, type));
@@ -189,7 +191,7 @@
case MouseEvent.BUTTON1_MASK:
return PicrossGridController.CHECK_ACTION;
- case MouseEvent.BUTTON2_MASK:
+ case MouseEvent.BUTTON3_MASK:
return PicrossGridController.CROSS_ACTION;
default:
Modified: trunk/src/picross/grid/PicrossGridModel.java
===================================================================
--- trunk/src/picross/grid/PicrossGridModel.java 2007-06-06 11:42:57 UTC (rev 11)
+++ trunk/src/picross/grid/PicrossGridModel.java 2007-06-06 12:07:47 UTC (rev 12)
@@ -36,7 +36,7 @@
import java.util.ArrayList;
import java.util.List;
-//import org.apache.log4j.Logger;
+import org.apache.log4j.Logger;
/**
* The grid model.
@@ -52,7 +52,7 @@
/*** Static field ***/
/** The class' logger. */
- //private static Logger log = Logger.getLogger(PicrossGridModel.class);
+ private static Logger log = Logger.getLogger(PicrossGridModel.class);
/*** Fields ***/
@@ -234,9 +234,9 @@
* @param column column of the box
*/
void checkBox(int row, int column, int type) {
- //PicrossGridModel.log.debug("checkBox(" + row + ", " + column + ")");
- //PicrossGridModel.log.debug("lastChecked == null : "
- // + (lastChecked == null));
+ PicrossGridModel.log.debug("checkBox(" + row + ", " + column + ")");
+ //PicrossGridModel.log.debug("lastModified == null : "
+ // + (lastModified == null));
/*
* If we are trying to check the last box we just checked
@@ -264,6 +264,7 @@
if (type == PicrossGridController.CHECK_ACTION) {
this.boxes[row][column].check();
+ this.checkCompleted();
} else { //if (type == PicrossGridController.CROSS_ACTION) {
this.boxes[row][column].cross();
}
@@ -272,13 +273,36 @@
} else if (!this.boxes[row][column].isEmpty()
&& (this.lastModified == null
|| this.lastModified.isEmpty())) {
- this.boxes[row][column].empty();
- this.mediator.uncheck(row, column, type);
+ if (this.boxes[row][column].isChecked()) {
+ //PicrossGridModel.log.debug("checked");
+
+ if (type == PicrossGridController.CHECK_ACTION) {
+ this.boxes[row][column].empty();
+ this.mediator.uncheck(row, column, type);
+ } else { //if (type == PicrossGridController.CROSS_ACTION) {
+ this.boxes[row][column].cross();
+ this.mediator.check(row, column,
+ PicrossGridController.CROSS_ACTION);
+ }
+ } else { //if (this.boxes[row][column].isCrossed())\xA0{
+ //PicrossGridModel.log.debug("crossed");
+
+ if (type == PicrossGridController.CROSS_ACTION) {
+ this.boxes[row][column].empty();
+ this.mediator.uncheck(row, column, type);
+ } else {
+ //PicrossGridModel.log.debug("check()");
+
+ this.boxes[row][column].check();
+ this.mediator.check(row, column,
+ PicrossGridController.CHECK_ACTION);
+ this.checkCompleted();
+ }
+ }
}
this.lastModified = this.boxes[row][column];
- this.checkCompleted();
}
/** Checks wether the grid is finished. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|