You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <chr...@us...> - 2006-06-25 12:22:16
|
Revision: 184 Author: christianhujer Date: 2006-06-25 05:22:10 -0700 (Sun, 25 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=184&view=rev Log Message: ----------- Removied redundant MapTilePane class. Removed Paths: ------------- trunk/daimonin/src/daieditor/MapTilePane.java Deleted: trunk/daimonin/src/daieditor/MapTilePane.java =================================================================== --- trunk/daimonin/src/daieditor/MapTilePane.java 2006-06-25 12:21:31 UTC (rev 183) +++ trunk/daimonin/src/daieditor/MapTilePane.java 2006-06-25 12:22:10 UTC (rev 184) @@ -1,864 +0,0 @@ -/* - * Daimonin Java Editor. - * Copyright (C) 2000 Michael Toennies - * Copyright (C) 2001 Andreas Vogl - * 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 daieditor; - -import static net.sf.japi.swing.ActionFactory.getFactory; -import daieditor.gui.DirectionLayout; -import daieditor.map.MapArchObject; -import daieditor.map.MapControl; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.util.Dictionary; -import java.util.Hashtable; -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JFileChooser; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JSlider; -import javax.swing.JTextField; -import javax.swing.SwingConstants; -import javax.swing.border.CompoundBorder; -import javax.swing.border.TitledBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import net.sf.japi.swing.ActionFactory; -import net.sf.gridarta.GridderException; -import org.jetbrains.annotations.Nullable; - -/** - * A Panel for managing the tiling of maps. - * It creates a Panel for a map where the user can manage the tile paths. - * He can choose files to tile, attach tiles, clear all or individual tile paths and switch between relative and absolute paths. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:Chr...@it...">Chrsitian Hujer</a> - */ -public final class MapTilePane extends JPanel { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - /** ActionFactory. */ - private static final ActionFactory ACTION_FACTORY = getFactory("daieditor"); - - /** The mainControl to use. */ - private final CMainControl mainControl; - - /** The mapControl of the map in context. */ - private MapControl mapControl; - - /** The MapArchObject to show. */ - private MapArchObject map; - - /** The tile link names for the labels / borders. */ - private static final String[] tile_link_name = { - ACTION_FACTORY.getString("mapNorth"), - ACTION_FACTORY.getString("mapEast"), - ACTION_FACTORY.getString("mapSouth"), - ACTION_FACTORY.getString("mapWest"), - ACTION_FACTORY.getString("mapNorthEast"), - ACTION_FACTORY.getString("mapSouthEast"), - ACTION_FACTORY.getString("mapSouthWest"), - ACTION_FACTORY.getString("mapNorthWest"), - }; - - /** The tile links used for the attach map algorithm. */ - private static final int[][][] tileLink = new int[8][2][2]; - - static { - /* fine list of indirect links von maps around to other maps around us */ - tileLink[IGUIConstants.TILE_PATH_NORTH][0][0] = IGUIConstants.TILE_PATH_NORTHWEST; - tileLink[IGUIConstants.TILE_PATH_NORTH][0][1] = IGUIConstants.TILE_PATH_WEST; - tileLink[IGUIConstants.TILE_PATH_NORTH][1][0] = IGUIConstants.TILE_PATH_NORTHEAST; - tileLink[IGUIConstants.TILE_PATH_NORTH][1][1] = IGUIConstants.TILE_PATH_EAST; - - tileLink[IGUIConstants.TILE_PATH_NORTHEAST][0][0] = IGUIConstants.TILE_PATH_NORTH; - tileLink[IGUIConstants.TILE_PATH_NORTHEAST][0][1] = IGUIConstants.TILE_PATH_WEST; - tileLink[IGUIConstants.TILE_PATH_NORTHEAST][1][0] = IGUIConstants.TILE_PATH_EAST; - tileLink[IGUIConstants.TILE_PATH_NORTHEAST][1][1] = IGUIConstants.TILE_PATH_SOUTH; - - tileLink[IGUIConstants.TILE_PATH_EAST][0][0] = IGUIConstants.TILE_PATH_NORTHEAST; - tileLink[IGUIConstants.TILE_PATH_EAST][0][1] = IGUIConstants.TILE_PATH_NORTH; - tileLink[IGUIConstants.TILE_PATH_EAST][1][0] = IGUIConstants.TILE_PATH_SOUTHEAST; - tileLink[IGUIConstants.TILE_PATH_EAST][1][1] = IGUIConstants.TILE_PATH_SOUTH; - - tileLink[IGUIConstants.TILE_PATH_SOUTHEAST][0][0] = IGUIConstants.TILE_PATH_EAST; - tileLink[IGUIConstants.TILE_PATH_SOUTHEAST][0][1] = IGUIConstants.TILE_PATH_NORTH; - tileLink[IGUIConstants.TILE_PATH_SOUTHEAST][1][0] = IGUIConstants.TILE_PATH_SOUTH; - tileLink[IGUIConstants.TILE_PATH_SOUTHEAST][1][1] = IGUIConstants.TILE_PATH_WEST; - - tileLink[IGUIConstants.TILE_PATH_SOUTH][0][0] = IGUIConstants.TILE_PATH_SOUTHEAST; - tileLink[IGUIConstants.TILE_PATH_SOUTH][0][1] = IGUIConstants.TILE_PATH_EAST; - tileLink[IGUIConstants.TILE_PATH_SOUTH][1][0] = IGUIConstants.TILE_PATH_SOUTHWEST; - tileLink[IGUIConstants.TILE_PATH_SOUTH][1][1] = IGUIConstants.TILE_PATH_WEST; - - tileLink[IGUIConstants.TILE_PATH_SOUTHWEST][0][0] = IGUIConstants.TILE_PATH_SOUTH; - tileLink[IGUIConstants.TILE_PATH_SOUTHWEST][0][1] = IGUIConstants.TILE_PATH_EAST; - tileLink[IGUIConstants.TILE_PATH_SOUTHWEST][1][0] = IGUIConstants.TILE_PATH_WEST; - tileLink[IGUIConstants.TILE_PATH_SOUTHWEST][1][1] = IGUIConstants.TILE_PATH_NORTH; - - tileLink[IGUIConstants.TILE_PATH_WEST][0][0] = IGUIConstants.TILE_PATH_SOUTHWEST; - tileLink[IGUIConstants.TILE_PATH_WEST][0][1] = IGUIConstants.TILE_PATH_SOUTH; - tileLink[IGUIConstants.TILE_PATH_WEST][1][0] = IGUIConstants.TILE_PATH_NORTHWEST; - tileLink[IGUIConstants.TILE_PATH_WEST][1][1] = IGUIConstants.TILE_PATH_NORTH; - - tileLink[IGUIConstants.TILE_PATH_NORTHWEST][0][0] = IGUIConstants.TILE_PATH_WEST; - tileLink[IGUIConstants.TILE_PATH_NORTHWEST][0][1] = IGUIConstants.TILE_PATH_SOUTH; - tileLink[IGUIConstants.TILE_PATH_NORTHWEST][1][0] = IGUIConstants.TILE_PATH_NORTH; - tileLink[IGUIConstants.TILE_PATH_NORTHWEST][1][1] = IGUIConstants.TILE_PATH_EAST; - } - - /** List with links used for reverse map linking. */ - private static final int[] rev_link = { - IGUIConstants.TILE_PATH_SOUTH, - IGUIConstants.TILE_PATH_WEST, - IGUIConstants.TILE_PATH_NORTH, - IGUIConstants.TILE_PATH_EAST, - IGUIConstants.TILE_PATH_SOUTHWEST, - IGUIConstants.TILE_PATH_NORTHWEST, - IGUIConstants.TILE_PATH_NORTHEAST, - IGUIConstants.TILE_PATH_SOUTHEAST, - }; - - /** Indices of next focus. */ - private static final int[] nextFocus = {4, 5, 6, 7, 1, 2, 3, 0}; - - /** The JTextFields with the tile paths. */ - private final TilePanel[] tilePaths = new TilePanel[8]; - - /** - * Create a MapTilePane. - * @param mainControl CMainControl to use for displaying dialogs, getting paths etc.. - */ - public MapTilePane(final CMainControl mainControl) { - this.mainControl = mainControl; - buildComponents(); - } - - /** - * Create a MapTilePane. - * @param mainControl CMainControl to use for displaying dialogs, getting paths etc.. - * @param mapControl MapControl of the map that's tiles are to be viewed / controlled - */ - public MapTilePane(final CMainControl mainControl, final MapControl mapControl) { - this(mainControl); - setMapControl(mapControl); - } - - /** - * Sets the mapControl for this MapTilePane. - * @param mapControl MapControl of the map that's tiles are to be viewed / controlled - */ - public void setMapControl(final MapControl mapControl) { - this.mapControl = mapControl; - map = mapControl.getMapModel().getMapArch(); - final File mapDir = mainControl.getMapDir(); - final File mapFile = mapControl.getMapFile(); - for (int i = 0; i < 8; i++) { - tilePaths[i].setAbsoluteReference(mapDir); - tilePaths[i].setOriginal(map.getTilePath(i)); - tilePaths[i].setRelativeReference(mapFile); - } - } - - /** Builds the components of this panel. */ - private void buildComponents() { - setLayout(new GridBagLayout()); - final GridBagConstraints gbc = new GridBagConstraints(); - gbc.gridwidth = GridBagConstraints.REMAINDER; - gbc.weightx = 1.0; - gbc.fill = GridBagConstraints.BOTH; - add(buildTilePanels(), gbc); - add(buildSubPanel(), gbc); - } - - /** Builds the tile panel. */ - private JPanel buildTilePanels() { - final JPanel tilePanels = new JPanel(new DirectionLayout()); - //JPanel tilePanels = new JPanel(new GridBagLayout()); - tilePanels.setBorder(new CompoundBorder(BorderFactory.createTitledBorder(ACTION_FACTORY.getString("mapTiles")), IGUIConstants.DIALOG_BORDER)); - - final GridBagConstraints gbc = new GridBagConstraints(); - gbc.weightx = 0.33; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.anchor = GridBagConstraints.CENTER; - 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) - tilePanels.add(tilePanel, (Object) index); - } - return tilePanels; - } - - /** Creates the subPanel that holds the buttons to attach maps or clear all paths. */ - private JPanel buildSubPanel() { - final JPanel subPanel = new JPanel(new GridBagLayout()); - subPanel.setBorder(new CompoundBorder(BorderFactory.createTitledBorder(ACTION_FACTORY.getString("mapControl")), IGUIConstants.DIALOG_BORDER)); - final GridBagConstraints gbc = new GridBagConstraints(); - gbc.fill = GridBagConstraints.NONE; - gbc.weightx = 1.0; - gbc.weighty = 1.0; - gbc.anchor = GridBagConstraints.EAST; - subPanel.add(new JButton(ACTION_FACTORY.createAction(true, "mapTilesAttach", this)), gbc); - gbc.gridwidth = GridBagConstraints.REMAINDER; - gbc.anchor = GridBagConstraints.WEST; - subPanel.add(new JButton(ACTION_FACTORY.createAction(true, "mapTilesClear", this)), gbc); - return subPanel; - } - - /** - * A TilePanel displays exactly one direction for map tiling. - * It's basically an extended textfield with some additional buttons to make usage easier for users. - */ - public static final class TilePanel extends JPanel implements ActionListener { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - /** The original value. */ - private String original; - - /** The context reference for relative paths (file). */ - private File relativeReference; - - /** The context reference for absolute paths (file). */ - private File absoluteReference; - - /** The JTextField with the text. */ - private final JTextField textField; - - /** The direction. */ - private final int direction; - - /** The RASwitch. */ - private final RASwitch raSwitch; - - /** - * Create a TilePanel. - * @param direction Index, used to determine the direction and corresponding locale keys - */ - private TilePanel(final int direction) { - super(new GridBagLayout()); - this.direction = direction; - final TitledBorder border = new TitledBorder(tile_link_name[direction]); - border.setTitleJustification(TitledBorder.CENTER); - setBorder(border); - //setBorder(BorderFactory.createTitledBorder(tile_link_name[direction])); - final GridBagConstraints gbc = new GridBagConstraints(); - textField = new JTextField(); - textField.setColumns(16); - textField.addActionListener(this); - - gbc.fill = GridBagConstraints.NONE; - add(iconButton("mapTileRevert"), gbc); - add(iconButton("mapTileClear"), gbc); - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.weightx = 1.0; - add(textField, gbc); - gbc.weightx = 0.0; - gbc.fill = GridBagConstraints.NONE; - raSwitch = new RASwitch(); - add(raSwitch, gbc); - add(iconButton("mapTileChoose"), gbc); - } - - /** - * Set the original value, which is used as initial value and for restoring it. - * This method also invokes {@link #setText(String)}. - * @param original original value, used as initial value and for restoring it. - */ - public void setOriginal(final String original) { - this.original = original; - mapTileRevert(); - } - - /** - * Set the context reference for relative paths. - * @param relativeReference file to reference for relative paths (context file or directory, not parent directory) - */ - public void setRelativeReference(final File relativeReference) { - try { - this.relativeReference = relativeReference.getCanonicalFile(); - } catch (final IOException e) { - this.relativeReference = relativeReference.getAbsoluteFile(); - } catch (final NullPointerException e) { - // occurs on unsaved maps where this method is invoked with null argument - } - } - - /** - * Set the context reference for absolute paths. - * @param absoluteReference file to reference for absolute paths (context file or directory, not parent directory) - */ - public void setAbsoluteReference(final File absoluteReference) { - try { - this.absoluteReference = absoluteReference.getCanonicalFile(); - } catch (final IOException e) { - this.absoluteReference = absoluteReference.getAbsoluteFile(); - } - } - - /** - * {@inheritDoc} - * Bound to the textField to update the relative/absolute state. - */ - public void actionPerformed(final ActionEvent e) { - raSwitch.updateRAState(); - ((MapTilePane) getParent()).tilePaths[nextFocus[direction]].textField.requestFocusInWindow(); - } - - /** - * Create a new JButton for reverting a path entry. - * @param key key to create button with icon for - * @return JButton for key - */ - private JButton iconButton(final String key) { - final JButton button = new JButton(ACTION_FACTORY.createAction(false, key, this)); - button.setMargin(new Insets(0, 0, 0, 0)); - return button; - } - - /** - * Action method for reverting to stored path. - * @used - */ - public void mapTileRevert() { - setText(original); - } - - /** - * Action method for deleting the path. - * @used - */ - public void mapTileClear() { - setText(""); - } - - /** - * Action method for choosing the path. - * @used - */ - public void mapTileChoose() { - final JFileChooser chooser = new JFileChooser(relativeReference.getParentFile()); - final String oldFilename = getText(); - if (oldFilename != null && oldFilename.length() > 0) { - // Point the chooser on the current path tile file - final File oldFile; - if (oldFilename.startsWith("/")) { - oldFile = new File(absoluteReference, oldFilename.substring(1)); - } else { - oldFile = new File(relativeReference.getParentFile(), oldFilename); - } - chooser.setCurrentDirectory(oldFile.getParentFile()); - chooser.setSelectedFile(oldFile); - } - chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); - chooser.setMultiSelectionEnabled(false); - chooser.setFileFilter(CMainControl.mapFileFilter); - final int returnVal = chooser.showOpenDialog(this); - if (returnVal == JFileChooser.APPROVE_OPTION) { - try { - final File selected = chooser.getSelectedFile(); - final String relPath = selected.getCanonicalPath().substring(absoluteReference.getCanonicalPath().length()).replace('\\', '/'); - setText(relPath); - } catch (final IOException ex) { - setText("Error: " + ex); - } - } - } - - /** - * Set the text. - * @param text Text to set - */ - public void setText(final String text) { - textField.setText(text); - raSwitch.updateRAState(); - } - - /** - * Get the text. - * @return text - */ - public String getText() { - return textField.getText(); - } - - /** A JSlider that converts relative to absolute paths and vice versa. */ - private final class RASwitch extends JSlider implements ChangeListener { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - /** Create RASwitch. */ - private RASwitch() { - super(SwingConstants.VERTICAL, 0, 1, 0); - final Dictionary<Integer, JComponent> pathLabelDict = new Hashtable<Integer, JComponent>(); - pathLabelDict.put(0, new JLabel("A")); - pathLabelDict.put(1, new JLabel("R")); - setToolTipText(ACTION_FACTORY.getString("mapTilePathMode.shortdescription")); - setLabelTable(pathLabelDict); - setPaintLabels(true); - setLabelTable(pathLabelDict); - addChangeListener(this); - setSnapToTicks(true); - setPreferredSize(getMinimumSize()); - } - - /** {@inheritDoc} */ - public void stateChanged(final ChangeEvent e) { - final String path = getText(); - if (path == null || relativeReference == null) { - return; - } - final String relRef = new StringBuilder().append('/').append(PathManager.absoluteToRelative(absoluteReference.getPath() + '/', relativeReference.getPath())).toString(); - if (getValue() == 0) { - textField.setText(PathManager.relativeToAbsolute(relRef, path)); - } else { - textField.setText(PathManager.absoluteToRelative(relRef, path)); - } - } - - /** Update the state of the slider. */ - private void updateRAState() { - final String path = getText(); - if (PathManager.isRelative(path)) { - setValue(1); - } else { - setValue(0); - } - } - - } // class RASwitch - - } // class TilePanel - - /** - * Action method for tiles attaching automatically. - * @used - */ - public void mapTilesAttach() { - attachTiledMap(); - } - - /** - * Action method for tiles clearing paths. - * @used - */ - public void mapTilesClear() { - clearPathes(); - } - - void attachTiledMap() { - - if (mapControl.getMapFile() == null) { // map is created but was never saved - ACTION_FACTORY.showMessageDialog(this, "mapErrorUnsaved"); - return; - } - final TileMapHeader[] tileHeaders = new TileMapHeader[8]; - - /* first action: we go around all 8 links and try to load the maps */ - for (int i = 0; i < 8; i++) { - - final String path = tilePaths[i].getText(); - if (path == null || path.length() == 0) { - continue; - } - - /* lets test there is a map with this name & path */ - final String mapPath = getCanonicalTilePath(path); - if (mapPath == null) { - ACTION_FACTORY.showMessageDialog(this, "mapErrorPath", path); - return; - } - /* run through all loaded maps and see we have a map with this path - * if unsaved, ask for stop or autosave - */ - final MapControl level = mainControl.getMapIfOpened(mapPath); - if (level != null) { // opened map in the editor ! - if (!ACTION_FACTORY.showQuestionDialog(this, "mapQueryLoaded")) { - return; - } - mainControl.saveMapIfOpened(mapPath); - } - - /* now lets check we have perhaps this map opened in the editor - force a "autosave" or stop */ - - /* at last load the map and its links */ - tileHeaders[i] = openMapFileHeader(path); - if (tileHeaders[i] == null || tileHeaders[i].maparch == null) { - ACTION_FACTORY.showMessageDialog(this, "mapErrorPath2", mapPath); - return; - } - tileHeaders[i].map = level; - } - - /* We have loaded all 8 direct linked maps around our map. - * now, lets check free spaces. We try to "fill" them - * by checking the "side" path links of the loaded ones. - */ - boolean repeatFlag = true; - while (repeatFlag) { - repeatFlag = false; - for (int i = 0; i < 8; i++) { - if (tileHeaders[i] != null) { - for (int ii = 0; ii < 2; ii++) { - - /* - mainControl.showMessage("Trying: ", "Base: " + tile_link_name[i] - + "\nchecking: " + tile_link_name[tile_link[i][ii][0]] - + "\nldir: " + tile_link_name[tile_link[i][ii][1]]); - */ - if (tileHeaders[tileLink[i][ii][0]] == null && tileHeaders[i].maparch.getTilePath(tileLink[i][ii][1]) != null) { - final String link = createTilePath(tileHeaders[i], tileHeaders[i].maparch.getTilePath(tileLink[i][ii][1])); - /* lets test there is a map with this name & path */ - - final String mapPath = getCanonicalTilePath(link); - if (mapPath == null) { - ACTION_FACTORY.showMessageDialog(this, "mapErrorPath", link); - return; - } - /* run through all loaded maps and see we have a map with this path - * if unsaved, ask for stop or autosave - */ - final MapControl level = mainControl.getMapIfOpened(mapPath); - if (level != null) { // opened map in the editor ! - if (!ACTION_FACTORY.showQuestionDialog(this, "mapQueryLoaded", level.getMapFileName())) { - return; - } - mainControl.saveMapIfOpened(mapPath); - } - - tileHeaders[tileLink[i][ii][0]] = openMapFileHeader(link); - /* - mainControl.showMessage("Trying: ", "Base: " + tile_link_name[i] - + "\nchecking: " + tile_link_name[tile_link[i][ii][0]] - + "\ndir: " + tile_link_name[tile_link[i][ii][1]] - + "\nlink: " + link); - */ - if (tileHeaders[tileLink[i][ii][0]] != null) { // if now != null, we have successful loaded the linked map - tileHeaders[tileLink[i][ii][0]].map = level; - repeatFlag = true; - } else { - if (ACTION_FACTORY.showQuestionDialog(this, "mapErrorInvalid", tile_link_name[i], tileHeaders[i].linkPath, tile_link_name[tileLink[i][ii][0]], tile_link_name[tileLink[i][ii][1]], tileHeaders[i].maparch.getTilePath(tileLink[i][ii][1]), link)) - { - return; - } - } - } - } - } - } - } - /* now we have all maps around our starting map loaded. - * As next step we check all links so we are sure all is legal. - * is all ok, we set the new links and save our maps. - * We *also* must check loaded maps and set the links there too! - */ - { - final int width = map.getWidth(); - final int height = map.getHeight(); - for (int i = 0; i < 8; i++) { - final TileMapHeader tileHeader = tileHeaders[i]; - if (tileHeader != null) { - final MapArchObject otherMap = tileHeader.maparch; - final int otherWidth = otherMap.getWidth(); - final int otherHeight = otherMap.getHeight(); - if (width != otherWidth || height != otherHeight) { - ACTION_FACTORY.showMessageDialog(this, "mapErrorDifferentSize", map.getFileName(), width, height, otherMap.getFileName(), otherWidth, otherHeight); - return; - } - for (int ii = 0; ii < 2; ii++) { - // TODO: check links - } - } - } - } - - /* finally... set the links! */ - for (int i = 0; i < 8; i++) { - if (tileHeaders[i] != null) { - /* generate a valid path relativ to both map positions */ - try { - String link = getTilePath(mapControl.getMapFile().getCanonicalPath(), tileHeaders[i].mapfile.getCanonicalPath()); - /* set the link of our source map to the map around */ - tilePaths[i].setText(link); - /* generate again a valid path relativ to both map positions */ - link = getTilePath(tileHeaders[i].mapfile.getCanonicalPath(), mapControl.getMapFile().getCanonicalPath()); - tileHeaders[i].maparch.setTilePath(rev_link[i], link); - if (tileHeaders[i].map != null) { // update links in loadd maps too - tileHeaders[i].map.getMapModel().getMapArch().setTilePath(rev_link[i], link); - } - } catch (final IOException e) { - ACTION_FACTORY.showMessageDialog(this, "mapErrorFatalPath", e.getMessage()); - return; - } - } - } - - /* all done! now we write all back */ - BufferedWriter bufferedWriter = null; - - for (int i = 0; i < 8; i++) { - if (tileHeaders[i] != null) { - try { - bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tileHeaders[i].mapfile), CMainControl.MAP_ENCODING)); - tileHeaders[i].maparch.writeMapArch(bufferedWriter); - final String tail = tileHeaders[i].maptail.toString().trim(); - if (tail.length() > 0) { - bufferedWriter.write(tail); - if (tail.lastIndexOf(0x0a) != tail.length() - 1) { - bufferedWriter.write("\n"); - } - } - bufferedWriter.close(); - } catch (final IOException e) { - ACTION_FACTORY.showMessageDialog(this, "mapErrorFatalWrite", e.getMessage()); - return; - } finally { - try { - bufferedWriter.close(); - } catch (final Exception e) { /* ignore */ } finally { - bufferedWriter = null; - } - } - } - } - } - - @Nullable private String getTilePath(final String base, final String link) { - - int i = base.lastIndexOf("/"); - int ii = base.lastIndexOf(File.separator); - int pos = i; - if (ii > i) { - pos = ii; - } - - i = link.lastIndexOf("/"); - ii = link.lastIndexOf(File.separator); - int pos2 = i; - if (ii > i) { - pos2 = ii; - } - final String first; - final String second; - final String mapdir; - - try { - mapdir = mainControl.getMapDir().getCanonicalPath(); - first = base.substring(mapdir.length(), pos).trim(); - second = link.substring(mapdir.length(), pos2).trim(); - /*mainControl.showMessage("PATH", mapdir.length() + " - " + pos + "\n:: " + first + "\n:: " + second + "\n" + base + "\n" + link);*/ - } catch (final IOException e) { - ACTION_FACTORY.showMessageDialog(this, "mapErrorFatalWrite", e.getMessage()); - return null; - } - - /* funny lame glitch in java... */ - String sep = File.separator; - if (sep.compareTo("\\") == 0) { - sep = "\\\\"; - } - - /* our map is in root - second is higher or same level */ - if (first.length() == 0) { - return link.substring(mapdir.length()).trim().replaceAll(sep, "/"); - } - /* same folder... we return the name without '/' */ - if (first.compareTo(second) == 0) { - return link.substring(pos2 + 1).trim().replaceAll(sep, "/"); - } - /* second is subfolder of first */ - if (second.startsWith(first)) { - return link.substring(pos + 1).trim().replaceAll(sep, "/"); - } - /* in any other case we return a absolute path */ - return link.substring(mapdir.length()).trim().replaceAll(sep, "/"); - } - - private static String createTilePath(final TileMapHeader map, final String linkPath) { - /* our link is a absolut call - not much to do */ - if (linkPath.startsWith(File.pathSeparator) || linkPath.startsWith("/")) { - return linkPath; - } - - /* is a relative call - so we must attach the folder part of map file name to it */ - final StringBuilder path = new StringBuilder(map.linkPath.substring(0, map.linkPath.length() - map.maparch.getFileName().length())); - if (!path.toString().endsWith("/") && !path.toString().endsWith(File.separator)) { - path.append(File.separator); - } - path.append(linkPath); - - /*mainControl.showMessage("Path", "map: " + map.link_path + "\nfilename: " + map.maparch.getFileName() + "\nlink: " + link_path + "\nPATH: " + path);*/ - - return path.toString(); - } - - private String getCanonicalTilePath(final String path) { - final File newfile; - - if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { - newfile = new File(mainControl.getMapDir().getAbsolutePath(), path.substring(1)); - } else { - newfile = new File(mapControl.getMapFile().getParent(), path); - } - - try { - return newfile.getCanonicalFile().toString(); - } catch (final IOException e) { - return newfile.getAbsoluteFile().toString(); - } - } - - private TileMapHeader openMapFileHeader(final String path) { - final File newfile; - - if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { - newfile = new File(mainControl.getMapDir().getAbsolutePath(), path.substring(1)); - } else { - newfile = new File(mapControl.getMapFile().getParent(), path); - } - TileMapHeader maphead; - - try { - try { - maphead = loadMapFileHeader(newfile.getCanonicalFile()); - } catch (final IOException e) { - maphead = null; - /*mainControl.showMessage("Invalid Path", "Failed to load file for tiled map.\n" + newfile.getAbsolutePath());*/ - } - } catch (final GridderException e) { - maphead = null; - /* mainControl.showMessage("Couldn't load Map", e.getMessage());*/ - } - - if (maphead != null) { - maphead.mapfile = newfile; - maphead.linkPath = path; - - for (int x = 0; x < 8; x++) { - if (maphead.maparch.getTilePath(x) != null && maphead.maparch.getTilePath(x).length() == 0) { - maphead.maparch.setTilePath(x, null); - } - } - } - - return maphead; - } - - private static TileMapHeader loadMapFileHeader(final File file) throws GridderException { - - TileMapHeader maphead = null; - - BufferedReader myInput = null; - try { - myInput = new BufferedReader(new InputStreamReader(new FileInputStream(file), CMainControl.MAP_ENCODING)); - - // first of all we read the map arch (if that fails we throw an exception) - final MapArchObject maparch = new MapArchObject(); - if (!maparch.parseMapArch(myInput, file.getName())) { - throw new GridderException("The file '" + file.getName() + "' does not\n" + "contain a valid Daimonin map format!\n"); - } - - maphead = new TileMapHeader(maparch); - // now we store the map arches as tail - for (String thisLine; (thisLine = myInput.readLine()) != null;) { - maphead.maptail.append(thisLine); - if (thisLine.lastIndexOf(0x0a) != thisLine.length() - 1) { - maphead.maptail.append('\n'); - } - } - } catch (final IOException e) { - maphead = null; - /*mainControl.showMessage("Can't find map:", "Link: " + file.getName() + "\n" + e.getMessage());*/ - } finally { - try { - myInput.close(); - } catch (final Exception e) { /* ignore */ } finally { - myInput = null; - } - } - return maphead; - } - - /** Invoke this method if the dialog using this pane is confirmed with OK to write the informations from this pane back to the map. */ - public void modifyMapProperties() { - // update tilepaths - boolean modifyTilepaths = false; // true when map tile-paths were modified - for (int i = 0; i < 8; i++) { - if (map.getTilePath(i) == null && (tilePaths[i].getText() == null || tilePaths[i].getText().length() == 0) || (map.getTilePath(i) != null && !map.getTilePath(i).equals(tilePaths[i].getText()))) - { - modifyTilepaths = true; - } - map.setTilePath(i, tilePaths[i].getText()); - } - // refresh menus if tilepaths have been modified - if (modifyTilepaths) { - mainControl.refreshMenus(); - } - - } - - void clearPathes() { - for (int i = 0; i < 8; i++) { - tilePaths[i].setText(""); - } - mainControl.refreshMenus(); - } - - private static final class TileMapHeader { - - private final MapArchObject maparch; - - private String linkPath; - - private File mapfile; - - private final StringBuffer maptail; - - private MapControl map; // map loaded in editor - - TileMapHeader(final MapArchObject maphead) { - this.maparch = maphead; - this.linkPath = null; - this.mapfile = null; - this.maptail = new StringBuffer(); - map = null; - } - } // class TileMapHeader - -} // class MapTilePane This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-25 12:21:37
|
Revision: 183 Author: christianhujer Date: 2006-06-25 05:21:31 -0700 (Sun, 25 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=183&view=rev Log Message: ----------- Minor documentation improvement. Modified Paths: -------------- trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java Modified: trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java 2006-06-25 12:19:47 UTC (rev 182) +++ trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java 2006-06-25 12:21:31 UTC (rev 183) @@ -7,6 +7,7 @@ import java.awt.Component; import java.awt.FlowLayout; import java.awt.event.ActionEvent; +import java.awt.event.MouseEvent; import static java.awt.event.InputEvent.BUTTON2_DOWN_MASK; import static java.awt.event.InputEvent.BUTTON3_DOWN_MASK; import static java.awt.event.MouseEvent.BUTTON1; @@ -49,7 +50,7 @@ /** * Default mapping of mouse button to Tool. - * @see java.awt.event.MouseEvent#getButton() + * The key is the mouse button ({@link MouseEvent#getButton()}). */ @NotNull private final Map<Integer, MouseOpListener> defaultMouseOpListeners = new HashMap<Integer, MouseOpListener>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-25 12:19:58
|
Revision: 182 Author: christianhujer Date: 2006-06-25 05:19:47 -0700 (Sun, 25 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=182&view=rev Log Message: ----------- Unified MapArchObject. Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/MapArchObject.java trunk/daimonin/src/daieditor/map/MapArchObject.java Modified: trunk/crossfire/src/cfeditor/map/MapArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-06-25 12:18:31 UTC (rev 181) +++ trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-06-25 12:19:47 UTC (rev 182) @@ -94,7 +94,7 @@ * If nonzero, the map reset time will not be updated when someone enters / * exits the map. */ - private boolean fixedResettime; + private boolean fixedReset; /** * Light / darkness of map (overall). Zero means fully bright. @@ -189,14 +189,11 @@ * The map tile paths used for map tiling. * 0 = north, 1 = east, 2 = south, 3 = west. */ - private final String[] tilePath = new String[MAX_TILE]; + private final String[] tilePaths = new String[MAX_TILE]; /** - * Constructor, set default values - * <p/> - * Note from tchize 05 nov 2004, this contructor had no visibility - * specified (protected as is default of java). Any reason why it was like - * that? Made it public so beanshell script can use this object + * Create a new MapArchObject. + * All fields will be set to reasonable default values. */ public MapArchObject() { enterX = 0; @@ -206,12 +203,12 @@ difficulty = 0; darkness = 0; for (int i = 0; i < MAX_TILE; i++) { - tilePath[i] = ""; + tilePaths[i] = ""; } name = DEFAULT_MAP_NAME; // map creation enforces setting a real map name filename = IGUIConstants.DEF_MAPFNAME; // default map file name - fixedResettime = false; + fixedReset = false; unique = false; template = false; outdoor = false; @@ -311,74 +308,74 @@ /** * Set the map filename. - * @param newName new map filename + * @param filename new map filename */ - public void setFileName(final String newName) { - filename = newName; + public void setFileName(final String filename) { + this.filename = filename; } public int getEnterX() { return enterX; } - public void setEnterX(final int x) { - enterX = x; + public void setEnterX(final int enterX) { + this.enterX = enterX; } public int getEnterY() { return enterY; } - public void setEnterY(final int y) { - enterY = y; + public void setEnterY(final int enterY) { + this.enterY = enterY; } public int getResetTimeout() { return resetTimeout; } - public void setResetTimeout(final int n) { - resetTimeout = n; + public void setResetTimeout(final int resetTimeout) { + this.resetTimeout = resetTimeout; } public int getSwapTime() { return swapTime; } - public void setSwapTime(final int n) { - swapTime = n; + public void setSwapTime(final int swapTime) { + this.swapTime = swapTime; } public int getDifficulty() { return difficulty; } - public void setDifficulty(final int n) { - difficulty = n; + public void setDifficulty(final int difficulty) { + this.difficulty = difficulty; } public boolean isFixedReset() { - return fixedResettime; + return fixedReset; } - public void setFixedReset(final boolean b) { - fixedResettime = b; + public void setFixedReset(final boolean fixedReset) { + this.fixedReset = fixedReset; } public int getDarkness() { return darkness; } - public void setDarkness(final int n) { - darkness = n; + public void setDarkness(final int darkness) { + this.darkness = darkness; } public boolean isUnique() { return unique; } - public void setUnique(final boolean b) { - unique = b; + public void setUnique(final boolean unique) { + this.unique = unique; } public boolean isTemplate() { @@ -393,8 +390,8 @@ return outdoor; } - public void setOutdoor(final boolean b) { - outdoor = b; + public void setOutdoor(final boolean outdoor) { + this.outdoor = outdoor; } public boolean isNosmooth() { @@ -406,11 +403,11 @@ } public String getTilePath(final int n) { - return tilePath[n]; + return tilePaths[n]; } - public void setTilePath(final int n, final String s) { - tilePath[n] = s; + public void setTilePath(final int n, final String tilePath) { + tilePaths[n] = tilePath; } public String getMapRegion() { @@ -513,72 +510,72 @@ return noMagic; } - public void setNoMagic(final boolean b) { - noMagic = b; + public void setNoMagic(final boolean noMagic) { + this.noMagic = noMagic; } public boolean isNoPriest() { return noPriest; } - public void setNoPriest(final boolean b) { - noPriest = b; + public void setNoPriest(final boolean noPriest) { + this.noPriest = noPriest; } public boolean isNoSummon() { return noSummon; } - public void setNoSummon(final boolean b) { - noSummon = b; + public void setNoSummon(final boolean noSummon) { + this.noSummon = noSummon; } public boolean isNoHarm() { return noHarm; } - public void setNoHarm(final boolean b) { - noHarm = b; + public void setNoHarm(final boolean noHarm) { + this.noHarm = noHarm; } public boolean isFixedLogin() { return fixedLogin; } - public void setFixedLogin(final boolean b) { - fixedLogin = b; + public void setFixedLogin(final boolean fixedLogin) { + this.fixedLogin = fixedLogin; } public boolean isPermDeath() { return permDeath; } - public void setPermDeath(final boolean b) { - permDeath = b; + public void setPermDeath(final boolean permDeath) { + this.permDeath = permDeath; } public boolean isUltraDeath() { return ultraDeath; } - public void setUltraDeath(final boolean b) { - ultraDeath = b; + public void setUltraDeath(final boolean ultraDeath) { + this.ultraDeath = ultraDeath; } public boolean isUltimateDeath() { return ultimateDeath; } - public void setUltimateDeath(final boolean b) { - ultimateDeath = b; + public void setUltimateDeath(final boolean ultimateDeath) { + this.ultimateDeath = ultimateDeath; } public boolean isPvp() { return pvp; } - public void setPvp(final boolean b) { - pvp = b; + public void setPvp(final boolean pvp) { + this.pvp = pvp; } /** @@ -637,17 +634,14 @@ * otherwise false */ public boolean parseMapArch(final BufferedReader reader, final String fname) { + filename = fname; // store file name String line2; // input line, includes leading and trailing white space - int i; - boolean msgflag = false; // flag for map-message boolean loreflag = false; // flag for lore-text boolean archflag = false; // flag for arch<->end - boolean endReached = false; // true when end of maparch is reached - - filename = fname; // store file name - try { + boolean msgflag = false; // flag for map-message // read lines + boolean endReached = false; while ((!endReached && (line2 = reader.readLine()) != null)) { final String line = line2.trim(); @@ -704,7 +698,7 @@ darkness = getLineValue(line); } else if (line.startsWith("fixed_resettime") || line.startsWith("stand_still")) { if (getLineValue(line) != 0) { - fixedResettime = true; + fixedReset = true; } } else if (line.startsWith("unique")) { if (getLineValue(line) != 0) { @@ -725,11 +719,12 @@ } else if (line.startsWith("tile_path_")) { // get tile path try { - i = Integer.valueOf(line.substring(10, 11)).intValue(); // direction + final int i = Integer.valueOf(line.substring(10, 11)); if (i > 0 && i <= MAX_TILE && line.lastIndexOf(" ") > 0) { - tilePath[i - 1] = line.substring(line.lastIndexOf(" ") + 1); + tilePaths[i - 1] = line.substring(line.lastIndexOf(" ") + 1); } - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { + /* ignore (really?) */ } } else if (line.startsWith("shopitems")) { shopitems = line.substring(line.indexOf(" ") + 1).trim(); @@ -802,12 +797,7 @@ // if we reach eof here, the mapfile is corrupt return false; } - - if (archflag) { - return true; // everything okay - } else { - return false; // no map arch found - } + return archflag; } /** @@ -816,14 +806,14 @@ * @param s the attribute line to be parsed * @return attribute value, zero if value not readable */ - private int getLineValue(final String s) { + private static int getLineValue(final String s) { try { if (s.lastIndexOf(" ") > 0) { - return Integer.valueOf(s.substring(s.lastIndexOf(" ") + 1)).intValue(); + return Integer.valueOf(s.substring(s.lastIndexOf(" ") + 1)); } } catch (final NumberFormatException e) { + /* ignore (really?) */ } - return 0; } @@ -841,136 +831,136 @@ /** * Writing the MapArchObject into the mapfile * @param stream <code>BufferedWriter</code> to the mapfile - * @throws FileNotFoundException the mapfile could not be found + * @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 BufferedWriter stream) throws IOException { int i; - stream.write("arch map\n"); + stream.append("arch map\n"); if (name.length() > 0 && !name.equals(DEFAULT_MAP_NAME)) { - stream.write("name " + name + "\n"); + stream.append("name " + name + "\n"); } if (swapTime > 0) { - stream.write("swap_time " + swapTime + "\n"); + stream.append("swap_time " + swapTime + "\n"); } if (resetTimeout > 0) { - stream.write("reset_timeout " + resetTimeout + "\n"); + stream.append("reset_timeout " + resetTimeout + "\n"); } - if (fixedResettime) { - stream.write("fixed_resettime 1\n"); + if (fixedReset) { + stream.append("fixed_resettime 1\n"); } if (difficulty > 0) { - stream.write("difficulty " + difficulty + "\n"); + stream.append("difficulty " + difficulty + "\n"); } if (region.length() > 0) { - stream.write("region " + region + "\n"); + stream.append("region " + region + "\n"); } if (shopitems.length() > 0) { - stream.write("shopitems " + shopitems + "\n"); + stream.append("shopitems " + shopitems + "\n"); } if (shopgreed != 0) { - stream.write("shopgreed " + shopgreed + "\n"); + stream.append("shopgreed " + shopgreed + "\n"); } if (shopmin != 0) { - stream.write("shopmin " + shopmin + "\n"); + stream.append("shopmin " + shopmin + "\n"); } if (shopmax != 0) { - stream.write("shopmax " + shopmax + "\n"); + stream.append("shopmax " + shopmax + "\n"); } if (shoprace.length() > 0) { - stream.write("shoprace " + shoprace + "\n"); + stream.append("shoprace " + shoprace + "\n"); } if (darkness > 0) { - stream.write("darkness " + darkness + "\n"); + stream.append("darkness " + darkness + "\n"); } if (mapSize.width > 0) { - stream.write("width " + mapSize.width + "\n"); + stream.append("width " + mapSize.width + "\n"); } if (mapSize.height > 0) { - stream.write("height " + mapSize.height + "\n"); + stream.append("height " + mapSize.height + "\n"); } if (enterX > 0) { - stream.write("enter_x " + enterX + "\n"); + stream.append("enter_x " + enterX + "\n"); } if (enterY > 0) { - stream.write("enter_y " + enterY + "\n"); + stream.append("enter_y " + enterY + "\n"); } if (msgText.length() > 0 && msgText.toString().trim().length() > 0) { - stream.write(TAG_START_TEXT + "\n"); - stream.write(msgText.toString().trim() + "\n"); - stream.write(TAG_END_TEXT + "\n"); + stream.append(TAG_START_TEXT + "\n"); + stream.append(msgText.toString().trim() + "\n"); + stream.append(TAG_END_TEXT + "\n"); } if (loreText.length() > 0 && loreText.toString().trim().length() > 0 && !IGUIConstants.isoView) { - stream.write(TAG_START_LORE + "\n"); - stream.write(loreText.toString().trim() + "\n"); - stream.write(TAG_END_LORE + "\n"); + stream.append(TAG_START_LORE + "\n"); + stream.append(loreText.toString().trim() + "\n"); + stream.append(TAG_END_LORE + "\n"); } if (unique) { - stream.write("unique 1\n"); + stream.append("unique 1\n"); } if (template) { - stream.write("template 1\n"); + stream.append("template 1\n"); } if (outdoor) { - stream.write("outdoor 1\n"); + stream.append("outdoor 1\n"); } if (temp != 0) { - stream.write("temp " + temp + "\n"); + stream.append("temp " + temp + "\n"); } if (pressure != 0) { - stream.write("pressure " + pressure + "\n"); + stream.append("pressure " + pressure + "\n"); } if (humid != 0) { - stream.write("humid " + humid + "\n"); + stream.append("humid " + humid + "\n"); } if (windspeed != 0) { - stream.write("windspeed " + windspeed + "\n"); + stream.append("windspeed " + windspeed + "\n"); } if (winddir != 0) { - stream.write("winddir " + winddir + "\n"); + stream.append("winddir " + winddir + "\n"); } if (sky != 0) { - stream.write("sky " + sky + "\n"); + stream.append("sky " + sky + "\n"); } for (i = 0; i < MAX_TILE; i++) { - if (tilePath[i].length() > 0) { - stream.write("tile_path_" + (i + 1) + " " + tilePath[i] + "\n"); + if (tilePaths[i].length() > 0) { + stream.append("tile_path_" + (i + 1) + " " + tilePaths[i] + "\n"); } } if (nosmooth) { - stream.write("nosmooth 1\n"); + stream.append("nosmooth 1\n"); } if (IGUIConstants.isoView) { if (noMagic) { - stream.write("no_magic 1\n"); + stream.append("no_magic 1\n"); } if (noPriest) { - stream.write("no_priest 1\n"); + stream.append("no_priest 1\n"); } if (noSummon) { - stream.write("no_summon 1\n"); + stream.append("no_summon 1\n"); } if (noHarm) { - stream.write("no_harm 1\n"); + stream.append("no_harm 1\n"); } if (fixedLogin) { - stream.write("fixed_login 1\n"); + stream.append("fixed_login 1\n"); } if (permDeath) { - stream.write("perm_death 1\n"); + stream.append("perm_death 1\n"); } if (ultraDeath) { - stream.write("ultra_death 1\n"); + stream.append("ultra_death 1\n"); } if (ultimateDeath) { - stream.write("ultimate_death 1\n"); + stream.append("ultimate_death 1\n"); } if (pvp) { - stream.write("pvp 1\n"); + stream.append("pvp 1\n"); } } - stream.write("end\n"); + stream.append("end\n"); } } // class MapArchObject Modified: trunk/daimonin/src/daieditor/map/MapArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapArchObject.java 2006-06-25 12:18:31 UTC (rev 181) +++ trunk/daimonin/src/daieditor/map/MapArchObject.java 2006-06-25 12:19:47 UTC (rev 182) @@ -149,7 +149,10 @@ /** The tileset y coordinate */ private int tilesetY; - /** Constructor, set default values. */ + /** + * Create a new MapArchObject. + * All fields will be set to reasonable default values. + */ public MapArchObject() { for (int i = 0; i < 8; i++) { tilePaths[i] = ""; @@ -447,9 +450,9 @@ */ public boolean parseMapArch(final BufferedReader reader, final String fname) { filename = fname; // store file name - boolean archflag = false; + boolean archflag = false; // flag for arch<->end try { - boolean msgflag = false; + boolean msgflag = false; // flag for map-message // read lines boolean endReached = false; String line; @@ -511,7 +514,9 @@ if (i > 0 && i < 9 && line.lastIndexOf(" ") > 0) { tilePaths[i - 1] = line.substring(line.lastIndexOf(" ") + 1); } - } catch (final NumberFormatException e) { /* ignore (really?) */ } + } catch (final NumberFormatException e) { + /* ignore (really?) */ + } } else if (line.startsWith("no_save")) { if (getLineValue(line) != 0) { noSave = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-25 12:18:40
|
Revision: 181 Author: christianhujer Date: 2006-06-25 05:18:31 -0700 (Sun, 25 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=181&view=rev Log Message: ----------- Minor improvements: replaced redundant method invocation by variable usage. 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-06-25 12:17:28 UTC (rev 180) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-06-25 12:18:31 UTC (rev 181) @@ -630,7 +630,7 @@ // print the currently selected treasurelist into the attribute dialog final String result = getSelectedTreasureList(); if (result != null) { - input.setText(" " + getSelectedTreasureList()); + input.setText(" " + result); } frame.setVisible(false); } catch (final GridderException ex) { Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-06-25 12:17:28 UTC (rev 180) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-06-25 12:18:31 UTC (rev 181) @@ -620,7 +620,7 @@ // print the currently selected treasurelist into the attribute dialog final String result = getSelectedTreasureList(); if (result != null) { - input.setText(' ' + getSelectedTreasureList()); + input.setText(' ' + result); } frame.setVisible(false); } catch (final GridderException ex) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-25 12:17:46
|
Revision: 180 Author: christianhujer Date: 2006-06-25 05:17:28 -0700 (Sun, 25 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=180&view=rev Log Message: ----------- Minor improvements. Modified Paths: -------------- trunk/crossfire/src/cfeditor/IdGenerator.java Modified: trunk/crossfire/src/cfeditor/IdGenerator.java =================================================================== --- trunk/crossfire/src/cfeditor/IdGenerator.java 2006-06-25 11:21:38 UTC (rev 179) +++ trunk/crossfire/src/cfeditor/IdGenerator.java 2006-06-25 12:17:28 UTC (rev 180) @@ -9,28 +9,28 @@ import java.util.HashSet; import java.util.Random; +import java.util.Set; /** + * Generator for ids. * @author tchize - * <p/> - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments */ public final class IdGenerator { - private final HashSet unsecureUid; + private final Set<String> unsecureUid; private final Random unSecureRandom; - private static final IdGenerator theGen = new IdGenerator(); + private static final IdGenerator INSTANCE = new IdGenerator(); - protected IdGenerator() { - unsecureUid = new HashSet(); + IdGenerator() { + unsecureUid = new HashSet<String>(); + //noinspection UnsecureRandomNumberGeneration unSecureRandom = new Random(); } public static IdGenerator getInstance() { - return theGen; + return INSTANCE; } public String getUnsecureId() { @@ -44,4 +44,4 @@ return id; } -} +} // class IdGenerator This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-25 11:21:43
|
Revision: 179 Author: akirschbaum Date: 2006-06-25 04:21:38 -0700 (Sun, 25 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=179&view=rev Log Message: ----------- Fix typo in variable name; it sometimes did not delete all object from a resized map. Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-06-25 11:05:32 UTC (rev 178) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-06-25 11:21:38 UTC (rev 179) @@ -1064,7 +1064,7 @@ // (and yes, there is an area getting sweeped twice - and yes it could // be optimized you smartass - but I don't care!) for (int y = newSize.height; y < mapSize.height; y++) { - for (int x = 0; x < mapSize.height; x++) { + for (int x = 0; x < mapSize.width; x++) { // for every map square: delete all arches on it final Iterator it = getArchObjectsDeleteMapArch(x, y, false, false); while (it.hasNext()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-25 11:05:37
|
Revision: 178 Author: akirschbaum Date: 2006-06-25 04:05:32 -0700 (Sun, 25 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=178&view=rev Log Message: ----------- Fix typo in variable name; it sometimes did prevent the confirm dialog for map-resizing from appearing. Modified Paths: -------------- trunk/daimonin/src/daieditor/map/DefaultMapModel.java Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-06-24 20:16:40 UTC (rev 177) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-06-25 11:05:32 UTC (rev 178) @@ -489,7 +489,7 @@ } } - if (mapSize.width > newSize.height) { + if (mapSize.height > newSize.height) { // search the bottom stripe (as far as being cut off) for (int y = newSize.height; y < mapSize.height; y++) { for (int x = 0; x < mapSize.width; x++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-24 20:16:51
|
Revision: 177 Author: akirschbaum Date: 2006-06-24 13:16:40 -0700 (Sat, 24 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=177&view=rev Log Message: ----------- Convert if statements into guards. Modified Paths: -------------- trunk/daimonin/src/daieditor/map/DefaultMapModel.java Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-06-24 20:12:13 UTC (rev 176) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-06-24 20:16:40 UTC (rev 177) @@ -179,30 +179,34 @@ /** Reset the level changed flag to false. */ public void resetLevelChangedFlag() { - if (levelChanged) { - // change status and update title bar - levelChanged = false; - if (mapControl.getMapViewFrame() != null) { - mapControl.getMapViewFrame().changedFlagNotify(); - } + if (!levelChanged) { + return; } + + // change status and update title bar + levelChanged = false; + if (mapControl.getMapViewFrame() != null) { + mapControl.getMapViewFrame().changedFlagNotify(); + } } /** Set the level changed flag to true. */ public void setLevelChangedFlag() { - if (!levelChanged) { - // change status and update title bar - levelChanged = true; - if (mapControl != null && mapControl.getMapViewFrame() != null) { - // pickmaps obviously somehow call this at startup, but have mapControl or mapViewFrame null. - mapControl.getMapViewFrame().changedFlagNotify(); - } + if (levelChanged) { + return; + } - // enable menu file->revert to revert the map - if (mainControl.getCurrentMap() == mapControl) { - mainControl.getMainView().setRevertMenuEnabled(true); - } + // change status and update title bar + levelChanged = true; + if (mapControl != null && mapControl.getMapViewFrame() != null) { + // pickmaps obviously somehow call this at startup, but have mapControl or mapViewFrame null. + mapControl.getMapViewFrame().changedFlagNotify(); } + + // enable menu file->revert to revert the map + if (mainControl.getCurrentMap() == mapControl) { + mainControl.getMainView().setRevertMenuEnabled(true); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-24 20:12:24
|
Revision: 176 Author: akirschbaum Date: 2006-06-24 13:12:13 -0700 (Sat, 24 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=176&view=rev Log Message: ----------- Unify code. 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-06-24 12:20:17 UTC (rev 175) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-06-24 20:12:13 UTC (rev 176) @@ -51,7 +51,7 @@ private static final Logger log = Logger.getLogger(DefaultMapModel.class); /** The MapArchObject; it contains global map attributes. */ - private MapArchObject mapArch = null; + private final MapArchObject mapArch; /** * Level grid data. Contains all arches grid-wise. Its size is @@ -73,19 +73,18 @@ /** * Constructs a level model. - * @param mainControl main controller - * @param control the controller of this view - * @param map the map header + * @param mainControl main controller + * @param control the controller of this view + * @param mapArch the map header (<code>MapArchObject</code>) */ - public DefaultMapModel(final CMainControl mainControl, final MapControl control, final MapArchObject map) { + public DefaultMapModel(final CMainControl mainControl, final MapControl control, final MapArchObject mapArch) { + this.mapArch = mapArch; this.mainControl = mainControl; mapControl = control; - mapSize.setSize(map.getMapSize()); + mapSize.setSize(mapArch.getMapSize()); mapGrid = initMap(); - mapArch = map; - mapArch.setMapSize(mapSize); } Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-06-24 12:20:17 UTC (rev 175) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-06-24 20:12:13 UTC (rev 176) @@ -76,21 +76,22 @@ */ private MapSquare[][] mapGrid; + /** Size of this map. */ private final Dimension mapSize = new Dimension(); /** Flag that indicates if the level has been changed since last save. */ - private boolean levelChanged; + private boolean levelChanged = false; /** CMainControl. */ - private CMainControl mainControl; + private final CMainControl mainControl; /** MapControl. */ - private MapControl mapControl; + private final MapControl mapControl; /** * Constructs a level model. - * @param mainControl main controler - * @param control the controler of this view + * @param mainControl main controller + * @param control the controller of this view * @param objects the <code>ArchObject</code> list of this map or <code>null</code> for an empty map * @param mapArch the map header (<code>MapArchObject</code>) */ @@ -99,7 +100,6 @@ this.mainControl = mainControl; mapControl = control; mapSize.setSize(mapArch.getWidth(), mapArch.getHeight()); - levelChanged = false; mapGrid = new MapSquare[mapSize.width][mapSize.height]; clearMap(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-06-24 12:20:53
|
Revision: 175 Author: derdanny Date: 2006-06-24 05:20:17 -0700 (Sat, 24 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=175&view=rev Log Message: ----------- Deleted uses code. Modified Paths: -------------- trunk/daimonin/src/daieditor/CArchPanel.java trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java trunk/daimonin/src/daieditor/gui/map/event/MouseOpListener.java trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java Modified: trunk/daimonin/src/daieditor/CArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanel.java 2006-06-22 20:13:30 UTC (rev 174) +++ trunk/daimonin/src/daieditor/CArchPanel.java 2006-06-24 12:20:17 UTC (rev 175) @@ -30,7 +30,6 @@ import daieditor.gui.map.tools.SelectionTool; import daieditor.gui.map.tools.ToolSelector; import java.awt.BorderLayout; -import static java.awt.event.MouseEvent.BUTTON1; import static java.awt.event.MouseEvent.BUTTON2; import static java.awt.event.MouseEvent.BUTTON3; import java.util.ArrayList; @@ -108,7 +107,6 @@ // TODO: introduce a tool registry toolSelector.add(SelectionTool.instance); - toolSelector.setDefault(BUTTON1, SelectionTool.instance); toolSelector.add(InsertionTool.instance); toolSelector.setDefault(BUTTON3, InsertionTool.instance); toolSelector.add(DeletionTool.instance); Modified: trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java 2006-06-22 20:13:30 UTC (rev 174) +++ trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java 2006-06-24 12:20:17 UTC (rev 175) @@ -1,23 +1,11 @@ package daieditor.gui.map.event; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import net.sf.japi.util.Pair; - /** * Event Listener Adapater for {@link MouseOpListener}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ @SuppressWarnings({"NoopMethodInAbstractClass"}) public abstract class MouseOpAdapter implements MouseOpListener { - /** - * Maps event ids to lists of (onMask, offMask) pairs. - * A pair inside this map means that this MouseOpAdapter is listening to events with this type - * with modifiers set to <code>onMask</code> but not set to <code>offMask</code> - */ - private final Map<Integer, List<Pair<Integer, Integer>>> useMap = new HashMap<Integer, List<Pair<Integer, Integer>>>(); /** {@inheritDoc} */ public void clicked(final MouseOpEvent e) { @@ -42,40 +30,4 @@ /** {@inheritDoc} */ public void released(final MouseOpEvent e) { } - - /** {@inheritDoc} */ - public boolean isUsing(final int type, final int modifiers) { - final List<Pair<Integer, Integer>> pairList = useMap.get(type); - if (pairList == null) { - return false; - } - for (final Pair<Integer, Integer> pair : pairList) { - if ((modifiers & (pair.getFirst() | pair.getSecond())) == pair.getFirst()) { - return true; - } - } - return false; - } - - /** - * Stores which type of events are processed. - * @param type id of event - * @param onMask Mask of pressed keys and buttons - * @param offMask Mask of keys and buttons that are not pressed - * @see java.awt.AWTEvent#getID() - * @see daieditor.gui.map.event.MouseOpEvent#getModifiers() - */ - protected void uses(final int type, final int onMask, final int offMask) { - final List<Pair<Integer, Integer>> pairList = useMap.get(type); - final List<Pair<Integer, Integer>> list; - if (pairList == null) { - list = new ArrayList<Pair<Integer, Integer>>(); - useMap.put(type, list); - } else { - list = pairList; - } - final Pair<Integer, Integer> pair = new Pair<Integer, Integer>(onMask, offMask); - list.add(pair); - } - } // class MouseOpAdapter Modified: trunk/daimonin/src/daieditor/gui/map/event/MouseOpListener.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/event/MouseOpListener.java 2006-06-22 20:13:30 UTC (rev 174) +++ trunk/daimonin/src/daieditor/gui/map/event/MouseOpListener.java 2006-06-24 12:20:17 UTC (rev 175) @@ -27,14 +27,4 @@ * Mouse was released. */ void released(MouseOpEvent e); - - /** - * Tests if the implementation of this Listener uses this type of event with these modifiers. - * @param type id of the event - * @param modifiers modifiers of the event - * @return <code>true</code> if this event is used - * @see java.awt.AWTEvent#getID() - * @see daieditor.gui.map.event.MouseOpEvent#getModifiers() - */ - boolean isUsing(int type, int modifiers); } // interface MouseOpListener Modified: trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java 2006-06-22 20:13:30 UTC (rev 174) +++ trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java 2006-06-24 12:20:17 UTC (rev 175) @@ -7,9 +7,6 @@ import daieditor.map.MapSquare; import java.awt.Component; import java.awt.Point; -import java.awt.event.InputEvent; -import static java.awt.event.MouseEvent.MOUSE_DRAGGED; -import static java.awt.event.MouseEvent.MOUSE_PRESSED; import javax.swing.JPanel; import net.sf.gridarta.gui.map.MapCursor; import net.sf.japi.swing.ActionFactory; @@ -34,8 +31,6 @@ /** Create a DeletionTool. */ public DeletionTool() { super("deletion"); - uses(MOUSE_PRESSED, InputEvent.BUTTON2_DOWN_MASK, 0); - uses(MOUSE_DRAGGED, InputEvent.BUTTON2_DOWN_MASK, 0); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java 2006-06-22 20:13:30 UTC (rev 174) +++ trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java 2006-06-24 12:20:17 UTC (rev 175) @@ -5,9 +5,6 @@ import daieditor.map.MapControl; import java.awt.Component; import java.awt.Point; -import java.awt.event.InputEvent; -import static java.awt.event.MouseEvent.MOUSE_DRAGGED; -import static java.awt.event.MouseEvent.MOUSE_PRESSED; import javax.swing.JPanel; import net.sf.gridarta.gui.map.MapCursor; import net.sf.japi.swing.ActionFactory; @@ -37,8 +34,6 @@ */ public InsertionTool() { super("insertion"); - uses(MOUSE_PRESSED, InputEvent.BUTTON3_DOWN_MASK, 0); - uses(MOUSE_DRAGGED, InputEvent.BUTTON3_DOWN_MASK, 0); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java 2006-06-22 20:13:30 UTC (rev 174) +++ trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java 2006-06-24 12:20:17 UTC (rev 175) @@ -5,7 +5,6 @@ import daieditor.map.MapControl; import java.awt.Point; import java.awt.event.InputEvent; -import java.awt.event.MouseEvent; import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapGrid; @@ -19,9 +18,6 @@ */ public SelectionTool() { super("selection"); - uses(MouseEvent.MOUSE_PRESSED, InputEvent.BUTTON1_DOWN_MASK, 0); - uses(MouseEvent.MOUSE_DRAGGED, InputEvent.BUTTON1_DOWN_MASK, 0); - uses(MouseEvent.MOUSE_RELEASED, 0, 0); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java 2006-06-22 20:13:30 UTC (rev 174) +++ trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java 2006-06-24 12:20:17 UTC (rev 175) @@ -7,7 +7,6 @@ import java.awt.Component; import java.awt.FlowLayout; import java.awt.event.ActionEvent; -import static java.awt.event.InputEvent.BUTTON1_DOWN_MASK; import static java.awt.event.InputEvent.BUTTON2_DOWN_MASK; import static java.awt.event.InputEvent.BUTTON3_DOWN_MASK; import static java.awt.event.MouseEvent.BUTTON1; @@ -140,30 +139,27 @@ /** * Returns <code>MouseOpListener</code> depending on the <code>event</code> * and the default settings. - * @param event This event's id, button and modifiers are needed - * @return A <code>MouseOpListener</code> that matches the event. + * @param event This event's button and modifiers are needed + * @return Default <code>MouseOpListener</code> or <code>null</code> if mouse button is not bound to a tool. */ @Nullable public MouseOpListener getMouseOpListener(final MouseOpEvent event) { - final int modifiers = event.getModifiers(); - if (selectedTool instanceof MouseOpListener) { - final MouseOpListener mouseOpListener = (MouseOpListener) selectedTool; - if (mouseOpListener.isUsing(event.getId(), modifiers)) { + final int button = event.getButton(); + if (button != BUTTON1) { + @Nullable final MouseOpListener mouseOpListener = defaultMouseOpListeners.get(button); + if (mouseOpListener != null) { return mouseOpListener; } } - @Nullable final MouseOpListener mouseOpListener = defaultMouseOpListeners.get(event.getButton()); - if (mouseOpListener != null) { - return mouseOpListener; - } - if ((modifiers & BUTTON1_DOWN_MASK) != 0) { - return defaultMouseOpListeners.get(BUTTON1); - } + final int modifiers = event.getModifiers(); if ((modifiers & BUTTON2_DOWN_MASK) != 0) { return defaultMouseOpListeners.get(BUTTON2); } if ((modifiers & BUTTON3_DOWN_MASK) != 0) { return defaultMouseOpListeners.get(BUTTON3); } + if (selectedTool instanceof MouseOpListener) { + return (MouseOpListener) selectedTool; + } return null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-22 20:13:41
|
Revision: 174 Author: akirschbaum Date: 2006-06-22 13:13:30 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=174&view=rev Log Message: ----------- Unify variable names and white space. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/daimonin/src/daieditor/CAttribDialog.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-22 19:52:42 UTC (rev 173) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-22 20:13:30 UTC (rev 174) @@ -146,7 +146,7 @@ private JTabbedPane tabbedPane; /** Central pane, this is the parent component of above tabbed pane. */ - private final JScrollPane paneCenter; + private final JScrollPane centerPane; /** Text pane where the summary is displayed. */ private final JTextPane summaryTP; @@ -159,8 +159,7 @@ * @param defaobj the default ArchObject of 'arch' * @param mainControl main control */ - CAttribDialog(final CFArchTypeList atList, final ArchObject aobj, final ArchObject defaobj, - final CMainControl mainControl) { + CAttribDialog(final CFArchTypeList atList, final ArchObject aobj, final ArchObject defaobj, final CMainControl mainControl) { super(mainControl.getMainView(), "CF Attribute Dialog", false); // when close-box is selected, execute the 'closeDialog' method and nothing else @@ -251,35 +250,32 @@ //type = typelist.getType(typeNr); // first split top-left and -right - final JScrollPane paneLeft = buildHeader(); - final JScrollPane paneRight = buildInv(); + final JScrollPane leftPane = buildHeader(); + final JScrollPane rightPane = buildInv(); //Create a split pane with the two scroll panes in it. - final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, - paneLeft, paneRight); + final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPane, rightPane); splitPane.setOneTouchExpandable(false); splitPane.setDividerLocation(width - inventoryWidth - 2 * dividerSize); splitPane.setDividerSize(dividerSize + 1); //Provide minimum sizes for the two components in the split pane - paneLeft.setMinimumSize(new Dimension(width - inventoryWidth - 2 * dividerSize, 120)); - paneRight.setMinimumSize(new Dimension(inventoryWidth, 120)); + leftPane.setMinimumSize(new Dimension(width - inventoryWidth - 2 * dividerSize, 120)); + rightPane.setMinimumSize(new Dimension(inventoryWidth, 120)); // Now split horizontally - //JScrollPane paneCenter = buildAttr(); - paneCenter = buildAttr(); + //JScrollPane centerPane = buildAttr(); + centerPane = buildAttr(); //Create a split pane with the two scroll panes in it. - final JSplitPane splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, - splitPane, paneCenter); + final JSplitPane splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, splitPane, centerPane); splitPane2.setOneTouchExpandable(false); splitPane2.setDividerLocation(126); splitPane2.setDividerSize(dividerSize); // split horizontally again final JScrollPane paneButtons = buildButtons(); - final JSplitPane splitPane3 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, - splitPane2, paneButtons); + final JSplitPane splitPane3 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, splitPane2, paneButtons); splitPane3.setOneTouchExpandable(false); //splitPane3.setDividerLocation(height-buttonBarHeight-34); splitPane3.setDividerLocation((int) (this.getHeight() - paneButtons.getMinimumSize().height - dividerSize)); @@ -388,8 +384,7 @@ // do we have "none" spell? int active; - if (spnum == 0 && (arch.getAttributeString(attr.getNameOld(), defarch).length() == 0 - || attr.getDataType() == CFArchAttrib.T_ZSPELL)) { + if (spnum == 0 && (arch.getAttributeString(attr.getNameOld(), defarch).length() == 0 || attr.getDataType() == CFArchAttrib.T_ZSPELL)) { active = 0; } else { // now look up the spell-number in the array of spells @@ -671,8 +666,7 @@ scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); //Create a split pane with the two scroll panes in it. - final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, - scrollPane, newAttr.helpButton); + final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scrollPane, newAttr.helpButton); splitPane.setDividerSize(0); splitPane.setResizeWeight(1); splitPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); @@ -691,19 +685,16 @@ final JCheckBox input; if (dType == CFArchAttrib.T_BOOL) { // normal bool - input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), - (arch.getAttributeValue(type.getAttr()[i].getNameOld(), defarch) == 1)); + input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (arch.getAttributeValue(type.getAttr()[i].getNameOld(), defarch) == 1)); } else { // parse values for customized bool final String trueVal = type.getAttr()[i].getMisc()[0]; if (trueVal.equals("0")) { final String attrString = arch.getAttributeString(type.getAttr()[i].getNameOld(), defarch); - input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), - (attrString.length() == 0 || attrString.equals("0"))); + input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (attrString.length() == 0 || attrString.equals("0"))); } else { - input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (arch.getAttributeString( - type.getAttr()[i].getNameOld(), defarch).equals(trueVal))); + input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (arch.getAttributeString(type.getAttr()[i].getNameOld(), defarch).equals(trueVal))); } } @@ -843,8 +834,7 @@ } else if (dType == CFArchAttrib.T_LIST) { if (type.getAttr()[i].getMisc() != null && typelist.getListTable().containsKey((String) (type.getAttr()[i].getMisc()[0]))) { // build the list from vector data - input = buildArrayBox(type.getAttr()[i], (Vector) (typelist.getListTable().get( - (String) (type.getAttr()[i].getMisc()[0])))); + input = buildArrayBox(type.getAttr()[i], (Vector) (typelist.getListTable().get((String) (type.getAttr()[i].getMisc()[0])))); } else { // error: list data is missing or corrupt panel3.add(new JLabel("Error: Undefined List")); @@ -939,8 +929,7 @@ if (newAttr != null) { if (newAttr.helpButton != null) { // help button: popup Info Window when clicked - newAttr.helpButton.addActionListener( - new HelpAL(newAttr.ref)); + newAttr.helpButton.addActionListener(new HelpAL(newAttr.ref)); } // now attach the new attribute into the list @@ -1172,18 +1161,18 @@ } summaryTP.setCaretPosition(0); // this prevents the document from scrolling down - paneCenter.setViewportView(summaryTP); - paneCenter.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + centerPane.setViewportView(summaryTP); + centerPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); summaryButton.setText("Input"); - paneCenter.validate(); + centerPane.validate(); update(getGraphics()); displaySummary = true; } else { // summary is displayed, switch to interface - paneCenter.setViewportView(tabbedPane); - paneCenter.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); + centerPane.setViewportView(tabbedPane); + centerPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); summaryButton.setText("Summary"); - paneCenter.validate(); + centerPane.validate(); update(getGraphics()); displaySummary = false; } @@ -1224,8 +1213,7 @@ valString = attr.ref.getMisc()[1]; // false string } // now see if we need to write it into the archtext or not - if ((valString.equals("0") && !(defarch.getAttributeString(attr.ref.getNameOld(), null).length() == 0)) - || (!valString.equals("0") && !defarch.getAttributeString(attr.ref.getNameOld(), null).equals(valString))) { + if ((valString.equals("0") && !(defarch.getAttributeString(attr.ref.getNameOld(), null).length() == 0)) || (!valString.equals("0") && !defarch.getAttributeString(attr.ref.getNameOld(), null).equals(valString))) { newArchText = newArchText + attr.ref.getNameOld() + " " + valString + "\n"; } } else if (dType == CFArchAttrib.T_INT || @@ -1400,8 +1388,7 @@ if (newFace != null) { boolean faceChanged = false; // check if face changed - if ((arch.getFaceName() != null && arch.getFaceName().length() > 0 && !newFace.equals(arch.getFaceName())) - || (newFace.length() > 0 && (arch.getFaceName() == null || arch.getFaceName().length() == 0))) { + if ((arch.getFaceName() != null && arch.getFaceName().length() > 0 && !newFace.equals(arch.getFaceName())) || (newFace.length() > 0 && (arch.getFaceName() == null || arch.getFaceName().length() == 0))) { faceChanged = true; } Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-06-22 19:52:42 UTC (rev 173) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-06-22 20:13:30 UTC (rev 174) @@ -174,7 +174,7 @@ private JTabbedPane tabbedPane; /** Central pane, this is the parent component of above tabbed pane. */ - private final JPanel paneCenter; + private final JPanel centerPane; /** Text pane where the summary is displayed. */ private final JTextPane summaryTP; @@ -286,17 +286,17 @@ final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPane, rightPane); // Now split horizontally - //JScrollPane paneCenter = buildAttr(); - paneCenter = new JPanel(cardLayout); - paneCenter.add("edit", buildAttr()); + //JScrollPane centerPane = buildAttr(); + centerPane = new JPanel(cardLayout); + centerPane.add("edit", buildAttr()); summaryTP = new JTextPane(); summaryTP.setEditable(false); summaryTP.setBorder(BorderFactory.createEmptyBorder(3, 15, 0, 0)); - paneCenter.add("summary", new JScrollPane(summaryTP)); - final Dimension size = paneCenter.getPreferredSize(); + centerPane.add("summary", new JScrollPane(summaryTP)); + final Dimension size = centerPane.getPreferredSize(); size.height = 256; - paneCenter.setMinimumSize(size); - paneCenter.setPreferredSize(size); + centerPane.setMinimumSize(size); + centerPane.setPreferredSize(size); final JPanel contentPanel = new JPanel(new GridBagLayout()); final GridBagConstraints gbc = new GridBagConstraints(); @@ -306,7 +306,7 @@ gbc.weighty = 0.0; contentPanel.add(splitPane, gbc); gbc.weighty = 1.0; - contentPanel.add(paneCenter, gbc); + contentPanel.add(centerPane, gbc); setOptions(buildOptions()); @@ -1015,7 +1015,7 @@ summaryTP.setCaretPosition(0); // this prevents the document from scrolling down summaryEditButton.setAction(editAction); - cardLayout.show(paneCenter, "summary"); + cardLayout.show(centerPane, "summary"); } /** @@ -1025,7 +1025,7 @@ */ public void attribEdit() { summaryEditButton.setAction(summaryAction); - cardLayout.show(paneCenter, "edit"); + cardLayout.show(centerPane, "edit"); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-22 19:52:58
|
Revision: 173 Author: akirschbaum Date: 2006-06-22 12:52:42 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=173&view=rev Log Message: ----------- Prevent crash when collecting archetypes or treasurelists from unreadable or non-existent directories. Now such directories are silently ignored. Modified Paths: -------------- trunk/crossfire/CHANGES.txt trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/daimonin/src/daieditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/arch/ArchObjectStack.java Modified: trunk/crossfire/CHANGES.txt =================================================================== --- trunk/crossfire/CHANGES.txt 2006-06-22 18:15:11 UTC (rev 172) +++ trunk/crossfire/CHANGES.txt 2006-06-22 19:52:42 UTC (rev 173) @@ -997,3 +997,10 @@ Reduce total memory consumption. Andreas Kirschbaum + +--- 22/06/2006 --- + +Prevent crash when collecting archetypes from unreadable or non-existent +directories. Now such directories are silently ignored. + +Andreas Kirschbaum Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-22 18:15:11 UTC (rev 172) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-22 19:52:42 UTC (rev 173) @@ -330,9 +330,11 @@ folderLevel++; final String[] children = f.list(); - Arrays.sort(children); - for (int i = 0; i < children.length; i++) { - loadArchFromFiles(new File(f, children[i]), index); + if (children != null) { + Arrays.sort(children); + for (int i = 0; i < children.length; i++) { + loadArchFromFiles(new File(f, children[i]), index); + } } folderLevel--; } Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-06-22 18:15:11 UTC (rev 172) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-06-22 19:52:42 UTC (rev 173) @@ -312,9 +312,11 @@ || name.toLowerCase().endsWith(".tl"); } }); - Arrays.sort(traverse); - for (final String entry : traverse) { - loadTreasureList(fname + File.separator + entry, tmpList, needLink); + if (traverse != null) { + Arrays.sort(traverse); + for (final String entry : traverse) { + loadTreasureList(fname + File.separator + entry, tmpList, needLink); + } } // This was a directory -> nothing to parse return; Modified: trunk/daimonin/src/daieditor/arch/ArchObjectStack.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-06-22 18:15:11 UTC (rev 172) +++ trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-06-22 19:52:42 UTC (rev 173) @@ -254,9 +254,11 @@ || name.toLowerCase().endsWith(".art"); } }); - Arrays.sort(traverse); - for (final String entry : traverse) { - loadArchesFromArtifacts(fname + File.separator + entry); + if (traverse != null) { + Arrays.sort(traverse); + for (final String entry : traverse) { + loadArchesFromArtifacts(fname + File.separator + entry); + } } // This was a directory -> nothing to parse return; @@ -391,7 +393,9 @@ // now, setup the arch panels if (CMainControl.arcFileFilter.accept(f)) { final String[] entries = f.list(); - Arrays.sort(entries); + if (entries != null) { + Arrays.sort(entries); + } if (!name.equalsIgnoreCase("intern") && !noPanel) { if (folderLevel > 0 && folderLevel < 2) { // add first folders as panels mainControl.addArchPanel(name); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-22 18:15:26
|
Revision: 172 Author: akirschbaum Date: 2006-06-22 11:15:11 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=172&view=rev Log Message: ----------- Unify variable names. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapArchObject.java trunk/crossfire/src/cfeditor/map/MapModel.java trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.java Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-06-22 17:55:24 UTC (rev 171) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-06-22 18:15:11 UTC (rev 172) @@ -376,13 +376,13 @@ * @param x starting x-coord for floodfill * @param y starting y-coord for floodfill * @param arch ArchObject to fill with - * @param is_defarch true when 'arch' is a default arch + * @param isDefarch true when 'arch' is a default arch */ - private static void floodfill(final MapControl mapControl, final int x, final int y, final ArchObject arch, final boolean is_defarch) { + private static void floodfill(final MapControl mapControl, final int x, final int y, final ArchObject arch, final boolean isDefarch) { final Point p = new Point(x, y); // insert new arch to x, y - //m_ctrl.addArchToMap(mainControl.getPanelArch(), p, 0, MapModel.JOIN_DISABLE); - if (is_defarch) { + //mapControl.addArchToMap(mainControl.getPanelArch(), p, 0, MapModel.JOIN_DISABLE); + if (isDefarch) { mapControl.addArchToMap(arch.getNodeNr(), p, 0, MapModel.JOIN_DISABLE); } else { // insert arch-clone from pickmap @@ -391,16 +391,16 @@ // now go recursive into all four directions if (mapControl.pointValid(x - 1, y) && !mapControl.containsArchObject(x - 1, y)) { - floodfill(mapControl, x - 1, y, arch, is_defarch); + floodfill(mapControl, x - 1, y, arch, isDefarch); } if (mapControl.pointValid(x, y - 1) && !mapControl.containsArchObject(x, y - 1)) { - floodfill(mapControl, x, y - 1, arch, is_defarch); + floodfill(mapControl, x, y - 1, arch, isDefarch); } if (mapControl.pointValid(x + 1, y) && !mapControl.containsArchObject(x + 1, y)) { - floodfill(mapControl, x + 1, y, arch, is_defarch); + floodfill(mapControl, x + 1, y, arch, isDefarch); } if (mapControl.pointValid(x, y + 1) && !mapControl.containsArchObject(x, y + 1)) { - floodfill(mapControl, x, y + 1, arch, is_defarch); + floodfill(mapControl, x, y + 1, arch, isDefarch); } } Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-06-22 17:55:24 UTC (rev 171) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-06-22 18:15:11 UTC (rev 172) @@ -717,9 +717,9 @@ pathFrame = new JDialog(CMainControl.getInstance().getMainView(), "Edit Parameters", true); pathFrame.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); - final JPanel main_panel = new JPanel(); - main_panel.setLayout(new BoxLayout(main_panel, BoxLayout.Y_AXIS)); - main_panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 2, 5)); + final JPanel mainPanel = new JPanel(); + mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); + mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 2, 5)); // input line: script path final JPanel line1 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); @@ -727,7 +727,7 @@ line1.add(text1); inputFPath = new JTextField(filePath, 20); line1.add(inputFPath); - main_panel.add(line1); + mainPanel.add(line1); // input line: plugin name final JPanel line2 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); @@ -735,7 +735,7 @@ line2.add(text2); inputPlName = new JTextField(pluginName, 20); line2.add(inputPlName); - main_panel.add(line2); + mainPanel.add(line2); // input line: event options final JPanel line3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); @@ -743,8 +743,8 @@ line3.add(text3); inputEEOptions = new JTextField(eventOptions, 20); line3.add(inputEEOptions); - main_panel.add(line3); - main_panel.add(Box.createVerticalStrut(5)); + mainPanel.add(line3); + mainPanel.add(Box.createVerticalStrut(5)); // button panel: final JPanel line4 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); @@ -759,9 +759,9 @@ ccListener.setTargetEvent(this); cancelButton.addActionListener(ccListener); line4.add(cancelButton); - main_panel.add(line4); + mainPanel.add(line4); - pathFrame.getContentPane().add(main_panel); + pathFrame.getContentPane().add(mainPanel); pathFrame.pack(); pathFrame.setLocationRelativeTo(CMainControl.getInstance().getMainView()); pathFrame.setVisible(true); Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-06-22 17:55:24 UTC (rev 171) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-06-22 18:15:11 UTC (rev 172) @@ -51,19 +51,19 @@ private static final Logger log = Logger.getLogger(DefaultMapModel.class); /** The MapArchObject; it contains global map attributes. */ - private MapArchObject m_mapArch = null; + private MapArchObject mapArch = null; /** * Level grid data. Contains all arches grid-wise. Its size is - * m_mapGrid[m_mapWidth][m_mapHeight]. Can never be null. + * mapGrid[m_mapWidth][m_mapHeight]. Can never be null. */ - private ArchObject[][] m_mapGrid; + private ArchObject[][] mapGrid; /** Size of this map. */ private final Dimension mapSize = new Dimension(); /** Flag that indicates if the level has been changed since last save. */ - private boolean m_fLevelChanged = false; + private boolean levelChanged = false; /** CMainControl. */ private final CMainControl mainControl; @@ -82,11 +82,11 @@ mapControl = control; mapSize.setSize(map.getMapSize()); - m_mapGrid = initMap(); + mapGrid = initMap(); - m_mapArch = map; + mapArch = map; - m_mapArch.setMapSize(mapSize); + mapArch.setMapSize(mapSize); } /** @@ -101,7 +101,7 @@ return null; } - return m_mapGrid[pos.x][pos.y]; + return mapGrid[pos.x][pos.y]; } /** @@ -109,8 +109,8 @@ * @param str the new description text */ public void setNewMapText(final String str) { - m_mapArch.resetText(); - m_mapArch.addText(str); + mapArch.resetText(); + mapArch.addText(str); } /** @@ -118,7 +118,7 @@ * @return the map description text */ public String getMapText() { - return m_mapArch.getText(); + return mapArch.getText(); } /** @@ -146,12 +146,12 @@ /** Reset the level changed flag to false. */ public void resetLevelChangedFlag() { - if (!m_fLevelChanged) { + if (!levelChanged) { return; } // change status and update title bar - m_fLevelChanged = false; + levelChanged = false; if (mapControl.getMapView() != null) { mapControl.getMapView().changedFlagNotify(); } @@ -159,12 +159,12 @@ /** Set the level changed flag to true. */ public void setLevelChangedFlag() { - if (m_fLevelChanged) { + if (levelChanged) { return; } // change status and update title bar - m_fLevelChanged = true; + levelChanged = true; if (mapControl.getMapView() != null) { mapControl.getMapView().changedFlagNotify(); } @@ -180,7 +180,7 @@ * @return true=level has changed */ public boolean isLevelChanged() { - return m_fLevelChanged; + return levelChanged; } /** @@ -223,7 +223,7 @@ return null; } - return m_mapGrid[pos.x][pos.y]; + return mapGrid[pos.x][pos.y]; } @Deprecated public ArchObject getTopArchObject(final int x, final int y) { @@ -255,7 +255,7 @@ throw new IllegalArgumentException(); } - m_mapGrid[pos.x][pos.y] = arch; + mapGrid[pos.x][pos.y] = arch; } /** @@ -298,7 +298,7 @@ /** Check whether a given location contains at least one ArchObject. */ public boolean containsArchObject(final Point pos) { - return pointValid(pos) && m_mapGrid[pos.x][pos.y] != null; + return pointValid(pos) && mapGrid[pos.x][pos.y] != null; } /** @@ -386,7 +386,7 @@ if (arch.getPrevArch() != null) { arch.getPrevArch().setNextArch(arch); } else { - m_mapGrid[arch.getMapX()][arch.getMapY()] = arch; + mapGrid[arch.getMapX()][arch.getMapY()] = arch; } arch.propagateElevation(prev); @@ -426,7 +426,7 @@ if (arch.getPrevArch() != null) { arch.getPrevArch().setNextArch(arch); } else { - m_mapGrid[arch.getMapX()][arch.getMapY()] = arch; + mapGrid[arch.getMapX()][arch.getMapY()] = arch; } arch.propagateElevation(prev); @@ -436,8 +436,8 @@ } } - @Deprecated public boolean addArchToMap(final int archnr, final int xx, final int yy, final int intern, final boolean join, final boolean insert_below) { - return addArchToMap(archnr, new Point(xx, yy), intern, join, insert_below); + @Deprecated public boolean addArchToMap(final int archnr, final int xx, final int yy, final int intern, final boolean join, final boolean insertBelow) { + return addArchToMap(archnr, new Point(xx, yy), intern, join, insertBelow); } /** @@ -449,11 +449,11 @@ * inserted per square * @param join if set to JOIN_ENABLE auto-joining is supported; autojoining * is only done if enabled in the main control - * @param insert_below true: new arch is inserted on top, false: new arch is + * @param insertBelow true: new arch is inserted on top, false: new arch is * inserted below * @return true if insertion successful, false if not */ - public boolean addArchToMap(int archnr, final Point pos, final int intern, final boolean join, final boolean insert_below) { + public boolean addArchToMap(int archnr, final Point pos, final int intern, final boolean join, final boolean insertBelow) { ArchObject newarch, oldarch, startarch; // our new suckers (copys, not ref ptrs) if (archnr < 0 || archnr >= mainControl.getArchObjectStack().getArchCount() @@ -493,13 +493,13 @@ oldarch = newarch; // insert ít in map or add to arch in map - ArchObject node = m_mapGrid[mapx][mapy]; + ArchObject node = mapGrid[mapx][mapy]; if (node == null) { - m_mapGrid[mapx][mapy] = newarch; - m_mapGrid[mapx][mapy].setMapX(mapx); - m_mapGrid[mapx][mapy].setMapY(mapy); + mapGrid[mapx][mapy] = newarch; + mapGrid[mapx][mapy].setMapX(mapx); + mapGrid[mapx][mapy].setMapY(mapy); } else { - if (!insert_below) { + if (!insertBelow) { // if we want to insert on top, we need to get last node element for (int i = 0; node.getNextArch() != null; i++) { node = node.getNextArch(); @@ -513,7 +513,7 @@ //ArchObject tmp = node; node.setPrevArch(newarch); newarch.setNextArch(node); - m_mapGrid[mapx][mapy] = newarch; + mapGrid[mapx][mapy] = newarch; newarch.setMapX(mapx); newarch.setMapY(mapy); newarch.propagateElevation(node); @@ -581,7 +581,7 @@ } // jump to the end of the list (-> grab "topmost" arch) - for (node = m_mapGrid[pos.x][pos.y]; + for (node = mapGrid[pos.x][pos.y]; node != null && node.getNextArch() != null; node = node.getNextArch()) { ; @@ -626,10 +626,10 @@ * that the given 'arch' is a new and unlinked object. * @param arch the new arch to be linked onto the map. (Dest. * coordinates must be set (arch.mapx/y)!) - * @param insert_below true: new arch is inserted on top, false: new arch + * @param insertBelow true: new arch is inserted on top, false: new arch * is inserted below */ - public void addArchObjectToMap(final ArchObject arch, final boolean insert_below) { + public void addArchObjectToMap(final ArchObject arch, final boolean insertBelow) { ArchObject oldarch, startarch; // our new suckers (copys, not ref ptrs) // Make sure this arch has the proper edit_type @@ -652,13 +652,13 @@ oldarch = arch; // insert ít in map or add to arch in map - ArchObject node = m_mapGrid[mapx][mapy]; + ArchObject node = mapGrid[mapx][mapy]; if (node == null) { - m_mapGrid[mapx][mapy] = arch; - m_mapGrid[mapx][mapy].setMapX(mapx); - m_mapGrid[mapx][mapy].setMapY(mapy); + mapGrid[mapx][mapy] = arch; + mapGrid[mapx][mapy].setMapX(mapx); + mapGrid[mapx][mapy].setMapY(mapy); } else { - if (!insert_below) { + if (!insertBelow) { // if we want to insert on top, we need to get last node element for (int i = 0; node.getNextArch() != null; i++) { node = node.getNextArch(); @@ -672,7 +672,7 @@ // insert below, so just put it on first place node.setPrevArch(arch); arch.setNextArch(node); - m_mapGrid[mapx][mapy] = arch; + mapGrid[mapx][mapy] = arch; arch.setMapX(mapx); arch.setMapY(mapy); arch.propagateElevation(node); @@ -703,7 +703,7 @@ @Nullable public ArchObject getMapArch(final int id, final Point pos) { ArchObject node; - if (m_mapGrid == null || pos.x < 0 || pos.x >= mapSize.width || pos.y < 0 || pos.y >= mapSize.height) { + if (mapGrid == null || pos.x < 0 || pos.x >= mapSize.width || pos.y < 0 || pos.y >= mapSize.height) { return null; } @@ -751,8 +751,8 @@ return null; } - @Deprecated public void deleteMapArch(final int id, final int xx, final int yy, final boolean refresh_map, final boolean join) { - deleteMapArch(id, new Point(xx, yy), refresh_map, join); + @Deprecated public void deleteMapArch(final int id, final int xx, final int yy, final boolean refreshMap, final boolean join) { + deleteMapArch(id, new Point(xx, yy), refreshMap, join); } /** @@ -761,11 +761,11 @@ * inventory.) * @param id ID of the arch to be removed (->arch.getMyID()) * @param pos location of the arch to be removed - * @param refresh_map If true, mapview is redrawn after deletion. Keep in + * @param refreshMap If true, mapview is redrawn after deletion. Keep in * mind: drawing consumes time! * @param join if set to JOIN_ENABLE auto-joining is supported */ - public void deleteMapArch(final int id, final Point pos, final boolean refresh_map, final boolean join) { + public void deleteMapArch(final int id, final Point pos, final boolean refreshMap, final boolean join) { // first, try to find the tile we had selected final Iterator it = getArchObjectsDeleteArchMapObject(pos); while (it.hasNext()) { @@ -794,7 +794,7 @@ } setLevelChangedFlag(); // the map has been modified - if (refresh_map) { + if (refreshMap) { mainControl.refreshCurrentMap(); // redraw } } @@ -847,7 +847,7 @@ if (prev == null) { // if some up (or null), put this on start - m_mapGrid[mapx][mapy] = next; + mapGrid[mapx][mapy] = next; if (next != null) { // if there one up, mark them as starter next.setPrevArch(null); } @@ -885,8 +885,8 @@ public void freeMapArchObject() { for (int x = 0; x < mapSize.width; x++) { for (int y = 0; y < mapSize.height; y++) { - while (m_mapGrid[x][y] != null) { - deleteArchMapObject(m_mapGrid[x][y]); + while (mapGrid[x][y] != null) { + deleteArchMapObject(mapGrid[x][y]); } } } @@ -897,7 +897,7 @@ * @param strFileName the new map filename */ public void setFileName(final String strFileName) { - m_mapArch.setFileName(strFileName); + mapArch.setFileName(strFileName); } /** @@ -905,7 +905,7 @@ * @return the map filename */ public String getFileName() { - return m_mapArch.getFileName(); + return mapArch.getFileName(); } /** @@ -913,7 +913,7 @@ * @param name the new map name */ public void setMapName(final String name) { - m_mapArch.setMapName(name); + mapArch.setMapName(name); } /** @@ -921,12 +921,12 @@ * @return the map name */ public String getMapName() { - return m_mapArch.getMapName(); + return mapArch.getMapName(); } /** ??? */ public String getMapNameWithoutMusic() { - return m_mapArch.getMapNameWithoutMusic(); + return mapArch.getMapNameWithoutMusic(); } /** @@ -934,7 +934,7 @@ * @return the map object */ public MapArchObject getMapArchObject() { - return m_mapArch; + return mapArch; } @Deprecated public boolean pointValid(final int posx, final int posy) { @@ -1001,7 +1001,7 @@ // search the right stripe (as far as being cut off) for (int x = newSize.width; x < mapSize.width; x++) { for (int y = 0; y < mapSize.height; y++) { - if (m_mapGrid[x][y] != null) { + if (mapGrid[x][y] != null) { return true; } } @@ -1012,7 +1012,7 @@ // search the bottom stripe (as far as being cut off) for (int y = newSize.height; y < mapSize.height; y++) { for (int x = 0; x < mapSize.width; x++) { - if (m_mapGrid[x][y] != null) { + if (mapGrid[x][y] != null) { return true; } } @@ -1089,16 +1089,16 @@ // relink all arches to the new grid for (int x = 0; x < Math.min(newSize.width, mapSize.width); x++) { for (int y = 0; y < Math.min(newSize.height, mapSize.height); y++) { - newGrid[x][y] = m_mapGrid[x][y]; + newGrid[x][y] = mapGrid[x][y]; } } // replace old grid by new one - m_mapGrid = newGrid; + mapGrid = newGrid; // adjust the map and model attributes mapSize.setSize(newSize.width, newSize.height); - m_mapArch.setMapSize(newSize); + mapArch.setMapSize(newSize); // an important last point: if there is a highlighted area in a region // that got cut off - unhilight it! @@ -1180,7 +1180,7 @@ m_levelGrid[x][y] |= data&m_dataMask; // Level data has changed - m_fLevelChanged = true; + levelChanged = true; mapControl.repaint(); } Modified: trunk/crossfire/src/cfeditor/map/MapArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-06-22 17:55:24 UTC (rev 171) +++ trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-06-22 18:15:11 UTC (rev 172) @@ -74,16 +74,16 @@ private Dimension mapSize = new Dimension(); /** Default enter coordinates (usage not recommended). */ - private int enter_x, enter_y; + private int enterX, enterY; /** Number of seconds that need to elapse before this map will be reset. */ - private int reset_timeout; + private int resetTimeout; /** * Number of ticks that must elapse after tha map has not been used before * it gets swapped out. */ - private int swap_time; + private int swapTime; /** * Map difficulty. If zero, server calculates something. @@ -94,7 +94,7 @@ * If nonzero, the map reset time will not be updated when someone enters / * exits the map. */ - private boolean fixed_resettime; + private boolean fixedResettime; /** * Light / darkness of map (overall). Zero means fully bright. @@ -147,28 +147,28 @@ private int shopmax; /** No magic spells. */ - private boolean no_magic; + private boolean noMagic; /** No prayers. */ - private boolean no_priest; + private boolean noPriest; /** No harmful spells allowed. */ - private boolean no_harm; + private boolean noHarm; /** No summoning allowed. */ - private boolean no_summon; + private boolean noSummon; /** Check map reset status after re-login. */ - private boolean fixed_login; + private boolean fixedLogin; /** Permanent death with revivable corpses. */ - private boolean perm_death; + private boolean permDeath; /** Permament death with corpses temporarily available. */ - private boolean ultra_death; + private boolean ultraDeath; /** Permanent death with instant character deletion. */ - private boolean ultimate_death; + private boolean ultimateDeath; /** Player vs Player combat allowed. */ private boolean pvp; @@ -189,7 +189,7 @@ * The map tile paths used for map tiling. * 0 = north, 1 = east, 2 = south, 3 = west. */ - private final String[] tile_path = new String[MAX_TILE]; + private final String[] tilePath = new String[MAX_TILE]; /** * Constructor, set default values @@ -199,32 +199,32 @@ * that? Made it public so beanshell script can use this object */ public MapArchObject() { - enter_x = 0; - enter_y = 0; - reset_timeout = 0; - swap_time = 0; + enterX = 0; + enterY = 0; + resetTimeout = 0; + swapTime = 0; difficulty = 0; darkness = 0; for (int i = 0; i < MAX_TILE; i++) { - tile_path[i] = ""; + tilePath[i] = ""; } name = DEFAULT_MAP_NAME; // map creation enforces setting a real map name filename = IGUIConstants.DEF_MAPFNAME; // default map file name - fixed_resettime = false; + fixedResettime = false; unique = false; template = false; outdoor = false; nosmooth = false; // iso flags - no_magic = false; - no_priest = false; - no_summon = false; - fixed_login = false; - perm_death = false; - ultra_death = false; - ultimate_death = false; + noMagic = false; + noPriest = false; + noSummon = false; + fixedLogin = false; + permDeath = false; + ultraDeath = false; + ultimateDeath = false; pvp = false; } @@ -295,10 +295,10 @@ /** * Set the map name. - * @param new_name new map name + * @param newName new map name */ - public void setMapName(final String new_name) { - name = new_name; + public void setMapName(final String newName) { + name = newName; } /** @@ -311,42 +311,42 @@ /** * Set the map filename. - * @param new_name new map filename + * @param newName new map filename */ - public void setFileName(final String new_name) { - filename = new_name; + public void setFileName(final String newName) { + filename = newName; } public int getEnterX() { - return enter_x; + return enterX; } public void setEnterX(final int x) { - enter_x = x; + enterX = x; } public int getEnterY() { - return enter_y; + return enterY; } public void setEnterY(final int y) { - enter_y = y; + enterY = y; } public int getResetTimeout() { - return reset_timeout; + return resetTimeout; } public void setResetTimeout(final int n) { - reset_timeout = n; + resetTimeout = n; } public int getSwapTime() { - return swap_time; + return swapTime; } public void setSwapTime(final int n) { - swap_time = n; + swapTime = n; } public int getDifficulty() { @@ -358,11 +358,11 @@ } public boolean isFixedReset() { - return fixed_resettime; + return fixedResettime; } public void setFixedReset(final boolean b) { - fixed_resettime = b; + fixedResettime = b; } public int getDarkness() { @@ -406,35 +406,35 @@ } public String getTilePath(final int n) { - return tile_path[n]; + return tilePath[n]; } public void setTilePath(final int n, final String s) { - tile_path[n] = s; + tilePath[n] = s; } public String getMapRegion() { return region; } - public void setMapRegion(final String new_region) { - region = new_region; + public void setMapRegion(final String newRegion) { + region = newRegion; } public String getShopItems() { return shopitems; } - public void setShopItems(final String new_shopitems) { - shopitems = new_shopitems; + public void setShopItems(final String newShopitems) { + shopitems = newShopitems; } public String getShopRace() { return shoprace; } - public void setShopRace(final String new_shoprace) { - shoprace = new_shoprace; + public void setShopRace(final String newShoprace) { + shoprace = newShoprace; } public int getShopMin() { @@ -510,67 +510,67 @@ } public boolean isNoMagic() { - return no_magic; + return noMagic; } public void setNoMagic(final boolean b) { - no_magic = b; + noMagic = b; } public boolean isNoPriest() { - return no_priest; + return noPriest; } public void setNoPriest(final boolean b) { - no_priest = b; + noPriest = b; } public boolean isNoSummon() { - return no_summon; + return noSummon; } public void setNoSummon(final boolean b) { - no_summon = b; + noSummon = b; } public boolean isNoHarm() { - return no_harm; + return noHarm; } public void setNoHarm(final boolean b) { - no_harm = b; + noHarm = b; } public boolean isFixedLogin() { - return fixed_login; + return fixedLogin; } public void setFixedLogin(final boolean b) { - fixed_login = b; + fixedLogin = b; } public boolean isPermDeath() { - return perm_death; + return permDeath; } public void setPermDeath(final boolean b) { - perm_death = b; + permDeath = b; } public boolean isUltraDeath() { - return ultra_death; + return ultraDeath; } public void setUltraDeath(final boolean b) { - ultra_death = b; + ultraDeath = b; } public boolean isUltimateDeath() { - return ultimate_death; + return ultimateDeath; } public void setUltimateDeath(final boolean b) { - ultimate_death = b; + ultimateDeath = b; } public boolean isPvp() { @@ -623,7 +623,7 @@ } /** @return true if the mapsize is zero */ - public boolean size_null() { + public boolean sizeNull() { return mapSize.width <= 0 && mapSize.height <= 0; } @@ -642,13 +642,13 @@ boolean msgflag = false; // flag for map-message boolean loreflag = false; // flag for lore-text boolean archflag = false; // flag for arch<->end - boolean end_reached = false; // true when end of maparch is reached + boolean endReached = false; // true when end of maparch is reached filename = fname; // store file name try { // read lines - while ((!end_reached && (line2 = reader.readLine()) != null)) { + while ((!endReached && (line2 = reader.readLine()) != null)) { final String line = line2.trim(); if (archflag) { @@ -681,7 +681,7 @@ if (line.equalsIgnoreCase(TAG_START_LORE)) { loreflag = true; } else if (line.equalsIgnoreCase("end")) { - end_reached = true; + endReached = true; } else if (line.startsWith("name")) { name = line.substring(line.indexOf(" ") + 1).trim(); } else if (line.startsWith("region")) { @@ -691,20 +691,20 @@ } else if (line.startsWith("height") || line.startsWith("y ")) { mapSize.height = getLineValue(line); } else if (line.startsWith("enter_x") || line.startsWith("hp")) { - enter_x = getLineValue(line); + enterX = getLineValue(line); } else if (line.startsWith("enter_y") || line.startsWith("sp")) { - enter_y = getLineValue(line); + enterY = getLineValue(line); } else if (line.startsWith("reset_timeout") || line.startsWith("weight")) { - reset_timeout = getLineValue(line); + resetTimeout = getLineValue(line); } else if (line.startsWith("swap_time") || line.startsWith("value")) { - swap_time = getLineValue(line); + swapTime = getLineValue(line); } else if (line.startsWith("difficulty") || line.startsWith("level")) { difficulty = getLineValue(line); } else if (line.startsWith("darkness") || line.startsWith("invisible")) { darkness = getLineValue(line); } else if (line.startsWith("fixed_resettime") || line.startsWith("stand_still")) { if (getLineValue(line) != 0) { - fixed_resettime = true; + fixedResettime = true; } } else if (line.startsWith("unique")) { if (getLineValue(line) != 0) { @@ -727,7 +727,7 @@ try { i = Integer.valueOf(line.substring(10, 11)).intValue(); // direction if (i > 0 && i <= MAX_TILE && line.lastIndexOf(" ") > 0) { - tile_path[i - 1] = line.substring(line.lastIndexOf(" ") + 1); + tilePath[i - 1] = line.substring(line.lastIndexOf(" ") + 1); } } catch (NumberFormatException e) { } @@ -755,35 +755,35 @@ sky = getLineValue(line); } else if (IGUIConstants.isoView && line.startsWith("no_magic")) { if (getLineValue(line) != 0) { - no_magic = true; + noMagic = true; } } else if (IGUIConstants.isoView && line.startsWith("no_priest")) { if (getLineValue(line) != 0) { - no_priest = true; + noPriest = true; } } else if (IGUIConstants.isoView && line.startsWith("no_summon")) { if (getLineValue(line) != 0) { - no_summon = true; + noSummon = true; } } else if (IGUIConstants.isoView && line.startsWith("no_harm")) { if (getLineValue(line) != 0) { - no_harm = true; + noHarm = true; } } else if (IGUIConstants.isoView && line.startsWith("fixed_login")) { if (getLineValue(line) != 0) { - fixed_login = true; + fixedLogin = true; } } else if (IGUIConstants.isoView && line.startsWith("perm_death")) { if (getLineValue(line) != 0) { - perm_death = true; + permDeath = true; } } else if (IGUIConstants.isoView && line.startsWith("ultra_death")) { if (getLineValue(line) != 0) { - ultra_death = true; + ultraDeath = true; } } else if (IGUIConstants.isoView && line.startsWith("ultimate_death")) { if (getLineValue(line) != 0) { - ultimate_death = true; + ultimateDeath = true; } } else if (IGUIConstants.isoView && line.startsWith("pvp")) { if (getLineValue(line) != 0) { @@ -851,13 +851,13 @@ if (name.length() > 0 && !name.equals(DEFAULT_MAP_NAME)) { stream.write("name " + name + "\n"); } - if (swap_time > 0) { - stream.write("swap_time " + swap_time + "\n"); + if (swapTime > 0) { + stream.write("swap_time " + swapTime + "\n"); } - if (reset_timeout > 0) { - stream.write("reset_timeout " + reset_timeout + "\n"); + if (resetTimeout > 0) { + stream.write("reset_timeout " + resetTimeout + "\n"); } - if (fixed_resettime) { + if (fixedResettime) { stream.write("fixed_resettime 1\n"); } if (difficulty > 0) { @@ -890,11 +890,11 @@ if (mapSize.height > 0) { stream.write("height " + mapSize.height + "\n"); } - if (enter_x > 0) { - stream.write("enter_x " + enter_x + "\n"); + if (enterX > 0) { + stream.write("enter_x " + enterX + "\n"); } - if (enter_y > 0) { - stream.write("enter_y " + enter_y + "\n"); + if (enterY > 0) { + stream.write("enter_y " + enterY + "\n"); } if (msgText.length() > 0 && msgText.toString().trim().length() > 0) { stream.write(TAG_START_TEXT + "\n"); @@ -934,36 +934,36 @@ stream.write("sky " + sky + "\n"); } for (i = 0; i < MAX_TILE; i++) { - if (tile_path[i].length() > 0) { - stream.write("tile_path_" + (i + 1) + " " + tile_path[i] + "\n"); + if (tilePath[i].length() > 0) { + stream.write("tile_path_" + (i + 1) + " " + tilePath[i] + "\n"); } } if (nosmooth) { stream.write("nosmooth 1\n"); } if (IGUIConstants.isoView) { - if (no_magic) { + if (noMagic) { stream.write("no_magic 1\n"); } - if (no_priest) { + if (noPriest) { stream.write("no_priest 1\n"); } - if (no_summon) { + if (noSummon) { stream.write("no_summon 1\n"); } - if (no_harm) { + if (noHarm) { stream.write("no_harm 1\n"); } - if (fixed_login) { + if (fixedLogin) { stream.write("fixed_login 1\n"); } - if (perm_death) { + if (permDeath) { stream.write("perm_death 1\n"); } - if (ultra_death) { + if (ultraDeath) { stream.write("ultra_death 1\n"); } - if (ultimate_death) { + if (ultimateDeath) { stream.write("ultimate_death 1\n"); } if (pvp) { Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-06-22 17:55:24 UTC (rev 171) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-06-22 18:15:11 UTC (rev 172) @@ -48,16 +48,16 @@ Dimension getMapSize(); - @Deprecated boolean addArchToMap(int archnr, int xx, int yy, int intern, boolean join, boolean insert_below); - boolean addArchToMap(int archnr, Point pos, int intern, boolean join, boolean insert_below); + @Deprecated boolean addArchToMap(int archnr, int xx, int yy, int intern, boolean join, boolean insertBelow); + boolean addArchToMap(int archnr, Point pos, int intern, boolean join, boolean insertBelow); @Deprecated boolean insertArchToMap(ArchObject newarch, int archnr, ArchObject next, int mapx, int mapy, boolean join); boolean insertArchToMap(ArchObject newarch, int archnr, ArchObject next, Point pos, boolean join); void addArchObjectToMap(ArchObject arch, boolean insertBelow); - @Deprecated void deleteMapArch(int id, int xx, int yy, boolean refresh_map, boolean join); - void deleteMapArch(int id, Point pos, boolean refresh_map, boolean join); + @Deprecated void deleteMapArch(int id, int xx, int yy, boolean refreshMap, boolean join); + void deleteMapArch(int id, Point pos, boolean refreshMap, boolean join); @Deprecated @Nullable ArchObject getMapArch(int id, int xx, int yy); @Nullable ArchObject getMapArch(int id, Point pos); Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.java 2006-06-22 17:55:24 UTC (rev 171) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.java 2006-06-22 18:15:11 UTC (rev 172) @@ -277,9 +277,9 @@ /** * Redraws the whole menu with latest custom fonts. - * @param do_redraw if true, menu is redrawn at the end + * @param doRedraw if true, menu is redrawn at the end */ - public void updateFont(final boolean do_redraw) { + public void updateFont(final boolean doRedraw) { if (!control.isStandAlone()) { // File menu: control.getMainControl().setBoldFont(menuFile); @@ -303,7 +303,7 @@ control.getMainControl().setBoldFont(miColors); } - if (do_redraw) { + if (doRedraw) { // redraw the menu bar refresh(); if (getGraphics() != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-22 17:55:44
|
Revision: 171 Author: akirschbaum Date: 2006-06-22 10:55:24 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=171&view=rev Log Message: ----------- Unify comments and whitespace. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditView.java trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java 2006-06-22 17:43:41 UTC (rev 170) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java 2006-06-22 17:55:24 UTC (rev 171) @@ -207,7 +207,7 @@ return menu; } - // ------------------------ SUBCLASSES ----------------------- + // ------------------------ NESTED / INNER CLASSES ----------------------- /** * Subclass MenuActionListener handles the actionevents for the menu items. Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java 2006-06-22 17:43:41 UTC (rev 170) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java 2006-06-22 17:55:24 UTC (rev 171) @@ -300,7 +300,7 @@ // -------------------------------------- /** - * Subclass: Listener for ChangeEvents in the tabPane. + * Inner class: Listener for ChangeEvents in the tabPane. */ private final class EditTabListener implements ChangeListener { @@ -324,7 +324,7 @@ } // class EditTabListener /** - * Subclass: Listener for closebox on the window. + * Inner class: Listener for closebox on the window. */ private static final class EditWindowListener implements WindowListener { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java 2006-06-22 17:43:41 UTC (rev 170) +++ trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java 2006-06-22 17:55:24 UTC (rev 171) @@ -311,6 +311,7 @@ } } + // private members private DefaultInputHandler(final DefaultInputHandler copy) { currentBindings = copy.bindings; bindings = currentBindings; Modified: trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java 2006-06-22 17:43:41 UTC (rev 170) +++ trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java 2006-06-22 17:55:24 UTC (rev 171) @@ -186,7 +186,7 @@ /** * Returns a named text area action. - * @param name the action + * @param name the action name */ public static ActionListener getAction(final String name) { return (ActionListener) actions.get(name); Modified: trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditView.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditView.java 2006-06-22 17:43:41 UTC (rev 170) +++ trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditView.java 2006-06-22 17:55:24 UTC (rev 171) @@ -277,7 +277,7 @@ // -------------------------------------- /** - * Inner bclass: Listener for ChangeEvents in the tabPane. + * Inner class: Listener for ChangeEvents in the tabPane. */ private final class EditTabListener implements ChangeListener { @@ -301,7 +301,7 @@ } // class EditTabListener /** - * Inner bclass: Listener for closebox on the window. + * Inner class: Listener for closebox on the window. */ private static final class EditWindowListener extends WindowAdapter { Modified: trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java 2006-06-22 17:43:41 UTC (rev 170) +++ trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java 2006-06-22 17:55:24 UTC (rev 171) @@ -183,7 +183,7 @@ /** * Returns a named text area action. - * @param name The action name + * @param name the action name */ public static ActionListener getAction(final String name) { return actions.get(name); Modified: trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java 2006-06-22 17:43:41 UTC (rev 170) +++ trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java 2006-06-22 17:55:24 UTC (rev 171) @@ -396,6 +396,7 @@ */ public final boolean setOrigin(final int firstLine, final int horizontalOffset) { boolean changed = false; + if (horizontalOffset != this.horizontalOffset) { this.horizontalOffset = horizontalOffset; changed = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-22 17:43:52
|
Revision: 170 Author: akirschbaum Date: 2006-06-22 10:43:41 -0700 (Thu, 22 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=170&view=rev Log Message: ----------- Remove superfluous super() call. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java 2006-06-21 22:13:09 UTC (rev 169) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java 2006-06-22 17:43:41 UTC (rev 170) @@ -74,7 +74,6 @@ * Constructor - builds the CFPython popup menu. */ public CFPythonPopup() { - super(); setBackground(Color.white); // white background control = ScriptEditControl.getInstance(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-06-21 22:13:23
|
Revision: 169 Author: derdanny Date: 2006-06-21 15:13:09 -0700 (Wed, 21 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=169&view=rev Log Message: ----------- Refactored getMouseOpListener in ToolSelector. Modified Paths: -------------- trunk/daimonin/src/daieditor/CArchPanel.java trunk/daimonin/src/daieditor/gui/map/MapUserListener.java trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java trunk/daimonin/src/daieditor/gui/map/event/MouseOpEvent.java trunk/daimonin/src/daieditor/gui/map/event/MouseOpListener.java trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java Modified: trunk/daimonin/src/daieditor/CArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanel.java 2006-06-19 21:17:38 UTC (rev 168) +++ trunk/daimonin/src/daieditor/CArchPanel.java 2006-06-21 22:13:09 UTC (rev 169) @@ -25,11 +25,14 @@ package daieditor; import daieditor.arch.ArchObject; -import daieditor.gui.map.tools.ToolSelector; -import daieditor.gui.map.tools.SelectionTool; import daieditor.gui.map.tools.DeletionTool; import daieditor.gui.map.tools.InsertionTool; +import daieditor.gui.map.tools.SelectionTool; +import daieditor.gui.map.tools.ToolSelector; import java.awt.BorderLayout; +import static java.awt.event.MouseEvent.BUTTON1; +import static java.awt.event.MouseEvent.BUTTON2; +import static java.awt.event.MouseEvent.BUTTON3; import java.util.ArrayList; import java.util.List; import javax.swing.BorderFactory; @@ -54,6 +57,8 @@ /** Controller of this subview. */ private final transient CMainControl mainControl; + /** ToolSelector of this subview. */ + private final ToolSelector toolSelector = new ToolSelector(); /** * Name of the selected arch. @@ -101,11 +106,13 @@ // calculate default value in case there is no settings file - final ToolSelector toolSelector = new ToolSelector(); // TODO: introduce a tool registry toolSelector.add(SelectionTool.instance); + toolSelector.setDefault(BUTTON1, SelectionTool.instance); toolSelector.add(InsertionTool.instance); + toolSelector.setDefault(BUTTON3, InsertionTool.instance); toolSelector.add(DeletionTool.instance); + toolSelector.setDefault(BUTTON2, DeletionTool.instance); add(toolSelector, BorderLayout.NORTH); add(archAndPickPane, BorderLayout.CENTER); add(archQuickPanel, BorderLayout.SOUTH); @@ -199,6 +206,11 @@ this.selectedArch = selectedArch; } + /** Getter of <code>toolSelector</code>. */ + public ToolSelector getToolSelector() { + return toolSelector; + } + public static final class PanelNode { private final CArchPanelPan data; Modified: trunk/daimonin/src/daieditor/gui/map/MapUserListener.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapUserListener.java 2006-06-19 21:17:38 UTC (rev 168) +++ trunk/daimonin/src/daieditor/gui/map/MapUserListener.java 2006-06-21 22:13:09 UTC (rev 169) @@ -25,39 +25,19 @@ import daieditor.CMapViewBasic; import daieditor.gui.map.event.MouseOpEvent; import daieditor.gui.map.event.MouseOpListener; -import daieditor.gui.map.tools.SelectionTool; -import daieditor.gui.map.tools.VoidTool; -import daieditor.gui.map.tools.InsertionTool; -import daieditor.gui.map.tools.DeletionTool; +import daieditor.gui.map.tools.ToolSelector; import daieditor.map.MapControl; import java.awt.Point; -import static java.awt.event.InputEvent.BUTTON1_MASK; -import static java.awt.event.InputEvent.BUTTON2_MASK; -import static java.awt.event.InputEvent.BUTTON3_MASK; -import static java.awt.event.InputEvent.SHIFT_MASK; import java.awt.event.MouseEvent; -import static java.awt.event.MouseEvent.BUTTON1; -import static java.awt.event.MouseEvent.BUTTON2; -import static java.awt.event.MouseEvent.BUTTON3; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import net.sf.gridarta.gui.map.MapCursor; import org.jetbrains.annotations.Nullable; public final class MapUserListener implements MouseListener, MouseMotionListener { + /** ToolSelector of ArchPanel. */ + private final ToolSelector toolSelector; - /** Mouse Operation bound to the left mouse button. */ - private MouseOpListener lmbOp = SelectionTool.instance; - - /** Mouse Operation bound to the middle mouse button. */ - private MouseOpListener mmbOp = DeletionTool.instance; - - /** Mouse Operation bound to the right mouse button. */ - private MouseOpListener rmbOp = InsertionTool.instance; - - /** Mouse Operation stub doing nothing. */ - private MouseOpListener stub = VoidTool.instance; - private MapCursor mapCursor; private DefaultLevelRenderer renderer; @@ -72,21 +52,28 @@ public MapUserListener(final CMainControl mainControl, final MapControl mapControl, final CMapViewBasic mapView) { this.mainControl = mainControl; this.mapControl = mapControl; + toolSelector = mainControl.getMainView().archPanel.getToolSelector(); mapCursor = mapView.getMapCursor(); renderer = mapView.getRenderer(); } /** {@inheritDoc} */ public void mouseClicked(final MouseEvent event) { - getMouseOperation(event).clicked(mouseOpEvent); + final MouseOpListener mouseOpListener = getMouseOperation(event); + if (mouseOpListener != null) { + mouseOpListener.clicked(mouseOpEvent); + } } private void initEvent(final MouseEvent event) { + mouseOpEvent.setButton(event.getButton()); + mouseOpEvent.setId(event.getID()); mouseOpEvent.setMapLocation(getMapLocation(event)); mouseOpEvent.setMapCursor(mapCursor); - mouseOpEvent.setModifiers(event.getModifiers()); + mouseOpEvent.setModifiers(event.getModifiersEx()); mouseOpEvent.setClickCount(event.getClickCount()); mouseOpEvent.setMapControl(mapControl); + event.consume(); } /** {@inheritDoc} */ @@ -101,12 +88,18 @@ /** {@inheritDoc} */ public void mouseDragged(final MouseEvent event) { - getMouseOperation(event).dragged(mouseOpEvent); + final MouseOpListener mouseOpListener = getMouseOperation(event); + if (mouseOpListener != null) { + mouseOpListener.dragged(mouseOpEvent); + } } /** {@inheritDoc} */ public void mouseMoved(final MouseEvent event) { - getMouseOperation(event).moved(mouseOpEvent); + final MouseOpListener mouseOpListener = getMouseOperation(event); + if (mouseOpListener != null) { + mouseOpListener.moved(mouseOpEvent); + } } /** {@inheritDoc} */ @@ -117,12 +110,18 @@ { return; } - getMouseOperation(event).pressed(mouseOpEvent); + final MouseOpListener mouseOpListener = getMouseOperation(event); + if (mouseOpListener != null) { + mouseOpListener.pressed(mouseOpEvent); + } } /** {@inheritDoc} */ public void mouseReleased(final MouseEvent event) { - getMouseOperation(event).released(mouseOpEvent); + final MouseOpListener mouseOpListener = getMouseOperation(event); + if (mouseOpListener != null) { + mouseOpListener.released(mouseOpEvent); + } } /** @@ -130,28 +129,9 @@ * @param event MouseEvent to get mouse operation for * @return mouse operation for <var>event</var> */ - private MouseOpListener getMouseOperation(final MouseEvent event) { + @Nullable private MouseOpListener getMouseOperation(final MouseEvent event) { initEvent(event); - final int mod = event.getModifiers(); - switch (event.getButton()) { - case BUTTON1: - return lmbOp; - case BUTTON2: - return mmbOp; - case BUTTON3: - return (mod & SHIFT_MASK) == SHIFT_MASK ? mmbOp : rmbOp; // quickfix for michtoen - default: // other mouse buttons are not supported yet, so there's nothing todo. - } - if ((mod & BUTTON1_MASK) == BUTTON1_MASK) { - return lmbOp; - } - if ((mod & BUTTON2_MASK) == BUTTON2_MASK) { - return mmbOp; - } - if ((mod & BUTTON3_MASK) == BUTTON3_MASK) { - return (mod & SHIFT_MASK) == SHIFT_MASK ? mmbOp : rmbOp; - } // quickfix for michtoen - return stub; + return toolSelector.getMouseOpListener(mouseOpEvent); } /** Modified: trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java 2006-06-19 21:17:38 UTC (rev 168) +++ trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java 2006-06-21 22:13:09 UTC (rev 169) @@ -1,8 +1,10 @@ package daieditor.gui.map.event; -import net.sf.gridarta.gui.map.MapCursor; -import net.sf.gridarta.gui.map.MapGrid; -import java.awt.event.InputEvent; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import net.sf.japi.util.Pair; /** * Event Listener Adapater for {@link MouseOpListener}. @@ -10,6 +12,12 @@ */ @SuppressWarnings({"NoopMethodInAbstractClass"}) public abstract class MouseOpAdapter implements MouseOpListener { + /** + * Maps event ids to lists of (onMask, offMask) pairs. + * A pair inside this map means that this MouseOpAdapter is listening to events with this type + * with modifiers set to <code>onMask</code> but not set to <code>offMask</code> + */ + private final Map<Integer, List<Pair<Integer, Integer>>> useMap = new HashMap<Integer, List<Pair<Integer, Integer>>>(); /** {@inheritDoc} */ public void clicked(final MouseOpEvent e) { @@ -35,4 +43,39 @@ public void released(final MouseOpEvent e) { } + /** {@inheritDoc} */ + public boolean isUsing(final int type, final int modifiers) { + final List<Pair<Integer, Integer>> pairList = useMap.get(type); + if (pairList == null) { + return false; + } + for (final Pair<Integer, Integer> pair : pairList) { + if ((modifiers & (pair.getFirst() | pair.getSecond())) == pair.getFirst()) { + return true; + } + } + return false; + } + + /** + * Stores which type of events are processed. + * @param type id of event + * @param onMask Mask of pressed keys and buttons + * @param offMask Mask of keys and buttons that are not pressed + * @see java.awt.AWTEvent#getID() + * @see daieditor.gui.map.event.MouseOpEvent#getModifiers() + */ + protected void uses(final int type, final int onMask, final int offMask) { + final List<Pair<Integer, Integer>> pairList = useMap.get(type); + final List<Pair<Integer, Integer>> list; + if (pairList == null) { + list = new ArrayList<Pair<Integer, Integer>>(); + useMap.put(type, list); + } else { + list = pairList; + } + final Pair<Integer, Integer> pair = new Pair<Integer, Integer>(onMask, offMask); + list.add(pair); + } + } // class MouseOpAdapter Modified: trunk/daimonin/src/daieditor/gui/map/event/MouseOpEvent.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/event/MouseOpEvent.java 2006-06-19 21:17:38 UTC (rev 168) +++ trunk/daimonin/src/daieditor/gui/map/event/MouseOpEvent.java 2006-06-21 22:13:09 UTC (rev 169) @@ -1,9 +1,9 @@ package daieditor.gui.map.event; +import daieditor.map.MapControl; +import daieditor.map.MapModel; import java.awt.Point; import java.util.EventObject; -import daieditor.map.MapModel; -import daieditor.map.MapControl; import net.sf.gridarta.gui.map.MapCursor; /** @@ -23,6 +23,18 @@ private Point mapLocation; /** + * The pressed mouse button. + * @see java.awt.event.MouseEvent#getButton() + */ + private int button; + + /** + * The type of event. + * @see java.awt.AWTEvent#getID() + */ + private int id; + + /** * The modifiers during this event. * @see java.awt.event.MouseEvent#getModifiers() */ @@ -59,7 +71,7 @@ * @param mapCursor The map cursor to control cursor and selection * @param mapLocation The location of the point on the map model * @param modifiers The event modifiers (keys like shift or ctrl being pressed while this event was triggered) - * @see java.awt.event.MouseEvent#getModifiers() + * @see java.awt.event.MouseEvent#getModifiersEx() */ public MouseOpEvent(final MapModel source, final MapCursor mapCursor, final Point mapLocation, final int modifiers) { this(source, mapCursor, mapLocation, modifiers, 0); @@ -81,19 +93,35 @@ return clickCount; } - public void setMapCursor(MapCursor mapCursor) { + /** + * Get mouse button that changed. + * @return Changed mouse button + */ + public int getButton() { + return button; + } + + /** + * Set mouse button that changed. + * @param button Mouse button that changed. + */ + public void setButton(final int button) { + this.button = button; + } + + public void setMapCursor(final MapCursor mapCursor) { this.mapCursor = mapCursor; } - public void setMapLocation(Point mapLocation) { + public void setMapLocation(final Point mapLocation) { this.mapLocation = mapLocation; } - public void setModifiers(int modifiers) { + public void setModifiers(final int modifiers) { this.modifiers = modifiers; } - public void setClickCount(int clickCount) { + public void setClickCount(final int clickCount) { this.clickCount = clickCount; } @@ -101,8 +129,24 @@ return mapControl; } - public void setMapControl(MapControl mapControl) { + public void setMapControl(final MapControl mapControl) { this.mapControl = mapControl; } + /** + * Get event type. + * @return Return event type + * @see java.awt.AWTEvent#getID() + */ + public int getId() { + return id; + } + + /** + * Set event type. + * @param id Set event type to <code>id</code> + */ + public void setId(final int id) { + this.id = id; + } } // class MouseOpEvent Modified: trunk/daimonin/src/daieditor/gui/map/event/MouseOpListener.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/event/MouseOpListener.java 2006-06-19 21:17:38 UTC (rev 168) +++ trunk/daimonin/src/daieditor/gui/map/event/MouseOpListener.java 2006-06-21 22:13:09 UTC (rev 169) @@ -1,7 +1,5 @@ package daieditor.gui.map.event; -import daieditor.gui.map.event.MouseOpEvent; - /** Interface for Mouse Operations. */ public interface MouseOpListener { @@ -30,4 +28,13 @@ */ void released(MouseOpEvent e); + /** + * Tests if the implementation of this Listener uses this type of event with these modifiers. + * @param type id of the event + * @param modifiers modifiers of the event + * @return <code>true</code> if this event is used + * @see java.awt.AWTEvent#getID() + * @see daieditor.gui.map.event.MouseOpEvent#getModifiers() + */ + boolean isUsing(int type, int modifiers); } // interface MouseOpListener Modified: trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java 2006-06-19 21:17:38 UTC (rev 168) +++ trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java 2006-06-21 22:13:09 UTC (rev 169) @@ -7,12 +7,15 @@ import daieditor.map.MapSquare; import java.awt.Component; import java.awt.Point; +import java.awt.event.InputEvent; +import static java.awt.event.MouseEvent.MOUSE_DRAGGED; +import static java.awt.event.MouseEvent.MOUSE_PRESSED; import javax.swing.JPanel; import net.sf.gridarta.gui.map.MapCursor; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ToggleAction; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; /** MouseOpListener for deletion. */ public class DeletionTool extends BasicAbstractTool { @@ -31,6 +34,8 @@ /** Create a DeletionTool. */ public DeletionTool() { super("deletion"); + uses(MOUSE_PRESSED, InputEvent.BUTTON2_DOWN_MASK, 0); + uses(MOUSE_DRAGGED, InputEvent.BUTTON2_DOWN_MASK, 0); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java 2006-06-19 21:17:38 UTC (rev 168) +++ trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java 2006-06-21 22:13:09 UTC (rev 169) @@ -3,14 +3,17 @@ import daieditor.CMainControl; import daieditor.gui.map.event.MouseOpEvent; import daieditor.map.MapControl; +import java.awt.Component; import java.awt.Point; -import java.awt.Component; +import java.awt.event.InputEvent; +import static java.awt.event.MouseEvent.MOUSE_DRAGGED; +import static java.awt.event.MouseEvent.MOUSE_PRESSED; +import javax.swing.JPanel; import net.sf.gridarta.gui.map.MapCursor; +import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ToggleAction; -import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.swing.JPanel; /** * MouseOpListener for insertion. @@ -34,6 +37,8 @@ */ public InsertionTool() { super("insertion"); + uses(MOUSE_PRESSED, InputEvent.BUTTON3_DOWN_MASK, 0); + uses(MOUSE_DRAGGED, InputEvent.BUTTON3_DOWN_MASK, 0); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java 2006-06-19 21:17:38 UTC (rev 168) +++ trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java 2006-06-21 22:13:09 UTC (rev 169) @@ -5,6 +5,7 @@ import daieditor.map.MapControl; import java.awt.Point; import java.awt.event.InputEvent; +import java.awt.event.MouseEvent; import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapGrid; @@ -18,6 +19,9 @@ */ public SelectionTool() { super("selection"); + uses(MouseEvent.MOUSE_PRESSED, InputEvent.BUTTON1_DOWN_MASK, 0); + uses(MouseEvent.MOUSE_DRAGGED, InputEvent.BUTTON1_DOWN_MASK, 0); + uses(MouseEvent.MOUSE_RELEASED, 0, 0); } /** {@inheritDoc} */ @@ -29,7 +33,7 @@ // left mouse button: select tiles final boolean selChange = mapCursor.isActive(); // Throw away old selection if CTRL is not pressed - if ((mod & InputEvent.CTRL_MASK) == 0) { + if ((mod & InputEvent.CTRL_DOWN_MASK) == 0) { mapCursor.deactivate(); } mapCursor.setLocation(mapLoc); @@ -54,10 +58,10 @@ final MapCursor mapCursor = e.getMapCursor(); final int modifiers = e.getModifiers(); if (mapCursor.isOnGrid(e.getMapLocation())) { - if ((modifiers & InputEvent.SHIFT_MASK) == 0) { + if ((modifiers & InputEvent.SHIFT_DOWN_MASK) == 0) { mapCursor.dragSelect(MapGrid.SelectionMode.FLIP); } else { - if ((modifiers & InputEvent.CTRL_MASK) == 0) { + if ((modifiers & InputEvent.CTRL_DOWN_MASK) == 0) { mapCursor.dragSelect(MapGrid.SelectionMode.SUB); } else { mapCursor.dragSelect(MapGrid.SelectionMode.ADD); Modified: trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java 2006-06-19 21:17:38 UTC (rev 168) +++ trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java 2006-06-21 22:13:09 UTC (rev 169) @@ -1,12 +1,20 @@ package daieditor.gui.map.tools; +import daieditor.gui.map.event.MouseOpEvent; +import daieditor.gui.map.event.MouseOpListener; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; import java.awt.FlowLayout; import java.awt.event.ActionEvent; +import static java.awt.event.InputEvent.BUTTON1_DOWN_MASK; +import static java.awt.event.InputEvent.BUTTON2_DOWN_MASK; +import static java.awt.event.InputEvent.BUTTON3_DOWN_MASK; +import static java.awt.event.MouseEvent.BUTTON1; +import static java.awt.event.MouseEvent.BUTTON2; +import static java.awt.event.MouseEvent.BUTTON3; +import java.util.HashMap; import java.util.Map; -import java.util.HashMap; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.ButtonGroup; @@ -40,6 +48,12 @@ /** The tools. */ @NotNull private final Map<String, Tool> tools = new HashMap<String, Tool>(); + /** + * Default mapping of mouse button to Tool. + * @see java.awt.event.MouseEvent#getButton() + */ + @NotNull private final Map<Integer, MouseOpListener> defaultMouseOpListeners = new HashMap<Integer, MouseOpListener>(); + /** Create a ToolSelector component. */ public ToolSelector() { createUI(); @@ -124,6 +138,45 @@ } /** + * Returns <code>MouseOpListener</code> depending on the <code>event</code> + * and the default settings. + * @param event This event's id, button and modifiers are needed + * @return A <code>MouseOpListener</code> that matches the event. + */ + @Nullable public MouseOpListener getMouseOpListener(final MouseOpEvent event) { + final int modifiers = event.getModifiers(); + if (selectedTool instanceof MouseOpListener) { + final MouseOpListener mouseOpListener = (MouseOpListener) selectedTool; + if (mouseOpListener.isUsing(event.getId(), modifiers)) { + return mouseOpListener; + } + } + @Nullable final MouseOpListener mouseOpListener = defaultMouseOpListeners.get(event.getButton()); + if (mouseOpListener != null) { + return mouseOpListener; + } + if ((modifiers & BUTTON1_DOWN_MASK) != 0) { + return defaultMouseOpListeners.get(BUTTON1); + } + if ((modifiers & BUTTON2_DOWN_MASK) != 0) { + return defaultMouseOpListeners.get(BUTTON2); + } + if ((modifiers & BUTTON3_DOWN_MASK) != 0) { + return defaultMouseOpListeners.get(BUTTON3); + } + return null; + } + + /** + * Set a default <code>MouseOpListener</code> for a mouse button. + * @param button Button number + * @param mouseOpListener This will become the default Listener for the mouse button. + */ + public void setDefault(final int button, @Nullable final MouseOpListener mouseOpListener) { + defaultMouseOpListeners.put(button, mouseOpListener); + } + + /** * Action for selecting a tool. */ private final class SelectionAction extends AbstractAction { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-19 21:17:50
|
Revision: 168 Author: christianhujer Date: 2006-06-19 14:17:38 -0700 (Mon, 19 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=168&view=rev Log Message: ----------- Added project properties for automatic branching and releasing. Added Paths: ----------- trunk/project.properties Added: trunk/project.properties =================================================================== --- trunk/project.properties (rev 0) +++ trunk/project.properties 2006-06-19 21:17:38 UTC (rev 168) @@ -0,0 +1,5 @@ +project.version.major=0 +project.version.minor=1 +project.version.patch=0 +project.version=${project.version.major}.${project.version.minor}.${project.version.patch} +project.focus=majorEnhancements Property changes on: trunk/project.properties ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-18 20:45:35
|
Revision: 167 Author: christianhujer Date: 2006-06-18 13:45:22 -0700 (Sun, 18 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=167&view=rev Log Message: ----------- Fixed broken copyright character. Please keep in mind that .properties files MUST be ISO-8859-1. Modified Paths: -------------- trunk/daimonin/src/daieditor/messages_sv.properties Modified: trunk/daimonin/src/daieditor/messages_sv.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_sv.properties 2006-06-18 20:43:44 UTC (rev 166) +++ trunk/daimonin/src/daieditor/messages_sv.properties 2006-06-18 20:45:22 UTC (rev 167) @@ -779,7 +779,7 @@ about.mnemonic=O about.title=Om DaimoninEditor BETA3 v0.966 -about=<html><h1 align="center">Daimonin Editor</h1><h2 align="center">Version BETA3 v0.966</h2><table><tr><td valign="top" align="right" width="50%">Copyright � 2001-2006</td><td width="50%">Michael Toennies<br>Andreas Vogl<br>Peter Plischewsky<br>Gecko<br>Christian Hujer<br>Daniel Viegas</td></tr><tr><td align="right">Java version:</td><td>{0}</td></tr><tr><td align="right">Build number:</td><td>{1}</td></tr><tr><td align="right">av:</td><td>{2}</td></tr><tr><td align="right">datum:</td><td>{3}</td></tr></table></html> +about=<html><h1 align="center">Daimonin Editor</h1><h2 align="center">Version BETA3 v0.966</h2><table><tr><td valign="top" align="right" width="50%">Copyright \xA9 2001-2006</td><td width="50%">Michael Toennies<br>Andreas Vogl<br>Peter Plischewsky<br>Gecko<br>Christian Hujer<br>Daniel Viegas</td></tr><tr><td align="right">Java version:</td><td>{0}</td></tr><tr><td align="right">Build number:</td><td>{1}</td></tr><tr><td align="right">av:</td><td>{2}</td></tr><tr><td align="right">datum:</td><td>{3}</td></tr></table></html> aboutTab.title=Om license.text=Licens... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-18 20:43:50
|
Revision: 166 Author: christianhujer Date: 2006-06-18 13:43:44 -0700 (Sun, 18 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=166&view=rev Log Message: ----------- Fixed broken copyright character. Please keep in mind that .properties files MUST be ISO-8859-1. Modified Paths: -------------- trunk/daimonin/src/daieditor/messages.properties Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-06-18 20:22:53 UTC (rev 165) +++ trunk/daimonin/src/daieditor/messages.properties 2006-06-18 20:43:44 UTC (rev 166) @@ -786,7 +786,7 @@ about.mnemonic=A about.title=About DaimoninEditor BETA3 v0.966 -about=<html><h1 align="center">Daimonin Editor</h1><h2 align="center">Version BETA3 v0.966</h2><table><tr><td valign="top" align="right" width="50%">Copyright � 2001-2006</td><td width="50%">Michael Toennies<br>Andreas Vogl<br>Peter Plischewsky<br>Gecko<br>Christian Hujer<br>Daniel Viegas</td></tr><tr><td align="right">Java version:</td><td>{0}</td></tr><tr><td align="right">Build number:</td><td>{1}</td></tr><tr><td align="right">by:</td><td>{2}</td></tr><tr><td align="right">at:</td><td>{3}</td></tr></table></html> +about=<html><h1 align="center">Daimonin Editor</h1><h2 align="center">Version BETA3 v0.966</h2><table><tr><td valign="top" align="right" width="50%">Copyright \xA9 2001-2006</td><td width="50%">Michael Toennies<br>Andreas Vogl<br>Peter Plischewsky<br>Gecko<br>Christian Hujer<br>Daniel Viegas</td></tr><tr><td align="right">Java version:</td><td>{0}</td></tr><tr><td align="right">Build number:</td><td>{1}</td></tr><tr><td align="right">by:</td><td>{2}</td></tr><tr><td align="right">at:</td><td>{3}</td></tr></table></html> aboutTab.title=About license.text=License... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-18 20:23:01
|
Revision: 165 Author: christianhujer Date: 2006-06-18 13:22:53 -0700 (Sun, 18 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=165&view=rev Log Message: ----------- Fixed moving css class. Modified Paths: -------------- trunk/src/doc/transform.xslt Modified: trunk/src/doc/transform.xslt =================================================================== --- trunk/src/doc/transform.xslt 2006-06-17 23:12:31 UTC (rev 164) +++ trunk/src/doc/transform.xslt 2006-06-18 20:22:53 UTC (rev 165) @@ -62,7 +62,7 @@ <a href="http://sourceforge.net/"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=166996&type=1" alt="SourceForge.net Logo" width="88" height="31" class="now" /></a> <a href="http://sourceforge.net/donate/index.php?group_id=166996"><img src="http://sourceforge.net/images/project-support.jpg" width="88" height="32" alt="Support This Project" class="now" /></a> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML 1.1" height="31" width="88" class="now" /></a> - <a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="http://jigsaw.w3.org/css-validator/images/vcss" width="88" height="31" alt="Valid CSS!" /></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="http://jigsaw.w3.org/css-validator/images/vcss" width="88" height="31" alt="Valid CSS!" class="now" /></a> <!--<a href="http://www.jetbrains.com/idea/"><img src="http://www.jetbrains.com/idea/opensource/img/banners/idea88x31_blue.gif" alt="The best Java IDE" width="88" height="31" /></a>--> Feedback: <a href="mailto:ch...@ri...">webmaster</a> <xsl:if test="/html:html/html:head/html:meta[@name='Date']"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-06-17 23:12:45
|
Revision: 164 Author: derdanny Date: 2006-06-17 16:12:31 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=164&view=rev Log Message: ----------- Added delete below feature. Modified Paths: -------------- trunk/daimonin/src/daieditor/CArchPanel.java trunk/daimonin/src/daieditor/gui/map/MapUserListener.java trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java trunk/daimonin/src/daieditor/gui/map/tools/VoidTool.java trunk/daimonin/src/daieditor/gui/map/tools/action.properties trunk/daimonin/src/daieditor/map/MapControl.java Modified: trunk/daimonin/src/daieditor/CArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanel.java 2006-06-17 11:38:16 UTC (rev 163) +++ trunk/daimonin/src/daieditor/CArchPanel.java 2006-06-17 23:12:31 UTC (rev 164) @@ -103,9 +103,9 @@ final ToolSelector toolSelector = new ToolSelector(); // TODO: introduce a tool registry - toolSelector.add(new SelectionTool()); - toolSelector.add(new InsertionTool()); - toolSelector.add(new DeletionTool()); + toolSelector.add(SelectionTool.instance); + toolSelector.add(InsertionTool.instance); + toolSelector.add(DeletionTool.instance); add(toolSelector, BorderLayout.NORTH); add(archAndPickPane, BorderLayout.CENTER); add(archQuickPanel, BorderLayout.SOUTH); Modified: trunk/daimonin/src/daieditor/gui/map/MapUserListener.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapUserListener.java 2006-06-17 11:38:16 UTC (rev 163) +++ trunk/daimonin/src/daieditor/gui/map/MapUserListener.java 2006-06-17 23:12:31 UTC (rev 164) @@ -47,16 +47,16 @@ public final class MapUserListener implements MouseListener, MouseMotionListener { /** Mouse Operation bound to the left mouse button. */ - private MouseOpListener lmbOp = new SelectionTool(); + private MouseOpListener lmbOp = SelectionTool.instance; /** Mouse Operation bound to the middle mouse button. */ - private MouseOpListener mmbOp = new DeletionTool(); + private MouseOpListener mmbOp = DeletionTool.instance; /** Mouse Operation bound to the right mouse button. */ - private MouseOpListener rmbOp = new InsertionTool(); + private MouseOpListener rmbOp = InsertionTool.instance; /** Mouse Operation stub doing nothing. */ - private MouseOpListener stub = new VoidTool(); + private MouseOpListener stub = VoidTool.instance; private MapCursor mapCursor; private DefaultLevelRenderer renderer; Modified: trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java 2006-06-17 11:38:16 UTC (rev 163) +++ trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java 2006-06-17 23:12:31 UTC (rev 164) @@ -4,12 +4,30 @@ import daieditor.arch.ArchObject; import daieditor.gui.map.event.MouseOpEvent; import daieditor.map.MapControl; +import daieditor.map.MapSquare; +import java.awt.Component; import java.awt.Point; +import javax.swing.JPanel; import net.sf.gridarta.gui.map.MapCursor; +import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ToggleAction; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** MouseOpListener for deletion. */ public class DeletionTool extends BasicAbstractTool { + /** The ActionFactory. */ + @NotNull private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor.gui.map.tools"); + + /** The ToggleAction for toggling the deleteBelow status. */ + private ToggleAction deleteBelowAction = (ToggleAction) ACTION_FACTORY.createToggle(true, "deleteBelow", this); + + /** The position for deletion. */ + private boolean deleteBelow; + + public static final DeletionTool instance = new DeletionTool(); + /** Create a DeletionTool. */ public DeletionTool() { super("deletion"); @@ -46,9 +64,10 @@ * @param mapLoc position to delete topmost arch at * @param mapControl map control of map to delete arch from */ - private static void deleteArch(final Point mapLoc, final MapControl mapControl) { + private void deleteArch(final Point mapLoc, final MapControl mapControl) { ArchObject delArch = null; - for (final ArchObject searchArch : mapControl.getMapModel().getMapSquare(mapLoc).reverse()) { + final MapSquare mapSquare = mapControl.getMapModel().getMapSquare(mapLoc); + for (final ArchObject searchArch : deleteBelow ? mapSquare : mapSquare.reverse()) { if (CMainControl.getInstance().isTileEdit(searchArch)) { delArch = searchArch; break; @@ -59,4 +78,27 @@ } } + /** {@inheritDoc} */ + @Override @Nullable public Component createOptionsView() { + final JPanel optionsPanel = new JPanel(); + optionsPanel.add(deleteBelowAction.createCheckBox()); + return optionsPanel; + } + + /** + * Returns the position for deletion. + * @return the position for deletion. + */ + public boolean isDeleteBelow() { + return deleteBelow; + } + + /** + * Sets the position for deletion. + * @param deleteBelow the position for deletion. + */ + public void setDeleteBelow(final boolean deleteBelow) { + this.deleteBelow = deleteBelow; + } + } // class DeletionTool Modified: trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java 2006-06-17 11:38:16 UTC (rev 163) +++ trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java 2006-06-17 23:12:31 UTC (rev 164) @@ -4,11 +4,31 @@ import daieditor.gui.map.event.MouseOpEvent; import daieditor.map.MapControl; import java.awt.Point; +import java.awt.Component; import net.sf.gridarta.gui.map.MapCursor; +import net.sf.japi.swing.ToggleAction; +import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import javax.swing.JPanel; -/** MouseOpListener for insertion. */ +/** + * MouseOpListener for insertion. + * @todo implement insert below + */ public class InsertionTool extends BasicAbstractTool { + /** The ActionFactory. */ + @NotNull private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor.gui.map.tools"); + + /** The ToggleAction for toggling the deleteBelow status. */ + private ToggleAction deleteBelowAction = (ToggleAction) ACTION_FACTORY.createToggle(true, "insertBelow", this); + + /** The position for deletion. */ + private boolean deleteBelow; + + public static final InsertionTool instance = new InsertionTool(); + /** * Create a BasicAbstractTool. */ @@ -46,4 +66,27 @@ } } + /** {@inheritDoc} */ + @Override @Nullable public Component createOptionsView() { + final JPanel optionsPanel = new JPanel(); + // todo optionsPanel.add(deleteBelowAction.createCheckBox()); + return optionsPanel; + } + + /** + * Returns the position for deletion. + * @return the position for deletion. + */ + public boolean isDeleteBelow() { + return deleteBelow; + } + + /** + * Sets the position for deletion. + * @param deleteBelow the position for deletion. + */ + public void setDeleteBelow(final boolean deleteBelow) { + this.deleteBelow = deleteBelow; + } + } // class InsertMouseOperation Modified: trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java 2006-06-17 11:38:16 UTC (rev 163) +++ trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java 2006-06-17 23:12:31 UTC (rev 164) @@ -11,6 +11,8 @@ /** MouseOpListener for selection */ public class SelectionTool extends BasicAbstractTool { + public static final SelectionTool instance = new SelectionTool(); + /** * Create a BasicAbstractTool. */ Modified: trunk/daimonin/src/daieditor/gui/map/tools/VoidTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/VoidTool.java 2006-06-17 11:38:16 UTC (rev 163) +++ trunk/daimonin/src/daieditor/gui/map/tools/VoidTool.java 2006-06-17 23:12:31 UTC (rev 164) @@ -6,6 +6,8 @@ */ public class VoidTool extends BasicAbstractTool { + public static final VoidTool instance = new VoidTool(); + /** * Create a BasicAbstractTool. */ Modified: trunk/daimonin/src/daieditor/gui/map/tools/action.properties =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/action.properties 2006-06-17 11:38:16 UTC (rev 163) +++ trunk/daimonin/src/daieditor/gui/map/tools/action.properties 2006-06-17 23:12:31 UTC (rev 164) @@ -1,4 +1,5 @@ selection.text=SEL deletion.text=DEL insertion.text=INS -void.text=VOID \ No newline at end of file +void.text=VOID +deleteBelow.text=Delete below \ No newline at end of file Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-06-17 11:38:16 UTC (rev 163) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-06-17 23:12:31 UTC (rev 164) @@ -446,6 +446,10 @@ return mapFile; } + /** + * Returns model (= map data of this level). + * @return model (= map data of this level) + */ public MapModel getMapModel() { return mapModel; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-06-17 11:38:23
|
Revision: 163 Author: derdanny Date: 2006-06-17 04:38:16 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=163&view=rev Log Message: ----------- Cosmetic changes. Modified Paths: -------------- trunk/daimonin/src/daieditor/CArchPanel.java trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java Modified: trunk/daimonin/src/daieditor/CArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanel.java 2006-06-17 10:59:34 UTC (rev 162) +++ trunk/daimonin/src/daieditor/CArchPanel.java 2006-06-17 11:38:16 UTC (rev 163) @@ -27,8 +27,8 @@ import daieditor.arch.ArchObject; import daieditor.gui.map.tools.ToolSelector; import daieditor.gui.map.tools.SelectionTool; +import daieditor.gui.map.tools.DeletionTool; import daieditor.gui.map.tools.InsertionTool; -import daieditor.gui.map.tools.DeletionTool; import java.awt.BorderLayout; import java.util.ArrayList; import java.util.List; @@ -102,10 +102,11 @@ final ToolSelector toolSelector = new ToolSelector(); - add(new ToolSelector(), BorderLayout.NORTH); + // TODO: introduce a tool registry toolSelector.add(new SelectionTool()); toolSelector.add(new InsertionTool()); toolSelector.add(new DeletionTool()); + add(toolSelector, BorderLayout.NORTH); add(archAndPickPane, BorderLayout.CENTER); add(archQuickPanel, BorderLayout.SOUTH); Modified: trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java 2006-06-17 10:59:34 UTC (rev 162) +++ trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java 2006-06-17 11:38:16 UTC (rev 163) @@ -46,4 +46,4 @@ } } -} // Class InsertMouseOperation +} // class InsertMouseOperation This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-06-17 10:59:48
|
Revision: 162 Author: derdanny Date: 2006-06-17 03:59:34 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=162&view=rev Log Message: ----------- Files are now processed in alphabetical order. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/daimonin/src/daieditor/CArchPanel.java trunk/daimonin/src/daieditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/CPickmapPanel.java trunk/daimonin/src/daieditor/arch/ArchObjectStack.java trunk/daimonin/src/daieditor/messages.properties Modified: trunk/crossfire/src/cfeditor/CPickmapPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-06-17 10:12:54 UTC (rev 161) +++ trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-06-17 10:59:34 UTC (rev 162) @@ -31,6 +31,7 @@ import java.util.Map; import java.util.HashMap; import java.util.Iterator; +import java.util.Arrays; import javax.swing.JOptionPane; import javax.swing.JTabbedPane; import javax.swing.event.ChangeEvent; @@ -104,6 +105,7 @@ } final File[] flist = pickmapDir.listFiles(); // list of files + Arrays.sort(flist); for (final File aFlist : flist) { // open the pickmaps if (aFlist.isFile()) { Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-17 10:12:54 UTC (rev 161) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-17 10:59:34 UTC (rev 162) @@ -49,6 +49,7 @@ import java.util.Date; import java.util.HashMap; import java.util.Map; +import java.util.Arrays; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JDialog; @@ -329,6 +330,7 @@ folderLevel++; final String[] children = f.list(); + Arrays.sort(children); for (int i = 0; i < children.length; i++) { loadArchFromFiles(new File(f, children[i]), index); } Modified: trunk/daimonin/src/daieditor/CArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanel.java 2006-06-17 10:12:54 UTC (rev 161) +++ trunk/daimonin/src/daieditor/CArchPanel.java 2006-06-17 10:59:34 UTC (rev 162) @@ -25,8 +25,13 @@ package daieditor; import daieditor.arch.ArchObject; +import daieditor.gui.map.tools.ToolSelector; +import daieditor.gui.map.tools.SelectionTool; +import daieditor.gui.map.tools.InsertionTool; +import daieditor.gui.map.tools.DeletionTool; import java.awt.BorderLayout; import java.util.ArrayList; +import java.util.List; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JTabbedPane; @@ -66,7 +71,7 @@ private final CArchQuickView archQuickPanel; /** List of arch panels. */ - private static ArrayList<PanelNode> panelNodeList = new ArrayList<PanelNode>(); + private static List<PanelNode> panelNodeList = new ArrayList<PanelNode>(); /** The active panel. */ private CArchPanelPan selectedPanel; @@ -76,12 +81,12 @@ * @param mainControl CMainControl */ public CArchPanel(final CMainControl mainControl) { + super(new BorderLayout()); this.mainControl = mainControl; selectedPanel = null; setSelectedArch(null); - setLayout(new BorderLayout()); tabDesktop = new JTabbedPane(TOP); tabDesktop.setBorder(BorderFactory.createEmptyBorder(IGUIConstants.SPACE_PICKARCH_TOP, 0, 0, 0)); archQuickPanel = new CArchQuickView(mainControl); @@ -96,6 +101,11 @@ // calculate default value in case there is no settings file + final ToolSelector toolSelector = new ToolSelector(); + add(new ToolSelector(), BorderLayout.NORTH); + toolSelector.add(new SelectionTool()); + toolSelector.add(new InsertionTool()); + toolSelector.add(new DeletionTool()); add(archAndPickPane, BorderLayout.CENTER); add(archQuickPanel, BorderLayout.SOUTH); @@ -115,7 +125,7 @@ }); } - public static ArrayList<PanelNode> getPanelNodeList() { + public static List<PanelNode> getPanelNodeList() { return panelNodeList; } Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-06-17 10:12:54 UTC (rev 161) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-06-17 10:59:34 UTC (rev 162) @@ -47,6 +47,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Arrays; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; @@ -311,6 +312,7 @@ || name.toLowerCase().endsWith(".tl"); } }); + Arrays.sort(traverse); for (final String entry : traverse) { loadTreasureList(fname + File.separator + entry, tmpList, needLink); } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-06-17 10:12:54 UTC (rev 161) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-06-17 10:59:34 UTC (rev 162) @@ -87,6 +87,7 @@ import java.util.List; import java.util.ListIterator; import java.util.Random; +import java.util.Arrays; import java.util.logging.Level; import java.util.logging.Logger; import java.util.prefs.Preferences; @@ -464,12 +465,14 @@ final String[] patterns = libsString.split("\\s+"); final File[] libFiles = libs.listFiles(Factory.not(new GlobFileFilter(patterns))); if (libFiles != null) { + Arrays.sort(libFiles); for (final File libFile : libFiles) { System.out.println(libFile); } } if (libFiles != null && libFiles.length > 0 && ACTION_FACTORY.showOnetimeConfirmDialog(mainView, YES_NO_OPTION, INFORMATION_MESSAGE, "oldLibsFound", libs.toString()) == YES_OPTION) { + Arrays.sort(libFiles); for (final File libFile : libFiles) { libFile.delete(); } @@ -756,6 +759,9 @@ /** Swing FileFilter for .anim files. */ public static final FileFilter animFileFilter = new HideFileFilterProxy(new EndingFileFilter(true, ACTION_FACTORY.getString("fileDialog.filter.anim"), ".anim")); + /** Swing FileFilter for all unignored files. */ + public static final FileFilter unignoredFilter = new HideFileFilterProxy(new EndingFileFilter(true, ACTION_FACTORY.getString("fileDialog.filter.unignored"), "")); + public String getMapDefaultFolder() { return strMapDir; } Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-06-17 10:12:54 UTC (rev 161) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-06-17 10:59:34 UTC (rev 162) @@ -312,7 +312,7 @@ */ @Nullable public List<ArchObject> getArchPanelSelection() { - if ((isPickmapActive() || archPanel.getArchPanelSelection() == null) + if ((pickmapActive || archPanel.getArchPanelSelection() == null) && CPickmapPanel.getInstance().isLoadComplete()) { // get the active pickmap final MapControl pmap = CPickmapPanel.getInstance().getCurrentPickmap(); @@ -820,7 +820,7 @@ aReloadFaces.setEnabled(!ArchObjectStack.isLoadedFromArchive()); aViewTreasurelists.setEnabled(true); - final boolean pickmapState = !mainControl.isLockAllPickmaps() && mainControl.getMainView().isPickmapActive(); + final boolean pickmapState = !mainControl.isLockAllPickmaps() && mainControl.getMainView().pickmapActive; aClosePickmap.setEnabled(pickmapState); aOpenPickmap.setEnabled(pickmapState); aRevertPickmap.setEnabled(pickmapState); Modified: trunk/daimonin/src/daieditor/CPickmapPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-06-17 10:12:54 UTC (rev 161) +++ trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-06-17 10:59:34 UTC (rev 162) @@ -34,6 +34,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Arrays; import javax.swing.JTabbedPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -106,7 +107,8 @@ } final File[] flist = pickmapDir.listFiles(); // list of files - for (File aFlist : flist) { + Arrays.sort(flist); + for (final File aFlist : flist) { // open the pickmaps if (aFlist.isFile()) { openPickmap(aFlist); Modified: trunk/daimonin/src/daieditor/arch/ArchObjectStack.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-06-17 10:12:54 UTC (rev 161) +++ trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-06-17 10:59:34 UTC (rev 162) @@ -54,6 +54,7 @@ import java.io.OutputStreamWriter; import java.io.Reader; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -224,7 +225,7 @@ } else { // display the time it took to collect arches: loadStatus = IS_COMPLETE; // status: stack completed - System.err.println("Arch collect took " + (System.currentTimeMillis() - timeStart) / 1000. + " Seconds"); + System.err.println("Arch collect took " + (System.currentTimeMillis() - timeStart) / 1000.0 + " Seconds"); // load pickmaps CPickmapPanel.getInstance().loadPickmaps(); @@ -249,10 +250,11 @@ final String[] traverse = f.list(new FilenameFilter() { public boolean accept(final File d, final String name) { final File fullPath = new File(d, name); - return ((fullPath.isDirectory() && !name.equalsIgnoreCase("cvs"))) + return fullPath.isDirectory() && !name.equalsIgnoreCase("cvs") || name.toLowerCase().endsWith(".art"); } }); + Arrays.sort(traverse); for (final String entry : traverse) { loadArchesFromArtifacts(fname + File.separator + entry); } @@ -387,7 +389,9 @@ final String name = f.getName(); if (f.isDirectory()) { // now, setup the arch panels - if (!name.equalsIgnoreCase("cvs") && !name.equalsIgnoreCase("dev") && !name.equalsIgnoreCase(".xvpics")) { + if (CMainControl.arcFileFilter.accept(f)) { + final String[] entries = f.list(); + Arrays.sort(entries); if (!name.equalsIgnoreCase("intern") && !noPanel) { if (folderLevel > 0 && folderLevel < 2) { // add first folders as panels mainControl.addArchPanel(name); @@ -400,9 +404,8 @@ } folderLevel++; - final String[] entries = f.list(); if (entries != null) { - for (final String entry : f.list()) { + for (final String entry : entries) { loadArchFromFiles(new File(f, entry), index, false); } } else { @@ -412,9 +415,8 @@ } else { // We are in an intern folder, so no panel will be generated folderLevel++; - final String[] entries = f.list(); if (entries != null) { - for (final String entry : f.list()) { + for (final String entry : entries) { loadArchFromFiles(new File(f, entry), index, true); } } else { Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-06-17 10:12:54 UTC (rev 161) +++ trunk/daimonin/src/daieditor/messages.properties 2006-06-17 10:59:34 UTC (rev 162) @@ -364,6 +364,7 @@ fileDialog.filter.png=PNG Images fileDialog.filter.arc=Archetype definitions fileDialog.filter.anim=Animation definitions +fileDialog.filter.unignored=All supported file types createNew.text=New createNew.shortdescription=Create new map This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-06-17 10:13:03
|
Revision: 161 Author: derdanny Date: 2006-06-17 03:12:54 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=161&view=rev Log Message: ----------- Moved selection related code from MouseOpAdapter to SelectionTool. Modified Paths: -------------- trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-06-17 08:54:15 UTC (rev 160) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-06-17 10:12:54 UTC (rev 161) @@ -224,14 +224,14 @@ mapDesktop = new JDesktopPane(); mapArchPanel = new CMapArchPanel(mainControl, this); - if (!mapTileListBottom) { + if (mapTileListBottom) { + splitRightPane = new GSplitPane(HORIZONTAL_SPLIT, mapArchPanel, mapTileList); + splitRightPane.setDividerLocation(divLocationRight); + splitDownPane = new GSplitPane(VERTICAL_SPLIT, mapDesktop, splitRightPane); + } else { splitRightPane = new GSplitPane(HORIZONTAL_SPLIT, mapDesktop, mapTileList); splitRightPane.setDividerLocation(divLocationRight); splitDownPane = new GSplitPane(VERTICAL_SPLIT, splitRightPane, mapArchPanel); - } else { - splitRightPane = new GSplitPane(HORIZONTAL_SPLIT, mapArchPanel, mapTileList); - splitRightPane.setDividerLocation(divLocationRight); - splitDownPane = new GSplitPane(VERTICAL_SPLIT, mapDesktop, splitRightPane); } splitDownPane.setDividerLocation(divLocationDown); splitPane = new GSplitPane(HORIZONTAL_SPLIT, archPanel, splitDownPane); @@ -276,7 +276,7 @@ */ @Nullable public ArchObject getArchPanelHighlight() { - if ((isPickmapActive() || archPanel.getArchPanelSelection() == null) + if ((pickmapActive || archPanel.getArchPanelSelection() == null) && CPickmapPanel.getInstance().isLoadComplete() && CPickmapPanel.getInstance().getCurrentPickmap() != null) { // get the active pickmap Modified: trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java 2006-06-17 08:54:15 UTC (rev 160) +++ trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java 2006-06-17 10:12:54 UTC (rev 161) @@ -8,6 +8,7 @@ * Event Listener Adapater for {@link MouseOpListener}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ +@SuppressWarnings({"NoopMethodInAbstractClass"}) public abstract class MouseOpAdapter implements MouseOpListener { /** {@inheritDoc} */ @@ -32,21 +33,6 @@ /** {@inheritDoc} */ public void released(final MouseOpEvent e) { - final MapCursor mapCursor = e.getMapCursor(); - final int modifiers = e.getModifiers(); - if (mapCursor.isOnGrid(e.getMapLocation())) { - if ((modifiers & InputEvent.SHIFT_MASK) != 0) { - if ((modifiers & InputEvent.CTRL_MASK) != 0) { - mapCursor.dragSelect(MapGrid.SelectionMode.ADD); - } else { - mapCursor.dragSelect(MapGrid.SelectionMode.SUB); - } - } else { - mapCursor.dragSelect(MapGrid.SelectionMode.FLIP); - } - } else { - mapCursor.dragRelease(); - } } } // class MouseOpAdapter Modified: trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java 2006-06-17 08:54:15 UTC (rev 160) +++ trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java 2006-06-17 10:12:54 UTC (rev 161) @@ -6,6 +6,7 @@ import java.awt.Point; import java.awt.event.InputEvent; import net.sf.gridarta.gui.map.MapCursor; +import net.sf.gridarta.gui.map.MapGrid; /** MouseOpListener for selection */ public class SelectionTool extends BasicAbstractTool { @@ -46,4 +47,23 @@ e.getMapCursor().dragTo(e.getMapLocation()); } + /** {@inheritDoc} */ + @Override public void released(final MouseOpEvent e) { + final MapCursor mapCursor = e.getMapCursor(); + final int modifiers = e.getModifiers(); + if (mapCursor.isOnGrid(e.getMapLocation())) { + if ((modifiers & InputEvent.SHIFT_MASK) == 0) { + mapCursor.dragSelect(MapGrid.SelectionMode.FLIP); + } else { + if ((modifiers & InputEvent.CTRL_MASK) == 0) { + mapCursor.dragSelect(MapGrid.SelectionMode.SUB); + } else { + mapCursor.dragSelect(MapGrid.SelectionMode.ADD); + } + } + } else { + mapCursor.dragRelease(); + } + } + } // class SelectionTool Modified: trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java 2006-06-17 08:54:15 UTC (rev 160) +++ trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java 2006-06-17 10:12:54 UTC (rev 161) @@ -43,7 +43,7 @@ /** Create a ToolSelector component. */ public ToolSelector() { createUI(); - final Tool voidTool = new VoidTool(); + @NotNull final Tool voidTool = new VoidTool(); selectedTool = voidTool; add(voidTool, true); setSelectedTool(voidTool); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-06-17 08:54:22
|
Revision: 160 Author: derdanny Date: 2006-06-17 01:54:15 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=160&view=rev Log Message: ----------- The VoidTool is now initially selected. The tool can now be selected by id. Modified Paths: -------------- trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java Modified: trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java 2006-06-17 08:40:12 UTC (rev 159) +++ trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java 2006-06-17 08:54:15 UTC (rev 160) @@ -5,6 +5,8 @@ import java.awt.Component; import java.awt.FlowLayout; import java.awt.event.ActionEvent; +import java.util.Map; +import java.util.HashMap; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.ButtonGroup; @@ -35,12 +37,15 @@ /** The currently selected tool. */ @NotNull private Tool selectedTool; + /** The tools. */ + @NotNull private final Map<String, Tool> tools = new HashMap<String, Tool>(); + /** Create a ToolSelector component. */ public ToolSelector() { createUI(); final Tool voidTool = new VoidTool(); selectedTool = voidTool; - add(voidTool); + add(voidTool, true); setSelectedTool(voidTool); } @@ -57,12 +62,23 @@ */ @SuppressWarnings({"MethodOverloadsMethodOfSuperclass"}) public void add(@NotNull final Tool tool) { + add(tool, false); + } + + /** + * Add a tool to this tool selector. + * @param tool Tool to add + * @param selected <code>true</code> if the tool should be made the selected tool, otherwise <code>false</code> + */ + private void add(final Tool tool, final boolean selected) { @NotNull final Action selectionAction = new SelectionAction(tool); @NotNull final JToggleButton toggleButton = new JToggleButton(selectionAction); @NotNull final Component optionsView = createOptionsView(tool); selectionButtonGroup.add(toggleButton); selectionPane.add(toggleButton); optionsPane.add(optionsView, tool.getId()); + toggleButton.setSelected(selected); + tools.put(tool.getId(), tool); } /** @@ -80,6 +96,7 @@ * Make a tool the currently selected tool to edit its options. * @pre the tool must be controlled by this toolselector. * @param tool Tool to select + * @see #setSelectedTool(String) */ public void setSelectedTool(@NotNull final Tool tool) { selectedTool = tool; @@ -87,6 +104,18 @@ } /** + * Make a tool the currently selected tool to edit its options. + * This method exists to allow programs to store the currently selected tool in preferences and restore it after startup. + * @pre the tool must be controlled by this toolselector. + * @param id ID of tool to select + * @see #setSelectedTool(Tool) + * @see Tool#getId() + */ + public void setSelectedTool(@NotNull final String id) { + setSelectedTool(tools.get(id)); + } + + /** * Get the tool that is currently selected. * @return the currently selected tool. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |