diff --git a/src/java/com/threerings/miso/client/IsoSceneView.java b/src/java/com/threerings/miso/client/IsoSceneView.java index 5c7791124..c4f887d0c 100644 --- a/src/java/com/threerings/miso/client/IsoSceneView.java +++ b/src/java/com/threerings/miso/client/IsoSceneView.java @@ -1,5 +1,5 @@ // -// $Id: IsoSceneView.java,v 1.129 2003/01/15 04:25:45 shaper Exp $ +// $Id: IsoSceneView.java,v 1.130 2003/01/15 21:12:45 shaper Exp $ package com.threerings.miso.scene; @@ -168,7 +168,7 @@ public class IsoSceneView implements SceneView renderDirtyItems(gfx, dirtyRect); // draw sprite paths - if (_model.showPaths) { + if (_pathsDebug.getValue()) { _spritemgr.renderSpritePaths(gfx); } @@ -239,13 +239,12 @@ public class IsoSceneView implements SceneView // if we're showing coordinates, we need to do some setting up int thw = 0, thh = 0, fhei = 0; FontMetrics fm = null; - if (_model.showCoords) { + if (_coordsDebug.getValue()) { fm = gfx.getFontMetrics(_font); fhei = fm.getAscent(); thw = _model.tilehwid; thh = _model.tilehhei; gfx.setFont(_font); - gfx.setColor(Color.white); } // determine which tiles intersect this clipping region: this is @@ -316,7 +315,7 @@ public class IsoSceneView implements SceneView passable = ((BaseTile)tile).isPassable(); // highlight impassable tiles - if (_isoRenderDebug.getValue() && !passable) { + if (_traverseDebug.getValue() && !passable) { fillTile(gfx, tx, ty, Color.yellow); } } @@ -326,7 +325,7 @@ public class IsoSceneView implements SceneView } // highlight passable non-traversable tiles - if (_isoRenderDebug.getValue() && passable && + if (_traverseDebug.getValue() && passable && !_scene.canTraverse(null, tx, ty)) { fillTile(gfx, tx, ty, Color.green); } @@ -338,9 +337,8 @@ public class IsoSceneView implements SceneView } // if we're showing coordinates, do that - if (_model.showCoords) { - // outline the tile -// gfx.draw(tpoly); + if (_coordsDebug.getValue()) { + gfx.setColor(Color.white); // get the top-left screen coordinates of the tile int sx = _tbounds.x, sy = _tbounds.y; @@ -430,7 +428,7 @@ public class IsoSceneView implements SceneView // compute the footprint if we're rendering those Polygon foot = null; - if (_model.showFootprints) { + if (_fprintDebug.getValue()) { foot = IsoUtil.getObjectFootprint(_model, scobj); } @@ -739,11 +737,32 @@ public class IsoSceneView implements SceneView /** The stroke object used to draw highlighted tiles and coordinates. */ protected BasicStroke _hstroke = new BasicStroke(2); - /** A debug hook that toggles debug rendering in the iso scene view. */ - protected static RuntimeAdjust.BooleanAdjust _isoRenderDebug = + /** A debug hook that toggles debug rendering of traversable tiles. */ + protected static RuntimeAdjust.BooleanAdjust _traverseDebug = new RuntimeAdjust.BooleanAdjust( - "Toggles debug rendering in the iso scene view.", - "narya.miso.iso_debug_render", MisoPrefs.config, false); + "Toggles debug rendering of traversable and impassable tiles in " + + "the iso scene view.", "narya.miso.iso_traverse_debug_render", + MisoPrefs.config, false); + + /** A debug hook that toggles debug rendering of tile coordinates. */ + protected static RuntimeAdjust.BooleanAdjust _coordsDebug = + new RuntimeAdjust.BooleanAdjust( + "Toggles debug rendering of tile coordinates in the iso scene " + + "view.", "narya.miso.iso_coords_debug_render", + MisoPrefs.config, false); + + /** A debug hook that toggles debug rendering of sprite paths. */ + protected static RuntimeAdjust.BooleanAdjust _pathsDebug = + new RuntimeAdjust.BooleanAdjust( + "Toggles debug rendering of sprite paths in the iso scene view.", + "narya.miso.iso_paths_debug_render", MisoPrefs.config, false); + + /** A debug hook that toggles debug rendering of object footprints. */ + protected static RuntimeAdjust.BooleanAdjust _fprintDebug = + new RuntimeAdjust.BooleanAdjust( + "Toggles debug rendering of object footprints in the iso scene " + + "view.", "narya.miso.iso_fprint_debug_render", + MisoPrefs.config, false); /** The stroke used to draw dirty rectangles. */ protected static final Stroke DIRTY_RECT_STROKE = new BasicStroke(2); diff --git a/src/java/com/threerings/miso/client/IsoSceneViewModel.java b/src/java/com/threerings/miso/client/IsoSceneViewModel.java index 56e81cc26..c61087e22 100644 --- a/src/java/com/threerings/miso/client/IsoSceneViewModel.java +++ b/src/java/com/threerings/miso/client/IsoSceneViewModel.java @@ -1,11 +1,10 @@ // -// $Id: IsoSceneViewModel.java,v 1.26 2002/06/21 00:04:41 mdb Exp $ +// $Id: IsoSceneViewModel.java,v 1.27 2003/01/15 21:12:45 shaper Exp $ package com.threerings.miso.scene; import java.awt.Point; import java.awt.Rectangle; -import java.util.ArrayList; import com.threerings.miso.Log; import com.threerings.miso.MisoConfig; @@ -71,15 +70,6 @@ public class IsoSceneViewModel /** The slope of the x- and y-axis lines within a tile. */ public float fineSlopeX, fineSlopeY; - /** Whether tile coordinates should be drawn. */ - public boolean showCoords; - - /** Whether sprite paths should be drawn. */ - public boolean showPaths; - - /** Whether object footprints should be drawn. */ - public boolean showFootprints; - /** * Construct an iso scene view model with view parameters as * specified in the given config object. @@ -107,13 +97,6 @@ public class IsoSceneViewModel // set the fine coordinate granularity finegran = MisoConfig.config.getValue(FINE_GRAN_KEY, DEF_FINE_GRAN); - // set our various flags - showCoords = MisoConfig.config.getValue( - SHOW_COORDS_KEY, DEF_SHOW_COORDS); - showPaths = MisoConfig.config.getValue(SHOW_PATHS_KEY, DEF_SHOW_PATHS); - showFootprints = MisoConfig.config.getValue( - SHOW_FOOTPRINTS_KEY, DEF_SHOW_FOOTPRINTS); - // precalculate various things int offy = MisoConfig.config.getValue(SCENE_OFFSET_Y_KEY, DEF_OFFSET_Y); precalculate(offy); @@ -153,31 +136,6 @@ public class IsoSceneViewModel precalculate(offy); } - /** - * Add an iso scene view model listener. - * - * @param l the listener. - */ - public void addListener (IsoSceneViewModelListener l) - { - if (!_listeners.contains(l)) { - _listeners.add(l); - } - } - - /** - * Notify all model listeners that the iso scene view model has - * changed. - */ - protected void notifyListeners (int event) - { - int size = _listeners.size(); - for (int ii = 0; ii < size; ii++) { - ((IsoSceneViewModelListener)_listeners.get(ii)). - viewChanged(event); - } - } - /** * Returns whether the given tile coordinate is a valid coordinate * within the scene. @@ -201,24 +159,6 @@ public class IsoSceneViewModel fy >= 0 && fy < finegran); } - /** - * Toggle whether coordinates should be drawn for each tile. - */ - public void toggleShowCoordinates () - { - showCoords = !showCoords; - notifyListeners(IsoSceneViewModelListener.SHOW_COORDINATES_CHANGED); - } - - /** - * Toggle whether footprints should be drawn for each object tile. - */ - public void toggleShowFootprints () - { - showFootprints = !showFootprints; - notifyListeners(IsoSceneViewModelListener.SHOW_FOOTPRINTS_CHANGED); - } - /** * Pre-calculate various member data that are commonly used in working * with an isometric view. @@ -312,15 +252,6 @@ public class IsoSceneViewModel /** The config key for scene origin vertical offset in tile count. */ protected static final String SCENE_OFFSET_Y_KEY = "scene_offset_y"; - /** The config key for whether to show tile coordinates. */ - protected static final String SHOW_COORDS_KEY = "show_coords"; - - /** The config key for whether to show sprite paths. */ - protected static final String SHOW_PATHS_KEY = "show_paths"; - - /** The config key for whether to show object tile footprints. */ - protected static final String SHOW_FOOTPRINTS_KEY = "show_footprints"; - /** Default scene view parameters. */ protected static final int DEF_TILE_WIDTH = 64; protected static final int DEF_TILE_HEIGHT = 48; @@ -330,10 +261,4 @@ public class IsoSceneViewModel protected static final int DEF_SCENE_WIDTH = 22; protected static final int DEF_SCENE_HEIGHT = 22; protected static final int DEF_OFFSET_Y = -5; - protected static final boolean DEF_SHOW_COORDS = false; - protected static final boolean DEF_SHOW_PATHS = false; - protected static final boolean DEF_SHOW_FOOTPRINTS = false; - - /** The model listeners. */ - protected ArrayList _listeners = new ArrayList(); } diff --git a/src/java/com/threerings/miso/client/SceneViewPanel.java b/src/java/com/threerings/miso/client/SceneViewPanel.java index 2314a570d..947e92de6 100644 --- a/src/java/com/threerings/miso/client/SceneViewPanel.java +++ b/src/java/com/threerings/miso/client/SceneViewPanel.java @@ -1,5 +1,5 @@ // -// $Id: SceneViewPanel.java,v 1.47 2002/12/05 23:06:30 mdb Exp $ +// $Id: SceneViewPanel.java,v 1.48 2003/01/15 21:12:45 shaper Exp $ package com.threerings.miso.scene; @@ -30,7 +30,6 @@ import com.threerings.miso.scene.util.IsoUtil; * UI events. */ public class SceneViewPanel extends VirtualMediaPanel - implements IsoSceneViewModelListener { /** * Constructs the scene view panel with the supplied view model. @@ -45,10 +44,6 @@ public class SceneViewPanel extends VirtualMediaPanel // create the data model for the scene view _viewmodel = model; - // listen to the iso scene view model to receive notice when - // the scene display has changed and needs must be repainted - _viewmodel.addListener(this); - // create the scene view _view = newSceneView(_spritemgr, _viewmodel); @@ -171,13 +166,6 @@ public class SceneViewPanel extends VirtualMediaPanel super.getPreferredSize() : _viewmodel.bounds.getSize(); } - // documentation inherited - public void viewChanged (int event) - { - // update the scene view display - repaint(); - } - /** The scene view data model. */ protected IsoSceneViewModel _viewmodel;