From: <aki...@us...> - 2006-12-03 16:18:41
|
Revision: 823 http://svn.sourceforge.net/gridarta/?rev=823&view=rev Author: akirschbaum Date: 2006-12-03 08:18:27 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Make fields private. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanel.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-12-03 16:15:01 UTC (rev 822) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-12-03 16:18:27 UTC (rev 823) @@ -236,11 +236,11 @@ public static final class PanelNode { - public final CArchPanelPan data; + private final CArchPanelPan data; public PanelNode next; // next node - final String title; // title of this PanelNode + private final String title; // title of this PanelNode public PanelNode(final CArchPanelPan data, final String title) { this.data = data; @@ -252,6 +252,10 @@ return title; } + public CArchPanelPan getData() { + return data; + } + } // class PanelNode } // class CArchPanel Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-03 16:15:01 UTC (rev 822) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-03 16:18:27 UTC (rev 823) @@ -634,8 +634,8 @@ for (CArchPanel.PanelNode node = CArchPanel.getStartPanelNode(); node != null; node = node.next) { - final String[] numList = node.data.getListArchNameArray(); - final String[] catList = node.data.getListCategoryArray(); // list of category strings + final String[] numList = node.getData().getListArchNameArray(); + final String[] catList = node.getData().getListCategoryArray(); // list of category strings // process every arch in this panel for (int i = 0; i < numList.length; i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-03 16:36:47
|
Revision: 824 http://svn.sourceforge.net/gridarta/?rev=824&view=rev Author: akirschbaum Date: 2006-12-03 08:36:47 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Use ArrayList for panel list. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanel.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-12-03 16:18:27 UTC (rev 823) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-12-03 16:36:47 UTC (rev 824) @@ -29,6 +29,8 @@ import java.awt.Component; import java.awt.Dimension; import java.awt.Toolkit; +import java.util.ArrayList; +import java.util.List; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JSplitPane; @@ -71,10 +73,8 @@ private final CArchQuickView archQuickPanel; /** List of arch panels. */ - private static PanelNode panelNodeStart; + private static List<PanelNode> panelNodeList = new ArrayList<PanelNode>(); - private PanelNode panelNodeLast; - /** The active panel. */ private CArchPanelPan selectedPanel; @@ -115,16 +115,8 @@ public void stateChanged(final ChangeEvent e) { final JTabbedPane tabbedPane = (JTabbedPane) e.getSource(); - // This is weird: we need to compare against SelectedComponent, - // and *not* SelectedIndex. The index seemed to get all messed up during - // load proccess, leading to odd behaviour and sometimes wrecked panes. - final Component sel = tabbedPane.getSelectedComponent(); - PanelNode node = panelNodeStart; - while (node != null && node.data.getPanel() != sel) { - node = node.next; - } - - selectedPanel = node.data; + final PanelNode node = panelNodeList.get(tabbedPane.getSelectedIndex()); + selectedPanel = node.getData(); if (selectedPanel != null) { selectedPanel.showArchList(); } @@ -132,8 +124,8 @@ }); } - public static PanelNode getStartPanelNode() { - return panelNodeStart; + public static List<PanelNode> getPanelNodeList() { + return panelNodeList; } /** Move the pickmap panel in front of the default-archpanel. */ @@ -177,14 +169,7 @@ public void addPanel(final String name) { final PanelNode newnode = new PanelNode(new CArchPanelPan(this, mainControl), name); - // chain it to our list of panels - if (panelNodeStart == null) { - panelNodeStart = newnode; - } - if (panelNodeLast != null) { - panelNodeLast.next = newnode; - } - panelNodeLast = newnode; + panelNodeList.add(newnode); // insert new panels in alphabetical order int i; @@ -205,15 +190,15 @@ */ public void finishBuildProccess() { final Component sel = tabDesktop.getSelectedComponent(); - PanelNode node = panelNodeStart; - while (node != null && node.data.getPanel() != sel) { - node = node.next; + for (final PanelNode node : panelNodeList) { + if (node.data.getPanel() == sel) { + if (node.data != null) { + selectedPanel = node.data; + selectedPanel.showArchList(); + } + break; + } } - - if (node != null && node.data != null) { - selectedPanel = node.data; - selectedPanel.showArchList(); - } } void appExitNotify() { @@ -238,14 +223,11 @@ private final CArchPanelPan data; - public PanelNode next; // next node - private final String title; // title of this PanelNode public PanelNode(final CArchPanelPan data, final String title) { this.data = data; this.title = title; - next = null; } public String getTitle() { Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-03 16:18:27 UTC (rev 823) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-03 16:36:47 UTC (rev 824) @@ -631,8 +631,7 @@ // loop through all existing ArchPanels and find all arches // along with their display-category Archetype<GameObject> archetype; - for (CArchPanel.PanelNode node = CArchPanel.getStartPanelNode(); - node != null; node = node.next) { + for (final CArchPanel.PanelNode node : CArchPanel.getPanelNodeList()) { final String[] numList = node.getData().getListArchNameArray(); final String[] catList = node.getData().getListCategoryArray(); // list of category strings This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-03 19:54:05
|
Revision: 838 http://svn.sourceforge.net/gridarta/?rev=838&view=rev Author: akirschbaum Date: 2006-12-03 11:53:57 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Remove function used only for Daimonin. 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/MapControl.java trunk/crossfire/src/cfeditor/map/MapModel.java trunk/crossfire/src/cfeditor/parameter/MapParameter.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-03 19:38:37 UTC (rev 837) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-03 19:53:57 UTC (rev 838) @@ -722,7 +722,7 @@ } if (level != null && !forced && level.isLevelChanged()) { - if (askConfirm("Do You Want To Save Changes?", "Do you want to save changes to map " + level.getMapNameWithoutMusic() + "?")) { + if (askConfirm("Do You Want To Save Changes?", "Do you want to save changes to map " + level.getMapName() + "?")) { if (level.isPlainSaveEnabled()) { level.save(); Modified: trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2006-12-03 19:38:37 UTC (rev 837) +++ trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2006-12-03 19:53:57 UTC (rev 838) @@ -139,7 +139,7 @@ */ public MapPropertiesDialog(final CMainControl mainControl, final Frame parentFrame, final MapControl mapControl) { // set title - super(parentFrame, "" + mapControl.getMapNameWithoutMusic() + " - Map Properties"); + super(parentFrame, "" + mapControl.getMapName() + " - Map Properties"); final MapArchObject map = mapControl.getMapModel().getMapArchObject(); // map arch object this.mainControl = mainControl; // main control Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-03 19:38:37 UTC (rev 837) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-03 19:53:57 UTC (rev 838) @@ -570,11 +570,6 @@ return getMapArchObject().getMapDisplayName(); } - /** ??? */ - public String getMapNameWithoutMusic() { - return getMapArchObject().getMapDisplayName(); - } - @Deprecated public boolean isPointValid(final int posx, final int posy) { return isPointValid(new Point(posx, posy)); } Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-03 19:38:37 UTC (rev 837) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-03 19:53:57 UTC (rev 838) @@ -419,11 +419,6 @@ return mapModel.getMapName(); } - /** @return The level name without attached music string */ - public String getMapNameWithoutMusic() { - return mapModel.getMapNameWithoutMusic(); - } - /** * Set the level name. * @param strName the level name Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-03 19:38:37 UTC (rev 837) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-03 19:53:57 UTC (rev 838) @@ -60,8 +60,6 @@ void setMapName(String name); - String getMapNameWithoutMusic(); - String getFileName(); void setFileName(String strFileName); Modified: trunk/crossfire/src/cfeditor/parameter/MapParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/parameter/MapParameter.java 2006-12-03 19:38:37 UTC (rev 837) +++ trunk/crossfire/src/cfeditor/parameter/MapParameter.java 2006-12-03 19:53:57 UTC (rev 838) @@ -74,7 +74,7 @@ super.setValue(null); } else { final MapControl map = (MapControl) value; - super.setValue(map.getMapNameWithoutMusic()); + super.setValue(map.getMapName()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-03 22:12:23
|
Revision: 844 http://svn.sourceforge.net/gridarta/?rev=844&view=rev Author: akirschbaum Date: 2006-12-03 14:12:23 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Simplify access to map properties. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java trunk/crossfire/src/cfeditor/map/MapControl.java Modified: trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2006-12-03 21:49:04 UTC (rev 843) +++ trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2006-12-03 22:12:23 UTC (rev 844) @@ -149,10 +149,10 @@ private MapPropertiesDialog(final CMainControl mainControl, final MapControl mapControl) { okButton.setDefaultCapable(true); setOptions(new Object[]{helpButton, okButton, restoreButton, cancelButton}); - final MapArchObject map = mapControl.getMapModel().getMapArchObject(); // map arch object this.mainControl = mainControl; this.mapControl = mapControl; + final MapArchObject map = mapControl.getMapArch(); final JTabbedPane tabs = new JTabbedPane(); tabs.setBorder(new EmptyBorder(10, 4, 4, 4)); @@ -246,7 +246,7 @@ private JPanel createMapLorePanel(final MapArchObject map) { final JPanel panel = new JPanel(new GridLayout(0, 1)); - mapLore.setText(mapControl.getMapLore()); + mapLore.setText(map.getLore()); mapLore.setCaretPosition(0); panel.add(mapLore); @@ -257,7 +257,7 @@ private JPanel createMapTextPanel(final MapArchObject map) { final JPanel panel = new JPanel(new BorderLayout(1, 1)); - mapDescription.setText(mapControl.getMapText()); + mapDescription.setText(map.getText()); mapDescription.setCaretPosition(0); panel.add(mapDescription); @@ -353,7 +353,6 @@ * <code>false</code> if the parameters were wrong. */ private boolean modifyMapProperties() { - final MapArchObject map = mapControl.getMapModel().getMapArchObject(); // map arch object boolean modifyTilepaths = false; // true when map tile-paths were modified // tmp variables for parsing @@ -430,6 +429,8 @@ mainControl.setLevelProperties(mapControl, mapDescription.getText(), mapLore.getText(), mapName.getText(), size); + final MapArchObject map = mapControl.getMapArch(); + map.setMapRegion(t_region); map.setEnterX(t_enter_x); map.setEnterY(t_enter_y); @@ -539,11 +540,10 @@ /** Reset all map properties to the saved values in the maparch */ private void restoreMapProperties() { - final MapArchObject map = mapControl.getMapModel().getMapArchObject(); // map arch object + final MapArchObject map = mapControl.getMapArch(); - mapControl.getMapModel().getMapArchObject().getText(); - mapDescription.setText(mapControl.getMapText()); - mapLore.setText(mapControl.getMapLore()); + mapDescription.setText(map.getText()); + mapLore.setText(map.getLore()); mapName.setText(mapControl.getMapName()); mapRegion.setText("" + map.getMapRegion()); final Size2D mapSize = map.getMapSize(); Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-03 21:49:04 UTC (rev 843) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-03 22:12:23 UTC (rev 844) @@ -177,16 +177,6 @@ } } - // text of map arch object! - public String getMapText() { - return mapModel.getMapText(); - } - - // text of map arch object! - public String getMapLore() { - return mapModel.getMapArchObject().getLore(); - } - public void levelCloseNotify() { levelClosing = true; mapModel.levelCloseNotify(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-12-03 22:14:59
|
Revision: 847 http://svn.sourceforge.net/gridarta/?rev=847&view=rev Author: christianhujer Date: 2006-12-03 14:14:54 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Fixed some javadoc issues. Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/BshThread.java trunk/crossfire/src/cfeditor/CArchPanel.java trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CAttribDialog.java Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-12-03 22:14:47 UTC (rev 846) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-12-03 22:14:54 UTC (rev 847) @@ -66,7 +66,9 @@ // (0 = no connection, N = north, E = east, S = south, W = west) private String[] archnames; - /** Konstructor */ + /** + * Create an AutojoinList. + */ public AutojoinList() { stack = null; // pointer to stack of default arches next = null; // pointer to next element @@ -290,17 +292,32 @@ return 0; } - /** Checks if the index (=bitmask) contains the following direction */ + /** + * Returns whether the index (=bitmask) contains the specified direction. + * @param index Index / bitmask to check. + * @param direction Direction to check for being contained in the bitmask. + * @return <code>true</code> if the bitmask contains the direction, otherwise <code>false</code>. + */ private boolean hasDir(final int index, final int direction) { return (index & direction) != 0; } - /** add direction to the index */ + /** + * Adds a direction to the index (=bitmask). + * @param index Index / bitmask to add direction to. + * @param direction Direction to add. + * @return Index / bitmask with <var>direction</var> added.. + */ private int addDir(final int index, final int direction) { return index | direction; } - /** remove direction from the index */ + /** + * Removes a direction from an index (=bitmask). + * @param index Index / bitmask to remove direction from. + * @param direction Direction to remove. + * @return Index / bitmask with <var>direction</var> removed. + */ private int removeDir(final int index, final int direction) { return index & ~direction; } @@ -327,13 +344,15 @@ /** * Add/remove a certain connection of the given arch * by changing archtype and face. + * @param gameObject GameObject to connect. + * @param archetypeName Name of the archetype to connect with. */ - private void connectArch(final GameObject gameObject, final String archname) { - final GameObject archetype = stack.getArchetype(archname); // new default arch + private void connectArch(final GameObject gameObject, final String archetypeName) { + final GameObject archetype = stack.getArchetype(archetypeName); // new default arch - if (!gameObject.getArchetypeName().equals(archname)) { + if (!gameObject.getArchetypeName().equals(archetypeName)) { // set new archtype - gameObject.setArchetypeName(archname); + gameObject.setArchetypeName(archetypeName); // set face of new default arch gameObject.setFaceNr(archetype.getFaceNr()); Modified: trunk/crossfire/src/cfeditor/BshThread.java =================================================================== --- trunk/crossfire/src/cfeditor/BshThread.java 2006-12-03 22:14:47 UTC (rev 846) +++ trunk/crossfire/src/cfeditor/BshThread.java 2006-12-03 22:14:54 UTC (rev 847) @@ -11,44 +11,62 @@ import bsh.Interpreter; /** + * A BshThread. + * @todo Document this class. * @author tchize - * <p/> - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments */ public final class BshThread extends Thread { + /** + * The ScriptModel of this BshThread. + */ private CScriptModel script; + /** + * The Interpreter of this BshThread. + */ private Interpreter interpreter; /** - * + * Create a BshThread. */ public BshThread() { } - /** @param name */ + /** + * Create a BshThread with name. + * @param name Name to assign to the BshThread. + */ public BshThread(final String name) { super(name); } /** - * @param group - * @param name + * Create a BshThread with a name in a certain thread group. + * @param group ThreadGroup to put BshThread in. + * @param name Name to assign to the BshThread. */ public BshThread(final ThreadGroup group, final String name) { super(group, name); } + /** + * Sets the interpreter for this BshThread. + * @param interpreter Interpreter for this BshThread. + */ public void setInterpreter(final Interpreter interpreter) { this.interpreter = interpreter; } + /** + * Sets the ScriptModel for this BshThread. + * @param script ScriptModel for this BshThread. + */ public void setScript(final CScriptModel script) { this.script = script; } + /** {@inheritDoc} */ @Override public void run() { try { interpreter.set("scriptThread", this); @@ -62,4 +80,5 @@ e.printStackTrace(); } } -} + +} // class BshThread Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-12-03 22:14:47 UTC (rev 846) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-12-03 22:14:54 UTC (rev 847) @@ -206,7 +206,7 @@ } /** - * Get name of selected Arch + * Get name of selected Arch. * @return Name of selected arch in arch panel */ public String getSelectedArch() { @@ -214,7 +214,7 @@ } /** - * Set selected Arch + * Set selected Arch. * @param selectedArch name of selected arch in arch panel */ public void setSelectedArch(final String selectedArch) { Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-12-03 22:14:47 UTC (rev 846) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-12-03 22:14:54 UTC (rev 847) @@ -189,11 +189,13 @@ } /** - * this is only needed when arche collection is run, so we want - * to know to which categories the arches belong to: + * 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). */ - public String[] getListArchNameArray() { + @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++) { @@ -204,12 +206,14 @@ } /** - * 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> + * 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). */ - public String[] getListCategoryArray() { + @Deprecated public String[] getListCategoryArray() { final String[] catList = new String[(int) (list.length() / 50.0)]; for (int i = 0; i < (int) (list.length() / 50.0); i++) { Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-03 22:14:47 UTC (rev 846) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-03 22:14:54 UTC (rev 847) @@ -1458,6 +1458,7 @@ /** * Constructor. + * @param label Name of this Action. * @param newAttr the GUI-bitmask attribute where the change button belongs to */ MaskChangeAL(final String label, final BitmaskAttrib newAttr) { @@ -1496,6 +1497,7 @@ /** * Constructor. * @param attr the GUI-string attribute where the treasurelist button belongs to + * @param dialog Parent component to show on. */ ViewTreasurelistAL(final DialogAttrib<JTextField> attr, final CAttribDialog dialog) { super("treasurelist:"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-12-03 22:23:01
|
Revision: 849 http://svn.sourceforge.net/gridarta/?rev=849&view=rev Author: christianhujer Date: 2006-12-03 14:23:01 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Changed treasurelist dialog's parent component to a less specific type. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-03 22:20:03 UTC (rev 848) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-03 22:23:01 UTC (rev 849) @@ -27,7 +27,6 @@ import cfeditor.gameobject.ArchAttribType; import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; -import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; import java.awt.Component; @@ -1490,16 +1489,16 @@ */ private static final class ViewTreasurelistAL extends AbstractAction { - final DialogAttrib<JTextField> strAttr; // attribute structure + private final DialogAttrib<JTextField> strAttr; // attribute structure - final CAttribDialog dialog; // reference to this dialog instance + private final Component dialog; // reference to this dialog instance /** * Constructor. * @param attr the GUI-string attribute where the treasurelist button belongs to * @param dialog Parent component to show on. */ - ViewTreasurelistAL(final DialogAttrib<JTextField> attr, final CAttribDialog dialog) { + private ViewTreasurelistAL(final DialogAttrib<JTextField> attr, final Component dialog) { super("treasurelist:"); strAttr = attr; this.dialog = dialog; Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-03 22:20:03 UTC (rev 848) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-03 22:23:01 UTC (rev 849) @@ -108,8 +108,6 @@ // the textfield in the attribute dialog where the result gets written to private JTextField input; // input textfield - private CAttribDialog parentDialog; // parent attr. dialog window (can be null) - private int tListCount; // number of treasurelists private final boolean isEmpty; // is this tree empty? @@ -125,7 +123,6 @@ isEmpty = true; // three is empty hasBeenDisplayed = false; tListCount = 0; - parentDialog = null; // draw thin blue lines connecting the nodes putClientProperty("JTree.lineStyle", "Angled"); @@ -195,19 +192,6 @@ return instance; } - /** - * @return The parent attribute dialog attached to this dialog. - * If no attribute dialog is attached, or this dialog is hidden, - * null is returned. - */ - @Nullable public static CAttribDialog getParentDialog() { - if (instance != null && instance.frame != null && instance.frame.isShowing()) { - return instance.parentDialog; - } - - return null; - } - /** Hide the Treasurelists window, if not already hidden. */ public static void hideDialog() { if (instance != null && instance.frame != null && instance.frame.isShowing()) { @@ -497,9 +481,8 @@ * When a second window is opened, the first one gets (re-)moved. * @param parent Parent frame (attribute dialog) */ - public synchronized void showDialog(final JTextField input, final CAttribDialog parent) { + public synchronized void showDialog(final JTextField input, final Component parent) { this.input = input; // set textfield for input/output - parentDialog = parent; // set parent attribute dialog (or null if there is none) if (!hasBeenDisplayed) { // open a popup dialog which tmporarily disables all other frames This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-12-03 23:32:32
|
Revision: 855 http://svn.sourceforge.net/gridarta/?rev=855&view=rev Author: christianhujer Date: 2006-12-03 15:32:31 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Fixed javadoc bugs. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFArchAttrib.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CFancyButton.java trunk/crossfire/src/cfeditor/CGUIUtils.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CMainToolbar.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CNewMapDialog.java trunk/crossfire/src/cfeditor/COptionDialog.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/CopyBuffer.java Modified: trunk/crossfire/src/cfeditor/CFArchAttrib.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-12-03 23:32:31 UTC (rev 855) @@ -79,7 +79,9 @@ private String section; // name of the section this attribute is in - /** Constructor */ + /** + * Create a CFArchAttrib. + */ public CFArchAttrib() { nameOld = ""; nameNew = ""; Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-03 23:32:31 UTC (rev 855) @@ -221,6 +221,7 @@ /** * Parse a list vector from an xml list element. * @param root element to parse + * @return List with data parsed from <var>root</var>. */ private List<?> parseListFromElement(final Element root) { final List<Object> list = new ArrayList<Object>(); @@ -247,8 +248,8 @@ } /** - * @return Number of CFArchTypes in the list. - * (Not counting the default type.) + * Returns the number of CFArchTypes in this list (excluding the default type). + * @return The number of CFArchTypes in this list. */ public int getLength() { return length; @@ -617,7 +618,7 @@ return type; } - /** Subclass: FileFilter to accept only known CF spellist files */ + /** FileFilter to accept only known CF spellist files. */ static class SpellFileFilter extends FileFilter { SpellFileFilter() { @@ -631,14 +632,11 @@ return "spellist.h"; } - /** - * Whether the given file is accepted by this filter - * @param f any file - * @return true if the file is accepted as spellist - */ + /** {@inheritDoc} */ @Override public boolean accept(final File f) { return f.isDirectory() || f.getName().equalsIgnoreCase("spellist.h"); } + } // class SpellFileFilter } // class CFArchTypeList Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-12-03 23:32:31 UTC (rev 855) @@ -37,7 +37,6 @@ /** * Main class, launches the level editor application. * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @version $Revision: 1.27 $ */ public final class CFJavaEditor { Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-03 23:32:31 UTC (rev 855) @@ -187,7 +187,10 @@ specialTreasureLists.put("dragon_player_items", playerFolder); } - /** @return static instance of this tree */ + /** + * Retruns the singleton instance of this tree. + * @return The singleton instance of this tree. + */ public static CFTreasureListTree getInstance() { return instance; } @@ -200,9 +203,9 @@ } /** - * Check if a certain treasurelist exists + * Check if a certain treasurelist exists. * @param name Name of a treasurelist - * @return True when the treasurelists with the given name exists + * @return <code>true</code> when the treasurelists with the given name exists, otherwise <code>false</code>. */ public static boolean containsTreasureList(final String name) { return treasureTable.containsKey(name); @@ -371,9 +374,11 @@ } /** - * Read and parse the text inside a treasurelist + * Read and parse the text inside a treasurelist. * @param parentNode parent treenode * @param needLink List containing all sub-treasurelist nodes which need linking + * @param reader Reader to read from. + * @throws IOException in case of I/O problems reading from <var>reader</var>. */ private void readInsideList(final TreasureTreeNode parentNode, final BufferedReader reader, final List<TreasureTreeNode> needLink) throws IOException { String line; // read line of file @@ -480,6 +485,7 @@ * As a side-effect, only one treasurelist window can be open at a time. * When a second window is opened, the first one gets (re-)moved. * @param parent Parent frame (attribute dialog) + * @param input Textfield to show. */ public synchronized void showDialog(final JTextField input, final Component parent) { this.input = input; // set textfield for input/output @@ -642,10 +648,10 @@ } /** - * @return The name of the currently selected treasurelist. - * If nothing is selected, null is returned. - * @throws GridderException when user selected an invalid - * treasurelist (e.g. a god-list) + * Returns the name of the currently selected treasurelist. + * If nothing is selected, <code>null</code> is returned. + * @return The name of the currently selected treasurelist or <code>null</code> if nothing is selected. + * @throws GridderException when user selected an invalid treasurelist (e.g. a god-list) */ @Nullable private String getSelectedTreasureList() throws GridderException { // return null when nothing is selected @@ -692,13 +698,16 @@ private final TreasureObj content; // content object - /** Construct tree node with specified content object */ + /** + * Construct tree node with specified content object. + * @param content Treasure object of this node. + */ public TreasureTreeNode(final TreasureObj content) { this.content = content; } /** - * Construct tree node and content object + * Construct tree node and content object. * @param name name of content object * @param type type of content object (see TreasureObj constants) */ @@ -706,7 +715,10 @@ this.content = new TreasureObj(name, type); } - /** @return a new cloned instance of this object */ + /** + * Returns a new cloned instance of this object. + * @return A new cloned instance of this object. + */ public TreasureTreeNode getClone() { // clone this object final TreasureTreeNode clone = new TreasureTreeNode(this.getTreasureObj()); @@ -792,6 +804,8 @@ /** * Constructor for treasurelist objects. + * @param name Name of this treasure object. + * @param type Type of thsi treasure object. */ public TreasureObj(final String name, final int type) { this.type = type; @@ -805,10 +819,7 @@ hasLoop = false; } - /** - * @return String representation of this treasure object. This is - * what gets displayed on the tree. - */ + /** {@inheritDoc} */ @Override public String toString() { return (nrof == UNSET ? "" : nrof + " ") + name + (type == TREASUREONE_LIST ? " [one]" : "") + (magic == UNSET ? "" : " +" + magic) + (chance == UNSET ? "" : " (" + chance + " %)"); @@ -881,7 +892,9 @@ final ImageIcon noarch; // icon for unknown arches - /** Constructor: Load icons and initialize fonts */ + /** + * Create a TreasureCellRenderer. + */ public TreasureCellRenderer() { // get icons tlistIcon = cfeditor.CGUIUtils.getSysIcon(IGUIConstants.TILE_TREASURE); Modified: trunk/crossfire/src/cfeditor/CFancyButton.java =================================================================== --- trunk/crossfire/src/cfeditor/CFancyButton.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/CFancyButton.java 2006-12-03 23:32:31 UTC (rev 855) @@ -68,7 +68,7 @@ } /** - * Sets the fancy icon (automatically calculates the grayscaled normal icon) + * Sets the fancy icon (automatically calculates the grayscaled normal icon). * @param icon the icon to be used as the rollover icon. */ public void setFancyIcon(final ImageIcon icon) { Modified: trunk/crossfire/src/cfeditor/CGUIUtils.java =================================================================== --- trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-12-03 23:32:31 UTC (rev 855) @@ -54,7 +54,10 @@ private static final Map<String, ImageIcon> imageCache = new HashMap<String, ImageIcon>(); - /** @return the static instance of this class */ + /** + * Returns the singleton instance of this class. + * @return The singleton instance of this class. + */ public static CGUIUtils getInstance() { return staticInstance; } @@ -68,6 +71,7 @@ * @param dirName name of the directory the icon is in * @param strIconName the icon name (propably one of the * constants defined in IGUIConstants). + * @return The image icon for the given icon name. */ private static ImageIcon getResourceIcon(final String dirName, final String strIconName) { // first, look if this icon is already available in the Hashtable Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-03 23:32:31 UTC (rev 855) @@ -130,10 +130,10 @@ /** All open maps. */ private final List<MapControl> levels = new ArrayList<MapControl>(); - /** The current top map we are working with */ + /** The current top map we are working with. */ private MapControl currentMap; - /** The current script controller */ + /** The current script controller. */ private final CScriptController scriptControl; /** The current main directory. */ @@ -200,6 +200,7 @@ /** * Initialises this main controller. + * @param doShow <code>true</code> for showing, <code>false</code> for not showing. */ void init(final boolean doShow) { // Get the current directory @@ -269,7 +270,7 @@ } } - /** collect CF arches */ + /** Collect crossfire archetypes. */ public void collectCFArches() { if (archetypeSet.getLoadStatus() != ArchetypeSet.LoadStatus.COMPLETE) { // must not collect arches while arch stack not complete @@ -311,10 +312,10 @@ } /** - * Get information on the current state of tileEdit: - * Are tiles of type 'v' displayed? + * Returns the information on the current state of tileEdit for <var>v</var>. + * Answers the question whether tiles of type 'v' are displayed. * @param v are tiles of this type displayed? - * @return true if these tiles are currently displayed + * @return <code>true</code> if these tiles are currently displayed, otherwise <code>false</code>. */ public boolean isTileEdit(final int v) { if (v == 0) { @@ -324,8 +325,9 @@ } /** - * @return true when a tileEdit value is set, so that not - * all tiles are displayed. + * Returns whether a tileEdit value is set. + * In case a tileEdit value is set, not all tiles should be displayed. + * @return <code>true</code> if a tileEdit value is set, otherwise <code>false</code>. */ public boolean isTileEditSet() { return (tileEdit & IGUIConstants.TILE_EDIT_NONE) == 0 && tileEdit != 0; @@ -423,6 +425,8 @@ * @param map path of map directory * @param script path of script directory * @param baseImageSet true if base image set is used + * @param load <code>true</code> if archetypes should be loaded from the collection, otherwise (scanning arch tree) <code>false</code>. + * @param mapTileBottom <code>true</code> if the map tile list should be displayed on the window bottom, otherwise (right border) <code>false</code>. */ void setGlobalSettings(final String arch, String map, final String script, final boolean baseImageSet, final boolean load, final boolean mapTileBottom) { map = map.replace('\\', '/'); @@ -467,7 +471,7 @@ return pickmapsLocked; } - /** refresh the active map view, if there is one */ + /** Refresh the active map view, if there is one. */ public void refreshCurrentMap() { mainView.refreshMapTileList(); // update tile window if (currentMap != null) { @@ -615,7 +619,7 @@ CMainStatusbar.getInstance().setText(""); } - /** Invoked when user wants to open a new pickmap */ + /** 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); @@ -679,7 +683,7 @@ } } - /** Invoked when the user wants to close the active pickmap */ + /** Invoked when the user wants to close the active pickmap. */ public void closePickmap() { if (!CPickmapPanel.getInstance().isLoadComplete()) { showMessage("Cannot close Pickmap", "Pickmaps aren't loaded.\n" + @@ -754,7 +758,7 @@ return true; } - /** Open active pickmap as normal map for extensive editing */ + /** Open active pickmap as normal map for extensive editing. */ public void openPickmapMap() { if (!CPickmapPanel.getInstance().isLoadComplete()) { showMessage("Cannot open Pickmap", "Pickmaps aren't loaded.\n" + @@ -908,7 +912,7 @@ } /** - * Open an attribute dialog window for the specified arch + * Open an attribute dialog window for the specified gameObject. * @param gameObject GameObject to open attribute dialog window for. */ public void openAttrDialog(final GameObject gameObject) { @@ -942,8 +946,13 @@ } /** - * browse first through the default arch list and attach map arches to it - * then browse through the face list and try to find the pictures + * Browse first through the default arch list and attach map arches to it + * then browse through the face list and try to find the pictures. + * @param objects GameObjects to collect. + * @param file File (for error messages). + * @return <code>true</code> in case of success, otherwise <code>false</code>. + * @note The current implementation always returns <code>true</code>. + * @todo Check whether <code>return false;</code> ever happens, and if not, change method return type to <code>void</code>. */ boolean collectTempList(final List<GameObject> objects, final File file) { final List<GameObject> tailList = new ArrayList<GameObject>(); @@ -995,7 +1004,7 @@ currentMap.save(); } - /** Save current active pickmap */ + /** Save currently active pickmap. */ public void savePickmap() { if (!CPickmapPanel.getInstance().isLoadComplete()) { showMessage("Cannot save Pickmap", "Pickmaps aren't loaded.\n" + @@ -1384,7 +1393,7 @@ //CMainStatusbar.getInstance().setLevelInfo(level); } - /** Invoked when user wants to revert the current map to previously saved state */ + /** Invoked when user wants to revert the current map to previously saved state. */ public void revert() { final MapControl modmap = this.currentMap; // "modified map" to be reverted @@ -1402,7 +1411,7 @@ } } - /** Invoked when user wants to revert the current map to previously saved state */ + /** Invoked when user wants to revert the current pickmap to previously saved state. */ public void revertPickmap() { if (!CPickmapPanel.getInstance().isLoadComplete()) { showMessage("Cannot revert Pickmap", "Pickmaps aren't loaded.\n" + @@ -1546,8 +1555,8 @@ } /** - * Is the CopyBuffer empty? - * @return true if the buffer is empty + * Returns whether the CopyBuffer is empty. + * @return <code>true</code> if the CopyBuffer is empty, otherwise <code>false</code>. */ public boolean isCopyBufferEmpty() { return copybuffer.isEmpty(); @@ -1614,8 +1623,10 @@ return currentMap != null && currentMap.isPlainSaveEnabled(); } - - /** @return <code>ImageIcon</code> of the grid icon */ + /** + * Returns the grid icon. + * @return The grid icon. + */ public ImageIcon getGridIcon() { return mapGridIcon; } Modified: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-12-03 23:32:31 UTC (rev 855) @@ -236,7 +236,9 @@ currentmapLocation.addMenuEntry(m_fill_below); } - /** "File"-Menu */ + /** + * Creates the "File"-Menu. + */ private void buildFileMenu() { final MenuManager menuManager = MenuManager.getMenuManager(); menu_file = new SimpleMenuLocation("main.file"); @@ -359,7 +361,9 @@ add(entry.getMenuBarComponent()); } - /** "Edit"-Menu */ + /** + * Creates the "Edit"-Menu. + */ private void buildEditMenu() { final MenuManager menuManager = MenuManager.getMenuManager(); menu_edit = new SimpleMenuLocation("main.edit"); @@ -1077,7 +1081,7 @@ } */ - /** Create the help-about window with the credits */ + /** Create the help-about window with the credits. */ private void buildHelpMenu() { menu_help = new JMenu("Help"); menu_help.setMnemonic('H'); @@ -1174,7 +1178,7 @@ } /** - * allows external access to dis-/enable the file->revert menu + * Allows external access to dis-/enable the file->revert menu. * @param state enable state of the revert menu */ public void setRevertEnabled(final boolean state) { @@ -1183,7 +1187,7 @@ } /** - * allows external access to dis-/enable the menus related to active pickmap + * Allows external access to dis-/enable the menus related to active pickmap. * @param state true when there is an active pickmap */ public void setActivePickmapsEnabled(final boolean state) { Modified: trunk/crossfire/src/cfeditor/CMainToolbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainToolbar.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/CMainToolbar.java 2006-12-03 23:32:31 UTC (rev 855) @@ -64,7 +64,7 @@ /** The current icon/labels mode. */ private int m_eIconAndLabelVisibility = SHOW_ICONS_ONLY; - /** The popup */ + /** The popup menu. */ private final CPopupMenu m_popupMenu; // UI elements Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-12-03 23:32:31 UTC (rev 855) @@ -91,7 +91,7 @@ /** Key for info whether map-tile panel is seperate or at bottom. */ public static final String MAPTILE_BOTTOM_KEY = "MapTileBottom"; - /** Border size for the split panes */ + /** Border size for the split panes. */ private static final int BORDER_SIZE = 5; /** The controller of this view. */ @@ -164,6 +164,7 @@ /** * Initialises (builds) this view. + * @param doShow <code>true</code> whether to show, otherwise <code>false</code>. */ void init(final boolean doShow) { final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); @@ -276,7 +277,10 @@ menu.setActivePickmapsEnabled(state); } - /** @return true when pickmap is active, false when archlist is active */ + /** + * Returns whether selection would be from a pickmap (otherwise it would be from the archlist). + * @return <code>true</code> if selection would be from a pickmap, <code>false</code> for the archlist. + */ public boolean isPickmapActive() { return pickmapActive; } @@ -291,9 +295,10 @@ } /** + * Returns the highlighted Archetype / GameObject. * @return the active arch in the left-side panel. - * This can either be a default arch from the archlist, or - * a custom arch from a pickmap. + * This can either be a Archetype from the archlist, or + * a custom GameObject from a pickmap. * IMPORTANT: The returned GameObject is not a clone. A copy * must be generated before inserting such an arch to the map. */ @@ -327,7 +332,10 @@ archPanel.showArchPanelQuickObject(arch); } - /** @return the panel with all pickmaps */ + /** + * Returns the JTabbedPane with all pickmaps. + * @return The JTabbedPane with all pickmaps. + */ public JTabbedPane getPickmapPanel() { return pickmapPanel; } @@ -441,12 +449,12 @@ statusBar.refresh(); } - /** refresh the map arch panel (bottom window) */ + /** Refreshes the map arch panel (bottom window). */ void refreshMapArchPanel() { mapArchPanel.refresh(); } - /** refresh the arch panel (left window) */ + /** Refresh the arch panel (left window). */ void refreshArchPanel() { archPanel.invalidate(); archPanel.refresh(); Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-03 23:32:31 UTC (rev 855) @@ -113,21 +113,21 @@ private final JScrollPane scrollArchPane = new JScrollPane(); - /** 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 JPanel scriptPanel; - /** 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); - /** arch face field */ + /** Arch face field. */ private final JTextField archFaceField = new JTextField(14); private JLabel archInvCount = new JLabel(); @@ -454,7 +454,7 @@ return false; } - /** 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 c = new GridBagConstraints(); @@ -511,14 +511,14 @@ } /** - * Open an attribute dialog window for the currently selected arch + * Open an attribute dialog window for the currently selected arch. * @param arch currently selected arch */ private void openAttrDialog(final GameObject arch) { mainControl.openAttrDialog(arch); } - /** 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 @@ -535,7 +535,7 @@ textPanel.add(sta); } - /** set up the script panel tab */ + /** Set up the script panel tab. */ private void setupScriptPanel() { scriptPanel = new JPanel(); // new panel scriptPanel.setLayout(new BoxLayout(scriptPanel, BoxLayout.X_AXIS)); @@ -795,6 +795,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 @@ -825,11 +826,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) { s_new.setEnabled(newButton); Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-03 23:32:31 UTC (rev 855) @@ -26,14 +26,14 @@ import cfeditor.gameobject.GameObject; import cfeditor.gui.MapView; +import cfeditor.gui.map.DefaultLevelRenderer; import cfeditor.map.MapControl; import cfeditor.map.MapModel; -import cfeditor.gui.map.DefaultLevelRenderer; import java.awt.Dimension; import java.awt.Point; import java.awt.Rectangle; +import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.io.File; import java.io.IOException; @@ -110,6 +110,7 @@ * @param mapControl the controller of this view * @param initial the initial view position to show; null=show top left * corner + * @param fi MapView. */ CMapViewBasic(final CMainControl mainControl, final MapControl mapControl, final MapView fi, final Point initial) { //super("Map ["+control.getMapFileName()+"]", true, true, true, true); @@ -172,27 +173,27 @@ } /** - * is the map grid visible? - * @return true if map grid is visible + * Returns whether the map grid is visible. + * @return <code>true</code> if the map grid is visible, otherwise <code>false</code>. */ public boolean isGridVisible() { return gridVisible; } - /** Update for a new look and feel (-> view menu) */ + /** Update for a new look and feel (-> view menu). */ public void updateLookAndFeel() { renderer.updateLookAndFeel(); } /** - * is there a highlighted area in this mapview? - * @return true if there is a highlighted area + * Returns whether there is a highlighted area in this MapView. + * @return <code>true</code> if there is a highlighted area, otherwise <code>false</code>. */ public boolean isHighlight() { return highlightOn; } - /** turn the highlight off */ + /** Turn the highlight off. */ public void unHighlight() { if (highlightOn) { highlightOn = false; @@ -232,14 +233,18 @@ } /** - * @return the coord. of the starting point of the highlighted - * tile-selection + * Returns the starting coordinates of the highlighted tile-selection. + * @return The starting coordinates of the highlighted tile-selection. */ public Point getHighlightStart() { return mapMouseRightPos; } - /** @return the coord. of the end point of the highlighted tile-selection */ + /** + * Returns the ending coordinates of the highlighted tile-selection. + * @return The ending coordinates of the highlighted tile-selection. + * @todo fix naming or comment: The method name suggests ending is relative to start, while the original description suggests its absolute. + */ public Point getHighlightOffset() { return mapMouseRightOff; } @@ -291,6 +296,7 @@ /** * Convert the map into a png file. * @param filename the file to write to + * @throws IOException in case of I/O problems writing the image. */ public void printFullImage(final String filename) throws IOException { ImageIO.write(renderer.getFullImage(), "png", new File(filename)); @@ -495,7 +501,7 @@ } /** The mouse listener for the view. */ - public final class CListener implements MouseListener, MouseMotionListener { + public final class CListener extends MouseAdapter implements MouseMotionListener { private boolean fFilling = false; @@ -507,9 +513,7 @@ private Point[] needRedraw = null; // array of tile coords which need to be redrawn - public void mouseClicked(final MouseEvent e) { - } - + /** {@inheritDoc} */ public void mousePressed(final MouseEvent e) { changedFlagNotify(); // set flag: map has changed final Point clickPoint = e.getPoint(); @@ -576,10 +580,7 @@ } } - /** - * This method gets called whenever a mousebutton is released - * @param event the occurred <code>MouseEvent</code> - */ + /** {@inheritDoc} */ public void mouseReleased(final MouseEvent event) { final int buttonNr; // Number of released mouse button @@ -599,17 +600,12 @@ } } - public void mouseEntered(final MouseEvent event) { - } - + /** {@inheritDoc} */ public void mouseExited(final MouseEvent event) { // endFill(); } - /** - * Listen for Mouse move events (no dragging) - * @param event the occurred <code>MouseEvent</code> - */ + /** {@inheritDoc} */ public void mouseMoved(final MouseEvent event) { final int xp, yp; @@ -627,10 +623,7 @@ // this paints the whole map again, but we want only the marker } - /** - * Listen for mouse drag events on the Map View - * @param event the occurred <code>MouseEvent</code> - */ + /** {@inheritDoc} */ public void mouseDragged(final MouseEvent event) { final int xp, yp; Modified: trunk/crossfire/src/cfeditor/CNewMapDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-12-03 23:32:31 UTC (rev 855) @@ -72,7 +72,7 @@ /** The controller of this new level dialog view. */ private final CMainControl mainControl; - /** type of map to create: pickmap or normal map? */ + /** Type of map to create: pickmap or normal map. */ private final MapType mapType; /** Desired filename for new map, null if not specified. */ Modified: trunk/crossfire/src/cfeditor/COptionDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/COptionDialog.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/COptionDialog.java 2006-12-03 23:32:31 UTC (rev 855) @@ -131,15 +131,15 @@ final JPanel cbox; if (this.mainControl.getImageSet() != null) { - cbox = build_ImageSetBox(this.mainControl.getImageSet().equalsIgnoreCase("base")); + cbox = buildImageSetBox(this.mainControl.getImageSet().equalsIgnoreCase("base")); } else { - cbox = build_ImageSetBox(false); + cbox = buildImageSetBox(false); } optionPartPanel.add(cbox); m_loadArches = new JCheckBox(" Load Arches from Collection"); m_loadArches.setSelected(this.mainControl.isArchLoadedFromCollection()); - m_loadArches.addActionListener(new selectArchLoadAL(m_loadArches, this)); + m_loadArches.addActionListener(new SelectArchLoadAL(m_loadArches, this)); optionPartPanel.add(m_loadArches); if (this.mainControl.isArchLoadedFromCollection()) { m_archField.setEnabled(false); @@ -213,8 +213,13 @@ setVisible(true); } - /** Construct the Combo box for the selection of Image Sets */ - private JPanel build_ImageSetBox(final boolean base_set) { + /** + * Creates the ComboBox for the selection of Image Sets. + * @param baseSet <code>true</code> to select the base set, otherwise <code>false</code>. + * @return A Panel with the combobox plus label. + */ + /** Construct the Combo box for the selection of Image Sets. */ + private JPanel buildImageSetBox(final boolean baseSet) { final JPanel lineLayout = new JPanel(new FlowLayout(FlowLayout.RIGHT)); // layout for this line // list of available Image Sets: @@ -226,7 +231,7 @@ m_ImageSet = new JComboBox(list); // set "content" m_ImageSet.setPreferredSize(new Dimension(150, 25)); - m_ImageSet.setSelectedIndex(base_set ? 1 : 0); // set active selection + m_ImageSet.setSelectedIndex(baseSet ? 1 : 0); // set active selection m_ImageSet.setBackground(Color.white); // white background m_ImageSet.setName("Image Set"); @@ -236,20 +241,22 @@ } /** - * Action-listener for the checkbox "Load Arches from Collection" - * While it is selected, the arch path should be disabled + * Action-listener for the checkbox "Load Arches from Collection". + * While it is selected, the arch path should be disabled. + * @todo Turn this into an Action. */ - private final class selectArchLoadAL implements ActionListener { + private final class SelectArchLoadAL implements ActionListener { final COptionDialog frame; // the frame (options dialog window) final JCheckBox cbox; // input checkbox - public selectArchLoadAL(final JCheckBox cbox, final COptionDialog frame) { + public SelectArchLoadAL(final JCheckBox cbox, final COptionDialog frame) { this.cbox = cbox; this.frame = frame; } + /** {@inheritDoc} */ public void actionPerformed(final ActionEvent event) { // state has changed if (cbox.isSelected()) { @@ -260,5 +267,7 @@ frame.update(frame.getGraphics()); } } - } -} + + } // class SelectArchLoadAL + +} // class COptionDialog Modified: trunk/crossfire/src/cfeditor/CPickmapPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-12-03 23:32:31 UTC (rev 855) @@ -55,7 +55,7 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); - /** static instance of this class */ + /** Singleton instance of this class. */ private static CPickmapPanel instance; private final CMainControl mainControl; // main control reference @@ -70,7 +70,7 @@ /** The current active pickmap ontop. */ private MapControl currentPickMap; - /** Constructor */ + /** Creates a PickmapPanel. */ public CPickmapPanel() { mainControl = CMainControl.getInstance(); instance = this; @@ -78,28 +78,33 @@ currentPickMap = null; } - /** @return instance of this class */ + /** + * Returns the singleton instance of this class. + * @return The singleton instance of this class. + */ public static CPickmapPanel getInstance() { return instance; } /** - * @return true when loading process of pickmaps is complete, - * and at least one pickmap is available. + * Returns whether the loading process of pickmaps is complete and at least one pickmap is available. + * @return <code>true</code> if pickmaps are loaded, otherwise <code>false</code> + * @todo check whether this method returns <code>true</code> or <code>false</code> if the loading process is complete but no pickmaps are availbale. */ public boolean isLoadComplete() { return loadComplete; } /** - * @return currently active pickmap (is on top), - * or null if there is no pickmap + * Returns the currently active pickmap. + * If there is no currently active pickmap, this method returns <code>null</code>. + * @return Currently active pickmap or <code>null</code> if there are no pickmaps. */ public MapControl getCurrentPickmap() { return currentPickMap; } - /** load all pickmaps and build the pickmap-panel in the process */ + /** Load all pickmaps and build the pickmap-panel in the process. */ public void loadPickmaps() { // the main-panel for pickmaps: tabpane = mainControl.getMainView().getPickmapPanel(); Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-12-03 23:27:38 UTC (rev 854) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-12-03 23:32:31 UTC (rev 855) @@ -369,6 +369,12 @@ /** * Add an archetype to the destination map. Inserts a new object instance * for default archetypes, and a clone for non-default archetypes. + * If <var>allowDouble</var> is <code>false</code> and <var>gameObject</var> is an {@link net.sf.gridarta.gameobject.Archetype}, the object will only be inserted if there wasn't already an object with the same Archetype. + * @param mapControl MapControl of the destination map. + * @param gameObject GameObject to add. + * @param pos Position of MapSquare to add GameObject to. + * @param allowDouble <code>true</code> if insertion of multiple instances of the same Archetype should be allowed, otherwise <code>false</code> + * @param fillBelow <code>true</code> if insertion should happen below other objects on the same MapSquare, <code>false</code> to insert above other objects. */ private void addArchToMap(final MapControl mapControl, final GameObject gameObject, final Point pos, final boolean allowDouble, final boolean fillBelow) { if (gameObject.isArchetype()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-03 23:35:17
|
Revision: 856 http://svn.sourceforge.net/gridarta/?rev=856&view=rev Author: akirschbaum Date: 2006-12-03 15:35:16 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Remove deprecated methods. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/map/MapControl.java Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-03 23:32:31 UTC (rev 855) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-03 23:35:16 UTC (rev 856) @@ -364,32 +364,32 @@ // first look how many we need int num = 1; - if (mapControl.isPointValid(gameObject.getMapX() + 1, gameObject.getMapY())) { + if (mapControl.isPointValid(new Point(gameObject.getMapX() + 1, gameObject.getMapY()))) { num++; } - if (mapControl.isPointValid(gameObject.getMapX(), gameObject.getMapY() + 1)) { + if (mapControl.isPointValid(new Point(gameObject.getMapX(), gameObject.getMapY() + 1))) { num++; } - if (mapControl.isPointValid(gameObject.getMapX() - 1, gameObject.getMapY())) { + if (mapControl.isPointValid(new Point(gameObject.getMapX() - 1, gameObject.getMapY()))) { num++; } - if (mapControl.isPointValid(gameObject.getMapX(), gameObject.getMapY() - 1)) { + if (mapControl.isPointValid(new Point(gameObject.getMapX(), gameObject.getMapY() - 1))) { num++; } // now get the coordinates redraw = new Point[num]; // create instance of needed size redraw[--num] = new Point(gameObject.getMapX(), gameObject.getMapY()); // center square - if (mapControl.isPointValid(gameObject.getMapX() + 1, gameObject.getMapY())) { + if (mapControl.isPointValid(new Point(gameObject.getMapX() + 1, gameObject.getMapY()))) { redraw[--num] = new Point(gameObject.getMapX() + 1, gameObject.getMapY()); } - if (mapControl.isPointValid(gameObject.getMapX(), gameObject.getMapY() + 1)) { + if (mapControl.isPointValid(new Point(gameObject.getMapX(), gameObject.getMapY() + 1))) { redraw[--num] = new Point(gameObject.getMapX(), gameObject.getMapY() + 1); } - if (mapControl.isPointValid(gameObject.getMapX() - 1, gameObject.getMapY())) { + if (mapControl.isPointValid(new Point(gameObject.getMapX() - 1, gameObject.getMapY()))) { redraw[--num] = new Point(gameObject.getMapX() - 1, gameObject.getMapY()); } - if (mapControl.isPointValid(gameObject.getMapX(), gameObject.getMapY() - 1)) { + if (mapControl.isPointValid(new Point(gameObject.getMapX(), gameObject.getMapY() - 1))) { redraw[--num] = new Point(gameObject.getMapX(), gameObject.getMapY() - 1); } assert num == 0; Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-12-03 23:32:31 UTC (rev 855) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-12-03 23:35:16 UTC (rev 856) @@ -352,16 +352,16 @@ addArchToMap(mapControl, arch, new Point(startX, startY), false, false); // now go recursive into all four directions - if (mapControl.isPointValid(startX - 1, startY) && !mapControl.containsArchObject(startX - 1, startY)) { + if (mapControl.isPointValid(new Point(startX - 1, startY)) && !mapControl.containsArchObject(new Point(startX - 1, startY))) { floodfill(mapControl, startX - 1, startY, arch); } - if (mapControl.isPointValid(startX, startY - 1) && !mapControl.containsArchObject(startX, startY - 1)) { + if (mapControl.isPointValid(new Point(startX, startY - 1)) && !mapControl.containsArchObject(new Point(startX, startY - 1))) { floodfill(mapControl, startX, startY - 1, arch); } - if (mapControl.isPointValid(startX + 1, startY) && !mapControl.containsArchObject(startX + 1, startY)) { + if (mapControl.isPointValid(new Point(startX + 1, startY)) && !mapControl.containsArchObject(new Point(startX + 1, startY))) { floodfill(mapControl, startX + 1, startY, arch); } - if (mapControl.isPointValid(startX, startY + 1) && !mapControl.containsArchObject(startX, startY + 1)) { + if (mapControl.isPointValid(new Point(startX, startY + 1)) && !mapControl.containsArchObject(new Point(startX, startY + 1))) { floodfill(mapControl, startX, startY + 1, arch); } } Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-03 23:32:31 UTC (rev 855) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-03 23:35:16 UTC (rev 856) @@ -198,19 +198,6 @@ return addArchToMap(archname, pos, allowDouble, join, false); } - /** wrapper method for addArchToMap, always inserting new arches on top. - * @param archname - * @param xx - * @param yy - * @param allowDouble - * @param join - * @return <code>true</code> if insertion is successful, <code>false</code> if not - * @deprecated use {@link #addArchToMap(String, Point, int, boolean, boolean)} instead - */ - @Deprecated public boolean addArchToMap(final String archname, final int xx, final int yy, final boolean allowDouble, final boolean join) { - return addArchToMap(archname, new Point(xx, yy), allowDouble, join, false); - } - public boolean insertArchToMap(final GameObject newarch, final String archname, final GameObject next, final Point pos, final boolean join) { return mapModel.insertArchToMap(newarch, archname, next, pos, join); } @@ -239,10 +226,6 @@ return mapModel.containsArchObject(pos); } - @Deprecated public boolean containsArchObject(final int x, final int y) { - return containsArchObject(new Point(x, y)); - } - public GameObject getBottomArchObject(final Point pos) { return mapModel.getMapSquare(pos).getFirst(); } @@ -373,18 +356,6 @@ /** * Check if the coordinates posx, posy are valid (located within the * borders of the map). - * @param posx the x-coordinate - * @param posy the y-coordinate - * @return <code>true</code> if this point is located within the map - * boundaries - */ - @Deprecated public boolean isPointValid(final int posx, final int posy) { - return isPointValid(new Point(posx, posy)); - } - - /** - * Check if the coordinates posx, posy are valid (located within the - * borders of the map). * @param pos coordinate to check * @return true if this point is located within the map boundaries */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-03 23:45:17
|
Revision: 858 http://svn.sourceforge.net/gridarta/?rev=858&view=rev Author: akirschbaum Date: 2006-12-03 15:45:17 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Remove deprecated methods. Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapModel.java Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-12-03 23:37:12 UTC (rev 857) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-12-03 23:45:17 UTC (rev 858) @@ -205,28 +205,28 @@ // now do the joining in all four directions: GameObject arch; - if (map.isPointValid(x, y - 1)) { + if (map.isPointValid(new Point(x, y - 1))) { if ((arch = findArchOfJoinlist(map, x, y - 1)) != null) { newIndex = addDir(newIndex, NORTH); connectArch(arch, archnames[addDir(getIndex(arch.getArchetypeName()), SOUTH)]); } } - if (map.isPointValid(x + 1, y)) { + if (map.isPointValid(new Point(x + 1, y))) { if ((arch = findArchOfJoinlist(map, x + 1, y)) != null) { newIndex = addDir(newIndex, EAST); connectArch(arch, archnames[addDir(getIndex(arch.getArchetypeName()), WEST)]); } } - if (map.isPointValid(x, y + 1)) { + if (map.isPointValid(new Point(x, y + 1))) { if ((arch = findArchOfJoinlist(map, x, y + 1)) != null) { newIndex = addDir(newIndex, SOUTH); connectArch(arch, archnames[addDir(getIndex(arch.getArchetypeName()), NORTH)]); } } - if (map.isPointValid(x - 1, y)) { + if (map.isPointValid(new Point(x - 1, y))) { if ((arch = findArchOfJoinlist(map, x - 1, y)) != null) { newIndex = addDir(newIndex, WEST); connectArch(arch, archnames[addDir(getIndex(arch.getArchetypeName()), EAST)]); @@ -249,25 +249,25 @@ GameObject arch; // temp. arch // do the joining in all four directions: - if (map.isPointValid(x, y - 1)) { + if (map.isPointValid(new Point(x, y - 1))) { if ((arch = findArchOfJoinlist(map, x, y - 1)) != null) { connectArch(arch, archnames[removeDir(getIndex(arch.getArchetypeName()), SOUTH)]); } } - if (map.isPointValid(x + 1, y)) { + if (map.isPointValid(new Point(x + 1, y))) { if ((arch = findArchOfJoinlist(map, x + 1, y)) != null) { connectArch(arch, archnames[removeDir(getIndex(arch.getArchetypeName()), WEST)]); } } - if (map.isPointValid(x, y + 1)) { + if (map.isPointValid(new Point(x, y + 1))) { if ((arch = findArchOfJoinlist(map, x, y + 1)) != null) { connectArch(arch, archnames[removeDir(getIndex(arch.getArchetypeName()), NORTH)]); } } - if (map.isPointValid(x - 1, y)) { + if (map.isPointValid(new Point(x - 1, y))) { if ((arch = findArchOfJoinlist(map, x - 1, y)) != null) { connectArch(arch, archnames[removeDir(getIndex(arch.getArchetypeName()), EAST)]); } Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-03 23:37:12 UTC (rev 857) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-03 23:45:17 UTC (rev 858) @@ -459,7 +459,7 @@ if (tile.length <= 25) { for (int i = tile.length - 1; i >= 0; i--) { // paint the tiles - if (mapControl.getMapModel().isPointValid(tile[i].x, tile[i].y)) { + if (mapControl.getMapModel().isPointValid(tile[i])) { renderer.paintTile(tile[i].x, tile[i].y); } if (log.isDebugEnabled()) { Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-03 23:37:12 UTC (rev 857) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-03 23:45:17 UTC (rev 858) @@ -213,7 +213,7 @@ for (GameObject part = getArchetype(archName); part != null; part = part.getMultiNext()) { final int mapx = pos.x + part.getMultiX(); final int mapy = pos.y + part.getMultiY(); - if (!isPointValid(mapx, mapy)) { + if (!isPointValid(new Point(mapx, mapy))) { // outside map return false; } @@ -568,10 +568,6 @@ return getMapArchObject().getMapDisplayName(); } - @Deprecated public boolean isPointValid(final int posx, final int posy) { - return isPointValid(new Point(posx, posy)); - } - /** * Searching for a valid exit at the highlighted map-spot. (This can be a * teleporter, exit, pit etc.) @@ -613,11 +609,8 @@ super.resizeMap(newSize); // an important last point: if there is a highlighted area in a region // that got cut off - unhilight it! - final int mposx = mapControl.getMapViewFrame().getHighlightStart().x; - final int mposy = mapControl.getMapViewFrame().getHighlightStart().y; - if (!isPointValid(mposx, mposy) || - !isPointValid(mposx + mapControl.getMapViewFrame().getHighlightOffset().x, - mposy + mapControl.getMapViewFrame().getHighlightOffset().y)) { + final Point mpos = mapControl.getMapViewFrame().getHighlightStart(); + if (!isPointValid(mpos) || !isPointValid(new Point(mpos.x + mapControl.getMapViewFrame().getHighlightOffset().x, mpos.y + mapControl.getMapViewFrame().getHighlightOffset().y))) { mapControl.getMapViewFrame().unHighlight(); } @@ -646,7 +639,7 @@ * @return whether a match was found */ public boolean filterSquare(final Filter filter, final FilterConfig config, final int x, final int y) { - if (!isPointValid(x, y)) { + if (!isPointValid(new Point(x, y))) { return false; } Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-03 23:37:12 UTC (rev 857) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-03 23:45:17 UTC (rev 858) @@ -42,8 +42,6 @@ @Deprecated @Nullable GameObject getMapArch(int id, int xx, int yy); @Nullable GameObject getMapArch(int id, Point pos); - @Deprecated boolean isPointValid(int x, int y); - @Nullable GameObject getExit(); String getMapText(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-03 23:51:19
|
Revision: 863 http://svn.sourceforge.net/gridarta/?rev=863&view=rev Author: akirschbaum Date: 2006-12-03 15:51:19 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Remove deprecated method. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapModel.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-03 23:49:00 UTC (rev 862) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-03 23:51:19 UTC (rev 863) @@ -216,7 +216,7 @@ for (int y = 0; y < mapViewBasic.getMapSize().getHeight(); y++) { for (int x = 0; x < mapViewBasic.getMapSize().getWidth(); x++) { filter.newSquare(); - if (!mapControl.getMapModel().containsArchObject(x, y)) { + if (!mapControl.getMapModel().containsArchObject(new Point(x, y))) { // empty square if (isPickmap) { grfx.fillRect(x * 32 + borderOffset, y * 32 + borderOffset, 32, 32); @@ -316,7 +316,7 @@ final CFilterControl filter = mainControl.getFilterControl(); filter.newSquare(); // first, draw the object's faces: - if (!mapControl.getMapModel().containsArchObject(x, y)) { + if (!mapControl.getMapModel().containsArchObject(new Point(x, y))) { // draw the empty-tile icon (direcly to the mapview) if (isPickmap) { grfx.setColor(IGUIConstants.BG_COLOR); @@ -365,7 +365,7 @@ } // We have been drawing to the tmp. buffer, now convert it to // an ImageIcon and paint it into the mapview: - if (mapControl.getMapModel().containsArchObject(x, y)) { + if (mapControl.getMapModel().containsArchObject(new Point(x, y))) { tmpIcon.setImage(tmpImage); tmpIcon.paintIcon(this, grfx, x * 32, y * 32); } Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-03 23:49:00 UTC (rev 862) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-03 23:51:19 UTC (rev 863) @@ -199,11 +199,6 @@ } /** Check whether a given location contains at least one GameObject. */ - @Deprecated public boolean containsArchObject(final int x, final int y) { - return containsArchObject(new Point(x, y)); - } - - /** Check whether a given location contains at least one GameObject. */ public boolean containsArchObject(final Point pos) { return isPointValid(pos) && !mapGrid[pos.x][pos.y].isEmpty(); } Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-03 23:49:00 UTC (rev 862) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-03 23:51:19 UTC (rev 863) @@ -46,8 +46,6 @@ void levelCloseNotify(); - boolean containsArchObject(int x, int y); - boolean containsArchObject(Point pos); String getMapName(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-03 23:54:08
|
Revision: 866 http://svn.sourceforge.net/gridarta/?rev=866&view=rev Author: akirschbaum Date: 2006-12-03 15:54:08 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Remove deprecated method. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/MapViewIFrame.java Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-03 23:52:46 UTC (rev 865) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-03 23:54:08 UTC (rev 866) @@ -331,10 +331,6 @@ frame.updateTitle(); } - @Deprecated void setMapAndArchPosition(final int archid, final int x, final int y) { - setMapAndArchPosition(archid, new Point(x, y)); - } - void setMapAndArchPosition(final int archid, final Point pos) { mapMouseRightPos.setLocation(pos); if (pos.x == -1 || pos.y == -1) { Modified: trunk/crossfire/src/cfeditor/MapViewIFrame.java =================================================================== --- trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-12-03 23:52:46 UTC (rev 865) +++ trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-12-03 23:54:08 UTC (rev 866) @@ -190,10 +190,6 @@ view.changedFlagNotify(); } - @Deprecated void setMapAndArchPosition(final int archid, final int x, final int y) { - setMapAndArchPosition(archid, new Point(x, y)); - } - void setMapAndArchPosition(final int archid, final Point pos) { view.setMapAndArchPosition(archid, pos); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-04 00:07:06
|
Revision: 869 http://svn.sourceforge.net/gridarta/?rev=869&view=rev Author: akirschbaum Date: 2006-12-03 16:07:06 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Replace x/y coordinate by Point. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-04 00:02:05 UTC (rev 868) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-04 00:07:06 UTC (rev 869) @@ -456,7 +456,7 @@ for (int i = tile.length - 1; i >= 0; i--) { // paint the tiles if (mapControl.getMapModel().isPointValid(tile[i])) { - renderer.paintTile(tile[i].x, tile[i].y); + renderer.paintTile(tile[i]); } if (log.isDebugEnabled()) { log.debug("redraw: (" + tile[i].x + ", " + tile[i].y + ")"); Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-04 00:02:05 UTC (rev 868) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-04 00:07:06 UTC (rev 869) @@ -303,7 +303,7 @@ * @param x map coordinates for the tile to draw * @param y map coordinates for the tile to draw */ - public void paintTile(final int x, final int y) { + public void paintTile(final Point point) { final Graphics grfx; if (isPickmap()) { grfx = getGraphics(); // graphics context for drawing in the mapview @@ -316,18 +316,18 @@ final CFilterControl filter = mainControl.getFilterControl(); filter.newSquare(); // first, draw the object's faces: - if (!mapControl.getMapModel().containsArchObject(new Point(x, y))) { + if (!mapControl.getMapModel().containsArchObject(point)) { // draw the empty-tile icon (direcly to the mapview) if (isPickmap) { grfx.setColor(IGUIConstants.BG_COLOR); - grfx.fillRect(x * 32 + borderOffset, y * 32 + borderOffset, 32, 32); + grfx.fillRect(point.x * 32 + borderOffset, point.y * 32 + borderOffset, 32, 32); } else { - mainControl.getUnknownTileIcon().paintIcon(this, grfx, x * 32, y * 32); + mainControl.getUnknownTileIcon().paintIcon(this, grfx, point.x * 32, point.y * 32); } } else { tmpGrfx.fillRect(0, 0, 32, 32); // loop through all arches on that square and draw em - for (final GameObject node : mapControl.getMapModel().getMapSquare(new Point(x, y))) { + for (final GameObject node : mapControl.getMapModel().getMapSquare(point)) { filter.objectInSquare(node); if (!filter.canShow(node)) { continue; @@ -365,21 +365,21 @@ } // We have been drawing to the tmp. buffer, now convert it to // an ImageIcon and paint it into the mapview: - if (mapControl.getMapModel().containsArchObject(new Point(x, y))) { + if (mapControl.getMapModel().containsArchObject(point)) { tmpIcon.setImage(tmpImage); - tmpIcon.paintIcon(this, grfx, x * 32, y * 32); + tmpIcon.paintIcon(this, grfx, point.x * 32, point.y * 32); } // if grid is active, draw grid lines (right and bottom) if (mapViewBasic.isGridVisible()) { // horizontal: - grfx.drawLine(x * 32, y * 32, x * 32, y * 32 + 32); + grfx.drawLine(point.x * 32, point.y * 32, point.x * 32, point.y * 32 + 32); // vertical: - grfx.drawLine(x * 32, y * 32, x * 32 + 32, y * 32); + grfx.drawLine(point.x * 32, point.y * 32, point.x * 32 + 32, point.y * 32); } // if tile is highlighted, draw the highlight icon - paintHighlightTile(grfx, x, y); + paintHighlightTile(grfx, point.x, point.y); } Modified: trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-04 00:02:05 UTC (rev 868) +++ trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-04 00:07:06 UTC (rev 869) @@ -35,7 +35,7 @@ BufferedImage getFullImage(); - void paintTile(int x, int y); + void paintTile(Point point); Point getTileLocationAt(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-04 00:10:40
|
Revision: 871 http://svn.sourceforge.net/gridarta/?rev=871&view=rev Author: akirschbaum Date: 2006-12-03 16:10:39 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Replace x/y coordinate by Point. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-04 00:09:26 UTC (rev 870) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-04 00:10:39 UTC (rev 871) @@ -778,7 +778,7 @@ } // paint the highlight-icon - renderer.setHighlightTile(/*((JComponent)renderer).getGraphics(), */mapLoc.x, mapLoc.y); + renderer.setHighlightTile(/*((JComponent)renderer).getGraphics(), */mapLoc); if (renderer.isPickmap()) { final GameObject arch = mapControl.getBottomArchObject(mapLoc); Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-04 00:09:26 UTC (rev 870) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-04 00:10:39 UTC (rev 871) @@ -383,11 +383,11 @@ } - public void setHighlightTile(final int x, final int y) { + public void setHighlightTile(final Point point) { if (isPickmap()) { - paintHighlightTile(getGraphics(), new Point(x, y)); + paintHighlightTile(getGraphics(), point); } else { - paintHighlightTile(backBuffer.getGraphics(), new Point(x, y)); + paintHighlightTile(backBuffer.getGraphics(), point); repaint(); } } Modified: trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-04 00:09:26 UTC (rev 870) +++ trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-04 00:10:39 UTC (rev 871) @@ -43,7 +43,7 @@ void modelChanged(); - void setHighlightTile(int x, int y); + void setHighlightTile(Point point); boolean resizeBackBuffer(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-04 00:19:40
|
Revision: 873 http://svn.sourceforge.net/gridarta/?rev=873&view=rev Author: akirschbaum Date: 2006-12-03 16:19:41 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Replace x/y coordinate by Point. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/MapViewIFrame.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-04 00:16:10 UTC (rev 872) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-04 00:19:41 UTC (rev 873) @@ -1249,7 +1249,7 @@ if (exitPos.x == 0 && exitPos.y == 0) { showMessage("Destination Invalid", "This exit points nowhere."); } else if (currentMap.isPointValid(exitPos)) { - currentMap.getMapViewFrame().setHotspot(exitPos.x, exitPos.y); + currentMap.getMapViewFrame().setHotspot(exitPos); } else { showMessage("Destination Invalid", "The destination of this exit is outside the map."); } @@ -1290,7 +1290,7 @@ exitPos.x = currentMap.getMapModel().getMapArchObject().getEnterX(); exitPos.y = currentMap.getMapModel().getMapArchObject().getEnterY(); } - currentMap.getMapViewFrame().setHotspot(exitPos.x, exitPos.y); // set hotspot + currentMap.getMapViewFrame().setHotspot(exitPos); // set hotspot // Update the main view so the new map instantly pops up. mainView.update(mainView.getGraphics()); Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-04 00:16:10 UTC (rev 872) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-04 00:19:41 UTC (rev 873) @@ -256,16 +256,16 @@ * @param dx x-coordinate * @param dy y-coordinate */ - public void setHotspot(final int dx, final int dy) { + public void setHotspot(final Point point) { // set the highlighted spot: - mapMouseRightPos.x = dx; - mapMouseRightPos.y = dy; + mapMouseRightPos.x = point.x; + mapMouseRightPos.y = point.y; mapMouseRightOff.x = 0; mapMouseRightOff.y = 0; // set scroll position accordingly to center on target - final Rectangle scrollto = new Rectangle((dx + 1) * 32 + 16 - getViewport().getViewRect().width / 2, - (dy + 1) * 32 + 16 - getViewport().getViewRect().height / 2, + final Rectangle scrollto = new Rectangle((point.x + 1) * 32 + 16 - getViewport().getViewRect().width / 2, + (point.y + 1) * 32 + 16 - getViewport().getViewRect().height / 2, getViewport().getViewRect().width, getViewport().getViewRect().height); if (scrollto.x + scrollto.width > getViewport().getViewSize().width) { Modified: trunk/crossfire/src/cfeditor/MapViewIFrame.java =================================================================== --- trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-12-04 00:16:10 UTC (rev 872) +++ trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-12-04 00:19:41 UTC (rev 873) @@ -170,8 +170,8 @@ return view.getHighlightOffset(); } - public void setHotspot(final int dx, final int dy) { - view.setHotspot(dx, dy); + public void setHotspot(final Point point) { + view.setHotspot(point); } public void printFullImage(final String filename) throws IOException { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-04 00:21:18
|
Revision: 874 http://svn.sourceforge.net/gridarta/?rev=874&view=rev Author: akirschbaum Date: 2006-12-03 16:21:18 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Replace x/y coordinate by Point. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-04 00:19:41 UTC (rev 873) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-04 00:21:18 UTC (rev 874) @@ -491,9 +491,9 @@ return mapMousePos; } - public void setMapMousePos(final int x, final int y) { - mapMousePos.x = x; - mapMousePos.y = y; + public void setMapMousePos(final Point point) { + mapMousePos.x = point.x; + mapMousePos.y = point.y; } /** The mouse listener for the view. */ Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-04 00:19:41 UTC (rev 873) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-04 00:21:18 UTC (rev 874) @@ -474,13 +474,13 @@ renderTransform.inverseTransform(point, point); } catch (final NoninvertibleTransformException e) { } - mapViewBasic.setMapMousePos(-1, -1); + 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) { - mapViewBasic.setMapMousePos(point.x / 32, point.y / 32); + mapViewBasic.setMapMousePos(new Point(point.x / 32, point.y / 32)); } mpoint.x = mapViewBasic.getMapMousePos().x; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-04 00:28:54
|
Revision: 875 http://svn.sourceforge.net/gridarta/?rev=875&view=rev Author: akirschbaum Date: 2006-12-03 16:28:54 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Replace x/y coordinate by Point. Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-12-04 00:21:18 UTC (rev 874) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-12-04 00:28:54 UTC (rev 875) @@ -189,45 +189,44 @@ * archetype name of the correct arch to be inserted is returned. * This method must be called from the appropriate element of the * AutojoinList, best use the link from the default arch. - * @param x Location of the insert point on the map - * @param y Location of the insert point on the map + * @param point Location of the insert point on the map * @param map Data model of the map - * @return the archetype name of the (default) arch to be inserted at x, y - * <code>null</code> if there's already an arch of this list on x, y + * @return the archetype name of the (default) arch to be inserted at point + * <code>null</code> if there's already an arch of this list on point */ - public String joinInsert(final MapModel map, final int x, final int y) { + public String joinInsert(final MapModel map, final Point point) { int newIndex = 0; // return value, see above - // if there already is an arch of this list at x, y -> abort - if (findArchOfJoinlist(map, x, y) != null) { + // if there already is an arch of this list at point -> abort + if (findArchOfJoinlist(map, point) != null) { return null; // we don't want same arches over each other } // now do the joining in all four directions: GameObject arch; - if (map.isPointValid(new Point(x, y - 1))) { - if ((arch = findArchOfJoinlist(map, x, y - 1)) != null) { + if (map.isPointValid(new Point(point.x, point.y - 1))) { + if ((arch = findArchOfJoinlist(map, new Point(point.x, point.y - 1))) != null) { newIndex = addDir(newIndex, NORTH); connectArch(arch, archnames[addDir(getIndex(arch.getArchetypeName()), SOUTH)]); } } - if (map.isPointValid(new Point(x + 1, y))) { - if ((arch = findArchOfJoinlist(map, x + 1, y)) != null) { + if (map.isPointValid(new Point(point.x + 1, point.y))) { + if ((arch = findArchOfJoinlist(map, new Point(point.x + 1, point.y))) != null) { newIndex = addDir(newIndex, EAST); connectArch(arch, archnames[addDir(getIndex(arch.getArchetypeName()), WEST)]); } } - if (map.isPointValid(new Point(x, y + 1))) { - if ((arch = findArchOfJoinlist(map, x, y + 1)) != null) { + if (map.isPointValid(new Point(point.x, point.y + 1))) { + if ((arch = findArchOfJoinlist(map, new Point(point.x, point.y + 1))) != null) { newIndex = addDir(newIndex, SOUTH); connectArch(arch, archnames[addDir(getIndex(arch.getArchetypeName()), NORTH)]); } } - if (map.isPointValid(new Point(x - 1, y))) { - if ((arch = findArchOfJoinlist(map, x - 1, y)) != null) { + if (map.isPointValid(new Point(point.x - 1, point.y))) { + if ((arch = findArchOfJoinlist(map, new Point(point.x - 1, point.y))) != null) { newIndex = addDir(newIndex, WEST); connectArch(arch, archnames[addDir(getIndex(arch.getArchetypeName()), EAST)]); } @@ -241,34 +240,33 @@ * All arches around the insert point get adjusted. * This method must be called from the appropriate element of the * AutojoinList, best use the link from the default arch. - * @param x Location of the insert point on the map - * @param y Location of the insert point on the map + * @param point Location of the insert point on the map * @param map Data model of the map */ - public void joinDelete(final MapModel map, final int x, final int y) { + public void joinDelete(final MapModel map, final Point point) { GameObject arch; // temp. arch // do the joining in all four directions: - if (map.isPointValid(new Point(x, y - 1))) { - if ((arch = findArchOfJoinlist(map, x, y - 1)) != null) { + if (map.isPointValid(new Point(point.x, point.y - 1))) { + if ((arch = findArchOfJoinlist(map, new Point(point.x, point.y - 1))) != null) { connectArch(arch, archnames[removeDir(getIndex(arch.getArchetypeName()), SOUTH)]); } } - if (map.isPointValid(new Point(x + 1, y))) { - if ((arch = findArchOfJoinlist(map, x + 1, y)) != null) { + if (map.isPointValid(new Point(point.x + 1, point.y))) { + if ((arch = findArchOfJoinlist(map, new Point(point.x + 1, point.y))) != null) { connectArch(arch, archnames[removeDir(getIndex(arch.getArchetypeName()), WEST)]); } } - if (map.isPointValid(new Point(x, y + 1))) { - if ((arch = findArchOfJoinlist(map, x, y + 1)) != null) { + if (map.isPointValid(new Point(point.x, point.y + 1))) { + if ((arch = findArchOfJoinlist(map, new Point(point.x, point.y + 1))) != null) { connectArch(arch, archnames[removeDir(getIndex(arch.getArchetypeName()), NORTH)]); } } - if (map.isPointValid(new Point(x - 1, y))) { - if ((arch = findArchOfJoinlist(map, x - 1, y)) != null) { + if (map.isPointValid(new Point(point.x - 1, point.y))) { + if ((arch = findArchOfJoinlist(map, new Point(point.x - 1, point.y))) != null) { connectArch(arch, archnames[removeDir(getIndex(arch.getArchetypeName()), EAST)]); } } @@ -323,16 +321,15 @@ } /** - * Looks for an arch at map-position (x, y) which is part + * Looks for an arch at map-position point which is part * of this AutojoinList. * @param map the data model of the map - * @param x location to search - * @param y location to search + * @param point location to search * @return arch which is part of this joinlist, null if no such arch exists */ - @Nullable private GameObject findArchOfJoinlist(final MapModel map, final int x, final int y) { + @Nullable private GameObject findArchOfJoinlist(final MapModel map, final Point point) { // we look through the arches at the given location (top to bottom): - for (final GameObject tmpArch : map.getMapSquare(new Point(x, y)).reverse()) { + for (final GameObject tmpArch : map.getMapSquare(point).reverse()) { if (stack.getArchetype(tmpArch.getArchetypeName()).getJoinList() == this) { return tmpArch; // we found an arch } Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-04 00:21:18 UTC (rev 874) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-04 00:28:54 UTC (rev 875) @@ -246,7 +246,7 @@ if (mainControl.getAutojoin() && join == JOIN_ENABLE && mainControl.getJoinlist() != null && newarch.getJoinList() != null && !newarch.isMulti()) { // do autojoining if enabled - archName = newarch.getJoinList().joinInsert(this, pos.x, pos.y); + archName = newarch.getJoinList().joinInsert(this, pos); if (archName == null) { return false; // only one autojoin type per square allowed } @@ -475,7 +475,7 @@ if (mainControl.getAutojoin() && join == JOIN_ENABLE && mainControl.getJoinlist() != null && temp.getJoinList() != null && !temp.isMulti()) { // remove connections to the deleted arch - temp.getJoinList().joinDelete(this, pos.x, pos.y); + temp.getJoinList().joinDelete(this, pos); } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-04 19:48:43
|
Revision: 884 http://svn.sourceforge.net/gridarta/?rev=884&view=rev Author: akirschbaum Date: 2006-12-04 11:48:44 -0800 (Mon, 04 Dec 2006) Log Message: ----------- Rename method name. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java trunk/crossfire/src/cfeditor/map/MapControl.java Modified: trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2006-12-04 19:47:17 UTC (rev 883) +++ trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2006-12-04 19:48:44 UTC (rev 884) @@ -419,7 +419,7 @@ } // if the mapsize has been modified, see if we should ask for a confirm - if (!mapControl.isCutoffSave(mapSize)) { + if (!mapControl.isCutoffSafe(mapSize)) { if (!askConfirmResize(mapSize)) { // resizing has been cancelled mapSize = mapControl.getMapSize(); Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-04 19:47:17 UTC (rev 883) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-04 19:48:44 UTC (rev 884) @@ -363,7 +363,7 @@ return mapModel.isPointValid(pos); } - public boolean isCutoffSave(final Size2D size) { + public boolean isCutoffSafe(final Size2D size) { return mapModel.isCutoffSafe(size); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-04 21:43:44
|
Revision: 887 http://svn.sourceforge.net/gridarta/?rev=887&view=rev Author: akirschbaum Date: 2006-12-04 13:43:43 -0800 (Mon, 04 Dec 2006) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/JFontChooser.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-04 21:36:45 UTC (rev 886) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-04 21:43:43 UTC (rev 887) @@ -499,10 +499,6 @@ return ".py"; } - public String msgToHtml(final String msg) { - return JFontChooser.msgToHtml(msg, null); - } - boolean addArchToMap(final String archname, final Point pos, final boolean allowDouble, final boolean join) { return currentMap.addArchToMap(archname, pos, allowDouble, join); } Deleted: trunk/crossfire/src/cfeditor/JFontChooser.java =================================================================== --- trunk/crossfire/src/cfeditor/JFontChooser.java 2006-12-04 21:36:45 UTC (rev 886) +++ trunk/crossfire/src/cfeditor/JFontChooser.java 2006-12-04 21:43:43 UTC (rev 887) @@ -1,387 +0,0 @@ -/* JFontChooser.java - * - * Copyright (C) 1998-2001, The University of Sheffield. - * Copyright (C) 2002, Andreas Vogl - * - * This file is based on a part of GATE (see http://gate.ac.uk/), which is - * free software, licenced under the GNU Library General Public License, - * Version 2, June 1991 (in the distribution as file licence.html, - * and also available at http://gate.ac.uk/gate/licence.html). - * - * Valentin Tablan 06/04/2001 - * - * $Id: JFontChooser.java,v 1.23 2006/03/26 00:48:56 akirschbaum Exp $ - * - */ - -package cfeditor; - -import java.awt.Component; -import java.awt.Dialog; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Frame; -import java.awt.GraphicsEnvironment; -import java.awt.GridLayout; -import java.awt.Window; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; -import java.awt.font.TextAttribute; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JTextArea; -import javax.swing.SwingUtilities; -import javax.swing.UIManager; -import javax.swing.plaf.FontUIResource; -import org.apache.log4j.Logger; - -/** - * Class for choosing Fonts - * @author University of Sheffield - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - */ -public final class JFontChooser extends JPanel { - - private static final Logger log = Logger.getLogger(JFontChooser.class); - - private static final Font defaultFont = new Font("Default", Font.PLAIN, 12); - - // GUI components: - private JComboBox familyCombo; - - private JCheckBox italicChk; - - private JCheckBox boldChk; - - private JComboBox sizeCombo; - - private JTextArea sampleTextArea; - - private Font fontValue; - - private static final long serialVersionUID = 1L; - - public JFontChooser() { - this(UIManager.getFont("Button.font")); - } - - public JFontChooser(final Font initialFont) { - initLocalData(); - initGuiComponents(initialFont); - initListeners(); - setFontValue(initialFont); - }// public JFontChooser(Font initialFont) - - /** - * Show Fontdialog, let user choose a font, then close and return chosen font.<br> - * This is a static method. Use it like:<br><br> - * <code> - * Font f = JFontChooser.showDialog(parent, "title", defaultFont); - * </code> - * @param parent parent Component - * @param title frame title - * @param initialfont initial/default font - * @return new font that the user has chosen - */ - public static Font showDialog(final Component parent, final String title, final Font initialfont) { - final Window windowParent; - if (parent instanceof Window) { - windowParent = (Window) parent; - } else { - windowParent = SwingUtilities.getWindowAncestor(parent); - } - if (windowParent == null) { - throw new IllegalArgumentException("The supplied parent component has no window ancestor"); - } - - final JDialog dialog; - if (windowParent instanceof Frame) { - dialog = new JDialog((Frame) windowParent, title, true); - } else { - dialog = new JDialog((Dialog) windowParent, title, true); - } - - dialog.getContentPane().setLayout(new BoxLayout(dialog.getContentPane(), - BoxLayout.Y_AXIS)); - - final JFontChooser fontChooser = new JFontChooser(initialfont); - dialog.getContentPane().add(fontChooser); - - // buttons - final JButton okBtn = new JButton("OK"); - final JButton defaultBtn = new JButton("Default"); - final JPanel buttonsBox = new JPanel(); - buttonsBox.setLayout(new BoxLayout(buttonsBox, BoxLayout.X_AXIS)); - buttonsBox.add(Box.createHorizontalGlue()); - buttonsBox.add(defaultBtn); - buttonsBox.add(Box.createHorizontalStrut(30)); - buttonsBox.add(okBtn); - buttonsBox.add(Box.createHorizontalGlue()); - buttonsBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); - dialog.getContentPane().add(buttonsBox); - - dialog.pack(); - dialog.setLocationRelativeTo(parent); - - // actionlistener for the font choose-box - fontChooser.addComponentListener(new ComponentAdapter() { - @Override public void componentResized(final ComponentEvent e) { - dialog.pack(); - } - }); - - // actionlistener for the ok-button - okBtn.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - dialog.setVisible(false); // dialog remains hidden till next time needed - } - }); - - // actionlistener for the cancel-button - defaultBtn.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - dialog.setVisible(false); - fontChooser.setFontValue(null); - } - }); - - dialog.setVisible(true); - - return fontChooser.getFontValue(); - } // showDialog - - protected void initLocalData() { - } - - /** initialize the GUI components */ - protected void initGuiComponents(final Font initfont) { - // container panel, containing the whole GUI - final JPanel panel = new JPanel(); - panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); - - familyCombo = new JComboBox( - GraphicsEnvironment.getLocalGraphicsEnvironment(). - getAvailableFontFamilyNames()); - familyCombo.setSelectedItem(UIManager.getFont("Label.font").getFamily()); - - sizeCombo = new JComboBox(new String[]{"6", "8", "10", "12", "14", "16", - "18", "20", "22", "24", "26"}); - sizeCombo.setSelectedItem(new Integer( - UIManager.getFont("Label.font").getSize()).toString()); - - italicChk = new JCheckBox("<html><i>Italic</i></html>", false); - boldChk = new JCheckBox("<html><b>Bold</b></html>", false); - - // font-box panel - final JPanel fontBox = new JPanel(); - fontBox.setLayout(new BoxLayout(fontBox, BoxLayout.X_AXIS)); - fontBox.add(familyCombo); - fontBox.add(sizeCombo); - fontBox.setBorder(BorderFactory.createTitledBorder(" Font ")); - panel.add(fontBox); - panel.add(Box.createVerticalStrut(10)); - - // bold/italic panel - final JPanel effectsBox = new JPanel(); - effectsBox.setLayout(new BoxLayout(effectsBox, BoxLayout.X_AXIS)); - effectsBox.add(italicChk); - effectsBox.add(boldChk); - effectsBox.setBorder(BorderFactory.createTitledBorder(" Effects ")); - panel.add(effectsBox); - - // sample panel - sampleTextArea = new JTextArea("Type your sample here..."); - final JPanel samplePanel = new JPanel(new GridLayout(1, 1)); - - samplePanel.add(sampleTextArea); - - samplePanel.setBorder(BorderFactory.createTitledBorder(" Sample ")); - panel.add(samplePanel); - panel.add(Box.createVerticalStrut(10)); - - // add a small border around the whole thing - panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); - add(panel); - }// initGuiComponents() - - /** initialize the listeners */ - protected void initListeners() { - familyCombo.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - updateFont(); - } - }); - - sizeCombo.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - updateFont(); - } - }); - - boldChk.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - updateFont(); - } - }); - - italicChk.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - updateFont(); - } - }); - } - - protected void updateFont() { - final Map<TextAttribute, Object> fontAttrs = new HashMap<TextAttribute, Object>(); - fontAttrs.put(TextAttribute.FAMILY, (String) familyCombo.getSelectedItem()); - fontAttrs.put(TextAttribute.SIZE, new Float((String) sizeCombo.getSelectedItem())); - - if (boldChk.isSelected()) { - fontAttrs.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); - } else { - fontAttrs.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_REGULAR); - } - - if (italicChk.isSelected()) { - fontAttrs.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE); - } else { - fontAttrs.put(TextAttribute.POSTURE, TextAttribute.POSTURE_REGULAR); - } - - final Font newFont = new Font(fontAttrs); - final Font oldFont = fontValue; - fontValue = newFont; - sampleTextArea.setFont(newFont); - final String text = sampleTextArea.getText(); - sampleTextArea.setText(""); - sampleTextArea.setText(text); - sampleTextArea.repaint(100); - - firePropertyChange("fontValue", oldFont, newFont); - }//updateFont() - - /** Test code */ - public static void main(final String args[]) { - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (final Exception e) { - e.printStackTrace(); - } - final JFrame frame = new JFrame("Foo frame"); - frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - final JButton btn = new JButton("Show dialog"); - btn.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - log.info(showDialog(frame, "Fonter", UIManager.getFont("Button.font"))); - } - }); - frame.getContentPane().add(btn); - frame.setSize(new Dimension(300, 300)); - frame.setVisible(true); - log.info("Font: " + UIManager.getFont("Button.font")); - showDialog(frame, "Fonter", UIManager.getFont("Button.font")); - }// main - - /** - * Set selected font - * @param newfontValue new font - */ - public void setFontValue(final Font newfontValue) { - if (newfontValue != null) { - boldChk.setSelected(newfontValue.isBold()); - italicChk.setSelected(newfontValue.isItalic()); - familyCombo.setSelectedItem(newfontValue.getName()); - sizeCombo.setSelectedItem(Integer.toString(newfontValue.getSize())); - } - this.fontValue = newfontValue; - } - - /** Convert fontsize into the htmal size which is most appropriate. */ - public static int getHtmlSize(final int fontsize) { - if (fontsize <= 11) { - return 1; - } else if (fontsize <= 13) { - return 2; - } else if (fontsize <= 17) { - return 3; - } else if (fontsize <= 21) { - return 4; - } else { - return 5; - } - } - - /** - * Convert a text-string message into a message with html (font) tags to - * display in message-window-popups. (This is currently not used.) - * @param msg the ascii message text with '\n' linebreaks - * @param f the custom font used, or null for default - * @return the new message with html tags - */ - public static String msgToHtml(String msg, final Font f) { - if (f == null) { // default font needs no tags to display - return msg; - } - - int t; // temp. value - while ((t = msg.indexOf("<")) >= 0) { - msg = msg.substring(0, t) + "<" + msg.substring(t + 1); - } - while ((t = msg.indexOf(">")) >= 0) { - msg = msg.substring(0, t) + ">" + msg.substring(t + 1); - } - - String new_msg = ""; // return value: new message with html tags - while (msg.indexOf("\n") >= 0) { - new_msg = new_msg + "<html><font color=black size=\"" + getHtmlSize(f.getSize()) + - "\" face=\"" + f.getFontName() + "\"><b>" + msg.substring(0, msg.indexOf("\n")) + "</b></font></html>§"; - msg = msg.substring(msg.indexOf("\n") + 1); - } - new_msg = new_msg + "<html><font color=black size=\"" + getHtmlSize(f.getSize()) + - "\" face=\"" + f.getFontName() + "\"><b>" + msg + "</b></font></html>"; - - new_msg = new_msg.replace('§', '\n'); - return new_msg; - } - - /** Set the default font for all Swing components. */ - public static void setUIFont(final Font new_font) { - final FontUIResource plainf = new FontUIResource( - new_font.getFontName(), Font.PLAIN, new_font.getSize()); - final FontUIResource boldf = new FontUIResource( - new_font.getFontName(), Font.BOLD, new_font.getSize()); - - final Enumeration keys = UIManager.getDefaults().keys(); - while (keys.hasMoreElements()) { - final Object key = keys.nextElement(); - final Object value = UIManager.get(key); - if (value instanceof FontUIResource) { - if (((FontUIResource) value).getStyle() == Font.PLAIN) { - UIManager.put(key, plainf); - } else if (((FontUIResource) value).getStyle() == Font.BOLD) { - UIManager.put(key, boldf); - } - } - } - } - - public Font getFontValue() { - return fontValue; - } - - public static Font getDefaultFont() { - return defaultFont; - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-04 21:54:21
|
Revision: 888 http://svn.sourceforge.net/gridarta/?rev=888&view=rev Author: akirschbaum Date: 2006-12-04 13:54:21 -0800 (Mon, 04 Dec 2006) Log Message: ----------- Unify main exception handler. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-04 21:43:43 UTC (rev 887) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-04 21:54:21 UTC (rev 888) @@ -37,7 +37,6 @@ import cfeditor.map.MapModel; import java.awt.Point; import java.awt.Rectangle; -import java.awt.Toolkit; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; @@ -60,6 +59,7 @@ import net.sf.gridarta.map.MapType; import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import net.sf.japi.swing.ActionFactory; +import net.sf.japi.util.ThrowableHandler; import net.sf.japi.util.filter.file.EndingFileFilter; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -70,7 +70,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public final class CMainControl implements MainControl { +public final class CMainControl implements ThrowableHandler, MainControl { /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); @@ -1655,9 +1655,9 @@ noarchTileIcon = CGUIUtils.getSysIcon(IGUIConstants.TILE_NOARCH); } - public void handleErrors(final GridderException error) { - Toolkit.getDefaultToolkit().beep(); - mainView.showError(error); + /** {@inheritDoc} */ + public void handleThrowable(final Throwable t) { + mainView.handleThrowable(t); } /** Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-12-04 21:43:43 UTC (rev 887) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-12-04 21:54:21 UTC (rev 888) @@ -546,12 +546,14 @@ return null; } - /** - * Shows the given error in the UI. - * @param error The error to be shown. + + /* + * {@inheritDoc} + * This implementation displays the exception in a modal message dialog. */ - void showError(final GridderException error) { - JOptionPane.showConfirmDialog(this, error.getMessage(), IGUIConstants.APP_NAME, JOptionPane.OK_OPTION, JOptionPane.WARNING_MESSAGE); + public void handleThrowable(final Throwable t) { + Toolkit.getDefaultToolkit().beep(); + JOptionPane.showMessageDialog(this, t.getMessage(), "Error", JOptionPane.WARNING_MESSAGE); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-12-05 19:20:22
|
Revision: 897 http://svn.sourceforge.net/gridarta/?rev=897&view=rev Author: christianhujer Date: 2006-12-05 11:20:17 -0800 (Tue, 05 Dec 2006) Log Message: ----------- Fixed Javadoc bugs. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/CResourceLoader.java trunk/crossfire/src/cfeditor/CScriptController.java trunk/crossfire/src/cfeditor/CScriptModel.java trunk/crossfire/src/cfeditor/CSettings.java trunk/crossfire/src/cfeditor/CStartupScreen.java trunk/crossfire/src/cfeditor/ExitTypes.java trunk/crossfire/src/cfeditor/IGUIConstants.java trunk/crossfire/src/cfeditor/JarResources.java trunk/crossfire/src/cfeditor/MapViewIFrame.java trunk/crossfire/src/cfeditor/MultiPositionData.java trunk/crossfire/src/cfeditor/PluginParameter.java trunk/crossfire/src/cfeditor/PluginParameterFactory.java trunk/crossfire/src/cfeditor/PluginParameterView.java trunk/crossfire/src/cfeditor/ReplaceDialog.java trunk/crossfire/src/cfeditor/ScriptArchData.java Modified: trunk/crossfire/src/cfeditor/CPickmapPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-12-05 19:20:17 UTC (rev 897) @@ -36,7 +36,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import javax.swing.JOptionPane; import javax.swing.JTabbedPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -216,6 +215,7 @@ * Add a new pickmap. * @param objects list of objects or <code>null</code> for empty * @param maparch the maparch of the pickmap + * @param mapFile The map file that's stored in the MapControl. * @return basic mapview */ private CMapViewBasic newPickmap(final List<GameObject> objects, final MapArchObject maparch, final File mapFile) { @@ -259,7 +259,7 @@ } /** - * Set pickmap with given name to be the active one (ontop) + * Set pickmap with given name to be the active one (ontop). * @param name map name (which is also the tab title) */ public void setActivePickmap(final String name) { @@ -269,7 +269,7 @@ } } - /** update info which pickmap is currently on top */ + /** Update info which pickmap is currently on top. */ private void updateActivePickmap() { if (tabpane == null) { @@ -301,7 +301,7 @@ } /** - * Add the PickmapSelectionListener to the pickmap tabbed panel + * Add the PickmapSelectionListener to the pickmap tabbed panel. * @param pickpane the panel with pickmaps * @todo this method's name is a Bad Thing */ @@ -321,7 +321,7 @@ // ------------------------ nested and inner classes ------------------------ - /** listener class to keep track of the currently active pickmap */ + /** Listener class to keep track of the currently active pickmap. */ private final class PickmapSelectionListener implements ChangeListener { private final String activePickmap; // file-name of active pickmap @@ -355,7 +355,7 @@ private int selectedIndex; // current state of selection /** - * Constructor + * Create a new ArchNPickChangeListener. * @param mainView the main view * @param pane the JTabbedPane containing both archlist and pickmaps */ Modified: trunk/crossfire/src/cfeditor/CResourceLoader.java =================================================================== --- trunk/crossfire/src/cfeditor/CResourceLoader.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/CResourceLoader.java 2006-12-05 19:20:17 UTC (rev 897) @@ -18,34 +18,34 @@ import org.jdom.input.SAXBuilder; /** + * Loader for loading resources from various locations. + * Used to load resources from various locations. + * Given a relative filename, this looks for the given + * file in the following order: + * - current directory + * - home directory + * - JAR ressource + * It is also able to write the ressource. If ressource was loaded + * from current directory or home directory, it is written at same + * place (if not read only). If the ressource was loaded from JAR, it + * is written to the home directory. You can also explicitly choose + * where to load/save using the LOCATION_xxx constants * @author tchize - * <p/> - * Used to load resources from various locations. - * Given a relative filename, this looks for the given - * file in the following order: - * - current directory - * - home directory - * - JAR ressource - * It is also able to write the ressource. If ressource was loaded - * from current directory or home directory, it is written at same - * place (if not read only). If the ressource was loaded from JAR, it - * is written to the home directory. You can also explicitly choose - * where to load/save using the LOCATION_xxx constants */ public final class CResourceLoader { private static final Logger log = Logger.getLogger(CResourceLoader.class); - /** The current working directory location */ + /** The current working directory location. */ public static final int LOCATION_CURRENT = 1; - /** The user's home directory location */ + /** The user's home directory location. */ public static final int LOCATION_HOME = 2; - /** The JAR ressources */ + /** The JAR ressources. */ public static final int LOCATION_JAR = 3; - /** The Unknown */ + /** The Unknown. */ public static final int LOCATION_UNKNOWN = 0; private int type; @@ -191,6 +191,7 @@ } /** + * Returns an aggregated XML document from the supplied parameters. * @param filename The ressource name to load * @param readCurrent read from current directory * @param readHome read from home/cfeditor directory Modified: trunk/crossfire/src/cfeditor/CScriptController.java =================================================================== --- trunk/crossfire/src/cfeditor/CScriptController.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/CScriptController.java 2006-12-05 19:20:17 UTC (rev 897) @@ -37,10 +37,9 @@ import org.jetbrains.annotations.Nullable; /** + * Controller for Scripts. + * @todo documentation * @author tchize - * <p/> - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments */ public final class CScriptController { Modified: trunk/crossfire/src/cfeditor/CScriptModel.java =================================================================== --- trunk/crossfire/src/cfeditor/CScriptModel.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/CScriptModel.java 2006-12-05 19:20:17 UTC (rev 897) @@ -20,10 +20,9 @@ import org.jetbrains.annotations.Nullable; /** + * Model for Scripts. + * @todo documentation * @author tchize - * <p/> - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments */ public final class CScriptModel { @@ -99,23 +98,37 @@ } } - /** @return Returns the name. */ + /** + * Returns the name of this ScriptModel. + * @return The name of this ScriptModel. + */ public String getName() { return name; } - /** @param name The name to set. */ + /** + * Sets the name of this ScriptModel. + * @param name The name of this ScriptModel. + * @todo Maybe this should be moved to the constructor and the underlying field made final. + */ public void setName(final String name) { this.name = name; notifyListeners(); } - /** @return Returns the code. */ + /** + * Returns the code of this ScriptModel. + * @return The code of this ScriptModel. + * @todo Improve name - what code is it? Source code? A special coded String? + */ public String getCode() { return code; } - /** @param code The code to set. */ + /** + * Sets the code of this ScriptModel. + * @param code The code of this ScriptModel. + */ public void setCode(final String code) { this.code = code; notifyListeners(); @@ -148,8 +161,9 @@ } /** + * Returns the parameter description for the parameter with the specified index. * @param index the parameter index to get - * @return Returns the description of a parameter. + * @return The description of the specified parameter. */ @Nullable public String getParamDescription(final int index) { try { @@ -160,14 +174,16 @@ } /** + * Returns the parameter description for the parameter with the specified name. * @param name the parameter name to get - * @return Returns the description of a parameter. + * @return The description of the specified parameter. */ public String getParamDescription(final String name) { return getParamDescription(locateParam(name)); } /** + * Sets the parameter description for the parameter with the specified index. * @param index the parameter index to set * @param description the new description of parameter */ @@ -180,6 +196,7 @@ } /** + * Sets the parameter description for the parameter with the specified name. * @param name the parameter name to set * @param description the new description of parameter */ @@ -188,6 +205,7 @@ } /** + * Returns the parameter value for the parameter with the specified index. * @param index the parameter index to get * @return Returns the parameter default value. */ @@ -202,6 +220,7 @@ } /** + * Returns the parameter value for the parameter with the specified name. * @param name the parameter name to get * @return Returns the parameter value. */ @@ -210,6 +229,7 @@ } /** + * Sets the parameter value for the parameter with the specified index. * @param index the parameter index to set * @param value the default value to set */ @@ -222,6 +242,7 @@ } /** + * Sets the parameter value for the parameter with the specified name. * @param name the argument name to set * @param value the value to set */ Modified: trunk/crossfire/src/cfeditor/CSettings.java =================================================================== --- trunk/crossfire/src/cfeditor/CSettings.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/CSettings.java 2006-12-05 19:20:17 UTC (rev 897) @@ -79,7 +79,7 @@ * load settings. Default the location to the users home directory * (user.home) and a subdirectory called .cfeditor to follow the unix * standard configuration for resource files. - * @param strFile + * @param strFile file name to read the configuration from. */ private CSettings(final String strFile) { this.strFile = CResourceLoader.getHomeFileName(strFile); @@ -117,6 +117,7 @@ * Searches for the property with the specified key in this * property * list. The method returns <code>null</code> if the * property is not found. * @param strKey The key that identifies the property. + * @return Property value for the named key. */ public synchronized String getProperty(final String strKey) { return properties.getProperty(strKey); @@ -128,6 +129,7 @@ * found and adds the default value with the key to properties. * @param strKey the key that identifies the property * @param strDefaultValue the default value to use + * @return Property value for the named key or <var>strDefaultValue</var> if the property is not set. */ public synchronized String getProperty(final String strKey, final String strDefaultValue) { final String strValue = properties.getProperty(strKey); Modified: trunk/crossfire/src/cfeditor/CStartupScreen.java =================================================================== --- trunk/crossfire/src/cfeditor/CStartupScreen.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/CStartupScreen.java 2006-12-05 19:20:17 UTC (rev 897) @@ -56,7 +56,9 @@ private static final long serialVersionUID = 1L; - /** Constructs and shows a startup screen. */ + /** Constructs and shows a startup screen. + * @param parentFrame parent frame to display the screen on. + */ public CStartupScreen(final Frame parentFrame) { super(parentFrame); Modified: trunk/crossfire/src/cfeditor/ExitTypes.java =================================================================== --- trunk/crossfire/src/cfeditor/ExitTypes.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/ExitTypes.java 2006-12-05 19:20:17 UTC (rev 897) @@ -27,7 +27,11 @@ private ExitTypes() { } - /** Determine whether a given GameObject is an "exit". */ + /** + * Determine whether a given GameObject is an "exit". + * @param exit Object to check for being an exit. + * @return <code>true</code> if <var>exit</var> is an exit, otherwise <code>false</code>. + */ public static boolean contains(final GameObject exit) { if (exit == null) { throw new IllegalArgumentException(); Modified: trunk/crossfire/src/cfeditor/IGUIConstants.java =================================================================== --- trunk/crossfire/src/cfeditor/IGUIConstants.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/IGUIConstants.java 2006-12-05 19:20:17 UTC (rev 897) @@ -39,15 +39,15 @@ public interface IGUIConstants { /** - * Version number of the CFJavaEditor <br> - * should be increased when a certain amount of changes happened + * Version number of the CFJavaEditor. + * Should be increased when a certain amount of changes happened. */ String VERSION = "0.986"; /** - * Internal version number of the included online-documentation <br> - * increasing the number causes an automated popup of the docu - * when users upgrade their editor and run for the first time + * Internal version number of the included online-documentation. + * Increasing the number causes an automated popup of the docu + * when users upgrade their editor and run for the first time. */ int DOCU_VERSION = 2; Modified: trunk/crossfire/src/cfeditor/JarResources.java =================================================================== --- trunk/crossfire/src/cfeditor/JarResources.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/JarResources.java 2006-12-05 19:20:17 UTC (rev 897) @@ -164,6 +164,7 @@ /** * Dumps a zip entry into a string. * @param ze a ZipEntry + * @return String with information on the supplied ZipEntry. */ private String dumpZipEntry(final ZipEntry ze) { final StringBuffer sb = new StringBuffer(); @@ -202,6 +203,8 @@ * JR.getResources("logo.gif")); * ... * </pre> + * @param args Command line parameters + * @throws IOException In case of I/O problems. */ public static void main(final String[] args) throws IOException { if (args.length != 2) { Modified: trunk/crossfire/src/cfeditor/MapViewIFrame.java =================================================================== --- trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-12-05 19:20:17 UTC (rev 897) @@ -93,7 +93,7 @@ return view; } - /** Update the Map-Window Title (according to name and changeFlag) */ + /** Update the Map-Window Title (according to name and changeFlag). */ public void updateTitle() { String strTitle = "Map [" + mapControl.getMapFileName() + "]"; Modified: trunk/crossfire/src/cfeditor/MultiPositionData.java =================================================================== --- trunk/crossfire/src/cfeditor/MultiPositionData.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/MultiPositionData.java 2006-12-05 19:20:17 UTC (rev 897) @@ -42,17 +42,18 @@ private static final Logger log = Logger.getLogger(MultiPositionData.class); - /** number of rows and columns in the array */ + /** Number of rows and columns in the array. */ public static final int X_DIM = 34; + /** Number of rows and columns in the array. */ public static final int Y_DIM = 16; private static MultiPositionData instance = null; - /** array with position data */ + /** Array with position data. */ private final int[][] data; - /** private constructor: initialize array */ + /** Private constructor: initialize array. */ private MultiPositionData() { data = new int[Y_DIM][X_DIM]; } Modified: trunk/crossfire/src/cfeditor/PluginParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/PluginParameter.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/PluginParameter.java 2006-12-05 19:20:17 UTC (rev 897) @@ -14,10 +14,8 @@ import org.jdom.Element; /** + * Parameter for a Plugin. * @author tchize - * <p/> - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments */ public abstract class PluginParameter { Modified: trunk/crossfire/src/cfeditor/PluginParameterFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/PluginParameterFactory.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/PluginParameterFactory.java 2006-12-05 19:20:17 UTC (rev 897) @@ -20,10 +20,8 @@ import org.jetbrains.annotations.Nullable; /** + * Factory for Plugin Parameters. * @author tchize - * <p/> - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments */ public final class PluginParameterFactory { Modified: trunk/crossfire/src/cfeditor/PluginParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/PluginParameterView.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/PluginParameterView.java 2006-12-05 19:20:17 UTC (rev 897) @@ -10,10 +10,8 @@ import javax.swing.JComponent; /** + * Interface for Views that display plugin parameters. * @author tchize - * <p/> - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments */ public interface PluginParameterView { Modified: trunk/crossfire/src/cfeditor/ReplaceDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-12-05 19:20:17 UTC (rev 897) @@ -107,7 +107,10 @@ this.mainControl = mainControl; } - /** @return true when this frame has been fully built */ + /** + * Returns whether this frame has been fully built. + * @return <code>true</code> when if this frame has been fully built, otherwise <code>false</code>. + */ public static boolean isBuilt() { return instance != null && instance.isBuilt; } Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-12-05 19:05:52 UTC (rev 896) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-12-05 19:20:17 UTC (rev 897) @@ -103,7 +103,7 @@ private final List<ScriptedEvent> eventList; // contains list of ScriptedEvents - /** Constructor */ + /** Create a ScriptArchData. */ public ScriptArchData() { eventList = new ArrayList<ScriptedEvent>(); if (eventTypeBox == null) { @@ -300,7 +300,7 @@ } /** - * Try to create a reasonable default script name for lazy users :-) + * Try to create a reasonable default script name for lazy users. * @param archName the best suitable name for the arch (see GameObject.getBestName()) * @return a nice default script name without whitespaces */ @@ -370,6 +370,7 @@ * A popup is opened and the user can create a new scripting event * which gets attached to this arch. * @param panelList JList from the MapArchPanel (script tab) which displays the events + * @param arch GameObject that's name should be used for creating a reasonable default script name. */ public void addEventScript(final JList panelList, final GameObject arch) { final String archName = arch.getBestName(); @@ -595,8 +596,9 @@ } /** + * Returns whether this ScriptArchData is empty (contains no events). * (Note that empty ScriptArchData objects always are removed ASAP) - * @return true when this ScriptArchData contains no events + * @return <code>true</code> if this ScriptArchData contains no events, otherwise <code>false</code>. */ public boolean isEmpty() { return eventList == null || eventList.size() == 0; @@ -614,8 +616,8 @@ private String filePath; // path to scriptfile (can be a relative or absolute path) /** - * Construct a ScriptedEvent of given type (This is used for map-loading) - * @param eventType + * Construct a ScriptedEvent of given type (This is used for map-loading). + * @param eventType Type of the event. */ ScriptedEvent(final String eventType) { this.eventType = eventType; @@ -623,7 +625,13 @@ filePath = null; } - /** Construct a fully initialized ScriptedEvent. */ + /** + * Creates a fully initialized ScriptedEvent. + * @param eventType Type of the event. + * @param pluginName Name of the plugin. + * @param filePath Path the the script. + * @param eventOptions Options for the Event. + */ ScriptedEvent(final String eventType, final String pluginName, final String filePath, final String eventOptions) { this.eventType = eventType; this.pluginName = pluginName; @@ -653,7 +661,10 @@ return true; } - /** @return text for this events, how it is written in a mapfile */ + /** + * Returns the text that has to be written to a map file for this ScriptedEvent. + * @return Event text for the map file. + */ public String getMapArchText() { final StringBuilder buff = new StringBuilder(""); buff.append("event_").append(eventType).append("_plugin ").append(pluginName).append("\n"); @@ -664,7 +675,11 @@ return buff.toString(); } - /** @return a cloned instance of this object */ + /** + * Creates a clone of this object. + * @return Clone of this object. + * @todo instead override {@link Object#clone()}. + */ public ScriptedEvent getClone() { final ScriptedEvent clone = new ScriptedEvent(eventType); clone.pluginName = pluginName; @@ -840,7 +855,7 @@ private ScriptArchData scriptArchData; /** - * Constructor + * Create a PathButtonListener. * @param isOkButton true for ok-buttons * @param frame frame this listener belongs to * @param scriptArchData this is only set for the ok-button of "create new" frame, otherwise null This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-06 08:36:12
|
Revision: 923 http://svn.sourceforge.net/gridarta/?rev=923&view=rev Author: akirschbaum Date: 2006-12-06 00:36:12 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Unify CFTreasureListTree.showDialog(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-06 08:33:31 UTC (rev 922) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-06 08:36:12 UTC (rev 923) @@ -1491,14 +1491,14 @@ private final DialogAttrib<JTextField> strAttr; // attribute structure - private final Component dialog; // reference to this dialog instance + private final CAttribDialog dialog; // reference to this dialog instance /** * Constructor. * @param attr the GUI-string attribute where the treasurelist button belongs to * @param dialog Parent component to show on. */ - private ViewTreasurelistAL(final DialogAttrib<JTextField> attr, final Component dialog) { + private ViewTreasurelistAL(final DialogAttrib<JTextField> attr, final CAttribDialog dialog) { super("treasurelist:"); strAttr = attr; this.dialog = dialog; Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-06 08:33:31 UTC (rev 922) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-06 08:36:12 UTC (rev 923) @@ -51,6 +51,8 @@ import javax.swing.JTextField; import javax.swing.JTree; import javax.swing.JViewport; +import javax.swing.ScrollPaneConstants; +import javax.swing.WindowConstants; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreePath; @@ -464,29 +466,29 @@ * The dialog window is built only ONCE, then hidden/shown as needed. * As a side-effect, only one treasurelist window can be open at a time. * When a second window is opened, the first one gets (re-)moved. + * @param input Textfield to show. * @param parent Parent frame (attribute dialog) - * @param input Textfield to show. */ - public synchronized void showDialog(final JTextField input, final Component parent) { + public synchronized void showDialog(final JTextField input, final CAttribDialog parent) { this.input = input; // set textfield for input/output if (!hasBeenDisplayed) { // open a popup dialog which tmporarily disables all other frames frame = new JDialog(CMainControl.getInstance().getMainView(), "Treasurelists", false); - frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); // click on closebox hides dialog + frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); // click on closebox hides dialog this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5)); final JScrollPane scrollPane = new JScrollPane(this); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); // split display: tree/buttons final JPanel buttonPanel = buildButtonPanel(); final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scrollPane, buttonPanel); splitPane.setOneTouchExpandable(false); - splitPane.setDividerLocation((int) (frame.getHeight() - buttonPanel.getMinimumSize().height - 4)); + splitPane.setDividerLocation(frame.getHeight() - buttonPanel.getMinimumSize().height - 4); splitPane.setDividerSize(4); splitPane.setResizeWeight(1); Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-06 08:33:31 UTC (rev 922) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-06 08:36:12 UTC (rev 923) @@ -59,6 +59,7 @@ import net.sf.gridarta.map.MapType; import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionMethod; import net.sf.japi.util.ThrowableHandler; import net.sf.japi.util.filter.file.EndingFileFilter; import org.apache.log4j.Logger; @@ -289,6 +290,11 @@ collector.start(); } + /** View Treasure Lists. */ + @ActionMethod public void viewTreasurelists() { + CFTreasureListTree.getInstance().showDialog(); + } + private FaceObjects getFaceObjects() { return faceObjects; } 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:11:37
|
Revision: 932 http://svn.sourceforge.net/gridarta/?rev=932&view=rev Author: akirschbaum Date: 2006-12-06 15:11:37 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Unify move tile up/down. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapTileList.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-06 23:03:49 UTC (rev 931) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-06 23:11:37 UTC (rev 932) @@ -257,20 +257,6 @@ } } - void moveTileUp(final GameObject gameObject, final boolean refresh) { - gameObject.moveUp(); - if (refresh) { - refreshCurrentMap(); - } - } - - void moveTileDown(final GameObject gameObject, final boolean refresh) { - gameObject.moveDown(); - if (refresh) { - refreshCurrentMap(); - } - } - /** Collect crossfire archetypes. */ public void collectArches() { if (archetypeSet.getLoadStatus() != ArchetypeSet.LoadStatus.COMPLETE) { Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-12-06 23:03:49 UTC (rev 931) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-12-06 23:11:37 UTC (rev 932) @@ -129,7 +129,11 @@ IGUIConstants.MOVE_DOWN_ICON, new ActionListener() { public void actionPerformed(final ActionEvent event) { - mainControl.moveTileDown(getMapTileSelection(), true); + final GameObject arch = getMapTileSelection(); + if (arch != null) { + arch.moveDown(); + refresh(); + } } }); buttonDown.setVerticalTextPosition(JButton.BOTTOM); @@ -142,7 +146,11 @@ IGUIConstants.MOVE_UP_ICON, new ActionListener() { public void actionPerformed(final ActionEvent event) { - mainControl.moveTileUp(getMapTileSelection(), true); + final GameObject arch = getMapTileSelection(); + if (arch != null) { + arch.moveUp(); + refresh(); + } } }); buttonUp.setVerticalTextPosition(JButton.BOTTOM); 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:17:21
|
Revision: 933 http://svn.sourceforge.net/gridarta/?rev=933&view=rev Author: akirschbaum Date: 2006-12-06 15:17:15 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Remove CMainControl.getArchetype(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-06 23:11:37 UTC (rev 932) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-06 23:17:15 UTC (rev 933) @@ -907,7 +907,7 @@ // normal arch: display the face icon if (CMainControl.getInstance().getArchetypeSet().getLoadStatus() == ArchetypeSet.LoadStatus.COMPLETE) { final String archetypeName = content.getName(); - final GameObject archetype = CMainControl.getInstance().getArchetype(archetypeName); + final GameObject archetype = CMainControl.getInstance().getArchetypeSet().getArchetype(archetypeName); if (archetype != null) { if (!archetype.getFaceFlag()) { setIcon(CMainControl.getInstance().getFace(archetype.getFaceNr())); Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-06 23:11:37 UTC (rev 932) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-06 23:17:15 UTC (rev 933) @@ -350,10 +350,6 @@ mainView.openHelpWindow(); } - public GameObject getArchetype(final String archetypeName) { - return archetypeSet.getArchetype(archetypeName); - } - public CopyBuffer getCopyBuffer() { return copybuffer; } 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-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. |