[Picross-commit] SF.net SVN: picross:[136] trunk
Status: Pre-Alpha
Brought to you by:
yvan_norsa
|
From: <yva...@us...> - 2013-01-28 08:42:44
|
Revision: 136
http://sourceforge.net/p/picross/code/136
Author: yvan_norsa
Date: 2013-01-28 08:42:39 +0000 (Mon, 28 Jan 2013)
Log Message:
-----------
add 'reset' button
Modified Paths:
--------------
trunk/android/src/picross/specific/game/ui/GameController.java
trunk/android/src/picross/specific/game/ui/GameMediator.java
trunk/android/src/picross/specific/game/ui/GameUI.java
trunk/android/src/picross/specific/grid/ui/GridUI.java
trunk/common/src/picross/common/grid/ui/AbstractGridMediator.java
trunk/common/src/picross/common/grid/ui/GridCommands.java
trunk/common/src/picross/common/grid/ui/IGridMediator.java
trunk/common/src/picross/common/ui/PicrossController.java
trunk/common/src/picross/specific/grid/ui/GridUI.java
trunk/engine/src/picross/engine/grid/GridModel.java
trunk/properties/messages_picross.properties
trunk/properties/messages_picross_fr.properties
trunk/swing/src/picross/specific/game/ui/GameController.java
trunk/swing/src/picross/specific/game/ui/GameMediator.java
trunk/swing/src/picross/specific/game/ui/GameUI.java
trunk/swing/src/picross/specific/grid/ui/GridController.java
trunk/swing/src/picross/specific/grid/ui/GridUI.java
Added Paths:
-----------
trunk/common/src/picross/common/game/ui/AbstractGameMediator.java
trunk/common/src/picross/specific/game/ui/GameController.java
trunk/common/src/picross/specific/game/ui/GameUI.java
Removed Paths:
-------------
trunk/common/src/picross/common/game/ui/GameMediator.java
Modified: trunk/android/src/picross/specific/game/ui/GameController.java
===================================================================
--- trunk/android/src/picross/specific/game/ui/GameController.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/android/src/picross/specific/game/ui/GameController.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -57,6 +57,8 @@
public static final int QUIT_CMD_ID = PicrossController.QUIT_CMD.hashCode();
+ public static final int RESET_CMD_ID = PicrossController.RESET_CMD.hashCode();
+
/*** Method overloaded from the class Controller ***/
/** {@inheritDoc} */
@@ -92,6 +94,11 @@
return;
}
+ if (itemId == GameController.RESET_CMD_ID) {
+ this.fireEventPerformed(PicrossController.RESET_CMD);
+ return;
+ }
+
super.onPicrossEvent(e);
}
}
Modified: trunk/android/src/picross/specific/game/ui/GameMediator.java
===================================================================
--- trunk/android/src/picross/specific/game/ui/GameMediator.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/android/src/picross/specific/game/ui/GameMediator.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -33,7 +33,6 @@
package picross.specific.game.ui;
-import fr.cle.mmvcs.Mediateur;
import fr.cle.mmvcs.SimpleEvent;
import picross.engine.PicrossLogger;
@@ -46,52 +45,21 @@
import picross.common.grid.ui.GridView;
import picross.common.grid.ui.IGridMediator;
+import picross.common.game.ui.AbstractGameMediator;
+
import picross.common.game.ui.GameView;
import android.content.Context;
import picross.specific.ui.MenuController;
-public abstract class GameMediator extends Mediateur {
- /*** Static field ***/
-
- /** The class' logger. */
- private static PicrossLogger log = PicrossLogHelper.getLogger(GameMediator.class);
-
- /*** Fields ***/
-
- /** The game view. */
- private GameUI view;
-
- /** The game grid. */
- private IGridMediator grid;
-
+public abstract class GameMediator extends AbstractGameMediator {
protected Context context;
public GameMediator(Context androidContext) {
this.context = androidContext;
}
- /*** Abstract method ***/
-
- /**
- * Creates the model.
- *
- * @return grid model
- * @throws PicrossException if there is a problem
- */
- protected abstract PicrossGrid initModel() throws PicrossException;
-
- /*** Method overloaded from the class Mediator ***/
-
- /** {@inheritDoc} */
- @Override
- public void eventPerformed(SimpleEvent e) {
- GameMediator.log.debug("eventPerformed(" + e + ")");
-
- this.fireEventPerformed(e);
- }
-
/*** Methods ***/
/**
@@ -135,22 +103,19 @@
return new GameUI(this.context, width, height, gridView, controller);
}
- /**
- * Initialises the controller.
- *
- * @return the created controller
- */
+ @Override
+ public void eventPerformed(SimpleEvent e) {
+ //GameMediator.log.debug("eventPerformed(" + e + ")");
- protected GameController initController() {
- return new GameController();
- }
+ String cmd = e.getCommandName();
- /**
- * Returns the game view.
- *
- * @return the view
- */
- public final GameView getView() {
- return this.view;
+ if (cmd.equals(picross.common.ui.PicrossController.RESET_CMD)) {
+ this.grid.clear();
+ this.view.repaint();
+
+ return;
+ }
+
+ this.fireEventPerformed(e);
}
}
Modified: trunk/android/src/picross/specific/game/ui/GameUI.java
===================================================================
--- trunk/android/src/picross/specific/game/ui/GameUI.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/android/src/picross/specific/game/ui/GameUI.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -180,6 +180,7 @@
public void populateOptionsMenu(Menu menu) {
menu.clear();
+ menu.add(Menu.NONE, GameController.RESET_CMD_ID, Menu.NONE, BundleHelper.getString(this, "resetButton"));
menu.add(Menu.NONE, GameController.QUIT_CMD_ID, Menu.NONE, BundleHelper.getString(this, "menuButton"));
}
@@ -193,4 +194,8 @@
protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec) {
this.setMeasuredDimension(this.grid.getWidth(), this.grid.getHeight());
}
+
+ public void repaint() {
+ this.invalidate();
+ }
}
Modified: trunk/android/src/picross/specific/grid/ui/GridUI.java
===================================================================
--- trunk/android/src/picross/specific/grid/ui/GridUI.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/android/src/picross/specific/grid/ui/GridUI.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -711,6 +711,20 @@
this.boxes[row][col].updateState(box);
}
+ public void clearAll() {
+ for (UIBox[] boxRow : this.boxes) {
+ for (UIBox box : boxRow) {
+ box.updateState(GridUI.EMPTY_BOX);
+ }
+ }
+ }
+
+ private static final Box EMPTY_BOX = new Box();
+
+ public void doRepaint() {
+ //this.repaint();
+ }
+
@Override
public boolean onTouch(View view, MotionEvent event) {
this.controller.onTouch(null, event);
Copied: trunk/common/src/picross/common/game/ui/AbstractGameMediator.java (from rev 134, trunk/common/src/picross/common/game/ui/GameMediator.java)
===================================================================
--- trunk/common/src/picross/common/game/ui/AbstractGameMediator.java (rev 0)
+++ trunk/common/src/picross/common/game/ui/AbstractGameMediator.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -0,0 +1,124 @@
+/*
+ * $Id$
+ *
+ * Copyright (c) 2007-2013
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+
+package picross.common.game.ui;
+
+import fr.cle.mmvcs.Mediateur;
+
+import picross.engine.PicrossException;
+import picross.engine.grid.PicrossGrid;
+
+import picross.engine.PicrossLogger;
+import picross.engine.PicrossLogHelper;
+
+import picross.specific.game.ui.GameUI;
+import picross.specific.game.ui.GameController;
+
+import picross.common.grid.ui.IGridMediator;
+import picross.common.grid.ui.GridView;
+
+import picross.common.ui.PicrossController;
+
+import fr.cle.mmvcs.SimpleEvent;
+
+public abstract class AbstractGameMediator extends Mediateur {
+ /*** Static field ***/
+
+ /** The class' logger. */
+ private static PicrossLogger log = PicrossLogHelper.getLogger(AbstractGameMediator.class);
+
+ /*** Fields ***/
+
+ /** The game view. */
+ protected GameUI view;
+
+ /** The game grid. */
+ protected IGridMediator grid;
+
+ /*** Abstrac method ***/
+
+ /**
+ * Creates the model.
+ *
+ * @return grid model
+ * @throws PicrossException if there is a problem
+ */
+ protected abstract PicrossGrid initModel() throws PicrossException;
+
+ /*** Method overloaded from the class Mediator ***/
+
+ /** {@inheritDoc} */
+ @Override
+ public void eventPerformed(SimpleEvent e) {
+ //GameMediator.log.debug("eventPerformed(" + e + ")");
+
+ String cmd = e.getCommandName();
+
+ if (cmd.equals(PicrossController.RESET_CMD)) {
+ this.grid.clear();
+ return;
+ }
+
+ this.fireEventPerformed(e);
+ }
+
+ /*** Methods ***/
+
+ /**
+ * Inits the game.
+ *
+ * @throws PicrossException if there is a problem loading the grid model
+ * or building the view
+ */
+ public abstract void init() throws PicrossException;
+
+ /**
+ * Initialises the controller.
+ *
+ * @return the created controller
+ */
+ protected GameController initController() {
+ return new GameController();
+ }
+
+ /**
+ * Returns the game view.
+ *
+ * @return the view
+ */
+ public final GameView getView() {
+ return this.view;
+ }
+
+}
+
Deleted: trunk/common/src/picross/common/game/ui/GameMediator.java
===================================================================
--- trunk/common/src/picross/common/game/ui/GameMediator.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/common/src/picross/common/game/ui/GameMediator.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -1,45 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (c) 2007-2013
- *
- * This software is governed by the CeCILL license under French law and
- * abiding by the rules of distribution of free software. You can use,
- * modify and/ or redistribute the software under the terms of the CeCILL
- * license as circulated by CEA, CNRS and INRIA at the following URL
- * "http://www.cecill.info".
- *
- * As a counterpart to the access to the source code and rights to copy,
- * modify and redistribute granted by the license, users are provided only
- * with a limited warranty and the software's author, the holder of the
- * economic rights, and the successive licensors have only limited
- * liability.
- *
- * In this respect, the user's attention is drawn to the risks associated
- * with loading, using, modifying and/or developing or reproducing the
- * software by the user in light of its specific status of free software,
- * that may mean that it is complicated to manipulate, and that also
- * therefore means that it is reserved for developers and experienced
- * professionals having in-depth computer knowledge. Users are therefore
- * encouraged to load and test the software's suitability as regards their
- * requirements in conditions enabling the security of their systems and/or
- * data to be ensured and, more generally, to use and operate it in the
- * same conditions as regards security.
- *
- * The fact that you are presently reading this means that you have had
- * knowledge of the CeCILL license and that you accept its terms.
- */
-
-
-package picross.common.game.ui;
-
-import fr.cle.mmvcs.IMediateur;
-
-import picross.engine.PicrossException;
-import picross.engine.grid.PicrossGrid;
-
-public interface GameMediator extends IMediateur {
- PicrossGrid initModel() throws PicrossException;
- void init() throws PicrossException;
-}
-
Modified: trunk/common/src/picross/common/grid/ui/AbstractGridMediator.java
===================================================================
--- trunk/common/src/picross/common/grid/ui/AbstractGridMediator.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/common/src/picross/common/grid/ui/AbstractGridMediator.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -217,6 +217,12 @@
this.fireEventPerformed(GridCommands.ERASE_MODE_CMD);
}
+ public void clear() {
+ this.model.clearAll();
+ this.view.clearAll();
+ this.fireEventPerformed(GridCommands.REPAINT_EVERYTHING_CMD);
+ }
+
/*** Accessor ***/
/**
Modified: trunk/common/src/picross/common/grid/ui/GridCommands.java
===================================================================
--- trunk/common/src/picross/common/grid/ui/GridCommands.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/common/src/picross/common/grid/ui/GridCommands.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -60,5 +60,7 @@
/** Command asking to enable the Erase mode. */
public static final String ERASE_MODE_CMD = "ERASE_MODE_CMD";
+ public static final String REPAINT_EVERYTHING_CMD = "REPAINT_EVERYTHING_CMD";
+
private GridCommands() { }
}
Modified: trunk/common/src/picross/common/grid/ui/IGridMediator.java
===================================================================
--- trunk/common/src/picross/common/grid/ui/IGridMediator.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/common/src/picross/common/grid/ui/IGridMediator.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -61,6 +61,8 @@
/** Enables the erase mode. */
void setEraseMode();
+ void clear();
+
/**
* Returns the grid view.
*
Modified: trunk/common/src/picross/common/ui/PicrossController.java
===================================================================
--- trunk/common/src/picross/common/ui/PicrossController.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/common/src/picross/common/ui/PicrossController.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -56,6 +56,8 @@
/** Command used to quit a game. */
public static final String QUIT_CMD = "QUIT_CMD";
+ public static final String RESET_CMD = "RESET_CMD";
+
/*** Field ***/
/** The view to which this controller is attached. */
Added: trunk/common/src/picross/specific/game/ui/GameController.java
===================================================================
--- trunk/common/src/picross/specific/game/ui/GameController.java (rev 0)
+++ trunk/common/src/picross/specific/game/ui/GameController.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -0,0 +1,43 @@
+/*
+ * $Id$
+ *
+ * Copyright (c) 2008-2013
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+
+package picross.specific.game.ui;
+
+import fr.cle.mmvcs.Controller;
+import fr.cle.mmvcs.SimpleEvent;
+
+public class GameController extends Controller {
+ public void eventPerformed(SimpleEvent event) { }
+}
+
+
Property changes on: trunk/common/src/picross/specific/game/ui/GameController.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Added: trunk/common/src/picross/specific/game/ui/GameUI.java
===================================================================
--- trunk/common/src/picross/specific/game/ui/GameUI.java (rev 0)
+++ trunk/common/src/picross/specific/game/ui/GameUI.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -0,0 +1,39 @@
+/*
+ * $Id$
+ *
+ * Copyright (c) 2007-2013
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+
+package picross.specific.game.ui;
+
+import picross.common.game.ui.GameView;
+
+public class GameUI implements GameView { }
+
Property changes on: trunk/common/src/picross/specific/game/ui/GameUI.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Modified: trunk/common/src/picross/specific/grid/ui/GridUI.java
===================================================================
--- trunk/common/src/picross/specific/grid/ui/GridUI.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/common/src/picross/specific/grid/ui/GridUI.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -50,4 +50,5 @@
public void init() throws FileNotFoundException { }
public void updateBox(int row, int col, Box box) { }
+ public void clearAll() { }
}
Modified: trunk/engine/src/picross/engine/grid/GridModel.java
===================================================================
--- trunk/engine/src/picross/engine/grid/GridModel.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/engine/src/picross/engine/grid/GridModel.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -117,8 +117,8 @@
this.rowData = GridModel.getRowHints(this.data);
this.completedHints =
- new CompletedHints(data.length, this.colData[0].length,
- data[0].length, this.rowData[0].length);
+ new CompletedHints(this.data.length, this.colData[0].length,
+ this.data[0].length, this.rowData[0].length);
/*
* Marks the empty rows and columns as completed
@@ -1036,5 +1036,15 @@
public CompletedHints getCompletedHints() {
return this.completedHints;
}
+
+ public void clearAll() {
+ //for (Box[] boxRow : this.boxes) {
+ // for (Box box : boxRow) {
+ for (int i = 0; i < this.boxes.length; i++) {
+ for (int j = 0; j < this.boxes[i].length; j++) {
+ this.actOnBox(j, i, GridAction.EMPTY);
+ }
+ }
+ }
}
Modified: trunk/properties/messages_picross.properties
===================================================================
--- trunk/properties/messages_picross.properties 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/properties/messages_picross.properties 2013-01-28 08:42:39 UTC (rev 136)
@@ -4,6 +4,7 @@
# picross.game.GameUI
gridSize = Size
menuButton = Back to menu
+resetButton = Reset
# picross.game.random.RandomGameUI
anotherGrid = Another grid
Modified: trunk/properties/messages_picross_fr.properties
===================================================================
--- trunk/properties/messages_picross_fr.properties 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/properties/messages_picross_fr.properties 2013-01-28 08:42:39 UTC (rev 136)
@@ -4,6 +4,7 @@
# picross.game.GameUI
gridSize = Taille
menuButton = Retour au menu
+resetButton = Recommencer
# picross.game.random.RandomGameUI
anotherGrid = Une autre grille
Modified: trunk/swing/src/picross/specific/game/ui/GameController.java
===================================================================
--- trunk/swing/src/picross/specific/game/ui/GameController.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/swing/src/picross/specific/game/ui/GameController.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -74,6 +74,11 @@
this.fireEventPerformed(cmd);
return;
}
+
+ if (cmd.equals(PicrossController.RESET_CMD)) {
+ this.fireEventPerformed(cmd);
+ return;
+ }
}
}
Modified: trunk/swing/src/picross/specific/game/ui/GameMediator.java
===================================================================
--- trunk/swing/src/picross/specific/game/ui/GameMediator.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/swing/src/picross/specific/game/ui/GameMediator.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -33,7 +33,6 @@
package picross.specific.game.ui;
-import fr.cle.mmvcs.Mediateur;
import fr.cle.mmvcs.SimpleEvent;
import java.awt.event.ActionListener;
@@ -50,6 +49,7 @@
import picross.common.grid.ui.GridView;
import picross.common.grid.ui.IGridMediator;
+import picross.common.game.ui.AbstractGameMediator;
import picross.common.game.ui.GameView;
/**
@@ -57,40 +57,7 @@
*
* @author Y. Norsa
*/
-public abstract class GameMediator extends Mediateur {
- /*** Static field ***/
-
- /** The class' logger. */
- private static PicrossLogger log = PicrossLogHelper.getLogger(GameMediator.class);
-
- /*** Fields ***/
-
- /** The game view. */
- private GameUI view;
-
- /** The game grid. */
- private IGridMediator grid;
-
- /*** Abstrac method ***/
-
- /**
- * Creates the model.
- *
- * @return grid model
- * @throws PicrossException if there is a problem
- */
- protected abstract PicrossGrid initModel() throws PicrossException;
-
- /*** Method overloaded from the class Mediator ***/
-
- /** {@inheritDoc} */
- @Override
- public void eventPerformed(SimpleEvent e) {
- //GameMediator.log.debug("eventPerformed(" + e + ")");
-
- this.fireEventPerformed(e);
- }
-
+public abstract class GameMediator extends AbstractGameMediator {
/*** Methods ***/
/**
@@ -137,22 +104,4 @@
ActionListener controller) {
return new GameUI(width, height, gridView, controller);
}
-
- /**
- * Initialises the controller.
- *
- * @return the created controller
- */
- protected GameController initController() {
- return new GameController();
- }
-
- /**
- * Returns the game view.
- *
- * @return the view
- */
- public final GameView getView() {
- return this.view;
- }
}
Modified: trunk/swing/src/picross/specific/game/ui/GameUI.java
===================================================================
--- trunk/swing/src/picross/specific/game/ui/GameUI.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/swing/src/picross/specific/game/ui/GameUI.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -109,6 +109,11 @@
this.buttonsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
this.buttonsPanel.setBackground(Color.WHITE);
+ JButton resetButton = new JButton(BundleHelper.getString(this, "resetButton"));
+ resetButton.addActionListener(listener);
+ resetButton.setActionCommand(PicrossController.RESET_CMD);
+ this.buttonsPanel.add(resetButton);
+
JButton menuButton = new JButton(BundleHelper.getString(this,
"menuButton"));
menuButton.addActionListener(listener);
Modified: trunk/swing/src/picross/specific/grid/ui/GridController.java
===================================================================
--- trunk/swing/src/picross/specific/grid/ui/GridController.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/swing/src/picross/specific/grid/ui/GridController.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -106,6 +106,11 @@
this.eraseMode = true;
return;
}
+
+ if (cmd.equals(GridCommands.REPAINT_EVERYTHING_CMD)) {
+ this.view.doRepaint();
+ return;
+ }
}
/*** Methods implanted from the interface MouseListener ***/
Modified: trunk/swing/src/picross/specific/grid/ui/GridUI.java
===================================================================
--- trunk/swing/src/picross/specific/grid/ui/GridUI.java 2013-01-23 11:32:35 UTC (rev 135)
+++ trunk/swing/src/picross/specific/grid/ui/GridUI.java 2013-01-28 08:42:39 UTC (rev 136)
@@ -732,4 +732,18 @@
public void updateBox(int row, int col, Box box) {
this.boxes[row][col].updateState(box);
}
+
+ public void clearAll() {
+ for (UIBox[] boxRow : this.boxes) {
+ for (UIBox box : boxRow) {
+ box.updateState(GridUI.EMPTY_BOX);
+ }
+ }
+ }
+
+ private static final Box EMPTY_BOX = new Box();
+
+ public void doRepaint() {
+ this.repaint();
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|