From: <aki...@us...> - 2006-12-05 21:47:32
|
Revision: 907 http://svn.sourceforge.net/gridarta/?rev=907&view=rev Author: akirschbaum Date: 2006-12-05 13:47:28 -0800 (Tue, 05 Dec 2006) Log Message: ----------- Unify annotations. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/crossfire/src/cfeditor/map/MapArchObject.java trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2006-12-05 21:26:36 UTC (rev 906) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2006-12-05 21:47:28 UTC (rev 907) @@ -168,7 +168,7 @@ /** {@inheritDoc} */ @Nullable - public GameObject parseArchetypeFromStream(final BufferedReader in, @Nullable final GameObject prototype, final String line, final String archName, int index, final String fname) throws IOException { + public GameObject parseArchetypeFromStream(final BufferedReader in, @Nullable final GameObject prototype, @Nullable final String line, @Nullable final String archName, int index, final String fname) throws IOException { // start with new clean GameObject instance GameObject archetype; GameObject archlast = null; Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-05 21:26:36 UTC (rev 906) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-05 21:47:28 UTC (rev 907) @@ -50,6 +50,8 @@ import javax.swing.JComponent; import net.sf.gridarta.Size2D; import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * The component that does the actual rendering of tiles in the palette. @@ -469,7 +471,7 @@ // i'll change it to a fixed point... i want use this for mouse tracking // and don't want have millions of mallocs here // this should be reworked more intelligent later - public Point getTileLocationAt(final Point point) { + @Nullable public Point getTileLocationAt(@NotNull final Point point) { try { renderTransform.inverseTransform(point, point); } catch (final NoninvertibleTransformException e) { Modified: trunk/crossfire/src/cfeditor/map/MapArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-12-05 21:26:36 UTC (rev 906) +++ trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-12-05 21:47:28 UTC (rev 907) @@ -29,6 +29,8 @@ import java.io.IOException; import net.sf.gridarta.Size2D; import net.sf.gridarta.map.AbstractMapArchObject; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * MapArchObject contains the specific meta data about a map that is stored in @@ -182,7 +184,7 @@ return tilePaths[n]; } - public void setTilePath(final int n, final String tilePath) { + public void setTilePath(final int n, @Nullable final String tilePath) { tilePaths[n] = tilePath; } @@ -286,7 +288,7 @@ * Append 'text' to the map text. * @param text string to add */ - public void addText(final String text) { + public void addText(@NotNull final String text) { msgText.append(text); } @@ -305,7 +307,7 @@ } /** @return the maptext */ - public String getText() { + @NotNull public String getText() { return msgText.toString(); } @@ -333,7 +335,7 @@ * otherwise false * @throws IOException in case of I/O problems */ - public boolean parseMapArch(final BufferedReader reader, final String fname) throws IOException { + public boolean parseMapArch(@NotNull final BufferedReader reader, @NotNull final String fname) throws IOException { setFileName(fname); String line2; // input line, includes leading and trailing white space boolean loreflag = false; // flag for lore-text @@ -470,7 +472,7 @@ * @param s the attribute line to be parsed * @return attribute value, zero if value not readable */ - private static int getLineValue(final String s) { + private static int getLineValue(@NotNull final String s) { try { if (s.lastIndexOf(" ") > 0) { return Integer.valueOf(s.substring(s.lastIndexOf(" ") + 1)); @@ -498,7 +500,7 @@ * @throws java.io.FileNotFoundException the mapfile could not be found * @throws IOException an I/O error occured during writing to the file */ - public void writeMapArch(final Appendable appendable) throws IOException { + public void writeMapArch(@NotNull final Appendable appendable) throws IOException { int i; appendable.append("arch map\n"); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-12-05 21:26:36 UTC (rev 906) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-12-05 21:47:28 UTC (rev 907) @@ -1176,7 +1176,7 @@ * @param view only create a view if this is true * @return MapControl of loaded file or <code>null</code> if the file couldn't be opened */ - public MapControl openFile(final File file, final boolean view) { + @Nullable public MapControl openFile(final File file, final boolean view) { // First look whether the file isn't already open. // If so, return the previously loaded map. try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-05 23:07:02
|
Revision: 918 http://svn.sourceforge.net/gridarta/?rev=918&view=rev Author: akirschbaum Date: 2006-12-05 15:07:00 -0800 (Tue, 05 Dec 2006) Log Message: ----------- Unify comments. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/CFTreasureListTree.java Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-05 22:54:42 UTC (rev 917) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-05 23:07:00 UTC (rev 918) @@ -126,7 +126,6 @@ hasBeenDisplayed = false; tListCount = 0; - // draw thin blue lines connecting the nodes putClientProperty("JTree.lineStyle", "Angled"); needSecondLink = new ArrayList<TreasureTreeNode>(); @@ -190,8 +189,8 @@ } /** - * Retruns the singleton instance of this tree. - * @return The singleton instance of this tree. + * Return the singleton instance of this tree. + * @return the singleton instance of this tree */ public static CFTreasureListTree getInstance() { return instance; @@ -207,7 +206,8 @@ /** * Check if a certain treasurelist exists. * @param name Name of a treasurelist - * @return <code>true</code> when the treasurelists with the given name exists, otherwise <code>false</code>. + * @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); @@ -383,8 +383,8 @@ * @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 - TreasureTreeNode node = null; // tmp. treenode + String line; + TreasureTreeNode node = null; boolean insideArch = false; @@ -646,9 +646,10 @@ } /** - * 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. + * Return 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. */ @Nullable private String getSelectedTreasureList() { // return null when nothing is selected @@ -711,8 +712,8 @@ } /** - * Returns a new cloned instance of this object. - * @return A new cloned instance of this object. + * Return a new cloned instance of this object. + * @return a new cloned instance of this object */ public TreasureTreeNode getClone() { // clone this object @@ -799,8 +800,8 @@ /** * Constructor for treasurelist objects. - * @param name Name of this treasure object. - * @param type Type of thsi treasure object. + * @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; @@ -888,7 +889,7 @@ final ImageIcon noarch; // icon for unknown arches /** - * Create a TreasureCellRenderer. + * Create a TreasureCellRenderer: load icons and initialize fonts. */ public TreasureCellRenderer() { // get icons @@ -900,7 +901,7 @@ noarch = cfeditor.CGUIUtils.getSysIcon(IGUIConstants.TILE_NOARCH); } - /** The cell-drawing method. */ + /** {@inheritDoc} */ @Override public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) { // first use the standard renderer to paint it all super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); @@ -964,5 +965,6 @@ return this; } - } -} + } // class TreasureCellRenderer + +} // class CFTreasureListTree Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-05 22:54:42 UTC (rev 917) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-05 23:07:00 UTC (rev 918) @@ -182,7 +182,10 @@ //specialTreasureLists.put("gnome_player_items", playerFolder); } - /** @return static instance of this tree */ + /** + * Return the singleton instance of this tree. + * @return the singleton instance of this tree + */ public static CFTreasureListTree getInstance() { return instance; } @@ -208,9 +211,10 @@ } /** - * 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); @@ -403,13 +407,13 @@ }; /** - * Read and parse the text inside a treasurelist + * Read and parse the text inside a treasurelist. * @param parentNode parent treenode * @param needLink vector containing all sub-treasurelist nodes which need linking */ @SuppressWarnings({"LiteralAsArgToStringEquals"}) private void readInsideList(final TreasureTreeNode parentNode, final BufferedReader reader, final List<TreasureTreeNode> needLink) throws IOException { - TreasureTreeNode node = null; // tmp. treenode + TreasureTreeNode node = null; boolean insideArch = false; @@ -661,9 +665,10 @@ } /** - * @return The name of the currently selected treasurelist. - * If nothing is selected, null is returned. - * treasurelist (e.g. a god-list) + * Return 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. */ @Nullable private String getSelectedTreasureList() { // return null when nothing is selected @@ -708,13 +713,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. + */ 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) */ @@ -722,7 +730,10 @@ this.content = new TreasureObj(name, type); } - /** @return a new cloned instance of this object */ + /** + * Return 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()); @@ -807,6 +818,8 @@ /** * Constructor for treasurelist objects. + * @param name name of this treasure object + * @param type type of thsi treasure object */ TreasureObj(final String name, final int type) { this.type = type; @@ -820,10 +833,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 + " %)"); @@ -892,7 +902,9 @@ final ImageIcon noarch; // icon for unknown arches - /** Constructor: Load icons and initialize fonts */ + /** + * Create a TreasureCellRenderer: load icons and initialize fonts. + */ public TreasureCellRenderer() { // get icons tlistIcon = getSysIcon(IGUIConstants.TILE_TREASURE); @@ -904,8 +916,7 @@ } /** {@inheritDoc} */ - @Override - public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) { + @Override public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) { // first use the standard renderer to paint it all super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-05 23:22:37
|
Revision: 919 http://svn.sourceforge.net/gridarta/?rev=919&view=rev Author: akirschbaum Date: 2006-12-05 15:22:37 -0800 (Tue, 05 Dec 2006) Log Message: ----------- Mutliple small unifications. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/CFTreasureListTree.java Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-05 23:07:00 UTC (rev 918) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-05 23:22:37 UTC (rev 919) @@ -90,16 +90,13 @@ // all syntax-errors encountered during datafile-parsing get written in this log private final StringBuffer errorLog = new StringBuffer(); - private List<TreasureTreeNode> needSecondLink; + private List<TreasureTreeNode> needSecondLink = new ArrayList<TreasureTreeNode>(); - private boolean processSecondLinking; + private boolean processSecondLinking = false; /** JDialog containing the tree. */ private JDialog frame; - // the cell renderer - private final TreasureCellRenderer renderer; - // buttons in the dialog window private JButton okButton; @@ -110,11 +107,11 @@ // the textfield in the attribute dialog where the result gets written to private JTextField input; // input textfield - private int tListCount; // number of treasurelists + private int tListCount = 0; // number of treasurelists - private final boolean isEmpty; // is this tree empty? + private final boolean isEmpty = true; // is this tree empty? - private boolean hasBeenDisplayed; // true when the dialog has been displayed at least once + private boolean hasBeenDisplayed = false; // true when the dialog has been displayed at least once /** * Construct an empty instance of this object. This method is private, @@ -122,18 +119,10 @@ */ private CFTreasureListTree() { super(root); - isEmpty = true; // three is empty - hasBeenDisplayed = false; - tListCount = 0; putClientProperty("JTree.lineStyle", "Angled"); - needSecondLink = new ArrayList<TreasureTreeNode>(); - processSecondLinking = false; - - // set special cell renderer - renderer = new TreasureCellRenderer(); - this.setCellRenderer(renderer); + setCellRenderer(new TreasureCellRenderer()); } /** @@ -153,7 +142,7 @@ * of all treasurelists which are special and belong into a special subfolder. * TODO: It would be nice to read this information from a simple datafile. */ - public synchronized void initSpecialTreasureLists() { + private synchronized void initSpecialTreasureLists() { specialTreasureLists = new HashMap<String, TreasureTreeNode>(); final TreasureTreeNode godFolder = new TreasureTreeNode("God Intervention", TreasureObj.FOLDER); @@ -216,10 +205,8 @@ /** * Parse the treasure-data from the CF file "treasures.txt" into this JTree * instance. This method must be called AFTER arch-loading is complete! - * @return True when parsing succeeded so that at least one treasurelist - * has been parsed. False when there is no data and tree remains empty. */ - private boolean parseTreasures() { + private void parseTreasures() { final List<TreasureTreeNode> tmpList = new ArrayList<TreasureTreeNode>(); // tmp. container for all treasurelists final List<TreasureTreeNode> needLink = new ArrayList<TreasureTreeNode>(); // all sub-treasurelist nodes that need linking treasureTable = new HashMap<String, TreasureTreeNode>(); // hashtable for all treasureTreeNodes @@ -245,8 +232,7 @@ // read this treasurelist till the very end readInsideList(node, reader, needLink); } else { - errorLog.append("After treasurelist " + node.getTreasureObj().getName() - + ": unexpected line:\n\"" + line + "\"\n"); + errorLog.append("After treasurelist ").append(node.getTreasureObj().getName()).append(": unexpected line:\n\"").append(line).append("\"\n"); } } } @@ -324,8 +310,6 @@ // free unused memory specialTreasureLists = null; - - return false; } /** @@ -383,11 +367,11 @@ * @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; TreasureTreeNode node = null; boolean insideArch = false; + String line; while ((line = reader.readLine()) != null && !(line = line.trim()).equals("end")) { if (line.length() > 0 && !line.startsWith("#")) { if (!insideArch) { @@ -405,13 +389,12 @@ // check for potential infinite loops by lists containing itself if (node.getTreasureObj().isTreasureList && parentNode.getTreasureObj().getName().equals(newName)) { node.getTreasureObj().setHasLoop(true); - //errorLog.append("Treasurelist "+parentNode.getTreasureObj().getName()+" contains itself.\n"); + //errorLog.append("Treasurelist ").append(parentNode.getTreasureObj().getName()).append(" contains itself.\n"); } insideArch = true; } else { - errorLog.append("in list " + parentNode.getTreasureObj().getName() - + ": unknown line:\n\"" + line + "\"\n"); + errorLog.append("in list ").append(parentNode.getTreasureObj().getName()).append(": unknown line:\n\"").append(line).append("\"\n"); } } else { // reading inside an arch-section @@ -421,29 +404,25 @@ try { node.getTreasureObj().setChance(Integer.parseInt(line.substring(line.indexOf(" ") + 1).trim())); } catch (final NumberFormatException e) { - errorLog.append("in list " + parentNode.getTreasureObj().getName() + ": arch " - + node.getTreasureObj().getName() + " chance is not a number.\n"); + errorLog.append("in list ").append(parentNode.getTreasureObj().getName()).append(": arch ").append(node.getTreasureObj().getName()).append(" chance is not a number.\n"); } } else if (line.startsWith("nrof")) { try { node.getTreasureObj().setNrof(Integer.parseInt(line.substring(line.indexOf(" ") + 1).trim())); } catch (final NumberFormatException e) { - errorLog.append("in list " + parentNode.getTreasureObj().getName() + ": arch " - + node.getTreasureObj().getName() + " nrof value is not a number.\n"); + errorLog.append("in list ").append(parentNode.getTreasureObj().getName()).append(": arch ").append(node.getTreasureObj().getName()).append(" nrof value is not a number.\n"); } } else if (line.startsWith("magic")) { try { node.getTreasureObj().setMagic(Integer.parseInt(line.substring(line.indexOf(" ") + 1).trim())); } catch (final NumberFormatException e) { - errorLog.append("in list " + parentNode.getTreasureObj().getName() + ": arch " - + node.getTreasureObj().getName() + " magic value is not a number.\n"); + errorLog.append("in list ").append(parentNode.getTreasureObj().getName()).append(": arch ").append(node.getTreasureObj().getName()).append(" magic value is not a number.\n"); } } else if (line.equals("no")) { // if fist arch not generated, process subtree final int chance; if (node.getTreasureObj().getChance() == UNSET) { - errorLog.append("in list " + parentNode.getTreasureObj().getName() + ": arch " - + node.getTreasureObj().getName() + " has NO-list but chance is unset!\n"); + errorLog.append("in list ").append(parentNode.getTreasureObj().getName()).append(": arch ").append(node.getTreasureObj().getName()).append(" has NO-list but chance is unset!\n"); chance = 0; } else { chance = 100 - node.getTreasureObj().getChance(); @@ -464,8 +443,7 @@ // parse this subtree readInsideList(subNode, reader, needLink); } else { - errorLog.append("in list " + parentNode.getTreasureObj().getName() + ", arch " - + node.getTreasureObj().getName() + ": unexpected line:\n\"" + line + "\"\n"); + errorLog.append("in list ").append(parentNode.getTreasureObj().getName()).append(", arch ").append(node.getTreasureObj().getName()).append(": unexpected line:\n\"").append(line).append("\"\n"); } } } @@ -790,8 +768,6 @@ private int chance; // chance value from datafile - private int relativeChance; // relative chance (total is always 100% per list) - private int nrof; // maximum number of generated items private int magic; // maximum magic bonus? @@ -817,8 +793,7 @@ /** {@inheritDoc} */ @Override public String toString() { - return (nrof == UNSET ? "" : nrof + " ") + name + (type == TREASUREONE_LIST ? " [one]" : "") - + (magic == UNSET ? "" : " +" + magic) + (chance == UNSET ? "" : " (" + chance + " %)"); + return (nrof == UNSET ? "" : nrof + " ") + name + (type == TREASUREONE_LIST ? " [one]" : "") + (magic == UNSET ? "" : " +" + magic) + (chance == UNSET ? "" : " (" + chance + " %)"); } // --- GET/SET methods: --- @@ -854,8 +829,8 @@ return hasLoop; } - public void setHasLoop(final boolean state) { - hasLoop = state; + public void setHasLoop(final boolean hasLoop) { + this.hasLoop = hasLoop; } public boolean isTreasureList() { Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-05 23:07:00 UTC (rev 918) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-05 23:22:37 UTC (rev 919) @@ -103,9 +103,9 @@ // all syntax-errors encountered during datafile-parsing get written in this log private final StringBuffer errorLog = new StringBuffer(); - private List<TreasureTreeNode> needSecondLink; + private List<TreasureTreeNode> needSecondLink = new ArrayList<TreasureTreeNode>(); - private boolean processSecondLinking; + private boolean processSecondLinking = false; /** JDialog containing the tree. */ private JDialog frame; @@ -120,11 +120,11 @@ // 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 CAttribDialog parentDialog = null; // parent attr. dialog window (can be null) - private int tListCount; // number of treasurelists + private int tListCount = 0; // number of treasurelists - private boolean hasBeenDisplayed; // true when the dialog has been displayed at least once + private boolean hasBeenDisplayed = false; // true when the dialog has been displayed at least once /** * Construct an empty instance of this object. This method is private, @@ -132,18 +132,10 @@ */ private CFTreasureListTree() { super(root); - hasBeenDisplayed = false; - tListCount = 0; - parentDialog = null; putClientProperty("JTree.lineStyle", "Angled"); - needSecondLink = new ArrayList<TreasureTreeNode>(); - processSecondLinking = false; - - // set special cell renderer - final TreasureCellRenderer renderer = new TreasureCellRenderer(); - this.setCellRenderer(renderer); + setCellRenderer(new TreasureCellRenderer()); } /** @@ -435,7 +427,7 @@ // check for potential infinite loops by lists containing itself if (node.getTreasureObj().isTreasureList && parentNode.getTreasureObj().getName().equals(newName)) { node.getTreasureObj().setHasLoop(true); - //errorLog.append("Treasurelist "+parentNode.getTreasureObj().getName()+" contains itself.\n"); + //errorLog.append("Treasurelist ").append(parentNode.getTreasureObj().getName()).append(" contains itself.\n"); } insideArch = true; @@ -809,7 +801,6 @@ private int chance; // chance value from datafile - //private int relativeChance; // relative chance (total is always 100% per list) private int nrof; // maximum number of generated items private int magic; // maximum magic bonus? @@ -835,8 +826,7 @@ /** {@inheritDoc} */ @Override public String toString() { - return (nrof == UNSET ? "" : nrof + " ") + name + (type == TREASUREONE_LIST ? " [one]" : "") - + (magic == UNSET ? "" : " +" + magic) + (chance == UNSET ? "" : " (" + chance + " %)"); + return (nrof == UNSET ? "" : nrof + " ") + name + (type == TREASUREONE_LIST ? " [one]" : "") + (magic == UNSET ? "" : " +" + magic) + (chance == UNSET ? "" : " (" + chance + " %)"); } // --- GET/SET methods: --- 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:54:04
|
Revision: 924 http://svn.sourceforge.net/gridarta/?rev=924&view=rev Author: akirschbaum Date: 2006-12-06 00:54:03 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Various unifications. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/CFTreasureListTree.java Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-06 08:36:12 UTC (rev 923) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-06 08:54:03 UTC (rev 924) @@ -29,6 +29,7 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; +import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; @@ -37,13 +38,12 @@ import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; -import java.util.Map; import java.util.List; +import java.util.Map; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JDialog; -import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; @@ -62,7 +62,7 @@ import org.jetbrains.annotations.Nullable; /** - * The CFTreasureListTree class fully manages the Crossfire treasurelists. + * The CFTreasureListTree class fully manages treasurelists. * CF datafile "treasures" gets parsed into a JTree structure. * @author Andreas Vogl */ @@ -111,8 +111,6 @@ private int tListCount = 0; // number of treasurelists - private final boolean isEmpty = true; // is this tree empty? - private boolean hasBeenDisplayed = false; // true when the dialog has been displayed at least once /** @@ -250,8 +248,7 @@ // Loop through all treasureone lists and calculate the real ratio // of chances (Summed up to be 100%). Also attach lists to tree model. - for (int i = 0; i < tmpList.size(); i++) { - final TreasureTreeNode realNode = tmpList.get(i); + for (final TreasureTreeNode realNode : tmpList) { if (realNode.getTreasureObj().getType() == TreasureObj.TREASUREONE_LIST) { recalculateChances(realNode); } @@ -265,10 +262,7 @@ } // link the sub-lists first time - for (int i = 0; i < needLink.size(); i++) { - // 'node' is a sub-treasurelist which needs to be linked to it's content - final TreasureTreeNode node = needLink.get(i); - + for (final TreasureTreeNode node : needLink) { // 'realNode' is the real instance of that treasurelist final TreasureTreeNode realNode = treasureTable.get(node.getTreasureObj().getName()); if (realNode != null) { @@ -283,11 +277,7 @@ // do second linking to link all what is left processSecondLinking = true; - final int x = needSecondLink.size(); - for (int i = 0; i < x; i++) { - // 'node' is a sub-treasurelist which needs to be linked to it's content - final TreasureTreeNode node = needSecondLink.get(i); - + for (final TreasureTreeNode node : needSecondLink) { // 'realNode' is the real instance of that treasurelist final TreasureTreeNode realNode = treasureTable.get(node.getTreasureObj().getName()); if (realNode != null) { @@ -319,7 +309,7 @@ * The new chances always sum up to 100% total. * @param listNode node of the treasureone list */ - private void recalculateChances(final TreasureTreeNode listNode) { + private static void recalculateChances(final TreasureTreeNode listNode) { int sumChances = 0; // sum of chances // calculate the sum of all chances @@ -364,8 +354,8 @@ /** * 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. + * @param needLink List containing all sub-treasurelist nodes which need linking * @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 { @@ -579,7 +569,6 @@ okButton = new JButton("Select"); okButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { - // print the currently selected treasurelist into the attribute dialog final String result = getSelectedTreasureList(); if (result != null) { input.setText(" " + result); @@ -678,7 +667,7 @@ * Construct tree node with specified content object. * @param content Treasure object of this node. */ - public TreasureTreeNode(final TreasureObj content) { + TreasureTreeNode(final TreasureObj content) { this.content = content; } @@ -687,7 +676,7 @@ * @param name name of content object * @param type type of content object (see TreasureObj constants) */ - public TreasureTreeNode(final String name, final int type) { + TreasureTreeNode(final String name, final int type) { this.content = new TreasureObj(name, type); } @@ -700,15 +689,13 @@ final TreasureTreeNode clone = new TreasureTreeNode(this.getTreasureObj()); // also clone all children nodes and link them properly - Enumeration clist; // enumeration to loop through children nodes + Enumeration<?> clist; for (clist = children(); clist != null && clist.hasMoreElements();) { clone.add(((TreasureTreeNode) clist.nextElement()).getClone()); } // if this is a list without children it will need second linking - if (!processSecondLinking && getTreasureObj().isTreasureList() && - !getTreasureObj().getName().equalsIgnoreCase("NONE") && - !getTreasureObj().hasLoop()) { + if (!processSecondLinking && getTreasureObj().isTreasureList() && !getTreasureObj().getName().equalsIgnoreCase("NONE") && !getTreasureObj().hasLoop()) { // this is a list, let's see if there are children if (children() == null || !children().hasMoreElements()) { // no children-nodes of any kind, needs second linking @@ -781,7 +768,7 @@ * @param name name of this treasure object * @param type type of thsi treasure object */ - public TreasureObj(final String name, final int type) { + TreasureObj(final String name, final int type) { this.type = type; this.name = name; if (type == TREASURE_LIST || type == TREASUREONE_LIST) { @@ -885,6 +872,7 @@ final DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; + setFont(getFont().deriveFont(Font.PLAIN)); if (node.isRoot()) { this.setForeground(Color.gray); setIcon(null); Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-06 08:36:12 UTC (rev 923) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-06 08:54:03 UTC (rev 924) @@ -70,7 +70,7 @@ import org.jetbrains.annotations.Nullable; /** - * The CFTreasureListTree class fully manages the Daimonin treasurelists. + * The CFTreasureListTree class fully manages treasurelists. * CF datafile "treasures" gets parsed into a JTree structure. * @author Andreas Vogl */ @@ -92,13 +92,13 @@ // hashtable containing references to all treasurelists (tree nodes) // TODO: replace with HashMap - private static Map<String, TreasureTreeNode> treasureTable; + private static Map<String, TreasureTreeNode> treasureTable = null; // hashtable temporarily containing names of special treasurelists (like gods' lists) // as keys and folder-nodes where to put these treasurelists as values // TODO: replace with HashMap // TODO: generify - private Map<String, TreasureTreeNode> specialTreasureLists; + private Map<String, TreasureTreeNode> specialTreasureLists = null; // all syntax-errors encountered during datafile-parsing get written in this log private final StringBuffer errorLog = new StringBuffer(); @@ -224,7 +224,7 @@ // check for special treasurelists, which are put in subfolders if (specialTreasureLists.containsKey(realNode.getTreasureObj().getName())) { - ((TreasureTreeNode) (specialTreasureLists.get(realNode.getTreasureObj().getName()))).add(realNode); + specialTreasureLists.get(realNode.getTreasureObj().getName()).add(realNode); } else { root.add(realNode); // normal treasurelist - attach to root node } @@ -352,7 +352,6 @@ * @param listNode node of the treasureone list */ private static void recalculateChances(final TreasureTreeNode listNode) { - //int cnum = listNode.getSiblingCount() - 1; // number of child-objects in the treasureone list int sumChances = 0; // sum of chances // calculate the sum of all chances @@ -386,7 +385,9 @@ /** * Read and parse the text inside a treasurelist. * @param parentNode parent treenode - * @param needLink vector containing all sub-treasurelist nodes which need linking + * @param reader Reader to read from. + * @param needLink List containing all sub-treasurelist nodes which need linking + * @throws IOException in case of I/O problems reading from <var>reader</var>. */ @SuppressWarnings({"LiteralAsArgToStringEquals"}) private void readInsideList(final TreasureTreeNode parentNode, final BufferedReader reader, final List<TreasureTreeNode> needLink) throws IOException { @@ -722,9 +723,7 @@ } // if this is a list without children it will need second linking - if (!processSecondLinking && getTreasureObj().isTreasureList() - && !getTreasureObj().getName().equalsIgnoreCase("NONE") - && !getTreasureObj().hasLoop()) { + if (!processSecondLinking && getTreasureObj().isTreasureList() && !getTreasureObj().getName().equalsIgnoreCase("NONE") && !getTreasureObj().hasLoop()) { // this is a list, let's see if there are children if (children() == null || !children().hasMoreElements()) { // no children-nodes of any kind, needs second linking This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-06 22:05:49
|
Revision: 925 http://svn.sourceforge.net/gridarta/?rev=925&view=rev Author: akirschbaum Date: 2006-12-06 14:05:33 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Use LevelRenderer interface where possible. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/daimonin/src/daieditor/CMapViewBasic.java trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java trunk/daimonin/src/daieditor/gui/map/MapUserListener.java trunk/daimonin/src/daieditor/gui/map/SimpleLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-06 08:54:03 UTC (rev 924) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-06 22:05:33 UTC (rev 925) @@ -27,6 +27,7 @@ import cfeditor.gameobject.GameObject; import cfeditor.gui.MapView; import cfeditor.gui.map.DefaultLevelRenderer; +import cfeditor.gui.map.LevelRenderer; import cfeditor.map.MapControl; import cfeditor.map.MapModel; import java.awt.Dimension; @@ -84,7 +85,7 @@ private Size2D mapSize = new Size2D(1, 1); /** The tile palette renderer. */ - private final DefaultLevelRenderer renderer; + private final LevelRenderer renderer; private boolean changed = false; Modified: trunk/daimonin/src/daieditor/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-12-06 08:54:03 UTC (rev 924) +++ trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-12-06 22:05:33 UTC (rev 925) @@ -26,6 +26,7 @@ import daieditor.gameobject.GameObject; import daieditor.gui.map.DefaultLevelRenderer; +import daieditor.gui.map.LevelRenderer; import daieditor.gui.map.MapUserListener; import daieditor.map.MapControl; import daieditor.map.MapModel; @@ -371,7 +372,7 @@ renderer.setPaintOnlyMap(b); } - public DefaultLevelRenderer getRenderer() { + public LevelRenderer getRenderer() { return renderer; } Modified: trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java 2006-12-06 08:54:03 UTC (rev 924) +++ trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java 2006-12-06 22:05:33 UTC (rev 925) @@ -21,11 +21,16 @@ package daieditor.gui.map; +import java.awt.Point; import java.awt.image.BufferedImage; import javax.swing.JComponent; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public abstract class LevelRenderer extends JComponent { public abstract BufferedImage getFullImage(); + @Nullable public abstract Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint); + } // class LevelRenderer Modified: trunk/daimonin/src/daieditor/gui/map/MapUserListener.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapUserListener.java 2006-12-06 08:54:03 UTC (rev 924) +++ trunk/daimonin/src/daieditor/gui/map/MapUserListener.java 2006-12-06 22:05:33 UTC (rev 925) @@ -43,7 +43,7 @@ private final ToolSelectorPane toolSelectorPane; private MapCursor mapCursor; - private DefaultLevelRenderer renderer; + private LevelRenderer renderer; private MapControl mapControl; Modified: trunk/daimonin/src/daieditor/gui/map/SimpleLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/SimpleLevelRenderer.java 2006-12-06 08:54:03 UTC (rev 924) +++ trunk/daimonin/src/daieditor/gui/map/SimpleLevelRenderer.java 2006-12-06 22:05:33 UTC (rev 925) @@ -39,6 +39,8 @@ import javax.swing.ImageIcon; import net.sf.gridarta.Size2D; import net.sf.gridarta.map.MapSquare; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * The SimpleLevelRenderer renders maps without MapGrid or validation errors. @@ -176,5 +178,10 @@ } } } + + @Nullable public Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint) { + throw new IllegalStateException(); + } + } // class CLevelRenderer This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-06 22:23:44
|
Revision: 926 http://svn.sourceforge.net/gridarta/?rev=926&view=rev Author: akirschbaum Date: 2006-12-06 14:22:40 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Unify DefaultMapModel.getExit(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapModel.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/ExitTypes.java Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-06 22:05:33 UTC (rev 925) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-06 22:22:40 UTC (rev 926) @@ -35,6 +35,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import javax.swing.JFileChooser; @@ -96,7 +97,27 @@ private int length = 0; // Number of types in the list + /** List of exit object types. (Integer values) */ + private static final HashSet<Integer> EXIT_TYPES = new HashSet<Integer>(); + + static { + EXIT_TYPES.add(41); // teleporter + EXIT_TYPES.add(58); // battleground + EXIT_TYPES.add(66); // exit + EXIT_TYPES.add(94); // pit + EXIT_TYPES.add(95); // trapdoor + } + /** + * Check whether the GameObject is an exit. + * @param arch GameObject to check + * @return <code>true</code> if <var>arch</var> is an exit, otherwise <code>false</code> + */ + public static boolean isExitType(final GameObject arch) { + return arch != null && EXIT_TYPES.contains(arch.getHead().getArchTypNr()); + } + + /** * Constructor - Parsing all the data from the xml definitions file * 'types.xml'. */ Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-06 22:05:33 UTC (rev 925) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-06 22:22:40 UTC (rev 926) @@ -1224,12 +1224,16 @@ * Try to load the map where the selected map-exit points to. */ public void enterExit() { - final GameObject exit = currentMap.getMapModel().getExit(); + GameObject exit = getMainView().getMapTileSelection(); + if (exit == null || !CFArchTypeList.isExitType(exit)) { + exit = currentMap.getMapModel().getExit(currentMap.getMapViewFrame().getHighlightStart()); + } if (exit == null) { // no exit found ACTION_FACTORY.showMessageDialog(mainView, "enterExitNoExit"); return; } + exit = exit.getHead(); final Point exitPos = new Point(); exitPos.x = exit.getAttributeInt("hp"); Deleted: trunk/crossfire/src/cfeditor/ExitTypes.java =================================================================== --- trunk/crossfire/src/cfeditor/ExitTypes.java 2006-12-06 22:05:33 UTC (rev 925) +++ trunk/crossfire/src/cfeditor/ExitTypes.java 2006-12-06 22:22:40 UTC (rev 926) @@ -1,42 +0,0 @@ -/* $Id: ExitTypes.java,v 1.1 2006/04/06 17:59:46 akirschbaum Exp $ */ - -package cfeditor; - -import cfeditor.gameobject.GameObject; -import java.util.HashSet; -import java.util.Set; - -/** - * Contains a list of all types that are exits. - * @author Andreas Kirschbaum - */ -public final class ExitTypes { - - /** List of exit object types. (Integer values) */ - private static final Set<Integer> EXIT_TYPES = new HashSet<Integer>(); - - static { - EXIT_TYPES.add(41); // teleporter - EXIT_TYPES.add(58); // battleground - EXIT_TYPES.add(66); // exit - EXIT_TYPES.add(94); // pit - EXIT_TYPES.add(95); // trapdoor - } - - // Prevent instantiation. - private ExitTypes() { - } - - /** - * 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(); - } - return EXIT_TYPES.contains(exit.getArchTypNr()); - } - -} // class ExitTypes Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-06 22:05:33 UTC (rev 925) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-06 22:22:40 UTC (rev 926) @@ -24,8 +24,8 @@ package cfeditor.map; +import cfeditor.CFArchTypeList; import cfeditor.CMainControl; -import cfeditor.ExitTypes; import cfeditor.IGUIConstants; import cfeditor.filter.Filter; import cfeditor.filter.FilterConfig; @@ -541,40 +541,17 @@ return getMapArchObject().getMapDisplayName(); } - /** - * Searching for a valid exit at the highlighted map-spot. (This can be a - * teleporter, exit, pit etc.) - * @return GameObject exit-arch if existent, otherwise null - */ - @Nullable public GameObject getExit() { - final Point hspot = mapControl.getMapViewFrame().getHighlightStart(); // selected spot - - if (!isPointValid(hspot)) { + /** {@inheritDoc} */ + @Nullable public GameObject getExit(@Nullable final Point hspot) { + if (hspot == null || !isPointValid(hspot)) { return null; // out of map } - - // first, check if the selected arch is a valid exit - GameObject exit = mainControl.getMainView().getMapTileSelection(); - if (exit == null || !ExitTypes.contains(exit)) { - // if not, we check the whole selected spot for an exit - for (final GameObject exitObject : getMapSquare(hspot)) { - if (ExitTypes.contains(exitObject)) { - exit = exitObject; - break; - } + for (final GameObject arch : mapGrid[hspot.x][hspot.y]) { + if (CFArchTypeList.isExitType(arch)) { + return arch; } } - - if (exit == null || !ExitTypes.contains(exit)) { - exit = null; // make sure it's either an exit, or null - } - - // if we have a multipart exit, return the head - if (exit != null) { - exit = exit.getHead(); - } - - return exit; + return null; } /** {@inheritDoc} */ Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-06 22:05:33 UTC (rev 925) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-06 22:22:40 UTC (rev 926) @@ -2,13 +2,14 @@ import cfeditor.gameobject.GameObject; import java.awt.Point; +import java.io.Serializable; import org.jetbrains.annotations.Nullable; /** * Interface for MapModels. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public interface MapModel extends net.sf.gridarta.map.MapModel<GameObject, MapArchObject> { +public interface MapModel extends net.sf.gridarta.map.MapModel<GameObject, MapArchObject>, Serializable { /** Enable autojoin when inserting objects. */ boolean JOIN_ENABLE = true; @@ -38,7 +39,14 @@ @Nullable GameObject getMapArch(int id, Point pos); - @Nullable GameObject getExit(); + /** + * Get the first exit on the MapSquare described by <var>hspot</var>. + * Possible exits include teleporters, exits and pits. + * @param hspot Point to get exit at + * @return first exit found or <code>null</code> if no exit was found + * @todo move this method somewhere else because the model should not know about arch types + */ + @Nullable GameObject getExit(@Nullable Point hspot); String getMapText(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-12-06 22:05:33 UTC (rev 925) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-12-06 22:22:40 UTC (rev 926) @@ -1553,6 +1553,7 @@ ACTION_FACTORY.showMessageDialog(mainView, "enterExitNoExit"); return; } + exit = exit.getHead(); final Point exitPos = new Point(); exitPos.x = exit.getAttributeInt("hp"); Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-06 22:05:33 UTC (rev 925) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-06 22:22:40 UTC (rev 926) @@ -277,7 +277,7 @@ /** {@inheritDoc} */ @Nullable public GameObject getExit(@Nullable final Point hspot) { - if (hspot == null) { + if (hspot == null || !isPointValid(hspot)) { return null; // out of map } for (final GameObject arch : mapGrid[hspot.x][hspot.y]) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-06 22:27:15
|
Revision: 927 http://svn.sourceforge.net/gridarta/?rev=927&view=rev Author: akirschbaum Date: 2006-12-06 14:27:10 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Remove redundant catch(FileNotFoundException). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/MultiPositionData.java trunk/daimonin/src/daieditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/MultiPositionData.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-06 22:22:40 UTC (rev 926) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-06 22:27:10 UTC (rev 927) @@ -33,7 +33,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; -import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.Enumeration; @@ -238,7 +237,6 @@ } reader.close(); - } catch (final FileNotFoundException e) { } catch (final IOException e) { } Modified: trunk/crossfire/src/cfeditor/MultiPositionData.java =================================================================== --- trunk/crossfire/src/cfeditor/MultiPositionData.java 2006-12-06 22:22:40 UTC (rev 926) +++ trunk/crossfire/src/cfeditor/MultiPositionData.java 2006-12-06 22:27:10 UTC (rev 927) @@ -26,7 +26,6 @@ import java.io.BufferedReader; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.util.StringTokenizer; import net.sf.gridarta.io.IOUtils; @@ -120,8 +119,6 @@ if (log.isInfoEnabled()) { log.info("Loaded multipart position data from '" + IGUIConstants.ARCHDEF_FILE + "'"); } - } catch (final FileNotFoundException e) { - /* TODO ignore (really?) */ } catch (final IOException e) { /* TODO ignore (really?) */ } Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-06 22:22:40 UTC (rev 926) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-06 22:27:10 UTC (rev 927) @@ -34,7 +34,6 @@ import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.File; -import java.io.FileNotFoundException; import java.io.FilenameFilter; import java.io.IOException; import static java.lang.String.CASE_INSENSITIVE_ORDER; @@ -339,8 +338,6 @@ } finally { reader.close(); } - } catch (final FileNotFoundException e) { - // FIXME: Either do something or DOCUMENT NOT TO DO SOMETHING! } catch (final IOException e) { // FIXME: Either do something or DOCUMENT NOT TO DO SOMETHING! } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-12-06 22:22:40 UTC (rev 926) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-12-06 22:27:10 UTC (rev 927) @@ -78,7 +78,6 @@ import java.awt.image.ImageFilter; import java.awt.image.ImageProducer; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -1215,9 +1214,6 @@ } finally { decoder.close(); } - } catch (final FileNotFoundException e) { - ACTION_FACTORY.showMessageDialog(mainView, "openFileLoadMap", e.getMessage()); - return null; } catch (final IOException e) { ACTION_FACTORY.showMessageDialog(mainView, "openFileLoadMap", e.getMessage()); return null; @@ -1256,8 +1252,6 @@ } finally { mapFileEncoder.close(); } - } catch (final FileNotFoundException e) { - ACTION_FACTORY.showMessageDialog(mainView, "encodeMapFile", file, e.getMessage()); } catch (final IOException e) { ACTION_FACTORY.showMessageDialog(mainView, "encodeMapFile", file, e.getMessage()); } Modified: trunk/daimonin/src/daieditor/MultiPositionData.java =================================================================== --- trunk/daimonin/src/daieditor/MultiPositionData.java 2006-12-06 22:22:40 UTC (rev 926) +++ trunk/daimonin/src/daieditor/MultiPositionData.java 2006-12-06 22:27:10 UTC (rev 927) @@ -28,7 +28,6 @@ import java.awt.Point; import java.io.BufferedReader; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import net.sf.gridarta.io.IOUtils; import org.apache.log4j.Logger; @@ -129,8 +128,6 @@ } finally { reader.close(); } - } catch (final FileNotFoundException e) { - // FIXME either do something or DOCUMENT TO IGNORE ME } catch (final IOException e) { // FIXME either do something or DOCUMENT TO IGNORE ME } Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2006-12-06 22:22:40 UTC (rev 926) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2006-12-06 22:27:10 UTC (rev 927) @@ -391,8 +391,6 @@ anims.loadAnims(animFile); } catch (final DuplicateAnimationException e) { mainControl.handleThrowable(e); - } catch (final FileNotFoundException e) { - mainControl.handleThrowable(e); } catch (final IOException e) { mainControl.handleThrowable(e); } catch (final AnimationParseException e) { @@ -411,8 +409,6 @@ } finally { in.close(); } - } catch (final FileNotFoundException e) { - mainControl.handleThrowable(e); } catch (final DuplicateAnimationException e) { mainControl.handleThrowable(e); } catch (final IOException e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-06 22:54:21
|
Revision: 928 http://svn.sourceforge.net/gridarta/?rev=928&view=rev Author: akirschbaum Date: 2006-12-06 14:48:56 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Various unifications. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CGUIUtils.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/crossfire/src/cfeditor/io/CMapReader.java trunk/crossfire/src/cfeditor/io/CMapWriter.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CGUIUtils.java trunk/daimonin/src/daieditor/CMapViewBasic.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gui/map/MapUserListener.java trunk/daimonin/src/daieditor/io/CMapReader.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-06 22:27:10 UTC (rev 927) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-06 22:48:56 UTC (rev 928) @@ -1373,7 +1373,7 @@ * Create a DialogAttrib. * @param ref reference to the attribute data */ - DialogAttrib(final CFArchAttrib ref) { + private DialogAttrib(final CFArchAttrib ref) { this.ref = ref; } @@ -1431,7 +1431,7 @@ * Constructor. * @param a the gameObject attribute where this help button belongs to */ - HelpActionListener(final CFArchAttrib a) { + private HelpActionListener(final CFArchAttrib a) { if (a == null) { throw new NullPointerException("HelpActionListener without context"); } @@ -1453,14 +1453,14 @@ /** ActionListener for the change buttons of bitmasks. */ private static final class MaskChangeAL extends AbstractAction { - final BitmaskAttrib bmAttr; // attribute structure + private final BitmaskAttrib bmAttr; // attribute structure /** * 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) { + private MaskChangeAL(final String label, final BitmaskAttrib newAttr) { super(label); bmAttr = newAttr; } @@ -1544,7 +1544,7 @@ * @param keepB button "keep what is in the textfield" * @param textNew textfield containing the error-text to keep */ - ConfirmErrorsAL(final JDialog dialog, final GameObject gameObject, final String errors, final JButton keepB, final JTextArea textNew) { + private ConfirmErrorsAL(final JDialog dialog, final GameObject gameObject, final String errors, final JButton keepB, final JTextArea textNew) { this.gameObject = gameObject; keepButton = keepB; text = textNew; @@ -1595,7 +1595,7 @@ * @param frameNew the attribute-dialog mainframe * @param gameObject the gameObject which has the error to be added */ - TypesBoxAL(final CAttribDialog frameNew, final GameObject gameObject) { + private TypesBoxAL(final CAttribDialog frameNew, final GameObject gameObject) { frame = frameNew; this.gameObject = gameObject; ignoreEvent = false; @@ -1672,7 +1672,7 @@ * Create a StringKeyManager. * @param box JComboBox to create StringKeyManager for */ - StringKeyManager(final JComboBox box) { + private StringKeyManager(final JComboBox box) { this.box = box; } Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-12-06 22:27:10 UTC (rev 927) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-12-06 22:48:56 UTC (rev 928) @@ -102,7 +102,7 @@ } // print jre version, for easier recognition of jre-specific problems - System.out.println("Running java version " + System.getProperty("java.version")); + System.err.println("Running java version " + System.getProperty("java.version")); // Create the application and give it the parameters final CMainControl mainControl = new CMainControl(); Modified: trunk/crossfire/src/cfeditor/CGUIUtils.java =================================================================== --- trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-12-06 22:27:10 UTC (rev 927) +++ trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-12-06 22:48:56 UTC (rev 928) @@ -54,6 +54,9 @@ private static final Map<String, ImageIcon> imageCache = new HashMap<String, ImageIcon>(); + private CGUIUtils() { + } + /** * Returns the singleton instance of this class. * @return The singleton instance of this class. @@ -94,7 +97,7 @@ if (imageResource != null) { icon = new ImageIcon(imageResource); - } else if (dirName.indexOf(File.separator) >= 0) { + } else if (dirName.contains(File.separator)) { // let's try it again without first directory (okay, this may look // a bit weird, but usually this is the correct icon path in the jar) imageResource = ClassLoader.getSystemResource(dirName.substring(dirName.indexOf(File.separator) + 1) Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-06 22:27:10 UTC (rev 927) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-06 22:48:56 UTC (rev 928) @@ -247,7 +247,7 @@ mainControl.getArchetypeParser().parseArchetype(f.getAbsolutePath(), index); } else if (name.regionMatches(len - 4, ".png", 0, 4)) { //CMainStatusbar.getInstance().setText(" Loading PNG: "+name); - if (mainControl.getImageSet() == null || name.indexOf("." + mainControl.getImageSet() + ".") != -1) { + if (mainControl.getImageSet() == null || name.contains("." + mainControl.getImageSet() + ".")) { addPNGFace(f.getAbsolutePath(), name); } } @@ -372,7 +372,7 @@ final char l = (char) stream.read(); filePosition++; - if (face.indexOf("/") >= 0) { + if (face.contains("/")) { face = face.substring(face.lastIndexOf("/") + 1); } Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-12-06 22:27:10 UTC (rev 927) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-12-06 22:48:56 UTC (rev 928) @@ -844,7 +844,7 @@ /* // the attribute doesn't match the definitions, // now check if it is a negation of an entry in the default arch - if (line.indexOf(" ") >= 0) { + if (line.contains(" ")) { String attr_val = line.substring(line.indexOf(" ")).trim(); if (!(archetype.getAttributeString(attr_key, null).length() > 0 && (attr_val.equals("0") || attr_val.equals("null") || Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-06 22:27:10 UTC (rev 927) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-06 22:48:56 UTC (rev 928) @@ -307,7 +307,7 @@ */ public void paintTile(final Point point) { final Graphics grfx; - if (isPickmap()) { + if (isPickmap) { grfx = getGraphics(); // graphics context for drawing in the mapview } else { grfx = backBuffer.getGraphics(); @@ -386,7 +386,7 @@ public void setHighlightTile(final Point point) { - if (isPickmap()) { + if (isPickmap) { paintHighlightTile(getGraphics(), point); } else { paintHighlightTile(backBuffer.getGraphics(), point); Modified: trunk/crossfire/src/cfeditor/io/CMapReader.java =================================================================== --- trunk/crossfire/src/cfeditor/io/CMapReader.java 2006-12-06 22:27:10 UTC (rev 927) +++ trunk/crossfire/src/cfeditor/io/CMapReader.java 2006-12-06 22:48:56 UTC (rev 928) @@ -160,24 +160,14 @@ } } else if (thisLine.equals("end")) { objects.add(gameObject); - //archflag = false; - //archmore = false; if (log.isDebugEnabled()) { log.debug("LEAVE!: " + gameObject + " - " + thisLine); } return gameObject; } else if (thisLine.startsWith("msg")) { - // gameObject.addArchText(thisLine + "\n"); - gameObject.addMsgText(""); // this init the msg text buffer - // in the case of msg/endmsg - // with no content to overrule def msg + gameObject.addMsgText(""); msgflag = true; - // this is a MUST, because we overrule "anim" test - } else if (thisLine.startsWith("animation")) { - gameObject.addObjectText(thisLine); - } else if (thisLine.startsWith("anim_speed")) { - gameObject.addObjectText(thisLine); } else if (thisLine.startsWith("event_")) { // here's something about a scripted event final int i = thisLine.indexOf("_plugin"); Modified: trunk/crossfire/src/cfeditor/io/CMapWriter.java =================================================================== --- trunk/crossfire/src/cfeditor/io/CMapWriter.java 2006-12-06 22:27:10 UTC (rev 927) +++ trunk/crossfire/src/cfeditor/io/CMapWriter.java 2006-12-06 22:48:56 UTC (rev 928) @@ -113,7 +113,7 @@ if (archetype != null && gameObject.getArchTypNr() != archetype.getArchTypNr()) { // this gameObject has special type - if (gameObject.getObjectText().indexOf("type ") >= 0) { + if (gameObject.getObjectText().contains("type ")) { // oh oh - there might also be a type in the archtext which // is conflicting. remove the type from the archtext Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-06 22:27:10 UTC (rev 927) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-06 22:48:56 UTC (rev 928) @@ -37,7 +37,7 @@ import org.jetbrains.annotations.NotNull; /** - * The <code>MapControl</code> + * The <code>MapControl</code>. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ @@ -130,7 +130,7 @@ } /** - * Checks if the given edit type is active or not + * Checks if the given edit type is active or not. * @param editType edit type * @return true if this edit type is active */ @@ -146,9 +146,9 @@ */ public void addEditType(final int editType) { // calculate only if needed - final Size2D mapSize = mapModel.getMapSize(); - final Point pos = new Point(); if (!hasEditType(editType)) { + final Size2D mapSize = mapModel.getMapSize(); + final Point pos = new Point(); for (pos.x = 0; pos.x < mapSize.getWidth(); pos.x++) { for (pos.y = 0; pos.y < mapSize.getHeight(); pos.y++) { for (final GameObject arch : mapModel.getMapSquare(pos)) { @@ -183,6 +183,7 @@ } /** + * Returns whether this map has been closed. * @return true when this map has been closed */ public boolean isClosing() { Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-06 22:27:10 UTC (rev 927) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-06 22:48:56 UTC (rev 928) @@ -1450,7 +1450,7 @@ * Create a DialogAttrib. * @param ref reference to the attribute data */ - DialogAttrib(final CFArchAttrib ref) { + private DialogAttrib(final CFArchAttrib ref) { this.ref = ref; } @@ -1508,7 +1508,7 @@ * Constructor. * @param a the gameObject attribute where this help button belongs to */ - HelpActionListener(final CFArchAttrib a) { + private HelpActionListener(final CFArchAttrib a) { if (a == null) { throw new NullPointerException("HelpActionListener without context"); } @@ -1531,13 +1531,14 @@ /** ActionListener for the change buttons of bitmasks. */ private static final class MaskChangeAL extends AbstractAction { - final BitmaskAttrib bmAttr; // attribute structure + private final BitmaskAttrib bmAttr; // attribute structure /** * 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) { + private MaskChangeAL(final String label, final BitmaskAttrib newAttr) { super(label); bmAttr = newAttr; } @@ -1566,15 +1567,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 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. */ - ViewTreasurelistAL(final DialogAttrib<JTextField> attr, final CAttribDialog dialog) { + private ViewTreasurelistAL(final DialogAttrib<JTextField> attr, final CAttribDialog dialog) { super("treasurelist:"); strAttr = attr; this.dialog = dialog; @@ -1620,7 +1622,7 @@ * @param keepB button "keep what is in the textfield" * @param textNew textfield containing the error-text to keep */ - ConfirmErrorsAL(final JDialog dialog, final GameObject gameObject, final String errors, final JButton keepB, final JTextArea textNew) { + private ConfirmErrorsAL(final JDialog dialog, final GameObject gameObject, final String errors, final JButton keepB, final JTextArea textNew) { this.gameObject = gameObject; keepButton = keepB; text = textNew; @@ -1671,7 +1673,7 @@ * @param frameNew the attribute-dialog mainframe * @param gameObject the gameObject which has the error to be added */ - TypesBoxAL(final CAttribDialog frameNew, final GameObject gameObject) { + private TypesBoxAL(final CAttribDialog frameNew, final GameObject gameObject) { frame = frameNew; this.gameObject = gameObject; ignoreEvent = false; @@ -1746,7 +1748,7 @@ * Create a StringKeyManager. * @param box JComboBox to create StringKeyManager for */ - StringKeyManager(final JComboBox box) { + private StringKeyManager(final JComboBox box) { this.box = box; } @@ -1782,7 +1784,7 @@ * @param textField JTextField to update upon tree selection * @param objects NamedObjects that provide the tree */ - TreeChooseAction(final String text, final JTextField textField, final NamedObjects<? extends NamedObject> objects) { + private TreeChooseAction(final String text, final JTextField textField, final NamedObjects<? extends NamedObject> objects) { super(text); this.textField = textField; this.objects = objects; Modified: trunk/daimonin/src/daieditor/CGUIUtils.java =================================================================== --- trunk/daimonin/src/daieditor/CGUIUtils.java 2006-12-06 22:27:10 UTC (rev 927) +++ trunk/daimonin/src/daieditor/CGUIUtils.java 2006-12-06 22:48:56 UTC (rev 928) @@ -58,6 +58,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/daimonin/src/daieditor/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-12-06 22:27:10 UTC (rev 927) +++ trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-12-06 22:48:56 UTC (rev 928) @@ -98,6 +98,7 @@ /** The tile palette renderer. */ private final DefaultLevelRenderer renderer; + private MapCursor mapCursor; private MapGrid mapGrid; Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-12-06 22:27:10 UTC (rev 927) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-12-06 22:48:56 UTC (rev 928) @@ -769,7 +769,7 @@ /* // the attribute doesn't match the definitions, // now check if it is a negation of an entry in the default arch - if (line.indexOf(" ") >= 0) { + if (line.contains(" ")) { String attr_val = line.substring(line.indexOf(" ")).trim(); if (!(archetype.getAttributeString(attrKey, null).length() > 0 && (attr_val.equals("0") || attr_val.equals("null") || Modified: trunk/daimonin/src/daieditor/gui/map/MapUserListener.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapUserListener.java 2006-12-06 22:27:10 UTC (rev 927) +++ trunk/daimonin/src/daieditor/gui/map/MapUserListener.java 2006-12-06 22:48:56 UTC (rev 928) @@ -43,6 +43,7 @@ private final ToolSelectorPane toolSelectorPane; private MapCursor mapCursor; + private LevelRenderer renderer; private MapControl mapControl; Modified: trunk/daimonin/src/daieditor/io/CMapReader.java =================================================================== --- trunk/daimonin/src/daieditor/io/CMapReader.java 2006-12-06 22:27:10 UTC (rev 927) +++ trunk/daimonin/src/daieditor/io/CMapReader.java 2006-12-06 22:48:56 UTC (rev 928) @@ -139,7 +139,6 @@ } } else if (thisLine.equals("end")) { objects.add(gameObject); - //archflag = false; if (log.isDebugEnabled()) { log.debug("LEAVE!: " + gameObject + " - " + thisLine); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 00:20:15
|
Revision: 942 http://svn.sourceforge.net/gridarta/?rev=942&view=rev Author: akirschbaum Date: 2006-12-06 16:20:15 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Unify comments and whitespace. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/daimonin/src/daieditor/CMapArchPanel.java Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-07 00:04:16 UTC (rev 941) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-07 00:20:15 UTC (rev 942) @@ -182,10 +182,7 @@ panelDesktop = new JTabbedPane(JTabbedPane.TOP); mapArchPanel.setLayout(new BorderLayout()); - splitPane = new GSplitPane( - GSplitPane.HORIZONTAL_SPLIT, - scrollPane3, - scrollPane2); + splitPane = new GSplitPane(GSplitPane.HORIZONTAL_SPLIT, scrollPane3, scrollPane2); final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(0, 1)); @@ -216,7 +213,6 @@ gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.NORTHWEST; - //panelDesktop.add(scrollArchPane, "Arch"); // and add it to this panel object*/ setupArchPanel(); setupTextPanel(); setupScriptPanel(); @@ -233,8 +229,7 @@ // calculate default value in case there is no settings file final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - final int divLocation = Integer.parseInt(settings.getProperty( - MAPARCHPANEL_LOCATION_KEY, "" + (int) (0.49 * screen.getWidth()))); + final int divLocation = Integer.parseInt(settings.getProperty(MAPARCHPANEL_LOCATION_KEY, "" + (int) (0.49 * screen.getWidth()))); splitPane.setDividerLocation(divLocation); splitPane.setDividerSize(5); @@ -303,7 +298,7 @@ return; } - // If the active arch is part of a multi, the mutli-head's stats + // If the active gameObject is part of a multi, the mutli-head's stats // are taken instead: final GameObject gameObject = activeArch.getHead(); @@ -323,16 +318,16 @@ if (archNameField.getText().compareTo(archetype.getObjName()) == 0) { gameObject.setObjName(null); // yes, we don't need it in map } else { - gameObject.setObjName(archNameField.getText()); // overrule in map arch + gameObject.setObjName(archNameField.getText()); // overrule in map gameObject } } else if (archNameField.getText().compareTo(gameObject.getArchetypeName()) == 0) { gameObject.setObjName(null); } else { // def is null, something is in panel, so we set it - gameObject.setObjName(archNameField.getText()); // overrule in map arch + gameObject.setObjName(archNameField.getText()); // overrule in map gameObject } } else { - gameObject.setObjName(null); // nothing in, nothing in map arch - // hm, there is no way yet to overrule a default arch name with "nothing" + gameObject.setObjName(null); // nothing in, nothing in map gameObject + // hm, there is no way yet to overrule a default gameObject name with "nothing" // like <name > ore <name "">..?? } @@ -409,7 +404,7 @@ } // read from archEdit (bottom right textwin) only the attributes - // that differ from the default arch. These get stored into + // that differ from the default gameObject. These get stored into // the arche's archText (and finally in the map). gameObject.setObjectText(archetype.diffArchText(archEdit.getText(), false)); @@ -456,7 +451,7 @@ private void setupArchPanel() { final GridBagLayout gridbag = new GridBagLayout(); final GridBagConstraints gbc = new GridBagConstraints(); - //archPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); + archPanel.setLayout(gridbag); gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; @@ -591,8 +586,7 @@ aPath.setEnabled(false); aRemove.setEnabled(false); - grid.setPreferredSize(new Dimension((int) (Math.max(aModify.getMinimumSize().getWidth() * 2, - aNew.getMinimumSize().getWidth() * 2)), 40)); + grid.setPreferredSize(new Dimension((int) (Math.max(aModify.getMinimumSize().getWidth() * 2, aNew.getMinimumSize().getWidth() * 2)), 40)); scriptPanel.add(ssa); scriptPanel.add(grid); @@ -627,7 +621,6 @@ */ public void setMapArchPanelObject(final GameObject activeGameObject) { selectedObject = activeGameObject; - // archObjNameText.setText("<html><font color=black>Name:</font></html>"); // reset panel archNameField.setText(""); archTypeText.setText("Type:"); @@ -655,7 +648,7 @@ return; } - // If the active arch is part of a multi, the mutli-head's stats + // If the active gameObject is part of a multi, the mutli-head's stats // are displayed (Only the head can store information!). final GameObject gameObject = activeGameObject.getHead(); @@ -693,7 +686,7 @@ if (gameObject.getObjName() == null && gameObject.getArchetypeName() != null) { archNameField.setForeground(Color.black); if (gameObject.getArchetype().getObjName() == null) { - // arch name + // gameObject name if (gameObject.getArchetypeName() != null) { archNameField.setText(gameObject.getArchetypeName()); } else { @@ -747,7 +740,7 @@ archTileText.setText("Tile: single"); } - // drawing the arch's attributes in the text field (archEdit) at the bottom right + // drawing the gameObject's attributes in the text field (archEdit) at the bottom right archEdit.setEnabled(true); final Style currentAttributes = archEdit.getStyle(StyleContext.DEFAULT_STYLE); try { Modified: trunk/daimonin/src/daieditor/CMapArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-12-07 00:04:16 UTC (rev 941) +++ trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-12-07 00:20:15 UTC (rev 942) @@ -165,7 +165,6 @@ /** Arch name field. */ private final JTextField archNameField = new JTextField(14); - // private JLabel archInvCount = new JLabel(); private final JLabel archMapPos = new JLabel(); private final JLabel archFaceText = new JLabel(); @@ -174,7 +173,6 @@ private final JLabel archAnimText = new JLabel(); - // private JLabel archTileText = new JLabel(); private final JPanel mapArchPanel = new JPanel(); private final Action aSubmitChange = ACTION_FACTORY.createAction(false, "mapArchApply", this); @@ -212,7 +210,6 @@ mapArchPanel.setLayout(new BorderLayout()); splitPane = new GSplitPane(HORIZONTAL_SPLIT, mapArchPanel, scrollPane2); - final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(0, 1)); @@ -474,12 +471,11 @@ } - /** set up the arch panel entry of the lower window */ + /** Set up the arch panel entry of the lower window. */ private void setupArchPanel() { final GridBagLayout gridbag = new GridBagLayout(); final GridBagConstraints gbc = new GridBagConstraints(); - //archPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); archPanel.setLayout(gridbag); gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; @@ -651,7 +647,7 @@ directionButtons[direction] = button; } - /** set up the text panel entry of the lower window */ + /** Set up the text panel entry of the lower window. */ private void setupTextPanel() { textPanel = new JPanel(); // new panel @@ -668,7 +664,7 @@ textPanel.add(sta); } - /** set up the script panel tab */ + /** Set up the script panel tab. */ private JPanel createScriptPanel() { eventList = new JList(); @@ -730,12 +726,10 @@ } /** - * update the map arch panel to display the custom font + * Update the map arch panel to display the custom font. * @param refresh if true, the window is redrawn after setting the fonts */ public void updateFont(final boolean refresh) { - - archMapPos.setForeground(black); archTypeText.setForeground(black); archFaceText.setForeground(black); @@ -749,8 +743,8 @@ } /** - * If an arch is selected, the MapArchPanels - * (bottom right windows) get updated. + * If an arch is selected, the MapArchPanels (bottom right windows) get + * updated. * @param activeGameObject the selected arch */ void setMapArchPanelObject(final GameObject activeGameObject) { @@ -959,11 +953,6 @@ archEdit.setEnabled(true); final Style currentAttributes = archEdit.getStyle(StyleContext.DEFAULT_STYLE); try { - //if (mainControl.getFont() != null) { - // StyleConstants.setFontFamily(currentAttributes, mainControl.getFont().getFamily()); - // StyleConstants.setFontSize(currentAttributes, mainControl.getFont().getSize()); - //} - // blue: the "special" attributes, differ from the default archetype StyleConstants.setForeground(currentAttributes, blue); if (gameObject.getObjectText() != null) { @@ -1006,6 +995,7 @@ * script"/"path"/"remove" button from the script panel. If there is a * valid selection in the event list, the appropriate action for this * script is triggered. + * @param task Script type to edit (?). */ public void editScriptWanted(final int task) { GameObject gameObject = mainControl.getMainView().getMapTileSelection(); // get selected gameObject @@ -1039,11 +1029,11 @@ } /** - * Set enable/disable states for the four buttons in the script panel - * @param newButton - * @param modifyButton - * @param pathButton - * @param removeButton + * Set enable/disable states for the four buttons in the script panel. + * @param newButton Enabled state for the "new" button. + * @param modifyButton Enabled state for the "modify" button. + * @param pathButton Enabled state for the "path" button. + * @param removeButton Enabled state for the "remove" button. */ public void setScriptPanelButtonState(final boolean newButton, final boolean modifyButton, final boolean pathButton, final boolean removeButton) { aNew.setEnabled(newButton); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 00:41:55
|
Revision: 945 http://svn.sourceforge.net/gridarta/?rev=945&view=rev Author: akirschbaum Date: 2006-12-06 16:41:53 -0800 (Wed, 06 Dec 2006) Log Message: ----------- Rename variable name. Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 00:39:07 UTC (rev 944) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 00:41:53 UTC (rev 945) @@ -268,7 +268,7 @@ } /** {@inheritDoc} */ - public boolean insertArchToMap(GameObject newarch, String archName, final GameObject next, final Point pos, final boolean join) { + public boolean insertArchToMap(GameObject newArch, String archName, final GameObject next, final Point pos, final boolean join) { // map coords must be valid if (!isPointValid(pos)) { return false; @@ -277,20 +277,20 @@ if (next == null || !next.isInContainer()) { // put arch on the map - if (newarch == null || newarch.isArchetype()) { + if (newArch == null || newArch.isArchetype()) { // just make sure we never insert an uninitialized default arch from the stack - if (newarch != null && newarch.isArchetype()) { - archName = newarch.getArchetypeName(); + if (newArch != null && newArch.isArchetype()) { + archName = newArch.getArchetypeName(); } // insert a new instance of the default arch (number 'archName') if (!addArchToMap(archName, pos, true, join, false)) { return false; } } else { - // insert the given 'newarch' (multis not allowed here yet - sorry) - if (!newarch.isMulti()) { - newarch = newarch.createClone(pos.x, pos.y); // create a clone - addGameObjectToMap(newarch, false); // insert it to the map + // insert the given 'newArch' (multis not allowed here yet - sorry) + if (!newArch.isMulti()) { + newArch = newArch.createClone(pos.x, pos.y); // create a clone + addGameObjectToMap(newArch, false); // insert it to the map } else { return false; // tried to insert multi (probably from pickmap) } @@ -310,16 +310,16 @@ } else { // insert the new arch into the inventory of a map arch final GameObject invnew; // new arch to be inserted - if (newarch == null || newarch.isArchetype()) { - if (newarch != null && newarch.isArchetype()) { - archName = newarch.getArchetypeName(); + if (newArch == null || newArch.isArchetype()) { + if (newArch != null && newArch.isArchetype()) { + archName = newArch.getArchetypeName(); } // create a new copy of a default arch invnew = getArchetype(archName).createArch(); } else { // create clone from a pickmap - if (!newarch.isMulti()) { - invnew = newarch.createClone(pos.x, pos.y); + if (!newArch.isMulti()) { + invnew = newArch.createClone(pos.x, pos.y); } else { return false; } Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-07 00:39:07 UTC (rev 944) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-07 00:41:53 UTC (rev 945) @@ -177,7 +177,7 @@ * {@inheritDoc} * @xxx I'm too complex */ - public boolean insertArchToMap(GameObject newarch, String archName, final GameObject next, final Point pos) { + public boolean insertArchToMap(GameObject newArch, String archName, final GameObject next, final Point pos) { // map coords must be valid if (!isPointValid(pos)) { return false; @@ -186,20 +186,20 @@ if (next == null || !next.isInContainer()) { // put arch on the map - if (newarch == null || newarch.isArchetype()) { + if (newArch == null || newArch.isArchetype()) { // just make sure we never insert an uninitialized default arch from the stack - if (newarch != null && newarch.isArchetype()) { - archName = newarch.getArchetypeName(); + if (newArch != null && newArch.isArchetype()) { + archName = newArch.getArchetypeName(); } // insert a new instance of the default arch (number 'archName') if (!addArchToMap(archName, pos, true, false)) { return false; } } else { - // insert the given 'newarch' (multis not allowed here yet - sorry) - if (!newarch.isMulti()) { - newarch = newarch.createClone(pos.x, pos.y); // create a clone - addGameObjectToMap(newarch, false); // insert it to the map + // insert the given 'newArch' (multis not allowed here yet - sorry) + if (!newArch.isMulti()) { + newArch = newArch.createClone(pos.x, pos.y); // create a clone + addGameObjectToMap(newArch, false); // insert it to the map } else { return false; // tried to insert multi (probably from pickmap) } @@ -219,16 +219,16 @@ } else { // insert the new arch into the inventory of a map arch final GameObject invnew; // new arch to be inserted - if (newarch == null || newarch.isArchetype()) { - if (newarch != null && newarch.isArchetype()) { - archName = newarch.getArchetypeName(); + if (newArch == null || newArch.isArchetype()) { + if (newArch != null && newArch.isArchetype()) { + archName = newArch.getArchetypeName(); } // create a new copy of a default arch invnew = getArchetype(archName).createArch(); } else { // create clone from a pickmap - if (!newarch.isMulti()) { - invnew = newarch.createClone(pos.x, pos.y); + if (!newArch.isMulti()) { + invnew = newArch.createClone(pos.x, pos.y); } else { return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 10:33:45
|
Revision: 948 http://svn.sourceforge.net/gridarta/?rev=948&view=rev Author: akirschbaum Date: 2006-12-07 02:33:45 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Unify MapPropertiesDialog. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapArchObject.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/map/MapModel.java trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java trunk/daimonin/src/daieditor/map/MapArchObject.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-07 10:33:45 UTC (rev 948) @@ -1148,21 +1148,6 @@ new COptionDialog(this, mainView); } - /** - * Sets the properties of the given level. - * @param level map control - * @param archText map text - * @param loreText lore text - * @param strMapTitle map name - * @param mapSize size of map - */ - public void setLevelProperties(final MapControl level, final String archText, final String loreText, final String strMapTitle, final Size2D mapSize) { - if (level != null) { - level.setProperties(archText, loreText, strMapTitle, mapSize); - refreshMenusAndToolbars(); - } - } - void setLockAllPickmaps(final boolean state) { pickmapsLocked = state; } Modified: trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2006-12-07 10:33:45 UTC (rev 948) @@ -427,10 +427,15 @@ } // now that all is well, write the new values into the maparch - mainControl.setLevelProperties(mapControl, mapDescription.getText(), mapLore.getText(), mapName.getText(), mapSize); final MapArchObject map = mapControl.getMapArch(); + final String mapNameString = mapName.getText(); + mapControl.getMapModel().resizeMap(mapSize); + map.setText(mapDescription.getText()); + map.setLore(mapLore.getText()); + map.setMapName(mapNameString.trim()); // trim, this string might come from the UI + map.setMapRegion(region); map.setEnterX(enterX); map.setEnterY(enterY); @@ -465,10 +470,8 @@ map.setTilePath(i, fieldTilePath[i].getText()); } - // refresh menus if tilepaths have been modified - if (modifyTilepaths) { - mainControl.refreshMenus(); - } + mainControl.refreshMenusAndToolbars(); + mapControl.notifyViews(); // set flag that map has changed mapControl.setLevelChangedFlag(); Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 10:33:45 UTC (rev 948) @@ -94,12 +94,6 @@ } /** {@inheritDoc} */ - public void setNewMapText(final String str) { - getMapArchObject().resetText(); - getMapArchObject().addText(str); - } - - /** {@inheritDoc} */ public String getMapText() { return getMapArchObject().getText(); } Modified: trunk/crossfire/src/cfeditor/map/MapArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-12-07 10:33:45 UTC (rev 948) @@ -293,8 +293,8 @@ } /** - * Set 'text' = maptext. - * @param text string to set + * Set map text. + * @param text the new map text */ public void setText(final String text) { msgText.delete(0, msgText.length()); Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-07 10:33:45 UTC (rev 948) @@ -255,29 +255,6 @@ } /** - * Set the properties (name, maptext and size) of this map. - * @param archText map text - * @param loreText lore text - * @param strMapTitle map name - * @param newSize size of map - */ - public void setProperties(final String archText, final String loreText, String strMapTitle, final Size2D newSize) { - // resize this map - if (!newSize.equals(getMapSize())) { - resizeMap(newSize); - } - - setNewMapText(archText); // change map text - setNewLoreText(loreText); // change lore text - - // change map name (does not change the filename anymore) - strMapTitle = strMapTitle.trim(); - setMapName(strMapTitle); - - notifyViews(); // update - } - - /** * Repaints the view. */ public void repaint() { @@ -287,7 +264,7 @@ /** * Notifies the view that data has changed in the model. */ - void notifyViews() { + public void notifyViews() { mapViewFrame.refreshDataFromModel(); } @@ -398,14 +375,6 @@ mapModel.setFileName(fname); } - public void setNewMapText(final String str) { - mapModel.setNewMapText(str); - } - - public void setNewLoreText(final String str) { - mapModel.getMapArchObject().setLore(str); - } - public void setLevelChangedFlag() { mapModel.setLevelChangedFlag(); } Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-07 10:33:45 UTC (rev 948) @@ -106,12 +106,6 @@ String getMapText(); /** - * Update the map description text. - * @param str the new description text - */ - void setNewMapText(String str); - - /** * Notify that the level is about to be closed. */ void levelCloseNotify(); Modified: trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2006-12-07 10:33:45 UTC (rev 948) @@ -438,8 +438,7 @@ final String mapNameString = mapName.getText() + (mapSound.getText().length() > 0 ? '§' + mapSound.getText() + "|0|-1" : ""); mapControl.getMapModel().resizeMap(mapSize); - map.resetText(); - map.addText(mapDescription.getText()); + map.setText(mapDescription.getText()); map.setMapName(mapNameString.trim()); // trim, this string might come from the UI map.setEnterX(enterX); Modified: trunk/daimonin/src/daieditor/map/MapArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapArchObject.java 2006-12-07 00:45:55 UTC (rev 947) +++ trunk/daimonin/src/daieditor/map/MapArchObject.java 2006-12-07 10:33:45 UTC (rev 948) @@ -239,6 +239,15 @@ msgText.append(text); } + /** + * Set map text. + * @param text the new map text + */ + public void setText(final String text) { + msgText.delete(0, msgText.length()); + msgText.append(text); + } + /** Delete maptext. */ public void resetText() { msgText.delete(0, msgText.length()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 19:05:43
|
Revision: 950 http://svn.sourceforge.net/gridarta/?rev=950&view=rev Author: akirschbaum Date: 2006-12-07 11:05:43 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Do not insert multiple identical objects while dragging the mouse. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2006-12-07 18:48:12 UTC (rev 949) +++ trunk/crossfire/ChangeLog 2006-12-07 19:05:43 UTC (rev 950) @@ -1,3 +1,8 @@ +2006-12-07 Andreas Kirschbaum + + * Do not insert multiple identical objects while dragging the + mouse. + 2006-12-06 Andreas Kirschbaum * Do not close treasure list selection dialog if the user selects Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 18:48:12 UTC (rev 949) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-12-07 19:05:43 UTC (rev 950) @@ -177,23 +177,17 @@ /** {@inheritDoc} */ public boolean isMultiArchFittingToMap(final String archName, final Point pos, final boolean allowDouble) { - final Archetype<GameObject> head = getArchetype(archName); - final Point mapH = new Point(head.getMultiX(), head.getMultiY()); - mapH.translate(pos.x, pos.y); - if (!isPointValid(mapH)) { - return false; - } - for (GameObject tail = head.getMultiNext(); tail != null; tail = tail.getMultiNext()) { - final Point mapT = new Point(tail.getMultiX(), tail.getMultiY()); - mapT.translate(pos.x, pos.y); + for (GameObject part = getArchetype(archName); part != null; part = part.getMultiNext()) { + final Point point = new Point(part.getMultiX(), part.getMultiY()); + point.translate(pos.x, pos.y); // outside map - if (!isPointValid(mapT)) { + if (!isPointValid(point)) { return false; } if (!allowDouble) { - final String temp = tail.getArchetypeName(); - for (final GameObject node : mapGrid[mapT.x][mapT.y]) { + final String temp = part.getArchetypeName(); + for (final GameObject node : mapGrid[point.x][point.y]) { if (node.getArchetypeName().equals(temp)) { return false; } Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-07 18:48:12 UTC (rev 949) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-07 19:05:43 UTC (rev 950) @@ -100,23 +100,17 @@ /** {@inheritDoc} */ public boolean isMultiArchFittingToMap(final String archName, final Point pos, final boolean allowDouble) { - final Archetype<GameObject> head = getArchetype(archName); - final Point mapH = new Point(head.getMultiX(), head.getMultiY()); - mapH.translate(pos.x, pos.y); - if (!isPointValid(mapH)) { - return false; - } - for (GameObject tail = head.getMultiNext(); tail != null; tail = tail.getMultiNext()) { - final Point mapT = new Point(tail.getMultiX(), tail.getMultiY()); - mapT.translate(pos.x, pos.y); + for (GameObject part = getArchetype(archName); part != null; part = part.getMultiNext()) { + final Point point = new Point(part.getMultiX(), part.getMultiY()); + point.translate(pos.x, pos.y); // outside map - if (!isPointValid(mapT)) { + if (!isPointValid(point)) { return false; } if (!allowDouble) { - final String temp = tail.getArchetypeName(); - for (final GameObject node : mapGrid[mapT.x][mapT.y]) { + final String temp = part.getArchetypeName(); + for (final GameObject node : mapGrid[point.x][point.y]) { if (node.getArchetypeName().equals(temp)) { return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 20:24:13
|
Revision: 952 http://svn.sourceforge.net/gridarta/?rev=952&view=rev Author: akirschbaum Date: 2006-12-07 12:24:00 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Various unifications. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanel.java trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/daimonin/src/daieditor/CArchPanel.java trunk/daimonin/src/daieditor/CArchPanelPan.java trunk/daimonin/src/daieditor/CMapArchPanel.java trunk/daimonin/src/daieditor/CMapTileList.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-12-07 20:06:31 UTC (rev 951) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-12-07 20:24:00 UTC (rev 952) @@ -85,11 +85,11 @@ * @param mainControl CMainControl */ public CArchPanel(final CMainControl mainControl) { + super(new BorderLayout()); this.mainControl = mainControl; final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); selectedArch = null; - setLayout(new BorderLayout()); tabDesktop = new JTabbedPane(SwingConstants.TOP); tabDesktop.setBorder(BorderFactory.createEmptyBorder(IGUIConstants.SPACE_PICKARCH_TOP, 0, 0, 0)); archQuickPanel = new CArchQuickView(mainControl); Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-12-07 20:06:31 UTC (rev 951) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-12-07 20:24:00 UTC (rev 952) @@ -44,6 +44,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; public final class CArchPanelPan extends JPanel { @@ -111,17 +112,28 @@ @Override public void mousePressed(final MouseEvent e) { // In JDK 1.4 it is required to transfer focus back to mapview after // every click in the panel, otherwise the menu-shortcuts stop working - if (mainControl.getCurrentMap() != null && - mainControl.getCurrentMap().getMapViewFrame() != null) { + if (mainControl.getCurrentMap() != null && mainControl.getCurrentMap().getMapViewFrame() != null) { mainControl.getCurrentMap().getMapViewFrame().requestFocus(); // focus to mapview } } }); } + /** + * Get the GameObject currently selected in the list. + * @return GameObject or <code>null</code> if no selection + */ public GameObject getArchListObject() { + return getArchListObject(theList.getSelectedIndex()); + } + + /** + * Get the GameObject from the list. + * @param index Index of selected list element or <code>-1</code> for no selection. + * @return GameObject or <code>null</code> if <var>index</var> was <code>-1</code> + */ + @Nullable private GameObject getArchListObject(final int index) { GameObject archetype = null; - int index = theList.getSelectedIndex(); if (index != -1) { final String archname = theList.getSelectedValue().toString(); archetype = mainControl.getArchetypeSet().getArchetype(archname); @@ -243,26 +255,17 @@ } } - private class MyCellRenderer extends DefaultListCellRenderer { + /** Cell Renderer for rendering cells in the ArchPanelPan. */ + private final class MyCellRenderer extends DefaultListCellRenderer { /** Serial Version UID. */ private static final long serialVersionUID = 1L; - /* {@inheritDoc} */ - @Override public Component getListCellRendererComponent(final JList list, - final Object value, // value to display - final int index, // cell index - final boolean isSelected, // is the cell selected - final boolean cellHasFocus) { // the list and the cell have the focus - - /* The DefaultListCellRenderer class will take care of - * the JLabels text property, it's foreground and background - *colors, and so on. - */ + /** {@inheritDoc} */ + @Override + public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - /* We additionally set the JLabels icon property here. - */ final ArchetypeSet archetypeSet = mainControl.getArchetypeSet(); final String archetypeName = value.toString(); final GameObject archetype = archetypeSet.getArchetype(archetypeName); Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-12-07 20:06:31 UTC (rev 951) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-12-07 20:24:00 UTC (rev 952) @@ -88,12 +88,8 @@ /** The currently selected MapSquare. */ private transient Point currentSquare = null; - /** - * Create a CMapTileList. - * @param mainControl MainControl. - * @param mainView MainView. - */ - CMapTileList(final CMainControl mainControl, final CMainView mainView) { + /** Build Panel */ + public CMapTileList(final CMainControl mainControl, final CMainView mainView) { this.mainControl = mainControl; this.mainView = mainView; setLayout(new BorderLayout()); @@ -175,8 +171,7 @@ // --- left mouse button: select arch --- // first, check if this is a doubleclick final long thisClick = (new Date()).getTime(); - if (thisClick - lastClick < IGUIConstants.DOUBLECLICK_MS && - lastClickGameObject != null && lastClickGameObject == getMapTileSelection()) { + if (thisClick - lastClick < IGUIConstants.DOUBLECLICK_MS && lastClickGameObject != null && lastClickGameObject == getMapTileSelection()) { // doubleclick: open attribute window mainControl.openAttrDialog(getMapTileSelection()); } else { @@ -377,8 +372,8 @@ return selListCounter; } - /** Builds the cells in the map-tile panel. */ - final class MyCellRenderer extends DefaultListCellRenderer { + /** CellRenderer for rendering ArchObjects on a certain map tile in a list. */ + private final class MyCellRenderer extends DefaultListCellRenderer { /** Serial Version UID. */ private static final long serialVersionUID = 1L; Modified: trunk/daimonin/src/daieditor/CArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanel.java 2006-12-07 20:06:31 UTC (rev 951) +++ trunk/daimonin/src/daieditor/CArchPanel.java 2006-12-07 20:24:00 UTC (rev 952) @@ -175,7 +175,7 @@ } /** - * Get name of selected Arch + * Get name of selected Arch. * @return Name of selected arch in arch panel */ public String getSelectedArch() { @@ -183,7 +183,7 @@ } /** - * Set selected Arch + * Set selected Arch. * @param selectedArch name of selected arch in arch panel */ public void setSelectedArch(final String selectedArch) { Modified: trunk/daimonin/src/daieditor/CArchPanelPan.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-07 20:06:31 UTC (rev 951) +++ trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-07 20:24:00 UTC (rev 952) @@ -49,7 +49,6 @@ import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; - public final class CArchPanelPan extends JPanel { private static final Logger log = Logger.getLogger(CArchPanelPan.class); @@ -114,7 +113,6 @@ theList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(final ListSelectionEvent e) { - //mainControl.showArchPanelQuickObject(getArchListObject()); mainControl.showArchPanelQuickObject(getArchListObject(e.getFirstIndex())); } }); Modified: trunk/daimonin/src/daieditor/CMapArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-12-07 20:06:31 UTC (rev 951) +++ trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-12-07 20:24:00 UTC (rev 952) @@ -959,7 +959,7 @@ document.insertString(document.getLength(), gameObject.getObjectText(), currentAttributes); } - // document.insertString(document.getLength(), "ID#"+gameObject.getMyID()+ " inv#: "+gameObject.countInvObjects()+"\n", currentAttributes); + // document.insertString(document.getLength(), "ID#"+gameObject+ " inv#: "+gameObject.countInvObjects()+"\n", currentAttributes); // black: the attributes from the default archetype // that don't exist among the "special" ones Modified: trunk/daimonin/src/daieditor/CMapTileList.java =================================================================== --- trunk/daimonin/src/daieditor/CMapTileList.java 2006-12-07 20:06:31 UTC (rev 951) +++ trunk/daimonin/src/daieditor/CMapTileList.java 2006-12-07 20:24:00 UTC (rev 952) @@ -84,7 +84,7 @@ private final DefaultListModel model; - private int listCounter; + private int listCounter = 0; /** The currently selected MapSquare. */ private transient MapSquare<GameObject> currentSquare; @@ -319,12 +319,12 @@ /** * Set the display to the currently selected map tile. * @param map Map to get display for (includes selection information) - * @param selArch Selected GameObject + * @param gameObject selected GameObject */ - public void setMapTileList(final MapControl map, final GameObject selArch) { + public void setMapTileList(final MapControl mapControl, final GameObject gameObject) { list.setEnabled(false); model.removeAllElements(); - if (map == null) { + if (mapControl == null) { // mouse has been clicked outside the mapview currentSquare = null; getTileArch(-1); @@ -334,7 +334,7 @@ } listCounter = 0; - currentSquare = map.getMapModel().getMouseRightPosObject(); + currentSquare = mapControl.getMapModel().getMouseRightPosObject(); int postSelect = -1; boolean foundSIndex = false; int sIndex = 0; @@ -342,9 +342,9 @@ // Now go through the list backwards and put all arches // on the panel in this order if (currentSquare != null) { - for (GameObject node : currentSquare.reverse()) { + for (final GameObject node : currentSquare.reverse()) { // add the node - if (node == selArch) { + if (node == gameObject) { postSelect = listCounter; } listCounter++; @@ -355,7 +355,8 @@ sIndex = listCounter - 1; // select this tile foundSIndex = true; // this is it - don't select any other tile } - final int tmpSelect = addInvObjects(node.getHead(), selArch); + + final int tmpSelect = addInvObjects(node.getHead(), gameObject); if (postSelect == -1 && tmpSelect != -1) { postSelect = tmpSelect; } @@ -378,19 +379,20 @@ /** * Add inventory objects to an arch in the MapTileList recursively. - * @param node the arch where the inventory gets added - * @param selArch selected GameObject + * @param node the arch where the inventory gets added + * @param gameObject selected GameObject * @return <code>-1</code> if <var>selArch</var> was found, else <var>listCounter</var> of the arch */ - private int addInvObjects(final GameObject node, final GameObject selArch) { + private int addInvObjects(final GameObject node, final GameObject gameObject) { int selListCounter = -1; for (GameObject arch : node.reverse()) { - if (arch == selArch) { + if (arch == gameObject) { selListCounter = listCounter; } listCounter++; model.addElement(arch); - final int tmpListCounter = addInvObjects(arch, selArch); + + final int tmpListCounter = addInvObjects(arch, gameObject); if (tmpListCounter != -1) { selListCounter = tmpListCounter; } @@ -421,13 +423,12 @@ private static final long serialVersionUID = 1L; /** {@inheritDoc} */ - @Override - public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { + @Override public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); GameObject arch = (GameObject) value; - // arch==null should not happen, but it *can* happen when the active + // arch == null should not happen, but it *can* happen when the active // window gets changed by user and java is still blitting here if (arch != null) { arch = arch.getHead(); @@ -444,8 +445,6 @@ // In the map-tile-window the object names are displayed // next to the icons - arch = arch.getHead(); - if (arch.getObjName() != null && arch.getObjName().length() > 0) { setText(arch.getObjName()); // special name } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 20:53:06
|
Revision: 953 http://svn.sourceforge.net/gridarta/?rev=953&view=rev Author: akirschbaum Date: 2006-12-07 12:53:02 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Unify comments. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java trunk/crossfire/src/cfeditor/map/MapArchObject.java trunk/crossfire/src/cfeditor/map/MapModel.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java trunk/daimonin/src/daieditor/map/MapModel.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-12-07 20:53:02 UTC (rev 953) @@ -74,7 +74,10 @@ */ private ScriptArchData script; - private boolean noface; // if true, arch has no face as default + /** + * If set, the game object has no face as default. + */ + private boolean noface; private int facenr; // the index of faceImages[] @@ -86,7 +89,10 @@ */ private List<GameObject> inv = Collections.EMPTY_LIST; - private int archType; // CF object type of the arch + /** + * Object type. + */ + private int archType; private AutojoinList join; // if nonzero, pointing to the list of autojoining archetypes @@ -284,7 +290,7 @@ } /** - * Insert an GameObject before this GameObject. + * Insert a GameObject before this GameObject. * @param node GameObject to append */ public void insertBefore(final GameObject node) { @@ -292,7 +298,7 @@ } /** - * Insert an GameObject after this GameObject. + * Insert a GameObject after this GameObject. * @param node GameObject to append */ public void insertAfter(final GameObject node) { @@ -693,7 +699,7 @@ /** * Returns whether this GameObject has one or more scripted events defined. - * @return <code>true</code> if this GameObject has one or more scripted events, otherwise <code>false</code>. + * @return <code>true</code> if this GameObject has one or more scripted events, otherwise <code>false</code> */ public boolean isScripted() { return script != null; @@ -729,7 +735,7 @@ * @param eventList JList from the MapArchPanel (script tab) which displays * the events * @param mapanel the MapArchPanel - * @xxx this method knows things it should never know, it is evil! + * @XXX this method knows things it should never know, it is evil! */ public void modifyEventScript(final String eventType, final int task, final JList eventList, final CMapArchPanel mapanel) { if (script != null) { Modified: trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java 2006-12-07 20:53:02 UTC (rev 953) @@ -99,7 +99,10 @@ return facings; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + * @see #getName() + */ public String getAnimName() { return animName; } Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2006-12-07 20:53:02 UTC (rev 953) @@ -1,3 +1,24 @@ +/* + * Daimonin Java Editor. + * Copyright (C) 2005 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + package cfeditor.gameobject.face; import cfeditor.CMainControl; @@ -8,7 +29,7 @@ import org.jetbrains.annotations.NotNull; /** - * Container for Faces. + * This class manages the FaceObjects. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public class FaceObjects extends AbstractFaceObjects<FaceObject> { Modified: trunk/crossfire/src/cfeditor/map/MapArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-12-07 20:53:02 UTC (rev 953) @@ -34,9 +34,8 @@ /** * MapArchObject contains the specific meta data about a map that is stored in - * the map-arch, at the very beginning of the map file. (width, height, - * difficulty level... etc) In former days, this used to be put into an - * ordinary GameObject, but that's just no longer appropriate. + * the map-arch, at the very beginning of the map file. The map metadata is + * information like mapSize, difficulty level, darkness etc.). * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ @SuppressWarnings({"HardcodedLineSeparator"}) @@ -495,10 +494,9 @@ } /** - * Writing the MapArchObject into the mapfile - * @param appendable <code>BufferedWriter</code> to the mapfile - * @throws java.io.FileNotFoundException the mapfile could not be found - * @throws IOException an I/O error occured during writing to the file + * Write the MapArchObject into the mapfile. + * @param appendable <code>Appendable</code> to the mapfile + * @throws IOException an I/O error occured during appending or formatting */ public void writeMapArch(@NotNull final Appendable appendable) throws IOException { int i; Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-12-07 20:53:02 UTC (rev 953) @@ -25,7 +25,7 @@ /** * Checks whether an GameObject (multi-arch) would still fit on this map. - * @param archname name of arch to check + * @param archName name of arch to check * @param pos position of multitile head * @param allowDouble whether overlapping multitile arches should be allowed (check is done using the arch name) * @return whether the multi-arch would still fit on this map @@ -33,11 +33,12 @@ * @retval <code>false</code> otherwise * @todo discuss whether this method really belongs to the interface of MapModel as it is only used by MapModel implementations and heavily depends on how arches, especially multi-tile arches are implemented. */ - boolean isMultiArchFittingToMap(String archname, Point pos, boolean allowDouble); + boolean isMultiArchFittingToMap(String archName, Point pos, boolean allowDouble); /** - * Add a new arch to the map. Including multi tile arches. This function - * allows only to choose from the default arches (->archName). + * Create a game object and add it to the map. + * This function allows only to choose from the default arches (->archName). + * This function also works for multi tile arches. * @param archName Name of a default arch on the ArchetypeSet * @param pos insert-location on this map * @param allowDouble if set, only one arch of the same kind can be @@ -57,8 +58,8 @@ * container-inventory. * @param newarch A clone copy of this GameObject gets inserted to the map. * It can be an arch directly from a pickmap or even a - * default arch. if ('newarch'==null) the default arch of - * number 'archName' gets inserted + * default arch. if ('newarch'==null) the default arch + * 'archName' gets inserted * @param archName Name of a default arch to get inserted. This value gets * used ONLY when 'newarch' is null * @param next the new arch gets inserted before 'next' if @@ -68,7 +69,7 @@ * @param join if set to JOIN_ENABLE auto-joining is supported * @return true if insertion was successful */ - boolean insertArchToMap(GameObject newarch, String archname, GameObject next, Point pos, boolean join); + boolean insertArchToMap(GameObject newarch, String archName, GameObject next, Point pos, boolean join); /** * Delete an existing arch from the map. (If the specified arch doesn't Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-12-07 20:53:02 UTC (rev 953) @@ -96,6 +96,9 @@ */ private ScriptArchData script; + /** + * If set, the game object has no face as default. + */ private boolean noface; /** State where the face comes from. */ @@ -109,7 +112,10 @@ private int direction; - private int archType; // CF object type of the arch + /** + * Object type. + */ + private int archType; /** Editor Folder. */ private String editorFolder; @@ -653,7 +659,7 @@ return clone; } - /** @return true if 'this' arch is part of a multisquare object */ + /** {@inheritDoc} */ public boolean isMulti() { return multi != null; } @@ -666,7 +672,10 @@ script.validateAllEvents(); } - /** @return true when this arch has one or more scripted events defined */ + /** + * Returns whether this GameObject has one or more scripted events defined. + * @return <code>true</code> if this GameObject has one or more scripted events, otherwise <code>false</code> + */ public boolean isScripted() { for (final GameObject tmp : this) { if (tmp.archType == 118) { Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2006-12-07 20:53:02 UTC (rev 953) @@ -48,7 +48,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; - /** * The <code>AnimationObject</code>. * AnimationObjects are iterated in Unicode (=ASCII) order. Modified: trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-07 20:53:02 UTC (rev 953) @@ -20,7 +20,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. - * */ package daieditor.gui.map; Modified: trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2006-12-07 20:53:02 UTC (rev 953) @@ -82,7 +82,7 @@ private final JTextField mapName = new JTextField(); // name of arch - private final JTextField mapSound = new JTextField(); // name of arch + private final JTextField mapSound = new JTextField(); // name of soundfile private final JFormattedTextField levelWidthField = new JFormattedTextField(); // len x Modified: trunk/daimonin/src/daieditor/map/MapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapModel.java 2006-12-07 20:24:00 UTC (rev 952) +++ trunk/daimonin/src/daieditor/map/MapModel.java 2006-12-07 20:53:02 UTC (rev 953) @@ -21,7 +21,7 @@ /** * Checks whether an GameObject (multi-arch) would still fit on this map. - * @param archname name of arch to check + * @param archName name of arch to check * @param pos position of multitile head * @param allowDouble whether overlapping multitile arches should be allowed (check is done using the arch name) * @return whether the multi-arch would still fit on this map @@ -29,32 +29,33 @@ * @retval <code>false</code> otherwise * @todo discuss whether this method really belongs to the interface of MapModel as it is only used by MapModel implementations and heavily depends on how arches, especially multi-tile arches are implemented. */ - boolean isMultiArchFittingToMap(String archname, Point pos, boolean allowDouble); + boolean isMultiArchFittingToMap(String archName, Point pos, boolean allowDouble); /** - * Create a new arch and add it to the map. - * This function allows only to choose from the default arches (->archname). + * Create a game object and add it to the map. + * This function allows only to choose from the default arches (->archName). * This function also works for multi tile arches. - * @param archname ID from a default arch on the ArchetypeSet + * @param archName Name of a default arch on the ArchetypeSet * @param pos insert-location on this map - * @param allowDouble whether inserting more than one arch of the same type is allowed + * @param allowDouble if set, only one arch of the same kind can be + * inserted per square * @param insertBelow true: new arch is inserted on top, false: new arch is * inserted below * @return true if insertion successful, false if not * @todo discuss whether this method really belongs to a map model, as implementing this would require the map model to know more than is desireable (e.g. ArchObjectStack + MainControl). */ - boolean addArchToMap(String archname, Point pos, boolean allowDouble, boolean insertBelow); + boolean addArchToMap(String archName, Point pos, boolean allowDouble, boolean insertBelow); /** * Insert a new arch to the map at a specified position. This function - * allows either to choose from the default arches (->archname) or to insert + * allows either to choose from the default arches (->archName) or to insert * a copy from an existing arch (->newarch). It also works for * container-inventory. * @param newarch A clone copy of this GameObject gets inserted to the map. * It can be an arch directly from a pickmap or even a * default arch. if ('newarch'==null) the default arch - * 'archname' gets inserted - * @param archname ID from a default arch to get inserted. This value gets + * 'archName' gets inserted + * @param archName Name of a default arch to get inserted. This value gets * used ONLY when 'newarch' is null * @param next the new arch gets inserted before 'next' if * ('next'==null) the arch gets inserted at bottom @@ -62,7 +63,7 @@ * @param pos map position to insert the new arch * @return true if insertion was successful */ - boolean insertArchToMap(GameObject newarch, String archname, GameObject next, Point pos); + boolean insertArchToMap(GameObject newarch, String archName, GameObject next, Point pos); /** * Get the first exit on the MapSquare described by <var>hspot</var>. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 23:23:29
|
Revision: 955 http://svn.sourceforge.net/gridarta/?rev=955&view=rev Author: akirschbaum Date: 2006-12-07 15:23:29 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Unify CMainStatusbar. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainStatusbar.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/messages_de.properties trunk/daimonin/src/daieditor/CArchPanelPan.java trunk/daimonin/src/daieditor/CMainStatusbar.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/messages.properties trunk/src/app/net/sf/gridarta/messages.properties Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/ChangeLog 2006-12-07 23:23:29 UTC (rev 955) @@ -1,5 +1,7 @@ 2006-12-07 Andreas Kirschbaum + * Make mouse position display work again. + * Do not insert multiple identical objects while dragging the mouse. Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-12-07 23:23:29 UTC (rev 955) @@ -271,7 +271,7 @@ final GameObject archetype = archetypeSet.getArchetype(archetypeName); if (isSelected) { archPanel.setSelectedArch(archetypeName); - mainControl.setStatusText(" " + archetypeName + " "); + mainControl.setStatusText(archetypeName); } assert archetype != null : "Archetype not found: " + archetypeName; setText(archetypeName); Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-07 23:23:29 UTC (rev 955) @@ -281,7 +281,11 @@ CFTreasureListTree.getInstance().showDialog(); } - private FaceObjects getFaceObjects() { + /** + * Get the Face Objects. + * @return faceObjects + */ + public FaceObjects getFaceObjects() { return faceObjects; } @@ -600,16 +604,12 @@ * @param filename desired filename for the new map, null if not specified */ public void newLevelWanted(final String filename) { - CMainStatusbar.getInstance().setText(" Creating new map..."); CNewMapDialog.showNewMapDialog(this, mainView, filename, MapType.GAMEMAP); - CMainStatusbar.getInstance().setText(""); } /** Invoked when user wants to open a new pickmap. */ public void addNewPickmap() { - CMainStatusbar.getInstance().setText(" Creating new pickmap..."); CNewMapDialog.showNewMapDialog(this, mainView, null, MapType.PICKMAP); - CMainStatusbar.getInstance().setText(""); } /** @@ -622,10 +622,10 @@ */ public MapControl newLevel(final List<GameObject> objects, final MapArchObject maparch, final boolean view, final Point initial) { // Create a new level control and set the level view from that - CMainStatusbar.getInstance().setText(" Creating new map " + maparch.getMapDisplayName()); final MapControl map = new MapControl(this, objects, maparch, false, initial); if (view) { + setStatusText("Creating new map " + maparch.getMapDisplayName()); mainView.addLevelView(map.getMapViewFrame()); // one view... map.getMapViewFrame().setAutoscrolls(true); levels.add(map); Modified: trunk/crossfire/src/cfeditor/CMainStatusbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-12-07 23:23:29 UTC (rev 955) @@ -2,6 +2,7 @@ * Crossfire Java Editor. * Copyright (C) 2000 Michael Toennies * Copyright (C) 2001 Andreas Vogl + * Copyright (C) 2005 Christian Hujer * * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) * @@ -24,11 +25,21 @@ package cfeditor; -import java.awt.BorderLayout; +import cfeditor.gui.map.DefaultLevelRenderer; +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Point; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; import java.text.NumberFormat; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.border.BevelBorder; +import net.sf.gridarta.gui.map.MapCursor; +import net.sf.gridarta.gui.map.MapCursorEvent; +import net.sf.gridarta.gui.map.MapCursorListener; +import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.Nullable; /** @@ -38,27 +49,36 @@ * panels. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> + * @todo Separate labels and methods for mouse coordinates */ -public final class CMainStatusbar extends JPanel { +public final class CMainStatusbar extends JPanel implements MapCursorListener, MouseMotionListener { /** Serial Version UID. */ private static final long serialVersionUID = 1L; - /** The most recent instance of this statusbar class. */ - private static CMainStatusbar staticStatusbar = null; + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); /** Controller of this statusbar view. */ private final CMainControl mainControl; + /** The label that shows the mouse. */ + private final JLabel mouse; + + /** The label that shows the cursor. */ + private final JLabel cursor; + /** The label that shows the one line text message. */ private final JLabel status; - /** The label that shows the level status. */ - private final JLabel levelStatus; - /** The label that shows the memory status. */ private final JLabel memory; + /** Temporary used to get map coordinates */ + private final Point mouseMapTmp = new Point(); + /** * Constructs a statusbar that has the given main controller object set * as its controller. @@ -66,56 +86,43 @@ */ public CMainStatusbar(final CMainControl mainControl) { this.mainControl = mainControl; + setLayout(new GridBagLayout()); + setBorder(new BevelBorder(BevelBorder.LOWERED)); - setLayout(new BorderLayout()); + final GridBagConstraints gbc = new GridBagConstraints(); + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.anchor = GridBagConstraints.WEST; + gbc.ipadx = 1; - final JPanel mainPanel = new JPanel(new BorderLayout()); - mainPanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); - status = new JLabel(" "); - mainPanel.add(status, BorderLayout.CENTER); + gbc.weightx = 0.0; + mouse = new JLabel(" "); + mouse.setBorder(new BevelBorder(BevelBorder.LOWERED)); + add(mouse, gbc); - add(mainPanel, BorderLayout.CENTER); + cursor = new JLabel(" "); + cursor.setBorder(new BevelBorder(BevelBorder.LOWERED)); + add(cursor, gbc); - final JPanel infoPanel = new JPanel(new BorderLayout()); + gbc.weightx = 5.0; + status = new JLabel(" "); + status.setBorder(new BevelBorder(BevelBorder.LOWERED)); + add(status, gbc); - final JPanel levelInfoPanel = new JPanel(new BorderLayout()); - levelInfoPanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); - levelStatus = new JLabel(" "); - levelInfoPanel.add(levelStatus, BorderLayout.CENTER); - infoPanel.add(levelInfoPanel, BorderLayout.CENTER); - - final JPanel memInfoPanel = new JPanel(new BorderLayout()); - memInfoPanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); - memory = new JLabel(" "); - memInfoPanel.add(memory, BorderLayout.CENTER); - infoPanel.add(memInfoPanel, BorderLayout.WEST); - - mainPanel.add(infoPanel, BorderLayout.EAST); - - staticStatusbar = this; + gbc.weightx = 0.0; + memory = new JLabel(" "); + memory.setBorder(new BevelBorder(BevelBorder.LOWERED)); + add(memory, gbc); } /** - * Returns the instance of this statusbar once its created by someone. - * @return The statusbar. + * Sets the level status text, which usually displays arch numbers. + * @param text String to set */ - public static CMainStatusbar getInstance() { - return staticStatusbar; + public void setStatusText(final String text) { + status.setText(text); + refresh(); } - /** - * Sets the one line text displayed to the user. - * @param strText The text to be set. - */ - public void setText(final String strText) { - status.setText(strText); - repaint(); - } - - void setStatusText(final String string) { - levelStatus.setText(string != null ? string : " "); - } - /** Refreshes the memory usage info panel. */ void refresh() { final Runtime runtime = Runtime.getRuntime(); @@ -123,10 +130,11 @@ final long totMem = runtime.totalMemory(); final long usedMem = totMem - freeMem; - memory.setText(" ( " + mainControl.getArchetypeSet().getArchetypeCount() - + "/" + mainControl.getArchetypeSet().getFaceCount() - + " ) Memory Use:" + getMemoryString(usedMem) + "/" + getMemoryString(totMem)); - repaint(); + memory.setText(ACTION_FACTORY.format("memory", + mainControl.getArchetypeSet().getArchetypeCount(), + mainControl.getFaceObjects().size(), + getMemoryString(usedMem), getMemoryString(freeMem), getMemoryString(totMem) + )); } /** The DecimalFormat to use for formatting the numbers in {@link #getMemoryString(long)}.. */ @@ -157,4 +165,62 @@ return null; } + public void mapCursorChangedPos(final MapCursorEvent e) { + mapCursorChanged(e.getSource()); + } + + public void mapCursorChangedMode(final MapCursorEvent e) { + mapCursorChanged(e.getSource()); + } + + /** Set coordinates of MapCursor to cursor label and the offset when in drag mode. */ + private void mapCursorChanged(final MapCursor mapCursor) { + final String formatCursor; + if (mapCursor.isActive()) { + final Point pos = mapCursor.getLocation(); + assert pos != null; + final int cursorX = pos.x; + final int cursorY = pos.y; + if (mapCursor.isDragging()) { + final Dimension offset = mapCursor.getDragOffset(); + assert offset != null; + final int offsetX = Math.abs(offset.width) + 1; + final int offsetY = Math.abs(offset.height) + 1; + formatCursor = ACTION_FACTORY.format("statusSelect", cursorX, cursorY, offsetX, offsetY); + } else { + formatCursor = ACTION_FACTORY.format("statusNormal", cursorX, cursorY); + } + } else { + formatCursor = ACTION_FACTORY.format("statusCursorOff"); + } + cursor.setText(formatCursor); + } + + public void mouseDragged(final MouseEvent e) { + mousePosChanged(e); + } + + public void mouseMoved(final MouseEvent e) { + mousePosChanged(e); + } + + /** + * Set new mouse and map coordinates to mouse label + * @param e Event that was fired from #MapCursor + */ + private void mousePosChanged(final MouseEvent e) { + final Point mousePos = e.getPoint(); + final int mouseX = mousePos.x; + final int mouseY = mousePos.y; + final DefaultLevelRenderer renderer = (DefaultLevelRenderer) e.getSource(); + final Point mouseMap = renderer.getTileLocationAt(mousePos, mouseMapTmp); + if (mouseMap != null) { + final int mouseMapX = mouseMap.x; + final int mouseMapY = mouseMap.y; + mouse.setText(ACTION_FACTORY.format("statusMouseOn", mouseX, mouseY, mouseMapX, mouseMapY)); + } else { + mouse.setText(ACTION_FACTORY.format("statusMouseOff", mouseX, mouseY)); + } + } + } // class CMainStatusbar Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-12-07 23:23:29 UTC (rev 955) @@ -196,9 +196,6 @@ //getContentPane().add(toolBar, BorderLayout.NORTH); getContentPane().add(toolBar, BorderLayout.WEST); // put it left - statusBar = new CMainStatusbar(mainControl); - getContentPane().add(statusBar, BorderLayout.SOUTH); - menu = new CMainMenu(mainControl); setJMenuBar(menu); @@ -207,6 +204,9 @@ pickmapPanel.setBorder(BorderFactory.createEmptyBorder(IGUIConstants.SPACE_PICKARCH_TOP, 0, 0, 0)); CPickmapPanel.getInstance().addPickmapSelectionListener(pickmapPanel); + statusBar = new CMainStatusbar(mainControl); + getContentPane().add(statusBar, BorderLayout.SOUTH); + // Build the placeholder for tile palette archPanel = new CArchPanel(mainControl); mapTileList = new CMapTileList(mainControl, this); @@ -393,10 +393,10 @@ /** * Set the status message to be displayed in the status bar. - * @param string status message to be displayed + * @param statusText status message to be displayed */ - public void setStatusText(final String string) { - statusBar.setStatusText(string); + public void setStatusText(final String statusText) { + statusBar.setStatusText(statusText); } /** @@ -736,4 +736,8 @@ public void internalFrameDeactivated(final InternalFrameEvent e) { } + public CMainStatusbar getStatusBar() { + return statusBar; + } + } // class CMainView Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-07 23:23:29 UTC (rev 955) @@ -152,7 +152,8 @@ final CListener listener = new CListener(); ((JComponent) renderer).addMouseListener(listener); if (!isPickmap()) { - ((JComponent) renderer).addMouseMotionListener(listener); + renderer.addMouseMotionListener(listener); + renderer.addMouseMotionListener(mainControl.getMainView().getStatusBar()); } renderer.updateLookAndFeel(); } @@ -514,7 +515,7 @@ public void mousePressed(final MouseEvent e) { changedFlagNotify(); // set flag: map has changed final Point clickPoint = e.getPoint(); - final Point mapLoc = renderer.getTileLocationAt(clickPoint); + final Point mapLoc = renderer.getTileLocationAt(clickPoint, null); needRedraw = null; Point[] preRedraw = null; // array of tile coords which need to be redrawn boolean needFullRepaint = false; // true if full repaint of map needed @@ -604,33 +605,20 @@ /** {@inheritDoc} */ public void mouseMoved(final MouseEvent event) { - final int xp, yp; - - final Point dragPoint = event.getPoint(); - xp = (int) dragPoint.getX(); - yp = (int) dragPoint.getY(); - - // draw Mouse coordinates into the status bar (bottom of window) - if (mapMousePos.x == -1 && mapMousePos.y == -1) { - CMainStatusbar.getInstance().setText(" Mouse off Map"); - } else { - CMainStatusbar.getInstance().setText(" Mouse x:" + (int) xp + " y:" + (int) yp + " MAP x:" + mapMousePos.x + " y:" + mapMousePos.y); - } // repaint(); // we should blt here with clipping... // this paints the whole map again, but we want only the marker } /** {@inheritDoc} */ public void mouseDragged(final MouseEvent event) { - final int xp, yp; - changedFlagNotify(); Point[] needRedraw = null; // array of tile coords which need to be redrawn final Point dragPoint = event.getPoint(); // Mouse pointer - xp = (int) dragPoint.getX(); - yp = (int) dragPoint.getY(); - final Point temp = renderer.getTileLocationAt(dragPoint); // tile under Mouse pointer + Point temp = renderer.getTileLocationAt(dragPoint, null); // tile under Mouse pointer + if (temp == null) { + temp = new Point(-1, -1); + } if (event.getModifiers() == MouseEvent.BUTTON1_MASK) { // Left Mouse Button: Selected area gets highlighted @@ -646,20 +634,8 @@ renderer.modelChanged(); } - - // print location infos on status bar - if (highlightOn && (mapMouseRightOff.x != 0 || mapMouseRightOff.y != 0)) { - CMainStatusbar.getInstance().setText(" Mouse x:" + (int) xp + " y:" + (int) yp + " MAP x:" + mapMousePos.x + " y:" + mapMousePos.y - + " Selected x:" + (int) (Math.abs(mapMouseRightOff.x) + 1) + " y:" + (int) (Math.abs(mapMouseRightOff.y + 1))); - } else { - CMainStatusbar.getInstance().setText(" Mouse x:" + (int) xp + " y:" + (int) yp + " MAP x:" + mapMousePos.x + " y:" + mapMousePos.y); - } } else if (event.getModifiers() == MouseEvent.BUTTON3_MASK) { // Right Mouse Button: Arches get inserted all the way - - CMainStatusbar.getInstance().setText("Mouse x:" + (int) xp + " y:" + (int) yp + " MAP x:" + mapMousePos.x + " y:" + mapMousePos.y - + " Insert: " + insertArchName); - if (temp.x != mapMouseRightPos.x || mapMouseRightPos.y != temp.y) { mapMouseRightPos.x = temp.x; mapMouseRightPos.y = temp.y; Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-07 23:23:29 UTC (rev 955) @@ -28,7 +28,6 @@ import cfeditor.CArchPanel; import cfeditor.CFTreasureListTree; import cfeditor.CMainControl; -import cfeditor.CMainStatusbar; import cfeditor.CPickmapPanel; import cfeditor.IGUIConstants; import cfeditor.gameobject.face.FaceObject; @@ -128,7 +127,7 @@ if (log.isInfoEnabled()) { log.info("Start to collect archetypes..."); } - CMainStatusbar.getInstance().setText(" Loading Archetypes... "); + mainControl.setStatusText("Loading Archetypes..."); // browse arch archive // load object from a arch file you found @@ -143,17 +142,17 @@ loadArchetypesFromFiles(f, 0); // collect arches & images from individual files } - CMainStatusbar.getInstance().setText(" Sorting..."); + mainControl.setStatusText("Sorting..."); connectFaces(); // attach faces to arches mainControl.setTabPaneEnabled(true); mainControl.getMainView().finishArchPanelBuildProccess(); System.gc(); // load the autojoin lists - CMainStatusbar.getInstance().setText(" Loading Autojoin Tables..."); + mainControl.setStatusText("Loading Autojoin Tables..."); mainControl.loadJoinlist(); - CMainStatusbar.getInstance().setText(" Ready."); + mainControl.setStatusText("Ready."); // print message if no arches were found if (getArchetypeCount() == 0) { @@ -237,16 +236,16 @@ int len; if ((len = name.length()) >= 5) { if (name.regionMatches(len - 5, ".face", 0, 5)) { - //CMainStatusbar.getInstance().setText(" Loading Face: "+name); + //mainControl.setstatusText(" Loading Face: "+name); parseDefFace(f.getAbsolutePath()); } if ((len = name.length()) >= 4) { if (name.regionMatches(len - 4, ".arc", 0, 4)) { - //CMainStatusbar.getInstance().setText(" Loading Arch: "+name); + //mainControl.setStatusText("Loading Arch: "+name); mainControl.getArchetypeParser().parseArchetype(f.getAbsolutePath(), index); } else if (name.regionMatches(len - 4, ".png", 0, 4)) { - //CMainStatusbar.getInstance().setText(" Loading PNG: "+name); + //mainControl.setStatusText("Loading PNG: "+name); if (mainControl.getImageSet() == null || name.contains("." + mainControl.getImageSet() + ".")) { addPNGFace(f.getAbsolutePath(), name); } @@ -515,7 +514,7 @@ public boolean collectFaces(final Progress progress, final File destDir) throws IOException { try { final File dfile = new File(destDir, IGUIConstants.PNG_FILE); - CMainStatusbar.getInstance().setText("Collect Archfile: write images"); + mainControl.setStatusText("Collect Archfile: write images"); final DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(dfile))); Modified: trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObjects.java 2006-12-07 23:23:29 UTC (rev 955) @@ -61,7 +61,7 @@ // Copy from ArchetypeSet. /* try { - CMainStatusbar.getInstance().setText("Collect Archfile: write animations"); + mainControl.setStatusText("Collect Archfile: write animations"); final DataOutputStream out = new DataOutputStream( new BufferedOutputStream(new FileOutputStream("animations"))); Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:23:29 UTC (rev 955) @@ -57,7 +57,7 @@ * The component that does the actual rendering of tiles in the palette. * Flat version */ -public final class DefaultLevelRenderer extends JComponent implements LevelRenderer { +public final class DefaultLevelRenderer extends LevelRenderer { private static final Logger log = Logger.getLogger(DefaultLevelRenderer.class); @@ -465,29 +465,33 @@ * Returns the map location at the given point or null if no map location * is at the point. * @param point The coordinates in the renderer view. + * @param retPoint if <cod>(retPoint != null)</code> this point will be returned otherwise a new point will be created * @return The map location. */ - - // i'll change it to a fixed point... i want use this for mouse tracking - // and don't want have millions of mallocs here - // this should be reworked more intelligent later - @Nullable public Point getTileLocationAt(@NotNull final Point point) { + @Nullable public Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint) { try { renderTransform.inverseTransform(point, point); } catch (final NoninvertibleTransformException e) { } mapViewBasic.setMapMousePos(new Point(-1, -1)); - final Point mpoint = new Point(); - mpoint.x = mapViewBasic.getMapMousePos().x; - mpoint.y = mapViewBasic.getMapMousePos().y; - if (point.x >= 0 && point.x < mapViewBasic.getMapSize().getWidth() * 32 && point.y >= 0 && point.y < mapViewBasic.getMapSize().getHeight() * 32) { + final Size2D mapSize = mapViewBasic.getMapControl().getMapSize(); + if (point.x >= 0 && point.x < mapSize.getWidth() * 32 && point.y >= 0 && point.y < mapSize.getHeight() * 32) { mapViewBasic.setMapMousePos(new Point(point.x / 32, point.y / 32)); } - mpoint.x = mapViewBasic.getMapMousePos().x; - mpoint.y = mapViewBasic.getMapMousePos().y; - return mpoint; + final int xm = mapViewBasic.getMapMousePos().x; + final int ym = mapViewBasic.getMapMousePos().y; + + if (xm < 0 || xm >= mapSize.getWidth() || ym < 0 || ym >= mapSize.getHeight()) { + return null; + } + if (retPoint != null) { + retPoint.setLocation(xm, ym); + return retPoint; + } + + return new Point(xm, ym); } public boolean resizeBackBuffer() { Modified: trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-07 23:23:29 UTC (rev 955) @@ -23,30 +23,33 @@ import java.awt.Graphics; import java.awt.Point; import java.awt.image.BufferedImage; +import javax.swing.JComponent; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * A lavel renderer, mainly used as central point interfac to iso and flat * renderer * @author tchize */ -public interface LevelRenderer { +public abstract class LevelRenderer extends JComponent { - void updateLookAndFeel(); + public abstract void updateLookAndFeel(); - BufferedImage getFullImage(); + public abstract BufferedImage getFullImage(); - void paintTile(Point point); + public abstract void paintTile(final Point point); - Point getTileLocationAt(Point point); + @Nullable public abstract Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint); - boolean isPickmap(); + public abstract boolean isPickmap(); - void modelChanged(); + public abstract void modelChanged(); - void setHighlightTile(Point point); + public abstract void setHighlightTile(final Point point); - boolean resizeBackBuffer(); + public abstract boolean resizeBackBuffer(); - void freeBackBuffer(); + public abstract void freeBackBuffer(); } // interface LevelRenderer Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-07 23:23:29 UTC (rev 955) @@ -25,7 +25,6 @@ package cfeditor.map; import cfeditor.CMainControl; -import cfeditor.CMainStatusbar; import cfeditor.CMapViewBasic; import cfeditor.IGUIConstants; import cfeditor.MapViewIFrame; @@ -384,9 +383,9 @@ */ public void save() { if (isPickmap()) { - CMainStatusbar.getInstance().setText("Saving pickmap '" + getMapFileName() + "'..."); + mainControl.setStatusText("Saving pickmap '" + getMapFileName() + "'..."); } else { - CMainStatusbar.getInstance().setText("Saving map '" + getMapFileName() + "'..."); + mainControl.setStatusText("Saving map '" + getMapFileName() + "'..."); } assert mapFile != null; mainControl.encodeMapFile(mapFile, mapModel); @@ -399,7 +398,7 @@ * @param file the file to be saved to */ public void saveAs(@NotNull final File file) { - CMainStatusbar.getInstance().setText("Saving the map to a file..."); + mainControl.setStatusText("Saving the map to a file..."); mainControl.encodeMapFile(file, mapModel); mapModel.resetLevelChangedFlag(); mapViewFrame.changedFlagNotify(); Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-07 23:23:29 UTC (rev 955) @@ -211,3 +211,16 @@ archCollectErrorIOException.title=Fehler beim Sammeln archCollectErrorIOException.message=Fehler beim Sammeln: In {0} ist ein Ein-/Ausgabefehler ist aufgetreten:\n{1} dialogDontShowAgain=Diesen Dialog n\xE4chstes Mal wieder anzeigen. + +############# +# Status Bar +memory=({0}/{1}) Speicher: {2} belegt, {3} frei, {4} gesamt. + +################## +# Status Messages + +statusMouseOff=Mouse x:{0,number,integer} y:{1,number,integer} Maus nicht auf Karte +statusMouseOn=Mouse x:{0,number,integer} y:{1,number,integer} Karte x:{2,number,integer} y:{3,number,integer} +statusSelect=Cursor x:{0,number,integer} y:{1,number,integer} Offset x:{2,number,integer} y:{3,number,integer} +statusNormal=Cursor x:{0,number,integer} y:{1,number,integer} +statusCursorOff=Maus nicht auf Karte Modified: trunk/daimonin/src/daieditor/CArchPanelPan.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-07 23:23:29 UTC (rev 955) @@ -275,7 +275,7 @@ final GameObject archetype = archetypeSet.getArchetype(archetypeName); if (isSelected) { // XXX it is not a good idea to query the selection information at this place. archPanel.setSelectedArch(archetypeName); - mainControl.setStatusText(' ' + value.toString() + ' '); + mainControl.setStatusText(value.toString()); } setText(archetypeName); Modified: trunk/daimonin/src/daieditor/CMainStatusbar.java =================================================================== --- trunk/daimonin/src/daieditor/CMainStatusbar.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/daimonin/src/daieditor/CMainStatusbar.java 2006-12-07 23:23:29 UTC (rev 955) @@ -222,4 +222,5 @@ mouse.setText(ACTION_FACTORY.format("statusMouseOff", mouseX, mouseY)); } } + } // class CMainStatusbar Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2006-12-07 23:23:29 UTC (rev 955) @@ -126,7 +126,7 @@ if (log.isInfoEnabled()) { log.info("Start to load archetypes..."); } - mainControl.setStatusText(" Loading Archetypes... "); + mainControl.setStatusText("Loading Archetypes..."); // browse arch archive // load object from a arch file you found @@ -150,10 +150,10 @@ loadArchesFromArtifacts(mainControl.getMapDefaultFolder()); mainControl.setTabPaneEnabled(true); - mainControl.setStatusText(" Sorting..."); + mainControl.setStatusText("Sorting..."); connectFaces(); // attach faces to arches - mainControl.setStatusText(" Ready."); + mainControl.setStatusText("Ready."); // print message if no arches were found if (getArchetypeCount() == 0) { @@ -366,11 +366,11 @@ } } else if (f.isFile()) { // watch out for stuff that's not a file and not a directory!!! if (name.endsWith(".arc")) { - //CMainStatusbar.getInstance().setText(" Loading Arch: "+ name); + //mainControl.setStatusText("Loading Arch: "+ name); currentFile = f; mainControl.getArchetypeParser().parseArchetype(f.getPath(), index); } else if (name.endsWith(".png")) { - //CMainStatusbar.getInstance().setText(" Loading PNG: "+ name); + //mainControl.setStatusText("Loading PNG: "+ name); addPNGFace(f.getAbsolutePath(), name); } else if (name.endsWith(".anim")) { animFiles.add(f); Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/daimonin/src/daieditor/messages.properties 2006-12-07 23:23:29 UTC (rev 955) @@ -209,11 +209,6 @@ ################## # Status Messages -statusMouseOff=Mouse x:{0,number,integer} y:{1,number,integer} Mouse off map -statusMouseOn=Mouse x:{0,number,integer} y:{1,number,integer} Map x:{2,number,integer} y:{3,number,integer} -statusSelect=Cursor x:{0,number,integer} y:{1,number,integer} Offset x:{2,number,integer} y:{3,number,integer} -statusNormal=Cursor x:{0,number,integer} y:{1,number,integer} -statusCursorOff=Cursor off map mapImagesOutOfMemory=Out of memory creating map image ####### @@ -802,10 +797,6 @@ Validator.TilePaths.title=Tile path invalid Validator.TilePaths.msg=<html><h3>{0}</h3><p>This map has invalid tile paths.<br>Go to the map properties dialog and change the map tile paths. -############# -# Status Bar -memory=({0}/{1}) Memory: {2} used, {3} free, {4} total. - ####################### # Various Log Messages canonIOE=IOException while canonizing path: {0} Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2006-12-07 21:17:55 UTC (rev 954) +++ trunk/src/app/net/sf/gridarta/messages.properties 2006-12-07 23:23:29 UTC (rev 955) @@ -176,6 +176,19 @@ fileDialog.filter.python=Python Scripts +############# +# Status Bar +memory=({0}/{1}) Memory: {2} used, {3} free, {4} total. + +################## +# Status Messages + +statusMouseOff=Mouse x:{0,number,integer} y:{1,number,integer} Mouse off map +statusMouseOn=Mouse x:{0,number,integer} y:{1,number,integer} Map x:{2,number,integer} y:{3,number,integer} +statusSelect=Cursor x:{0,number,integer} y:{1,number,integer} Offset x:{2,number,integer} y:{3,number,integer} +statusNormal=Cursor x:{0,number,integer} y:{1,number,integer} +statusCursorOff=Cursor off map + ####################### # Various Log Messages saveLevelAsWithNull=DEBUG: CMainControl.saveLevelAsWanted(CMapControl level) invoked with null argument. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 23:26:22
|
Revision: 956 http://svn.sourceforge.net/gridarta/?rev=956&view=rev Author: akirschbaum Date: 2006-12-07 15:26:23 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Use LevelRenderer. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainStatusbar.java trunk/daimonin/src/daieditor/CMainStatusbar.java Modified: trunk/crossfire/src/cfeditor/CMainStatusbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-12-07 23:23:29 UTC (rev 955) +++ trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-12-07 23:26:23 UTC (rev 956) @@ -25,7 +25,7 @@ package cfeditor; -import cfeditor.gui.map.DefaultLevelRenderer; +import cfeditor.gui.map.LevelRenderer; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -212,7 +212,7 @@ final Point mousePos = e.getPoint(); final int mouseX = mousePos.x; final int mouseY = mousePos.y; - final DefaultLevelRenderer renderer = (DefaultLevelRenderer) e.getSource(); + final LevelRenderer renderer = (LevelRenderer) e.getSource(); final Point mouseMap = renderer.getTileLocationAt(mousePos, mouseMapTmp); if (mouseMap != null) { final int mouseMapX = mouseMap.x; Modified: trunk/daimonin/src/daieditor/CMainStatusbar.java =================================================================== --- trunk/daimonin/src/daieditor/CMainStatusbar.java 2006-12-07 23:23:29 UTC (rev 955) +++ trunk/daimonin/src/daieditor/CMainStatusbar.java 2006-12-07 23:26:23 UTC (rev 956) @@ -25,7 +25,7 @@ package daieditor; -import daieditor.gui.map.DefaultLevelRenderer; +import daieditor.gui.map.LevelRenderer; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -212,7 +212,7 @@ final Point mousePos = e.getPoint(); final int mouseX = mousePos.x; final int mouseY = mousePos.y; - final DefaultLevelRenderer renderer = (DefaultLevelRenderer) e.getSource(); + final LevelRenderer renderer = (LevelRenderer) e.getSource(); final Point mouseMap = renderer.getTileLocationAt(mousePos, mouseMapTmp); if (mouseMap != null) { final int mouseMapX = mouseMap.x; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 23:29:54
|
Revision: 957 http://svn.sourceforge.net/gridarta/?rev=957&view=rev Author: akirschbaum Date: 2006-12-07 15:29:54 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Comment changes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:26:23 UTC (rev 956) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:29:54 UTC (rev 957) @@ -461,13 +461,7 @@ } } - /** - * Returns the map location at the given point or null if no map location - * is at the point. - * @param point The coordinates in the renderer view. - * @param retPoint if <cod>(retPoint != null)</code> this point will be returned otherwise a new point will be created - * @return The map location. - */ + /** {@inheritDoc} */ @Nullable public Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint) { try { renderTransform.inverseTransform(point, point); Modified: trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-07 23:26:23 UTC (rev 956) +++ trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-07 23:29:54 UTC (rev 957) @@ -28,8 +28,8 @@ import org.jetbrains.annotations.Nullable; /** - * A lavel renderer, mainly used as central point interfac to iso and flat - * renderer + * A lavel renderer, mainly used as central point to iso and flat renderer. + * * @author tchize */ public abstract class LevelRenderer extends JComponent { @@ -40,6 +40,13 @@ public abstract void paintTile(final Point point); + /** + * Returns the map location at the given point or null if no map location + * is at the point. + * @param point The coordinates in the renderer view. + * @param retPoint if <cod>(retPoint != null)</code> this point will be returned otherwise a new point will be created + * @return The map location. + */ @Nullable public abstract Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint); public abstract boolean isPickmap(); @@ -52,4 +59,4 @@ public abstract void freeBackBuffer(); -} // interface LevelRenderer +} // class LevelRenderer Modified: trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:26:23 UTC (rev 956) +++ trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:29:54 UTC (rev 957) @@ -428,13 +428,7 @@ } } - /** - * Returns the map location at the given point or null if no map location - * is at the point. - * @param point The coordinates in the renderer view. - * @param retPoint if <cod>(retPoint != null)</code> this point will be returned otherwise a new point will be created - * @return The map location. - */ + /** {@inheritDoc} */ @Nullable public Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint) { final int x0 = point.x - origin.x; Modified: trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java 2006-12-07 23:26:23 UTC (rev 956) +++ trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java 2006-12-07 23:29:54 UTC (rev 957) @@ -27,10 +27,22 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +/** + * A lavel renderer, mainly used as central point to iso and flat renderer. + * + * @author tchize + */ public abstract class LevelRenderer extends JComponent { public abstract BufferedImage getFullImage(); + /** + * Returns the map location at the given point or null if no map location + * is at the point. + * @param point The coordinates in the renderer view. + * @param retPoint if <cod>(retPoint != null)</code> this point will be returned otherwise a new point will be created + * @return The map location. + */ @Nullable public abstract Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint); } // class LevelRenderer This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-07 23:38:31
|
Revision: 959 http://svn.sourceforge.net/gridarta/?rev=959&view=rev Author: akirschbaum Date: 2006-12-07 15:38:31 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Comment changes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:32:40 UTC (rev 958) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:38:31 UTC (rev 959) @@ -149,9 +149,7 @@ return isPickmap; } - /** - * @return an image of the entire mapview - */ + /** {@inheritDoc} */ public BufferedImage getFullImage() { final Size2D mapSize = mapControl.getMapSize(); final int mapWidth = 32 * mapSize.getWidth(); Modified: trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-07 23:32:40 UTC (rev 958) +++ trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-07 23:38:31 UTC (rev 959) @@ -36,6 +36,9 @@ public abstract void updateLookAndFeel(); + /** + * @return an image of the entire mapview + */ public abstract BufferedImage getFullImage(); public abstract void paintTile(final Point point); Modified: trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:32:40 UTC (rev 958) +++ trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-07 23:38:31 UTC (rev 959) @@ -184,9 +184,7 @@ return isPickmap; } - /** - * @return an image of the entire mapview - */ + /** {@inheritDoc} */ @Override public BufferedImage getFullImage() { // set map dimensions for iso view final int sum = mapSize.getWidth() + mapSize.getHeight(); Modified: trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java 2006-12-07 23:32:40 UTC (rev 958) +++ trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java 2006-12-07 23:38:31 UTC (rev 959) @@ -34,6 +34,9 @@ */ public abstract class LevelRenderer extends JComponent { + /** + * @return an image of the entire mapview + */ public abstract BufferedImage getFullImage(); /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-08 23:28:48
|
Revision: 960 http://svn.sourceforge.net/gridarta/?rev=960&view=rev Author: akirschbaum Date: 2006-12-08 15:28:46 -0800 (Fri, 08 Dec 2006) Log Message: ----------- Unify CMapArchPanel. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/messages_de.properties trunk/daimonin/src/daieditor/messages.properties trunk/src/app/net/sf/gridarta/messages.properties Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-07 23:38:31 UTC (rev 959) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-12-08 23:28:46 UTC (rev 960) @@ -34,8 +34,7 @@ import java.awt.GridLayout; import java.awt.Insets; import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; +import javax.swing.Action; import javax.swing.BoxLayout; import javax.swing.DefaultListModel; import javax.swing.JButton; @@ -43,11 +42,14 @@ import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.JSplitPane; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.JTextPane; import javax.swing.JViewport; +import javax.swing.ScrollPaneConstants; +import javax.swing.SwingConstants; import javax.swing.border.EtchedBorder; import javax.swing.text.BadLocationException; import javax.swing.text.Document; @@ -55,6 +57,8 @@ import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; import net.sf.gridarta.gui.GSplitPane; +import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionMethod; /** * <code>CMapArchPanel</code> implements the panel that holds information about @@ -67,6 +71,9 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + // constants for the 'task' parameter in editScriptWanted() public static final int SCRIPT_OPEN = 0; @@ -110,15 +117,13 @@ private final Document document; - private final JScrollPane scrollArchPane = new JScrollPane(); - /** Panel with name/face etc. */ private final JPanel archPanel; /** Panel with message text. */ private JPanel textPanel; - private JPanel scriptPanel; + private final JPanel animationPanel; /** Arch text field. */ private final JTextArea archTextArea = new JTextArea(4, 25); @@ -129,33 +134,30 @@ /** Arch face field. */ private final JTextField archFaceField = new JTextField(14); - private JLabel archInvCount = new JLabel(); + private final JLabel archMapPos = new JLabel(); - private JLabel archMapPos = new JLabel(); + private final JLabel archFaceText = new JLabel(); private final JLabel archTypeText = new JLabel(); - private final JLabel archTileText = new JLabel(); + private final JLabel archAnimText = new JLabel(); private final JPanel mapArchPanel = new JPanel(); - private final JButton submitChange; + private final Action aSubmitChange = ACTION_FACTORY.createAction(false, "mapArchApply", this); - private final JButton submitMultiChange; + private final Action aInvChange = ACTION_FACTORY.createAction(false, "mapArchAddInv", this); - private final JButton invChange; + private final Action aAttrWin = ACTION_FACTORY.createAction(false, "mapArchAttrib", this); - private final JButton attrWin; + private final Action aNew = ACTION_FACTORY.createAction(false, "scriptAddNew", this); - // stuff for scripting tab - private JButton aNew; + private final Action aPath = ACTION_FACTORY.createAction(false, "scriptEditData", this); - private JButton aPath; + private final Action aModify = ACTION_FACTORY.createAction(false, "scriptEdit", this); - private JButton aModify; + private final Action aRemove = ACTION_FACTORY.createAction(false, "scriptRemove", this); - private JButton aRemove; - private JList eventList; private GameObject selectedObject; @@ -169,20 +171,16 @@ // scrollPane2 contains the document for archtext editing final JScrollPane scrollPane2 = new JScrollPane(archEdit); + scrollPane2.setBackground(archEdit.getBackground()); scrollPane2.getViewport().add(archEdit); add(scrollPane2, BorderLayout.EAST); - scrollPane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - scrollPane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + scrollPane2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane2.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - final JScrollPane scrollPane3 = new JScrollPane(mapArchPanel); - scrollPane3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - scrollPane3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); - scrollPane3.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - - panelDesktop = new JTabbedPane(JTabbedPane.TOP); + panelDesktop = new JTabbedPane(SwingConstants.TOP); mapArchPanel.setLayout(new BorderLayout()); - splitPane = new GSplitPane(GSplitPane.HORIZONTAL_SPLIT, scrollPane3, scrollPane2); + splitPane = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, mapArchPanel, scrollPane2); final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(0, 1)); @@ -190,17 +188,9 @@ mapArchPanel.add(buttonPanel, BorderLayout.WEST); // our buttons - submitChange = new JButton("Apply"); - buttonPanel.add(submitChange); - invChange = new JButton("Add Inv."); - buttonPanel.add(invChange); - attrWin = new JButton("Attributes"); - attrWin.setForeground(Color.red); - buttonPanel.add(attrWin); - submitMultiChange = new JButton("Apply multi"); - submitMultiChange.setEnabled(false); - submitMultiChange.setVisible(false); - buttonPanel.add(submitMultiChange); + buttonPanel.add(new JButton(aSubmitChange)); + buttonPanel.add(new JButton(aInvChange)); + buttonPanel.add(new JButton(aAttrWin)); mapArchPanel.add(panelDesktop, BorderLayout.CENTER); @@ -213,79 +203,94 @@ gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.NORTHWEST; + animationPanel = new JPanel(); + setupArchPanel(); setupTextPanel(); - setupScriptPanel(); + setupAnimationPanel(); panelDesktop.add(archPanel, "Arch"); + panelDesktop.add(textPanel, "Msg Text"); - panelDesktop.add(textPanel, "Text"); + panelDesktop.add(createScriptPanel(), "Scripts"); - panelDesktop.add(scriptPanel, "Scripts"); - - final JPanel animationPanel = new JPanel(); panelDesktop.add(animationPanel, "Animation"); // calculate default value in case there is no settings file final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - final int divLocation = Integer.parseInt(settings.getProperty(MAPARCHPANEL_LOCATION_KEY, "" + (int) (0.49 * screen.getWidth()))); - - splitPane.setDividerLocation(divLocation); - splitPane.setDividerSize(5); + splitPane.setDividerLocation(Integer.parseInt(settings.getProperty(MAPARCHPANEL_LOCATION_KEY, "" + (int) (0.49 * screen.getWidth())))); add(splitPane, BorderLayout.CENTER); + updateFont(true); + document = archEdit.getDocument(); + } - submitChange.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent event) { - applyArchPanelChanges(mainView.getMapTileSelection()); - } - }); + /** + * Action method for applying the changes made in the arch panel. + */ + @ActionMethod public void mapArchApply() { + applyArchPanelChanges(mainView.getMapTileSelection()); + } - attrWin.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent event) { - openAttrDialog(mainView.getMapTileSelection()); - } - }); + /** + * Action method for displaying the attributes of the currently selected object. + */ + @ActionMethod public void mapArchAttrib() { + mainControl.openAttrDialog(mainView.getMapTileSelection()); + } - invChange.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent event) { - final GameObject arch = mainControl.getArchPanelHighlight(); - if (arch == null) { // nothing selected? - return; - } + /** + * Action method for adding an object to the inventory of the currently selected object. + */ + @ActionMethod public void mapArchAddInv() { + final GameObject arch = mainControl.getArchPanelHighlight(); + if (arch == null) { // nothing selected? + return; + } - // no single tile? - if (arch.isMulti()) { - return; - } + // no single tile? + if(arch.isMulti()) { + return; + } - GameObject inv = mainView.getMapTileSelection(); - if (inv == null) { - return; - } + GameObject inv = mainView.getMapTileSelection(); + if (inv == null) { + return; + } - // if this is a multi-tail, we put the new arch into the head's inv. - inv = inv.getHead(); + // if this is a multi-tail, we put the new arch into the head's inv. + inv = inv.getHead(); - final GameObject invnew; - if (arch.isArchetype()) { - // create a new copy of a default arch - invnew = arch.createArch(); - } else { - // create clone from a pickmap - invnew = arch.createClone(inv.getMapX(), inv.getMapY()); - } + final GameObject invnew; + if (arch.isArchetype()) { + // create a new copy of a default arch + invnew = arch.createArch(); + } else { + // create clone from a pickmap + invnew = arch.createClone(inv.getMapX(), inv.getMapY()); + } - inv.addLast(invnew); - mainControl.getArchetypeParser().postParseGameObject(invnew, 0); - mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), inv); - mainControl.getCurrentMap().setLevelChangedFlag(); // the map has been modified - } - }); + mainControl.getArchetypeParser().postParseGameObject(invnew, 0); + inv.addLast(invnew); + mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), inv); + mainControl.getCurrentMap().setLevelChangedFlag(); // the map has been modified } + public void updateMapTileList() { + GameObject inv = mainView.getMapTileSelection(); + if (inv == null) { + return; + } + + // if this is a multi-tail, we put the new arch into the head's inv. + inv = inv.getHead(); + + mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), inv); + mainControl.getCurrentMap().setLevelChangedFlag(); // the map has been modified + } + /** * When the "apply"-button on the ArchPanel (at the bottom of the window) * is pressed, this function updates the active arch object. @@ -385,6 +390,8 @@ String newMsgText = archTextArea.getText(); if (newMsgText != null) { newMsgText = newMsgText.trim(); + } else { + newMsgText = ""; } if (newMsgText.equals(archetype.getMsgText().trim())) { gameObject.deleteMsgText(); // yes, we don't need it in map @@ -429,7 +436,10 @@ // now here will be the special panels added! refresh(); + updateMapTileList(); + // if needed (due to face changes), we also redraw the map + mainControl.getMainView().refreshMapTileList(); if (needRedraw) { mainControl.getCurrentMap().repaint(); } @@ -437,14 +447,30 @@ // simple "white space test, to eliminate ' ' // perhaps we should include here a real white space test - public boolean isNonwhitespaceText(final String text) { - for (int i = 0; i < text.length(); i++) { - if (text.charAt(i) != ' ') { - return true; - } - } + private static boolean isNonwhitespaceText(final String text) { + return text.replaceAll("\\s+", "").length() > 0; + } - return false; + /** Set up the animation panel. */ + private void setupAnimationPanel() { + final GridBagLayout gridbag = new GridBagLayout(); + final GridBagConstraints gbc = new GridBagConstraints(); + + animationPanel.setLayout(gridbag); + gbc.fill = GridBagConstraints.BOTH; + gbc.weightx = 1.0; + gbc.weighty = 0; + gbc.anchor = GridBagConstraints.NORTHWEST; + gbc.insets = new Insets(3, 3, 0, 0); + + archAnimText.setText("Animation: "); + gbc.gridx = 0; + gbc.gridy = 0; + gbc.gridwidth = 1; + gbc.gridheight = 1; + gridbag.setConstraints(archAnimText, gbc); + animationPanel.add(archAnimText); + } /** Set up the arch panel entry of the lower window. */ @@ -457,60 +483,51 @@ gbc.weightx = 1.0; gbc.weighty = 0; gbc.anchor = GridBagConstraints.NORTHWEST; - gbc.insets = new Insets(5, 5, 0, 0); - // add our elements + gbc.insets = new Insets(4, 4, 0, 0); - archInvCount = new JLabel(""); - gbc.gridx = 1; - gbc.gridy = 0; - gbc.gridwidth = 1; - gridbag.setConstraints(archInvCount, gbc); - archPanel.add(archInvCount); - archNameField.setText(""); archNameField.setForeground(Color.blue); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 1; + gbc.gridheight = 1; gridbag.setConstraints(archNameField, gbc); archPanel.add(archNameField); - archMapPos = new JLabel(""); - gbc.gridx = 1; - gbc.gridy = 1; - gbc.gridwidth = 1; - gridbag.setConstraints(archMapPos, gbc); - archPanel.add(archMapPos); - archFaceField.setText(""); archFaceField.setForeground(Color.blue); gbc.gridx = 0; gbc.gridy = 1; gbc.gridwidth = 1; + gbc.gridheight = 1; gridbag.setConstraints(archFaceField, gbc); archPanel.add(archFaceField); + archFaceText.setText(""); + gbc.gridx = 0; + gbc.gridy = 2; + gbc.gridwidth = 1; + gbc.gridheight = 1; + gridbag.setConstraints(archFaceText, gbc); + archPanel.add(archFaceText); + archTypeText.setText(""); gbc.gridx = 0; - gbc.gridy = 2; + gbc.gridy = 3; + gbc.gridwidth = 1; + gbc.gridheight = 1; gridbag.setConstraints(archTypeText, gbc); archPanel.add(archTypeText); - archTileText.setText(""); - gbc.gridx = 1; - gbc.gridy = 2; - gridbag.setConstraints(archTileText, gbc); - archPanel.add(archTileText); + archMapPos.setText(""); + gbc.gridx = 0; + gbc.gridy = 4; + gbc.gridwidth = 1; + gbc.gridheight = 1; + gridbag.setConstraints(archMapPos, gbc); + archPanel.add(archMapPos); } - /** - * 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. */ private void setupTextPanel() { textPanel = new JPanel(); // new panel @@ -521,83 +538,68 @@ // create ScrollPane for text scrolling final JScrollPane sta = new JScrollPane(archTextArea); sta.setBorder(new EtchedBorder()); - sta.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - sta.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + sta.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + sta.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //textPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); textPanel.add(sta); } /** Set up the script panel tab. */ - private void setupScriptPanel() { - scriptPanel = new JPanel(); // new panel - scriptPanel.setLayout(new BoxLayout(scriptPanel, BoxLayout.X_AXIS)); - + private JPanel createScriptPanel() { eventList = new JList(); // create ScrollPane for jlist scrolling final JScrollPane ssa = new JScrollPane(eventList); ssa.setBorder(new EtchedBorder()); - ssa.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - ssa.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + ssa.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + ssa.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); ssa.setPreferredSize(new Dimension(80, 40)); // create buttons final JPanel grid = new JPanel(new GridLayout(2, 2)); - aNew = new JButton("Create New"); - aNew.setMargin(new Insets(3, 3, 3, 3)); - aNew.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - addNewScriptWanted(); - } - }); - grid.add(aNew); + grid.add(new JButton(aNew)); + grid.add(new JButton(aPath)); + grid.add(new JButton(aModify)); + grid.add(new JButton(aRemove)); - aPath = new JButton("Edit Params"); - aPath.setMargin(new Insets(3, 3, 3, 3)); - aPath.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - editScriptWanted(CMapArchPanel.SCRIPT_EDIT_PATH); - } - }); - grid.add(aPath); - - aModify = new JButton("Edit Script"); - aModify.setMargin(new Insets(3, 3, 3, 3)); - aModify.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - editScriptWanted(CMapArchPanel.SCRIPT_OPEN); - } - }); - grid.add(aModify); - - aRemove = new JButton("Remove"); - aRemove.setMargin(new Insets(3, 3, 3, 3)); - aRemove.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent e) { - editScriptWanted(CMapArchPanel.SCRIPT_REMOVE); - } - }); - grid.add(aRemove); - // disable all the buttons in the beginning aNew.setEnabled(false); aModify.setEnabled(false); aPath.setEnabled(false); aRemove.setEnabled(false); - grid.setPreferredSize(new Dimension((int) (Math.max(aModify.getMinimumSize().getWidth() * 2, aNew.getMinimumSize().getWidth() * 2)), 40)); - + final JPanel scriptPanel = new JPanel(); // new panel + scriptPanel.setLayout(new BoxLayout(scriptPanel, BoxLayout.X_AXIS)); scriptPanel.add(ssa); scriptPanel.add(grid); scriptPanel.setPreferredSize(new Dimension(100, 40)); + return scriptPanel; } + /** Action method for creating a new Script. */ + @ActionMethod public void scriptAddNew() { + addNewScriptWanted(); + } + + /** Action method for editing the data of an existing Script. */ + @ActionMethod public void scriptEditData() { + editScriptWanted(SCRIPT_EDIT_PATH); + } + + /** Action method for editing an existing Script. */ + @ActionMethod public void scriptEdit() { + editScriptWanted(SCRIPT_OPEN); + } + + /** Action method for removing an existing script. */ + @ActionMethod public void scriptRemove() { + editScriptWanted(SCRIPT_REMOVE); + } + void appExitNotify() { final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); - settings.setProperty(MAPARCHPANEL_LOCATION_KEY, "" + - splitPane.getDividerLocation()); - + settings.setProperty(MAPARCHPANEL_LOCATION_KEY, "" + splitPane.getDividerLocation()); } void refresh() { @@ -606,6 +608,23 @@ } /** + * Update the map arch panel to display the custom font. + * @param refresh if true, the window is redrawn after setting the fonts + */ + public void updateFont(final boolean refresh) { + archMapPos.setForeground(Color.black); + archTypeText.setForeground(Color.black); + archFaceText.setForeground(Color.black); + + // document needs to be set! + + // refresh if desired + if (refresh) { + refresh(); + } + } + + /** * If an arch is selected, the MapArchPanels (bottom right windows) get * updated. * @return the selected arch @@ -619,16 +638,14 @@ * updated. * @param activeGameObject the selected arch */ - public void setMapArchPanelObject(final GameObject activeGameObject) { + void setMapArchPanelObject(final GameObject activeGameObject) { selectedObject = activeGameObject; // reset panel archNameField.setText(""); + archFaceText.setText("Image:"); archTypeText.setText("Type:"); - archTileText.setText("Tile:"); archTextArea.setText(""); - archFaceField.setText(""); - archInvCount.setText(""); - archMapPos.setText(""); + archMapPos.setText("Status: "); // reset list archEdit.setEnabled(false); @@ -645,6 +662,14 @@ aPath.setEnabled(false); aRemove.setEnabled(false); } + panelDesktop.setForegroundAt(0, Color.black); + panelDesktop.setForegroundAt(1, Color.black); + panelDesktop.setForegroundAt(2, Color.black); + panelDesktop.setForegroundAt(3, Color.black); + + aInvChange.setEnabled(false); + aAttrWin.setEnabled(false); + aSubmitChange.setEnabled(false); return; } @@ -652,15 +677,22 @@ // are displayed (Only the head can store information!). final GameObject gameObject = activeGameObject.getHead(); + panelDesktop.setForegroundAt(0, Color.blue); + aInvChange.setEnabled(true); + aAttrWin.setEnabled(true); + aSubmitChange.setEnabled(true); + + final GameObject archetype = gameObject.getArchetype(); + // no text, we try to set the default text final boolean hasMessage; - if (gameObject.getMsgText() == null && gameObject.getArchetypeName() != null) { + if (gameObject.getMsgText() == null && archetype != null) { archTextArea.setForeground(Color.black); - if (gameObject.getArchetype().getMsgText() == null) { + if (archetype.getMsgText() == null) { archTextArea.setText(""); hasMessage = false; } else { - archTextArea.setText(gameObject.getArchetype().getMsgText()); + archTextArea.setText(archetype.getMsgText()); hasMessage = true; } } else { @@ -669,6 +701,9 @@ hasMessage = true; } archTextArea.setCaretPosition(0); + if (hasMessage) { + panelDesktop.setForegroundAt(1, Color.blue); + } // end msg text // SET FACE @@ -679,13 +714,16 @@ archFaceField.setText(gameObject.getFaceName()); } else if (gameObject.getArchetypeName() != null) { archFaceField.setForeground(Color.black); - archFaceField.setText(gameObject.getArchetype().getFaceName()); + archFaceField.setText(archetype.getFaceName()); } // end face + if (gameObject.getAnimName() != null || archetype != null && archetype.getAnimName() != null) { + panelDesktop.setForegroundAt(3, Color.blue); + } // *** OBJECT NAME *** - if (gameObject.getObjName() == null && gameObject.getArchetypeName() != null) { + if (gameObject.getObjName() == null && archetype != null) { archNameField.setForeground(Color.black); - if (gameObject.getArchetype().getObjName() == null) { + if (archetype.getObjName() == null) { // gameObject name if (gameObject.getArchetypeName() != null) { archNameField.setText(gameObject.getArchetypeName()); @@ -694,7 +732,7 @@ } } else { // default name - archNameField.setText(gameObject.getArchetype().getObjName()); + archNameField.setText(archetype.getObjName()); } } else { // object name ("special") @@ -704,47 +742,86 @@ // set hint for "specials": scripts/inventory/message final StringBuilder specialText = new StringBuilder(); - final int i; - if ((i = gameObject.countInvObjects()) > 0) { - specialText.append("Inv: ").append(Integer.toString(i)); - } + specialText.append("Status: in node ").append(gameObject.getMapX()).append(", ").append(gameObject.getMapY()).append(' '); if (gameObject.isScripted()) { - if (specialText.length() > 0) { - specialText.append(", "); - } - specialText.append("Script"); + panelDesktop.setForegroundAt(2, Color.blue); + specialText.append("(script)"); } if (hasMessage) { - if (specialText.length() > 0) { - specialText.append(", "); + specialText.append("(msg)"); + } + final int invObjects = gameObject.countInvObjects(); + if (invObjects > 0) { + specialText.append(" (inv: ").append(invObjects).append(')'); + } + if (gameObject.isInContainer()) { + final GameObject cont = (GameObject) gameObject.getContainer(); + if (cont.getArchetypeName() != null) { + specialText.append(" (env: ").append(cont.getArchetypeName()).append(')'); + } else { + specialText.append(" (env: ><)"); } - specialText.append("Msg"); } - archInvCount.setText(specialText.toString()); // set text to label - archMapPos.setText("Map: " + gameObject.getMapX() + ", " + gameObject.getMapY()); + archMapPos.setText(specialText.toString()); - if (gameObject.getArchetypeName() != null) { - archTypeText.setText("Type: " + mainControl.getArchetypeParser().getArchTypeName(gameObject.getArchTypNr()) - + " (" + gameObject.getArchTypNr() + ") [" + gameObject.getArchetypeName() + "]"); + final StringBuilder typeText = new StringBuilder(); + if (archetype != null) { + typeText.append("Type: ").append(mainControl.getTypeList().getArchTypeName(gameObject.getArchTypNr())).append(" (").append(gameObject.getArchTypNr()).append(") [").append(gameObject.getArchetypeName()).append(']'); } else { - archTypeText.setText("Type: <unknown>"); + typeText.append("Type: <unknown>"); } // check for multi tile if (gameObject.isMulti()) { // multi: print size - archTileText.setText("Tile: " + gameObject.getSizeX() + "x" + gameObject.getSizeY()); + typeText.append(" [").append(gameObject.getSizeX()).append('x').append(gameObject.getSizeY()).append(']'); } else { // single - archTileText.setText("Tile: single"); + typeText.append(" [single]"); } + archTypeText.setText(typeText.toString()); + + final StringBuilder faceText = new StringBuilder(); + if (gameObject.getFaceFlag()) { + faceText.append("Image: >no face<"); + } else { + final String faceName = gameObject.getFaceName(); + if (faceName != null) { + faceText.append("Image: ").append(faceName); + } else if (archetype == null) { + faceText.append("Image: >no face<"); + } else { + final String archFaceName = archetype.getFaceName(); + if (archFaceName != null) { + faceText.append("Image: ").append(archFaceName); + } else { + faceText.append("Image: >no face<"); + } + } + } + archFaceText.setText(faceText.toString()); + + String animName = gameObject.getAnimName(); + if (animName == null && archetype != null) { + animName = archetype.getAnimName(); + } + final StringBuilder animText = new StringBuilder("Animation: "); + if (animName != null) { + animText.append(animName); + if (!mainControl.getAnimationObjects().containsKey(animName)) { + panelDesktop.setForegroundAt(3, Color.red); + animText.append(" (** unknown animation **)"); + } + } + archAnimText.setText(animText.toString()); + // drawing the gameObject's attributes in the text field (archEdit) at the bottom right archEdit.setEnabled(true); final Style currentAttributes = archEdit.getStyle(StyleContext.DEFAULT_STYLE); try { - // blue: the "special" attributes, differ from the default archetype + // Color.blue: the "special" attributes, differ from the default archetype StyleConstants.setForeground(currentAttributes, Color.blue); if (gameObject.getObjectText() != null) { document.insertString(document.getLength(), gameObject.getObjectText(), currentAttributes); @@ -752,11 +829,11 @@ // document.insertString(document.getLength(), "ID#"+gameObject+ " inv#: "+gameObject.countInvObjects()+"\n", currentAttributes); - // black: the attributes from the default archetype + // Color.black: the attributes from the default archetype // that don't exist among the "special" ones StyleConstants.setForeground(currentAttributes, Color.black); - if (gameObject.getObjectText() != null && mainControl.getArchetypeSet().getArchetype(gameObject.getArchetypeName()) != null) { - document.insertString(document.getLength(), gameObject.diffArchText(mainControl.getArchetypeSet().getArchetype(gameObject.getArchetypeName()).getObjectText(), true), currentAttributes); + if (gameObject.getObjectText() != null && archetype != null) { + document.insertString(document.getLength(), gameObject.diffArchText(archetype.getObjectText(), true), currentAttributes); } } catch (final BadLocationException e) { // TODO Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-07 23:38:31 UTC (rev 959) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-08 23:28:46 UTC (rev 960) @@ -224,3 +224,20 @@ statusSelect=Cursor x:{0,number,integer} y:{1,number,integer} Offset x:{2,number,integer} y:{3,number,integer} statusNormal=Cursor x:{0,number,integer} y:{1,number,integer} statusCursorOff=Maus nicht auf Karte + +################# +# Map Arch Panel + +mapArchApply.text=Anwenden +mapArchApply.shortdescription=\xDCbernimmt die \xC4nderungen + +mapArchAttrib.text=Attribute +mapArchAttrib.shortdescription=\xD6ffnet den Attribute-Dialog + +mapArchAddInv.text=Einf\xFCgen +mapArchAddInv.shortdescription=F\xFCgt ein Objekt zum Inventory hinzu + +scriptAddNew.text=Script hinzuf\xFCgen +scriptEditData.text=Daten \xE4ndern +scriptEdit.text=Script \xE4ndern +scriptRemove.text=Script l\xF6schen Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-12-07 23:38:31 UTC (rev 959) +++ trunk/daimonin/src/daieditor/messages.properties 2006-12-08 23:28:46 UTC (rev 960) @@ -300,18 +300,8 @@ edit.text=Edit edit.mnemonic=E -undo.text=Undo -undo.shortdescription=Undo last action -undo.longdescription=Undoes the last action if possible -undo.mnemonic=U -undo.accel=ctrl pressed Z undo.error.text=Can''t undo last action -redo.text=Redo -redo.shortdescription=Redo last undo action -redo.longdescription=Redoes the last undone action if possible -redo.mnemonic=R -redo.accel=ctrl shift pressed Z redo.error.text=Can''t redo clear.text=Clear @@ -695,15 +685,6 @@ ################# # Map Arch Panel -mapArchApply.text=Apply -mapArchApply.shortdescription=Apply object changes - -mapArchAttrib.text=Attributes -mapArchAttrib.shortdescription=Open attributes dialog - -mapArchAddInv.text=Add Inv -mapArchAddInv.shortdescription=Add object to inventory - direction0.text=0 direction0.shortdescription=direction 0 @@ -727,11 +708,6 @@ moveTileUp.shortdescription=Move Tile Position Up moveTileDown.shortdescription=Move Tile Position Down -scriptAddNew.text=Create New -scriptEditData.text=Edit Data -scriptEdit.text=Edit Script -scriptRemove.text=Remove Script - ##################### # Preference Modules Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2006-12-07 23:38:31 UTC (rev 959) +++ trunk/src/app/net/sf/gridarta/messages.properties 2006-12-08 23:28:46 UTC (rev 960) @@ -193,3 +193,33 @@ # Various Log Messages saveLevelAsWithNull=DEBUG: CMainControl.saveLevelAsWanted(CMapControl level) invoked with null argument. imageCreated=Created image "{0}" of map "{1}". + +# Edit +undo.text=Undo +undo.shortdescription=Undo last action +undo.longdescription=Undoes the last action if possible +undo.mnemonic=U +undo.accel=ctrl pressed Z + +redo.text=Redo +redo.shortdescription=Redo last undo action +redo.longdescription=Redoes the last undone action if possible +redo.mnemonic=R +redo.accel=ctrl shift pressed Z + +################# +# Map Arch Panel + +mapArchApply.text=Apply +mapArchApply.shortdescription=Apply object changes + +mapArchAttrib.text=Attributes +mapArchAttrib.shortdescription=Open attributes dialog + +mapArchAddInv.text=Add Inv +mapArchAddInv.shortdescription=Add object to inventory + +scriptAddNew.text=Create New +scriptEditData.text=Edit Data +scriptEdit.text=Edit Script +scriptRemove.text=Remove Script This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-09 00:04:14
|
Revision: 962 http://svn.sourceforge.net/gridarta/?rev=962&view=rev Author: akirschbaum Date: 2006-12-08 16:04:15 -0800 (Fri, 08 Dec 2006) Log Message: ----------- Unify ResourceFileManager. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/ResourceFileManager.java Added Paths: ----------- trunk/crossfire/src/cfeditor/ResourceFileManager.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-08 23:35:12 UTC (rev 961) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-09 00:04:15 UTC (rev 962) @@ -84,18 +84,6 @@ private static final String DOCU_VERSION_KEY = "docuVersion"; - private static final String MAP_DIR_KEY = "mapDirectory"; - - private static final String DEFAULT_MAP_DIR = "maps"; - - private static final String ARCH_DIR_KEY = "archDirectory"; - - private static final String DEFAULT_ARCH_DIR = "arch"; - - private static final String SCRIPT_DIR_KEY = "scriptDirectory"; - - private static final String DEFAULT_SCRIPT_DIR = "script"; - private static final String USE_IMAGESET = "useImageSet"; private static final String USE_FONT = "useFont"; @@ -368,9 +356,9 @@ */ private void readGlobalSettings() { // Get the directories - strMapDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(MAP_DIR_KEY, DEFAULT_MAP_DIR); - strArchDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(ARCH_DIR_KEY, DEFAULT_ARCH_DIR); - strScriptDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(SCRIPT_DIR_KEY, DEFAULT_SCRIPT_DIR); + strMapDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(ResourceFileManager.MAP_DIR_KEY, ResourceFileManager.DEFAULT_MAP_DIR); + strArchDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(ResourceFileManager.ARCH_DIR_KEY, ResourceFileManager.DEFAULT_ARCH_DIR); + strScriptDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(ResourceFileManager.SCRIPT_DIR_KEY, ResourceFileManager.DEFAULT_SCRIPT_DIR); // set map dir if (strMapDir.length() > 0) { @@ -423,9 +411,9 @@ map = map.substring(0, map.length() - 1); // path should not end with slash } - CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(ARCH_DIR_KEY, arch); - CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(MAP_DIR_KEY, map); - CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(SCRIPT_DIR_KEY, script); + CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(ResourceFileManager.ARCH_DIR_KEY, arch); + CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(ResourceFileManager.MAP_DIR_KEY, map); + CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(ResourceFileManager.SCRIPT_DIR_KEY, script); CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(USE_IMAGESET, baseImageSet ? "base" : "none"); CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(LOAD_ARCH_COLL, load ? "true" : "false"); Added: trunk/crossfire/src/cfeditor/ResourceFileManager.java =================================================================== --- trunk/crossfire/src/cfeditor/ResourceFileManager.java (rev 0) +++ trunk/crossfire/src/cfeditor/ResourceFileManager.java 2006-12-09 00:04:15 UTC (rev 962) @@ -0,0 +1,43 @@ +/* + * Daimonin Java Editor. + * Copyright (C) 2006 Christian Hujer + * + * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package cfeditor; + +/** + * TODO + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public final class ResourceFileManager { + + public static final String MAP_DIR_KEY = "mapDirectory"; + + public static final String DEFAULT_MAP_DIR = "maps"; + + public static final String ARCH_DIR_KEY = "archDirectory"; + + public static final String DEFAULT_ARCH_DIR = "arch"; + + public static final String SCRIPT_DIR_KEY = "scriptDirectory"; + + public static final String DEFAULT_SCRIPT_DIR = "script"; + +} // class ResourceFileManager Property changes on: trunk/crossfire/src/cfeditor/ResourceFileManager.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/ResourceFileManager.java =================================================================== --- trunk/daimonin/src/daieditor/ResourceFileManager.java 2006-12-08 23:35:12 UTC (rev 961) +++ trunk/daimonin/src/daieditor/ResourceFileManager.java 2006-12-09 00:04:15 UTC (rev 962) @@ -1,3 +1,25 @@ +/* + * Daimonin Java Editor. + * Copyright (C) 2006 Christian Hujer + * + * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + package daieditor; /** @@ -21,4 +43,5 @@ public static final String MEDIA_DIR_KEY = "mediaDirectory"; public static final String DEFAULT_MEDIA_DIR = "../client/media"; + } // class ResourceFileManager This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-12-09 14:14:31
|
Revision: 963 http://svn.sourceforge.net/gridarta/?rev=963&view=rev Author: christianhujer Date: 2006-12-09 06:14:29 -0800 (Sat, 09 Dec 2006) Log Message: ----------- Converted variables that could be local variables into local variables. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CFilterControl.java trunk/crossfire/src/cfeditor/CGUIUtils.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CMainToolbar.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/COptionDialog.java trunk/crossfire/src/cfeditor/filter/NamedFilterList.java trunk/crossfire/src/cfeditor/gui/ArchComboBox.java trunk/crossfire/src/cfeditor/gui/ScriptEditor.java trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java trunk/crossfire/src/cfeditor/parameter/MapParameterView.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/MapViewIFrame.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-09 14:14:29 UTC (rev 963) @@ -115,12 +115,6 @@ private JComboBox typesel; // selection box for type - private JTextField nameTF; // textfield for gameObject name - - private JTextField archetypeTF; // textfield for name of the Archetype - - private JLabel imagePanel; // panel for object's face (png) - private final GameObject gameObject; private final Archetype<GameObject> archetype; @@ -413,7 +407,7 @@ gbc.weightx = 0.0; gbc.weighty = 3.0; gbc.gridheight = 3; - imagePanel = new JLabel(mainControl.getArchetypeSet().getFace(gameObject.getFaceNr())); + final JLabel imagePanel=new JLabel(mainControl.getArchetypeSet().getFace(gameObject.getFaceNr())); imagePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); header.add(imagePanel, gbc); gbc.gridheight = 1; @@ -433,7 +427,7 @@ gbc.gridx = 3; gbc.gridy = 1; gbc.weightx = 1.0; - if (gameObject.getObjName() != null && gameObject.getObjName().length() > 0) { + final JTextField nameTF;if (gameObject.getObjName() != null && gameObject.getObjName().length() > 0) { nameTF = new JTextField(gameObject.getObjName(), 16); } else if (archetype.getObjName() != null && archetype.getObjName().length() > 0) { nameTF = new JTextField(archetype.getObjName(), 16); @@ -445,7 +439,7 @@ gbc.gridy++; header.add(buildTypesBox(), gbc); // build type-selection box gbc.gridy++; - archetypeTF = new JTextField(archetype.getArchetypeName(), 16); + final JTextField archetypeTF=new JTextField(archetype.getArchetypeName(), 16); archetypeTF.setEditable(false); header.add(archetypeTF, gbc); Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-12-09 14:14:29 UTC (rev 963) @@ -103,8 +103,6 @@ private JButton noneButton; - private JButton cancelButton; - // the textfield in the attribute dialog where the result gets written to private JTextField input; // input textfield @@ -586,7 +584,7 @@ }); rightSide.add(noneButton); - cancelButton = new JButton("Cancel"); + final JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { frame.setVisible(false); Modified: trunk/crossfire/src/cfeditor/CFilterControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CFilterControl.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/crossfire/src/cfeditor/CFilterControl.java 2006-12-09 14:14:29 UTC (rev 963) @@ -46,8 +46,6 @@ private final boolean filterOut = false; - private final boolean highLight[]; - private static final NamedFilterList filterList = NamedFilterList.getDefaultList(); private final NamedFilterConfig filterOutConfig; @@ -66,7 +64,7 @@ * @param mapControl MapControl to create FilterControl for. */ public CFilterControl(final MapControl mapControl) { - highLight = new boolean[]{false, false, false,}; + final boolean[] highLight = new boolean[]{false, false, false,}; filterOutConfig = (NamedFilterConfig) filterList.createConfig(); highLightConfig = new NamedFilterConfig[]{ (NamedFilterConfig) filterList.createConfig(), Modified: trunk/crossfire/src/cfeditor/CGUIUtils.java =================================================================== --- trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-12-09 14:14:29 UTC (rev 963) @@ -183,6 +183,7 @@ } else if (gray > 255) { gray = 255; } + //noinspection PointlessBitwiseExpression return (rgb & 0xff000000) | (gray << 16) | (gray << 8) | (gray << 0); } } Modified: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-12-09 14:14:29 UTC (rev 963) @@ -56,33 +56,12 @@ private AggregateMenuLocation mainLocation; - private AggregateMenuLocation toolbarLocation; - private AggregateMenuLocation currentmapLocation; - private SimpleMenuLocation menu_file; - - private SimpleMenuLocation menu_edit; - - private SimpleMenuLocation menu_map; - - private SimpleMenuLocation menu_pickmaps; - - private SimpleMenuLocation menu_collect; - private SimpleMenuLocation menu_analyze; - //private JMenu menu_script; - private SimpleMenuLocation menu_view; - - private JMenu menu_help; - private JMenu menu_window; - private SimpleMenuEntry m_new; - - private SimpleMenuEntry m_open; - private SimpleMenuEntry m_close; private SimpleMenuEntry m_revert; @@ -93,10 +72,6 @@ private SimpleMenuEntry m_createImg; - private SimpleMenuEntry m_options; - - private SimpleMenuEntry m_exit; - private SimpleMenuEntry m_collectArch; private SimpleMenuEntry m_spellC; @@ -105,11 +80,6 @@ private JMenuItem m_scriptMenu; - //private JMenuItem m_analyzeMenu; - private JMenuItem m_helpMenu; - - private JMenuItem m_aboutMenu; - private CheckBoxMenuEntry m_autojoin; private CheckBoxMenuEntry m_gridToggle; @@ -158,10 +128,6 @@ private SimpleMenuEntry m_fill_below; - private SimpleMenuEntry m_rand_fill_above; - - private SimpleMenuEntry m_rand_fill_below; - private CheckBoxMenuEntry se_monster; private CheckBoxMenuEntry se_exit; @@ -178,8 +144,6 @@ private CheckBoxMenuEntry se_connected; - private SimpleMenuEntry m_show_all; - private JMenuItem m_newWindow; private JMenuItem m_closeAll; @@ -218,7 +182,7 @@ private void buildAggregates() { mainLocation = new AggregateMenuLocation("main"); - toolbarLocation = new AggregateMenuLocation("toolbar"); + final AggregateMenuLocation toolbarLocation = new AggregateMenuLocation("toolbar"); currentmapLocation = new AggregateMenuLocation("currentmap"); MenuManager.getMenuManager().addMenuLocation(mainLocation); MenuManager.getMenuManager().addMenuLocation(toolbarLocation); @@ -241,14 +205,14 @@ */ private void buildFileMenu() { final MenuManager menuManager = MenuManager.getMenuManager(); - menu_file = new SimpleMenuLocation("main.file"); + final SimpleMenuLocation menu_file = new SimpleMenuLocation("main.file"); menuManager.addMenuLocation(menu_file); mainLocation.addMenuLocation(menu_file); final LocationMenuEntry entry = new LocationMenuEntry("main.file", "File"); menuManager.addMenuEntry("main", entry); entry.setMnemonic('F'); - m_new = new SimpleMenuEntry("New..."); + final SimpleMenuEntry m_new = new SimpleMenuEntry("New..."); m_new.setIcon(CGUIUtils.getIcon(IGUIConstants.NEW_LEVEL_SMALLICON)); m_new.setMnemonic('N'); m_new.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK)); @@ -260,7 +224,7 @@ }); menuManager.addMenuEntry("main.file", m_new); - m_open = new SimpleMenuEntry("Open..."); + final SimpleMenuEntry m_open = new SimpleMenuEntry("Open..."); m_open.setIcon(CGUIUtils.getIcon(IGUIConstants.OPEN_LEVEL_SMALLICON)); m_open.setMnemonic('O'); m_open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.CTRL_MASK)); @@ -334,7 +298,7 @@ menuManager.addMenuEntry("main.file", SimpleMenuEntry.getSeparator()); - m_options = new SimpleMenuEntry("Options..."); + final SimpleMenuEntry m_options = new SimpleMenuEntry("Options..."); m_options.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); m_options.setMnemonic('P'); m_options.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, Event.ALT_MASK)); @@ -348,7 +312,7 @@ menuManager.addMenuEntry("main.file", SimpleMenuEntry.getSeparator()); - m_exit = new SimpleMenuEntry("Exit"); + final SimpleMenuEntry m_exit = new SimpleMenuEntry("Exit"); m_exit.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); m_exit.setMnemonic('X'); m_exit.addActionListener( @@ -366,7 +330,7 @@ */ private void buildEditMenu() { final MenuManager menuManager = MenuManager.getMenuManager(); - menu_edit = new SimpleMenuLocation("main.edit"); + final SimpleMenuLocation menu_edit = new SimpleMenuLocation("main.edit"); mainLocation.addMenuLocation(menu_edit); menuManager.addMenuLocation(menu_edit); final LocationMenuEntry entry = new LocationMenuEntry("main.edit", "Edit"); @@ -458,7 +422,7 @@ menuManager.addMenuEntry("main.edit", m_fill_below); // Random Fill: - m_rand_fill_above = new SimpleMenuEntry("Random Fill Above"); + final SimpleMenuEntry m_rand_fill_above = new SimpleMenuEntry("Random Fill Above"); m_rand_fill_above.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); m_rand_fill_above.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, Event.CTRL_MASK)); m_rand_fill_above.addActionListener( @@ -470,7 +434,7 @@ menuManager.addMenuEntry("main.edit", m_rand_fill_above); // Random Fill: - m_rand_fill_below = new SimpleMenuEntry("Random Fill Below"); + final SimpleMenuEntry m_rand_fill_below = new SimpleMenuEntry("Random Fill Below"); m_rand_fill_below.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); m_rand_fill_below.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, Event.CTRL_MASK | Event.SHIFT_MASK)); m_rand_fill_below.addActionListener( @@ -486,7 +450,7 @@ private void buildViewMenu() { final MenuManager menuManager = MenuManager.getMenuManager(); - menu_view = new SimpleMenuLocation("main.view"); + final SimpleMenuLocation menu_view = new SimpleMenuLocation("main.view"); mainLocation.addMenuLocation(menu_view); menuManager.addMenuLocation(menu_view); final LocationMenuEntry entry = new LocationMenuEntry("main.view", "View"); @@ -630,7 +594,7 @@ }); menuManager.addMenuEntry("main.view", se_connected); menuManager.addMenuEntry("main.view", SimpleMenuEntry.getSeparator()); - m_show_all = new SimpleMenuEntry("Reset View"); + final SimpleMenuEntry m_show_all = new SimpleMenuEntry("Reset View"); m_show_all.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent event) { @@ -653,7 +617,7 @@ } private void buildMapMenu() { - menu_map = new SimpleMenuLocation("main.map"); + final SimpleMenuLocation menu_map = new SimpleMenuLocation("main.map"); final LocationMenuEntry entry = new LocationMenuEntry("main.map", "Map"); final MenuManager menuManager = MenuManager.getMenuManager(); menuManager.addMenuLocation(menu_map); @@ -786,7 +750,7 @@ } private void buildPickmapsMenu() { - menu_pickmaps = new SimpleMenuLocation("main.pickmaps"); + final SimpleMenuLocation menu_pickmaps = new SimpleMenuLocation("main.pickmaps"); final LocationMenuEntry entry = new LocationMenuEntry("main.pickmaps", "Pickmaps"); final MenuManager menuManager = MenuManager.getMenuManager(); mainLocation.addMenuLocation(menu_pickmaps); @@ -891,7 +855,7 @@ } private void buildResourceMenu() { - menu_collect = new SimpleMenuLocation("main.resources"); + final SimpleMenuLocation menu_collect = new SimpleMenuLocation("main.resources"); final LocationMenuEntry entry = new LocationMenuEntry("main.resources", "Resources"); final MenuManager menuManager = MenuManager.getMenuManager(); mainLocation.addMenuLocation(menu_collect); @@ -1083,10 +1047,10 @@ /** Create the help-about window with the credits. */ private void buildHelpMenu() { - menu_help = new JMenu("Help"); + final JMenu menu_help = new JMenu("Help"); menu_help.setMnemonic('H'); - m_helpMenu = new JMenuItem("Online Help"); + final JMenuItem m_helpMenu = new JMenuItem("Online Help"); m_helpMenu.setMnemonic('H'); m_helpMenu.addActionListener( new ActionListener() { @@ -1096,7 +1060,7 @@ }); menu_help.add(m_helpMenu); menu_help.addSeparator(); - m_aboutMenu = new JMenuItem("About..."); + final JMenuItem m_aboutMenu = new JMenuItem("About..."); m_aboutMenu.setMnemonic('A'); m_aboutMenu.addActionListener( new ActionListener() { Modified: trunk/crossfire/src/cfeditor/CMainToolbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainToolbar.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/crossfire/src/cfeditor/CMainToolbar.java 2006-12-09 14:14:29 UTC (rev 963) @@ -67,19 +67,10 @@ /** The popup menu. */ private final CPopupMenu m_popupMenu; - // UI elements - private JButton m_new; - - private JButton m_open; - private JButton m_save; private JButton m_saveAs; - private JButton m_nextWindow; - - private JButton m_prevWindow; - private static final long serialVersionUID = 1L; /** @@ -140,7 +131,7 @@ setMargin(new Insets(IGUIConstants.DIALOG_INSETS, 0, IGUIConstants.DIALOG_INSETS, IGUIConstants.DIALOG_INSETS)); final Vector<JButton> buttons = new Vector<JButton>(10, 2); - m_new = new CFancyButton( + final JButton m_new = new CFancyButton( checkLabel("New"), "New Map", checkIcon(IGUIConstants.NEW_LEVEL_ICON), @@ -154,7 +145,7 @@ buttons.addElement(m_new); add(m_new); - m_open = new CFancyButton( + final JButton m_open = new CFancyButton( checkLabel("Open"), "Open Map File", checkIcon(IGUIConstants.OPEN_LEVEL_ICON), @@ -199,7 +190,7 @@ addSeparator(); - m_prevWindow = new CFancyButton( + final JButton m_prevWindow = new CFancyButton( checkLabel("Prev"), "Show Previous Window", checkIcon(IGUIConstants.PREVIOUS_WINDOW_ICON), @@ -213,7 +204,7 @@ buttons.addElement(m_prevWindow); add(m_prevWindow); - m_nextWindow = new CFancyButton( + final JButton m_nextWindow = new CFancyButton( checkLabel("Next"), "Show Next Window", checkIcon(IGUIConstants.NEXT_WINDOW_ICON), Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-09 14:14:29 UTC (rev 963) @@ -505,8 +505,6 @@ private Point startMapLoc = null; - private String insertArchName = ""; // name of arch being inserted - private Rectangle previewRect = null; private Point[] needRedraw = null; // array of tile coords which need to be redrawn @@ -709,7 +707,7 @@ // get name of inserted arch (this is display in status bar while dragging) @Nullable final GameObject insArch = mainControl.getArchPanelHighlight(); - if (insArch != null) { + final String insertArchName;if (insArch != null) { if (insArch.getObjName() != null && insArch.getObjName().length() > 0) { insertArchName = insArch.getObjName(); } else if (insArch.getArchetypeName() != null && insArch.getArchetypeName().length() > 0) { Modified: trunk/crossfire/src/cfeditor/COptionDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/COptionDialog.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/crossfire/src/cfeditor/COptionDialog.java 2006-12-09 14:14:29 UTC (rev 963) @@ -52,8 +52,6 @@ */ public final class COptionDialog extends CDialogBase { - private final CMainControl mainControl; - private final JTextField m_archField; private final JTextField m_mapField; @@ -75,7 +73,7 @@ */ COptionDialog(final CMainControl mainControl, final Frame parentFrame) { super(parentFrame, "Options"); - this.mainControl = mainControl; + final CMainControl mainControl1=mainControl; getContentPane().setLayout(new BorderLayout()); final JPanel mainPanel = new JPanel(); @@ -100,21 +98,21 @@ final JPanel archPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); archPanel.add(new JLabel("Archfiles: ")); m_archField = new JTextField(16); - m_archField.setText(this.mainControl.getArchDefaultFolder()); + m_archField.setText(mainControl1.getArchDefaultFolder()); archPanel.add(m_archField); optionPathPanel.add(archPanel); final JPanel mapPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); mapPanel.add(new JLabel("Maps: ")); m_mapField = new JTextField(16); - m_mapField.setText(this.mainControl.getMapDefaultFolder()); + m_mapField.setText(mainControl1.getMapDefaultFolder()); mapPanel.add(m_mapField); optionPathPanel.add(mapPanel); final JPanel scriptPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); scriptPanel.add(new JLabel("Scripts: ")); m_scriptField = new JTextField(16); - m_scriptField.setText(this.mainControl.getScriptDefaultFolder()); + m_scriptField.setText(mainControl1.getScriptDefaultFolder()); scriptPanel.add(m_scriptField); mainPanel.add(optionPathPanel); @@ -130,18 +128,18 @@ IGUIConstants.DIALOG_INSETS))); final JPanel cbox; - if (this.mainControl.getImageSet() != null) { - cbox = buildImageSetBox(this.mainControl.getImageSet().equalsIgnoreCase("base")); + if (mainControl1.getImageSet() != null) { + cbox = buildImageSetBox(mainControl1.getImageSet().equalsIgnoreCase("base")); } else { cbox = buildImageSetBox(false); } optionPartPanel.add(cbox); m_loadArches = new JCheckBox(" Load Arches from Collection"); - m_loadArches.setSelected(this.mainControl.isArchLoadedFromCollection()); + m_loadArches.setSelected(mainControl1.isArchLoadedFromCollection()); m_loadArches.addActionListener(new SelectArchLoadAL(m_loadArches, this)); optionPartPanel.add(m_loadArches); - if (this.mainControl.isArchLoadedFromCollection()) { + if (mainControl1.isArchLoadedFromCollection()) { m_archField.setEnabled(false); } @@ -158,7 +156,7 @@ IGUIConstants.DIALOG_INSETS))); m_mapPanelBottom = new JCheckBox(" Separate Map-Tile Panel"); - m_mapPanelBottom.setSelected(!this.mainControl.getMainView().isMapTileListBottom()); + m_mapPanelBottom.setSelected(!mainControl1.getMainView().isMapTileListBottom()); optionLayoutPanel.add(m_mapPanelBottom); optionLayoutPanel.add(new JLabel("(Takes effect on next application start)")); mainPanel.add(optionLayoutPanel); Modified: trunk/crossfire/src/cfeditor/filter/NamedFilterList.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/NamedFilterList.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/crossfire/src/cfeditor/filter/NamedFilterList.java 2006-12-09 14:14:29 UTC (rev 963) @@ -45,8 +45,6 @@ private final EventListenerList listenerList = new EventListenerList(); - private final boolean inverted; - private static final NamedFilterList DEFAULT_LIST = new NamedFilterList(); public static NamedFilterList getDefaultList() { @@ -55,7 +53,7 @@ /** Create a new NameFilterList. */ public NamedFilterList() { - inverted = false; + final boolean inverted = false; subFilters = new LinkedHashMap<String, Filter>(); AttributeFilter f; f = new AttributeFilter(); Modified: trunk/crossfire/src/cfeditor/gui/ArchComboBox.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/ArchComboBox.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/crossfire/src/cfeditor/gui/ArchComboBox.java 2006-12-09 14:14:29 UTC (rev 963) @@ -54,8 +54,6 @@ private final ArchComboBoxEditor editor; - private final MyCellRenderer renderer; - private final ArchComboBoxModel archComboBoxModel; private static final long serialVersionUID = 1L; @@ -63,7 +61,7 @@ public ArchComboBox() { setMaximumRowCount(4); mainControl = CMainControl.getInstance(); - renderer = new MyCellRenderer(); + final MyCellRenderer renderer = new MyCellRenderer(); editor = new ArchComboBoxEditor(); //setPrototypeDisplayValue(renderer.sizeTester); setRenderer(renderer); @@ -108,10 +106,8 @@ boolean locked = false; - private final ArchComboBoxModel archModel; - public ArchComboBoxEditor() { - archModel = new ArchComboBoxModel(); + final ArchComboBoxModel archModel = new ArchComboBoxModel(); } public synchronized void lockEditor() { Modified: trunk/crossfire/src/cfeditor/gui/ScriptEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/ScriptEditor.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/crossfire/src/cfeditor/gui/ScriptEditor.java 2006-12-09 14:14:29 UTC (rev 963) @@ -55,16 +55,10 @@ private static final Logger log = Logger.getLogger(ScriptEditor.class); - private final JTabbedPane tabs; - - private final JPanel parameterTab; - private final JPanel paramTable; - private final JPanel optionsTab; + private final JButton removeParameter; - private final JButton addParameter, removeParameter; - private final JTextArea code; private TableModel paramsModel; @@ -83,8 +77,6 @@ private int selectedRow = -1; - private int selectedCol = -1; - private final MouseListener cellMouseListener = new MouseListener() { public void mouseClicked(final MouseEvent e) { selectTableComponent((Component) e.getSource()); @@ -129,10 +121,10 @@ public ScriptEditor(final CScriptModel script) { super(); this.script = script; - tabs = new JTabbedPane(); + final JTabbedPane tabs = new JTabbedPane(); this.setLayout(new BorderLayout()); this.add(tabs); - optionsTab = new JPanel(new GridBagLayout()); + final JPanel optionsTab = new JPanel(new GridBagLayout()); final GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1.0; @@ -205,7 +197,7 @@ }); optionsTab.add(btn, gbc); tabs.add("Options", optionsTab); - parameterTab = new JPanel(new BorderLayout()); + final JPanel parameterTab = new JPanel(new BorderLayout()); paramTable = new JPanel(new GridBagLayout()); redrawTable(); script.addChangeListener(new ChangeListener() { @@ -218,7 +210,7 @@ //parameterTab.add(paramTable, BorderLayout.CENTER); final JPanel paramButtons = new JPanel(); paramButtons.setLayout(new StackLayout(5)); - addParameter = new JButton("Add parameter"); + final JButton addParameter = new JButton("Add parameter"); addParameter.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { getScript().newParameter(); @@ -280,7 +272,7 @@ final GridBagConstraints gbc = l.getConstraints(c); if (gbc != null) { selectedRow = gbc.gridy - 1; - selectedCol = gbc.gridx; + final int selectedCol = gbc.gridx; } } Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-09 14:14:29 UTC (rev 963) @@ -87,8 +87,6 @@ private final CMainControl mainControl; - private final AttributeFilter af; - private final Color[] highLightMask; private BufferedImage backBuffer; @@ -104,7 +102,7 @@ this.mainControl = mainControl; this.mapControl = mapControl; - af = new AttributeFilter(); + final AttributeFilter af = new AttributeFilter(); af.addAttribute("no_pass", "1"); isPickmap = pickmap; // initialize the tmp. graphic buffer Modified: trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java =================================================================== --- trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java 2006-12-09 14:14:29 UTC (rev 963) @@ -18,15 +18,13 @@ private class WrappedMenuLocation implements MenuLocation { - private final String parentName; - private final String name; private final MenuLocation location; public WrappedMenuLocation(final MenuLocation location, final String parentName) { this.location = location; - this.parentName = parentName; + final String parentName1 = parentName; name = parentName + "." + location.getName(); } Modified: trunk/crossfire/src/cfeditor/parameter/MapParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/parameter/MapParameterView.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/crossfire/src/cfeditor/parameter/MapParameterView.java 2006-12-09 14:14:29 UTC (rev 963) @@ -38,13 +38,11 @@ private final JComboBox value; - private final MyComboBoxModel myModel; - public MapParameterView(final MapParameter param) { super(); this.parameter = param; value = new JComboBox(); - myModel = new MyComboBoxModel(); + final MyComboBoxModel myModel = new MyComboBoxModel(); value.setModel(myModel); if (log.isDebugEnabled()) { log.debug("opened maps: " + CMainControl.getInstance().getOpenedMaps() + " len: " + CMainControl.getInstance().getOpenedMaps().length); Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-09 14:14:29 UTC (rev 963) @@ -120,10 +120,6 @@ private JComboBox typesel; // selection box for type - private JTextField nameTF; // textfield for gameObject name - - private JTextField archetypeTF; // textfield for name of the Archetype - private JLabel imagePanel; // panel for object's face (png) private final GameObject gameObject; @@ -439,7 +435,7 @@ gbc.gridx = 3; gbc.gridy = 1; gbc.weightx = 1.0; - if (gameObject.getObjName() != null && gameObject.getObjName().length() > 0) { + final JTextField nameTF;if (gameObject.getObjName() != null && gameObject.getObjName().length() > 0) { nameTF = new JTextField(gameObject.getObjName(), 16); } else if (archetype.getObjName() != null && archetype.getObjName().length() > 0) { nameTF = new JTextField(archetype.getObjName(), 16); @@ -451,7 +447,7 @@ gbc.gridy++; header.add(buildTypesBox(), gbc); // build type-selection box gbc.gridy++; - archetypeTF = new JTextField(archetype.getArchetypeName(), 16); + final JTextField archetypeTF=new JTextField(archetype.getArchetypeName(), 16); archetypeTF.setEditable(false); header.add(archetypeTF, gbc); Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-09 14:14:29 UTC (rev 963) @@ -113,8 +113,6 @@ private JButton noneButton; - private JButton cancelButton; - // the textfield in the attribute dialog where the result gets written to private JTextField input; // input textfield @@ -612,7 +610,7 @@ }); rightSide.add(noneButton); - cancelButton = new JButton("Cancel"); + final JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { frame.setVisible(false); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-12-09 14:14:29 UTC (rev 963) @@ -201,8 +201,6 @@ public static ImageIcon mapCursorIcon; - private static ImageIcon mapGridIcon; - private static ImageIcon unknownTileIcon; private static ImageIcon warningSquareIcon; @@ -1940,7 +1938,7 @@ * access. */ private static void loadDefTiles() { - mapGridIcon = CGUIUtils.getSysIcon(IGUIConstants.TILE_IGRID_TILE); + final ImageIcon mapGridIcon = CGUIUtils.getSysIcon(IGUIConstants.TILE_IGRID_TILE); mapPreSelIcon = CGUIUtils.getSysIcon(IGUIConstants.TILE_IPRESEL_TILE); mapSelIcon = CGUIUtils.getSysIcon(IGUIConstants.TILE_ISEL_TILE); mapCursorIcon = CGUIUtils.getSysIcon(IGUIConstants.TILE_ICURSOR); Modified: trunk/daimonin/src/daieditor/MapViewIFrame.java =================================================================== --- trunk/daimonin/src/daieditor/MapViewIFrame.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/daimonin/src/daieditor/MapViewIFrame.java 2006-12-09 14:14:29 UTC (rev 963) @@ -62,9 +62,6 @@ /** The underlying mapview object. */ private final CMapViewBasic view; - /** Number of this view. */ - private final int viewNumber; - /** * Constructs a level view. * @param mainControl the main controller @@ -76,7 +73,7 @@ super(mapControl.getMapFileName() + " [ " + mapControl.getMapArch().getMapDisplayName() + " ] ("+ number + ')', true, true, true, true); this.mapControl = mapControl; this.mainControl = mainControl; - viewNumber = number; + final int viewNumber = number; setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); Modified: trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-09 00:04:15 UTC (rev 962) +++ trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-09 14:14:29 UTC (rev 963) @@ -74,9 +74,6 @@ /** Time of last core painting (includes selection painting). */ private transient long lastCorePaint; - /** Time of last overall painting (includes core and thus selection). */ - private transient long lastPaint; - /** The origin is the point in the north-west corner */ private Point origin = new Point(); @@ -91,9 +88,6 @@ /** The MapSquares that are known to contain errors. */ private Map<MapSquare<? extends net.sf.gridarta.gameobject.GameObject>,ValidationError> erraneousMapSquares; - /** The ArchObjects that are known to contain errors. */ - private Map<net.sf.gridarta.gameobject.GameObject,ValidationError> erraneousArchObjects; - /** Used to avoid creation millions of points */ private final Point tmpPoint = new Point(); @@ -208,7 +202,7 @@ @Override public void paintComponent(final Graphics grfx) { final long start = System.currentTimeMillis(); paintComponent2((Graphics2D) grfx); - lastPaint = System.currentTimeMillis() - start; + final long lastPaint = System.currentTimeMillis() - start; mainControl.setStatusText("Sel: " + lastSelectionPaint + " Core: " + lastCorePaint + " All: " + lastPaint); } @@ -472,7 +466,7 @@ * @param erraneousArchObjects the ArchObjects that are known to contain errors. */ public void setErraneousArchObjects(final Map<net.sf.gridarta.gameobject.GameObject, ValidationError> erraneousArchObjects) { - this.erraneousArchObjects = erraneousArchObjects; + final Map<net.sf.gridarta.gameobject.GameObject, ValidationError> erraneousArchObjects1 = erraneousArchObjects; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-12-09 14:54:07
|
Revision: 965 http://svn.sourceforge.net/gridarta/?rev=965&view=rev Author: christianhujer Date: 2006-12-09 06:54:02 -0800 (Sat, 09 Dec 2006) Log Message: ----------- Replaced for- and while-loops with foreach-loops. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFArchType.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFilterControl.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CResourceLoader.java trunk/crossfire/src/cfeditor/CScriptController.java trunk/crossfire/src/cfeditor/CScriptModel.java trunk/crossfire/src/cfeditor/CScriptView.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/io/CMapWriter.java trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java trunk/crossfire/src/cfeditor/menu/BasicMenuEntry.java trunk/crossfire/src/cfeditor/menu/LocationMenuEntry.java trunk/crossfire/src/cfeditor/menu/MenuHelper.java trunk/crossfire/src/cfeditor/menu/MenuManager.java trunk/crossfire/src/cfeditor/parameter/DoubleParameterView.java trunk/crossfire/src/cfeditor/parameter/IntegerParameterView.java trunk/crossfire/src/cfeditor/parameter/MapParameter.java trunk/daimonin/src/daieditor/CFArchType.java Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-12-09 14:54:02 UTC (rev 965) @@ -196,8 +196,8 @@ } else if (tlist.getIgnoreListTable().containsKey(a1.getValue().trim())) { // just copy everything from ignorelist to this ignore section final List<String> ignlist = tlist.getIgnoreListTable().get(a1.getValue().trim()); - for (int k = 0; k < ignlist.size(); k++) { - ignoreTable.put(ignlist.get(k), ""); + for (final String ignItem : ignlist) { + ignoreTable.put(ignItem, ""); } } else { log.error("In '" + XML_IGNORE + "' section of type " + typeName + ": ignore_list with name \"" + a1.getValue() + "\" is undefined."); @@ -275,10 +275,10 @@ // create an array to store the references to the default atrribs: final CFArchAttrib[] defList = new CFArchAttrib[defaultArchType.attr.length]; - for (int t = 0; t < defaultArchType.attr.length; t++) { + for (final CFArchAttrib attrib : defaultArchType.attr) { // add all attributes from the default_type which are not in the ignoreTable - if (!ignoreTable.containsKey(defaultArchType.attr[t].getNameOld())) { - defList[numDef] = defaultArchType.attr[t]; + if (!ignoreTable.containsKey(attrib.getNameOld())) { + defList[numDef] = attrib; j++; numDef++; } @@ -303,20 +303,20 @@ // initialize array to store imported attribs importList = new CFArchAttrib[impType.attr.length]; - for (int z = 0; z < impType.attr.length; z++) { - if (!impType.attr[z].getSecName().equalsIgnoreCase("general")) { + for (final CFArchAttrib attrib : impType.attr) { + if (!attrib.getSecName().equalsIgnoreCase("general")) { // import this attrib: - if (!impType.attr[z].getSecName().equalsIgnoreCase("general") && - !impType.attr[z].getSecName().equalsIgnoreCase("special") && - !secNames.contains(impType.attr[z].getSecName())) { + if (!attrib.getSecName().equalsIgnoreCase("general") && + !attrib.getSecName().equalsIgnoreCase("special") && + !secNames.contains(attrib.getSecName())) { sectionNum++; // increment number of valid sections - secNames.add(impType.attr[z].getSecName()); + secNames.add(attrib.getSecName()); } - importList[importNum] = impType.attr[z].getClone(); + importList[importNum] = attrib.getClone(); // get section id - final int newId = secNames.indexOf(impType.attr[z].getSecName()); + final int newId = secNames.indexOf(attrib.getSecName()); if (newId >= 0) { importList[importNum].setSecId(newId + 2); } Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-09 14:54:02 UTC (rev 965) @@ -41,7 +41,6 @@ import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.io.IOUtils; -import net.sf.japi.xml.NodeListIterator; import org.apache.log4j.Logger; import org.jdom.Attribute; import org.jdom.DataConversionException; @@ -203,8 +202,8 @@ if (children2 != null && children2.size() > 0) { // load all attribute entries final List<String> content = new ArrayList<String>(); - for (int k = 0; k < children2.size(); k++) { - elem = children2.get(k); + for (Element aChildren2 : children2) { + elem = aChildren2; if ((a = elem.getAttribute(CFArchAttrib.XML_KEY_ARCH)) != null) { content.add(a.getValue().trim()); } else { @@ -572,8 +571,8 @@ bufferedWriter.write(" ##########################################################\n-->\n"); // write spell-entries: - for (int i = 0; i < list.size(); i++) { - tmp = String.valueOf(list.get(i)); + for (final String entry : list) { + tmp = String.valueOf(entry); final String id = tmp.substring(0, tmp.indexOf(" ")).trim(); final String name = tmp.substring(tmp.indexOf(" ") + 1).trim(); String space = ""; Modified: trunk/crossfire/src/cfeditor/CFilterControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CFilterControl.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/CFilterControl.java 2006-12-09 14:54:02 UTC (rev 965) @@ -136,9 +136,9 @@ if (mapControl != null) { mapControl.repaint(); } else { - final MapControl[] maps = CMainControl.getInstance().getOpenedMaps(); - for (int i = 0; i < maps.length; i++) { - maps[i].repaint(); + final MapControl[] mapControls = CMainControl.getInstance().getOpenedMaps(); + for (final MapControl mapControl : mapControls) { + mapControl.repaint(); } } } Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-09 14:54:02 UTC (rev 965) @@ -905,8 +905,7 @@ final List<GameObject> tailList = new ArrayList<GameObject>(); // first: attach our map sucker to a default arch we have loaded - for (final Iterator<GameObject> it = objects.iterator(); it.hasNext();) { - final GameObject gameObject = it.next(); + for (final GameObject gameObject : objects) { final GameObject archetype = archetypeSet.getArchetype(gameObject.getArchetypeName()); if (archetype == null) { // we had an unknown arch here!! Modified: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-12-09 14:54:02 UTC (rev 965) @@ -458,18 +458,18 @@ entry.setMnemonic('V'); final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); - final UIManager.LookAndFeelInfo[] aInfos = UIManager.getInstalledLookAndFeels(); + final UIManager.LookAndFeelInfo[] lafInfos = UIManager.getInstalledLookAndFeels(); final MenuGroup group = new MenuGroup(); //JCheckBoxMenuItem selectedMenuItem = null; final String strSelectedLNFName = settings.getProperty(CMainView.SELECTED_LNF_KEY, UIManager.getCrossPlatformLookAndFeelClassName()); - for (int i = 0; i < aInfos.length; i++) { - final CheckBoxMenuEntry menuItem = new CheckBoxMenuEntry(aInfos[i].getName()); - if (strSelectedLNFName.compareTo(aInfos[i].getClassName()) == 0) { + for (final UIManager.LookAndFeelInfo lafInfo : lafInfos) { + final CheckBoxMenuEntry menuItem = new CheckBoxMenuEntry(lafInfo.getName()); + if (strSelectedLNFName.compareTo(lafInfo.getClassName()) == 0) { menuItem.setChecked(true); } - menuItem.addActionListener(new CLNFActionListener(aInfos[i].getClassName())); + menuItem.addActionListener(new CLNFActionListener(lafInfo.getClassName())); menuManager.addMenuEntry("main.view", menuItem); group.add(menuItem); } Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-12-09 14:54:02 UTC (rev 965) @@ -354,17 +354,14 @@ */ 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 == gameObject) { + for (final GameObject invItem : node.getHead()) { + if (invItem == gameObject) { selListCounter = listCounter; } listCounter++; - model.addElement(arch); + model.addElement(invItem); - final int tmpListCounter = addInvObjects(arch, gameObject); + final int tmpListCounter = addInvObjects(invItem, gameObject); if (tmpListCounter != -1) { selListCounter = tmpListCounter; } Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-09 14:54:02 UTC (rev 965) @@ -659,8 +659,8 @@ // on that square and redraw the map GameObject tmpArch = null; final Iterator<GameObject> it = mapControl.getMapModel().getMapSquare(temp).reverse().iterator(); - while (it.hasNext()) { - tmpArch = it.next(); + for (final GameObject gameObject : mapControl.getMapModel().getMapSquare(temp).reverse()) { + tmpArch = gameObject; // now search backwards for matching view settings if (mainControl.getTileEdit() == 0 || mainControl.isTileEdit(tmpArch.getEditType())) { @@ -707,7 +707,8 @@ // get name of inserted arch (this is display in status bar while dragging) @Nullable final GameObject insArch = mainControl.getArchPanelHighlight(); - final String insertArchName;if (insArch != null) { + final String insertArchName; + if (insArch != null) { if (insArch.getObjName() != null && insArch.getObjName().length() > 0) { insertArchName = insArch.getObjName(); } else if (insArch.getArchetypeName() != null && insArch.getArchetypeName().length() > 0) { @@ -781,8 +782,8 @@ // and redraw the map GameObject tmpArch = null; final Iterator<GameObject> it = mapControl.getMapModel().getMapSquare(mapLoc).reverse().iterator(); - while (it.hasNext()) { - tmpArch = it.next(); + for (final GameObject gameObject : mapControl.getMapModel().getMapSquare(mapLoc).reverse()) { + tmpArch = gameObject; if (mainControl.getTileEdit() == 0 || mainControl.isTileEdit(tmpArch.getEditType())) { break; } Modified: trunk/crossfire/src/cfeditor/CResourceLoader.java =================================================================== --- trunk/crossfire/src/cfeditor/CResourceLoader.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/CResourceLoader.java 2006-12-09 14:54:02 UTC (rev 965) @@ -260,12 +260,12 @@ final Document[] docList = new Document[]{jarDoc, homeDoc, currentDoc,}; Document mainDoc = null; - for (int i = 0; i < docList.length; i++) { - if (docList[i] != null && docList[i].hasRootElement()) { + for (final Document document : docList) { + if (document != null && document.hasRootElement()) { if (mainDoc == null) { - mainDoc = docList[i]; + mainDoc = document; } else { - mainDoc.getRootElement().addContent(docList[i].getRootElement().removeContent()); + mainDoc.getRootElement().addContent(document.getRootElement().removeContent()); } } } Modified: trunk/crossfire/src/cfeditor/CScriptController.java =================================================================== --- trunk/crossfire/src/cfeditor/CScriptController.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/CScriptController.java 2006-12-09 14:54:02 UTC (rev 965) @@ -110,10 +110,10 @@ log.info("no script found"); return; } - for (int i = 0; i < scriptList.size(); i++) { + for (final Object o : scriptList) { log.debug("Reading one script"); final CScriptModel cScript = new CScriptModel(this); - cScript.fromXML((Element) scriptList.get(i)); + cScript.fromXML((Element) o); log.debug("script: " + cScript.getName()); if (override || !scripts.containsKey(cScript.getName())) { if (log.isDebugEnabled()) { @@ -174,8 +174,7 @@ public void exportXML(final OutputStream destination) { final Element root = new Element("scripts"); final Document d = new Document(root); - for (Iterator<CScriptModel> i = scripts.values().iterator(); i.hasNext();) { - final CScriptModel sm = i.next(); + for (final CScriptModel sm : scripts.values()) { root.addContent(sm.toXML()); } final XMLOutputter out = new XMLOutputter(); Modified: trunk/crossfire/src/cfeditor/CScriptModel.java =================================================================== --- trunk/crossfire/src/cfeditor/CScriptModel.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/CScriptModel.java 2006-12-09 14:54:02 UTC (rev 965) @@ -255,8 +255,7 @@ public String[] getParameters() { final ArrayList<String> l = new ArrayList<String>(); - for (Iterator<PluginParameter> it = params.iterator(); it.hasNext();) { - final PluginParameter p = it.next(); + for (final PluginParameter p : (Iterable<PluginParameter>) params) { if (!l.contains(p.getName())) { l.add(p.getName()); } @@ -320,8 +319,8 @@ mdl.code = new String(code); mdl.name = new String(name); mdl.scriptType = scriptType; - for (int i = 0; i < params.size(); i++) { - final PluginParameter original = (PluginParameter) params.get(i); + for (Object param : params) { + final PluginParameter original = (PluginParameter) param; mdl.addParameter((PluginParameter) original.clone()); } return mdl; @@ -413,8 +412,7 @@ scriptType = PLUGIN_SCRIPT; } else { final List<Element> modes = mode.getChildren(); - for (Iterator<Element> i = modes.iterator(); i.hasNext();) { - final Element m = i.next(); + for (final Element m : modes) { final boolean b = Boolean.valueOf(m.getTextTrim()).booleanValue(); final String name = m.getName(); if ("autoboot".equalsIgnoreCase(name) && b) { @@ -428,8 +426,7 @@ } final List<Element> params = node.getChildren("parameter"); if (params != null && !params.isEmpty()) { - for (int j = 0; j < params.size(); j++) { - final Element parameter = params.get(j); + for (final Element parameter : params) { final PluginParameter p = PluginParameterFactory.createParameter(parameter); addParameter(p); } Modified: trunk/crossfire/src/cfeditor/CScriptView.java =================================================================== --- trunk/crossfire/src/cfeditor/CScriptView.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/CScriptView.java 2006-12-09 14:54:02 UTC (rev 965) @@ -95,8 +95,8 @@ private synchronized void updateMenu() { JMenu menu = menuScripts; if (entryScript != null && entryScript.length > 0) { - for (int i = 0; i < entryScript.length; i++) { - entryScript[i].removeActionListener(this); + for (final JMenuItem item : entryScript) { + item.removeActionListener(this); } } if (menu != null) { @@ -108,14 +108,14 @@ } final String[] scripts = ctrl.listScript(); final ArrayList<JMenuItem> visibleScripts = new ArrayList<JMenuItem>(); - for (int i = 0; i < scripts.length; i++) { - if (!ctrl.getScript(scripts[i]).isBash()) { + for (final String script : scripts) { + if (!ctrl.getScript(script).isBash()) { continue; } - final JMenuItem item = new JMenuItem("Run " + scripts[i]); + final JMenuItem item = new JMenuItem("Run " + script); item.addActionListener(this); - item.setActionCommand(scripts[i]); + item.setActionCommand(script); item.setIcon(CGUIUtils.getIcon(IGUIConstants.RUN_PLUGIN_SMALLICON)); menu.add(item); visibleScripts.add(item); Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-12-09 14:54:02 UTC (rev 965) @@ -219,8 +219,7 @@ final StringBuilder buff = new StringBuilder(); if (eventList != null && eventList.size() > 0) { - for (int i = 0; i < eventList.size(); i++) { - final ScriptedEvent se = eventList.get(i); + for (final ScriptedEvent se : eventList) { buff.append(se.getMapArchText()); } } Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-09 14:54:02 UTC (rev 965) @@ -25,7 +25,6 @@ package cfeditor.gameobject; -import cfeditor.CArchPanel; import cfeditor.CFTreasureListTree; import cfeditor.CMainControl; import cfeditor.CPickmapPanel; @@ -225,8 +224,8 @@ final String[] children = f.list(); if (children != null) { Arrays.sort(children); - for (int i = 0; i < children.length; i++) { - loadArchetypesFromFiles(new File(f, children[i]), index); + for (final String child : children) { + loadArchetypesFromFiles(new File(f, child), index); } } folderLevel--; Modified: trunk/crossfire/src/cfeditor/io/CMapWriter.java =================================================================== --- trunk/crossfire/src/cfeditor/io/CMapWriter.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/io/CMapWriter.java 2006-12-09 14:54:02 UTC (rev 965) @@ -178,10 +178,9 @@ // Actually write the fields. append("arch " + gameObject.getArchetypeName() + "\n"); - for (int i = 0; i < keys.length; i++) { - final String value = (String) fields.get(keys[i]); + for (final String key : keys) { + final String value = (String) fields.get(key); if (value != null) { - final String key = keys[i]; if (key.equals("msg") || key.equals("lore")) { append(key + "\n" + value + "\n"); } else { Modified: trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java =================================================================== --- trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java 2006-12-09 14:54:02 UTC (rev 965) @@ -6,7 +6,6 @@ package cfeditor.menu; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Set; import org.apache.log4j.Logger; @@ -119,8 +118,8 @@ return true; } - for (Iterator<WrappedMenuLocation> i = subMenus.values().iterator(); i.hasNext();) { - if (i.next().contains(entry)) { + for (final WrappedMenuLocation wrappedMenuLocation : subMenus.values()) { + if (wrappedMenuLocation.contains(entry)) { return true; } } @@ -138,8 +137,8 @@ } this.menuManager = menuManager; if (!subMenus.isEmpty()) { - for (Iterator<WrappedMenuLocation> i = subMenus.values().iterator(); i.hasNext();) { - menuManager.addMenuLocation(i.next()); + for (final WrappedMenuLocation wrappedMenuLocation : subMenus.values()) { + menuManager.addMenuLocation(wrappedMenuLocation); } } } Modified: trunk/crossfire/src/cfeditor/menu/BasicMenuEntry.java =================================================================== --- trunk/crossfire/src/cfeditor/menu/BasicMenuEntry.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/menu/BasicMenuEntry.java 2006-12-09 14:54:02 UTC (rev 965) @@ -117,9 +117,9 @@ public void actionPerformed(final ActionEvent e) { synchronized (listeners) { - for (Iterator<ActionListener> i = listeners.iterator(); i.hasNext();) { + for (final ActionListener listener : listeners) { log.debug("One more actionPerformed Listerner"); - i.next().actionPerformed(e); + listener.actionPerformed(e); } } log.debug("Acton performed done"); @@ -135,8 +135,7 @@ update(); cleanUpQueue(componentQueue); synchronized (refs) { - for (Iterator<WeakReference<JComponent>> i = refs.iterator(); i.hasNext();) { - final WeakReference<JComponent> wf = i.next(); + for (final WeakReference<JComponent> wf : refs) { final JComponent item = wf.get(); if (log.isDebugEnabled()) { log.debug("Updating item: " + item); Modified: trunk/crossfire/src/cfeditor/menu/LocationMenuEntry.java =================================================================== --- trunk/crossfire/src/cfeditor/menu/LocationMenuEntry.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/menu/LocationMenuEntry.java 2006-12-09 14:54:02 UTC (rev 965) @@ -6,7 +6,6 @@ package cfeditor.menu; -import java.util.Iterator; import java.util.Set; import javax.swing.JComponent; import javax.swing.JMenu; @@ -46,9 +45,9 @@ } final Set entries = loc.getMenuEntries(); - for (Iterator i = entries.iterator(); i.hasNext();) { + for (final Object entry : entries) { log.debug("One more item added"); - menu.add(((MenuEntry) i.next()).getMenuItemComponent()); + menu.add(((MenuEntry) entry).getMenuItemComponent()); } log.debug("returning..."); } Modified: trunk/crossfire/src/cfeditor/menu/MenuHelper.java =================================================================== --- trunk/crossfire/src/cfeditor/menu/MenuHelper.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/menu/MenuHelper.java 2006-12-09 14:54:02 UTC (rev 965) @@ -7,7 +7,6 @@ package cfeditor.menu; -import java.util.Iterator; import java.util.Set; import javax.swing.JMenuBar; @@ -30,8 +29,8 @@ public static JMenuBar getLocationBar(final MenuLocation location) { final JMenuBar bar = new JMenuBar(); final Set s = location.getMenuEntries(); - for (Iterator i = s.iterator(); i.hasNext();) { - bar.add(((MenuEntry) i.next()).getMenuBarComponent()); + for (final Object value : s) { + bar.add(((MenuEntry) value).getMenuBarComponent()); } return bar; } Modified: trunk/crossfire/src/cfeditor/menu/MenuManager.java =================================================================== --- trunk/crossfire/src/cfeditor/menu/MenuManager.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/menu/MenuManager.java 2006-12-09 14:54:02 UTC (rev 965) @@ -164,8 +164,7 @@ log.debug("Removing listener " + listener + " from all locations"); } - for (Iterator<Set<MenuListener>> i = listeners.values().iterator(); i.hasNext();) { - final Set<MenuListener> s = i.next(); + for (final Set<MenuListener> s : listeners.values()) { s.remove(listener); } } @@ -187,8 +186,8 @@ if (loc != null) { final Set<MenuListener> s = getListeners(location); final MenuChangeEvent e = new MenuChangeEvent(loc, entry, type); - for (Iterator<MenuListener> i = s.iterator(); i.hasNext();) { - i.next().menuChanged(e); + for (final MenuListener value : s) { + value.menuChanged(e); } } else { log.warn("Tried to notify a change to unknown location " + location); @@ -208,8 +207,7 @@ } final HashSet<MenuListener> l = new HashSet<MenuListener>(); - for (Iterator<MenuLocation> i = locations.values().iterator(); i.hasNext();) { - final MenuLocation ml = i.next(); + for (final MenuLocation ml : locations.values()) { if (!ml.contains(entry)) { continue; } @@ -221,8 +219,8 @@ * ensure each listener is notified only once. */ final MenuChangeEvent e = new MenuChangeEvent(null, entry, type); - for (Iterator<MenuListener> i = l.iterator(); i.hasNext();) { - i.next().menuChanged(e); + for (final MenuListener aL : l) { + aL.menuChanged(e); } } Modified: trunk/crossfire/src/cfeditor/parameter/DoubleParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/parameter/DoubleParameterView.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/parameter/DoubleParameterView.java 2006-12-09 14:54:02 UTC (rev 965) @@ -66,10 +66,10 @@ } else { c.setToolTipText(tip); } - final Component[] cs = c.getComponents(); - for (int i = 0; i < cs.length; i++) { - if (cs[i] instanceof JComponent) { - forceTooltip((JComponent) cs[i], tip); + final Component[] components = c.getComponents(); + for (final Component component : components) { + if (component instanceof JComponent) { + forceTooltip((JComponent) component, tip); } } } Modified: trunk/crossfire/src/cfeditor/parameter/IntegerParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/parameter/IntegerParameterView.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/parameter/IntegerParameterView.java 2006-12-09 14:54:02 UTC (rev 965) @@ -66,10 +66,10 @@ } else { c.setToolTipText(tip); } - final Component[] cs = c.getComponents(); - for (int i = 0; i < cs.length; i++) { - if (cs[i] instanceof JComponent) { - forceTooltip((JComponent) cs[i], tip); + final Component[] components = c.getComponents(); + for (final Component component : components) { + if (component instanceof JComponent) { + forceTooltip((JComponent) component, tip); } } } Modified: trunk/crossfire/src/cfeditor/parameter/MapParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/parameter/MapParameter.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/crossfire/src/cfeditor/parameter/MapParameter.java 2006-12-09 14:54:02 UTC (rev 965) @@ -59,10 +59,10 @@ return CMainControl.getInstance().getCurrentMap(); } - final MapControl[] maps = CMainControl.getInstance().getOpenedMaps(); - for (int i = 0; i < maps.length; i++) { - if (maps[i].getMapFileName().equalsIgnoreCase(s)) { - return maps[i]; + final MapControl[] mapControls = CMainControl.getInstance().getOpenedMaps(); + for (final MapControl mapControl : mapControls) { + if (mapControl.getMapFileName().equalsIgnoreCase(s)) { + return mapControl; } } Modified: trunk/daimonin/src/daieditor/CFArchType.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchType.java 2006-12-09 14:25:07 UTC (rev 964) +++ trunk/daimonin/src/daieditor/CFArchType.java 2006-12-09 14:54:02 UTC (rev 965) @@ -260,10 +260,10 @@ // create an array to store the references to the default atrribs: final CFArchAttrib[] defList = new CFArchAttrib[defaultArchType.attr.length]; - for (int t = 0; t < defaultArchType.attr.length; t++) { + for (final CFArchAttrib attrib : defaultArchType.attr) { // add all attributes from the default_type which are not in the ignoreTable - if (!ignoreTable.containsKey(defaultArchType.attr[t].getNameOld())) { - defList[numDef] = defaultArchType.attr[t]; + if (!ignoreTable.containsKey(attrib.getNameOld())) { + defList[numDef] = attrib; j++; numDef++; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-12-09 15:21:56
|
Revision: 968 http://svn.sourceforge.net/gridarta/?rev=968&view=rev Author: christianhujer Date: 2006-12-09 07:21:56 -0800 (Sat, 09 Dec 2006) Log Message: ----------- Removed redundant casts. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/JarResources.java trunk/crossfire/src/cfeditor/filter/NamedFilterList.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/io/CMapWriter.java trunk/crossfire/src/cfeditor/menu/BasicMenuEntry.java trunk/crossfire/src/cfeditor/parameter/DoubleParameterView.java trunk/crossfire/src/cfeditor/parameter/IntegerParameterView.java trunk/daimonin/src/daieditor/gui/map/MapTilePane.java trunk/daimonin/src/daieditor/gui/prefs/NetPrefs.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-09 15:12:43 UTC (rev 967) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-09 15:21:56 UTC (rev 968) @@ -711,9 +711,9 @@ input = buildSpellBox(type.getAttr()[i]); break; case LIST: - if (type.getAttr()[i].getMisc() != null && typelist.getListTable().containsKey((String) (type.getAttr()[i].getMisc()[0]))) { + if (type.getAttr()[i].getMisc() != null && typelist.getListTable().containsKey(type.getAttr()[i].getMisc()[0])) { // build the list from vector data - input = buildArrayBox(type.getAttr()[i], typelist.getListTable().get((String) (type.getAttr()[i].getMisc()[0]))); + input = buildArrayBox(type.getAttr()[i], typelist.getListTable().get(type.getAttr()[i].getMisc()[0])); } else { // error: list data is missing or corrupt cComp = new JLabel("Error: Undefined List"); @@ -733,9 +733,9 @@ break; case BITMASK: { newAttr = new BitmaskAttrib(type.getAttr()[i]); - if (type.getAttr()[i].getMisc() != null && typelist.getBitmaskTable().containsKey((String) (type.getAttr()[i].getMisc()[0]))) { + if (type.getAttr()[i].getMisc() != null && typelist.getBitmaskTable().containsKey(type.getAttr()[i].getMisc()[0])) { // fetch the bitmask data, then build the attribute panel - final CAttribBitmask bitmask = (CAttribBitmask) (typelist.getBitmaskTable().get((String) (type.getAttr()[i].getMisc()[0]))); + final CAttribBitmask bitmask = typelist.getBitmaskTable().get((String) (type.getAttr()[i].getMisc()[0])); ((BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr).bitmask = bitmask; cLabel = new JButton(new MaskChangeAL(type.getAttr()[i].getNameNew() + ':', (BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr)); final JTextArea input = new JTextArea(); Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-12-09 15:12:43 UTC (rev 967) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-12-09 15:21:56 UTC (rev 968) @@ -314,7 +314,7 @@ // now try to get the topmost object GameObject arch = null; if (pmap.isPointValid(pmap.getMapViewFrame().getHighlightStart())) { - arch = (GameObject) pmap.getMapModel().getMapSquare(pmap.getMapViewFrame().getHighlightStart()).getFirst(); + arch = pmap.getMapModel().getMapSquare(pmap.getMapViewFrame().getHighlightStart()).getFirst(); } if (arch != null) { // so here we return the arch from the pickmap Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-09 15:12:43 UTC (rev 967) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-09 15:21:56 UTC (rev 968) @@ -136,7 +136,7 @@ setBackground(IGUIConstants.BG_COLOR); } renderer = new DefaultLevelRenderer(this, mainControl, mapControl, isPickmap()); - setViewportView((JComponent) renderer); + setViewportView(renderer); getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); refreshDataFromModel(); @@ -150,7 +150,7 @@ } final CListener listener = new CListener(); - ((JComponent) renderer).addMouseListener(listener); + renderer.addMouseListener(listener); if (!isPickmap()) { renderer.addMouseMotionListener(listener); renderer.addMouseMotionListener(mainControl.getMainView().getStatusBar()); @@ -313,12 +313,12 @@ log.debug("refreshDataFromModel"); // define how much drawing space we need for the map forcedSize = new Dimension(mapSize.getWidth() * 32 + (isPickmap() ? 0 : 64), mapSize.getHeight() * 32 + (isPickmap() ? 0 : 64)); - ((JComponent) renderer).setPreferredSize(forcedSize); - ((JComponent) renderer).setMinimumSize(forcedSize); + renderer.setPreferredSize(forcedSize); + renderer.setMinimumSize(forcedSize); changedFlagNotify(); if (renderer.resizeBackBuffer()) { - ((JComponent) renderer).setSize(forcedSize); - ((JComponent) renderer).revalidate(); + renderer.setSize(forcedSize); + renderer.revalidate(); } renderer.modelChanged(); } Modified: trunk/crossfire/src/cfeditor/JarResources.java =================================================================== --- trunk/crossfire/src/cfeditor/JarResources.java 2006-12-09 15:12:43 UTC (rev 967) +++ trunk/crossfire/src/cfeditor/JarResources.java 2006-12-09 15:21:56 UTC (rev 968) @@ -133,11 +133,11 @@ if (size == -1) { size = htSizes.get(ze.getName()).intValue(); } - final byte[] b = new byte[(int) size]; + final byte[] b = new byte[size]; int rb = 0; int chunk; while (size - rb > 0) { - chunk = zis.read(b, rb, (int) size - rb); + chunk = zis.read(b, rb, size - rb); if (chunk == -1) { break; } Modified: trunk/crossfire/src/cfeditor/filter/NamedFilterList.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/NamedFilterList.java 2006-12-09 15:12:43 UTC (rev 967) +++ trunk/crossfire/src/cfeditor/filter/NamedFilterList.java 2006-12-09 15:21:56 UTC (rev 968) @@ -111,7 +111,7 @@ } if (nfc.isSubFilterEnabled(name)) { log.debug("enabled!"); - final Filter f = (Filter) subFilters.get(name); + final Filter f = subFilters.get(name); if (f.match(nfc.getConfig(name), object)) { log.debug("and matched!"); return !nfc.isInverted(); @@ -263,10 +263,10 @@ inverted.addContent(Boolean.toString(fConfig.isInverted())); result.addContent(inverted); for (final Map.Entry<String, Filter> entry : subFilters.entrySet()) { - final Element filterValue = ((Filter) entry.getValue()).toXML(fConfig.getConfig((String) entry.getKey())); + final Element filterValue = entry.getValue().toXML(fConfig.getConfig(entry.getKey())); final Element subfilter = new Element("subfilter"); final Element fName = new Element("name"); - fName.addContent((String) entry.getKey()); + fName.addContent(entry.getKey()); subfilter.addContent(fName); subfilter.addContent(filterValue); result.addContent(subfilter); @@ -326,7 +326,7 @@ return; } - final JComponent c = (JComponent) content.get(name); + final JComponent c = content.get(name); content.remove(name); component.remove(c); } Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-09 15:12:43 UTC (rev 967) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-09 15:21:56 UTC (rev 968) @@ -501,7 +501,7 @@ for (final GameObject arch : getArchetypes()) { final String faceName = arch.getFaceName(); if (faceName != null) { - final Integer num = (Integer) faceMap.get(faceName); + final Integer num = faceMap.get(faceName); if (num != null) { arch.setFaceNr(num); } Modified: trunk/crossfire/src/cfeditor/io/CMapWriter.java =================================================================== --- trunk/crossfire/src/cfeditor/io/CMapWriter.java 2006-12-09 15:12:43 UTC (rev 967) +++ trunk/crossfire/src/cfeditor/io/CMapWriter.java 2006-12-09 15:21:56 UTC (rev 968) @@ -173,13 +173,13 @@ } // Sort fields to match server/crossedit order. - final String[] keys = (String[]) fields.keySet().toArray(new String[0]); + final String[] keys = fields.keySet().toArray(new String[0]); Arrays.sort(keys, keyOrderComparator); // Actually write the fields. append("arch " + gameObject.getArchetypeName() + "\n"); for (final String key : keys) { - final String value = (String) fields.get(key); + final String value = fields.get(key); if (value != null) { if (key.equals("msg") || key.equals("lore")) { append(key + "\n" + value + "\n"); Modified: trunk/crossfire/src/cfeditor/menu/BasicMenuEntry.java =================================================================== --- trunk/crossfire/src/cfeditor/menu/BasicMenuEntry.java 2006-12-09 15:12:43 UTC (rev 967) +++ trunk/crossfire/src/cfeditor/menu/BasicMenuEntry.java 2006-12-09 15:21:56 UTC (rev 968) @@ -105,8 +105,8 @@ } if (item instanceof AbstractButton) { //((AbstractButton)item).setText(getName()); - ((AbstractButton) item).setVisible(isVisible()); - ((AbstractButton) item).setEnabled(isEnabled()); + item.setVisible(isVisible()); + item.setEnabled(isEnabled()); //((AbstractButton)item).setMnemonic(mnemonic); //((AbstractButton)item).setActionCommand(getName()); } Modified: trunk/crossfire/src/cfeditor/parameter/DoubleParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/parameter/DoubleParameterView.java 2006-12-09 15:12:43 UTC (rev 967) +++ trunk/crossfire/src/cfeditor/parameter/DoubleParameterView.java 2006-12-09 15:21:56 UTC (rev 968) @@ -103,7 +103,7 @@ value.addChangeListener(new ChangeListener() { public void stateChanged(final ChangeEvent e) { try { - parameter.setValue((Double) ((SpinnerNumberModel) value.getModel()).getNumber()); + parameter.setValue(((SpinnerNumberModel) value.getModel()).getNumber()); } catch (final Exception ex) { ex.printStackTrace(); } Modified: trunk/crossfire/src/cfeditor/parameter/IntegerParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/parameter/IntegerParameterView.java 2006-12-09 15:12:43 UTC (rev 967) +++ trunk/crossfire/src/cfeditor/parameter/IntegerParameterView.java 2006-12-09 15:21:56 UTC (rev 968) @@ -100,7 +100,7 @@ value.addChangeListener(new ChangeListener() { public void stateChanged(final ChangeEvent e) { try { - parameter.setValue((Integer) ((SpinnerNumberModel) value.getModel()).getNumber()); + parameter.setValue(((SpinnerNumberModel) value.getModel()).getNumber()); } catch (final Exception ex) { ex.printStackTrace(); } Modified: trunk/daimonin/src/daieditor/gui/map/MapTilePane.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapTilePane.java 2006-12-09 15:12:43 UTC (rev 967) +++ trunk/daimonin/src/daieditor/gui/map/MapTilePane.java 2006-12-09 15:21:56 UTC (rev 968) @@ -224,6 +224,7 @@ for (int index = 0; index <= 7; index++) { final JPanel tilePanel = tilePaths[index] = new TilePanel(index); // DO NOT REMOVE THE CAST. it's required to call add(Component, Object), NOT add(Component, int) + //noinspection RedundantCast tilePanels.add(tilePanel, (Object) (Integer) index); } return tilePanels; Modified: trunk/daimonin/src/daieditor/gui/prefs/NetPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/NetPrefs.java 2006-12-09 15:12:43 UTC (rev 967) +++ trunk/daimonin/src/daieditor/gui/prefs/NetPrefs.java 2006-12-09 15:21:56 UTC (rev 968) @@ -99,7 +99,7 @@ /** {@inheritDoc} */ public boolean isChanged() { return !( - (Proxy.Type) proxyType.getSelectedItem() == Proxy.Type.valueOf(PREFS.get(NET_PREFS_KEY_TYPE, "DIRECT")) + proxyType.getSelectedItem() == Proxy.Type.valueOf(PREFS.get(NET_PREFS_KEY_TYPE, "DIRECT")) && PREFS.get(NET_PREFS_KEY_HOST, "").equals(proxyHost.getText()) && PREFS.getInt(NET_PREFS_KEY_PORT, 3128) == (Integer) proxyPort.getValue() ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-12-09 15:33:24
|
Revision: 974 http://svn.sourceforge.net/gridarta/?rev=974&view=rev Author: christianhujer Date: 2006-12-09 07:33:24 -0800 (Sat, 09 Dec 2006) Log Message: ----------- Simplified boolean returns. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFilterControl.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CFilterControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CFilterControl.java 2006-12-09 15:29:16 UTC (rev 973) +++ trunk/crossfire/src/cfeditor/CFilterControl.java 2006-12-09 15:33:24 UTC (rev 974) @@ -96,10 +96,7 @@ } public boolean highLightedSquare(final int path) { - if (highLightConfig[path].isEnabled()) { - return highLightResult[path]; - } - return false; + return highLightConfig[path].isEnabled() && highLightResult[path]; } public void objectInSquare(final GameObject o) { Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-09 15:29:16 UTC (rev 973) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-09 15:33:24 UTC (rev 974) @@ -561,11 +561,8 @@ // Set grid of level, if there is a level public boolean isGridVisible() { - if (currentMap == null) { - return false; - } + return currentMap != null && currentMap.getMapViewFrame().isGridVisible(); - return currentMap.getMapViewFrame().isGridVisible(); } /** Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-12-09 15:29:16 UTC (rev 973) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-12-09 15:33:24 UTC (rev 974) @@ -2191,10 +2191,7 @@ /** {@inheritDoc} */ @Override public boolean equals(final Object obj) { - if (obj == null || !(obj instanceof Recent)) { - return false; - } - return filename.equals(((Recent) obj).filename); + return !(obj == null || !(obj instanceof Recent)) && filename.equals(((Recent) obj).filename); } /** {@inheritDoc} */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-12-09 17:11:35
|
Revision: 978 http://svn.sourceforge.net/gridarta/?rev=978&view=rev Author: christianhujer Date: 2006-12-09 09:11:32 -0800 (Sat, 09 Dec 2006) Log Message: ----------- Removed some redundant local variables. Modified Paths: -------------- trunk/crossfire/src/cfeditor/COptionDialog.java trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java trunk/daimonin/src/daieditor/MapViewIFrame.java Modified: trunk/crossfire/src/cfeditor/COptionDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/COptionDialog.java 2006-12-09 17:08:39 UTC (rev 977) +++ trunk/crossfire/src/cfeditor/COptionDialog.java 2006-12-09 17:11:32 UTC (rev 978) @@ -73,7 +73,6 @@ */ COptionDialog(final CMainControl mainControl, final Frame parentFrame) { super(parentFrame, "Options"); - final CMainControl mainControl1=mainControl; getContentPane().setLayout(new BorderLayout()); final JPanel mainPanel = new JPanel(); @@ -98,21 +97,21 @@ final JPanel archPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); archPanel.add(new JLabel("Archfiles: ")); m_archField = new JTextField(16); - m_archField.setText(mainControl1.getArchDefaultFolder()); + m_archField.setText(mainControl.getArchDefaultFolder()); archPanel.add(m_archField); optionPathPanel.add(archPanel); final JPanel mapPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); mapPanel.add(new JLabel("Maps: ")); m_mapField = new JTextField(16); - m_mapField.setText(mainControl1.getMapDefaultFolder()); + m_mapField.setText(mainControl.getMapDefaultFolder()); mapPanel.add(m_mapField); optionPathPanel.add(mapPanel); final JPanel scriptPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); scriptPanel.add(new JLabel("Scripts: ")); m_scriptField = new JTextField(16); - m_scriptField.setText(mainControl1.getScriptDefaultFolder()); + m_scriptField.setText(mainControl.getScriptDefaultFolder()); scriptPanel.add(m_scriptField); mainPanel.add(optionPathPanel); @@ -128,18 +127,18 @@ IGUIConstants.DIALOG_INSETS))); final JPanel cbox; - if (mainControl1.getImageSet() != null) { - cbox = buildImageSetBox(mainControl1.getImageSet().equalsIgnoreCase("base")); + if (mainControl.getImageSet() != null) { + cbox = buildImageSetBox(mainControl.getImageSet().equalsIgnoreCase("base")); } else { cbox = buildImageSetBox(false); } optionPartPanel.add(cbox); m_loadArches = new JCheckBox(" Load Arches from Collection"); - m_loadArches.setSelected(mainControl1.isArchLoadedFromCollection()); + m_loadArches.setSelected(mainControl.isArchLoadedFromCollection()); m_loadArches.addActionListener(new SelectArchLoadAL(m_loadArches, this)); optionPartPanel.add(m_loadArches); - if (mainControl1.isArchLoadedFromCollection()) { + if (mainControl.isArchLoadedFromCollection()) { m_archField.setEnabled(false); } @@ -156,7 +155,7 @@ IGUIConstants.DIALOG_INSETS))); m_mapPanelBottom = new JCheckBox(" Separate Map-Tile Panel"); - m_mapPanelBottom.setSelected(!mainControl1.getMainView().isMapTileListBottom()); + m_mapPanelBottom.setSelected(!mainControl.getMainView().isMapTileListBottom()); optionLayoutPanel.add(m_mapPanelBottom); optionLayoutPanel.add(new JLabel("(Takes effect on next application start)")); mainPanel.add(optionLayoutPanel); Modified: trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java =================================================================== --- trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java 2006-12-09 17:08:39 UTC (rev 977) +++ trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java 2006-12-09 17:11:32 UTC (rev 978) @@ -23,7 +23,6 @@ public WrappedMenuLocation(final MenuLocation location, final String parentName) { this.location = location; - final String parentName1 = parentName; name = parentName + "." + location.getName(); } Modified: trunk/daimonin/src/daieditor/MapViewIFrame.java =================================================================== --- trunk/daimonin/src/daieditor/MapViewIFrame.java 2006-12-09 17:08:39 UTC (rev 977) +++ trunk/daimonin/src/daieditor/MapViewIFrame.java 2006-12-09 17:11:32 UTC (rev 978) @@ -73,7 +73,6 @@ super(mapControl.getMapFileName() + " [ " + mapControl.getMapArch().getMapDisplayName() + " ] ("+ number + ')', true, true, true, true); this.mapControl = mapControl; this.mainControl = mainControl; - final int viewNumber = number; setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |