Tabs -> spaces
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@331 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -35,24 +35,24 @@ public class Log
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.fine(message);
|
||||
log.fine(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.log(Level.WARNING, t.getMessage(), t);
|
||||
log.log(Level.WARNING, t.getMessage(), t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,29 +44,29 @@ public class Log
|
||||
{
|
||||
/** The static log instance configured for use by this package. */
|
||||
public static com.samskivert.util.Log log =
|
||||
new com.samskivert.util.Log("micasa");
|
||||
new com.samskivert.util.Log("micasa");
|
||||
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.debug(message);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,8 +86,8 @@ public class ChatPanel extends JPanel
|
||||
_ctx.getOccupantDirector().addOccupantObserver(this);
|
||||
|
||||
GroupLayout gl = new VGroupLayout(GroupLayout.STRETCH);
|
||||
gl.setOffAxisPolicy(GroupLayout.STRETCH);
|
||||
setLayout(gl);
|
||||
gl.setOffAxisPolicy(GroupLayout.STRETCH);
|
||||
setLayout(gl);
|
||||
|
||||
// create our scrolling chat text display
|
||||
_text = new JTextPane();
|
||||
@@ -172,13 +172,13 @@ public class ChatPanel extends JPanel
|
||||
// documentation inherited
|
||||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
String cmd = e.getActionCommand();
|
||||
if (cmd.equals("send")) {
|
||||
String cmd = e.getActionCommand();
|
||||
if (cmd.equals("send")) {
|
||||
sendText();
|
||||
|
||||
} else {
|
||||
System.out.println("Unknown action event: " + cmd);
|
||||
}
|
||||
} else {
|
||||
System.out.println("Unknown action event: " + cmd);
|
||||
}
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ClientController extends Controller
|
||||
// documentation inherited
|
||||
public boolean handleAction (ActionEvent action)
|
||||
{
|
||||
String cmd = action.getActionCommand();
|
||||
String cmd = action.getActionCommand();
|
||||
|
||||
if (cmd.equals("logoff")) {
|
||||
// request that we logoff
|
||||
|
||||
@@ -58,7 +58,7 @@ public class LogonPanel extends JPanel
|
||||
_ctx = ctx;
|
||||
_msgs = _ctx.getMessageManager().getBundle("micasa.logon");
|
||||
|
||||
setLayout(new VGroupLayout());
|
||||
setLayout(new VGroupLayout());
|
||||
|
||||
// stick the logon components into a panel that will stretch them
|
||||
// to a sensible width
|
||||
@@ -136,16 +136,16 @@ public class LogonPanel extends JPanel
|
||||
|
||||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
String cmd = e.getActionCommand();
|
||||
if (cmd.equals("skipToPassword")) {
|
||||
String cmd = e.getActionCommand();
|
||||
if (cmd.equals("skipToPassword")) {
|
||||
_password.requestFocusInWindow();
|
||||
|
||||
} else if (cmd.equals("logon")) {
|
||||
logon();
|
||||
|
||||
} else {
|
||||
System.out.println("Unknown action event: " + cmd);
|
||||
}
|
||||
} else {
|
||||
System.out.println("Unknown action event: " + cmd);
|
||||
}
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
|
||||
@@ -62,8 +62,8 @@ public class MiCasaFrame
|
||||
{
|
||||
// remove the old panel
|
||||
getContentPane().removeAll();
|
||||
// add the new one
|
||||
getContentPane().add(panel, BorderLayout.CENTER);
|
||||
// add the new one
|
||||
getContentPane().add(panel, BorderLayout.CENTER);
|
||||
// swing doesn't properly repaint after adding/removing children
|
||||
panel.revalidate();
|
||||
repaint();
|
||||
|
||||
@@ -48,7 +48,7 @@ public class LobbyPanel
|
||||
public LobbyPanel (MiCasaContext ctx, LobbyConfig config)
|
||||
{
|
||||
// we want a five pixel border around everything
|
||||
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
|
||||
// create our primary layout which divides the display in two
|
||||
// horizontally
|
||||
|
||||
@@ -73,7 +73,7 @@ public class TableItem
|
||||
_self = ((BodyObject)ctx.getClient().getClientObject()).getVisibleName();
|
||||
|
||||
// now create our user interface
|
||||
setBorder(BorderFactory.createLineBorder(Color.black));
|
||||
setBorder(BorderFactory.createLineBorder(Color.black));
|
||||
setLayout(new GridBagLayout());
|
||||
GridBagConstraints gbc = new GridBagConstraints();
|
||||
|
||||
|
||||
@@ -79,9 +79,9 @@ public class TableListView extends JPanel
|
||||
_tdtr.addSeatednessObserver(this);
|
||||
|
||||
// set up a layout manager
|
||||
HGroupLayout gl = new HGroupLayout(HGroupLayout.STRETCH);
|
||||
gl.setOffAxisPolicy(HGroupLayout.STRETCH);
|
||||
setLayout(gl);
|
||||
HGroupLayout gl = new HGroupLayout(HGroupLayout.STRETCH);
|
||||
gl.setOffAxisPolicy(HGroupLayout.STRETCH);
|
||||
setLayout(gl);
|
||||
|
||||
// we have two lists of tables, one of tables being matchmade...
|
||||
VGroupLayout pgl = new VGroupLayout(VGroupLayout.STRETCH);
|
||||
@@ -93,7 +93,7 @@ public class TableListView extends JPanel
|
||||
mgl.setOffAxisPolicy(VGroupLayout.STRETCH);
|
||||
mgl.setJustification(VGroupLayout.TOP);
|
||||
_matchList = new JPanel(mgl);
|
||||
_matchList.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
_matchList.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
panel.add(new JScrollPane(_matchList));
|
||||
|
||||
// create and initialize the configurator interface
|
||||
@@ -139,7 +139,7 @@ public class TableListView extends JPanel
|
||||
panel.add(new JLabel("Games in progress"), VGroupLayout.FIXED);
|
||||
|
||||
_playList = new JPanel(mgl);
|
||||
_playList.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
_playList.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
panel.add(new JScrollPane(_playList));
|
||||
|
||||
add(panel);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class SimulatorController extends Controller
|
||||
// documentation inherited
|
||||
public boolean handleAction (ActionEvent action)
|
||||
{
|
||||
String cmd = action.getActionCommand();
|
||||
String cmd = action.getActionCommand();
|
||||
|
||||
if (cmd.equals(LOGOFF)) {
|
||||
// request that we logoff
|
||||
|
||||
@@ -36,24 +36,24 @@ public class Log
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.fine(message);
|
||||
log.fine(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.log(Level.WARNING, t.getMessage(), t);
|
||||
log.log(Level.WARNING, t.getMessage(), t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,29 +28,29 @@ package com.threerings.parlor.card;
|
||||
public class Log
|
||||
{
|
||||
public static com.samskivert.util.Log log =
|
||||
new com.samskivert.util.Log("card");
|
||||
new com.samskivert.util.Log("card");
|
||||
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.debug(message);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,29 +28,29 @@ package com.threerings.puzzle;
|
||||
public class Log
|
||||
{
|
||||
public static com.samskivert.util.Log log =
|
||||
new com.samskivert.util.Log("puzzle");
|
||||
new com.samskivert.util.Log("puzzle");
|
||||
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.debug(message);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -656,9 +656,9 @@ public abstract class PuzzleController extends GameController
|
||||
if (cmd.equals(TOGGLE_CHATTING)) {
|
||||
setChatting(!isChatting());
|
||||
|
||||
} else {
|
||||
} else {
|
||||
return super.handleAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class DropBlockSprite extends DropSprite
|
||||
public DropBlockSprite (
|
||||
DropBoardView view, int col, int row, int orient, int[] pieces)
|
||||
{
|
||||
super(view, col, row, pieces, 0);
|
||||
super(view, col, row, pieces, 0);
|
||||
|
||||
_orient = orient;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class DropBlockSprite extends DropSprite
|
||||
DropBoardView view, int col, int row, int orient, int[] pieces,
|
||||
int renderOrder)
|
||||
{
|
||||
super(view, col, row, pieces, 0, renderOrder);
|
||||
super(view, col, row, pieces, 0, renderOrder);
|
||||
|
||||
_orient = orient;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class DropBlockSprite extends DropSprite
|
||||
{
|
||||
super.init();
|
||||
|
||||
setOrientation(_orient);
|
||||
setOrientation(_orient);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,18 +151,18 @@ public class DropBlockSprite extends DropSprite
|
||||
*/
|
||||
public void setOrientation (int orient)
|
||||
{
|
||||
super.setOrientation(orient);
|
||||
super.setOrientation(orient);
|
||||
|
||||
int edx = 0, edy = 0;
|
||||
if (orient == NORTH) {
|
||||
edy = -1;
|
||||
} else if (orient == WEST) {
|
||||
edx = -1;
|
||||
}
|
||||
int edx = 0, edy = 0;
|
||||
if (orient == NORTH) {
|
||||
edy = -1;
|
||||
} else if (orient == WEST) {
|
||||
edx = -1;
|
||||
}
|
||||
|
||||
// update the sprite image offset
|
||||
setRowOffset(edy);
|
||||
setColumnOffset(edx);
|
||||
setRowOffset(edy);
|
||||
setColumnOffset(edx);
|
||||
|
||||
// update the external piece position and drop block bounds
|
||||
updateDropInfo();
|
||||
@@ -171,9 +171,9 @@ public class DropBlockSprite extends DropSprite
|
||||
// documentation inherited
|
||||
public void toString (StringBuilder buf)
|
||||
{
|
||||
super.toString(buf);
|
||||
buf.append(", erow=").append(_erow);
|
||||
buf.append(", ecol=").append(_ecol);
|
||||
super.toString(buf);
|
||||
buf.append(", erow=").append(_erow);
|
||||
buf.append(", ecol=").append(_ecol);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,11 +231,11 @@ public class DropBlockSprite extends DropSprite
|
||||
*/
|
||||
protected int calculateExternalRow ()
|
||||
{
|
||||
if (_orient == NORTH) {
|
||||
return (_row - 1);
|
||||
} else if (_orient == SOUTH) {
|
||||
return (_row + 1);
|
||||
} else {
|
||||
if (_orient == NORTH) {
|
||||
return (_row - 1);
|
||||
} else if (_orient == SOUTH) {
|
||||
return (_row + 1);
|
||||
} else {
|
||||
return _row;
|
||||
}
|
||||
}
|
||||
@@ -246,11 +246,11 @@ public class DropBlockSprite extends DropSprite
|
||||
*/
|
||||
protected int calculateExternalColumn ()
|
||||
{
|
||||
if (_orient == WEST) {
|
||||
return (_col - 1);
|
||||
} else if (_orient == EAST) {
|
||||
return (_col + 1);
|
||||
} else {
|
||||
if (_orient == WEST) {
|
||||
return (_col - 1);
|
||||
} else if (_orient == EAST) {
|
||||
return (_col + 1);
|
||||
} else {
|
||||
return _col;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ public abstract class DropBoardView extends PuzzleBoardView
|
||||
*/
|
||||
public DropSprite createPieces (int col, int row, int[] pieces, int dist)
|
||||
{
|
||||
return new DropSprite(this, col, row, pieces, dist);
|
||||
return new DropSprite(this, col, row, pieces, dist);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -539,9 +539,9 @@ public abstract class DropBoardView extends PuzzleBoardView
|
||||
// documentation inherited
|
||||
public Dimension getPreferredSize ()
|
||||
{
|
||||
int wid = _bwid * _pwid;
|
||||
int wid = _bwid * _pwid;
|
||||
int hei = _bhei * _phei;
|
||||
return new Dimension(wid, hei);
|
||||
return new Dimension(wid, hei);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -274,9 +274,9 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
|
||||
} else if (cmd.equals(END_DROP_BLOCK)) {
|
||||
handleDropBlock(false);
|
||||
|
||||
} else {
|
||||
} else {
|
||||
return super.handleAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -322,7 +322,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
|
||||
if (checkBlockLanded(source, false, false)) {
|
||||
startBounceTimer(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return handled;
|
||||
}
|
||||
@@ -355,7 +355,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
|
||||
int fcol = col + (pos.x - bb.x);
|
||||
// Log.info("Valid move [row=" + frow + ", col=" + col + "].");
|
||||
_blocksprite.setBoardLocation(frow, fcol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -386,8 +386,8 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
|
||||
// ", col=" + info[1] + ", row=" + info[2] +
|
||||
// ", blocksprite=" + _blocksprite + "].");
|
||||
|
||||
// update the piece image
|
||||
_dview.rotateDropBlock(_blocksprite, info[0]);
|
||||
// update the piece image
|
||||
_dview.rotateDropBlock(_blocksprite, info[0]);
|
||||
|
||||
// place the block in its newly rotated location
|
||||
_blocksprite.setBoardLocation(info[2], info[1]);
|
||||
|
||||
@@ -72,8 +72,8 @@ public class DropSprite extends Sprite
|
||||
_view = view;
|
||||
_col = col;
|
||||
_row = row;
|
||||
_pieces = pieces;
|
||||
_dist = (dist == 0) ? 1 : dist;
|
||||
_pieces = pieces;
|
||||
_dist = (dist == 0) ? 1 : dist;
|
||||
_orient = NORTH;
|
||||
_unit = _view.getPieceHeight();
|
||||
setRenderOrder(renderOrder);
|
||||
@@ -86,10 +86,10 @@ public class DropSprite extends Sprite
|
||||
|
||||
// size the bounds to fit our pieces
|
||||
updateBounds();
|
||||
// set up the piece location
|
||||
setBoardLocation(_row, _col);
|
||||
// calculate vertical render offset based on the number of pieces
|
||||
setRowOffset(-(_pieces.length - 1));
|
||||
// set up the piece location
|
||||
setBoardLocation(_row, _col);
|
||||
// calculate vertical render offset based on the number of pieces
|
||||
setRowOffset(-(_pieces.length - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +97,7 @@ public class DropSprite extends Sprite
|
||||
*/
|
||||
public int getDistance ()
|
||||
{
|
||||
return _dist;
|
||||
return _dist;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +105,7 @@ public class DropSprite extends Sprite
|
||||
*/
|
||||
public int getColumn ()
|
||||
{
|
||||
return _col;
|
||||
return _col;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,7 +113,7 @@ public class DropSprite extends Sprite
|
||||
*/
|
||||
public int getRow ()
|
||||
{
|
||||
return _row;
|
||||
return _row;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,7 +121,7 @@ public class DropSprite extends Sprite
|
||||
*/
|
||||
public int[] getPieces ()
|
||||
{
|
||||
return _pieces;
|
||||
return _pieces;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,7 +129,7 @@ public class DropSprite extends Sprite
|
||||
*/
|
||||
public float getVelocity ()
|
||||
{
|
||||
return _vel;
|
||||
return _vel;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,9 +137,9 @@ public class DropSprite extends Sprite
|
||||
*/
|
||||
public void setBoardLocation (int row, int col)
|
||||
{
|
||||
_row = row;
|
||||
_col = col;
|
||||
updatePosition();
|
||||
_row = row;
|
||||
_col = col;
|
||||
updatePosition();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,8 +147,8 @@ public class DropSprite extends Sprite
|
||||
*/
|
||||
public void setColumn (int col)
|
||||
{
|
||||
_col = col;
|
||||
updatePosition();
|
||||
_col = col;
|
||||
updatePosition();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,8 +156,8 @@ public class DropSprite extends Sprite
|
||||
*/
|
||||
public void setRow (int row)
|
||||
{
|
||||
_row = row;
|
||||
updatePosition();
|
||||
_row = row;
|
||||
updatePosition();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,9 +165,9 @@ public class DropSprite extends Sprite
|
||||
*/
|
||||
public void setColumnOffset (int count)
|
||||
{
|
||||
_offx = count;
|
||||
_offx = count;
|
||||
updateRenderOffset();
|
||||
updateRenderOrigin();
|
||||
updateRenderOrigin();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,9 +175,9 @@ public class DropSprite extends Sprite
|
||||
*/
|
||||
public void setRowOffset (int count)
|
||||
{
|
||||
_offy = count;
|
||||
_offy = count;
|
||||
updateRenderOffset();
|
||||
updateRenderOrigin();
|
||||
updateRenderOrigin();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,8 +213,8 @@ public class DropSprite extends Sprite
|
||||
_rowstamp = now - msecs;
|
||||
}
|
||||
|
||||
// update the velocity
|
||||
_vel = velocity;
|
||||
// update the velocity
|
||||
_vel = velocity;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -229,17 +229,17 @@ public class DropSprite extends Sprite
|
||||
_dist = 1;
|
||||
}
|
||||
|
||||
if (_stopstamp > 0) {
|
||||
// we're dropping from a stand-still
|
||||
if (_stopstamp > 0) {
|
||||
// we're dropping from a stand-still
|
||||
long delta = _view.getTimeStamp() - _stopstamp;
|
||||
_rowstamp += delta;
|
||||
_rowstamp += delta;
|
||||
_stopstamp = 0;
|
||||
|
||||
} else {
|
||||
} else {
|
||||
// we're continuing a previous drop, so make use of any
|
||||
// previously existing time
|
||||
_rowstamp = _endstamp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -307,7 +307,7 @@ public class DropSprite extends Sprite
|
||||
// documentation inherited
|
||||
public boolean inside (Shape shape)
|
||||
{
|
||||
return shape.contains(_bounds);
|
||||
return shape.contains(_bounds);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -324,8 +324,8 @@ public class DropSprite extends Sprite
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
long msecs = Math.max(0, timestamp - _rowstamp);
|
||||
float travpix = msecs * _vel;
|
||||
long msecs = Math.max(0, timestamp - _rowstamp);
|
||||
float travpix = msecs * _vel;
|
||||
float pctdone = (travpix / _unit);
|
||||
|
||||
// Log.info("getPercentDone [timestamp=" + timestamp +
|
||||
@@ -333,7 +333,7 @@ public class DropSprite extends Sprite
|
||||
// ", travpix=" + travpix + ", pctdone=" + pctdone +
|
||||
// ", vel=" + _vel + "].");
|
||||
|
||||
return pctdone;
|
||||
return pctdone;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
@@ -373,7 +373,7 @@ public class DropSprite extends Sprite
|
||||
// documentation inherited
|
||||
public void tick (long timestamp)
|
||||
{
|
||||
super.tick(timestamp);
|
||||
super.tick(timestamp);
|
||||
|
||||
// initialize our rowstamp if we haven't done so already
|
||||
if (_rowstamp == 0) {
|
||||
@@ -387,18 +387,18 @@ public class DropSprite extends Sprite
|
||||
|
||||
PieceMovedOp pmop = null;
|
||||
|
||||
// figure out how far along the current board coordinate we should be
|
||||
float pctdone = getPercentDone(timestamp);
|
||||
if (pctdone >= 1.0f) {
|
||||
// note that we've reached the next row
|
||||
// figure out how far along the current board coordinate we should be
|
||||
float pctdone = getPercentDone(timestamp);
|
||||
if (pctdone >= 1.0f) {
|
||||
// note that we've reached the next row
|
||||
advancePosition();
|
||||
|
||||
// update remaining drop distance
|
||||
_dist--;
|
||||
// update remaining drop distance
|
||||
_dist--;
|
||||
|
||||
// calculate any remaining time to be used
|
||||
long used = (long)(_unit / _vel);
|
||||
_endstamp = _rowstamp + used;
|
||||
// calculate any remaining time to be used
|
||||
long used = (long)(_unit / _vel);
|
||||
_endstamp = _rowstamp + used;
|
||||
_rowstamp = _endstamp;
|
||||
|
||||
// update our percent done because we've moved down a row
|
||||
@@ -406,7 +406,7 @@ public class DropSprite extends Sprite
|
||||
|
||||
// inform observers that we've reached our destination
|
||||
pmop = new PieceMovedOp(this, timestamp, _col, _row);
|
||||
}
|
||||
}
|
||||
|
||||
// constrain the sprite's position to the destination row
|
||||
pctdone = Math.min(pctdone, 1.0f);
|
||||
@@ -453,11 +453,11 @@ public class DropSprite extends Sprite
|
||||
{
|
||||
super.toString(buf);
|
||||
buf.append(", orient=").append(DirectionUtil.toShortString(_orient));
|
||||
buf.append(", row=").append(_row);
|
||||
buf.append(", col=").append(_col);
|
||||
buf.append(", offx=").append(_offx);
|
||||
buf.append(", offy=").append(_offy);
|
||||
buf.append(", dist=").append(_dist);
|
||||
buf.append(", row=").append(_row);
|
||||
buf.append(", col=").append(_col);
|
||||
buf.append(", offx=").append(_offx);
|
||||
buf.append(", offy=").append(_offy);
|
||||
buf.append(", dist=").append(_dist);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -467,7 +467,7 @@ public class DropSprite extends Sprite
|
||||
{
|
||||
_view.getPiecePosition(_col, _row, _srcPos);
|
||||
_view.getPiecePosition(_col, _row+1, _destPos);
|
||||
setLocation(_srcPos.x, _srcPos.y);
|
||||
setLocation(_srcPos.x, _srcPos.y);
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
|
||||
@@ -160,14 +160,14 @@ public class DropBoard extends Board
|
||||
*/
|
||||
public int getDropDistance (int col, int row)
|
||||
{
|
||||
int dist = 0;
|
||||
for (int yy = row + 1; yy < _bhei; yy++) {
|
||||
if (getPiece(col, yy) != PIECE_NONE) {
|
||||
return dist;
|
||||
}
|
||||
dist++;
|
||||
}
|
||||
return dist;
|
||||
int dist = 0;
|
||||
for (int yy = row + 1; yy < _bhei; yy++) {
|
||||
if (getPiece(col, yy) != PIECE_NONE) {
|
||||
return dist;
|
||||
}
|
||||
dist++;
|
||||
}
|
||||
return dist;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -591,9 +591,9 @@ public class DropBoard extends Board
|
||||
padwid *= 2;
|
||||
}
|
||||
|
||||
for (int y = 0; y < _bhei; y++) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int x = 0; x < _bwid; x++) {
|
||||
for (int y = 0; y < _bhei; y++) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int x = 0; x < _bwid; x++) {
|
||||
int piece = getPiece(x, y);
|
||||
String str = formatPiece(piece);
|
||||
if (dother != null) {
|
||||
@@ -603,9 +603,9 @@ public class DropBoard extends Board
|
||||
}
|
||||
}
|
||||
buf.append(StringUtils.rightPad(str, padwid));
|
||||
}
|
||||
System.err.println(buf.toString());
|
||||
}
|
||||
}
|
||||
System.err.println(buf.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns a string representation of this instance. */
|
||||
|
||||
@@ -129,7 +129,7 @@ public abstract class DropManagerDelegate extends PuzzleManagerDelegate
|
||||
*/
|
||||
protected boolean dropPieces (DropBoard board)
|
||||
{
|
||||
return (_dropper.dropPieces(board, null) > 0);
|
||||
return (_dropper.dropPieces(board, null) > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,33 +43,33 @@ public class PieceDropper
|
||||
*/
|
||||
public static class PieceDropInfo
|
||||
{
|
||||
/** The starting row of the bottom piece being dropped. */
|
||||
public int row;
|
||||
/** The starting row of the bottom piece being dropped. */
|
||||
public int row;
|
||||
|
||||
/** The column number. */
|
||||
public int col;
|
||||
/** The column number. */
|
||||
public int col;
|
||||
|
||||
/** The distance to drop the pieces. */
|
||||
public int dist;
|
||||
/** The distance to drop the pieces. */
|
||||
public int dist;
|
||||
|
||||
/** The pieces to be dropped. */
|
||||
public int[] pieces;
|
||||
/** The pieces to be dropped. */
|
||||
public int[] pieces;
|
||||
|
||||
/**
|
||||
* Constructs a piece drop info object.
|
||||
*/
|
||||
public PieceDropInfo (int col, int row, int dist)
|
||||
{
|
||||
this.col = col;
|
||||
this.row = row;
|
||||
this.dist = dist;
|
||||
}
|
||||
public PieceDropInfo (int col, int row, int dist)
|
||||
{
|
||||
this.col = col;
|
||||
this.row = row;
|
||||
this.dist = dist;
|
||||
}
|
||||
|
||||
/** Returns a string representation of this instance. */
|
||||
public String toString ()
|
||||
{
|
||||
public String toString ()
|
||||
{
|
||||
return StringUtil.fieldsToString(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,11 +100,11 @@ public class PieceDropper
|
||||
public int dropPieces (DropBoard board, DropObserver drobs)
|
||||
{
|
||||
int dropped = 0, bhei = board.getHeight(), bwid = board.getWidth();
|
||||
for (int yy = bhei - 1; yy >= 0; yy--) {
|
||||
for (int xx = 0; xx < bwid; xx++) {
|
||||
for (int yy = bhei - 1; yy >= 0; yy--) {
|
||||
for (int xx = 0; xx < bwid; xx++) {
|
||||
dropped += dropPieces(board, xx, yy, drobs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if the board wants pieces to be dropped in to fill the gaps, do
|
||||
// that now
|
||||
@@ -133,14 +133,14 @@ public class PieceDropper
|
||||
protected int dropPieces (
|
||||
DropBoard board, int xx, int yy, DropObserver drobs)
|
||||
{
|
||||
// skip empty or fixed pieces
|
||||
int piece = board.getPiece(xx, yy);
|
||||
// skip empty or fixed pieces
|
||||
int piece = board.getPiece(xx, yy);
|
||||
if (!_logic.isDroppablePiece(piece)) {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dropped = 0;
|
||||
if (_logic.isConstrainedPiece(piece)) {
|
||||
if (_logic.isConstrainedPiece(piece)) {
|
||||
// find out where this constrained block starts and ends
|
||||
int start = _logic.getConstrainedEdge(board, xx, yy, LEFT);
|
||||
int end = _logic.getConstrainedEdge(board, xx, yy, RIGHT);
|
||||
@@ -159,27 +159,27 @@ public class PieceDropper
|
||||
for (int xpos = start; xpos <= end; xpos++) {
|
||||
dist = Math.min(dist, board.getDropDistance(xpos, yy));
|
||||
}
|
||||
if (dist == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (dist == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// scoot along the bottom edge of the block, noting the drop
|
||||
// for each column
|
||||
// scoot along the bottom edge of the block, noting the drop
|
||||
// for each column
|
||||
for (int xpos = start; xpos <= end; xpos++) {
|
||||
piece = board.getPiece(xpos, yy);
|
||||
drop(board, piece, xpos, yy, yy + dist, drobs);
|
||||
dropped++;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// get the distance to drop the pieces
|
||||
int dist = board.getDropDistance(xx, yy);
|
||||
if (dist == 0) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
// get the distance to drop the pieces
|
||||
int dist = board.getDropDistance(xx, yy);
|
||||
if (dist == 0) {
|
||||
return 0;
|
||||
}
|
||||
drop(board, piece, xx, yy, yy + dist, drobs);
|
||||
dropped++;
|
||||
}
|
||||
}
|
||||
|
||||
return dropped;
|
||||
}
|
||||
|
||||
@@ -41,9 +41,9 @@ public class PointSet
|
||||
*/
|
||||
public PointSet (int rangeX, int rangeY)
|
||||
{
|
||||
_rangeX = rangeX;
|
||||
_rangeY = rangeY;
|
||||
_points = new boolean[rangeX][rangeY];
|
||||
_rangeX = rangeX;
|
||||
_rangeY = rangeY;
|
||||
_points = new boolean[rangeX][rangeY];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,12 +57,12 @@ public class PointSet
|
||||
*/
|
||||
public boolean add (int x, int y)
|
||||
{
|
||||
boolean present = _points[x][y];
|
||||
_points[x][y] = true;
|
||||
if (!present) {
|
||||
_count++;
|
||||
}
|
||||
return present;
|
||||
boolean present = _points[x][y];
|
||||
_points[x][y] = true;
|
||||
if (!present) {
|
||||
_count++;
|
||||
}
|
||||
return present;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,11 +72,11 @@ public class PointSet
|
||||
*/
|
||||
public void addAll (PointSet set)
|
||||
{
|
||||
Iterator iter = set.iterator();
|
||||
Point pt;
|
||||
while ((pt = (Point)iter.next()) != null) {
|
||||
add(pt.x, pt.y);
|
||||
}
|
||||
Iterator iter = set.iterator();
|
||||
Point pt;
|
||||
while ((pt = (Point)iter.next()) != null) {
|
||||
add(pt.x, pt.y);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,17 +84,17 @@ public class PointSet
|
||||
*/
|
||||
public void clear ()
|
||||
{
|
||||
if (_count == 0) {
|
||||
// no need to clear anything
|
||||
return;
|
||||
}
|
||||
if (_count == 0) {
|
||||
// no need to clear anything
|
||||
return;
|
||||
}
|
||||
|
||||
for (int xx = 0; xx < _rangeX; xx++) {
|
||||
for (int yy = 0; yy < _rangeY; yy++) {
|
||||
_points[xx][yy] = false;
|
||||
}
|
||||
}
|
||||
_count = 0;
|
||||
for (int xx = 0; xx < _rangeX; xx++) {
|
||||
for (int yy = 0; yy < _rangeY; yy++) {
|
||||
_points[xx][yy] = false;
|
||||
}
|
||||
}
|
||||
_count = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,7 +107,7 @@ public class PointSet
|
||||
*/
|
||||
public boolean contains (int x, int y)
|
||||
{
|
||||
return (_points[x][y]);
|
||||
return (_points[x][y]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,7 +117,7 @@ public class PointSet
|
||||
*/
|
||||
public boolean isEmpty ()
|
||||
{
|
||||
return (_count == 0);
|
||||
return (_count == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,7 +131,7 @@ public class PointSet
|
||||
*/
|
||||
public Iterator iterator ()
|
||||
{
|
||||
return new PointIterator();
|
||||
return new PointIterator();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,12 +145,12 @@ public class PointSet
|
||||
*/
|
||||
public boolean remove (int x, int y)
|
||||
{
|
||||
boolean present = _points[x][y];
|
||||
_points[x][y] = false;
|
||||
if (present) {
|
||||
_count--;
|
||||
}
|
||||
return present;
|
||||
boolean present = _points[x][y];
|
||||
_points[x][y] = false;
|
||||
if (present) {
|
||||
_count--;
|
||||
}
|
||||
return present;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,7 +160,7 @@ public class PointSet
|
||||
*/
|
||||
public int size ()
|
||||
{
|
||||
return _count;
|
||||
return _count;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,70 +168,70 @@ public class PointSet
|
||||
*/
|
||||
public String toString ()
|
||||
{
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("[");
|
||||
Iterator iter = iterator();
|
||||
Point val;
|
||||
while ((val = (Point)iter.next()) != null) {
|
||||
buf.append("(").append(val.x);
|
||||
buf.append(",").append(val.y);
|
||||
buf.append(")");
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("[");
|
||||
Iterator iter = iterator();
|
||||
Point val;
|
||||
while ((val = (Point)iter.next()) != null) {
|
||||
buf.append("(").append(val.x);
|
||||
buf.append(",").append(val.y);
|
||||
buf.append(")");
|
||||
|
||||
if (iter.hasNext()) {
|
||||
buf.append(", ");
|
||||
}
|
||||
}
|
||||
return buf.append("]").toString();
|
||||
if (iter.hasNext()) {
|
||||
buf.append(", ");
|
||||
}
|
||||
}
|
||||
return buf.append("]").toString();
|
||||
}
|
||||
|
||||
protected class PointIterator implements Iterator
|
||||
{
|
||||
public boolean hasNext ()
|
||||
{
|
||||
return (_curCount < _count);
|
||||
}
|
||||
public boolean hasNext ()
|
||||
{
|
||||
return (_curCount < _count);
|
||||
}
|
||||
|
||||
public Object next ()
|
||||
{
|
||||
if (_curCount == _count) {
|
||||
return null;
|
||||
}
|
||||
public Object next ()
|
||||
{
|
||||
if (_curCount == _count) {
|
||||
return null;
|
||||
}
|
||||
|
||||
while (!_points[_curX][_curY]) {
|
||||
advance();
|
||||
}
|
||||
while (!_points[_curX][_curY]) {
|
||||
advance();
|
||||
}
|
||||
|
||||
_curCount++;
|
||||
_point.setLocation(_curX, _curY);
|
||||
_curCount++;
|
||||
_point.setLocation(_curX, _curY);
|
||||
|
||||
if (_curCount < _count) {
|
||||
advance();
|
||||
}
|
||||
if (_curCount < _count) {
|
||||
advance();
|
||||
}
|
||||
|
||||
return _point;
|
||||
}
|
||||
return _point;
|
||||
}
|
||||
|
||||
public void remove ()
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
public void remove ()
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
protected void advance ()
|
||||
{
|
||||
if ((++_curX) >= _rangeX) {
|
||||
_curX = 0;
|
||||
_curY++;
|
||||
}
|
||||
protected void advance ()
|
||||
{
|
||||
if ((++_curX) >= _rangeX) {
|
||||
_curX = 0;
|
||||
_curY++;
|
||||
}
|
||||
|
||||
if (_curY >= _rangeY) {
|
||||
Log.warning("Advanced past point range.");
|
||||
_curY = 0;
|
||||
}
|
||||
}
|
||||
if (_curY >= _rangeY) {
|
||||
Log.warning("Advanced past point range.");
|
||||
_curY = 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected int _curCount = 0;
|
||||
protected int _curX = 0, _curY = 0;
|
||||
protected Point _point = new Point();
|
||||
protected int _curCount = 0;
|
||||
protected int _curX = 0, _curY = 0;
|
||||
protected Point _point = new Point();
|
||||
}
|
||||
|
||||
/** The dimensions of the point array. */
|
||||
|
||||
@@ -28,29 +28,29 @@ package com.threerings.stage;
|
||||
public class Log
|
||||
{
|
||||
public static com.samskivert.util.Log log =
|
||||
new com.samskivert.util.Log("stage");
|
||||
new com.samskivert.util.Log("stage");
|
||||
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.debug(message);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,12 +104,12 @@ public class EditorApp implements Runnable
|
||||
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
|
||||
|
||||
// create and size the main application frame
|
||||
_frame = createEditorFrame();
|
||||
_frame = createEditorFrame();
|
||||
|
||||
// create our frame manager
|
||||
_framemgr = FrameManager.newInstance(_frame);
|
||||
|
||||
// create our myriad managers, repositories, etc.
|
||||
// create our myriad managers, repositories, etc.
|
||||
_rmgr = new ResourceManager("rsrc");
|
||||
|
||||
// build up a simple ui for displaying progress
|
||||
@@ -156,7 +156,7 @@ public class EditorApp implements Runnable
|
||||
{
|
||||
_msgmgr = new MessageManager("rsrc.i18n");
|
||||
_imgr = new ImageManager(_rmgr, _frame);
|
||||
_tilemgr = new EditorTileManager(_rmgr, _imgr);
|
||||
_tilemgr = new EditorTileManager(_rmgr, _imgr);
|
||||
|
||||
try {
|
||||
_tsrepo = new BundledTileSetRepository(_rmgr, _imgr, "tilesets");
|
||||
@@ -175,7 +175,7 @@ public class EditorApp implements Runnable
|
||||
|
||||
_ctx = new EditorContextImpl();
|
||||
|
||||
// initialize the frame with the now-prepared context
|
||||
// initialize the frame with the now-prepared context
|
||||
_frame.init(_ctx, target);
|
||||
|
||||
// wire up our runtime adjustment editor
|
||||
@@ -286,9 +286,9 @@ public class EditorApp implements Runnable
|
||||
*/
|
||||
protected class EditorContextImpl implements EditorContext
|
||||
{
|
||||
public MisoTileManager getTileManager () {
|
||||
return _tilemgr;
|
||||
}
|
||||
public MisoTileManager getTileManager () {
|
||||
return _tilemgr;
|
||||
}
|
||||
|
||||
public FrameManager getFrameManager () {
|
||||
return _framemgr;
|
||||
@@ -334,13 +334,13 @@ public class EditorApp implements Runnable
|
||||
}
|
||||
}
|
||||
|
||||
public TileSetRepository getTileSetRepository () {
|
||||
return _tsrepo;
|
||||
}
|
||||
public TileSetRepository getTileSetRepository () {
|
||||
return _tsrepo;
|
||||
}
|
||||
|
||||
public ColorPository getColorPository () {
|
||||
return _colpos;
|
||||
}
|
||||
public ColorPository getColorPository () {
|
||||
return _colpos;
|
||||
}
|
||||
|
||||
public void enumerateSceneTypes (List types) {
|
||||
EditorApp.this.enumerateSceneTypes(types);
|
||||
|
||||
@@ -36,21 +36,21 @@ public class EditorToolBarPanel extends JPanel implements ActionListener
|
||||
{
|
||||
public EditorToolBarPanel (TileManager tilemgr, EditorModel model)
|
||||
{
|
||||
_model = model;
|
||||
_model = model;
|
||||
|
||||
// use of flowlayout positions the toolbar and floats properly
|
||||
setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
// use of flowlayout positions the toolbar and floats properly
|
||||
setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
|
||||
// get our toolbar icons
|
||||
UniformTileSet tbset = tilemgr.loadTileSet(ICONS_PATH, 40, 40);
|
||||
|
||||
// create the toolbar
|
||||
JToolBar toolbar = new JToolBar();
|
||||
// create the toolbar
|
||||
JToolBar toolbar = new JToolBar();
|
||||
|
||||
// add all of the toolbar buttons
|
||||
_buttons = new ArrayList();
|
||||
for (int ii = 0; ii < EditorModel.NUM_ACTIONS; ii++) {
|
||||
// get the button icon images
|
||||
// add all of the toolbar buttons
|
||||
_buttons = new ArrayList();
|
||||
for (int ii = 0; ii < EditorModel.NUM_ACTIONS; ii++) {
|
||||
// get the button icon images
|
||||
Tile tile = tbset.getTile(ii);
|
||||
if (tile != null) {
|
||||
String cmd = EditorModel.CMD_ACTIONS[ii];
|
||||
@@ -66,55 +66,55 @@ public class EditorToolBarPanel extends JPanel implements ActionListener
|
||||
Log.warning("Unable to load toolbar icon " +
|
||||
"[index=" + ii + "].");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// default to the first button
|
||||
// default to the first button
|
||||
setSelectedButton((JButton)_buttons.get(0));
|
||||
|
||||
// add the toolbar
|
||||
add(toolbar);
|
||||
// add the toolbar
|
||||
add(toolbar);
|
||||
}
|
||||
|
||||
protected JButton addButton (JToolBar toolbar, String cmd, String tip,
|
||||
TileIcon icon)
|
||||
TileIcon icon)
|
||||
{
|
||||
// create the button and configure accordingly
|
||||
JButton button = new JButton(new DimmedIcon(icon));
|
||||
// create the button and configure accordingly
|
||||
JButton button = new JButton(new DimmedIcon(icon));
|
||||
button.setSelectedIcon(icon);
|
||||
button.addActionListener(this);
|
||||
button.setActionCommand("tbar_" + cmd);
|
||||
button.setToolTipText(tip);
|
||||
button.addActionListener(this);
|
||||
button.setActionCommand("tbar_" + cmd);
|
||||
button.setToolTipText(tip);
|
||||
|
||||
// add the button to the toolbar
|
||||
toolbar.add(button);
|
||||
// add the button to the toolbar
|
||||
toolbar.add(button);
|
||||
|
||||
return button;
|
||||
return button;
|
||||
}
|
||||
|
||||
protected void setSelectedButton (JButton button)
|
||||
{
|
||||
for (int ii = 0; ii < _buttons.size(); ii++) {
|
||||
JButton tb = (JButton)_buttons.get(ii);
|
||||
tb.setSelected(tb == button);
|
||||
}
|
||||
for (int ii = 0; ii < _buttons.size(); ii++) {
|
||||
JButton tb = (JButton)_buttons.get(ii);
|
||||
tb.setSelected(tb == button);
|
||||
}
|
||||
}
|
||||
|
||||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
String cmd = e.getActionCommand();
|
||||
String cmd = e.getActionCommand();
|
||||
|
||||
if (cmd.startsWith("tbar")) {
|
||||
if (cmd.startsWith("tbar")) {
|
||||
|
||||
// select the chosen mode in the toolbar
|
||||
setSelectedButton((JButton)e.getSource());
|
||||
// select the chosen mode in the toolbar
|
||||
setSelectedButton((JButton)e.getSource());
|
||||
|
||||
// update the active mode in the model, stripping the
|
||||
// "tbar_" prefix from the command string
|
||||
_model.setActionMode(cmd.substring(5));
|
||||
// update the active mode in the model, stripping the
|
||||
// "tbar_" prefix from the command string
|
||||
_model.setActionMode(cmd.substring(5));
|
||||
|
||||
} else {
|
||||
Log.warning("Unknown action command [cmd=" + cmd + "].");
|
||||
}
|
||||
} else {
|
||||
Log.warning("Unknown action command [cmd=" + cmd + "].");
|
||||
}
|
||||
}
|
||||
|
||||
/** The buttons in the tool bar. */
|
||||
|
||||
@@ -28,29 +28,29 @@ package com.threerings.stage.tools.editor;
|
||||
public class Log
|
||||
{
|
||||
public static com.samskivert.util.Log log =
|
||||
new com.samskivert.util.Log("stage.tools.editor");
|
||||
new com.samskivert.util.Log("stage.tools.editor");
|
||||
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.debug(message);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,22 +62,22 @@ public class ObjectEditorDialog extends JInternalFrame
|
||||
_ctx = ctx;
|
||||
_panel = panel;
|
||||
|
||||
// get a handle on the top-level panel
|
||||
JPanel top = (JPanel)getContentPane();
|
||||
// get a handle on the top-level panel
|
||||
JPanel top = (JPanel)getContentPane();
|
||||
|
||||
// set up a layout manager for the panel
|
||||
VGroupLayout gl = new VGroupLayout(
|
||||
// set up a layout manager for the panel
|
||||
VGroupLayout gl = new VGroupLayout(
|
||||
VGroupLayout.STRETCH, VGroupLayout.STRETCH, 5, VGroupLayout.CENTER);
|
||||
top.setLayout(gl);
|
||||
top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
top.setLayout(gl);
|
||||
top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
|
||||
// object action editor elements
|
||||
JPanel sub = new JPanel(new HGroupLayout(HGroupLayout.STRETCH));
|
||||
sub.add(new JLabel("Object action command:"), HGroupLayout.FIXED);
|
||||
sub.add(_action = new JTextField());
|
||||
JPanel sub = new JPanel(new HGroupLayout(HGroupLayout.STRETCH));
|
||||
sub.add(new JLabel("Object action command:"), HGroupLayout.FIXED);
|
||||
sub.add(_action = new JTextField());
|
||||
_action.addActionListener(this);
|
||||
_action.setActionCommand("ok");
|
||||
top.add(sub);
|
||||
top.add(sub);
|
||||
|
||||
// create the priority slider
|
||||
sub = new JPanel(new HGroupLayout(HGroupLayout.STRETCH));
|
||||
@@ -95,13 +95,13 @@ public class ObjectEditorDialog extends JInternalFrame
|
||||
zations.add(_secondary = new JComboBox(NO_CHOICES));
|
||||
top.add(zations);
|
||||
|
||||
// create our OK/Cancel buttons
|
||||
sub = HGroupLayout.makeButtonBox(HGroupLayout.CENTER);
|
||||
EditorDialogUtil.addButton(this, sub, "OK", "ok");
|
||||
EditorDialogUtil.addButton(this, sub, "Cancel", "cancel");
|
||||
top.add(sub);
|
||||
// create our OK/Cancel buttons
|
||||
sub = HGroupLayout.makeButtonBox(HGroupLayout.CENTER);
|
||||
EditorDialogUtil.addButton(this, sub, "OK", "ok");
|
||||
EditorDialogUtil.addButton(this, sub, "Cancel", "cancel");
|
||||
top.add(sub);
|
||||
|
||||
pack();
|
||||
pack();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +112,7 @@ public class ObjectEditorDialog extends JInternalFrame
|
||||
*/
|
||||
public void prepare (SceneObject scobj)
|
||||
{
|
||||
_scobj = scobj;
|
||||
_scobj = scobj;
|
||||
|
||||
// set our title to the name of the tileset and the tile index
|
||||
String title;
|
||||
@@ -152,10 +152,10 @@ public class ObjectEditorDialog extends JInternalFrame
|
||||
configureZations(_secondary, szations,
|
||||
_scobj.info.getSecondaryZation());
|
||||
|
||||
// select the text edit field and focus it
|
||||
_action.setCaretPosition(0);
|
||||
_action.moveCaretPosition(atext.length());
|
||||
_action.requestFocusInWindow();
|
||||
// select the text edit field and focus it
|
||||
_action.setCaretPosition(0);
|
||||
_action.moveCaretPosition(atext.length());
|
||||
_action.requestFocusInWindow();
|
||||
}
|
||||
|
||||
protected Object[] computeZations (String[] zations, int index)
|
||||
@@ -198,7 +198,7 @@ public class ObjectEditorDialog extends JInternalFrame
|
||||
// documentation inherited from interface
|
||||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
String cmd = e.getActionCommand();
|
||||
String cmd = e.getActionCommand();
|
||||
|
||||
if (cmd.equals("ok")) {
|
||||
_scobj.info.action = _action.getText();
|
||||
|
||||
@@ -48,29 +48,29 @@ public class PortalDialog extends JInternalFrame
|
||||
*/
|
||||
public PortalDialog ()
|
||||
{
|
||||
super("Edit Portal", true);
|
||||
super("Edit Portal", true);
|
||||
|
||||
// get a handle on the top-level panel
|
||||
JPanel top = (JPanel)getContentPane();
|
||||
// get a handle on the top-level panel
|
||||
JPanel top = (JPanel)getContentPane();
|
||||
|
||||
// set up a layout manager for the panel
|
||||
VGroupLayout gl = new VGroupLayout(VGroupLayout.STRETCH);
|
||||
gl.setOffAxisPolicy(VGroupLayout.STRETCH);
|
||||
top.setLayout(gl);
|
||||
top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
// set up a layout manager for the panel
|
||||
VGroupLayout gl = new VGroupLayout(VGroupLayout.STRETCH);
|
||||
gl.setOffAxisPolicy(VGroupLayout.STRETCH);
|
||||
top.setLayout(gl);
|
||||
top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
|
||||
// add the dialog instruction text
|
||||
top.add(new JLabel("Enter settings for this portal:"));
|
||||
// add the dialog instruction text
|
||||
top.add(new JLabel("Enter settings for this portal:"));
|
||||
|
||||
// create a panel to contain the portal name info
|
||||
JPanel sub = new JPanel(new HGroupLayout(HGroupLayout.STRETCH));
|
||||
sub.add(new JLabel("Portal name:", SwingConstants.RIGHT));
|
||||
// create a panel to contain the portal name info
|
||||
JPanel sub = new JPanel(new HGroupLayout(HGroupLayout.STRETCH));
|
||||
sub.add(new JLabel("Portal name:", SwingConstants.RIGHT));
|
||||
|
||||
// create and add the portal name text entry field
|
||||
sub.add(_portalText = new JTextField());
|
||||
// create and add the portal name text entry field
|
||||
sub.add(_portalText = new JTextField());
|
||||
|
||||
// add the portal name info to the top-level panel
|
||||
top.add(sub);
|
||||
// add the portal name info to the top-level panel
|
||||
top.add(sub);
|
||||
|
||||
// create a check box to allow making this the default
|
||||
// entrance portal
|
||||
@@ -79,14 +79,14 @@ public class PortalDialog extends JInternalFrame
|
||||
_entrance.setActionCommand("entrance");
|
||||
top.add(_entrance);
|
||||
|
||||
// create a panel to contain the OK/Cancel buttons
|
||||
sub = new JPanel(new HGroupLayout());
|
||||
EditorDialogUtil.addButton(this, sub, "OK", "ok");
|
||||
// create a panel to contain the OK/Cancel buttons
|
||||
sub = new JPanel(new HGroupLayout());
|
||||
EditorDialogUtil.addButton(this, sub, "OK", "ok");
|
||||
|
||||
// add the buttons to the top-level panel
|
||||
top.add(sub);
|
||||
// add the buttons to the top-level panel
|
||||
top.add(sub);
|
||||
|
||||
pack();
|
||||
pack();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,26 +97,26 @@ public class PortalDialog extends JInternalFrame
|
||||
*/
|
||||
public void prepare (StageScene scene, EditablePortal port)
|
||||
{
|
||||
_port = port;
|
||||
_port = port;
|
||||
_scene = scene;
|
||||
|
||||
// if the location is already a portal, fill the text entry field
|
||||
// with the current scene name, else clear it
|
||||
String text = port.name;
|
||||
_portalText.setText(text);
|
||||
// if the location is already a portal, fill the text entry field
|
||||
// with the current scene name, else clear it
|
||||
String text = port.name;
|
||||
_portalText.setText(text);
|
||||
|
||||
// select the text edit field
|
||||
_portalText.setCaretPosition(0);
|
||||
_portalText.moveCaretPosition(text.length());
|
||||
// select the text edit field
|
||||
_portalText.setCaretPosition(0);
|
||||
_portalText.moveCaretPosition(text.length());
|
||||
|
||||
// select the default entrance check box appropriately
|
||||
Portal entry = _scene.getDefaultEntrance();
|
||||
_entrance.setSelected(entry == null ||
|
||||
entry.portalId == _port.portalId);
|
||||
|
||||
// request the keyboard focus so that the destination scene
|
||||
// name can be typed immediately
|
||||
_portalText.requestFocusInWindow();
|
||||
// request the keyboard focus so that the destination scene
|
||||
// name can be typed immediately
|
||||
_portalText.requestFocusInWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,17 +124,17 @@ public class PortalDialog extends JInternalFrame
|
||||
*/
|
||||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
String cmd = e.getActionCommand();
|
||||
String cmd = e.getActionCommand();
|
||||
|
||||
if (cmd.equals("entrance")) {
|
||||
_entrance.setSelected(_entrance.isSelected());
|
||||
|
||||
} else if (cmd.equals("ok")) {
|
||||
handleSubmit();
|
||||
} else if (cmd.equals("ok")) {
|
||||
handleSubmit();
|
||||
|
||||
} else {
|
||||
Log.warning("Unknown action command [cmd=" + cmd + "].");
|
||||
}
|
||||
} else {
|
||||
Log.warning("Unknown action command [cmd=" + cmd + "].");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,7 +142,7 @@ public class PortalDialog extends JInternalFrame
|
||||
*/
|
||||
protected void handleSubmit ()
|
||||
{
|
||||
// get the destination scene name
|
||||
// get the destination scene name
|
||||
_port.name = _portalText.getText();
|
||||
|
||||
// update the scene's default entrance
|
||||
@@ -160,10 +160,10 @@ public class PortalDialog extends JInternalFrame
|
||||
// documentation inherited
|
||||
protected void processKeyEvent (KeyEvent e)
|
||||
{
|
||||
switch (e.getKeyCode()) {
|
||||
case KeyEvent.VK_ENTER: handleSubmit(); break;
|
||||
case KeyEvent.VK_ESCAPE: setVisible(false); break;
|
||||
}
|
||||
switch (e.getKeyCode()) {
|
||||
case KeyEvent.VK_ENTER: handleSubmit(); break;
|
||||
case KeyEvent.VK_ESCAPE: setVisible(false); break;
|
||||
}
|
||||
}
|
||||
|
||||
/** The scene. */
|
||||
|
||||
@@ -45,12 +45,12 @@ public class EditorDialogUtil
|
||||
* @param cmd the action command.
|
||||
*/
|
||||
public static void addButton (ActionListener l, Container container,
|
||||
String name, String cmd)
|
||||
String name, String cmd)
|
||||
{
|
||||
JButton button = new JButton(name);
|
||||
button.addActionListener(l);
|
||||
button.setActionCommand(cmd);
|
||||
container.add(button);
|
||||
JButton button = new JButton(name);
|
||||
button.addActionListener(l);
|
||||
button.setActionCommand(cmd);
|
||||
container.add(button);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,10 +63,10 @@ public class EditorDialogUtil
|
||||
*/
|
||||
public static JComboBox getOrientationComboBox (ActionListener l)
|
||||
{
|
||||
JComboBox box = new JComboBox(DirectionUtil.getDirectionNames());
|
||||
box.addActionListener(l);
|
||||
box.setActionCommand("orient");
|
||||
return box;
|
||||
JComboBox box = new JComboBox(DirectionUtil.getDirectionNames());
|
||||
box.addActionListener(l);
|
||||
box.setActionCommand("orient");
|
||||
return box;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,8 +90,8 @@ public class EditorDialogUtil
|
||||
{
|
||||
center(parent, dialog);
|
||||
parent.getLayeredPane().add(dialog, JLayeredPane.POPUP_LAYER);
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the supplied dialog from its parent container, but does not
|
||||
|
||||
@@ -86,17 +86,17 @@ public class ViewerApp
|
||||
_rmgr = new ResourceManager("rsrc");
|
||||
_rmgr.initBundles(null, "config/resource/manager.properties", null);
|
||||
_imgr = new ImageManager(_rmgr, _frame);
|
||||
_tilemgr = new MisoTileManager(_rmgr, _imgr);
|
||||
_tilemgr = new MisoTileManager(_rmgr, _imgr);
|
||||
_tilemgr.setTileSetRepository(
|
||||
new BundledTileSetRepository(_rmgr, _imgr, "tilesets"));
|
||||
_colpos = ColorPository.loadColorPository(_rmgr);
|
||||
_crepo = new BundledComponentRepository(_rmgr, _imgr, "components");
|
||||
_mesgmgr = new MessageManager("rsrc.i18n");
|
||||
|
||||
_frame = new ViewerFrame(gc);
|
||||
_frame = new ViewerFrame(gc);
|
||||
_framemgr = FrameManager.newInstance(_frame);
|
||||
|
||||
StageContext ctx = new ContextImpl();
|
||||
StageContext ctx = new ContextImpl();
|
||||
_frame.init(ctx, new CharacterManager(_imgr, _crepo));
|
||||
|
||||
// grab our argument
|
||||
@@ -124,9 +124,9 @@ public class ViewerApp
|
||||
return _framemgr;
|
||||
}
|
||||
|
||||
public MisoTileManager getTileManager () {
|
||||
return _tilemgr;
|
||||
}
|
||||
public MisoTileManager getTileManager () {
|
||||
return _tilemgr;
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public ResourceManager getResourceManager () {
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ViewerFrame extends ManagedJFrame
|
||||
*/
|
||||
public ViewerFrame (GraphicsConfiguration gc)
|
||||
{
|
||||
super(gc);
|
||||
super(gc);
|
||||
|
||||
// set up the frame options
|
||||
setTitle("Scene Viewer");
|
||||
@@ -104,7 +104,7 @@ public class ViewerFrame extends ManagedJFrame
|
||||
public void init (StageContext ctx, CharacterManager charmgr)
|
||||
{
|
||||
_panel = new ViewerScenePanel(ctx, charmgr);
|
||||
getContentPane().add(_panel, BorderLayout.CENTER);
|
||||
getContentPane().add(_panel, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ViewerScenePanel extends StageScenePanel
|
||||
*/
|
||||
public ViewerScenePanel (StageContext ctx, CharacterManager charmgr)
|
||||
{
|
||||
super(ctx, new Controller() {
|
||||
super(ctx, new Controller() {
|
||||
});
|
||||
|
||||
_charmgr = charmgr;
|
||||
@@ -76,7 +76,7 @@ public class ViewerScenePanel extends StageScenePanel
|
||||
_sprite = createSprite(_descUser);
|
||||
setFollowsPathable(_sprite, CENTER_ON_PATHABLE);
|
||||
|
||||
PerformanceMonitor.register(this, "paint", 1000);
|
||||
PerformanceMonitor.register(this, "paint", 1000);
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
@@ -158,8 +158,8 @@ public class ViewerScenePanel extends StageScenePanel
|
||||
// documentation inherited
|
||||
public void paint (Graphics g)
|
||||
{
|
||||
super.paint(g);
|
||||
PerformanceMonitor.tick(this, "paint");
|
||||
super.paint(g);
|
||||
PerformanceMonitor.tick(this, "paint");
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
@@ -197,14 +197,14 @@ public class ViewerScenePanel extends StageScenePanel
|
||||
{
|
||||
// get the path from here to there
|
||||
LineSegmentPath path = (LineSegmentPath)getPath(s, x, y, false);
|
||||
if (path == null) {
|
||||
s.cancelMove();
|
||||
return false;
|
||||
}
|
||||
if (path == null) {
|
||||
s.cancelMove();
|
||||
return false;
|
||||
}
|
||||
|
||||
// start the sprite moving along the path
|
||||
path.setVelocity(100f/1000f);
|
||||
s.move(path);
|
||||
path.setVelocity(100f/1000f);
|
||||
s.move(path);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ package com.threerings.whirled;
|
||||
public class Log
|
||||
{
|
||||
public static com.samskivert.util.Log log =
|
||||
new com.samskivert.util.Log("whirled");
|
||||
new com.samskivert.util.Log("whirled");
|
||||
|
||||
/** Convenience function. */
|
||||
public static boolean debug ()
|
||||
@@ -40,24 +40,24 @@ public class Log
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.debug(message);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,29 +28,29 @@ package com.threerings.whirled.spot;
|
||||
public class Log
|
||||
{
|
||||
public static com.samskivert.util.Log log =
|
||||
new com.samskivert.util.Log("whirled.spot");
|
||||
new com.samskivert.util.Log("whirled.spot");
|
||||
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.debug(message);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,29 +28,29 @@ package com.threerings.whirled.zone;
|
||||
public class Log
|
||||
{
|
||||
public static com.samskivert.util.Log log =
|
||||
new com.samskivert.util.Log("whirled.zone");
|
||||
new com.samskivert.util.Log("whirled.zone");
|
||||
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.debug(message);
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user