You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <aki...@us...> - 2006-12-07 23:38:31
|
Revision: 959 http://svn.sourceforge.net/gridarta/?rev=959&view=rev Author: akirschbaum Date: 2006-12-07 15:38:31 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Comment changes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:32:40 UTC (rev 958) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:38:31 UTC (rev 959) @@ -149,9 +149,7 @@ return isPickmap; } - /** - * @return an image of the entire mapview - */ + /** {@inheritDoc} */ public BufferedImage getFullImage() { final Size2D mapSize = mapControl.getMapSize(); final int mapWidth = 32 * mapSize.getWidth(); Modified: trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-07 23:32:40 UTC (rev 958) +++ trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-07 23:38:31 UTC (rev 959) @@ -36,6 +36,9 @@ public abstract void updateLookAndFeel(); + /** + * @return an image of the entire mapview + */ public abstract BufferedImage getFullImage(); public abstract void paintTile(final Point point); Modified: trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:32:40 UTC (rev 958) +++ trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:38:31 UTC (rev 959) @@ -184,9 +184,7 @@ return isPickmap; } - /** - * @return an image of the entire mapview - */ + /** {@inheritDoc} */ @Override public BufferedImage getFullImage() { // set map dimensions for iso view final int sum = mapSize.getWidth() + mapSize.getHeight(); Modified: trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java 2006-12-07 23:32:40 UTC (rev 958) +++ trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java 2006-12-07 23:38:31 UTC (rev 959) @@ -34,6 +34,9 @@ */ public abstract class LevelRenderer extends JComponent { + /** + * @return an image of the entire mapview + */ public abstract BufferedImage getFullImage(); /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 23:32:41
|
Revision: 958 http://svn.sourceforge.net/gridarta/?rev=958&view=rev Author: akirschbaum Date: 2006-12-07 15:32:40 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Remove LevelRenderer.isPickmap(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-07 23:29:54 UTC (rev 957) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-07 23:32:40 UTC (rev 958) @@ -736,7 +736,7 @@ mapMouseRightOff.y = 0; if (mapLoc.x == -1 || mapLoc.y == -1) { - if (!renderer.isPickmap()) { + if (!mapControl.isPickmap()) { mainControl.getMainView().setMapTileList(null, null); if (highlightOn) { @@ -757,7 +757,7 @@ // paint the highlight-icon renderer.setHighlightTile(/*((JComponent)renderer).getGraphics(), */mapLoc); - if (renderer.isPickmap()) { + if (mapControl.isPickmap()) { final GameObject arch = mapControl.getBottomArchObject(mapLoc); if (arch != null) { // an arch of a pickmap was selected Modified: trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-07 23:29:54 UTC (rev 957) +++ trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-07 23:32:40 UTC (rev 958) @@ -49,8 +49,6 @@ */ @Nullable public abstract Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint); - public abstract boolean isPickmap(); - public abstract void modelChanged(); public abstract void setHighlightTile(final Point point); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 23:29:54
|
Revision: 957 http://svn.sourceforge.net/gridarta/?rev=957&view=rev Author: akirschbaum Date: 2006-12-07 15:29:54 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Comment changes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:26:23 UTC (rev 956) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:29:54 UTC (rev 957) @@ -461,13 +461,7 @@ } } - /** - * Returns the map location at the given point or null if no map location - * is at the point. - * @param point The coordinates in the renderer view. - * @param retPoint if <cod>(retPoint != null)</code> this point will be returned otherwise a new point will be created - * @return The map location. - */ + /** {@inheritDoc} */ @Nullable public Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint) { try { renderTransform.inverseTransform(point, point); Modified: trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-07 23:26:23 UTC (rev 956) +++ trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-07 23:29:54 UTC (rev 957) @@ -28,8 +28,8 @@ import org.jetbrains.annotations.Nullable; /** - * A lavel renderer, mainly used as central point interfac to iso and flat - * renderer + * A lavel renderer, mainly used as central point to iso and flat renderer. + * * @author tchize */ public abstract class LevelRenderer extends JComponent { @@ -40,6 +40,13 @@ public abstract void paintTile(final Point point); + /** + * Returns the map location at the given point or null if no map location + * is at the point. + * @param point The coordinates in the renderer view. + * @param retPoint if <cod>(retPoint != null)</code> this point will be returned otherwise a new point will be created + * @return The map location. + */ @Nullable public abstract Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint); public abstract boolean isPickmap(); @@ -52,4 +59,4 @@ public abstract void freeBackBuffer(); -} // interface LevelRenderer +} // class LevelRenderer Modified: trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:26:23 UTC (rev 956) +++ trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:29:54 UTC (rev 957) @@ -428,13 +428,7 @@ } } - /** - * Returns the map location at the given point or null if no map location - * is at the point. - * @param point The coordinates in the renderer view. - * @param retPoint if <cod>(retPoint != null)</code> this point will be returned otherwise a new point will be created - * @return The map location. - */ + /** {@inheritDoc} */ @Nullable public Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint) { final int x0 = point.x - origin.x; Modified: trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java 2006-12-07 23:26:23 UTC (rev 956) +++ trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java 2006-12-07 23:29:54 UTC (rev 957) @@ -27,10 +27,22 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +/** + * A lavel renderer, mainly used as central point to iso and flat renderer. + * + * @author tchize + */ public abstract class LevelRenderer extends JComponent { public abstract BufferedImage getFullImage(); + /** + * Returns the map location at the given point or null if no map location + * is at the point. + * @param point The coordinates in the renderer view. + * @param retPoint if <cod>(retPoint != null)</code> this point will be returned otherwise a new point will be created + * @return The map location. + */ @Nullable public abstract Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint); } // class LevelRenderer This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 23:26:22
|
Revision: 956 http://svn.sourceforge.net/gridarta/?rev=956&view=rev Author: akirschbaum Date: 2006-12-07 15:26:23 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Use LevelRenderer. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainStatusbar.java trunk/daimonin/src/daieditor/CMainStatusbar.java Modified: trunk/crossfire/src/cfeditor/CMainStatusbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-12-07 23:23:29 UTC (rev 955) +++ trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-12-07 23:26:23 UTC (rev 956) @@ -25,7 +25,7 @@ package cfeditor; -import cfeditor.gui.map.DefaultLevelRenderer; +import cfeditor.gui.map.LevelRenderer; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -212,7 +212,7 @@ final Point mousePos = e.getPoint(); final int mouseX = mousePos.x; final int mouseY = mousePos.y; - final DefaultLevelRenderer renderer = (DefaultLevelRenderer) e.getSource(); + final LevelRenderer renderer = (LevelRenderer) e.getSource(); final Point mouseMap = renderer.getTileLocationAt(mousePos, mouseMapTmp); if (mouseMap != null) { final int mouseMapX = mouseMap.x; Modified: trunk/daimonin/src/daieditor/CMainStatusbar.java =================================================================== --- trunk/daimonin/src/daieditor/CMainStatusbar.java 2006-12-07 23:23:29 UTC (rev 955) +++ trunk/daimonin/src/daieditor/CMainStatusbar.java 2006-12-07 23:26:23 UTC (rev 956) @@ -25,7 +25,7 @@ package daieditor; -import daieditor.gui.map.DefaultLevelRenderer; +import daieditor.gui.map.LevelRenderer; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -212,7 +212,7 @@ final Point mousePos = e.getPoint(); final int mouseX = mousePos.x; final int mouseY = mousePos.y; - final DefaultLevelRenderer renderer = (DefaultLevelRenderer) e.getSource(); + final LevelRenderer renderer = (LevelRenderer) e.getSource(); final Point mouseMap = renderer.getTileLocationAt(mousePos, mouseMapTmp); if (mouseMap != null) { final int mouseMapX = mouseMap.x; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 23:23:29
|
Revision: 955 http://svn.sourceforge.net/gridarta/?rev=955&view=rev Author: akirschbaum Date: 2006-12-07 15:23:29 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Unify CMainStatusbar. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainStatusbar.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/messages_de.properties trunk/daimonin/src/daieditor/CArchPanelPan.java trunk/daimonin/src/daieditor/CMainStatusbar.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/messages.properties trunk/src/app/net/sf/gridarta/messages.properties Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/ChangeLog 2006-12-07 23:23:29 UTC (rev 955) @@ -1,5 +1,7 @@ 2006-12-07 Andreas Kirschbaum + * Make mouse position display work again. + * Do not insert multiple identical objects while dragging the mouse. Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-12-07 23:23:29 UTC (rev 955) @@ -271,7 +271,7 @@ final GameObject archetype = archetypeSet.getArchetype(archetypeName); if (isSelected) { archPanel.setSelectedArch(archetypeName); - mainControl.setStatusText(" " + archetypeName + " "); + mainControl.setStatusText(archetypeName); } assert archetype != null : "Archetype not found: " + archetypeName; setText(archetypeName); Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-07 23:23:29 UTC (rev 955) @@ -281,7 +281,11 @@ CFTreasureListTree.getInstance().showDialog(); } - private FaceObjects getFaceObjects() { + /** + * Get the Face Objects. + * @return faceObjects + */ + public FaceObjects getFaceObjects() { return faceObjects; } @@ -600,16 +604,12 @@ * @param filename desired filename for the new map, null if not specified */ public void newLevelWanted(final String filename) { - CMainStatusbar.getInstance().setText(" Creating new map..."); CNewMapDialog.showNewMapDialog(this, mainView, filename, MapType.GAMEMAP); - CMainStatusbar.getInstance().setText(""); } /** Invoked when user wants to open a new pickmap. */ public void addNewPickmap() { - CMainStatusbar.getInstance().setText(" Creating new pickmap..."); CNewMapDialog.showNewMapDialog(this, mainView, null, MapType.PICKMAP); - CMainStatusbar.getInstance().setText(""); } /** @@ -622,10 +622,10 @@ */ public MapControl newLevel(final List<GameObject> objects, final MapArchObject maparch, final boolean view, final Point initial) { // Create a new level control and set the level view from that - CMainStatusbar.getInstance().setText(" Creating new map " + maparch.getMapDisplayName()); final MapControl map = new MapControl(this, objects, maparch, false, initial); if (view) { + setStatusText("Creating new map " + maparch.getMapDisplayName()); mainView.addLevelView(map.getMapViewFrame()); // one view... map.getMapViewFrame().setAutoscrolls(true); levels.add(map); Modified: trunk/crossfire/src/cfeditor/CMainStatusbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-12-07 23:23:29 UTC (rev 955) @@ -2,6 +2,7 @@ * Crossfire Java Editor. * Copyright (C) 2000 Michael Toennies * Copyright (C) 2001 Andreas Vogl + * Copyright (C) 2005 Christian Hujer * * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) * @@ -24,11 +25,21 @@ package cfeditor; -import java.awt.BorderLayout; +import cfeditor.gui.map.DefaultLevelRenderer; +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Point; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; import java.text.NumberFormat; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.border.BevelBorder; +import net.sf.gridarta.gui.map.MapCursor; +import net.sf.gridarta.gui.map.MapCursorEvent; +import net.sf.gridarta.gui.map.MapCursorListener; +import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.Nullable; /** @@ -38,27 +49,36 @@ * panels. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> + * @todo Separate labels and methods for mouse coordinates */ -public final class CMainStatusbar extends JPanel { +public final class CMainStatusbar extends JPanel implements MapCursorListener, MouseMotionListener { /** Serial Version UID. */ private static final long serialVersionUID = 1L; - /** The most recent instance of this statusbar class. */ - private static CMainStatusbar staticStatusbar = null; + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); /** Controller of this statusbar view. */ private final CMainControl mainControl; + /** The label that shows the mouse. */ + private final JLabel mouse; + + /** The label that shows the cursor. */ + private final JLabel cursor; + /** The label that shows the one line text message. */ private final JLabel status; - /** The label that shows the level status. */ - private final JLabel levelStatus; - /** The label that shows the memory status. */ private final JLabel memory; + /** Temporary used to get map coordinates */ + private final Point mouseMapTmp = new Point(); + /** * Constructs a statusbar that has the given main controller object set * as its controller. @@ -66,56 +86,43 @@ */ public CMainStatusbar(final CMainControl mainControl) { this.mainControl = mainControl; + setLayout(new GridBagLayout()); + setBorder(new BevelBorder(BevelBorder.LOWERED)); - setLayout(new BorderLayout()); + final GridBagConstraints gbc = new GridBagConstraints(); + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.anchor = GridBagConstraints.WEST; + gbc.ipadx = 1; - final JPanel mainPanel = new JPanel(new BorderLayout()); - mainPanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); - status = new JLabel(" "); - mainPanel.add(status, BorderLayout.CENTER); + gbc.weightx = 0.0; + mouse = new JLabel(" "); + mouse.setBorder(new BevelBorder(BevelBorder.LOWERED)); + add(mouse, gbc); - add(mainPanel, BorderLayout.CENTER); + cursor = new JLabel(" "); + cursor.setBorder(new BevelBorder(BevelBorder.LOWERED)); + add(cursor, gbc); - final JPanel infoPanel = new JPanel(new BorderLayout()); + gbc.weightx = 5.0; + status = new JLabel(" "); + status.setBorder(new BevelBorder(BevelBorder.LOWERED)); + add(status, gbc); - final JPanel levelInfoPanel = new JPanel(new BorderLayout()); - levelInfoPanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); - levelStatus = new JLabel(" "); - levelInfoPanel.add(levelStatus, BorderLayout.CENTER); - infoPanel.add(levelInfoPanel, BorderLayout.CENTER); - - final JPanel memInfoPanel = new JPanel(new BorderLayout()); - memInfoPanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); - memory = new JLabel(" "); - memInfoPanel.add(memory, BorderLayout.CENTER); - infoPanel.add(memInfoPanel, BorderLayout.WEST); - - mainPanel.add(infoPanel, BorderLayout.EAST); - - staticStatusbar = this; + gbc.weightx = 0.0; + memory = new JLabel(" "); + memory.setBorder(new BevelBorder(BevelBorder.LOWERED)); + add(memory, gbc); } /** - * Returns the instance of this statusbar once its created by someone. - * @return The statusbar. + * Sets the level status text, which usually displays arch numbers. + * @param text String to set */ - public static CMainStatusbar getInstance() { - return staticStatusbar; + public void setStatusText(final String text) { + status.setText(text); + refresh(); } - /** - * Sets the one line text displayed to the user. - * @param strText The text to be set. - */ - public void setText(final String strText) { - status.setText(strText); - repaint(); - } - - void setStatusText(final String string) { - levelStatus.setText(string != null ? string : " "); - } - /** Refreshes the memory usage info panel. */ void refresh() { final Runtime runtime = Runtime.getRuntime(); @@ -123,10 +130,11 @@ final long totMem = runtime.totalMemory(); final long usedMem = totMem - freeMem; - memory.setText(" ( " + mainControl.getArchetypeSet().getArchetypeCount() - + "/" + mainControl.getArchetypeSet().getFaceCount() - + " ) Memory Use:" + getMemoryString(usedMem) + "/" + getMemoryString(totMem)); - repaint(); + memory.setText(ACTION_FACTORY.format("memory", + mainControl.getArchetypeSet().getArchetypeCount(), + mainControl.getFaceObjects().size(), + getMemoryString(usedMem), getMemoryString(freeMem), getMemoryString(totMem) + )); } /** The DecimalFormat to use for formatting the numbers in {@link #getMemoryString(long)}.. */ @@ -157,4 +165,62 @@ return null; } + public void mapCursorChangedPos(final MapCursorEvent e) { + mapCursorChanged(e.getSource()); + } + + public void mapCursorChangedMode(final MapCursorEvent e) { + mapCursorChanged(e.getSource()); + } + + /** Set coordinates of MapCursor to cursor label and the offset when in drag mode. */ + private void mapCursorChanged(final MapCursor mapCursor) { + final String formatCursor; + if (mapCursor.isActive()) { + final Point pos = mapCursor.getLocation(); + assert pos != null; + final int cursorX = pos.x; + final int cursorY = pos.y; + if (mapCursor.isDragging()) { + final Dimension offset = mapCursor.getDragOffset(); + assert offset != null; + final int offsetX = Math.abs(offset.width) + 1; + final int offsetY = Math.abs(offset.height) + 1; + formatCursor = ACTION_FACTORY.format("statusSelect", cursorX, cursorY, offsetX, offsetY); + } else { + formatCursor = ACTION_FACTORY.format("statusNormal", cursorX, cursorY); + } + } else { + formatCursor = ACTION_FACTORY.format("statusCursorOff"); + } + cursor.setText(formatCursor); + } + + public void mouseDragged(final MouseEvent e) { + mousePosChanged(e); + } + + public void mouseMoved(final MouseEvent e) { + mousePosChanged(e); + } + + /** + * Set new mouse and map coordinates to mouse label + * @param e Event that was fired from #MapCursor + */ + private void mousePosChanged(final MouseEvent e) { + final Point mousePos = e.getPoint(); + final int mouseX = mousePos.x; + final int mouseY = mousePos.y; + final DefaultLevelRenderer renderer = (DefaultLevelRenderer) e.getSource(); + final Point mouseMap = renderer.getTileLocationAt(mousePos, mouseMapTmp); + if (mouseMap != null) { + final int mouseMapX = mouseMap.x; + final int mouseMapY = mouseMap.y; + mouse.setText(ACTION_FACTORY.format("statusMouseOn", mouseX, mouseY, mouseMapX, mouseMapY)); + } else { + mouse.setText(ACTION_FACTORY.format("statusMouseOff", mouseX, mouseY)); + } + } + } // class CMainStatusbar Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-12-07 23:23:29 UTC (rev 955) @@ -196,9 +196,6 @@ //getContentPane().add(toolBar, BorderLayout.NORTH); getContentPane().add(toolBar, BorderLayout.WEST); // put it left - statusBar = new CMainStatusbar(mainControl); - getContentPane().add(statusBar, BorderLayout.SOUTH); - menu = new CMainMenu(mainControl); setJMenuBar(menu); @@ -207,6 +204,9 @@ pickmapPanel.setBorder(BorderFactory.createEmptyBorder(IGUIConstants.SPACE_PICKARCH_TOP, 0, 0, 0)); CPickmapPanel.getInstance().addPickmapSelectionListener(pickmapPanel); + statusBar = new CMainStatusbar(mainControl); + getContentPane().add(statusBar, BorderLayout.SOUTH); + // Build the placeholder for tile palette archPanel = new CArchPanel(mainControl); mapTileList = new CMapTileList(mainControl, this); @@ -393,10 +393,10 @@ /** * Set the status message to be displayed in the status bar. - * @param string status message to be displayed + * @param statusText status message to be displayed */ - public void setStatusText(final String string) { - statusBar.setStatusText(string); + public void setStatusText(final String statusText) { + statusBar.setStatusText(statusText); } /** @@ -736,4 +736,8 @@ public void internalFrameDeactivated(final InternalFrameEvent e) { } + public CMainStatusbar getStatusBar() { + return statusBar; + } + } // class CMainView Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-07 23:23:29 UTC (rev 955) @@ -152,7 +152,8 @@ final CListener listener = new CListener(); ((JComponent) renderer).addMouseListener(listener); if (!isPickmap()) { - ((JComponent) renderer).addMouseMotionListener(listener); + renderer.addMouseMotionListener(listener); + renderer.addMouseMotionListener(mainControl.getMainView().getStatusBar()); } renderer.updateLookAndFeel(); } @@ -514,7 +515,7 @@ public void mousePressed(final MouseEvent e) { changedFlagNotify(); // set flag: map has changed final Point clickPoint = e.getPoint(); - final Point mapLoc = renderer.getTileLocationAt(clickPoint); + final Point mapLoc = renderer.getTileLocationAt(clickPoint, null); needRedraw = null; Point[] preRedraw = null; // array of tile coords which need to be redrawn boolean needFullRepaint = false; // true if full repaint of map needed @@ -604,33 +605,20 @@ /** {@inheritDoc} */ public void mouseMoved(final MouseEvent event) { - final int xp, yp; - - final Point dragPoint = event.getPoint(); - xp = (int) dragPoint.getX(); - yp = (int) dragPoint.getY(); - - // draw Mouse coordinates into the status bar (bottom of window) - if (mapMousePos.x == -1 && mapMousePos.y == -1) { - CMainStatusbar.getInstance().setText(" Mouse off Map"); - } else { - CMainStatusbar.getInstance().setText(" Mouse x:" + (int) xp + " y:" + (int) yp + " MAP x:" + mapMousePos.x + " y:" + mapMousePos.y); - } // repaint(); // we should blt here with clipping... // this paints the whole map again, but we want only the marker } /** {@inheritDoc} */ public void mouseDragged(final MouseEvent event) { - final int xp, yp; - changedFlagNotify(); Point[] needRedraw = null; // array of tile coords which need to be redrawn final Point dragPoint = event.getPoint(); // Mouse pointer - xp = (int) dragPoint.getX(); - yp = (int) dragPoint.getY(); - final Point temp = renderer.getTileLocationAt(dragPoint); // tile under Mouse pointer + Point temp = renderer.getTileLocationAt(dragPoint, null); // tile under Mouse pointer + if (temp == null) { + temp = new Point(-1, -1); + } if (event.getModifiers() == MouseEvent.BUTTON1_MASK) { // Left Mouse Button: Selected area gets highlighted @@ -646,20 +634,8 @@ renderer.modelChanged(); } - - // print location infos on status bar - if (highlightOn && (mapMouseRightOff.x != 0 || mapMouseRightOff.y != 0)) { - CMainStatusbar.getInstance().setText(" Mouse x:" + (int) xp + " y:" + (int) yp + " MAP x:" + mapMousePos.x + " y:" + mapMousePos.y - + " Selected x:" + (int) (Math.abs(mapMouseRightOff.x) + 1) + " y:" + (int) (Math.abs(mapMouseRightOff.y + 1))); - } else { - CMainStatusbar.getInstance().setText(" Mouse x:" + (int) xp + " y:" + (int) yp + " MAP x:" + mapMousePos.x + " y:" + mapMousePos.y); - } } else if (event.getModifiers() == MouseEvent.BUTTON3_MASK) { // Right Mouse Button: Arches get inserted all the way - - CMainStatusbar.getInstance().setText("Mouse x:" + (int) xp + " y:" + (int) yp + " MAP x:" + mapMousePos.x + " y:" + mapMousePos.y - + " Insert: " + insertArchName); - if (temp.x != mapMouseRightPos.x || mapMouseRightPos.y != temp.y) { mapMouseRightPos.x = temp.x; mapMouseRightPos.y = temp.y; Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-07 23:23:29 UTC (rev 955) @@ -28,7 +28,6 @@ import cfeditor.CArchPanel; import cfeditor.CFTreasureListTree; import cfeditor.CMainControl; -import cfeditor.CMainStatusbar; import cfeditor.CPickmapPanel; import cfeditor.IGUIConstants; import cfeditor.gameobject.face.FaceObject; @@ -128,7 +127,7 @@ if (log.isInfoEnabled()) { log.info("Start to collect archetypes..."); } - CMainStatusbar.getInstance().setText(" Loading Archetypes... "); + mainControl.setStatusText("Loading Archetypes..."); // browse arch archive // load object from a arch file you found @@ -143,17 +142,17 @@ loadArchetypesFromFiles(f, 0); // collect arches & images from individual files } - CMainStatusbar.getInstance().setText(" Sorting..."); + mainControl.setStatusText("Sorting..."); connectFaces(); // attach faces to arches mainControl.setTabPaneEnabled(true); mainControl.getMainView().finishArchPanelBuildProccess(); System.gc(); // load the autojoin lists - CMainStatusbar.getInstance().setText(" Loading Autojoin Tables..."); + mainControl.setStatusText("Loading Autojoin Tables..."); mainControl.loadJoinlist(); - CMainStatusbar.getInstance().setText(" Ready."); + mainControl.setStatusText("Ready."); // print message if no arches were found if (getArchetypeCount() == 0) { @@ -237,16 +236,16 @@ int len; if ((len = name.length()) >= 5) { if (name.regionMatches(len - 5, ".face", 0, 5)) { - //CMainStatusbar.getInstance().setText(" Loading Face: "+name); + //mainControl.setstatusText(" Loading Face: "+name); parseDefFace(f.getAbsolutePath()); } if ((len = name.length()) >= 4) { if (name.regionMatches(len - 4, ".arc", 0, 4)) { - //CMainStatusbar.getInstance().setText(" Loading Arch: "+name); + //mainControl.setStatusText("Loading Arch: "+name); mainControl.getArchetypeParser().parseArchetype(f.getAbsolutePath(), index); } else if (name.regionMatches(len - 4, ".png", 0, 4)) { - //CMainStatusbar.getInstance().setText(" Loading PNG: "+name); + //mainControl.setStatusText("Loading PNG: "+name); if (mainControl.getImageSet() == null || name.contains("." + mainControl.getImageSet() + ".")) { addPNGFace(f.getAbsolutePath(), name); } @@ -515,7 +514,7 @@ public boolean collectFaces(final Progress progress, final File destDir) throws IOException { try { final File dfile = new File(destDir, IGUIConstants.PNG_FILE); - CMainStatusbar.getInstance().setText("Collect Archfile: write images"); + mainControl.setStatusText("Collect Archfile: write images"); final DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(dfile))); Modified: trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2006-12-07 23:23:29 UTC (rev 955) @@ -61,7 +61,7 @@ // Copy from ArchetypeSet. /* try { - CMainStatusbar.getInstance().setText("Collect Archfile: write animations"); + mainControl.setStatusText("Collect Archfile: write animations"); final DataOutputStream out = new DataOutputStream( new BufferedOutputStream(new FileOutputStream("animations"))); Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:23:29 UTC (rev 955) @@ -57,7 +57,7 @@ * The component that does the actual rendering of tiles in the palette. * Flat version */ -public final class DefaultLevelRenderer extends JComponent implements LevelRenderer { +public final class DefaultLevelRenderer extends LevelRenderer { private static final Logger log = Logger.getLogger(DefaultLevelRenderer.class); @@ -465,29 +465,33 @@ * Returns the map location at the given point or null if no map location * is at the point. * @param point The coordinates in the renderer view. + * @param retPoint if <cod>(retPoint != null)</code> this point will be returned otherwise a new point will be created * @return The map location. */ - - // i'll change it to a fixed point... i want use this for mouse tracking - // and don't want have millions of mallocs here - // this should be reworked more intelligent later - @Nullable public Point getTileLocationAt(@NotNull final Point point) { + @Nullable public Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint) { try { renderTransform.inverseTransform(point, point); } catch (final NoninvertibleTransformException e) { } mapViewBasic.setMapMousePos(new Point(-1, -1)); - final Point mpoint = new Point(); - mpoint.x = mapViewBasic.getMapMousePos().x; - mpoint.y = mapViewBasic.getMapMousePos().y; - if (point.x >= 0 && point.x < mapViewBasic.getMapSize().getWidth() * 32 && point.y >= 0 && point.y < mapViewBasic.getMapSize().getHeight() * 32) { + final Size2D mapSize = mapViewBasic.getMapControl().getMapSize(); + if (point.x >= 0 && point.x < mapSize.getWidth() * 32 && point.y >= 0 && point.y < mapSize.getHeight() * 32) { mapViewBasic.setMapMousePos(new Point(point.x / 32, point.y / 32)); } - mpoint.x = mapViewBasic.getMapMousePos().x; - mpoint.y = mapViewBasic.getMapMousePos().y; - return mpoint; + final int xm = mapViewBasic.getMapMousePos().x; + final int ym = mapViewBasic.getMapMousePos().y; + + if (xm < 0 || xm >= mapSize.getWidth() || ym < 0 || ym >= mapSize.getHeight()) { + return null; + } + if (retPoint != null) { + retPoint.setLocation(xm, ym); + return retPoint; + } + + return new Point(xm, ym); } public boolean resizeBackBuffer() { Modified: trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-07 23:23:29 UTC (rev 955) @@ -23,30 +23,33 @@ import java.awt.Graphics; import java.awt.Point; import java.awt.image.BufferedImage; +import javax.swing.JComponent; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * A lavel renderer, mainly used as central point interfac to iso and flat * renderer * @author tchize */ -public interface LevelRenderer { +public abstract class LevelRenderer extends JComponent { - void updateLookAndFeel(); + public abstract void updateLookAndFeel(); - BufferedImage getFullImage(); + public abstract BufferedImage getFullImage(); - void paintTile(Point point); + public abstract void paintTile(final Point point); - Point getTileLocationAt(Point point); + @Nullable public abstract Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint); - boolean isPickmap(); + public abstract boolean isPickmap(); - void modelChanged(); + public abstract void modelChanged(); - void setHighlightTile(Point point); + public abstract void setHighlightTile(final Point point); - boolean resizeBackBuffer(); + public abstract boolean resizeBackBuffer(); - void freeBackBuffer(); + public abstract void freeBackBuffer(); } // interface LevelRenderer Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-07 23:23:29 UTC (rev 955) @@ -25,7 +25,6 @@ package cfeditor.map; import cfeditor.CMainControl; -import cfeditor.CMainStatusbar; import cfeditor.CMapViewBasic; import cfeditor.IGUIConstants; import cfeditor.MapViewIFrame; @@ -384,9 +383,9 @@ */ public void save() { if (isPickmap()) { - CMainStatusbar.getInstance().setText("Saving pickmap '" + getMapFileName() + "'..."); + mainControl.setStatusText("Saving pickmap '" + getMapFileName() + "'..."); } else { - CMainStatusbar.getInstance().setText("Saving map '" + getMapFileName() + "'..."); + mainControl.setStatusText("Saving map '" + getMapFileName() + "'..."); } assert mapFile != null; mainControl.encodeMapFile(mapFile, mapModel); @@ -399,7 +398,7 @@ * @param file the file to be saved to */ public void saveAs(@NotNull final File file) { - CMainStatusbar.getInstance().setText("Saving the map to a file..."); + mainControl.setStatusText("Saving the map to a file..."); mainControl.encodeMapFile(file, mapModel); mapModel.resetLevelChangedFlag(); mapViewFrame.changedFlagNotify(); Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-07 23:23:29 UTC (rev 955) @@ -211,3 +211,16 @@ archCollectErrorIOException.title=Fehler beim Sammeln archCollectErrorIOException.message=Fehler beim Sammeln: In {0} ist ein Ein-/Ausgabefehler ist aufgetreten:\n{1} dialogDontShowAgain=Diesen Dialog n\xE4chstes Mal wieder anzeigen. + +############# +# Status Bar +memory=({0}/{1}) Speicher: {2} belegt, {3} frei, {4} gesamt. + +################## +# Status Messages + +statusMouseOff=Mouse x:{0,number,integer} y:{1,number,integer} Maus nicht auf Karte +statusMouseOn=Mouse x:{0,number,integer} y:{1,number,integer} Karte x:{2,number,integer} y:{3,number,integer} +statusSelect=Cursor x:{0,number,integer} y:{1,number,integer} Offset x:{2,number,integer} y:{3,number,integer} +statusNormal=Cursor x:{0,number,integer} y:{1,number,integer} +statusCursorOff=Maus nicht auf Karte Modified: trunk/daimonin/src/daieditor/CArchPanelPan.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-07 23:23:29 UTC (rev 955) @@ -275,7 +275,7 @@ final GameObject archetype = archetypeSet.getArchetype(archetypeName); if (isSelected) { // XXX it is not a good idea to query the selection information at this place. archPanel.setSelectedArch(archetypeName); - mainControl.setStatusText(' ' + value.toString() + ' '); + mainControl.setStatusText(value.toString()); } setText(archetypeName); Modified: trunk/daimonin/src/daieditor/CMainStatusbar.java =================================================================== --- trunk/daimonin/src/daieditor/CMainStatusbar.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/daimonin/src/daieditor/CMainStatusbar.java 2006-12-07 23:23:29 UTC (rev 955) @@ -222,4 +222,5 @@ mouse.setText(ACTION_FACTORY.format("statusMouseOff", mouseX, mouseY)); } } + } // class CMainStatusbar Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2006-12-07 23:23:29 UTC (rev 955) @@ -126,7 +126,7 @@ if (log.isInfoEnabled()) { log.info("Start to load archetypes..."); } - mainControl.setStatusText(" Loading Archetypes... "); + mainControl.setStatusText("Loading Archetypes..."); // browse arch archive // load object from a arch file you found @@ -150,10 +150,10 @@ loadArchesFromArtifacts(mainControl.getMapDefaultFolder()); mainControl.setTabPaneEnabled(true); - mainControl.setStatusText(" Sorting..."); + mainControl.setStatusText("Sorting..."); connectFaces(); // attach faces to arches - mainControl.setStatusText(" Ready."); + mainControl.setStatusText("Ready."); // print message if no arches were found if (getArchetypeCount() == 0) { @@ -366,11 +366,11 @@ } } else if (f.isFile()) { // watch out for stuff that's not a file and not a directory!!! if (name.endsWith(".arc")) { - //CMainStatusbar.getInstance().setText(" Loading Arch: "+ name); + //mainControl.setStatusText("Loading Arch: "+ name); currentFile = f; mainControl.getArchetypeParser().parseArchetype(f.getPath(), index); } else if (name.endsWith(".png")) { - //CMainStatusbar.getInstance().setText(" Loading PNG: "+ name); + //mainControl.setStatusText("Loading PNG: "+ name); addPNGFace(f.getAbsolutePath(), name); } else if (name.endsWith(".anim")) { animFiles.add(f); Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/daimonin/src/daieditor/messages.properties 2006-12-07 23:23:29 UTC (rev 955) @@ -209,11 +209,6 @@ ################## # Status Messages -statusMouseOff=Mouse x:{0,number,integer} y:{1,number,integer} Mouse off map -statusMouseOn=Mouse x:{0,number,integer} y:{1,number,integer} Map x:{2,number,integer} y:{3,number,integer} -statusSelect=Cursor x:{0,number,integer} y:{1,number,integer} Offset x:{2,number,integer} y:{3,number,integer} -statusNormal=Cursor x:{0,number,integer} y:{1,number,integer} -statusCursorOff=Cursor off map mapImagesOutOfMemory=Out of memory creating map image ####### @@ -802,10 +797,6 @@ Validator.TilePaths.title=Tile path invalid Validator.TilePaths.msg=<html><h3>{0}</h3><p>This map has invalid tile paths.<br>Go to the map properties dialog and change the map tile paths. -############# -# Status Bar -memory=({0}/{1}) Memory: {2} used, {3} free, {4} total. - ####################### # Various Log Messages canonIOE=IOException while canonizing path: {0} Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/src/app/net/sf/gridarta/messages.properties 2006-12-07 23:23:29 UTC (rev 955) @@ -176,6 +176,19 @@ fileDialog.filter.python=Python Scripts +############# +# Status Bar +memory=({0}/{1}) Memory: {2} used, {3} free, {4} total. + +################## +# Status Messages + +statusMouseOff=Mouse x:{0,number,integer} y:{1,number,integer} Mouse off map +statusMouseOn=Mouse x:{0,number,integer} y:{1,number,integer} Map x:{2,number,integer} y:{3,number,integer} +statusSelect=Cursor x:{0,number,integer} y:{1,number,integer} Offset x:{2,number,integer} y:{3,number,integer} +statusNormal=Cursor x:{0,number,integer} y:{1,number,integer} +statusCursorOff=Cursor off map + ####################### # Various Log Messages saveLevelAsWithNull=DEBUG: CMainControl.saveLevelAsWanted(CMapControl level) invoked with null argument. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 21:17:56
|
Revision: 954 http://svn.sourceforge.net/gridarta/?rev=954&view=rev Author: akirschbaum Date: 2006-12-07 13:17:55 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Unify (remove) static imports. Modified Paths: -------------- trunk/daimonin/src/daieditor/CArchPanel.java trunk/daimonin/src/daieditor/CAttribBitmask.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFArchAttrib.java trunk/daimonin/src/daieditor/CFArchType.java trunk/daimonin/src/daieditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/daimonin/src/daieditor/CArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanel.java 2006-12-07 20:53:02 UTC (rev 953) +++ trunk/daimonin/src/daieditor/CArchPanel.java 2006-12-07 21:17:55 UTC (rev 954) @@ -33,7 +33,7 @@ import javax.swing.JPanel; import javax.swing.JSplitPane; import javax.swing.JTabbedPane; -import static javax.swing.SwingConstants.TOP; +import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import net.sf.gridarta.gui.GSplitPane; @@ -88,12 +88,12 @@ setSelectedArch(null); - tabDesktop = new JTabbedPane(TOP); + tabDesktop = new JTabbedPane(SwingConstants.TOP); tabDesktop.setBorder(BorderFactory.createEmptyBorder(IGUIConstants.SPACE_PICKARCH_TOP, 0, 0, 0)); archQuickPanel = new CArchQuickView(mainControl); // archAndPickPane is the panel containing both archpanel and pickmaps - archAndPickPane = new JTabbedPane(TOP); + archAndPickPane = new JTabbedPane(SwingConstants.TOP); archAndPickPane.addTab(" Arch List ", tabDesktop); archAndPickPane.addTab(" Pickmaps ", mainControl.getMainView().getPickmapPanel()); // this listener informs the mainview which panel is active: archlist or pickmaps? Modified: trunk/daimonin/src/daieditor/CAttribBitmask.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribBitmask.java 2006-12-07 20:53:02 UTC (rev 953) +++ trunk/daimonin/src/daieditor/CAttribBitmask.java 2006-12-07 21:17:55 UTC (rev 954) @@ -27,10 +27,7 @@ import java.awt.Component; import java.awt.GridLayout; import javax.swing.JCheckBox; -import static javax.swing.JOptionPane.OK_CANCEL_OPTION; -import static javax.swing.JOptionPane.OK_OPTION; -import static javax.swing.JOptionPane.PLAIN_MESSAGE; -import static javax.swing.JOptionPane.showConfirmDialog; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathExpressionException; @@ -134,7 +131,7 @@ checkbox[i].setSelected(isActive(i + 1, guiAttr.getValue())); gridPanel.add(checkbox[i]); } - if (showConfirmDialog(parentComponent, gridPanel, title, OK_CANCEL_OPTION, PLAIN_MESSAGE) == OK_OPTION) { + if (JOptionPane.showConfirmDialog(parentComponent, gridPanel, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) { int newValue = 0; for (int i = 0; i < number; i++) { if (checkbox[i].isSelected()) { Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-07 20:53:02 UTC (rev 953) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-07 21:17:55 UTC (rev 954) @@ -25,11 +25,6 @@ package daieditor; import daieditor.gameobject.ArchAttribType; -import static daieditor.gameobject.ArchAttribType.BITMASK; -import static daieditor.gameobject.ArchAttribType.FIXED; -import static daieditor.gameobject.ArchAttribType.FLOAT; -import static daieditor.gameobject.ArchAttribType.SPELL; -import static daieditor.gameobject.ArchAttribType.ZSPELL; import daieditor.gameobject.GameObject; import java.awt.BorderLayout; import java.awt.CardLayout; @@ -78,12 +73,9 @@ import javax.swing.JTextField; import javax.swing.JTextPane; import javax.swing.JViewport; -import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; -import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER; -import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS; -import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER; -import static javax.swing.SwingConstants.TRAILING; -import static javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE; +import javax.swing.ScrollPaneConstants; +import javax.swing.SwingConstants; +import javax.swing.WindowConstants; import javax.swing.text.BadLocationException; import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.Document; @@ -360,7 +352,7 @@ // do we have "none" spell? final int active; - if (spnum == 0 && (gameObject.getAttributeString(attr.getNameOld()).length() == 0 || attr.getDataType() == ZSPELL)) { + if (spnum == 0 && (gameObject.getAttributeString(attr.getNameOld()).length() == 0 || attr.getDataType() == ArchAttribType.ZSPELL)) { active = 0; } else { // now look up the spell-number in the array of spells @@ -437,11 +429,11 @@ gbc.weightx = 0.0; gbc.gridx = 2; gbc.gridy = 1; - header.add(new JLabel("Name: ", TRAILING), gbc); // create label + header.add(new JLabel("Name: ", SwingConstants.TRAILING), gbc); // create label gbc.gridy++; - header.add(new JLabel("Type: ", TRAILING), gbc); + header.add(new JLabel("Type: ", SwingConstants.TRAILING), gbc); gbc.gridy++; - header.add(new JLabel("Archetype: ", TRAILING), gbc); // create label + header.add(new JLabel("Archetype: ", SwingConstants.TRAILING), gbc); // create label gbc.gridx = 3; @@ -477,8 +469,8 @@ final JScrollPane scrollPane = new JScrollPane(inv); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - scrollPane.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_NEVER); - scrollPane.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_NEVER); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); scrollPane.setSize(80, 70); return scrollPane; @@ -532,11 +524,11 @@ for (int i = 0; type.getAttr().length > i; i++) { if (type.getAttr()[i].getSecId() == secId) { // count number of attributes - if (type.getAttr()[i].getDataType() != FIXED) { + if (type.getAttr()[i].getDataType() != ArchAttribType.FIXED) { number++; } // check for bitmask attributes - if (!hasBitmask && type.getAttr()[i].getDataType() == BITMASK) { + if (!hasBitmask && type.getAttr()[i].getDataType() == ArchAttribType.BITMASK) { hasBitmask = true; } } @@ -569,7 +561,7 @@ for (int i = 0; attribs.length > i; i++) { final CFArchAttrib attrib = attribs[i]; final ArchAttribType dType = attrib.getDataType(); // data type of the attribute - if (attrib.getSecId() == secId && dType != FIXED) { + if (attrib.getSecId() == secId && dType != ArchAttribType.FIXED) { final String nameOld = attrib.getNameOld(); final JButton helpButton = new JButton("?"); helpButton.setMargin(new Insets(0, 5, 0, 5)); @@ -601,8 +593,8 @@ input.setBorder(BorderFactory.createEmptyBorder(3, 7, 0, 0)); final JScrollPane scrollPane = new JScrollPane(input); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - scrollPane.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_AS_NEEDED); - scrollPane.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); ((DialogAttrib<JTextArea>) newAttr).input = input; cGlue = scrollPane; } @@ -640,7 +632,7 @@ case LONG: case FLOAT: { cLabel = new JLabel(attrib.getNameNew() + ": "); - cLabel.setForeground(dType == FLOAT ? IGUIConstants.FLOAT_COLOR : IGUIConstants.INT_COLOR); + cLabel.setForeground(dType == ArchAttribType.FLOAT ? IGUIConstants.FLOAT_COLOR : IGUIConstants.INT_COLOR); newAttr = new DialogAttrib<JFormattedTextField>(attrib); final int fieldLength = attrib.getInputLength() == 0 ? TEXTFIELD_COLUMNS : attrib.getInputLength(); final NumberFormat format; @@ -1111,7 +1103,7 @@ // an int attribute if ("0".equals(((DialogAttrib<JFormattedTextField>) attr).input.getText())) { if (archetype.getAttributeDouble(attr.ref.getNameOld()) != 0) { - newArchText = newArchText + attr.ref.getNameOld() + " " + (dType == FLOAT ? "0.0" : "0") + "\n"; + newArchText = newArchText + attr.ref.getNameOld() + " " + (dType == ArchAttribType.FLOAT ? "0.0" : "0") + "\n"; } } else { try { @@ -1222,7 +1214,7 @@ break; } - if (attrVal == -1 || attrVal == 0 && dType != SPELL && dType != ZSPELL) { + if (attrVal == -1 || attrVal == 0 && dType != ArchAttribType.SPELL && dType != ArchAttribType.ZSPELL) { if (archetype.getAttributeInt(attr.ref.getNameOld()) != 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0\n"; } @@ -1283,7 +1275,7 @@ // Also write all the 'fixed' attributes into the archtext for (int i = 0; type.getAttr().length > i; i++) { // ### TODO: for changed types, copy fixed attributes over default arches ### - if (type.getAttr()[i].getDataType() == FIXED) { + if (type.getAttr()[i].getDataType() == ArchAttribType.FIXED) { final String defaultValue = archetype.getAttributeString(type.getAttr()[i].getNameOld()); if (defaultValue.length() == 0 || gameObject.getArchTypNr() != archetype.getArchTypNr() && !defaultValue.equalsIgnoreCase(type.getAttr()[i].getNameNew())) { // usually, fixed attributes are only applied when *not* defined in the archetype. @@ -1379,7 +1371,7 @@ */ private void askConfirmErrors(final String errors) { final JDialog frame = new JDialog((JFrame) null, "Syntax Errors", true); // dialog freezes parents - frame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); // closing is handled by listener + frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // closing is handled by listener final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); Modified: trunk/daimonin/src/daieditor/CFArchAttrib.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchAttrib.java 2006-12-07 20:53:02 UTC (rev 953) +++ trunk/daimonin/src/daieditor/CFArchAttrib.java 2006-12-07 21:17:55 UTC (rev 954) @@ -25,22 +25,6 @@ package daieditor; import daieditor.gameobject.ArchAttribType; -import static daieditor.gameobject.ArchAttribType.ANIMNAME; -import static daieditor.gameobject.ArchAttribType.BITMASK; -import static daieditor.gameobject.ArchAttribType.BOOL; -import static daieditor.gameobject.ArchAttribType.BOOL_SPEC; -import static daieditor.gameobject.ArchAttribType.DBLLIST; -import static daieditor.gameobject.ArchAttribType.FACENAME; -import static daieditor.gameobject.ArchAttribType.FIXED; -import static daieditor.gameobject.ArchAttribType.FLOAT; -import static daieditor.gameobject.ArchAttribType.INT; -import static daieditor.gameobject.ArchAttribType.LIST; -import static daieditor.gameobject.ArchAttribType.LONG; -import static daieditor.gameobject.ArchAttribType.SPELL; -import static daieditor.gameobject.ArchAttribType.STRING; -import static daieditor.gameobject.ArchAttribType.TEXT; -import static daieditor.gameobject.ArchAttribType.TREASURE; -import static daieditor.gameobject.ArchAttribType.ZSPELL; import org.apache.log4j.Logger; import org.w3c.dom.Attr; import org.w3c.dom.Element; @@ -70,7 +54,7 @@ private String nameOld; // original attr. name (from the CF arches) - private String endingOld; // for dataType = 'TEXT' this is the terminating string + private String endingOld; // for dataType = ArchAttribType.TEXT this is the terminating string // (example: 'endmsg' for arch message) private String nameNew; // new attr. name (for the user-friendly GUI) @@ -82,9 +66,9 @@ private int inputLength; // optional attribute: set length for input JTextFields private String[] misc; // string array for misc. use - // BOOL_SPEC uses misc[0] = true value, misc[1] = false value - // BITMASK uses misc[0] = bitmask name - // LIST uses misc[0] = list name + // ArchAttribType.BOOL_SPEC uses misc[0] = true value, misc[1] = false value + // ArchAttribType.BITMASK uses misc[0] = bitmask name + // ArchAttribType.LIST uses misc[0] = list name private int secId; // identifier of the section this attribute is in @@ -143,10 +127,10 @@ // which type of attribute is it? if ("bool".equalsIgnoreCase(atype)) { - dataType = BOOL; // normal bool + dataType = ArchAttribType.BOOL; // normal bool } else if ("bool_special".equalsIgnoreCase(atype)) { // customized boolean type: - dataType = BOOL_SPEC; + dataType = ArchAttribType.BOOL_SPEC; // parse true and false values: a1 = root.getAttributeNode("true"); @@ -160,19 +144,19 @@ misc[1] = a2.getValue().trim(); // string for false } } else if ("int".equalsIgnoreCase(atype)) { - dataType = INT; + dataType = ArchAttribType.INT; } else if ("long".equalsIgnoreCase(atype)) { - dataType = LONG; + dataType = ArchAttribType.LONG; } else if ("float".equalsIgnoreCase(atype)) { - dataType = FLOAT; + dataType = ArchAttribType.FLOAT; } else if ("string".equalsIgnoreCase(atype)) { - dataType = STRING; + dataType = ArchAttribType.STRING; } else if ("facename".equalsIgnoreCase(atype)) { - dataType = FACENAME; + dataType = ArchAttribType.FACENAME; } else if ("animname".equalsIgnoreCase(atype)) { - dataType = ANIMNAME; + dataType = ArchAttribType.ANIMNAME; } else if ("text".equalsIgnoreCase(atype)) { - dataType = TEXT; + dataType = ArchAttribType.TEXT; // for text data, the terminating string has to be read too if ((a1 = root.getAttributeNode(XML_KEY_ARCH_BEGIN)) != null) { nameOld = a1.getValue().trim(); @@ -189,7 +173,7 @@ } } else if ("fixed".equalsIgnoreCase(atype)) { // fixed attribute - dataType = FIXED; + dataType = ArchAttribType.FIXED; if ((a1 = root.getAttributeNode("value")) != null) { nameNew = a1.getValue().trim(); } else { @@ -199,16 +183,16 @@ } else if ("spell".equalsIgnoreCase(atype)) { // spell attribute if (CFArchTypeList.getSpells().getSpellNumbers() == null) { - dataType = INT; // if we have no spells, use an INT field instead + dataType = ArchAttribType.INT; // if we have no spells, use an INT field instead } else { - dataType = SPELL; + dataType = ArchAttribType.SPELL; } } else if ("nz_spell".equalsIgnoreCase(atype)) { // spell attribute if (CFArchTypeList.getSpells().getSpellNumbers() == null) { - dataType = INT; // if we have no spells, use an INT field instead + dataType = ArchAttribType.INT; // if we have no spells, use an INT field instead } else { - dataType = ZSPELL; + dataType = ArchAttribType.ZSPELL; } } else if (atype.startsWith("bitmask")) { // got a bitmask attribute @@ -216,7 +200,7 @@ if (tlist.getBitmaskTable().containsKey(bitmaskName)) { // the bitmask is well defined - dataType = BITMASK; + dataType = ArchAttribType.BITMASK; misc = new String[1]; misc[0] = bitmaskName; // store bitmask name in misc[0] } else { @@ -227,7 +211,7 @@ final String listName = atype.substring(5).trim(); if (tlist.getListTable().containsKey(listName)) { // the list is well defined - dataType = LIST; + dataType = ArchAttribType.LIST; misc = new String[1]; misc[0] = listName; // store list name in misc[0] } else { @@ -253,7 +237,7 @@ if (tlist.getListTable().containsKey(listName1) && tlist.getListTable().containsKey(listName2)) { // the lists are well defined - dataType = DBLLIST; + dataType = ArchAttribType.DBLLIST; misc = new String[2]; misc[0] = listName1; // store list name in misc[0] misc[1] = listName2; // store list name in misc[1] @@ -261,7 +245,7 @@ log.error("In '" + IGUIConstants.TYPEDEF_FILE + "', type " + typeName + ": List \"" + listName1 + "\" or \"" + listName2 + "\" is undefined."); } } else if ("treasurelist".equalsIgnoreCase(atype)) { - dataType = TREASURE; + dataType = ArchAttribType.TREASURE; } else { // unknown type log.warn("In '" + IGUIConstants.TYPEDEF_FILE + "': Type " + typeName + " has an attribute with unknown type: '" + atype + "'."); Modified: trunk/daimonin/src/daieditor/CFArchType.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchType.java 2006-12-07 20:53:02 UTC (rev 953) +++ trunk/daimonin/src/daieditor/CFArchType.java 2006-12-07 21:17:55 UTC (rev 954) @@ -24,7 +24,7 @@ package daieditor; -import static daieditor.gameobject.ArchAttribType.TEXT; +import daieditor.gameobject.ArchAttribType; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -372,7 +372,7 @@ attrList.add(attrib); // parsing succeeded, now assign this attribute to a section - if (attrib.getDataType() == TEXT) { + if (attrib.getDataType() == ArchAttribType.TEXT) { // text attributes all have their own section attrib.setSection(sectionNum, attrib.getNameNew()); sectionNum++; Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-07 20:53:02 UTC (rev 953) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-07 21:17:55 UTC (rev 954) @@ -27,7 +27,7 @@ import static daieditor.CGUIUtils.getSysIcon; import daieditor.gameobject.GameObject; import java.awt.BorderLayout; -import static java.awt.Color.gray; +import java.awt.Color; import java.awt.Component; import java.awt.Font; import java.awt.event.ActionEvent; @@ -49,8 +49,7 @@ import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JDialog; -import static javax.swing.JOptionPane.WARNING_MESSAGE; -import static javax.swing.JOptionPane.showMessageDialog; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; @@ -668,7 +667,7 @@ // is selected, also return null because those must not be used on maps. final TreasureTreeNode trNode = (TreasureTreeNode) node; if (trNode.getTreasureObj().getType() == TreasureObj.FOLDER) { - showMessageDialog(this, "The " + trNode.getTreasureObj().getName() + " treasurelists must not be used in maps.\nThese lists are reserved for internal use in the Daimonin server.", "Invalid Selection", WARNING_MESSAGE); + JOptionPane.showMessageDialog(this, "The " + trNode.getTreasureObj().getName() + " treasurelists must not be used in maps.\nThese lists are reserved for internal use in the Daimonin server.", "Invalid Selection", JOptionPane.WARNING_MESSAGE); return null; } @@ -895,7 +894,7 @@ setFont(getFont().deriveFont(Font.PLAIN)); if (node.isRoot()) { - this.setForeground(gray); + this.setForeground(Color.gray); setIcon(null); } else { // node content object of this cell @@ -904,11 +903,11 @@ // now apply customized icons if (content.getType() == TreasureObj.YES) { //setIcon(tutorialIcon); - setForeground(gray); + setForeground(Color.gray); setIcon(yesIcon); } else if (content.getType() == TreasureObj.NO) { //setIcon(tutorialIcon); - setForeground(gray); + setForeground(Color.gray); setIcon(noIcon); } else if (content.getType() == TreasureObj.TREASURE_LIST) { if ("none".equalsIgnoreCase(content.getName())) { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-12-07 20:53:02 UTC (rev 953) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-12-07 21:17:55 UTC (rev 954) @@ -92,19 +92,7 @@ import javax.swing.AbstractAction; import javax.swing.ImageIcon; import javax.swing.JFileChooser; -import static javax.swing.JOptionPane.CANCEL_OPTION; -import static javax.swing.JOptionPane.CLOSED_OPTION; -import static javax.swing.JOptionPane.ERROR_MESSAGE; -import static javax.swing.JOptionPane.INFORMATION_MESSAGE; -import static javax.swing.JOptionPane.OK_CANCEL_OPTION; -import static javax.swing.JOptionPane.OK_OPTION; -import static javax.swing.JOptionPane.QUESTION_MESSAGE; -import static javax.swing.JOptionPane.WARNING_MESSAGE; -import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION; -import static javax.swing.JOptionPane.YES_NO_OPTION; -import static javax.swing.JOptionPane.YES_OPTION; -import static javax.swing.JOptionPane.showInputDialog; -import static javax.swing.JOptionPane.showMessageDialog; +import javax.swing.JOptionPane; import static javax.swing.KeyStroke.getKeyStroke; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.MainControl; @@ -447,7 +435,7 @@ System.out.println(libFile); } } - if (libFiles != null && libFiles.length > 0 && ACTION_FACTORY.showOnetimeConfirmDialog(mainView, YES_NO_OPTION, INFORMATION_MESSAGE, "oldLibsFound", libs.toString()) == YES_OPTION) { + if (libFiles != null && libFiles.length > 0 && ACTION_FACTORY.showOnetimeConfirmDialog(mainView, JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, "oldLibsFound", libs.toString()) == JOptionPane.YES_OPTION) { Arrays.sort(libFiles); for (final File libFile : libFiles) { libFile.delete(); @@ -463,7 +451,7 @@ @ActionMethod public void controlServer() { if (controlServer == null) { controlServer = new ProcessRunner("controlServer", prefs.get(PREFS_APP_SERVER, PREFS_APP_SERVER_DEFAULT)); - ACTION_FACTORY.showOnetimeMessageDialog(mainView, WARNING_MESSAGE, "controlServerWarning"); + ACTION_FACTORY.showOnetimeMessageDialog(mainView, JOptionPane.WARNING_MESSAGE, "controlServerWarning"); } else { controlServer.setCommand(prefs.get(PREFS_APP_SERVER, PREFS_APP_SERVER_DEFAULT)); } @@ -992,8 +980,8 @@ } if (!forced && level.isLevelChanged()) { - final int result = ACTION_FACTORY.showConfirmDialog(mainView, YES_NO_CANCEL_OPTION, WARNING_MESSAGE, "confirmSaveChanges", level.getMapArch().getMapDisplayName()); - if (result == YES_OPTION) { + final int result = ACTION_FACTORY.showConfirmDialog(mainView, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, "confirmSaveChanges", level.getMapArch().getMapDisplayName()); + if (result == JOptionPane.YES_OPTION) { if (level.isPlainSaveEnabled()) { level.save(); } else { @@ -1001,7 +989,7 @@ return false; } } - } else if (result == CANCEL_OPTION || result == CLOSED_OPTION) { + } else if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.CLOSED_OPTION) { return false; } } @@ -1365,7 +1353,7 @@ if (returnVal == JFileChooser.APPROVE_OPTION) { hasChangedDir = true; // user has chosen an active dir final File file = fileChooser.getSelectedFile(); - if (!file.exists() || ACTION_FACTORY.showConfirmDialog(mainView, WARNING_MESSAGE, OK_CANCEL_OPTION, "overwriteOtherFile", file.getName()) == OK_OPTION) { + if (!file.exists() || ACTION_FACTORY.showConfirmDialog(mainView, JOptionPane.WARNING_MESSAGE, JOptionPane.OK_CANCEL_OPTION, "overwriteOtherFile", file.getName()) == JOptionPane.OK_OPTION) { level.saveAs(file); level.setMapFileName(file.getName()); // window title and file name //level.setMapName(file.getName()); // map name (internal) @@ -1415,7 +1403,7 @@ if (!filename.endsWith(".png")) { filename += ".png"; } - if (!new File(filename).exists() || ACTION_FACTORY.showConfirmDialog(mainView, YES_NO_OPTION, WARNING_MESSAGE, "overwriteOtherFile", filename) == YES_OPTION) { + if (!new File(filename).exists() || ACTION_FACTORY.showConfirmDialog(mainView, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, "overwriteOtherFile", filename) == JOptionPane.YES_OPTION) { mc.getMapViewFrame().printFullImage(filename); } } @@ -1671,7 +1659,7 @@ d.y = currentMap.getMapModel().getMapArchObject().getEnterY(); } currentMap.getMapViewFrame().setHotspot(d); // set hotspot TODO set cursor instead - if (newFileOpened && YES_OPTION == ACTION_FACTORY.showOnetimeConfirmDialog(mainView, YES_NO_OPTION, QUESTION_MESSAGE, "enterExitClose")) { + if (newFileOpened && JOptionPane.YES_OPTION == ACTION_FACTORY.showOnetimeConfirmDialog(mainView, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose")) { // only close current level if a new file was opened and user wants to close it closeLevel(oldmap); // close the old map } @@ -1845,7 +1833,7 @@ return; } } - final String input = showInputDialog(mainView, "Enter a fill seed value between 1-100\n(default is 100%)", title.toString(), QUESTION_MESSAGE); + final String input = JOptionPane.showInputDialog(mainView, "Enter a fill seed value between 1-100\n(default is 100%)", title.toString(), JOptionPane.QUESTION_MESSAGE); if (input != null) { int rand = 100; if (input.trim().length() == 0) { @@ -1860,7 +1848,7 @@ rand = 100; } } catch (final NumberFormatException e) { - showMessageDialog(mainView, "You entered an illegal value", "Illegal Value.", ERROR_MESSAGE); + JOptionPane.showMessageDialog(mainView, "You entered an illegal value", "Illegal Value.", JOptionPane.ERROR_MESSAGE); } } copybuffer.fill(currentMap, fillBelow, pmap, rand); @@ -1980,7 +1968,7 @@ /** Calls for zooming preview tool. */ public void zoom() { if (currentMap == null) { - showMessageDialog(mainView, "No map loaded! Please load a map!!", "Error", ERROR_MESSAGE); + JOptionPane.showMessageDialog(mainView, "No map loaded! Please load a map!!", "Error", JOptionPane.ERROR_MESSAGE); return; } final CMapViewBasic view = currentMap.getMapViewFrame().getView(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 20:53:06
|
Revision: 953 http://svn.sourceforge.net/gridarta/?rev=953&view=rev Author: akirschbaum Date: 2006-12-07 12:53:02 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Unify comments. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java trunk/crossfire/src/cfeditor/map/MapArchObject.java trunk/crossfire/src/cfeditor/map/MapModel.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java trunk/daimonin/src/daieditor/map/MapModel.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-12-07 20:53:02 UTC (rev 953) @@ -74,7 +74,10 @@ */ private ScriptArchData script; - private boolean noface; // if true, arch has no face as default + /** + * If set, the game object has no face as default. + */ + private boolean noface; private int facenr; // the index of faceImages[] @@ -86,7 +89,10 @@ */ private List<GameObject> inv = Collections.EMPTY_LIST; - private int archType; // CF object type of the arch + /** + * Object type. + */ + private int archType; private AutojoinList join; // if nonzero, pointing to the list of autojoining archetypes @@ -284,7 +290,7 @@ } /** - * Insert an GameObject before this GameObject. + * Insert a GameObject before this GameObject. * @param node GameObject to append */ public void insertBefore(final GameObject node) { @@ -292,7 +298,7 @@ } /** - * Insert an GameObject after this GameObject. + * Insert a GameObject after this GameObject. * @param node GameObject to append */ public void insertAfter(final GameObject node) { @@ -693,7 +699,7 @@ /** * Returns whether this GameObject has one or more scripted events defined. - * @return <code>true</code> if this GameObject has one or more scripted events, otherwise <code>false</code>. + * @return <code>true</code> if this GameObject has one or more scripted events, otherwise <code>false</code> */ public boolean isScripted() { return script != null; @@ -729,7 +735,7 @@ * @param eventList JList from the MapArchPanel (script tab) which displays * the events * @param mapanel the MapArchPanel - * @xxx this method knows things it should never know, it is evil! + * @XXX this method knows things it should never know, it is evil! */ public void modifyEventScript(final String eventType, final int task, final JList eventList, final CMapArchPanel mapanel) { if (script != null) { Modified: trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java 2006-12-07 20:53:02 UTC (rev 953) @@ -99,7 +99,10 @@ return facings; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + * @see #getName() + */ public String getAnimName() { return animName; } Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2006-12-07 20:53:02 UTC (rev 953) @@ -1,3 +1,24 @@ +/* + * Daimonin Java Editor. + * Copyright (C) 2005 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + package cfeditor.gameobject.face; import cfeditor.CMainControl; @@ -8,7 +29,7 @@ import org.jetbrains.annotations.NotNull; /** - * Container for Faces. + * This class manages the FaceObjects. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public class FaceObjects extends AbstractFaceObjects<FaceObject> { Modified: trunk/crossfire/src/cfeditor/map/MapArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-12-07 20:53:02 UTC (rev 953) @@ -34,9 +34,8 @@ /** * MapArchObject contains the specific meta data about a map that is stored in - * the map-arch, at the very beginning of the map file. (width, height, - * difficulty level... etc) In former days, this used to be put into an - * ordinary GameObject, but that's just no longer appropriate. + * the map-arch, at the very beginning of the map file. The map metadata is + * information like mapSize, difficulty level, darkness etc.). * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ @SuppressWarnings({"HardcodedLineSeparator"}) @@ -495,10 +494,9 @@ } /** - * Writing the MapArchObject into the mapfile - * @param appendable <code>BufferedWriter</code> to the mapfile - * @throws java.io.FileNotFoundException the mapfile could not be found - * @throws IOException an I/O error occured during writing to the file + * Write the MapArchObject into the mapfile. + * @param appendable <code>Appendable</code> to the mapfile + * @throws IOException an I/O error occured during appending or formatting */ public void writeMapArch(@NotNull final Appendable appendable) throws IOException { int i; Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-07 20:53:02 UTC (rev 953) @@ -25,7 +25,7 @@ /** * Checks whether an GameObject (multi-arch) would still fit on this map. - * @param archname name of arch to check + * @param archName name of arch to check * @param pos position of multitile head * @param allowDouble whether overlapping multitile arches should be allowed (check is done using the arch name) * @return whether the multi-arch would still fit on this map @@ -33,11 +33,12 @@ * @retval <code>false</code> otherwise * @todo discuss whether this method really belongs to the interface of MapModel as it is only used by MapModel implementations and heavily depends on how arches, especially multi-tile arches are implemented. */ - boolean isMultiArchFittingToMap(String archname, Point pos, boolean allowDouble); + boolean isMultiArchFittingToMap(String archName, Point pos, boolean allowDouble); /** - * Add a new arch to the map. Including multi tile arches. This function - * allows only to choose from the default arches (->archName). + * Create a game object and add it to the map. + * This function allows only to choose from the default arches (->archName). + * This function also works for multi tile arches. * @param archName Name of a default arch on the ArchetypeSet * @param pos insert-location on this map * @param allowDouble if set, only one arch of the same kind can be @@ -57,8 +58,8 @@ * container-inventory. * @param newarch A clone copy of this GameObject gets inserted to the map. * It can be an arch directly from a pickmap or even a - * default arch. if ('newarch'==null) the default arch of - * number 'archName' gets inserted + * default arch. if ('newarch'==null) the default arch + * 'archName' gets inserted * @param archName Name of a default arch to get inserted. This value gets * used ONLY when 'newarch' is null * @param next the new arch gets inserted before 'next' if @@ -68,7 +69,7 @@ * @param join if set to JOIN_ENABLE auto-joining is supported * @return true if insertion was successful */ - boolean insertArchToMap(GameObject newarch, String archname, GameObject next, Point pos, boolean join); + boolean insertArchToMap(GameObject newarch, String archName, GameObject next, Point pos, boolean join); /** * Delete an existing arch from the map. (If the specified arch doesn't Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-12-07 20:53:02 UTC (rev 953) @@ -96,6 +96,9 @@ */ private ScriptArchData script; + /** + * If set, the game object has no face as default. + */ private boolean noface; /** State where the face comes from. */ @@ -109,7 +112,10 @@ private int direction; - private int archType; // CF object type of the arch + /** + * Object type. + */ + private int archType; /** Editor Folder. */ private String editorFolder; @@ -653,7 +659,7 @@ return clone; } - /** @return true if 'this' arch is part of a multisquare object */ + /** {@inheritDoc} */ public boolean isMulti() { return multi != null; } @@ -666,7 +672,10 @@ script.validateAllEvents(); } - /** @return true when this arch has one or more scripted events defined */ + /** + * Returns whether this GameObject has one or more scripted events defined. + * @return <code>true</code> if this GameObject has one or more scripted events, otherwise <code>false</code> + */ public boolean isScripted() { for (final GameObject tmp : this) { if (tmp.archType == 118) { Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2006-12-07 20:53:02 UTC (rev 953) @@ -48,7 +48,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; - /** * The <code>AnimationObject</code>. * AnimationObjects are iterated in Unicode (=ASCII) order. Modified: trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-07 20:53:02 UTC (rev 953) @@ -20,7 +20,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. - * */ package daieditor.gui.map; Modified: trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2006-12-07 20:53:02 UTC (rev 953) @@ -82,7 +82,7 @@ private final JTextField mapName = new JTextField(); // name of arch - private final JTextField mapSound = new JTextField(); // name of arch + private final JTextField mapSound = new JTextField(); // name of soundfile private final JFormattedTextField levelWidthField = new JFormattedTextField(); // len x Modified: trunk/daimonin/src/daieditor/map/MapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapModel.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/daimonin/src/daieditor/map/MapModel.java 2006-12-07 20:53:02 UTC (rev 953) @@ -21,7 +21,7 @@ /** * Checks whether an GameObject (multi-arch) would still fit on this map. - * @param archname name of arch to check + * @param archName name of arch to check * @param pos position of multitile head * @param allowDouble whether overlapping multitile arches should be allowed (check is done using the arch name) * @return whether the multi-arch would still fit on this map @@ -29,32 +29,33 @@ * @retval <code>false</code> otherwise * @todo discuss whether this method really belongs to the interface of MapModel as it is only used by MapModel implementations and heavily depends on how arches, especially multi-tile arches are implemented. */ - boolean isMultiArchFittingToMap(String archname, Point pos, boolean allowDouble); + boolean isMultiArchFittingToMap(String archName, Point pos, boolean allowDouble); /** - * Create a new arch and add it to the map. - * This function allows only to choose from the default arches (->archname). + * Create a game object and add it to the map. + * This function allows only to choose from the default arches (->archName). * This function also works for multi tile arches. - * @param archname ID from a default arch on the ArchetypeSet + * @param archName Name of a default arch on the ArchetypeSet * @param pos insert-location on this map - * @param allowDouble whether inserting more than one arch of the same type is allowed + * @param allowDouble if set, only one arch of the same kind can be + * inserted per square * @param insertBelow true: new arch is inserted on top, false: new arch is * inserted below * @return true if insertion successful, false if not * @todo discuss whether this method really belongs to a map model, as implementing this would require the map model to know more than is desireable (e.g. ArchObjectStack + MainControl). */ - boolean addArchToMap(String archname, Point pos, boolean allowDouble, boolean insertBelow); + boolean addArchToMap(String archName, Point pos, boolean allowDouble, boolean insertBelow); /** * Insert a new arch to the map at a specified position. This function - * allows either to choose from the default arches (->archname) or to insert + * allows either to choose from the default arches (->archName) or to insert * a copy from an existing arch (->newarch). It also works for * container-inventory. * @param newarch A clone copy of this GameObject gets inserted to the map. * It can be an arch directly from a pickmap or even a * default arch. if ('newarch'==null) the default arch - * 'archname' gets inserted - * @param archname ID from a default arch to get inserted. This value gets + * 'archName' gets inserted + * @param archName Name of a default arch to get inserted. This value gets * used ONLY when 'newarch' is null * @param next the new arch gets inserted before 'next' if * ('next'==null) the arch gets inserted at bottom @@ -62,7 +63,7 @@ * @param pos map position to insert the new arch * @return true if insertion was successful */ - boolean insertArchToMap(GameObject newarch, String archname, GameObject next, Point pos); + boolean insertArchToMap(GameObject newarch, String archName, GameObject next, Point pos); /** * Get the first exit on the MapSquare described by <var>hspot</var>. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 20:24:13
|
Revision: 952 http://svn.sourceforge.net/gridarta/?rev=952&view=rev Author: akirschbaum Date: 2006-12-07 12:24:00 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Various unifications. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanel.java trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/daimonin/src/daieditor/CArchPanel.java trunk/daimonin/src/daieditor/CArchPanelPan.java trunk/daimonin/src/daieditor/CMapArchPanel.java trunk/daimonin/src/daieditor/CMapTileList.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-12-07 20:06:31 UTC (rev 951) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-12-07 20:24:00 UTC (rev 952) @@ -85,11 +85,11 @@ * @param mainControl CMainControl */ public CArchPanel(final CMainControl mainControl) { + super(new BorderLayout()); this.mainControl = mainControl; final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); selectedArch = null; - setLayout(new BorderLayout()); tabDesktop = new JTabbedPane(SwingConstants.TOP); tabDesktop.setBorder(BorderFactory.createEmptyBorder(IGUIConstants.SPACE_PICKARCH_TOP, 0, 0, 0)); archQuickPanel = new CArchQuickView(mainControl); Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-12-07 20:06:31 UTC (rev 951) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-12-07 20:24:00 UTC (rev 952) @@ -44,6 +44,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; public final class CArchPanelPan extends JPanel { @@ -111,17 +112,28 @@ @Override public void mousePressed(final MouseEvent e) { // In JDK 1.4 it is required to transfer focus back to mapview after // every click in the panel, otherwise the menu-shortcuts stop working - if (mainControl.getCurrentMap() != null && - mainControl.getCurrentMap().getMapViewFrame() != null) { + if (mainControl.getCurrentMap() != null && mainControl.getCurrentMap().getMapViewFrame() != null) { mainControl.getCurrentMap().getMapViewFrame().requestFocus(); // focus to mapview } } }); } + /** + * Get the GameObject currently selected in the list. + * @return GameObject or <code>null</code> if no selection + */ public GameObject getArchListObject() { + return getArchListObject(theList.getSelectedIndex()); + } + + /** + * Get the GameObject from the list. + * @param index Index of selected list element or <code>-1</code> for no selection. + * @return GameObject or <code>null</code> if <var>index</var> was <code>-1</code> + */ + @Nullable private GameObject getArchListObject(final int index) { GameObject archetype = null; - int index = theList.getSelectedIndex(); if (index != -1) { final String archname = theList.getSelectedValue().toString(); archetype = mainControl.getArchetypeSet().getArchetype(archname); @@ -243,26 +255,17 @@ } } - private class MyCellRenderer extends DefaultListCellRenderer { + /** Cell Renderer for rendering cells in the ArchPanelPan. */ + private final class MyCellRenderer extends DefaultListCellRenderer { /** Serial Version UID. */ private static final long serialVersionUID = 1L; - /* {@inheritDoc} */ - @Override public Component getListCellRendererComponent(final JList list, - final Object value, // value to display - final int index, // cell index - final boolean isSelected, // is the cell selected - final boolean cellHasFocus) { // the list and the cell have the focus - - /* The DefaultListCellRenderer class will take care of - * the JLabels text property, it's foreground and background - *colors, and so on. - */ + /** {@inheritDoc} */ + @Override + public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - /* We additionally set the JLabels icon property here. - */ final ArchetypeSet archetypeSet = mainControl.getArchetypeSet(); final String archetypeName = value.toString(); final GameObject archetype = archetypeSet.getArchetype(archetypeName); Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-12-07 20:06:31 UTC (rev 951) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-12-07 20:24:00 UTC (rev 952) @@ -88,12 +88,8 @@ /** The currently selected MapSquare. */ private transient Point currentSquare = null; - /** - * Create a CMapTileList. - * @param mainControl MainControl. - * @param mainView MainView. - */ - CMapTileList(final CMainControl mainControl, final CMainView mainView) { + /** Build Panel */ + public CMapTileList(final CMainControl mainControl, final CMainView mainView) { this.mainControl = mainControl; this.mainView = mainView; setLayout(new BorderLayout()); @@ -175,8 +171,7 @@ // --- left mouse button: select arch --- // first, check if this is a doubleclick final long thisClick = (new Date()).getTime(); - if (thisClick - lastClick < IGUIConstants.DOUBLECLICK_MS && - lastClickGameObject != null && lastClickGameObject == getMapTileSelection()) { + if (thisClick - lastClick < IGUIConstants.DOUBLECLICK_MS && lastClickGameObject != null && lastClickGameObject == getMapTileSelection()) { // doubleclick: open attribute window mainControl.openAttrDialog(getMapTileSelection()); } else { @@ -377,8 +372,8 @@ return selListCounter; } - /** Builds the cells in the map-tile panel. */ - final class MyCellRenderer extends DefaultListCellRenderer { + /** CellRenderer for rendering ArchObjects on a certain map tile in a list. */ + private final class MyCellRenderer extends DefaultListCellRenderer { /** Serial Version UID. */ private static final long serialVersionUID = 1L; Modified: trunk/daimonin/src/daieditor/CArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanel.java 2006-12-07 20:06:31 UTC (rev 951) +++ trunk/daimonin/src/daieditor/CArchPanel.java 2006-12-07 20:24:00 UTC (rev 952) @@ -175,7 +175,7 @@ } /** - * Get name of selected Arch + * Get name of selected Arch. * @return Name of selected arch in arch panel */ public String getSelectedArch() { @@ -183,7 +183,7 @@ } /** - * Set selected Arch + * Set selected Arch. * @param selectedArch name of selected arch in arch panel */ public void setSelectedArch(final String selectedArch) { Modified: trunk/daimonin/src/daieditor/CArchPanelPan.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-07 20:06:31 UTC (rev 951) +++ trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-07 20:24:00 UTC (rev 952) @@ -49,7 +49,6 @@ import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; - public final class CArchPanelPan extends JPanel { private static final Logger log = Logger.getLogger(CArchPanelPan.class); @@ -114,7 +113,6 @@ theList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(final ListSelectionEvent e) { - //mainControl.showArchPanelQuickObject(getArchListObject()); mainControl.showArchPanelQuickObject(getArchListObject(e.getFirstIndex())); } }); Modified: trunk/daimonin/src/daieditor/CMapArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-12-07 20:06:31 UTC (rev 951) +++ trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-12-07 20:24:00 UTC (rev 952) @@ -959,7 +959,7 @@ document.insertString(document.getLength(), gameObject.getObjectText(), currentAttributes); } - // document.insertString(document.getLength(), "ID#"+gameObject.getMyID()+ " inv#: "+gameObject.countInvObjects()+"\n", currentAttributes); + // document.insertString(document.getLength(), "ID#"+gameObject+ " inv#: "+gameObject.countInvObjects()+"\n", currentAttributes); // black: the attributes from the default archetype // that don't exist among the "special" ones Modified: trunk/daimonin/src/daieditor/CMapTileList.java =================================================================== --- trunk/daimonin/src/daieditor/CMapTileList.java 2006-12-07 20:06:31 UTC (rev 951) +++ trunk/daimonin/src/daieditor/CMapTileList.java 2006-12-07 20:24:00 UTC (rev 952) @@ -84,7 +84,7 @@ private final DefaultListModel model; - private int listCounter; + private int listCounter = 0; /** The currently selected MapSquare. */ private transient MapSquare<GameObject> currentSquare; @@ -319,12 +319,12 @@ /** * Set the display to the currently selected map tile. * @param map Map to get display for (includes selection information) - * @param selArch Selected GameObject + * @param gameObject selected GameObject */ - public void setMapTileList(final MapControl map, final GameObject selArch) { + public void setMapTileList(final MapControl mapControl, final GameObject gameObject) { list.setEnabled(false); model.removeAllElements(); - if (map == null) { + if (mapControl == null) { // mouse has been clicked outside the mapview currentSquare = null; getTileArch(-1); @@ -334,7 +334,7 @@ } listCounter = 0; - currentSquare = map.getMapModel().getMouseRightPosObject(); + currentSquare = mapControl.getMapModel().getMouseRightPosObject(); int postSelect = -1; boolean foundSIndex = false; int sIndex = 0; @@ -342,9 +342,9 @@ // Now go through the list backwards and put all arches // on the panel in this order if (currentSquare != null) { - for (GameObject node : currentSquare.reverse()) { + for (final GameObject node : currentSquare.reverse()) { // add the node - if (node == selArch) { + if (node == gameObject) { postSelect = listCounter; } listCounter++; @@ -355,7 +355,8 @@ sIndex = listCounter - 1; // select this tile foundSIndex = true; // this is it - don't select any other tile } - final int tmpSelect = addInvObjects(node.getHead(), selArch); + + final int tmpSelect = addInvObjects(node.getHead(), gameObject); if (postSelect == -1 && tmpSelect != -1) { postSelect = tmpSelect; } @@ -378,19 +379,20 @@ /** * Add inventory objects to an arch in the MapTileList recursively. - * @param node the arch where the inventory gets added - * @param selArch selected GameObject + * @param node the arch where the inventory gets added + * @param gameObject selected GameObject * @return <code>-1</code> if <var>selArch</var> was found, else <var>listCounter</var> of the arch */ - private int addInvObjects(final GameObject node, final GameObject selArch) { + private int addInvObjects(final GameObject node, final GameObject gameObject) { int selListCounter = -1; for (GameObject arch : node.reverse()) { - if (arch == selArch) { + if (arch == gameObject) { selListCounter = listCounter; } listCounter++; model.addElement(arch); - final int tmpListCounter = addInvObjects(arch, selArch); + + final int tmpListCounter = addInvObjects(arch, gameObject); if (tmpListCounter != -1) { selListCounter = tmpListCounter; } @@ -421,13 +423,12 @@ private static final long serialVersionUID = 1L; /** {@inheritDoc} */ - @Override - public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { + @Override public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); GameObject arch = (GameObject) value; - // arch==null should not happen, but it *can* happen when the active + // arch == null should not happen, but it *can* happen when the active // window gets changed by user and java is still blitting here if (arch != null) { arch = arch.getHead(); @@ -444,8 +445,6 @@ // In the map-tile-window the object names are displayed // next to the icons - arch = arch.getHead(); - if (arch.getObjName() != null && arch.getObjName().length() > 0) { setText(arch.getObjName()); // special name } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 20:06:32
|
Revision: 951 http://svn.sourceforge.net/gridarta/?rev=951&view=rev Author: akirschbaum Date: 2006-12-07 12:06:31 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Remove use of object ids for game objects. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/MapViewIFrame.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/map/MapModel.java Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-12-07 19:05:43 UTC (rev 950) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-12-07 20:06:31 UTC (rev 951) @@ -32,6 +32,8 @@ import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.JComboBox; @@ -53,6 +55,9 @@ /** Controller of this subview. */ private final CMainControl mainControl; + /** List of index-archname pairs */ + private List<PanelEntry> archList = new ArrayList<PanelEntry>(); + private final JList theList; private final DefaultListModel model; @@ -61,10 +66,6 @@ private final JComboBox jbox; - private final StringBuffer list = new StringBuffer(); - - private int listcounter = 0; - private int comboCounter; private final CArchPanel archPanel; @@ -153,18 +154,7 @@ * @param index index of subdir where to add */ public void addArchPanelArch(final String archname, final int index) { - final String def = " "; - assert def.length() == 45; - assert archname.length() <= def.length(); - - list.append(archname); - list.append(def.substring(0, 45 - archname.length())); - - final String num = Integer.toString(index); - list.append(def.substring(0, 5 - num.length())); - list.append(num); - - listcounter++; + archList.add(new PanelEntry(index, archname)); } int addArchPanelCombo(final String name) { @@ -186,38 +176,24 @@ return model; } - /** - * Returns an array with archetype numbers as Strings. - * This is only needed when arche collection is run, so we want - * to know to which categories the arches belong to. - * @return an array of nodenumbers from all arches in this panel - * @deprecated The whole procedure behind this method looks sooo stupid (cher). - */ - @Deprecated public String[] getListArchNameArray() { - final String[] numList = new String[(int) (list.length() / 50.0)]; - - for (int i = 0; i < (int) (list.length() / 50.0); i++) { - numList[i] = list.substring(50 * i, 45 + 50 * i).trim(); - } - - return numList; + public List<PanelEntry> getPanelEntries() { + return archList; } /** * Returns an array with category numbers as Strings. * This is only needed when arche collection is run, so we want * to know to which categories the arches belong to. - * @return an array of the categories of all arches in this panel<br /> - * note that the same indices are used for same arches in 'getListArchNameArray()' - * @deprecated The whole procedure behind this method looks sooo stupid (cher). + * @return an array of the categories of all arches in this panel */ - @Deprecated public String[] getListCategoryArray() { - final String[] catList = new String[(int) (list.length() / 50.0)]; + public String[] getListCategoryArray() { + final String[] catList = new String[archList.size()]; - for (int i = 0; i < (int) (list.length() / 50.0); i++) { + int i = 0; + for (final PanelEntry p : archList) { try { - final int index = Integer.parseInt(list.substring(45 + 50 * i, 50 + 50 * i).trim()); - catList[i] = jbox.getItemAt(index).toString().trim(); + final int index = p.getIndex(); + catList[i++] = jbox.getItemAt(index).toString().trim(); } catch (final NullPointerException e) { log.warn("Nullpointer in getListCategoryArray()!", e); } @@ -234,24 +210,39 @@ final int index = jbox.getSelectedIndex(); model.removeAllElements(); - - int offset = 0; - for (int i = 0; i < listcounter; i++) { + for (PanelEntry p : archList) { if (index >= 0) { if (index == 0) { - // this.model.addElement(this.list.substring(offset, offset+5)+" I:"+this.list.substring(offset+45, offset+50)); - model.addElement(list.substring(offset, offset + 45).trim()); + model.addElement(p.getName()); } else { - final String strIndex = list.substring(offset + 45, offset + 50).trim(); - if (index == Integer.parseInt(strIndex)) { - model.addElement(list.substring(offset, offset + 45).trim()); + if (index == p.getIndex()) { + model.addElement(p.getName()); } } } - offset += 50; } } + public static final class PanelEntry { + + private int index; + + private String archName; + + public PanelEntry(final int i, final String name) { + index = i; + archName = name; + } + + public int getIndex() { + return index; + } + + public String getName() { + return archName; + } + } + private class MyCellRenderer extends DefaultListCellRenderer { /** Serial Version UID. */ Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-07 19:05:43 UTC (rev 950) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-07 20:06:31 UTC (rev 951) @@ -354,8 +354,8 @@ return copybuffer; } - void setMapAndArchPosition(final int archid, final Point pos) { - currentMap.getMapViewFrame().setMapAndArchPosition(archid, pos); + void setMapAndArchPosition(final GameObject gameObject, final Point pos) { + currentMap.getMapViewFrame().setMapAndArchPosition(gameObject, pos); } /** @@ -488,12 +488,12 @@ return currentMap.insertArchToMap(newarch, archname, next, pos, join); } - public void deleteMapArch(final int index, final Point pos, final boolean refreshMap, final boolean join) { - currentMap.deleteMapArch(index, pos, refreshMap, join); + public void deleteMapArch(final GameObject gameObject, final Point pos, final boolean refreshMap, final boolean join) { + currentMap.deleteMapArch(gameObject, pos, refreshMap, join); } - public GameObject getMapArch(final int index, final Point pos) { - return currentMap.getMapArch(index, pos); + public GameObject getMapArch(final GameObject gameObject, final Point pos) { + return currentMap.getMapArch(gameObject, pos); } /** @@ -713,7 +713,7 @@ level.levelCloseNotify(); } else { // Notify the level about the closing - mainView.setMapTileList(null, -1); + mainView.setMapTileList(null, null); level.levelCloseNotify(); mainView.removeLevelView(level.getMapViewFrame()); levels.remove(level); @@ -1521,7 +1521,7 @@ mainView.appExitNotify(); // notify main view if (currentMap != null) { - mainView.setMapTileList(null, -1); + mainView.setMapTileList(null, null); } // save settings Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-12-07 19:05:43 UTC (rev 950) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-12-07 20:06:31 UTC (rev 951) @@ -351,8 +351,8 @@ } // access mape tile list ... - public void setMapTileList(final MapControl map, final int archid) { - mapTileList.setMapTileList(map, archid); + public void setMapTileList(final MapControl map, final GameObject gameObject) { + mapTileList.setMapTileList(map, gameObject); } public void refreshMapTileList() { Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-07 19:05:43 UTC (rev 950) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-07 20:06:31 UTC (rev 951) @@ -280,7 +280,7 @@ inv.addLast(invnew); mainControl.getArchetypeParser().postParseGameObject(invnew, 0); - mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), inv.getMyID()); + mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), inv); mainControl.getCurrentMap().setLevelChangedFlag(); // the map has been modified } }); @@ -750,7 +750,7 @@ document.insertString(document.getLength(), gameObject.getObjectText(), currentAttributes); } - // document.insertString(document.getLength(), "ID#"+gameObject.getMyID()+ " inv#: "+gameObject.countInvObjects()+"\n", currentAttributes); + // document.insertString(document.getLength(), "ID#"+gameObject+ " inv#: "+gameObject.countInvObjects()+"\n", currentAttributes); // black: the attributes from the default archetype // that don't exist among the "special" ones Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-12-07 19:05:43 UTC (rev 950) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-12-07 20:06:31 UTC (rev 951) @@ -51,6 +51,7 @@ import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import net.sf.gridarta.gameobject.GameObjectContainer; import org.jetbrains.annotations.Nullable; /** @@ -74,10 +75,6 @@ private final DefaultListModel model; - private static final String listDef = "0000000000"; - - private int postSelect = -1; - private int listCounter = 0; /** @@ -86,7 +83,7 @@ */ private long lastClick = -1; - private int lastClickId = -1; + private GameObject lastClickGameObject = null; /** The currently selected MapSquare. */ private transient Point currentSquare = null; @@ -179,7 +176,7 @@ // first, check if this is a doubleclick final long thisClick = (new Date()).getTime(); if (thisClick - lastClick < IGUIConstants.DOUBLECLICK_MS && - lastClickId != -1 && lastClickId == getMapTileSelection().getMyID()) { + lastClickGameObject != null && lastClickGameObject == getMapTileSelection()) { // doubleclick: open attribute window mainControl.openAttrDialog(getMapTileSelection()); } else { @@ -189,11 +186,7 @@ // save values for next click lastClick = thisClick; - if (getMapTileSelection() != null) { - lastClickId = getMapTileSelection().getMyID(); - } else { - lastClickId = -1; - } + lastClickGameObject = getMapTileSelection(); } else if ((e.getModifiers() & MouseEvent.BUTTON3_MASK) != 0 || ((e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 && e.isShiftDown())) { // --- right mouse button: insert arch --- @@ -203,9 +196,8 @@ if (listIndex >= list.getModel().getSize()) { mainControl.insertArchToMap(mainControl.getArchPanelHighlight(), mainControl.getPanelArchName(), null, currentSquare, MapModel.JOIN_ENABLE); } else { - final String entry = model.getElementAt(listIndex).toString(); - final int num = Integer.parseInt(entry.substring(0, 10)); - mainControl.insertArchToMap(mainControl.getArchPanelHighlight(), mainControl.getPanelArchName(), mainControl.getMapArch(num, currentSquare), currentSquare, MapModel.JOIN_ENABLE); + final GameObject entry = (GameObject) model.getElementAt(listIndex); + mainControl.insertArchToMap(mainControl.getArchPanelHighlight(), mainControl.getPanelArchName(), entry, currentSquare, MapModel.JOIN_ENABLE); } // refresh @@ -250,31 +242,24 @@ return listIndex; } + /** Get the selected arch within the list (currently selected tile). */ @Nullable public GameObject getMapTileSelection() { - // find the selected entry if one - final int index = list.getSelectedIndex(); - if (currentSquare == null || index >= list.getModel().getSize() || index < 0 || list.getModel().getSize() <= 0 || mainControl.getCurrentMap() == null) { - return null; - } - - // parse selected entry and get the arch object - final String entry = model.getElementAt(index).toString(); - final int num = Integer.parseInt(entry.substring(0, 10)); - return mainControl.getMapArch(num, currentSquare); + return (GameObject) list.getSelectedValue(); } /** - * Insert a tile index of list, this will delete it. - * @param index Index - * @todo This comment is so stupid, I don't understand it (cher). + * Delete an GameObject with a specific list index. + * @param index List index of GameObject */ - void deleteIndexFromList(final int index) { - if (currentSquare != null && index != -1 && index < list.getModel().getSize()) { - final GameObject temp = getMapTileSelection(); - final String entry = model.getElementAt(index).toString(); - final int num = Integer.parseInt(entry.substring(0, 10)); - mainControl.deleteMapArch(num, currentSquare, true, MapModel.JOIN_ENABLE); - mainView.setMapTileList(mainControl.getCurrentMap(), (temp == null ? -1 : temp.getMyID())); + private void deleteIndexFromList(final int index) { + if (index < 0) { + return; + } // index is -1 for empty lists, so an IndexOutOfBoundsException would be thrown + final GameObject temp = getMapTileSelection(); + final GameObject entry = (GameObject) model.getElementAt(index); + if (entry != null) { + mainControl.deleteMapArch(entry, currentSquare, true, MapModel.JOIN_ENABLE); + setMapTileList(mainControl.getCurrentMap(), temp); } } @@ -294,30 +279,23 @@ } void refresh() { - final int id; + final GameObject gameObject; final GameObject sel = getMapTileSelection(); if (sel != null) { - id = getMapTileSelection().getMyID(); + gameObject = getMapTileSelection(); } else { - id = -1; + gameObject = null; } - mainView.setMapTileList(mainControl.getCurrentMap(), id); + mainView.setMapTileList(mainControl.getCurrentMap(), gameObject); repaint(); } /** - * Get mapControl start node, then list all arches from bottom up. i used 10 - * digits to code the object ids, that should be enough for running the - * editor a long time - * <p/> - * (if arch id != -1, he trys to sit on this arch) ??? - * @param mapControl MapControl to operate on. - * @param archid Id of the Archetype. + * Set the display to the currently selected map tile. + * @param map Map to get display for (includes selection information) + * @param gameObject selected GameObject */ - public void setMapTileList(final MapControl mapControl, final int archid) { - int sIndex = 0; // index of the tile which is selected by default - boolean foundSIndex = false; // true when 'sIndex' has been determined - + public void setMapTileList(final MapControl mapControl, final GameObject gameObject) { list.setEnabled(false); model.removeAllElements(); if (mapControl == null) { @@ -329,23 +307,22 @@ return; } - postSelect = -1; listCounter = 0; currentSquare = mapControl.getMapModel().getMouseRightPos(); + int postSelect = -1; + boolean foundSIndex = false; + int sIndex = 0; + // Now go through the list backwards and put all arches + // on the panel in this order if (currentSquare != null) { - // Now go through the list backwards and put all arches - // on the panel in this order for (final GameObject node : mapControl.getMapModel().getMapSquare(currentSquare).reverse()) { // add the node - if (node.getMyID() == archid) { + if (node == gameObject) { postSelect = listCounter; } - final String num = Integer.toString(node.getMyID()); - String liststring = listDef.substring(0, 10 - num.length()) + num; - liststring += listDef; listCounter++; - model.addElement(liststring); + model.addElement(node); // if view-settings are applied, mark topmost "visible" tile for selection if (mainControl.isTileEditSet() && !foundSIndex && mainControl.isTileEdit(node.getEditType())) { @@ -353,7 +330,10 @@ foundSIndex = true; // this is it - don't select any other tile } - addInvObjects(node, archid, 1); // browse the inventory of the mapControl object + final int tmpSelect = addInvObjects(node.getHead(), gameObject); + if (postSelect == -1 && tmpSelect != -1) { + postSelect = tmpSelect; + } } } @@ -373,28 +353,28 @@ /** * Add inventory objects to an arch in the MapTileList recursively. - * @param node the arch where the inventory gets added - * @param archid object id of the highlighted arch (?) - * @param indent indentation; 1=minimal indentation + * @param node the arch where the inventory gets added + * @param gameObject selected GameObject + * @return <code>-1</code> if <var>selArch</var> was found, else <var>listCounter</var> of the arch */ - private void addInvObjects(final GameObject node, final int archid, final int indent) { - final String indentStr = Integer.toString(indent); - + private int addInvObjects(final GameObject node, final GameObject gameObject) { + int selListCounter = -1; final Iterator it = node.getHead().iterator(); while (it.hasNext()) { final GameObject arch = (GameObject) it.next(); - if (arch.getMyID() == archid) { - postSelect = listCounter; + if (arch == gameObject) { + selListCounter = listCounter; } - final String num = Integer.toString(arch.getMyID()); - String liststring = listDef.substring(0, 10 - num.length()) + num; - liststring += listDef.substring(0, 10 - indentStr.length()) + indentStr; listCounter++; - model.addElement(liststring); + model.addElement(arch); - addInvObjects(arch, archid, indent + 1); + final int tmpListCounter = addInvObjects(arch, gameObject); + if (tmpListCounter != -1) { + selListCounter = tmpListCounter; + } } + return selListCounter; } /** Builds the cells in the map-tile panel. */ @@ -403,60 +383,35 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; - /* This is the only method defined by ListCellRenderer. We just - * reconfigure the Jlabel each time we're called. - */ + /** {@inheritDoc} */ @Override public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { - - /* The DefaultListCellRenderer class will take care of - * the JLabels text property, it's foreground and background - *colors, and so on. - */ super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - if (currentSquare == null) { - return this; - } + GameObject arch = (GameObject) value; - final String entry = value.toString(); - final int num = Integer.parseInt(entry.substring(0, 10)); - final int indent = Integer.parseInt(entry.substring(10, 20)); - - GameObject gameObject = mainControl.getMapArch(num, currentSquare); - //String label; - - // We must set a disabled Icon (even though we don't want it) - // If unset, in JDK 1.4 swing tries to generate a greyed out version - // of the lable-icon from the image-producer - causing a runtime error. - setDisabledIcon(CMainControl.getUnknownTileIcon()); - // arch == null should not happen, but it *can* happen when the active // window gets changed by user and java is still blitting here - if (gameObject != null) { - gameObject = gameObject.getHead(); + if (arch != null) { + arch = arch.getHead(); - if (!isSelected && indent == 0) { - this.setBackground(IGUIConstants.BG_COLOR); - } - - if (gameObject.getArchetypeName() == null) { + if (!arch.hasArchetype()) { setIcon(CMainControl.getNoarchTileIcon()); - } else if (gameObject.getFaceFlag()) { + } else if (arch.getFaceFlag()) { setIcon(CMainControl.getNofaceTileIcon()); - } else if (gameObject.getFaceNr() == -1) { + } else if (arch.getFaceNr() == -1) { setIcon(CMainControl.getUnknownTileIcon()); } else { - setIcon(mainControl.getFace(gameObject.getFaceNr())); + setIcon(mainControl.getFace(arch.getFaceNr())); } // In the map-tile-window the object names are displayed // next to the icons - if (gameObject.getObjName() != null && gameObject.getObjName().length() > 0) { - setText(gameObject.getObjName()); // special name + if (arch.getObjName() != null && arch.getObjName().length() > 0) { + setText(arch.getObjName()); // special name } else { final String defname; - if (gameObject.getArchetypeName() != null) { - defname = gameObject.getArchetype().getObjName(); + if (arch.hasArchetype()) { + defname = arch.getArchetype().getObjName(); } else { defname = null; } @@ -464,15 +419,27 @@ if (defname != null && defname.length() > 0) { setText(defname); // default name } else { - setText(gameObject.getArchetypeName()); // arch name + setText(arch.getArchetypeName()); // arch name } } } else { setIcon(CMainControl.getUnknownTileIcon()); setText("?"); } - setBorder(BorderFactory.createEmptyBorder(0, Math.max(0, indent - 1) * 16, 0, 0)); // indentation + int indent = 0; + for (;;) { + final GameObjectContainer<GameObject> env = arch.getContainer(); + if (env == null || !(env instanceof GameObject)) { + break; + } + arch = (GameObject) env; + indent++; + } + if (indent > 1) { + setBorder(BorderFactory.createEmptyBorder(0, (indent - 1) * 16, 0, 0)); // indentation + } + return this; } Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-07 19:05:43 UTC (rev 950) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-07 20:06:31 UTC (rev 951) @@ -203,7 +203,7 @@ // repaint map to display selection no more mapControl.repaint(); - mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), -1); + mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), null); } public int getActiveEditType() { @@ -291,7 +291,7 @@ // repaint map to display selection mapControl.repaint(); - mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), -1); + mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), null); } /** @@ -332,12 +332,12 @@ frame.updateTitle(); } - void setMapAndArchPosition(final int archid, final Point pos) { + void setMapAndArchPosition(final GameObject gameObject, final Point pos) { mapMouseRightPos.setLocation(pos); if (pos.x == -1 || pos.y == -1) { - mainControl.getMainView().setMapTileList(null, -1); + mainControl.getMainView().setMapTileList(null, null); } else { - mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), archid); + mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), gameObject); } modelChanged(); } @@ -559,7 +559,7 @@ deleteObject(mapLoc); } } else { - mainControl.getMainView().setMapTileList(null, -1); // for secure... + mainControl.getMainView().setMapTileList(null, null); // for secure... } /* UndoAndRedo.getInstance(mapControl).add(new CPaintOp(previewRect, aOrigData, (short)mapControl.getSelectedTile())); @@ -592,7 +592,7 @@ // We update the mapArchPanel here and not in the dragging method, // because it would considerably slow down the dragging-action. if (needMpanelUpdate[buttonNr]) { - mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), -1); + mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), null); needMpanelUpdate[buttonNr] = false; } } @@ -665,7 +665,7 @@ mapMouseRightPos.y = temp.y; if (temp.x == -1 || temp.y == -1) { - mainControl.getMainView().setMapTileList(null, -1); + mainControl.getMainView().setMapTileList(null, null); } else { needRedraw = insertSelArchToMap(temp, false); needMpanelUpdate[2] = true; // when dragging is done, update map panel @@ -679,7 +679,7 @@ mapMouseRightPos.y = temp.y; if (temp.x == -1 || temp.y == -1) { - mainControl.getMainView().setMapTileList(null, -1); + mainControl.getMainView().setMapTileList(null, null); } else { // delete the topmost arch (matching the view settings) // on that square and redraw the map @@ -695,7 +695,7 @@ } if (tmpArch != null) { needRedraw = calcArchRedraw(tmpArch); // get redraw info - mapControl.deleteMapArch(tmpArch.getMyID(), temp, false, MapModel.JOIN_ENABLE); + mapControl.deleteMapArch(tmpArch, temp, false, MapModel.JOIN_ENABLE); } needMpanelUpdate[1] = true; // when dragging is done, update map panel @@ -747,7 +747,7 @@ insertArchName = "nothing"; } - mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), -1); + mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), null); } } } @@ -761,7 +761,7 @@ if (mapLoc.x == -1 || mapLoc.y == -1) { if (!renderer.isPickmap()) { - mainControl.getMainView().setMapTileList(null, -1); + mainControl.getMainView().setMapTileList(null, null); if (highlightOn) { highlightOn = false; @@ -770,7 +770,7 @@ } } else { if (!mapControl.isPickmap()) { - mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), -1); + mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), null); } if (!highlightOn) { @@ -815,10 +815,10 @@ } if (tmpArch != null) { needRedraw = calcArchRedraw(tmpArch); // get redraw info - mapControl.deleteMapArch(tmpArch.getMyID(), mapLoc, false, MapModel.JOIN_ENABLE); + mapControl.deleteMapArch(tmpArch, mapLoc, false, MapModel.JOIN_ENABLE); // update mapArch panel - mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), -1); + mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), null); } } } Modified: trunk/crossfire/src/cfeditor/MapViewIFrame.java =================================================================== --- trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-12-07 19:05:43 UTC (rev 950) +++ trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-12-07 20:06:31 UTC (rev 951) @@ -190,8 +190,8 @@ view.changedFlagNotify(); } - void setMapAndArchPosition(final int archid, final Point pos) { - view.setMapAndArchPosition(archid, pos); + void setMapAndArchPosition(final GameObject gameObject, final Point pos) { + view.setMapAndArchPosition(gameObject, pos); } Point[] calcArchRedraw(final GameObject arch) { Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2006-12-07 19:05:43 UTC (rev 950) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2006-12-07 20:06:31 UTC (rev 951) @@ -312,6 +312,7 @@ } postParseArchetype(archetype); archetype.setIsArchetype(); + archetype.setEditorFolder(newCat); mainControl.getArchetypeSet().addArchetype(archetype); archmore = false; // we assume this is last... but perhaps.. Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-07 19:05:43 UTC (rev 950) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-07 20:06:31 UTC (rev 951) @@ -620,99 +620,83 @@ } /** {@inheritDoc} */ - public void collect(final Progress progress, final File destDir) throws IOException { - final File dfile = new File(destDir, IGUIConstants.ARCH_FILE); + public void collect(final Progress progress, final File dir) throws IOException { + final File dfile = new File(dir, IGUIConstants.ARCH_FILE); // now open the output-stream final DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(dfile))); try { - int count = 0; // count how much arches we've collected - // loop through all existing ArchPanels and find all arches - // along with their display-category - Archetype<GameObject> archetype; - for (final CArchPanel.PanelNode node : CArchPanel.getPanelNodeList()) { + for (final GameObject arch : getArchetypes()) { - final String[] numList = node.getData().getListArchNameArray(); - final String[] catList = node.getData().getListCategoryArray(); // list of category strings + if (arch.isTail()) { + log.error("Collect Error: Multipart Tail in Panel found!"); + } - // process every arch in this panel - for (int i = 0; i < numList.length; i++) { + out.writeBytes("Object " + arch.getArchetypeName() + "\n"); - archetype = getArchetype(numList[i]); + if (arch.getObjName() != null) { + out.writeBytes("name " + arch.getObjName() + "\n"); + } + if (arch.getFaceName() != null) { + out.writeBytes("face " + arch.getFaceName() + "\n"); + } + if (arch.getArchTypNr() > 0) { + out.writeBytes("type " + arch.getArchTypNr() + "\n"); + } - if (archetype.isTail()) { - log.error("Collect Error: Multipart Tail in Panel found!"); - } + // special: add a string-attribute with the display-category + out.writeBytes("editor_folder " + arch.getEditorFolder() + '\n'); - out.writeBytes("Object " + archetype.getArchetypeName() + "\n"); + // add message text + if (arch.getMsgText() != null && arch.getMsgText().trim().length() > 0) { + out.writeBytes("msg\n" + arch.getMsgText().trim() + "\nendmsg\n"); + } - if (archetype.getObjName() != null) { - out.writeBytes("name " + archetype.getObjName() + "\n"); + out.writeBytes(arch.getObjectText()); + if (arch.getObjectText().lastIndexOf(0x0a) != arch.getObjectText().length() - 1) { + out.writeBytes("\n"); + } + + out.writeBytes("end\n"); + count++; + if (count % 100 == 0) { + progress.setValue(count); + } + + // if multi-head, we must attach the tails + for (GameObject tail = arch.getMultiNext(); tail != null; tail = tail.getMultiNext()) { + out.writeBytes("More\n"); + + out.writeBytes("Object " + tail.getArchetypeName() + "\n"); + + if (tail.getObjName() != null) { + out.writeBytes("name " + tail.getObjName() + "\n"); } - if (archetype.getFaceName() != null) { - out.writeBytes("face " + archetype.getFaceName() + "\n"); + if (tail.getFaceName() != null) { + out.writeBytes("face " + tail.getFaceName() + "\n"); } - if (archetype.getArchTypNr() > 0) { - out.writeBytes("type " + archetype.getArchTypNr() + "\n"); + if (tail.getArchTypNr() > 0) { + out.writeBytes("type " + tail.getArchTypNr() + "\n"); } - // special: add a string-attribute with the display-category - out.writeBytes("editor_folder " + node.getTitle() + "/" + catList[i] + "\n"); - - // add message text - if (archetype.getMsgText() != null && archetype.getMsgText().trim().length() > 0) { - out.writeBytes("msg\n" + archetype.getMsgText().trim() + "\nendmsg\n"); - } - - out.writeBytes(archetype.getObjectText()); - if (archetype.getObjectText().lastIndexOf(0x0a) != archetype.getObjectText().length() - 1) { + out.writeBytes(tail.getObjectText()); + if (tail.getObjectText().lastIndexOf(0x0a) != tail.getObjectText().length() - 1) { out.writeBytes("\n"); } + // position of multi relative to head + if (tail.getMultiX() != 0) { + out.writeBytes("x " + tail.getMultiX() + "\n"); + } + if (tail.getMultiY() != 0) { + out.writeBytes("y " + tail.getMultiY() + "\n"); + } out.writeBytes("end\n"); count++; if (count % 100 == 0) { progress.setValue(count); } - - // if multi-head, we must attach the tails - for (GameObject tail = archetype.getMultiNext(); tail != null; tail = tail.getMultiNext()) { - out.writeBytes("More\n"); - - out.writeBytes("Object " + tail.getArchetypeName() + "\n"); - - if (tail.getObjName() != null) { - out.writeBytes("name " + tail.getObjName() + "\n"); - } - if (tail.getFaceName() != null) { - out.writeBytes("face " + tail.getFaceName() + "\n"); - } - if (tail.getArchTypNr() > 0) { - out.writeBytes("type " + tail.getArchTypNr() + "\n"); - } - - // special: add a string-attribute with the display-category - //out.writeBytes("editor_folder "+node.getTitle()+"/"+catList[i]+"\n"); - - out.writeBytes(tail.getObjectText()); - if (tail.getObjectText().lastIndexOf(0x0a) != tail.getObjectText().length() - 1) { - out.writeBytes("\n"); - } - - // position of multi relative to head - if (tail.getMultiX() != 0) { - out.writeBytes("x " + tail.getMultiX() + "\n"); - } - if (tail.getMultiY() != 0) { - out.writeBytes("y " + tail.getMultiY() + "\n"); - } - out.writeBytes("end\n"); - count++; - if (count % 100 == 0) { - progress.setValue(count); - } - } } } Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-12-07 19:05:43 UTC (rev 950) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-12-07 20:06:31 UTC (rev 951) @@ -54,11 +54,6 @@ /** Static reference to the typeList (find syntax errors). */ private static CFArchTypeList typeList; - private static int myIdCounter = 0; - - private int myId; // the one and only id - // unique arch object id at editor runtime - private String faceName; // face name : 1 private StringBuffer animText; // anim text buffer @@ -95,12 +90,13 @@ private AutojoinList join; // if nonzero, pointing to the list of autojoining archetypes + /** Editor Folder. */ + private String editorFolder; + /** Create an GameObject. */ public GameObject() { script = null; // this object stays 'null' unless there are events defined - myId = myIdCounter++; // increase ID counter for every new arch created - animText = loreText = null; archTextCount = 0; // lines inserted in objectText @@ -287,14 +283,6 @@ } } - public int getMyID() { - return myId; - } - - public void setMyID(final int num) { - myId = num; - } - /** * Insert an GameObject before this GameObject. * @param node GameObject to append @@ -893,4 +881,20 @@ return arch; } + /** + * Returns editor Folder. + * @return editor Folder + */ + public String getEditorFolder() { + return editorFolder; + } + + /** + * Sets editor Folder. + * @param editorFolder editor Folder + */ + public void setEditorFolder(final String editorFolder) { + this.editorFolder = editorFolder; + } + } // class GameObject Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 19:05:43 UTC (rev 950) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 20:06:31 UTC (rev 951) @@ -315,7 +315,7 @@ next.getContainer().addLast(invnew); mainControl.getArchetypeParser().postParseGameObject(invnew, mapControl.getActiveEditType()); - mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), invnew.getMyID()); + mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), invnew); } setLevelChangedFlag(); // the map has been modified @@ -361,19 +361,19 @@ } /** {@inheritDoc} */ - @Nullable public GameObject getMapArch(final int id, final Point pos) { + @Nullable public GameObject getMapArch(final GameObject gameObject, final Point pos) { if (mapGrid == null || !isPointValid(pos)) { return null; } // first, try to find the tile we had selected for (final GameObject node : getMapSquare(pos)) { - if (node.getMyID() == id) { // is it this map tile + if (node == gameObject) { // is it this map tile return node; } // no, lets check his inventory - final GameObject temp = findInvObject(node, id); + final GameObject temp = findInvObject(node, gameObject); if (temp != null) { return temp; } @@ -385,15 +385,15 @@ /** * Get the arch from the inventory of a given object with the specified * 'id'. - * @param id ID number of arch (-> <code>arch.getMyID()</code>) + * @param gameObject game object to search for * @return the specified arch, or null if not found */ - @Nullable public GameObject findInvObject(@NotNull final GameObject node, final int id) { + @Nullable public GameObject findInvObject(@NotNull final GameObject node, final GameObject gameObject) { for (final GameObject arch : node.getHead()) { - if (arch.getMyID() == id) { + if (arch == gameObject) { return arch; } - final GameObject temp = findInvObject(arch, id); + final GameObject temp = findInvObject(arch, gameObject); if (temp != null) { return temp; } @@ -402,10 +402,10 @@ } /** {@inheritDoc} */ - public void deleteMapArch(final int id, final Point pos, final boolean refreshMap, final boolean join) { + public void deleteMapArch(final GameObject gameObject, final Point pos, final boolean refreshMap, final boolean join) { // first, try to find the tile we had selected for (final GameObject node : getMapSquare(pos)) { - if (node.getMyID() == id) { + if (node == gameObject) { node.remove(); // do autojoining @@ -420,7 +420,7 @@ } // no, lets check his inventory - final GameObject temp = findInvObject(node, id); + final GameObject temp = findInvObject(node, gameObject); if (temp != null) { deleteInvObject(temp); break; Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-07 19:05:43 UTC (rev 950) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-07 20:06:31 UTC (rev 951) @@ -211,12 +211,12 @@ mapModel.addGameObjectToMap(arch, false); } - public void deleteMapArch(final int index, final Point pos, final boolean refreshMap, final boolean join) { - mapModel.deleteMapArch(index, pos, refreshMap, join); + public void deleteMapArch(final GameObject gameObject, final Point pos, final boolean refreshMap, final boolean join) { + mapModel.deleteMapArch(gameObject, pos, refreshMap, join); } - public GameObject getMapArch(final int index, final Point pos) { - return mapModel.getMapArch(index, pos); + public GameObject getMapArch(final GameObject gameObject, final Point pos) { + return mapModel.getMapArch(gameObject, pos); } public String getMapTilePath(final int direction) { Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-07 19:05:43 UTC (rev 950) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-07 20:06:31 UTC (rev 951) @@ -74,21 +74,21 @@ * Delete an existing arch from the map. (If the specified arch doesn't * exist, nothing happens.) (This includes deletion of multiparts and * inventory.) - * @param id ID of the arch to be removed (->arch.getMyID()) + * @param gameObject the game object to remove * @param pos location of the arch to be removed * @param refreshMap If true, mapview is redrawn after deletion. Keep in * mind: drawing consumes time! * @param join if set to JOIN_ENABLE auto-joining is supported */ - void deleteMapArch(int id, Point pos, boolean refreshMap, boolean join); + void deleteMapArch(GameObject gameObject, Point pos, boolean refreshMap, boolean join); /** * Get the arch from the map with the specified 'id', at location pos. + * @param gameObject game object to search for * @param pos Location of GameObject - * @param id ID number of arch (-> <code>arch.getMyID()</code>) * @return the specified arch, or null if not found */ - @Nullable GameObject getMapArch(int id, Point pos); + @Nullable GameObject getMapArch(GameObject gameObject, Point pos); /** * Get the first exit on the MapSquare described by <var>hspot</var>. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 19:05:43
|
Revision: 950 http://svn.sourceforge.net/gridarta/?rev=950&view=rev Author: akirschbaum Date: 2006-12-07 11:05:43 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Do not insert multiple identical objects while dragging the mouse. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2006-12-07 18:48:12 UTC (rev 949) +++ trunk/crossfire/ChangeLog 2006-12-07 19:05:43 UTC (rev 950) @@ -1,3 +1,8 @@ +2006-12-07 Andreas Kirschbaum + + * Do not insert multiple identical objects while dragging the + mouse. + 2006-12-06 Andreas Kirschbaum * Do not close treasure list selection dialog if the user selects Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 18:48:12 UTC (rev 949) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 19:05:43 UTC (rev 950) @@ -177,23 +177,17 @@ /** {@inheritDoc} */ public boolean isMultiArchFittingToMap(final String archName, final Point pos, final boolean allowDouble) { - final Archetype<GameObject> head = getArchetype(archName); - final Point mapH = new Point(head.getMultiX(), head.getMultiY()); - mapH.translate(pos.x, pos.y); - if (!isPointValid(mapH)) { - return false; - } - for (GameObject tail = head.getMultiNext(); tail != null; tail = tail.getMultiNext()) { - final Point mapT = new Point(tail.getMultiX(), tail.getMultiY()); - mapT.translate(pos.x, pos.y); + for (GameObject part = getArchetype(archName); part != null; part = part.getMultiNext()) { + final Point point = new Point(part.getMultiX(), part.getMultiY()); + point.translate(pos.x, pos.y); // outside map - if (!isPointValid(mapT)) { + if (!isPointValid(point)) { return false; } if (!allowDouble) { - final String temp = tail.getArchetypeName(); - for (final GameObject node : mapGrid[mapT.x][mapT.y]) { + final String temp = part.getArchetypeName(); + for (final GameObject node : mapGrid[point.x][point.y]) { if (node.getArchetypeName().equals(temp)) { return false; } Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-07 18:48:12 UTC (rev 949) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-07 19:05:43 UTC (rev 950) @@ -100,23 +100,17 @@ /** {@inheritDoc} */ public boolean isMultiArchFittingToMap(final String archName, final Point pos, final boolean allowDouble) { - final Archetype<GameObject> head = getArchetype(archName); - final Point mapH = new Point(head.getMultiX(), head.getMultiY()); - mapH.translate(pos.x, pos.y); - if (!isPointValid(mapH)) { - return false; - } - for (GameObject tail = head.getMultiNext(); tail != null; tail = tail.getMultiNext()) { - final Point mapT = new Point(tail.getMultiX(), tail.getMultiY()); - mapT.translate(pos.x, pos.y); + for (GameObject part = getArchetype(archName); part != null; part = part.getMultiNext()) { + final Point point = new Point(part.getMultiX(), part.getMultiY()); + point.translate(pos.x, pos.y); // outside map - if (!isPointValid(mapT)) { + if (!isPointValid(point)) { return false; } if (!allowDouble) { - final String temp = tail.getArchetypeName(); - for (final GameObject node : mapGrid[mapT.x][mapT.y]) { + final String temp = part.getArchetypeName(); + for (final GameObject node : mapGrid[point.x][point.y]) { if (node.getArchetypeName().equals(temp)) { return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 18:48:14
|
Revision: 949 http://svn.sourceforge.net/gridarta/?rev=949&view=rev Author: akirschbaum Date: 2006-12-07 10:48:12 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Update comments. Modified Paths: -------------- trunk/daimonin/src/daieditor/CArchPanelPan.java Modified: trunk/daimonin/src/daieditor/CArchPanelPan.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-07 10:33:45 UTC (rev 948) +++ trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-07 18:48:12 UTC (rev 949) @@ -203,10 +203,10 @@ } /** - * this is only needed when arche collection is run, so we want - * to know to which categories the arches belong to: - * @return an array of the categories of all arches in this panel<br> - * note that the same indices are used for same arches in 'getListArchNameArray()' + * Returns an array with category numbers as Strings. + * This is only needed when arche collection is run, so we want + * to know to which categories the arches belong to. + * @return an array of the categories of all arches in this panel */ public String[] getListCategoryArray() { final String[] catList = new String[archList.size()]; @@ -231,7 +231,6 @@ for (PanelEntry p : archList) { if (index >= 0) { if (index == 0) { - // this.model.addElement(this.list.substring(offset,offset+5) + " I:"+this.list.substring(offset+5,offset+10) ); model.addElement(p.getName()); } else { if (index == p.getIndex()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 10:33:45
|
Revision: 948 http://svn.sourceforge.net/gridarta/?rev=948&view=rev Author: akirschbaum Date: 2006-12-07 02:33:45 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Unify MapPropertiesDialog. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapArchObject.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/map/MapModel.java trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java trunk/daimonin/src/daieditor/map/MapArchObject.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-07 10:33:45 UTC (rev 948) @@ -1148,21 +1148,6 @@ new COptionDialog(this, mainView); } - /** - * Sets the properties of the given level. - * @param level map control - * @param archText map text - * @param loreText lore text - * @param strMapTitle map name - * @param mapSize size of map - */ - public void setLevelProperties(final MapControl level, final String archText, final String loreText, final String strMapTitle, final Size2D mapSize) { - if (level != null) { - level.setProperties(archText, loreText, strMapTitle, mapSize); - refreshMenusAndToolbars(); - } - } - void setLockAllPickmaps(final boolean state) { pickmapsLocked = state; } Modified: trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2006-12-07 10:33:45 UTC (rev 948) @@ -427,10 +427,15 @@ } // now that all is well, write the new values into the maparch - mainControl.setLevelProperties(mapControl, mapDescription.getText(), mapLore.getText(), mapName.getText(), mapSize); final MapArchObject map = mapControl.getMapArch(); + final String mapNameString = mapName.getText(); + mapControl.getMapModel().resizeMap(mapSize); + map.setText(mapDescription.getText()); + map.setLore(mapLore.getText()); + map.setMapName(mapNameString.trim()); // trim, this string might come from the UI + map.setMapRegion(region); map.setEnterX(enterX); map.setEnterY(enterY); @@ -465,10 +470,8 @@ map.setTilePath(i, fieldTilePath[i].getText()); } - // refresh menus if tilepaths have been modified - if (modifyTilepaths) { - mainControl.refreshMenus(); - } + mainControl.refreshMenusAndToolbars(); + mapControl.notifyViews(); // set flag that map has changed mapControl.setLevelChangedFlag(); Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 10:33:45 UTC (rev 948) @@ -94,12 +94,6 @@ } /** {@inheritDoc} */ - public void setNewMapText(final String str) { - getMapArchObject().resetText(); - getMapArchObject().addText(str); - } - - /** {@inheritDoc} */ public String getMapText() { return getMapArchObject().getText(); } Modified: trunk/crossfire/src/cfeditor/map/MapArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-12-07 10:33:45 UTC (rev 948) @@ -293,8 +293,8 @@ } /** - * Set 'text' = maptext. - * @param text string to set + * Set map text. + * @param text the new map text */ public void setText(final String text) { msgText.delete(0, msgText.length()); Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-07 10:33:45 UTC (rev 948) @@ -255,29 +255,6 @@ } /** - * Set the properties (name, maptext and size) of this map. - * @param archText map text - * @param loreText lore text - * @param strMapTitle map name - * @param newSize size of map - */ - public void setProperties(final String archText, final String loreText, String strMapTitle, final Size2D newSize) { - // resize this map - if (!newSize.equals(getMapSize())) { - resizeMap(newSize); - } - - setNewMapText(archText); // change map text - setNewLoreText(loreText); // change lore text - - // change map name (does not change the filename anymore) - strMapTitle = strMapTitle.trim(); - setMapName(strMapTitle); - - notifyViews(); // update - } - - /** * Repaints the view. */ public void repaint() { @@ -287,7 +264,7 @@ /** * Notifies the view that data has changed in the model. */ - void notifyViews() { + public void notifyViews() { mapViewFrame.refreshDataFromModel(); } @@ -398,14 +375,6 @@ mapModel.setFileName(fname); } - public void setNewMapText(final String str) { - mapModel.setNewMapText(str); - } - - public void setNewLoreText(final String str) { - mapModel.getMapArchObject().setLore(str); - } - public void setLevelChangedFlag() { mapModel.setLevelChangedFlag(); } Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-07 10:33:45 UTC (rev 948) @@ -106,12 +106,6 @@ String getMapText(); /** - * Update the map description text. - * @param str the new description text - */ - void setNewMapText(String str); - - /** * Notify that the level is about to be closed. */ void levelCloseNotify(); Modified: trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2006-12-07 10:33:45 UTC (rev 948) @@ -438,8 +438,7 @@ final String mapNameString = mapName.getText() + (mapSound.getText().length() > 0 ? '§' + mapSound.getText() + "|0|-1" : ""); mapControl.getMapModel().resizeMap(mapSize); - map.resetText(); - map.addText(mapDescription.getText()); + map.setText(mapDescription.getText()); map.setMapName(mapNameString.trim()); // trim, this string might come from the UI map.setEnterX(enterX); Modified: trunk/daimonin/src/daieditor/map/MapArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapArchObject.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/daimonin/src/daieditor/map/MapArchObject.java 2006-12-07 10:33:45 UTC (rev 948) @@ -239,6 +239,15 @@ msgText.append(text); } + /** + * Set map text. + * @param text the new map text + */ + public void setText(final String text) { + msgText.delete(0, msgText.length()); + msgText.append(text); + } + /** Delete maptext. */ public void resetText() { msgText.delete(0, msgText.length()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 00:45:54
|
Revision: 947 http://svn.sourceforge.net/gridarta/?rev=947&view=rev Author: akirschbaum Date: 2006-12-06 16:45:55 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Unify DefaultMapModel.getExit(). Modified Paths: -------------- trunk/daimonin/src/daieditor/map/DefaultMapModel.java Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-07 00:43:18 UTC (rev 946) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-07 00:45:55 UTC (rev 947) @@ -283,7 +283,7 @@ } for (final GameObject arch : mapGrid[hspot.x][hspot.y]) { if (CFArchTypeList.isExitType(arch)) { - return arch.getHead(); + return arch; } } return null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 00:43:17
|
Revision: 946 http://svn.sourceforge.net/gridarta/?rev=946&view=rev Author: akirschbaum Date: 2006-12-06 16:43:18 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Whitespace change. Modified Paths: -------------- trunk/daimonin/src/daieditor/map/DefaultMapModel.java Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-07 00:41:53 UTC (rev 945) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-07 00:43:18 UTC (rev 946) @@ -239,6 +239,7 @@ mainControl.getArchetypeParser().postParseGameObject(invnew, mapControl.getActiveEditType()); mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), invnew); } + return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 00:41:55
|
Revision: 945 http://svn.sourceforge.net/gridarta/?rev=945&view=rev Author: akirschbaum Date: 2006-12-06 16:41:53 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Rename variable name. Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 00:39:07 UTC (rev 944) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 00:41:53 UTC (rev 945) @@ -268,7 +268,7 @@ } /** {@inheritDoc} */ - public boolean insertArchToMap(GameObject newarch, String archName, final GameObject next, final Point pos, final boolean join) { + public boolean insertArchToMap(GameObject newArch, String archName, final GameObject next, final Point pos, final boolean join) { // map coords must be valid if (!isPointValid(pos)) { return false; @@ -277,20 +277,20 @@ if (next == null || !next.isInContainer()) { // put arch on the map - if (newarch == null || newarch.isArchetype()) { + if (newArch == null || newArch.isArchetype()) { // just make sure we never insert an uninitialized default arch from the stack - if (newarch != null && newarch.isArchetype()) { - archName = newarch.getArchetypeName(); + if (newArch != null && newArch.isArchetype()) { + archName = newArch.getArchetypeName(); } // insert a new instance of the default arch (number 'archName') if (!addArchToMap(archName, pos, true, join, false)) { return false; } } else { - // insert the given 'newarch' (multis not allowed here yet - sorry) - if (!newarch.isMulti()) { - newarch = newarch.createClone(pos.x, pos.y); // create a clone - addGameObjectToMap(newarch, false); // insert it to the map + // insert the given 'newArch' (multis not allowed here yet - sorry) + if (!newArch.isMulti()) { + newArch = newArch.createClone(pos.x, pos.y); // create a clone + addGameObjectToMap(newArch, false); // insert it to the map } else { return false; // tried to insert multi (probably from pickmap) } @@ -310,16 +310,16 @@ } else { // insert the new arch into the inventory of a map arch final GameObject invnew; // new arch to be inserted - if (newarch == null || newarch.isArchetype()) { - if (newarch != null && newarch.isArchetype()) { - archName = newarch.getArchetypeName(); + if (newArch == null || newArch.isArchetype()) { + if (newArch != null && newArch.isArchetype()) { + archName = newArch.getArchetypeName(); } // create a new copy of a default arch invnew = getArchetype(archName).createArch(); } else { // create clone from a pickmap - if (!newarch.isMulti()) { - invnew = newarch.createClone(pos.x, pos.y); + if (!newArch.isMulti()) { + invnew = newArch.createClone(pos.x, pos.y); } else { return false; } Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-07 00:39:07 UTC (rev 944) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-07 00:41:53 UTC (rev 945) @@ -177,7 +177,7 @@ * {@inheritDoc} * @xxx I'm too complex */ - public boolean insertArchToMap(GameObject newarch, String archName, final GameObject next, final Point pos) { + public boolean insertArchToMap(GameObject newArch, String archName, final GameObject next, final Point pos) { // map coords must be valid if (!isPointValid(pos)) { return false; @@ -186,20 +186,20 @@ if (next == null || !next.isInContainer()) { // put arch on the map - if (newarch == null || newarch.isArchetype()) { + if (newArch == null || newArch.isArchetype()) { // just make sure we never insert an uninitialized default arch from the stack - if (newarch != null && newarch.isArchetype()) { - archName = newarch.getArchetypeName(); + if (newArch != null && newArch.isArchetype()) { + archName = newArch.getArchetypeName(); } // insert a new instance of the default arch (number 'archName') if (!addArchToMap(archName, pos, true, false)) { return false; } } else { - // insert the given 'newarch' (multis not allowed here yet - sorry) - if (!newarch.isMulti()) { - newarch = newarch.createClone(pos.x, pos.y); // create a clone - addGameObjectToMap(newarch, false); // insert it to the map + // insert the given 'newArch' (multis not allowed here yet - sorry) + if (!newArch.isMulti()) { + newArch = newArch.createClone(pos.x, pos.y); // create a clone + addGameObjectToMap(newArch, false); // insert it to the map } else { return false; // tried to insert multi (probably from pickmap) } @@ -219,16 +219,16 @@ } else { // insert the new arch into the inventory of a map arch final GameObject invnew; // new arch to be inserted - if (newarch == null || newarch.isArchetype()) { - if (newarch != null && newarch.isArchetype()) { - archName = newarch.getArchetypeName(); + if (newArch == null || newArch.isArchetype()) { + if (newArch != null && newArch.isArchetype()) { + archName = newArch.getArchetypeName(); } // create a new copy of a default arch invnew = getArchetype(archName).createArch(); } else { // create clone from a pickmap - if (!newarch.isMulti()) { - invnew = newarch.createClone(pos.x, pos.y); + if (!newArch.isMulti()) { + invnew = newArch.createClone(pos.x, pos.y); } else { return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 00:39:09
|
Revision: 944 http://svn.sourceforge.net/gridarta/?rev=944&view=rev Author: akirschbaum Date: 2006-12-06 16:39:07 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Unify safety check. Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 00:36:58 UTC (rev 943) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 00:39:07 UTC (rev 944) @@ -212,7 +212,7 @@ /** {@inheritDoc} */ public boolean addArchToMap(String archName, final Point pos, final boolean allowDouble, final boolean join, final boolean insertBelow) { - if (archName == null || !isPointValid(pos)) { + if (archName == null || archName.length() == 0 || !isPointValid(pos)) { return false; } if (!isMultiArchFittingToMap(archName, pos, allowDouble)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 00:36:58
|
Revision: 943 http://svn.sourceforge.net/gridarta/?rev=943&view=rev Author: akirschbaum Date: 2006-12-06 16:36:58 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Move javadoc comments from implementation to interface. Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapModel.java Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 00:20:15 UTC (rev 942) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 00:36:58 UTC (rev 943) @@ -82,10 +82,7 @@ addObjectListToMap(objects); // init mapArchObject and (when not new map) the arch list } - /** - * Return the position of the displayed object in the map-tile panel. - * @return the position to show - */ + /** {@inheritDoc} */ @Nullable public Point getMouseRightPos() { final Point pos = mapControl.getMapViewFrame().getMapMouseRightPos(); @@ -96,26 +93,18 @@ return pos; } - /** - * Update the map description text. - * @param str the new description text - */ + /** {@inheritDoc} */ public void setNewMapText(final String str) { getMapArchObject().resetText(); getMapArchObject().addText(str); } - /** - * Return the map description text. - * @return the map description text - */ + /** {@inheritDoc} */ public String getMapText() { return getMapArchObject().getText(); } - /** - * Notify that the level is about to be closed. - */ + /** {@inheritDoc} */ public void levelCloseNotify() { } @@ -187,7 +176,7 @@ return mapGrid[pos.x][pos.y].getLast(); } - /** Check whether a given location contains at least one GameObject. */ + /** {@inheritDoc} */ public boolean containsArchObject(final Point pos) { return isPointValid(pos) && !mapGrid[pos.x][pos.y].isEmpty(); } @@ -221,19 +210,7 @@ return true; } - /** - * Add a new arch to the map. Including multi tile arches. This function - * allows only to choose from the default arches (->archName). - * @param archName Name of a default arch on the ArchetypeSet - * @param pos insert-location on this map - * @param allowDouble if set, only one arch of the same kind can be - * inserted per square - * @param join if set to JOIN_ENABLE auto-joining is supported; autojoining - * is only done if enabled in the main control - * @param insertBelow true: new arch is inserted on top, false: new arch is - * inserted below - * @return true if insertion successful, false if not - */ + /** {@inheritDoc} */ public boolean addArchToMap(String archName, final Point pos, final boolean allowDouble, final boolean join, final boolean insertBelow) { if (archName == null || !isPointValid(pos)) { return false; @@ -290,24 +267,7 @@ return true; } - /** - * Insert a new arch to the map at a specified position. This function - * allows either to choose from the default arches (->archName) or to insert - * a copy from an existing arch (->newarch). It also works for - * container-inventory. - * @param newarch A clone copy of this GameObject gets inserted to the map. - * It can be an arch directly from a pickmap or even a - * default arch. if ('newarch'==null) the default arch of - * number 'archName' gets inserted - * @param archName Name of a default arch to get inserted. This value gets - * used ONLY when 'newarch' is null - * @param next the new arch gets inserted before 'next' if - * ('next'==null) the arch gets inserted at bottom - * -> 'next' must be an arch from the map! (or null) - * @param pos map position to insert the new arch - * @param join if set to JOIN_ENABLE auto-joining is supported - * @return true if insertion was successful - */ + /** {@inheritDoc} */ public boolean insertArchToMap(GameObject newarch, String archName, final GameObject next, final Point pos, final boolean join) { // map coords must be valid if (!isPointValid(pos)) { @@ -412,12 +372,7 @@ } } - /** - * Get the arch from the map with the specified 'id', at location pos. - * @param pos Location of GameObject - * @param id ID number of arch (-> <code>arch.getMyID()</code>) - * @return the specified arch, or null if not found - */ + /** {@inheritDoc} */ @Nullable public GameObject getMapArch(final int id, final Point pos) { if (mapGrid == null || !isPointValid(pos)) { return null; @@ -458,16 +413,7 @@ return null; } - /** - * Delete an existing arch from the map. (If the specified arch doesn't - * exist, nothing happens.) (This includes deletion of multiparts and - * inventory.) - * @param id ID of the arch to be removed (->arch.getMyID()) - * @param pos location of the arch to be removed - * @param refreshMap If true, mapview is redrawn after deletion. Keep in - * mind: drawing consumes time! - * @param join if set to JOIN_ENABLE auto-joining is supported - */ + /** {@inheritDoc} */ public void deleteMapArch(final int id, final Point pos, final boolean refreshMap, final boolean join) { // first, try to find the tile we had selected for (final GameObject node : getMapSquare(pos)) { @@ -509,34 +455,22 @@ node.remove(); } - /** - * Update the map filename. - * @param strFileName the new map filename - */ + /** {@inheritDoc} */ public void setFileName(final String strFileName) { getMapArchObject().setFileName(strFileName); } - /** - * Get the map filename. - * @return the map filename - */ + /** {@inheritDoc} */ public String getFileName() { return getMapArchObject().getFileName(); } - /** - * Update the map name as seen by the player. - * @param name the new map name - */ + /** {@inheritDoc} */ public void setMapName(final String name) { getMapArchObject().setMapName(name); } - /** - * Get the map name as seen by the player. - * @return the map name - */ + /** {@inheritDoc} */ public String getMapName() { return getMapArchObject().getMapDisplayName(); } Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-07 00:20:15 UTC (rev 942) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-07 00:36:58 UTC (rev 943) @@ -17,6 +17,10 @@ /** Disable autojoin when inserting objects. */ boolean JOIN_DISABLE = false; + /** + * Return the position of the displayed object in the map-tile panel. + * @return the position to show + */ @Nullable Point getMouseRightPos(); /** @@ -31,12 +35,59 @@ */ boolean isMultiArchFittingToMap(String archname, Point pos, boolean allowDouble); - boolean addArchToMap(String archname, Point pos, boolean allowDouble, boolean join, boolean insertBelow); + /** + * Add a new arch to the map. Including multi tile arches. This function + * allows only to choose from the default arches (->archName). + * @param archName Name of a default arch on the ArchetypeSet + * @param pos insert-location on this map + * @param allowDouble if set, only one arch of the same kind can be + * inserted per square + * @param join if set to JOIN_ENABLE auto-joining is supported; autojoining + * is only done if enabled in the main control + * @param insertBelow true: new arch is inserted on top, false: new arch is + * inserted below + * @return true if insertion successful, false if not + */ + boolean addArchToMap(String archName, Point pos, boolean allowDouble, boolean join, boolean insertBelow); + /** + * Insert a new arch to the map at a specified position. This function + * allows either to choose from the default arches (->archName) or to insert + * a copy from an existing arch (->newarch). It also works for + * container-inventory. + * @param newarch A clone copy of this GameObject gets inserted to the map. + * It can be an arch directly from a pickmap or even a + * default arch. if ('newarch'==null) the default arch of + * number 'archName' gets inserted + * @param archName Name of a default arch to get inserted. This value gets + * used ONLY when 'newarch' is null + * @param next the new arch gets inserted before 'next' if + * ('next'==null) the arch gets inserted at bottom + * -> 'next' must be an arch from the map! (or null) + * @param pos map position to insert the new arch + * @param join if set to JOIN_ENABLE auto-joining is supported + * @return true if insertion was successful + */ boolean insertArchToMap(GameObject newarch, String archname, GameObject next, Point pos, boolean join); + /** + * Delete an existing arch from the map. (If the specified arch doesn't + * exist, nothing happens.) (This includes deletion of multiparts and + * inventory.) + * @param id ID of the arch to be removed (->arch.getMyID()) + * @param pos location of the arch to be removed + * @param refreshMap If true, mapview is redrawn after deletion. Keep in + * mind: drawing consumes time! + * @param join if set to JOIN_ENABLE auto-joining is supported + */ void deleteMapArch(int id, Point pos, boolean refreshMap, boolean join); + /** + * Get the arch from the map with the specified 'id', at location pos. + * @param pos Location of GameObject + * @param id ID number of arch (-> <code>arch.getMyID()</code>) + * @return the specified arch, or null if not found + */ @Nullable GameObject getMapArch(int id, Point pos); /** @@ -48,20 +99,50 @@ */ @Nullable GameObject getExit(@Nullable Point hspot); + /** + * Return the map description text. + * @return the map description text + */ String getMapText(); + /** + * Update the map description text. + * @param str the new description text + */ void setNewMapText(String str); + /** + * Notify that the level is about to be closed. + */ void levelCloseNotify(); + /** + * Check whether a given location contains at least one GameObject. + */ boolean containsArchObject(Point pos); + /** + * Get the map name as seen by the player. + * @return the map name + */ String getMapName(); + /** + * Update the map name as seen by the player. + * @param name the new map name + */ void setMapName(String name); + /** + * Get the map filename. + * @return the map filename + */ String getFileName(); + /** + * Update the map filename. + * @param strFileName the new map filename + */ void setFileName(String strFileName); /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 00:20:15
|
Revision: 942 http://svn.sourceforge.net/gridarta/?rev=942&view=rev Author: akirschbaum Date: 2006-12-06 16:20:15 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Unify comments and whitespace. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/daimonin/src/daieditor/CMapArchPanel.java Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-07 00:04:16 UTC (rev 941) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-07 00:20:15 UTC (rev 942) @@ -182,10 +182,7 @@ panelDesktop = new JTabbedPane(JTabbedPane.TOP); mapArchPanel.setLayout(new BorderLayout()); - splitPane = new GSplitPane( - GSplitPane.HORIZONTAL_SPLIT, - scrollPane3, - scrollPane2); + splitPane = new GSplitPane(GSplitPane.HORIZONTAL_SPLIT, scrollPane3, scrollPane2); final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(0, 1)); @@ -216,7 +213,6 @@ gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.NORTHWEST; - //panelDesktop.add(scrollArchPane, "Arch"); // and add it to this panel object*/ setupArchPanel(); setupTextPanel(); setupScriptPanel(); @@ -233,8 +229,7 @@ // calculate default value in case there is no settings file final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - final int divLocation = Integer.parseInt(settings.getProperty( - MAPARCHPANEL_LOCATION_KEY, "" + (int) (0.49 * screen.getWidth()))); + final int divLocation = Integer.parseInt(settings.getProperty(MAPARCHPANEL_LOCATION_KEY, "" + (int) (0.49 * screen.getWidth()))); splitPane.setDividerLocation(divLocation); splitPane.setDividerSize(5); @@ -303,7 +298,7 @@ return; } - // If the active arch is part of a multi, the mutli-head's stats + // If the active gameObject is part of a multi, the mutli-head's stats // are taken instead: final GameObject gameObject = activeArch.getHead(); @@ -323,16 +318,16 @@ if (archNameField.getText().compareTo(archetype.getObjName()) == 0) { gameObject.setObjName(null); // yes, we don't need it in map } else { - gameObject.setObjName(archNameField.getText()); // overrule in map arch + gameObject.setObjName(archNameField.getText()); // overrule in map gameObject } } else if (archNameField.getText().compareTo(gameObject.getArchetypeName()) == 0) { gameObject.setObjName(null); } else { // def is null, something is in panel, so we set it - gameObject.setObjName(archNameField.getText()); // overrule in map arch + gameObject.setObjName(archNameField.getText()); // overrule in map gameObject } } else { - gameObject.setObjName(null); // nothing in, nothing in map arch - // hm, there is no way yet to overrule a default arch name with "nothing" + gameObject.setObjName(null); // nothing in, nothing in map gameObject + // hm, there is no way yet to overrule a default gameObject name with "nothing" // like <name > ore <name "">..?? } @@ -409,7 +404,7 @@ } // read from archEdit (bottom right textwin) only the attributes - // that differ from the default arch. These get stored into + // that differ from the default gameObject. These get stored into // the arche's archText (and finally in the map). gameObject.setObjectText(archetype.diffArchText(archEdit.getText(), false)); @@ -456,7 +451,7 @@ private void setupArchPanel() { final GridBagLayout gridbag = new GridBagLayout(); final GridBagConstraints gbc = new GridBagConstraints(); - //archPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); + archPanel.setLayout(gridbag); gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; @@ -591,8 +586,7 @@ aPath.setEnabled(false); aRemove.setEnabled(false); - grid.setPreferredSize(new Dimension((int) (Math.max(aModify.getMinimumSize().getWidth() * 2, - aNew.getMinimumSize().getWidth() * 2)), 40)); + grid.setPreferredSize(new Dimension((int) (Math.max(aModify.getMinimumSize().getWidth() * 2, aNew.getMinimumSize().getWidth() * 2)), 40)); scriptPanel.add(ssa); scriptPanel.add(grid); @@ -627,7 +621,6 @@ */ public void setMapArchPanelObject(final GameObject activeGameObject) { selectedObject = activeGameObject; - // archObjNameText.setText("<html><font color=black>Name:</font></html>"); // reset panel archNameField.setText(""); archTypeText.setText("Type:"); @@ -655,7 +648,7 @@ return; } - // If the active arch is part of a multi, the mutli-head's stats + // If the active gameObject is part of a multi, the mutli-head's stats // are displayed (Only the head can store information!). final GameObject gameObject = activeGameObject.getHead(); @@ -693,7 +686,7 @@ if (gameObject.getObjName() == null && gameObject.getArchetypeName() != null) { archNameField.setForeground(Color.black); if (gameObject.getArchetype().getObjName() == null) { - // arch name + // gameObject name if (gameObject.getArchetypeName() != null) { archNameField.setText(gameObject.getArchetypeName()); } else { @@ -747,7 +740,7 @@ archTileText.setText("Tile: single"); } - // drawing the arch's attributes in the text field (archEdit) at the bottom right + // drawing the gameObject's attributes in the text field (archEdit) at the bottom right archEdit.setEnabled(true); final Style currentAttributes = archEdit.getStyle(StyleContext.DEFAULT_STYLE); try { Modified: trunk/daimonin/src/daieditor/CMapArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-12-07 00:04:16 UTC (rev 941) +++ trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-12-07 00:20:15 UTC (rev 942) @@ -165,7 +165,6 @@ /** Arch name field. */ private final JTextField archNameField = new JTextField(14); - // private JLabel archInvCount = new JLabel(); private final JLabel archMapPos = new JLabel(); private final JLabel archFaceText = new JLabel(); @@ -174,7 +173,6 @@ private final JLabel archAnimText = new JLabel(); - // private JLabel archTileText = new JLabel(); private final JPanel mapArchPanel = new JPanel(); private final Action aSubmitChange = ACTION_FACTORY.createAction(false, "mapArchApply", this); @@ -212,7 +210,6 @@ mapArchPanel.setLayout(new BorderLayout()); splitPane = new GSplitPane(HORIZONTAL_SPLIT, mapArchPanel, scrollPane2); - final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(0, 1)); @@ -474,12 +471,11 @@ } - /** set up the arch panel entry of the lower window */ + /** Set up the arch panel entry of the lower window. */ private void setupArchPanel() { final GridBagLayout gridbag = new GridBagLayout(); final GridBagConstraints gbc = new GridBagConstraints(); - //archPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); archPanel.setLayout(gridbag); gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; @@ -651,7 +647,7 @@ directionButtons[direction] = button; } - /** set up the text panel entry of the lower window */ + /** Set up the text panel entry of the lower window. */ private void setupTextPanel() { textPanel = new JPanel(); // new panel @@ -668,7 +664,7 @@ textPanel.add(sta); } - /** set up the script panel tab */ + /** Set up the script panel tab. */ private JPanel createScriptPanel() { eventList = new JList(); @@ -730,12 +726,10 @@ } /** - * update the map arch panel to display the custom font + * Update the map arch panel to display the custom font. * @param refresh if true, the window is redrawn after setting the fonts */ public void updateFont(final boolean refresh) { - - archMapPos.setForeground(black); archTypeText.setForeground(black); archFaceText.setForeground(black); @@ -749,8 +743,8 @@ } /** - * If an arch is selected, the MapArchPanels - * (bottom right windows) get updated. + * If an arch is selected, the MapArchPanels (bottom right windows) get + * updated. * @param activeGameObject the selected arch */ void setMapArchPanelObject(final GameObject activeGameObject) { @@ -959,11 +953,6 @@ archEdit.setEnabled(true); final Style currentAttributes = archEdit.getStyle(StyleContext.DEFAULT_STYLE); try { - //if (mainControl.getFont() != null) { - // StyleConstants.setFontFamily(currentAttributes, mainControl.getFont().getFamily()); - // StyleConstants.setFontSize(currentAttributes, mainControl.getFont().getSize()); - //} - // blue: the "special" attributes, differ from the default archetype StyleConstants.setForeground(currentAttributes, blue); if (gameObject.getObjectText() != null) { @@ -1006,6 +995,7 @@ * script"/"path"/"remove" button from the script panel. If there is a * valid selection in the event list, the appropriate action for this * script is triggered. + * @param task Script type to edit (?). */ public void editScriptWanted(final int task) { GameObject gameObject = mainControl.getMainView().getMapTileSelection(); // get selected gameObject @@ -1039,11 +1029,11 @@ } /** - * Set enable/disable states for the four buttons in the script panel - * @param newButton - * @param modifyButton - * @param pathButton - * @param removeButton + * Set enable/disable states for the four buttons in the script panel. + * @param newButton Enabled state for the "new" button. + * @param modifyButton Enabled state for the "modify" button. + * @param pathButton Enabled state for the "path" button. + * @param removeButton Enabled state for the "remove" button. */ public void setScriptPanelButtonState(final boolean newButton, final boolean modifyButton, final boolean pathButton, final boolean removeButton) { aNew.setEnabled(newButton); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 00:04:16
|
Revision: 941 http://svn.sourceforge.net/gridarta/?rev=941&view=rev Author: akirschbaum Date: 2006-12-06 16:04:16 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Rename variable names. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapArchPanel.java Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-06 23:49:41 UTC (rev 940) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-07 00:04:16 UTC (rev 941) @@ -108,7 +108,7 @@ private final JTabbedPane panelDesktop; - private final Document doc; + private final Document document; private final JScrollPane scrollArchPane = new JScrollPane(); @@ -148,13 +148,13 @@ private final JButton attrWin; // stuff for scripting tab - private JButton s_new; + private JButton aNew; - private JButton s_path; + private JButton aPath; - private JButton s_modify; + private JButton aModify; - private JButton s_remove; + private JButton aRemove; private JList eventList; @@ -211,10 +211,10 @@ // depending on the arch typ selected archPanel = new JPanel(); final GridBagLayout gridbag = new GridBagLayout(); - final GridBagConstraints c = new GridBagConstraints(); + final GridBagConstraints gbc = new GridBagConstraints(); archPanel.setLayout(gridbag); - c.fill = GridBagConstraints.BOTH; - c.anchor = GridBagConstraints.NORTHWEST; + gbc.fill = GridBagConstraints.BOTH; + gbc.anchor = GridBagConstraints.NORTHWEST; //panelDesktop.add(scrollArchPane, "Arch"); // and add it to this panel object*/ setupArchPanel(); @@ -240,7 +240,7 @@ splitPane.setDividerSize(5); add(splitPane, BorderLayout.CENTER); - doc = archEdit.getDocument(); + document = archEdit.getDocument(); submitChange.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { @@ -317,7 +317,7 @@ // We update all panels: name, face, msg and archText (more to come...) // the obj name: - if (testForText(archNameField.getText())) { // there is something in + if (isNonwhitespaceText(archNameField.getText())) { // there is something in // if this equal the default name... if (archetype.getObjName() != null) { if (archNameField.getText().compareTo(archetype.getObjName()) == 0) { @@ -337,7 +337,7 @@ } // set face - if (testForText(archFaceField.getText())) { // there is something in + if (isNonwhitespaceText(archFaceField.getText())) { // there is something in // check if we need a map redraw if (archetype.getFaceName() != null) { final String facename; @@ -384,19 +384,18 @@ // the msg TEXT!! ("msg ... endmsg") // if there is an entry in the archTextArea (msg window), this // overrules the default text (if any) - if (testForText(archTextArea.getText())) { // there is something in the msg win + if (isNonwhitespaceText(archTextArea.getText())) { // there is something in the msg win if (archetype.getMsgText() != null) { // trim text from message window - String newMsgtext = archTextArea.getText(); - if (newMsgtext != null) { - newMsgtext = newMsgtext.trim(); + String newMsgText = archTextArea.getText(); + if (newMsgText != null) { + newMsgText = newMsgText.trim(); } - - if (newMsgtext.equals(archetype.getMsgText().trim())) { + if (newMsgText.equals(archetype.getMsgText().trim())) { gameObject.deleteMsgText(); // yes, we don't need it in map } else { gameObject.resetMsgText(); - gameObject.addMsgText(newMsgtext); + gameObject.addMsgText(newMsgText); } } else { gameObject.resetMsgText(); @@ -443,7 +442,7 @@ // simple "white space test, to eliminate ' ' // perhaps we should include here a real white space test - public boolean testForText(final String text) { + public boolean isNonwhitespaceText(final String text) { for (int i = 0; i < text.length(); i++) { if (text.charAt(i) != ' ') { return true; @@ -456,56 +455,56 @@ /** Set up the arch panel entry of the lower window. */ private void setupArchPanel() { final GridBagLayout gridbag = new GridBagLayout(); - final GridBagConstraints c = new GridBagConstraints(); + final GridBagConstraints gbc = new GridBagConstraints(); //archPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); archPanel.setLayout(gridbag); - c.fill = GridBagConstraints.BOTH; - c.weightx = 1.0; - c.weighty = 0; - c.anchor = GridBagConstraints.NORTHWEST; - c.insets = new Insets(5, 5, 0, 0); + gbc.fill = GridBagConstraints.BOTH; + gbc.weightx = 1.0; + gbc.weighty = 0; + gbc.anchor = GridBagConstraints.NORTHWEST; + gbc.insets = new Insets(5, 5, 0, 0); // add our elements archInvCount = new JLabel(""); - c.gridx = 1; - c.gridy = 0; - c.gridwidth = 1; - gridbag.setConstraints(archInvCount, c); + gbc.gridx = 1; + gbc.gridy = 0; + gbc.gridwidth = 1; + gridbag.setConstraints(archInvCount, gbc); archPanel.add(archInvCount); archNameField.setText(""); archNameField.setForeground(Color.blue); - c.gridx = 0; - c.gridy = 0; - c.gridwidth = 1; - gridbag.setConstraints(archNameField, c); + gbc.gridx = 0; + gbc.gridy = 0; + gbc.gridwidth = 1; + gridbag.setConstraints(archNameField, gbc); archPanel.add(archNameField); archMapPos = new JLabel(""); - c.gridx = 1; - c.gridy = 1; - c.gridwidth = 1; - gridbag.setConstraints(archMapPos, c); + gbc.gridx = 1; + gbc.gridy = 1; + gbc.gridwidth = 1; + gridbag.setConstraints(archMapPos, gbc); archPanel.add(archMapPos); archFaceField.setText(""); archFaceField.setForeground(Color.blue); - c.gridx = 0; - c.gridy = 1; - c.gridwidth = 1; - gridbag.setConstraints(archFaceField, c); + gbc.gridx = 0; + gbc.gridy = 1; + gbc.gridwidth = 1; + gridbag.setConstraints(archFaceField, gbc); archPanel.add(archFaceField); archTypeText.setText(""); - c.gridx = 0; - c.gridy = 2; - gridbag.setConstraints(archTypeText, c); + gbc.gridx = 0; + gbc.gridy = 2; + gridbag.setConstraints(archTypeText, gbc); archPanel.add(archTypeText); archTileText.setText(""); - c.gridx = 1; - c.gridy = 2; - gridbag.setConstraints(archTileText, c); + gbc.gridx = 1; + gbc.gridy = 2; + gridbag.setConstraints(archTileText, gbc); archPanel.add(archTileText); } @@ -550,50 +549,50 @@ // create buttons final JPanel grid = new JPanel(new GridLayout(2, 2)); - s_new = new JButton("Create New"); - s_new.setMargin(new Insets(3, 3, 3, 3)); - s_new.addActionListener(new ActionListener() { + aNew = new JButton("Create New"); + aNew.setMargin(new Insets(3, 3, 3, 3)); + aNew.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { addNewScriptWanted(); } }); - grid.add(s_new); + grid.add(aNew); - s_path = new JButton("Edit Params"); - s_path.setMargin(new Insets(3, 3, 3, 3)); - s_path.addActionListener(new ActionListener() { + aPath = new JButton("Edit Params"); + aPath.setMargin(new Insets(3, 3, 3, 3)); + aPath.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { editScriptWanted(CMapArchPanel.SCRIPT_EDIT_PATH); } }); - grid.add(s_path); + grid.add(aPath); - s_modify = new JButton("Edit Script"); - s_modify.setMargin(new Insets(3, 3, 3, 3)); - s_modify.addActionListener(new ActionListener() { + aModify = new JButton("Edit Script"); + aModify.setMargin(new Insets(3, 3, 3, 3)); + aModify.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { editScriptWanted(CMapArchPanel.SCRIPT_OPEN); } }); - grid.add(s_modify); + grid.add(aModify); - s_remove = new JButton("Remove"); - s_remove.setMargin(new Insets(3, 3, 3, 3)); - s_remove.addActionListener(new ActionListener() { + aRemove = new JButton("Remove"); + aRemove.setMargin(new Insets(3, 3, 3, 3)); + aRemove.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { editScriptWanted(CMapArchPanel.SCRIPT_REMOVE); } }); - grid.add(s_remove); + grid.add(aRemove); // disable all the buttons in the beginning - s_new.setEnabled(false); - s_modify.setEnabled(false); - s_path.setEnabled(false); - s_remove.setEnabled(false); + aNew.setEnabled(false); + aModify.setEnabled(false); + aPath.setEnabled(false); + aRemove.setEnabled(false); - grid.setPreferredSize(new Dimension((int) (Math.max(s_modify.getMinimumSize().getWidth() * 2, - s_new.getMinimumSize().getWidth() * 2)), 40)); + grid.setPreferredSize(new Dimension((int) (Math.max(aModify.getMinimumSize().getWidth() * 2, + aNew.getMinimumSize().getWidth() * 2)), 40)); scriptPanel.add(ssa); scriptPanel.add(grid); @@ -647,11 +646,11 @@ eventList.setModel(new DefaultListModel()); // clear script event list } - if (s_new != null && s_remove != null) { - s_new.setEnabled(false); - s_modify.setEnabled(false); - s_path.setEnabled(false); - s_remove.setEnabled(false); + if (aNew != null && aRemove != null) { + aNew.setEnabled(false); + aModify.setEnabled(false); + aPath.setEnabled(false); + aRemove.setEnabled(false); } return; } @@ -755,16 +754,16 @@ // blue: the "special" attributes, differ from the default archetype StyleConstants.setForeground(currentAttributes, Color.blue); if (gameObject.getObjectText() != null) { - doc.insertString(doc.getLength(), gameObject.getObjectText(), currentAttributes); + document.insertString(document.getLength(), gameObject.getObjectText(), currentAttributes); } - // doc.insertString(doc.getLength(), "ID#"+arch.getMyID()+ " inv#: "+arch.countInvObjects()+"\n", currentAttributes); + // document.insertString(document.getLength(), "ID#"+gameObject.getMyID()+ " inv#: "+gameObject.countInvObjects()+"\n", currentAttributes); // black: the attributes from the default archetype // that don't exist among the "special" ones StyleConstants.setForeground(currentAttributes, Color.black); if (gameObject.getObjectText() != null && mainControl.getArchetypeSet().getArchetype(gameObject.getArchetypeName()) != null) { - doc.insertString(doc.getLength(), gameObject.diffArchText(mainControl.getArchetypeSet().getArchetype(gameObject.getArchetypeName()).getObjectText(), true), currentAttributes); + document.insertString(document.getLength(), gameObject.diffArchText(mainControl.getArchetypeSet().getArchetype(gameObject.getArchetypeName()).getObjectText(), true), currentAttributes); } } catch (final BadLocationException e) { // TODO @@ -776,17 +775,17 @@ eventList.removeAll(); // clear event list gameObject.addEventsToJList(eventList); // update JList to display all events - s_modify.setEnabled(true); - s_path.setEnabled(true); - s_remove.setEnabled(true); + aModify.setEnabled(true); + aPath.setEnabled(true); + aRemove.setEnabled(true); } else if (eventList.getModel() != null && eventList.getModel().getSize() > 0) { eventList.setModel(new DefaultListModel()); // clear event list - s_modify.setEnabled(false); - s_path.setEnabled(false); - s_remove.setEnabled(false); + aModify.setEnabled(false); + aPath.setEnabled(false); + aRemove.setEnabled(false); } - s_new.setEnabled(true); + aNew.setEnabled(true); } /** @@ -832,10 +831,10 @@ * @param removeButton Enabled state for the "remove" button. */ public void setScriptPanelButtonState(final boolean newButton, final boolean modifyButton, final boolean pathButton, final boolean removeButton) { - s_new.setEnabled(newButton); - s_modify.setEnabled(modifyButton); - s_path.setEnabled(pathButton); - s_remove.setEnabled(removeButton); + aNew.setEnabled(newButton); + aModify.setEnabled(modifyButton); + aPath.setEnabled(pathButton); + aRemove.setEnabled(removeButton); } } // class CMapArchPanel This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-06 23:49:41
|
Revision: 940 http://svn.sourceforge.net/gridarta/?rev=940&view=rev Author: akirschbaum Date: 2006-12-06 15:49:41 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Unify comments. Modified Paths: -------------- trunk/daimonin/src/daieditor/CMapArchPanel.java Modified: trunk/daimonin/src/daieditor/CMapArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-12-06 23:45:54 UTC (rev 939) +++ trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-12-06 23:49:41 UTC (rev 940) @@ -145,10 +145,10 @@ private final Document document; - /** panel with name/face etc */ + /** Panel with name/face etc. */ private final JPanel archPanel; - /** panel with message text */ + /** Panel with message text. */ private JPanel textPanel; private final JPanel animationPanel; @@ -159,10 +159,10 @@ /** The JPanel holding the error information. */ private final ErrorListView errorListView = new ErrorListView(); - /** arch text field */ + /** Arch text field. */ private final JTextArea archTextArea = new JTextArea(4, 25); - /** arch name field */ + /** Arch name field. */ private final JTextField archNameField = new JTextField(14); // private JLabel archInvCount = new JLabel(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-06 23:45:53
|
Revision: 939 http://svn.sourceforge.net/gridarta/?rev=939&view=rev Author: akirschbaum Date: 2006-12-06 15:45:54 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Whitespace change. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapArchPanel.java Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-06 23:44:52 UTC (rev 938) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-06 23:45:54 UTC (rev 939) @@ -93,7 +93,6 @@ if (size.width < getParent().getSize().width) { size.width = getParent().getSize().width; } - super.setSize(size); } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-06 23:44:51
|
Revision: 938 http://svn.sourceforge.net/gridarta/?rev=938&view=rev Author: akirschbaum Date: 2006-12-06 15:44:52 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Rename variable name. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapArchPanel.java Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-06 23:42:49 UTC (rev 937) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-06 23:44:52 UTC (rev 938) @@ -89,12 +89,12 @@ } /** {@inheritDoc} */ - @Override public void setSize(final Dimension d) { - if (d.width < getParent().getSize().width) { - d.width = getParent().getSize().width; + @Override public void setSize(final Dimension size) { + if (size.width < getParent().getSize().width) { + size.width = getParent().getSize().width; } - super.setSize(d); + super.setSize(size); } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-06 23:42:48
|
Revision: 937 http://svn.sourceforge.net/gridarta/?rev=937&view=rev Author: akirschbaum Date: 2006-12-06 15:42:49 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Remove method. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CNewMapDialog.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-06 23:37:13 UTC (rev 936) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-06 23:42:49 UTC (rev 937) @@ -616,17 +616,6 @@ * Begins the editing of a new Map. * @param objects the list of map objects, or <code>null</code> for new empty maps * @param maparch map arch - * @param initial the view position to show initially; null=show top left corner - * @return map control of new map - */ - public MapControl newLevel(final List<GameObject> objects, final MapArchObject maparch, final Point initial) { - return newLevel(objects, maparch, true, initial); - } - - /** - * Begins the editing of a new Map. - * @param objects the list of map objects, or <code>null</code> for new empty maps - * @param maparch map arch * @param view Only create a view if this is true * @param initial the view position to show initially; null=show top left corner * @return map control of new map Modified: trunk/crossfire/src/cfeditor/CNewMapDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-12-06 23:37:13 UTC (rev 936) +++ trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-12-06 23:42:49 UTC (rev 937) @@ -255,7 +255,7 @@ today.get(Calendar.DAY_OF_MONTH) + "/" + today.get(Calendar.YEAR)); if (mapType == MapType.GAMEMAP) { - mainControl.newLevel(null, maparch, null); + mainControl.newLevel(null, maparch, true, null); } else if (mapType == MapType.PICKMAP) { return CPickmapPanel.getInstance().addNewPickmap(parent, maparch); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-06 23:37:14
|
Revision: 936 http://svn.sourceforge.net/gridarta/?rev=936&view=rev Author: akirschbaum Date: 2006-12-06 15:37:13 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Remove unused function. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-06 23:32:45 UTC (rev 935) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-06 23:37:13 UTC (rev 936) @@ -535,10 +535,6 @@ return archetypeSet.getFace(i); } - public String getFaceName(final int i) { - return archetypeSet.getFaceName(i); - } - public void setStatusText(final String string) { mainView.setStatusText(string); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-06 23:33:07
|
Revision: 935 http://svn.sourceforge.net/gridarta/?rev=935&view=rev Author: akirschbaum Date: 2006-12-06 15:32:45 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Remove unused function. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-06 23:19:59 UTC (rev 934) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-06 23:32:45 UTC (rev 935) @@ -484,10 +484,6 @@ mainView.showArchPanelQuickObject(gameObject); } - boolean addArchToMap(final String archname, final Point pos, final boolean allowDouble, final boolean join) { - return currentMap.addArchToMap(archname, pos, allowDouble, join); - } - boolean insertArchToMap(final GameObject newarch, final String archname, final GameObject next, final Point pos, final boolean join) { return currentMap.insertArchToMap(newarch, archname, next, pos, join); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |