com.threerings.stage.tools.editor
Class EditorScenePanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.threerings.media.MediaPanel
                  extended by com.threerings.media.VirtualMediaPanel
                      extended by com.threerings.miso.client.MisoScenePanel
                          extended by com.threerings.stage.client.StageScenePanel
                              extended by com.threerings.stage.tools.editor.EditorScenePanel
All Implemented Interfaces:
ControllerProvider, RadialMenu.Host, PlaceView, com.threerings.media.FrameParticipant, com.threerings.media.MediaConstants, com.threerings.media.MediaHost, com.threerings.media.util.AStarPathUtil.TraversalPred, EditorModelListener, KeyListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, ChangeListener

public class EditorScenePanel
extends StageScenePanel
implements EditorModelListener, ChangeListener

Displays the scene view and handles UI events on the scene. Various actions may be performed on the scene depending on the selected action mode, including placing and deleting tiles or locations and creating portals.

See Also:
Serialized Form

Nested Class Summary
static interface EditorScenePanel.SceneModelListener
           
protected  class EditorScenePanel.UndoStack
           
 
Nested classes/interfaces inherited from class com.threerings.stage.client.StageScenePanel
StageScenePanel.PortalObjectTile
 
Nested classes/interfaces inherited from class com.threerings.miso.client.MisoScenePanel
com.threerings.miso.client.MisoScenePanel.PaintTileOp
 
Nested classes/interfaces inherited from class com.threerings.media.MediaPanel
com.threerings.media.MediaPanel.ActionSpriteHandler, com.threerings.media.MediaPanel.Obscurer
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  Rectangle _area
          The virtual screen rectangle around which we scroll.
protected  EditorScrollBox _box
          The scrollbox that tracks our view.
protected  boolean _coordHighlighting
          Whether or not coordinate highlighting is enabled.
protected  EditorContext _ctx
          Provides access to stuff.
protected  PortalDialog _dialogPortal
          The dialog providing portal edit functionality.
protected  Point _drag
          The location of the start of a tile drag in tile coords.
protected  EditorModel _emodel
          Our editor model.
protected  com.threerings.miso.client.SceneObject _eobject
          The object currently being edited by the object editor dialog.
protected  ArrayList<ExtrasPainter> _extras
          A list of things that will do some extra painting for us.
protected  JFrame _frame
          We need this to create our dialogs when they are needed.
protected  Point _hfull
          The currently highlighted full coordinate.
protected  BoundedRangeModel _horizRange
          Allows scrolling horizontally.
protected static Polygon _locTri
          The triangle used to render a portal on-screen.
protected  ObjectEditorDialog _objEditor
          The dialog providing object edit functionality.
protected  Point _ppos
          The position of the tile currently being placed.
protected  com.threerings.miso.client.SceneObject _pscobj
          Metrics for the tile currently being placed if it is an object tile.
protected  com.threerings.media.tile.Tile _ptile
          The tile currently being placed.
protected  EditorScenePanel.UndoStack _redo
           
protected  boolean _refreshBox
          Do we need to refresh the image being displayed in our scrollbox?
protected  EditorScenePanel.SceneModelListener _sceneListener
           
protected  EditorScenePanel.UndoStack _undo
           
protected  boolean _validPlacement
          Used to track whether or not the current "placing" tile is in a valid position.
protected  BoundedRangeModel _vertRange
          Allows scrolling vertically.
protected static Composite ALPHA_PLACING
          Alpha level used to render transparent placing tile image.
protected static Stroke HIGHLIGHT_STROKE
          The stroke object used to draw highlighted tiles and coordinates.
protected static int MAX_UNDO_SIZE
           
 
Fields inherited from class com.threerings.stage.client.StageScenePanel
_clusters, _clusterWells, _ctrl, _portobjs, _rizer, _scene, CLUSTER_CLICKED, CLUSTER_COLOR, CLUSTER_PAD, CLUSTER_SLOP, CLUSTER_STROKE, HIGHLIGHT_ALPHA, INACTIVE_PORTAL_ALPHA, LOCATION_CLICKED, MAX_LOCATION_DIST, PORTAL_ICON_HEIGHT, PORTAL_ICON_WIDTH, SHOW_CLUSTERS, SHOW_PLOTS, SHOWN_ALPHA
 
Fields inherited from class com.threerings.miso.client.MisoScenePanel
_activeMenu, _applicator, _armedItem, _blocks, _coordsDebug, _delayRepaint, _dframe, _dirtyItems, _dirtySprites, _dpanel, _fringes, _hcoords, _hitList, _hitSprites, _hobject, _ibounds, _indicators, _indicatorsLaidOut, _masks, _metrics, _model, _paintOp, _pathsDebug, _pendingBlocks, _resolveDebug, _resolver, _resolvers, _rethinkOp, _rsize, _showFlags, _tcoords, _traverseDebug, _ulpos, _vibounds, _visiBlocks, _vizobjs, ALPHA_FILL_TILE, DEF_RADIAL_RECT, DIRTY_RECT_STROKE, SHOW_TIPS
 
Fields inherited from class com.threerings.media.VirtualMediaPanel
_abounds, _background, _dx, _dy, _fmode, _fpath, _nx, _ny, _trackers, _vbounds, CENTER_ON_PATHABLE, ENCLOSE_PATHABLE, TRACK_PATHABLE
 
Fields inherited from class com.threerings.media.MediaPanel
_actionHandler, _actionSpriteCount, _animmgr, _metamgr, _obscurerList, _remgr, _spritemgr, _tickPaintPending
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.threerings.stage.tools.editor.EditorModelListener
ACTION_MODE_CHANGED, LAYER_INDEX_CHANGED, TILE_CHANGED
 
Fields inherited from interface com.threerings.media.MediaConstants
ALL, BACK, FRONT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
EditorScenePanel(EditorContext ctx, JFrame frame, EditorModel model, EditorScenePanel.SceneModelListener sceneListener)
          Constructs the editor scene view panel.
 
Method Summary
protected  void addExtrasPainter(ExtrasPainter painter)
          Add an extras painter.
 com.threerings.miso.data.ObjectInfo addObject(com.threerings.miso.data.ObjectInfo oinfo)
          Adds the given object to the scene.
 com.threerings.miso.data.ObjectInfo addObject(com.threerings.media.tile.ObjectTile tile, int fqTileId, int x, int y)
          Sets an object tile at the specified position in the scene (in tile coordinates).
protected  void adjustObjectCoordsAccordingToGrip(Point p, com.threerings.media.tile.ObjectTile tile)
          Alter the position of the object according to which corner we are holding it by.
 Rectangle clearTileSelectRegion(int x, int y)
          Clear and return the drag rectangle for selecting a rectangular region.
protected  void computeScrollArea()
          Computes the area in which the view is allowed to scroll.
 boolean deleteObject(com.threerings.miso.data.ObjectInfo info)
          Delete the given object from the scene.
 boolean deleteObject(com.threerings.miso.client.SceneObject scobj)
          Deletes the object tile at the specified tile coordinates.
 void deletePortal(int x, int y)
          Deletes the portal at the specified full coordinates.
protected  void deleteTile(int x, int y)
          Handle deleting the tile at the given screen coordinates from the scene.
protected  void editPortal(EditablePortal portal)
          Pop up the portal dialog for the specified location.
protected  void editTile(int x, int y)
          Handle editing the tile at the given screen coordinates from the scene.
 void enableCoordHighlighting(boolean enabled)
          Enables or disables highlighting of the tile over which the mouse is currently positioned.
protected  void fireObjectAction(com.threerings.miso.client.ObjectActionHandler handler, com.threerings.miso.client.SceneObject scobj, ActionEvent event)
           
 Portal getEntrance()
          Returns the portal that serves as the default entrance to this scene or null if no default is set.
 BoundedRangeModel getHorizModel()
          Returns a range model that controls the scrollability of the scene in the horizontal direction.
 BoundedRangeModel getVertModel()
          Returns a range model that controls the scrollability of the scene in the vertical direction.
protected  boolean handleMousePressed(Object hobject, MouseEvent event)
           
protected  void hoverObjectChanged(Object oldHover, Object newHover)
          A place for subclasses to react to the hover object changing.
protected  boolean isTilePlacementValid(int x, int y, com.threerings.media.tile.Tile tile)
          Returns whether placing a tile at the given coordinates in the scene is valid.
 void keyPressed(KeyEvent e)
           
 void keyReleased(KeyEvent e)
           
protected  void markCheckpoint()
           
 void modelChanged(int event)
          Called by the EditorModel when the model is changed.
 void mouseDragged(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(MouseEvent event)
           
 void mouseReleased(MouseEvent e)
           
protected  void objectEditorDismissed()
          Called by the ObjectEditorDialog when it is dismissed.
protected  boolean overlaps(com.threerings.miso.client.SceneObject tobj)
          Helper function for recomputeVisible().
protected  void paint(Graphics2D gfx, Rectangle[] dirty)
           
protected  void paintExtras(Graphics2D gfx, Rectangle dirty)
           
protected  void paintHighlights(Graphics2D gfx, Rectangle dirty)
           
protected  void paintLocation(Graphics2D gfx, StageLocation loc, Color color, boolean highlight)
          Paint the specified StageLocation
protected  void paintPlacingTile(Graphics2D gfx)
          Paints a transparent image of the tile being placed and draws a highlight around the bounds of the tile's current prospective position.
protected  void paintPortal(Graphics2D gfx, EditablePortal port)
          Paint the specified portal.
protected  void paintPortals(Graphics2D gfx)
          Paint demarcations at all portals in the scene.
protected  void placeTile(int x, int y)
          Handle placing the currently selected tile at the given screen coordinates in the scene.
protected  void recomputeVisible()
           
 void redo()
           
protected  void removeExtrasPainter(ExtrasPainter painter)
          Remove the specified extras painter.
protected  void selectTile(int x, int y)
           
 boolean setBaseTile(int fqTileId, int x, int y)
          Sets a base tile at the specified position in the scene (in tile coordinates).
 void setBaseTiles(Rectangle r, int setId, int tileCount)
          Set a region of tiles to a random selection from the supplied tileset.
 void setBounds(int x, int y, int width, int height)
           
protected  void setEditorModel(EditorModel model)
          Sets the editor model.
 void setEditorScrollBox(EditorScrollBox box)
          Set the scroll box that tracks our view.
 void setEntrance(Portal port)
          Makes the specified portal the default entrance to this scene.
 void setPlacingTile(com.threerings.media.tile.Tile tile)
          Sets the tile that is currently being placed.
 void setSceneModel(com.threerings.miso.data.MisoSceneModel model)
           
 void setTileSelectRegion(Point drag)
          Sets the start (in tile coords) of a mouse drag when placing a rectangular area of base tiles.
protected  boolean skipHitObject(com.threerings.miso.client.SceneObject scobj)
           
 void stateChanged(ChangeEvent e)
           
 void undo()
           
protected  void updateBaseTiles(int x, int y, Rectangle drag, int fqTileId, int tileSetId, int tileCount)
          Used to place or delete base tiles.
 boolean updateCoordPos(int x, int y, Point cpos)
          Updates the coordinate position and returns true if it has changed.
 void updateDefaultTileSet(int tileSetId)
          Updates the default tileset in the currently edited scene.
protected  boolean updateObjectTileCoords(int sx, int sy, Point tpos, com.threerings.media.tile.ObjectTile otile)
          Converts the supplied screen coordinates into tile coordinates for an object tile.
protected  void updateScrollArea(int hval, int vval)
          Updates our bounded range models to reflect potential changes in the viewable area and the scrollable area.
protected  void warnVisible(com.threerings.miso.client.SceneBlock block, Rectangle sbounds)
           
 
Methods inherited from class com.threerings.stage.client.StageScenePanel
clusterUpdated, computeOverHover, computeUnderHover, containsPoint, defaultShowTips, didLeavePlace, dirtyCluster, dirtyCluster, drawCluster, getColorizer, getColorizer, getController, getPortal, getScene, isPortal, keyTyped, loadPortalTileSet, paintBaseDecorations, paintClusters, recomputePortals, removeCluster, sceneUpdated, setScene, showFlagsDidChange, updateCluster, willEnterPlace
 
Methods inherited from class com.threerings.miso.client.MisoScenePanel
addNotify, allBlocksFinished, appendDirtySprite, blockAbandoned, blockFinished, blockResolved, blockResolving, canTraverse, canTraverseUnresolved, centerOnTile, changeHoverObject, checkShowFlag, clearRadialMenu, clearScene, compose, computeFringeTile, computeIndicators, computeInfluentialBounds, computeInfluentialBounds, dirtyIndicator, enumerateResolvedBlocks, fillTile, getBaseTile, getBlock, getComponent, getFringeTile, getFullCoords, getHitObjects, getHoverCoords, getHoverObject, getInfluentialBounds, getObjectRadialSize, getPath, getRadialMenuBounds, getSceneMetrics, getSceneModel, getScreenCoords, getTileCoords, getTileManager, getTipIcon, getTipText, getViewBounds, handleObjectPressed, handleSpritePressed, isResponsive, menuDeactivated, mouseClicked, mouseEntered, paint, paintBetween, paintBits, paintDirtyItems, paintIndicator, paintIndicators, paintInFront, paintTiles, pressObject, refreshScene, removeNotify, repaintRect, reportMemoryUsage, rethink, setShowFlags, updateTileCoords, viewLocationDidChange
 
Methods inherited from class com.threerings.media.VirtualMediaPanel
addObscurerDirtyRegion, addViewTracker, adjustBoundsCenter, clearPathable, constrainToBounds, didTick, dirtyScreenRect, doLayout, findRootBounds, paintBehind, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeViewTracker, setBackground, setFollowsPathable, setViewLocation, trackPathable
 
Methods inherited from class com.threerings.media.MediaPanel
abortAnimation, addAnimation, addObscurer, addObscurerDirtyRegions, addSprite, clearAnimations, clearSprites, clipToDirtyRegion, createActionSpriteHandler, createGraphics, getAnimationManager, getRegionManager, getSpriteManager, getTimeStamp, isManaged, isManaged, needsPaint, paintDirtyRect, removeObscurer, removeSprite, repaint, setOpaque, setPaused, tick, willTick
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_UNDO_SIZE

protected static final int MAX_UNDO_SIZE
See Also:
Constant Field Values

_ctx

protected EditorContext _ctx
Provides access to stuff.


_emodel

protected EditorModel _emodel
Our editor model.


_box

protected EditorScrollBox _box
The scrollbox that tracks our view.


_refreshBox

protected boolean _refreshBox
Do we need to refresh the image being displayed in our scrollbox?


_frame

protected JFrame _frame
We need this to create our dialogs when they are needed.


_horizRange

protected BoundedRangeModel _horizRange
Allows scrolling horizontally.


_vertRange

protected BoundedRangeModel _vertRange
Allows scrolling vertically.


_area

protected Rectangle _area
The virtual screen rectangle around which we scroll.


_coordHighlighting

protected boolean _coordHighlighting
Whether or not coordinate highlighting is enabled.


_hfull

protected Point _hfull
The currently highlighted full coordinate.


_drag

protected Point _drag
The location of the start of a tile drag in tile coords.


_ppos

protected Point _ppos
The position of the tile currently being placed.


_validPlacement

protected boolean _validPlacement
Used to track whether or not the current "placing" tile is in a valid position.


_ptile

protected com.threerings.media.tile.Tile _ptile
The tile currently being placed.


_pscobj

protected com.threerings.miso.client.SceneObject _pscobj
Metrics for the tile currently being placed if it is an object tile.


_extras

protected ArrayList<ExtrasPainter> _extras
A list of things that will do some extra painting for us.


_dialogPortal

protected PortalDialog _dialogPortal
The dialog providing portal edit functionality.


_objEditor

protected ObjectEditorDialog _objEditor
The dialog providing object edit functionality.


_eobject

protected com.threerings.miso.client.SceneObject _eobject
The object currently being edited by the object editor dialog.


_undo

protected EditorScenePanel.UndoStack _undo

_redo

protected EditorScenePanel.UndoStack _redo

_sceneListener

protected EditorScenePanel.SceneModelListener _sceneListener

_locTri

protected static Polygon _locTri
The triangle used to render a portal on-screen.


HIGHLIGHT_STROKE

protected static final Stroke HIGHLIGHT_STROKE
The stroke object used to draw highlighted tiles and coordinates.


ALPHA_PLACING

protected static final Composite ALPHA_PLACING
Alpha level used to render transparent placing tile image.

Constructor Detail

EditorScenePanel

public EditorScenePanel(EditorContext ctx,
                        JFrame frame,
                        EditorModel model,
                        EditorScenePanel.SceneModelListener sceneListener)
Constructs the editor scene view panel.

Method Detail

getHorizModel

public BoundedRangeModel getHorizModel()
Returns a range model that controls the scrollability of the scene in the horizontal direction.


getVertModel

public BoundedRangeModel getVertModel()
Returns a range model that controls the scrollability of the scene in the vertical direction.


stateChanged

public void stateChanged(ChangeEvent e)
Specified by:
stateChanged in interface ChangeListener

setSceneModel

public void setSceneModel(com.threerings.miso.data.MisoSceneModel model)
Overrides:
setSceneModel in class com.threerings.miso.client.MisoScenePanel

updateDefaultTileSet

public void updateDefaultTileSet(int tileSetId)
Updates the default tileset in the currently edited scene.


setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Overrides:
setBounds in class com.threerings.miso.client.MisoScenePanel

computeScrollArea

protected void computeScrollArea()
Computes the area in which the view is allowed to scroll.


updateScrollArea

protected void updateScrollArea(int hval,
                                int vval)
Updates our bounded range models to reflect potential changes in the viewable area and the scrollable area.


placeTile

protected void placeTile(int x,
                         int y)
Handle placing the currently selected tile at the given screen coordinates in the scene.


deleteTile

protected void deleteTile(int x,
                          int y)
Handle deleting the tile at the given screen coordinates from the scene.


updateBaseTiles

protected void updateBaseTiles(int x,
                               int y,
                               Rectangle drag,
                               int fqTileId,
                               int tileSetId,
                               int tileCount)
Used to place or delete base tiles.


editTile

protected void editTile(int x,
                        int y)
Handle editing the tile at the given screen coordinates from the scene. If the tile is not an object tile, we don't do anything.


selectTile

protected void selectTile(int x,
                          int y)

objectEditorDismissed

protected void objectEditorDismissed()
Called by the ObjectEditorDialog when it is dismissed.


editPortal

protected void editPortal(EditablePortal portal)
Pop up the portal dialog for the specified location.


modelChanged

public void modelChanged(int event)
Description copied from interface: EditorModelListener
Called by the EditorModel when the model is changed.

Specified by:
modelChanged in interface EditorModelListener

mousePressed

public void mousePressed(MouseEvent event)
Specified by:
mousePressed in interface MouseListener
Overrides:
mousePressed in class com.threerings.miso.client.MisoScenePanel

handleMousePressed

protected boolean handleMousePressed(Object hobject,
                                     MouseEvent event)
Overrides:
handleMousePressed in class StageScenePanel

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener
Overrides:
mouseReleased in class com.threerings.miso.client.MisoScenePanel

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener
Overrides:
mouseMoved in class com.threerings.miso.client.MisoScenePanel

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener
Overrides:
mouseDragged in class com.threerings.miso.client.MisoScenePanel

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener
Overrides:
mouseExited in class com.threerings.miso.client.MisoScenePanel

keyPressed

public void keyPressed(KeyEvent e)
Specified by:
keyPressed in interface KeyListener
Overrides:
keyPressed in class StageScenePanel

keyReleased

public void keyReleased(KeyEvent e)
Specified by:
keyReleased in interface KeyListener
Overrides:
keyReleased in class StageScenePanel

fireObjectAction

protected void fireObjectAction(com.threerings.miso.client.ObjectActionHandler handler,
                                com.threerings.miso.client.SceneObject scobj,
                                ActionEvent event)
Overrides:
fireObjectAction in class com.threerings.miso.client.MisoScenePanel

hoverObjectChanged

protected void hoverObjectChanged(Object oldHover,
                                  Object newHover)
A place for subclasses to react to the hover object changing. One of the supplied arguments may be null.

Overrides:
hoverObjectChanged in class StageScenePanel

setBaseTile

public boolean setBaseTile(int fqTileId,
                           int x,
                           int y)
Sets a base tile at the specified position in the scene (in tile coordinates).

Returns:
- if the tile was successfully set

setBaseTiles

public void setBaseTiles(Rectangle r,
                         int setId,
                         int tileCount)
Set a region of tiles to a random selection from the supplied tileset.


addObject

public com.threerings.miso.data.ObjectInfo addObject(com.threerings.media.tile.ObjectTile tile,
                                                     int fqTileId,
                                                     int x,
                                                     int y)
Sets an object tile at the specified position in the scene (in tile coordinates).

Returns:
- the created object or null if an identical object was already in that spot.

addObject

public com.threerings.miso.data.ObjectInfo addObject(com.threerings.miso.data.ObjectInfo oinfo)
Adds the given object to the scene.

Returns:
the added object or null if an identical object was already in that spot.

deleteObject

public boolean deleteObject(com.threerings.miso.client.SceneObject scobj)
Deletes the object tile at the specified tile coordinates.

Returns:
true - if a matching object was found and deleted.

deleteObject

public boolean deleteObject(com.threerings.miso.data.ObjectInfo info)
Delete the given object from the scene.

Returns:
true - if a matching object was found and deleted.

setPlacingTile

public void setPlacingTile(com.threerings.media.tile.Tile tile)
Sets the tile that is currently being placed. It will not be rendered until after a call to MisoScenePanel.updateTileCoords(int, int, java.awt.Point) on the placing tile (which happens automatically when the mouse moves).


setTileSelectRegion

public void setTileSelectRegion(Point drag)
Sets the start (in tile coords) of a mouse drag when placing a rectangular area of base tiles.


clearTileSelectRegion

public Rectangle clearTileSelectRegion(int x,
                                       int y)
Clear and return the drag rectangle for selecting a rectangular region.

Returns:
null if the drag is the same as the supplied tile coordinates, a rectangle containing the selected region if it was different.

enableCoordHighlighting

public void enableCoordHighlighting(boolean enabled)
Enables or disables highlighting of the tile over which the mouse is currently positioned.


deletePortal

public void deletePortal(int x,
                         int y)
Deletes the portal at the specified full coordinates.


getEntrance

public Portal getEntrance()
Returns the portal that serves as the default entrance to this scene or null if no default is set.


setEntrance

public void setEntrance(Portal port)
Makes the specified portal the default entrance to this scene.


recomputeVisible

protected void recomputeVisible()
Overrides:
recomputeVisible in class StageScenePanel

warnVisible

protected void warnVisible(com.threerings.miso.client.SceneBlock block,
                           Rectangle sbounds)
Overrides:
warnVisible in class com.threerings.miso.client.MisoScenePanel

overlaps

protected boolean overlaps(com.threerings.miso.client.SceneObject tobj)
Helper function for recomputeVisible().


paintHighlights

protected void paintHighlights(Graphics2D gfx,
                               Rectangle dirty)

paintExtras

protected void paintExtras(Graphics2D gfx,
                           Rectangle dirty)
Overrides:
paintExtras in class com.threerings.miso.client.MisoScenePanel

addExtrasPainter

protected void addExtrasPainter(ExtrasPainter painter)
Add an extras painter.


removeExtrasPainter

protected void removeExtrasPainter(ExtrasPainter painter)
Remove the specified extras painter.


paintPlacingTile

protected void paintPlacingTile(Graphics2D gfx)
Paints a transparent image of the tile being placed and draws a highlight around the bounds of the tile's current prospective position. The highlight is drawn in green if the tile placement is valid, or red if not.

Parameters:
gfx - the graphics context.

paintPortals

protected void paintPortals(Graphics2D gfx)
Paint demarcations at all portals in the scene.

Parameters:
gfx - the graphics context.

paintPortal

protected void paintPortal(Graphics2D gfx,
                           EditablePortal port)
Paint the specified portal.


paintLocation

protected void paintLocation(Graphics2D gfx,
                             StageLocation loc,
                             Color color,
                             boolean highlight)
Paint the specified StageLocation


updateCoordPos

public boolean updateCoordPos(int x,
                              int y,
                              Point cpos)
Updates the coordinate position and returns true if it has changed.


isTilePlacementValid

protected boolean isTilePlacementValid(int x,
                                       int y,
                                       com.threerings.media.tile.Tile tile)
Returns whether placing a tile at the given coordinates in the scene is valid. Makes sure placing an object fits within the scene and doesn't overlap any other objects.


skipHitObject

protected boolean skipHitObject(com.threerings.miso.client.SceneObject scobj)
Overrides:
skipHitObject in class com.threerings.miso.client.MisoScenePanel

updateObjectTileCoords

protected boolean updateObjectTileCoords(int sx,
                                         int sy,
                                         Point tpos,
                                         com.threerings.media.tile.ObjectTile otile)
Converts the supplied screen coordinates into tile coordinates for an object tile. (See MisoScenePanel.updateTileCoords(int, int, java.awt.Point).)

Returns:
true if the tile coordinates have changed.

adjustObjectCoordsAccordingToGrip

protected void adjustObjectCoordsAccordingToGrip(Point p,
                                                 com.threerings.media.tile.ObjectTile tile)
Alter the position of the object according to which corner we are holding it by.


setEditorModel

protected void setEditorModel(EditorModel model)
Sets the editor model.


setEditorScrollBox

public void setEditorScrollBox(EditorScrollBox box)
Set the scroll box that tracks our view.


paint

protected void paint(Graphics2D gfx,
                     Rectangle[] dirty)
Overrides:
paint in class com.threerings.media.VirtualMediaPanel

markCheckpoint

protected void markCheckpoint()

undo

public void undo()

redo

public void redo()