From: <aki...@us...> - 2006-12-12 03:39:22
|
Revision: 1005 http://svn.sourceforge.net/gridarta/?rev=1005&view=rev Author: akirschbaum Date: 2006-12-10 05:37:25 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Unify options dialog. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CSettings.java trunk/crossfire/src/cfeditor/action.properties trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/daimonin/src/daieditor/messages.properties trunk/src/app/net/sf/gridarta/messages.properties Added Paths: ----------- trunk/crossfire/resource/icons/development/ trunk/crossfire/resource/icons/development/Host24.gif trunk/crossfire/resource/icons/general/ trunk/crossfire/resource/icons/general/Open16.gif trunk/crossfire/resource/icons/general/Save24.gif trunk/crossfire/src/cfeditor/gui/prefs/ trunk/crossfire/src/cfeditor/gui/prefs/GUIPrefs.java trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java trunk/crossfire/src/cfeditor/gui/prefs/package.html trunk/crossfire/src/cfeditor/io/PathManager.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/COptionDialog.java Added: trunk/crossfire/resource/icons/development/Host24.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/development/Host24.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/Open16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/Open16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/Save24.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/Save24.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-12-10 13:34:04 UTC (rev 1004) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-12-10 13:37:25 UTC (rev 1005) @@ -24,6 +24,7 @@ package cfeditor; +import static cfeditor.CMainControl.PREFS_LANGUAGE; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; @@ -31,6 +32,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; @@ -51,6 +53,12 @@ * @param args The command line parameters given to the level editor. */ public static void main(final String[] args) { + // Make sure the locale is set before any ActionFactory is used. + final String locName = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(PREFS_LANGUAGE, null); + if (locName != null) { + Locale.setDefault(new Locale(locName)); + } + // Now add prefs to the ActionFactory. final ActionFactory actionFactory = ActionFactory.getFactory("cfeditor"); actionFactory.addParent(ActionFactory.getFactory("net.sf.gridarta")); final List<String> infiles = new ArrayList<String>(); // map file names to open initially Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-10 13:34:04 UTC (rev 1004) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-10 13:37:25 UTC (rev 1005) @@ -30,6 +30,8 @@ import cfeditor.gameobject.anim.AnimationObjects; import cfeditor.gameobject.face.FaceObjects; import cfeditor.gui.map.MapPropertiesDialog; +import cfeditor.gui.prefs.GUIPrefs; +import cfeditor.gui.prefs.ResPrefs; import cfeditor.io.CMapReader; import cfeditor.io.CMapWriter; import cfeditor.map.MapArchObject; @@ -41,6 +43,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import javax.swing.ImageIcon; import javax.swing.JFileChooser; @@ -51,6 +54,7 @@ import javax.swing.UnsupportedLookAndFeelException; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.MainControl; +import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.Collectable; import net.sf.gridarta.gameobject.Collector; import net.sf.gridarta.gui.HideFileFilterProxy; @@ -58,6 +62,8 @@ import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ActionMethod; +import net.sf.japi.swing.prefs.PreferencesGroup; +import static net.sf.japi.swing.prefs.PreferencesPane.showPreferencesDialog; import net.sf.japi.util.ThrowableHandler; import net.sf.japi.util.filter.file.EndingFileFilter; import org.apache.log4j.Logger; @@ -82,14 +88,17 @@ private static final String DOCU_VERSION_KEY = "docuVersion"; - private static final String USE_IMAGESET = "useImageSet"; + public static final String USE_IMAGESET = "useImageSet"; private static final String USE_FONT = "useFont"; - private static final String LOAD_ARCH_COLL = "loadArchFromCollection"; + public static final String LOAD_ARCH_COLL = "loadArchFromCollection"; public static final String PICKMAPS_LOCKED = "pickmapsLocked"; + /** Preferences key for language. */ + public static final String PREFS_LANGUAGE = "language"; + /** The main view. */ private final CMainView mainView; @@ -348,11 +357,31 @@ currentMap.getMapViewFrame().setMapAndArchPosition(gameObject, pos); } - /** - * Set all global settings (mostly read from the - * 'CFJavaEditor.ini'-file) - */ - private void readGlobalSettings() { + /** Set all global settings from the preferences. */ + public void readGlobalSettings() { + imageSet = new String(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(USE_IMAGESET, "base")); + if (imageSet.equalsIgnoreCase("none")) { + imageSet = null; + } + initDirs(); + + loadFromArchive = new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(LOAD_ARCH_COLL, "true")).booleanValue(); + + getMainView().setMapTileListBottom(new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(CMainView.MAP_TILE_LIST_BOTTOM_KEY, Boolean.toString(CMainView.MAP_TILE_LIST_BOTTOM_DEFAULT))).booleanValue()); + + setLockAllPickmaps(new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(PICKMAPS_LOCKED, "false")).booleanValue()); + + // docu version + if (IGUIConstants.DOCU_VERSION > (new Integer(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(DOCU_VERSION_KEY, "0"))).intValue()) { + // remember to open docu + autoPopupDocu = true; + // update docu version right now, because we want the help popup only one time + CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(DOCU_VERSION_KEY, String.valueOf(IGUIConstants.DOCU_VERSION)); + } + } + + /** (Re-)initializes the directories. */ + public void initDirs() { // Get the directories strMapDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(ResourceFileManager.MAP_DIR_KEY, ResourceFileManager.DEFAULT_MAP_DIR); strArchDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(ResourceFileManager.ARCH_DIR_KEY, ResourceFileManager.DEFAULT_ARCH_DIR); @@ -373,25 +402,6 @@ !mapDir.isAbsolute() && !hasChangedDir) { mapDir = new File(currentDir.getAbsolutePath(), mapDir.getPath()); } - - imageSet = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(USE_IMAGESET, "base"); - if (imageSet.equalsIgnoreCase("none")) { - imageSet = null; - } - - loadFromArchive = Boolean.valueOf(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(LOAD_ARCH_COLL, "true")); - - getMainView().setMapTileListBottom(Boolean.valueOf(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(CMainView.MAPTILE_BOTTOM_KEY, "false"))); - - setLockAllPickmaps(Boolean.valueOf(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(PICKMAPS_LOCKED, "false"))); - - // docu version - if (IGUIConstants.DOCU_VERSION > new Integer(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(DOCU_VERSION_KEY, "0"))) { - // remember to open docu - autoPopupDocu = true; - // update docu version right now, because we want the help popup only one time - CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(DOCU_VERSION_KEY, String.valueOf(IGUIConstants.DOCU_VERSION)); - } } /** @@ -404,18 +414,7 @@ * @param mapTileBottom <code>true</code> if the map tile list should be displayed on the window bottom, otherwise (right border) <code>false</code>. */ void setGlobalSettings(final String arch, String map, final String script, final boolean baseImageSet, final boolean load, final boolean mapTileBottom) { - map = map.replace('\\', '/'); - if (map.endsWith("/")) { - map = map.substring(0, map.length() - 1); // path should not end with slash - } - - CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(ResourceFileManager.ARCH_DIR_KEY, arch); - CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(ResourceFileManager.MAP_DIR_KEY, map); - CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(ResourceFileManager.SCRIPT_DIR_KEY, script); - CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(USE_IMAGESET, baseImageSet ? "base" : "none"); - CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(LOAD_ARCH_COLL, load ? "true" : "false"); - CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(CMainView.MAPTILE_BOTTOM_KEY, mapTileBottom ? "true" : "false"); CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(PICKMAPS_LOCKED, pickmapsLocked ? "true" : "false"); readGlobalSettings(); @@ -1126,8 +1125,17 @@ void toggleShowTiles() { } + private PreferencesGroup prefsGroup; + public void options() { - new COptionDialog(this, mainView); + if (prefsGroup == null) { + prefsGroup = new PreferencesGroup( + "Gridarta for Daimonin", + new ResPrefs(this), + new GUIPrefs(this) + ); // prefsGroup + } + showPreferencesDialog(mainView, prefsGroup, false); } void setLockAllPickmaps(final boolean state) { Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-12-10 13:34:04 UTC (rev 1004) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-12-10 13:37:25 UTC (rev 1005) @@ -89,8 +89,11 @@ private static final String DIVIDER_LOCATION_KEY3 = "MainWindow.dividerLocation3"; /** Key for info whether map-tile panel is seperate or at bottom. */ - public static final String MAPTILE_BOTTOM_KEY = "MapTileBottom"; + public static final String MAP_TILE_LIST_BOTTOM_KEY = "MapTileBottom"; + /** Default value for {@link #MAP_TILE_LIST_BOTTOM_KEY}. */ + public static final boolean MAP_TILE_LIST_BOTTOM_DEFAULT = false; + /** Border size for the split panes. */ private static final int BORDER_SIZE = 5; Deleted: trunk/crossfire/src/cfeditor/COptionDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/COptionDialog.java 2006-12-10 13:34:04 UTC (rev 1004) +++ trunk/crossfire/src/cfeditor/COptionDialog.java 2006-12-10 13:37:25 UTC (rev 1005) @@ -1,270 +0,0 @@ -/* - * Crossfire Java Editor. - * Copyright (C) 2000 Michael Toennies - * Copyright (C) 2001 Andreas Vogl - * - * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - */ - -package cfeditor; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Frame; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import javax.swing.border.EtchedBorder; -import javax.swing.border.TitledBorder; - -/** - * Dialog used to ask the user the properties for the new level. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - */ -public final class COptionDialog extends CDialogBase { - - private final JTextField m_archField; - - private final JTextField m_mapField; - - private final JTextField m_scriptField; - - private final JCheckBox m_loadArches; // load arches from collected archives? - - private JComboBox m_ImageSet; // selection box for Image Set - - private final JCheckBox m_mapPanelBottom; // is map-tile panel in bottom panel? - - private static final long serialVersionUID = 1L; - - /** - * Constructs a new option dialog. - * @param mainControl The controller of this dialog. - * @param parentFrame The parent frame of this dialog. - */ - COptionDialog(final CMainControl mainControl, final Frame parentFrame) { - super(parentFrame, "Options"); - getContentPane().setLayout(new BorderLayout()); - - final JPanel mainPanel = new JPanel(); - mainPanel.setBorder(new EmptyBorder( - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS)); - mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); - - // --- Resource Path --- - final JPanel optionPathPanel = new JPanel(); - optionPathPanel.setLayout(new BoxLayout(optionPathPanel, BoxLayout.Y_AXIS)); - optionPathPanel.setBorder(new CompoundBorder( - new TitledBorder(new EtchedBorder(), "Resource Path"), - new EmptyBorder( - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS))); - - final JPanel archPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - archPanel.add(new JLabel("Archfiles: ")); - m_archField = new JTextField(16); - m_archField.setText(mainControl.getArchDefaultFolder()); - archPanel.add(m_archField); - optionPathPanel.add(archPanel); - - final JPanel mapPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - mapPanel.add(new JLabel("Maps: ")); - m_mapField = new JTextField(16); - m_mapField.setText(mainControl.getMapDefaultFolder()); - mapPanel.add(m_mapField); - optionPathPanel.add(mapPanel); - - final JPanel scriptPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - scriptPanel.add(new JLabel("Scripts: ")); - m_scriptField = new JTextField(16); - m_scriptField.setText(mainControl.getScriptDefaultFolder()); - scriptPanel.add(m_scriptField); - - mainPanel.add(optionPathPanel); - - // --- globals --- - final JPanel optionPartPanel = new JPanel(new GridLayout(2, 1)); - optionPartPanel.setBorder(new CompoundBorder( - new TitledBorder(new EtchedBorder(), "Globals"), - new EmptyBorder( - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS))); - - final JPanel cbox; - if (mainControl.getImageSet() != null) { - cbox = buildImageSetBox(mainControl.getImageSet().equalsIgnoreCase("base")); - } else { - cbox = buildImageSetBox(false); - } - optionPartPanel.add(cbox); - - m_loadArches = new JCheckBox(" Load Arches from Collection"); - m_loadArches.setSelected(mainControl.isArchLoadedFromCollection()); - m_loadArches.addActionListener(new SelectArchLoadAL(m_loadArches, this)); - optionPartPanel.add(m_loadArches); - if (mainControl.isArchLoadedFromCollection()) { - m_archField.setEnabled(false); - } - - mainPanel.add(optionPartPanel); - - // --- layout settings --- - final JPanel optionLayoutPanel = new JPanel(new GridLayout(2, 1)); - optionLayoutPanel.setBorder(new CompoundBorder( - new TitledBorder(new EtchedBorder(), "Layout Settings"), - new EmptyBorder( - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS))); - - m_mapPanelBottom = new JCheckBox(" Separate Map-Tile Panel"); - m_mapPanelBottom.setSelected(!mainControl.getMainView().isMapTileListBottom()); - optionLayoutPanel.add(m_mapPanelBottom); - optionLayoutPanel.add(new JLabel("(Takes effect on next application start)")); - mainPanel.add(optionLayoutPanel); - - // --- button line --- - final JPanel buttonPanel = new JPanel(); - buttonPanel.setBorder(new EmptyBorder( - IGUIConstants.SPACE_BETWEEN_BUTTON_AREA_AND_MAIN_DIALOG, - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS)); - buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); - buttonPanel.add(Box.createGlue()); - - /* - final JButton button = new JButton("Restore"); - button.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent event) { - } - }); - buttonPanel.add(button); - - buttonPanel.add(Box.createRigidArea( - new Dimension(IGUIConstants.SPACE_BETWEEN_BUTTON_GROUPS, 1))); - */ - final JButton okButton = new JButton("OK"); - okButton.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.setGlobalSettings(m_archField.getText(), - m_mapField.getText(), m_scriptField.getText(), - m_ImageSet.getSelectedIndex() != 0, - m_loadArches.isSelected(), !m_mapPanelBottom.isSelected()); - dispose(); - } - }); - buttonPanel.add(okButton); - - buttonPanel.add(Box.createRigidArea( - new Dimension(IGUIConstants.SPACE_BETWEEN_BUTTONS, 1))); - - final JButton cancelButton = new JButton("Cancel"); - cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent event) { - dispose(); - } - }); - buttonPanel.add(cancelButton); - - getContentPane().add(mainPanel, BorderLayout.CENTER); - getContentPane().add(buttonPanel, BorderLayout.SOUTH); - pack(); - setVisible(true); - } - - /** - * Creates the ComboBox for the selection of Image Sets. - * @param baseSet <code>true</code> to select the base set, otherwise <code>false</code>. - * @return A Panel with the combobox plus label. - */ - /** Construct the Combo box for the selection of Image Sets. */ - private JPanel buildImageSetBox(final boolean baseSet) { - final JPanel lineLayout = new JPanel(new FlowLayout(FlowLayout.RIGHT)); // layout for this line - - // list of available Image Sets: - final String []list = new String[2]; - list[0] = " Disabled"; - list[1] = " Base"; - - lineLayout.add(new JLabel("Use Image Set: ")); // create label - - m_ImageSet = new JComboBox(list); // set "content" - m_ImageSet.setPreferredSize(new Dimension(150, 25)); - m_ImageSet.setSelectedIndex(baseSet ? 1 : 0); // set active selection - - m_ImageSet.setBackground(Color.white); // white background - m_ImageSet.setName("Image Set"); - - lineLayout.add(m_ImageSet); - return lineLayout; - } - - /** - * Action-listener for the checkbox "Load Arches from Collection". - * While it is selected, the arch path should be disabled. - * @todo Turn this into an Action. - */ - private final class SelectArchLoadAL implements ActionListener { - - final COptionDialog frame; // the frame (options dialog window) - - final JCheckBox cbox; // input checkbox - - public SelectArchLoadAL(final JCheckBox cbox, final COptionDialog frame) { - this.cbox = cbox; - this.frame = frame; - } - - /** {@inheritDoc} */ - public void actionPerformed(final ActionEvent event) { - // state has changed - if (cbox.isSelected()) { - m_archField.setEnabled(false); - frame.update(frame.getGraphics()); - } else { - m_archField.setEnabled(true); - frame.update(frame.getGraphics()); - } - } - - } // class SelectArchLoadAL - -} // class COptionDialog Modified: trunk/crossfire/src/cfeditor/CSettings.java =================================================================== --- trunk/crossfire/src/cfeditor/CSettings.java 2006-12-10 13:34:04 UTC (rev 1004) +++ trunk/crossfire/src/cfeditor/CSettings.java 2006-12-10 13:37:25 UTC (rev 1005) @@ -134,7 +134,9 @@ public synchronized String getProperty(final String strKey, final String strDefaultValue) { final String strValue = properties.getProperty(strKey); if (strValue == null) { - setProperty(strKey, strDefaultValue); + if (strDefaultValue != null) { + setProperty(strKey, strDefaultValue); + } return strDefaultValue; } return strValue; Modified: trunk/crossfire/src/cfeditor/action.properties =================================================================== --- trunk/crossfire/src/cfeditor/action.properties 2006-12-10 13:34:04 UTC (rev 1004) +++ trunk/crossfire/src/cfeditor/action.properties 2006-12-10 13:37:25 UTC (rev 1005) @@ -2,3 +2,8 @@ # See http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding ActionFactory.additionalBundles=cfeditor.messages +# Extend this if you add a new locale. The order is irrelevant. +availableLocales=en de fr sv + +prefsRes.icon=general/Save24 +prefsGUI.icon=development/Host24 Added: trunk/crossfire/src/cfeditor/gui/prefs/GUIPrefs.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/prefs/GUIPrefs.java (rev 0) +++ trunk/crossfire/src/cfeditor/gui/prefs/GUIPrefs.java 2006-12-10 13:37:25 UTC (rev 1005) @@ -0,0 +1,188 @@ +/* + * Daimonin Java Editor. + * Copyright (C) 2005 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package cfeditor.gui.prefs; + +import cfeditor.CMainControl; +import static cfeditor.CMainControl.PREFS_LANGUAGE; +import static cfeditor.CMainView.MAP_TILE_LIST_BOTTOM_DEFAULT; +import static cfeditor.CMainView.MAP_TILE_LIST_BOTTOM_KEY; +import cfeditor.CSettings; +import cfeditor.IGUIConstants; +import static cfeditor.IGUIConstants.DIALOG_BORDER; +import java.awt.Component; +import static java.util.Arrays.binarySearch; +import static java.util.Arrays.sort; +import java.util.Locale; +import java.util.prefs.Preferences; +import javax.swing.Box; +import static javax.swing.Box.createHorizontalBox; +import static javax.swing.Box.createVerticalBox; +import static javax.swing.Box.createVerticalGlue; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.border.Border; +import javax.swing.border.CompoundBorder; +import javax.swing.border.TitledBorder; +import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.LocaleComparator; +import net.sf.japi.swing.LocaleListCellRenderer; +import net.sf.japi.swing.prefs.AbstractPrefs; + +/** + * Preferences Module for user interface preferences. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @serial exclude + */ +public final class GUIPrefs extends AbstractPrefs { + + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + + private final CMainControl mainControl; + + /** ComboBox for choosing the locale. */ + private JComboBox localeBox; + + /** Wether to place the map tile panel at the bottom or the right. */ + private JCheckBox mapPanelBottom; + + /** Locale[]. */ + private Locale[] locales; + + /** LocaleComparator. */ + private LocaleComparator comp = new LocaleComparator(); + + /** + * Create a GUIPrefs pane. + */ + public GUIPrefs(final CMainControl mainControl) { + this.mainControl = mainControl; + + setListLabelText(ACTION_FACTORY.getString("prefsGUI.title")); + setListLabelIcon(ACTION_FACTORY.getIcon("prefsGUI.icon")); + + add(createGlobalPanel()); + add(createLayoutPanel()); + add(createVerticalGlue()); + } + + /** + * Create a titled border. + * @param titleKey Action Key for border title + * @return titled border + */ + private static Border createTitledBorder(final String titleKey) { + return new CompoundBorder(new TitledBorder(ACTION_FACTORY.getString(titleKey)), DIALOG_BORDER); + } + + /** {@inheritDoc} */ + public void apply() { + final Locale loc = (Locale) localeBox.getSelectedItem(); + if (loc != null) { + CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(PREFS_LANGUAGE, loc.getLanguage()); + } else { + CSettings.getInstance(IGUIConstants.APP_NAME).clearProperty(PREFS_LANGUAGE); + } + CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(MAP_TILE_LIST_BOTTOM_KEY, mapPanelBottom.isSelected() ? "true" : "false"); + mainControl.readGlobalSettings(); + mainControl.refreshMenusAndToolbars(); + } + + /** {@inheritDoc} */ + public void revert() { + final String current = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(PREFS_LANGUAGE, null); + localeBox.setSelectedIndex(binarySearch(locales, current != null ? new Locale(current) : null, comp)); + mapPanelBottom.setSelected(new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(MAP_TILE_LIST_BOTTOM_KEY, Boolean.toString(MAP_TILE_LIST_BOTTOM_DEFAULT))).booleanValue()); + } + + /** {@inheritDoc} */ + public void defaults() { + localeBox.setSelectedIndex(binarySearch(locales, null, comp)); + mapPanelBottom.setSelected(MAP_TILE_LIST_BOTTOM_DEFAULT); + } + + /** {@inheritDoc} */ + public boolean isChanged() { + final Locale loc = (Locale) localeBox.getSelectedItem(); + final String currentName = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(PREFS_LANGUAGE, null); + final Locale current = currentName != null ? new Locale(currentName) : null; + return !( + (loc == null ? loc == current : loc.equals(current)) + && mapPanelBottom.isSelected() == new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(MAP_TILE_LIST_BOTTOM_KEY, Boolean.toString(MAP_TILE_LIST_BOTTOM_DEFAULT))).booleanValue()); + } + + /** + * Construct the Combo box for the selection of locales. + * @return combo box with locales to select + */ + private Component buildLocaleBox() { + final Box lineLayout = createHorizontalBox(); + + final String[] locNames = ACTION_FACTORY.getString("availableLocales").split("\\s+"); + locales = new Locale[locNames.length + 1]; + // locales[0] is intentionally null. It will be displayed as default and always get sorted to the top. + for (int i = 0; i < locNames.length; i++) { + locales[i + 1] = new Locale(locNames[i]); + } + sort(locales, comp); + + lineLayout.add(new JLabel(ACTION_FACTORY.getString("optionsLanguage"))); // create label + + localeBox = new JComboBox(locales); // set "content" + localeBox.setRenderer(new LocaleListCellRenderer()); + //localeBox.setPreferredSize(new Dimension(150, 25)); + final String current = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(PREFS_LANGUAGE, null); + localeBox.setSelectedIndex(binarySearch(locales, current != null ? new Locale(current) : null, comp)); + + lineLayout.add(localeBox); + return lineLayout; + } + + /** + * Creates the subpanel with the global settings. + * @return subpanel + */ + private Component createGlobalPanel() { + final Box globalPanel = createVerticalBox(); + globalPanel.setBorder(createTitledBorder("optionsGlobal")); + + globalPanel.add(buildLocaleBox()); + + return globalPanel; + } + + /** + * Creates the subpanel with the layout settings. + * @return subpanel + */ + private Component createLayoutPanel() { + final Box layoutPanel = createVerticalBox(); + layoutPanel.setBorder(createTitledBorder("optionsLayout")); + + mapPanelBottom = new JCheckBox(ACTION_FACTORY.createAction(false, "optionsSepMapTile")); + mapPanelBottom.setSelected(new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(MAP_TILE_LIST_BOTTOM_KEY, Boolean.toString(MAP_TILE_LIST_BOTTOM_DEFAULT))).booleanValue()); + layoutPanel.add(mapPanelBottom); + return layoutPanel; + } + +} // class GUIPrefs Property changes on: trunk/crossfire/src/cfeditor/gui/prefs/GUIPrefs.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java (rev 0) +++ trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2006-12-10 13:37:25 UTC (rev 1005) @@ -0,0 +1,314 @@ +/* + * Daimonin Java Editor. + * Copyright (C) 2005 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package cfeditor.gui.prefs; + +import cfeditor.CMainControl; +import cfeditor.CSettings; +import cfeditor.IGUIConstants; +import static cfeditor.IGUIConstants.DIALOG_BORDER; +import cfeditor.ResourceFileManager; +import cfeditor.io.PathManager; +import java.awt.Component; +import java.awt.Container; +import java.awt.FlowLayout; +import static java.util.Arrays.sort; +import java.util.prefs.Preferences; +import javax.swing.Box; +import static javax.swing.Box.createHorizontalBox; +import static javax.swing.Box.createVerticalBox; +import static javax.swing.Box.createVerticalGlue; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import static javax.swing.JFileChooser.DIRECTORIES_ONLY; +import javax.swing.JLabel; +import static javax.swing.JOptionPane.WARNING_MESSAGE; +import javax.swing.JTextField; +import javax.swing.border.Border; +import javax.swing.border.CompoundBorder; +import javax.swing.border.TitledBorder; +import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.JFileChooserButton; +import net.sf.japi.swing.prefs.AbstractPrefs; + +/** + * Preferences Module for resource preferences. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @serial exclude + */ +public final class ResPrefs extends AbstractPrefs { + + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + + /** Main Control. */ + private final CMainControl mainControl; + + /** TextField for arch directory path. */ + private FileField archField; + + /** TextField for map directory path. */ + private FileField mapField; + + /** TextField for script directory path. */ + private FileField scriptField; + + /** Checbox whether arches are to be loaded from collection. */ + private JCheckBox loadArches; + + /** ComboBox for choosing the image set. */ + private JComboBox imageSetBox; + + /** Contains all supported image sets. */ + private String[] imageSets; + + /** + * Create a ResPrefs pane. + * @param mainControl The controller of this dialog. + */ + public ResPrefs(final CMainControl mainControl) { + setListLabelText(ACTION_FACTORY.getString("prefsRes.title")); + setListLabelIcon(ACTION_FACTORY.getIcon("prefsRes.icon")); + this.mainControl = mainControl; + + add(createResourcePanel()); + add(createGlobalPanel()); + add(createVerticalGlue()); + } + + /** + * Create a titled border. + * @param titleKey Action Key for border title + * @return titled border + */ + private static Border createTitledBorder(final String titleKey) { + return new CompoundBorder(new TitledBorder(ACTION_FACTORY.getString(titleKey)), DIALOG_BORDER); + } + + /** {@inheritDoc} */ + public void apply() { + CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(ResourceFileManager.ARCH_DIR_KEY, PathManager.path(archField.getText())); + CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(ResourceFileManager.MAP_DIR_KEY, PathManager.path(mapField.getText())); + CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(ResourceFileManager.SCRIPT_DIR_KEY, PathManager.path(scriptField.getText())); + CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(CMainControl.LOAD_ARCH_COLL, loadArches.isSelected() ? "true" : "false"); + + final String imageSet = (String) imageSetBox.getSelectedItem(); + CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(CMainControl.USE_IMAGESET, imageSet == null || imageSet.equals("disabled") ? "none" : imageSet); + + mainControl.readGlobalSettings(); + mainControl.refreshMenusAndToolbars(); + ACTION_FACTORY.showOnetimeMessageDialog(this, WARNING_MESSAGE, "optionsRestart"); + } + + /** {@inheritDoc} */ + public void revert() { + archField.setText(mainControl.getArchDefaultFolder()); + mapField.setText(mainControl.getMapDefaultFolder()); + scriptField.setText(mainControl.getScriptDefaultFolder()); + loadArches.setSelected(mainControl.isArchLoadedFromCollection()); + imageSetBox.setSelectedIndex(linearSearch(imageSets, getCurrentImageSet())); + } + + /** {@inheritDoc} */ + public void defaults() { + archField.setText(ResourceFileManager.DEFAULT_ARCH_DIR); + mapField.setText(ResourceFileManager.DEFAULT_MAP_DIR); + scriptField.setText(ResourceFileManager.DEFAULT_SCRIPT_DIR); + loadArches.setSelected(true); + imageSetBox.setSelectedIndex(linearSearch(imageSets, "disabled")); + } + + /** {@inheritDoc} */ + public boolean isChanged() { + final String selectedimageSet = (String) imageSetBox.getSelectedItem(); + final String imageSet = selectedimageSet == null ? "disabled" : selectedimageSet; + return !( + archField.getText().equals(mainControl.getArchDefaultFolder()) + && mapField.getText().equals(mainControl.getMapDefaultFolder()) + && scriptField.getText().equals(mainControl.getScriptDefaultFolder()) + && loadArches.isSelected() == new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(CMainControl.LOAD_ARCH_COLL, Boolean.toString(mainControl.isArchLoadedFromCollection()))).booleanValue() + && imageSet.equals(getCurrentImageSet())); + } + + /** + * Toggle action method for loading arches from collection. + * @param loadArchColl whether to load arches from collection + * @used + */ + public void setOptionsLoadArchColl(final boolean loadArchColl) { + archField.setEnabled(!loadArchColl); + } + + /** + * Toggle action method for loading arches from collection. + * @return whether arches are loaded from collection + * @used + */ + public boolean isOptionsLoadArchColl() { + return !archField.isEnabled(); + } + + /** + * Creates the subpanel with the resource paths. + * @return subpanel + */ + private Component createResourcePanel() { + final Box resourcePanel = createVerticalBox(); + resourcePanel.setBorder(createTitledBorder("optionsResPaths")); + archField = createFileField(resourcePanel, "optionsResArch", mainControl.getArchDefaultFolder(), DIRECTORIES_ONLY); + mapField = createFileField(resourcePanel, "optionsResMaps", mainControl.getMapDefaultFolder(), DIRECTORIES_ONLY); + scriptField = createFileField(resourcePanel, "optionsResScripts", mainControl.getScriptDefaultFolder(), DIRECTORIES_ONLY); + return resourcePanel; + } + + /** + * Creates the subpanel with the global settings. + * @return subpanel + */ + private Component createGlobalPanel() { + final Box globalPanel = createVerticalBox(); + globalPanel.setBorder(createTitledBorder("optionsGlobal")); + + loadArches = new JCheckBox(ACTION_FACTORY.createToggle(false, "optionsLoadArchColl", this)); + loadArches.setSelected(mainControl.isArchLoadedFromCollection()); + globalPanel.add(loadArches); + if (mainControl.isArchLoadedFromCollection()) { + archField.setEnabled(false); + } + + globalPanel.add(buildImageSetBox()); + + return globalPanel; + } + + /** + * Construct the Combo box for the selection of image sets. + * @return combo box with image sets to select + */ + private Component buildImageSetBox() { + final Box lineLayout = createHorizontalBox(); + + final String[] imageSetNames = ACTION_FACTORY.getString("availableImageSets").split("\\s+"); + sort(imageSetNames); + imageSets = new String[imageSetNames.length + 1]; + imageSets[0] = "disabled"; + System.arraycopy(imageSetNames, 0, imageSets, 1, imageSetNames.length); + + lineLayout.add(new JLabel(ACTION_FACTORY.getString("optionsImageSet"))); // create label + + imageSetBox = new JComboBox(imageSets); // set "content" + imageSetBox.setSelectedIndex(linearSearch(imageSets, getCurrentImageSet())); + + lineLayout.add(imageSetBox); + return lineLayout; + } + + /** + * Creats a textpanel for choosing a file and adds it to another panel. + * @param panel JPanel to add field to + * @param key Key for label + * @param initial Initial value for textfield + * @param fileSelectionMode file selection mode + * @return the created JTextField + */ + private static FileField createFileField(final Container panel, final String key, final String initial, final int fileSelectionMode) { + final FileField fileField = new FileField(ACTION_FACTORY.getString(key), initial, fileSelectionMode); + final String tooltip = ACTION_FACTORY.getString(key + ".shortdescription"); + if (tooltip != null) { + fileField.setToolTipText(tooltip); + } + panel.add(fileField); + return fileField; + } + + private static int linearSearch(final String[] a, final String key) { + for (int i = 0; i < a.length; i++) { + if (a[i].equals(key)) { + return i; + } + } + + return -1; + } + + private static String getCurrentImageSet() { + final String imageSet = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(CMainControl.USE_IMAGESET, "none"); + return imageSet.equals("none") ? "disabled" : imageSet; + } + + /** Class for selecting a file. + * @todo replace with JFileField from JAPI + */ + private static class FileField extends JComponent { + + /** The label. */ + private final JLabel label; + + /** The file field. */ + private final JTextField fileField; + + /** The button to start the JFileChooser. */ + private final JFileChooserButton chooserButton; + + /** + * Create a FileField. + * @param labelText the text for the label + * @param initial the initial path + * @param fileSelectionMode the mode for the file selection + */ + private FileField(final String labelText, final String initial, final int fileSelectionMode) { + setLayout(new FlowLayout(FlowLayout.RIGHT)); + fileField = new JTextField(initial, 16); + chooserButton = new JFileChooserButton(fileField, fileSelectionMode); + label = new JLabel(labelText); + add(label); + add(fileField); + add(chooserButton); + } + + /** {@inheritDoc} */ + @Override public void setEnabled(final boolean enabled) { + super.setEnabled(enabled); + fileField.setEnabled(enabled); + chooserButton.setEnabled(enabled); + label.setEnabled(enabled); + } + + /** + * Set the text, which is the filename. + * @param text filename + */ + public void setText(final String text) { + fileField.setText(text); + } + + /** + * Get the text, which is the filename. + * @return text (filename) + */ + public String getText() { + return fileField.getText(); + } + + } // class FileField + +} // class ResPrefs Property changes on: trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/crossfire/src/cfeditor/gui/prefs/package.html =================================================================== --- trunk/crossfire/src/cfeditor/gui/prefs/package.html (rev 0) +++ trunk/crossfire/src/cfeditor/gui/prefs/package.html 2006-12-10 13:37:25 UTC (rev 1005) @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> + <head> + <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> + <title></title> + </head> + <body> + <p>This package contains the preferences ui modules.</p> + </body> +</html> Property changes on: trunk/crossfire/src/cfeditor/gui/prefs/package.html ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/crossfire/src/cfeditor/io/PathManager.java =================================================================== --- trunk/crossfire/src/cfeditor/io/PathManager.java (rev 0) +++ trunk/crossfire/src/cfeditor/io/PathManager.java 2006-12-10 13:37:25 UTC (rev 1005) @@ -0,0 +1,215 @@ +/* + * Daimonin Java Editor. + * Copyright (C) 2005 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package cfeditor.io; + +import cfeditor.CMainControl; +import java.io.File; +import java.io.IOException; + +/** + * This class contains methods for converting relative map paths to absolute map paths and vice versa. + * Serverside, paths to maps always are URIs with the maps directory being the root directory for the maps. + * Therefore it makes sense to treat them as URIs in the editor as well. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @todo make more use of URI + * @todo This class knows CMainControl. The dependency should be flipped: instead CMainControl should use this class. Then this class could be used by crossfire, too. + */ +public final class PathManager { + + // NOTE: There are certainly faster algorithms. But these methods are rarely used. + + /** + * Private constructor. + * There are only static methods, so prevent this class from being instanciated. + */ + private PathManager() { + } + + /** + * Create arch path. + * Replaces all occurences of '\' with '/' and removes the path to the arch directory (absolute, relative or canonical) from the path. + * @param path to create arch path from + * @return fixed path + */ + public static String getArchPath(final String path) { + final String archDirName = CMainControl.getInstance().getArchDefaultFolder(); + String archPath = path.replace('\\', '/'); + if (archPath.startsWith(archDirName)) { + archPath = archPath.substring(archDirName.length()); + } + if (archPath.startsWith(new File(archDirName).getAbsolutePath())) { + archPath = archPath.substring(new File(archDirName).getAbsolutePath().length()); + } + archPath = archPath.replace('\\', '/'); + return archPath; + } + + /** + * Create map path. + * Replaces all occurences of '\' with '/' and removes the path to the map directory (absolute, relative or canonical) from the path. + * @param path to create map path from + * @return fixed path + * @throws IOException In case of problems converting / creating the map path. + */ + public static String getMapPath(final String path) throws IOException { + final String mapDirName = CMainControl.getInstance().getMapDefaultFolder(); + String mapPath = path.replace('\\', '/'); + if (mapPath.startsWith(mapDirName)) { + mapPath = mapPath.substring(mapDirName.length()); + } + if (mapPath.startsWith(new File(mapDirName).getAbsolutePath())) { + mapPath = mapPath.substring(new File(mapDirName).getAbsolutePath().length()); + } + if (mapPath.startsWith(new File(mapDirName).getCanonicalPath())) { + mapPath = mapPath.substring(new File(mapDirName).getCanonicalPath().length()); + } + mapPath = mapPath.replace('\\', '/'); + return mapPath; + } + + /** + * Check whether a path is absolute. + * Paths starting with "/" are absolute, paths starting with other characters are relative. + * Empty paths are neither relative nor absolute. + * @param path Path to check + * @return <code>true</code> if <var>path</var> is absolute, <code>false</code> otherwise + * @see #isRelative(String) which nearly is the opposite of this method + */ + public static boolean isAbsolute(final String path) { + return path.startsWith("/") || new File(path).isAbsolute(); + } + + /** + * Check whether a path is relative. + * Paths not starting with "/" are relative, paths starting with are absolute. + * Empty paths are neither relative nor absolute. + * @param path Path to check + * @return <code>true</code> if <var>path</var> is relative, <code>false</code> otherwise + * @see #isAbsolute(String) which nearly is the opposite of this method + */ + public static boolean isRelative(final String path) { + return !path.startsWith("/") && !new File(path).isAbsolute(); + } + + /** + * Converts a relative path to an absolute path. + * If the path already is relative, this method simply returns the path. + * @param reference reference file the relative path works on (regular file, not directory) + * @param relative destination file with relative path + * @return absolute path from the base directory + */ + public static String relativeToAbsolute(final String reference, final String relative) { + if (reference.contains("\\") || relative.contains("\\")) { + return relativeToAbsolute(reference.replace('\\', '/'), relative.replace('\\', '/')); + } + if (isAbsolute(relative)) { + return relative; + } + String work = reference.substring(0, reference.lastIndexOf("/") + 1) + relative; // + 1 to include the "/" + String work2; + do { + work2 = work; + work = work2.replaceAll("[^/]+/\\.\\./", ""); + } while (!work2.equals(work)); + return work; + } + + /** + * Converts an absolute path to a relative path. + * If the path already is absolute, this method simply returns the path. + * @param reference reference file the relative path works on (regular file, not directory) + * @param absolute destination file with relative path + * @return absolute path from the base directory + */ + public static String absoluteToRelative(final String reference, final String absolute) { + if (reference.contains("\\") || absolute.contains("\\")) { + return absoluteToRelative(reference.replace('\\', '/'), absolute.replace('\\', '/')); + } + if (isRelative(absolute)) { + return absolute; + } + //String reference2 = + // First: Strip equal path parts + final int difference = findDifference(reference, absolute); + final StringBuilder relative = new StringBuilder(absolute.substring(difference)); + final String referencePath = reference.substring(difference); + for (int i = 0, l = findOccurrences(referencePath, '/'); i < l; i++) { + relative.insert(0, "../"); + } + return relative.toString(); + } + + /** + * Helper method that returns the first string index at which two strings denoting paths aren't identical. + * That is, the index always points at the beginning or a '/'-character. + * The return value of this method is in every case good for a String.substring() invocation start index. + * @param s1 first string to compare + * @param s2 second string to compare + * @return index of first / after which s1 and s2 aren't identical or 0 if they differ from start + */ + private static int findDifference(final String s1, final String s2) { + int s1slash = -1; + int s2slash = -1; + char c1 = (char) 0; // initialize for equality for first loop cycle + char c2 = (char) 0; + for (int index = 0, l1 = s1.length(), l2 = s2.length(); index < l1 && index < l2 && c1 == c2; index++) { + c1 = s1.charAt(index); + c2 = s2.charAt(index); + if (c1 == '/') { + s1slash = index; + } + if (c2 == '/') { + s2slash = index; + } + } + return Math.min(s1slash, s2slash) + 1; + } + + /** + * Counts the occurrences of a character within a string. + * @param s String to count in + * @param c character to count + * @return number of occurences of <var>c</var> in <var>s</var> + */ + private static int findOccurrences(final String s, final char c) { + int occurrences = 0; + for (int i = 0, l = s.length(); i < l; i++) { + if (s.charAt(i) == c) { + occurrences++; + } + } + return occurrences; + } + + /** + * Create a reasonable path. + * @param str String to create path from + * @return path + */ + public static String path(final String str) { + String path = str.replaceAll("\\\\", "/"); + path = path.endsWith("/") ? path.substring(0, path.length() - 1) : path; + path = path.startsWith("file:") ? path.substring("file:".length()) : path; + return path; + } + +} // class PathManager Property changes on: trunk/crossfire/src/cfeditor/io/PathManager.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2006-12-10 13:34:04 UTC (rev 1004) +++ trunk/crossfire/src/cfeditor/messages.properties 2006-12-10 13:37:25 UTC (rev 1005) @@ -1,6 +1,10 @@ # Warning: This file MUST be ISO-8859-1 # See http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding +# Supported image set. The values must match the image file names: +# <name>.<image set name>.111 +availableImageSets=base + # Dialogs collectArchesNotReady.title=Arches still loading @@ -46,3 +50,7 @@ mapSkySetting=Sky setting mapTop=Top mapBottom=Bottom + +# Options +optionsImageSet=Image Set +optionsImageSet.shortdescription=The image set to use Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-10 13:34:04 UTC (rev 1004) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-10 13:37:25 UTC (rev 1005) @@ -241,3 +241,29 @@ scriptEditData.text=Daten \xE4ndern scriptEdit.text=Script \xE4ndern scriptRemove.text=Script l\xF6schen + +##################### +# Preference Modules + +prefsRes.title=Pfade & Ressourcen +prefsGUI.title=Aussehen + +# Options + +optionsLanguage=Sprache +optionsLayout=Layout-Einstellungen +optionsSepMapTile.text=Map-Tile-Panel unten anzeigen +optionsSepMapTile.shortdescription=Map-Tile-Panel unten (anstatt rechts) anzeigen +optionsLoadArchColl.text=Vorbereitete Archetypen laden +optionsGlobal=Global +optionsResPaths=Pfade +optionsResArch=Archetypen +optionsResArch.shortdescription=Dateiname der Archetypen-Datei +optionsResMaps=Karten +optionsResMaps.shortdescription=Verzeichnis f\xFCr Karten +optionsResScripts=Skripte +optionsResScripts.shortdescription=Verzeichnis f\xFCr Scripte +optionsImageSet=Image Set +optionsImageSet.shortdescription=Verwendetes Image Set zur Darstellung von Karten +optionsRestart.title=Warnung +optionsRestart.message=Viele Optionen erfordern einen Programmneustart, um effektiv zu werden. Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-12-10 13:34:04 UTC (rev 1004) +++ trunk/daimonin/src/daieditor/messages.properties 2006-12-10 13:37:25 UTC (rev 1005) @@ -157,17 +157,8 @@ # Options optionsTitle=Options -optionsLanguage=Language -optionsLayout=Layout Settings optionsUpdate=Automatic Update -optionsSepMapTile.text=Display Map-Tile Panel at the bottom -optionsSepMapTile.shortdescription=Unchecking this moves the Map-Tile Panel to the right side of the screen instead of the bottom right corner. optionsLoadArchColl.text=Load Arches from Collection -optionsGlobal=Global -optionsResPaths=Resource Paths -optionsResArch=Archfiles -optionsResMaps=Maps -optionsResScripts=Scripts optionsResMedia=Media optionsResMedia.shortdescription=<html>The media directory is for choosing background sounds for maps.<br>Please know that you cannot simply choose any media directory you want.<br>The background sound will only work if the files exist on the client as well.<br>Therefore, choosing a standard daimonin media directory is crucial.</html> optionsMisc=Miscellaneous Options @@ -180,8 +171,6 @@ optionsAppServer=Server optionsAppClient=Client optionsAppEditor=Editor -optionsRestart.title=Warning -optionsRestart.message=Most options require restarting the editor to take effect. optionsValidation=Validation settings autoValidate.text=Automatically run validation after each change optionsValidators=Validators @@ -713,9 +702,7 @@ prefsApp.title=External applications prefsDev.title=Developers -prefsRes.title=Paths & resources prefsMisc.title=Miscellaneous -prefsGUI.title=Appearance prefsUpdate.title=Update prefsMapValidator.title=Map validation Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2006-12-10 13:34:04 UTC (rev 1004) +++ trunk/src/app/net/sf/gridarta/messages.properties 2006-12-10 13:37:25 UTC (rev 1005) @@ -223,3 +223,27 @@ scriptEditData.text=Edit Data scriptEdit.text=Edit Script scriptRemove.text=Remove Script + +##################### +# Preference Modules + +prefsRes.title=Paths & resources +prefsGUI.title=Appearance + +# Options + +optionsLanguage=Language +optionsGlobal=Global +optionsLayout=Layout Settings +optionsSepMapTile.text=Display Map-Tile Panel at ... [truncated message content] |
From: <aki...@us...> - 2006-12-12 03:39:25
|
Revision: 1017 http://svn.sourceforge.net/gridarta/?rev=1017&view=rev Author: akirschbaum Date: 2006-12-10 07:59:12 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Rename variable name. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-10 15:46:05 UTC (rev 1016) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-10 15:59:12 UTC (rev 1017) @@ -1013,9 +1013,9 @@ * an output file name/path for the png image. */ public void createImg() { - final MapControl mc = currentMap; // control of current map + final MapControl mapControl = currentMap; // control of current map - if (mc == null) { + if (mapControl == null) { // there is no map open (should not happen due to disabled menus) ACTION_FACTORY.showMessageDialog(mainView, "createImgNoMap"); } else { @@ -1025,7 +1025,7 @@ strImageDir = mapDir.getAbsolutePath(); } - filename = strImageDir + File.separator + mc.getMapFileName() + ".png"; + filename = strImageDir + File.separator + mapControl.getMapFileName() + ".png"; final JFileChooser fileChooser = new JFileChooser(strImageDir); fileChooser.setDialogTitle("Save Image As"); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); @@ -1050,7 +1050,7 @@ if (!filename.endsWith(".png")) { filename += ".png"; } - mc.getMapViewFrame().printFullImage(filename); + mapControl.getMapViewFrame().printFullImage(filename); } } catch (final IOException e) { ACTION_FACTORY.showMessageDialog(mainView, "createImgIOException", filename, e.getMessage()); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-12-10 15:46:05 UTC (rev 1016) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-12-10 15:59:12 UTC (rev 1017) @@ -1379,9 +1379,9 @@ * an output file name/path for the png image. */ public void createImg() { - final MapControl mc = currentMap; // control of current map + final MapControl mapControl = currentMap; // control of current map - if (mc == null) { + if (mapControl == null) { // there is no map open (should not happen due to disabled menus) ACTION_FACTORY.showMessageDialog(mainView, "createImgNoMap"); } else { @@ -1391,7 +1391,7 @@ strImageDir = mapDir.getAbsolutePath(); } - filename = strImageDir + File.separator + mc.getMapFileName() + ".png"; + filename = strImageDir + File.separator + mapControl.getMapFileName() + ".png"; final JFileChooser fileChooser = new JFileChooser(strImageDir); fileChooser.setDialogTitle("Save Image As"); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); @@ -1409,7 +1409,7 @@ filename += ".png"; } if (!new File(filename).exists() || ACTION_FACTORY.showConfirmDialog(mainView, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, "overwriteOtherFile", filename) == JOptionPane.YES_OPTION) { - mc.getMapViewFrame().printFullImage(filename); + mapControl.getMapViewFrame().printFullImage(filename); } } } catch (final IOException e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-12 03:39:26
|
Revision: 1018 http://svn.sourceforge.net/gridarta/?rev=1018&view=rev Author: akirschbaum Date: 2006-12-10 08:21:49 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Use File instead of String filenames. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/MapViewIFrame.java trunk/daimonin/src/daieditor/CFJavaEditor.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMapViewBasic.java trunk/daimonin/src/daieditor/MapViewIFrame.java Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-12-10 15:59:12 UTC (rev 1017) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-12-10 16:21:49 UTC (rev 1018) @@ -137,7 +137,7 @@ } if (outfile != null) { - mainControl.createImageWanted(outfile); // create map image + mainControl.createImageWanted(new File(outfile)); // create map image System.exit(0); // exit } @@ -145,14 +145,13 @@ } - private static void makeImage(final CMainControl mainControl, final String in, final String out) { + private static void makeImage(final CMainControl mainControl, final File in, final File out) { if (log.isInfoEnabled()) { log.info("converting " + in + " to " + out); } - final File f = new File(in); - if (f.canRead()) { - mainControl.openFile(f); + if (in.canRead()) { + mainControl.openFile(in); mainControl.createImageWanted(out); mainControl.close(); } @@ -169,7 +168,7 @@ log.info("done."); System.exit(0); } - makeImage(mainControl, in, out); + makeImage(mainControl, new File(in), new File(out)); } } catch (final IOException e) { log.info("done."); Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-10 15:59:12 UTC (rev 1017) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-10 16:21:49 UTC (rev 1018) @@ -1050,7 +1050,7 @@ if (!filename.endsWith(".png")) { filename += ".png"; } - mapControl.getMapViewFrame().printFullImage(filename); + mapControl.getMapViewFrame().printFullImage(new File(filename)); } } catch (final IOException e) { ACTION_FACTORY.showMessageDialog(mainView, "createImgIOException", filename, e.getMessage()); @@ -1062,32 +1062,32 @@ * Create an image of the current map and save it as file. * In this method, the filename is already given, so the image * is created directly (if possible). - * @param filename Name of the png image file to create. + * @param file the png image file to create */ - public void createImageWanted(final String filename) { - createImageWanted(currentMap, filename); + public void createImageWanted(final File file) { + createImageWanted(currentMap, file); } /** * Create an image of the specified map and save it as file. * In this method, the filename is already given, so the image * is created directly (if possible). - * @param filename Name of the png image file to create. - * @param mapControl The controller of map to save. + * @param mapControl the controller of map to save + * @param file the png image file to create */ - public void createImageWanted(final MapControl mapControl, final String filename) { + public void createImageWanted(final MapControl mapControl, final File file) { if (mapControl == null) { // there is no map open (should not happen due to disabled menus) ACTION_FACTORY.showMessageDialog(mainView, "createImgNoMap"); } else { try { - mapControl.getMapViewFrame().printFullImage(filename); + mapControl.getMapViewFrame().printFullImage(file); if (log.isInfoEnabled()) { - log.info(ACTION_FACTORY.format("imageCreated", filename, mapControl.getMapFileName())); + log.info(ACTION_FACTORY.format("imageCreated", file, mapControl.getMapFileName())); } } catch (final IOException e) { - ACTION_FACTORY.showMessageDialog(mainView, "createImgIOException", filename); + ACTION_FACTORY.showMessageDialog(mainView, "createImgIOException", file); } } } Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-10 15:59:12 UTC (rev 1017) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-10 16:21:49 UTC (rev 1018) @@ -295,11 +295,11 @@ /** * Convert the map into a png file. - * @param filename the file to write to + * @param file the file to write to * @throws IOException in case of I/O problems writing the image. */ - public void printFullImage(final String filename) throws IOException { - ImageIO.write(renderer.getFullImage(), "png", new File(filename)); + public void printFullImage(final File file) throws IOException { + ImageIO.write(renderer.getFullImage(), "png", file); } /** Refreshes the data in the view from the model. */ Modified: trunk/crossfire/src/cfeditor/MapViewIFrame.java =================================================================== --- trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-12-10 15:59:12 UTC (rev 1017) +++ trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-12-10 16:21:49 UTC (rev 1018) @@ -32,6 +32,7 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; +import java.io.File; import java.io.IOException; import javax.swing.JInternalFrame; import javax.swing.JViewport; @@ -174,8 +175,8 @@ view.setHotspot(point); } - public void printFullImage(final String filename) throws IOException { - view.printFullImage(filename); + public void printFullImage(final File file) throws IOException { + view.printFullImage(file); } public void refreshDataFromModel() { Modified: trunk/daimonin/src/daieditor/CFJavaEditor.java =================================================================== --- trunk/daimonin/src/daieditor/CFJavaEditor.java 2006-12-10 15:59:12 UTC (rev 1017) +++ trunk/daimonin/src/daieditor/CFJavaEditor.java 2006-12-10 16:21:49 UTC (rev 1018) @@ -25,6 +25,7 @@ package daieditor; import static daieditor.CMainControl.PREFS_LANGUAGE; +import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -112,7 +113,7 @@ if (infiles.size() > 1) { System.err.println("Warning: you specified more than 1 map for creating an image. I will create an image for only one of them."); } - mainControl.createImageWanted(outfile); // create map image + mainControl.createImageWanted(new File(outfile)); // create map image } mainControl.refreshMenusAndToolbars(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-12-10 15:59:12 UTC (rev 1017) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-12-10 16:21:49 UTC (rev 1018) @@ -1408,8 +1408,9 @@ if (!filename.endsWith(".png")) { filename += ".png"; } - if (!new File(filename).exists() || ACTION_FACTORY.showConfirmDialog(mainView, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, "overwriteOtherFile", filename) == JOptionPane.YES_OPTION) { - mapControl.getMapViewFrame().printFullImage(filename); + final File file = new File(filename); + if (!file.exists() || ACTION_FACTORY.showConfirmDialog(mainView, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, "overwriteOtherFile", filename) == JOptionPane.YES_OPTION) { + mapControl.getMapViewFrame().printFullImage(file); } } } catch (final IOException e) { @@ -1422,9 +1423,9 @@ * Create an image of the current map and save it as file. * In this method, the filename is already given, so the image * is created directly (if possible). - * @param filename Name of the png image file to create. + * @param file the png image file to create */ - public void createImageWanted(final String filename) { + public void createImageWanted(final File file) { final MapControl mapc = currentMap; // control of current map if (mapc == null) { @@ -1432,12 +1433,12 @@ ACTION_FACTORY.showMessageDialog(mainView, "createImgNoMap"); } else { try { - mapc.getMapViewFrame().printFullImage(filename); + mapc.getMapViewFrame().printFullImage(file); if (log.isInfoEnabled()) { - log.info(ACTION_FACTORY.format("imageCreated", filename, mapc.getMapFileName())); + log.info(ACTION_FACTORY.format("imageCreated", file, mapc.getMapFileName())); } } catch (final IOException e) { - ACTION_FACTORY.showMessageDialog(mainView, "createImgIOException", filename); + ACTION_FACTORY.showMessageDialog(mainView, "createImgIOException", file); } } } Modified: trunk/daimonin/src/daieditor/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-12-10 15:59:12 UTC (rev 1017) +++ trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-12-10 16:21:49 UTC (rev 1018) @@ -310,11 +310,11 @@ /** * Saves an image of the entire view to a file. - * @param filename filename to write image file to + * @param file file to write image file to * @throws IOException in case of I/O problems */ - public void printFullImage(final String filename) throws IOException { - ImageIO.write(getFullImage(), "png", new File(filename)); + public void printFullImage(final File file) throws IOException { + ImageIO.write(getFullImage(), "png", file); } /** Modified: trunk/daimonin/src/daieditor/MapViewIFrame.java =================================================================== --- trunk/daimonin/src/daieditor/MapViewIFrame.java 2006-12-10 15:59:12 UTC (rev 1017) +++ trunk/daimonin/src/daieditor/MapViewIFrame.java 2006-12-10 16:21:49 UTC (rev 1018) @@ -29,6 +29,7 @@ import java.awt.Image; import java.awt.Point; import java.awt.event.ActionEvent; +import java.io.File; import java.io.IOException; import javax.swing.AbstractAction; import static javax.swing.Action.SMALL_ICON; @@ -123,8 +124,8 @@ view.setHotspot(pos); } - public void printFullImage(final String filename) throws IOException { - view.printFullImage(filename); + public void printFullImage(final File file) throws IOException { + view.printFullImage(file); } /** The Action to select this Window. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-12 03:39:26
|
Revision: 1028 http://svn.sourceforge.net/gridarta/?rev=1028&view=rev Author: akirschbaum Date: 2006-12-10 10:29:56 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Move unified class ArchAttribType to gridarta source. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchAttrib.java trunk/crossfire/src/cfeditor/CFArchType.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFArchAttrib.java trunk/daimonin/src/daieditor/CFArchType.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gameobject/ArchAttribType.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/gameobject/ArchAttribType.java trunk/daimonin/src/daieditor/gameobject/ArchAttribType.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-10 18:10:58 UTC (rev 1027) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-10 18:29:56 UTC (rev 1028) @@ -24,7 +24,6 @@ package cfeditor; -import cfeditor.gameobject.ArchAttribType; import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; import java.awt.BorderLayout; @@ -85,6 +84,7 @@ import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; +import net.sf.gridarta.gameobject.ArchAttribType; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.NamedObject; import net.sf.gridarta.gameobject.NamedObjects; Modified: trunk/crossfire/src/cfeditor/CFArchAttrib.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-12-10 18:10:58 UTC (rev 1027) +++ trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-12-10 18:29:56 UTC (rev 1028) @@ -24,11 +24,11 @@ package cfeditor; -import cfeditor.gameobject.ArchAttribType; import java.io.BufferedReader; import java.io.EOFException; import java.io.IOException; import java.io.StringReader; +import net.sf.gridarta.gameobject.ArchAttribType; import org.apache.log4j.Logger; import org.jdom.Attribute; import org.jdom.DataConversionException; Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-12-10 18:10:58 UTC (rev 1027) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-12-10 18:29:56 UTC (rev 1028) @@ -24,11 +24,11 @@ package cfeditor; -import cfeditor.gameobject.ArchAttribType; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import net.sf.gridarta.gameobject.ArchAttribType; import org.apache.log4j.Logger; import org.jdom.Attribute; import org.jdom.Element; Deleted: trunk/crossfire/src/cfeditor/gameobject/ArchAttribType.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchAttribType.java 2006-12-10 18:10:58 UTC (rev 1027) +++ trunk/crossfire/src/cfeditor/gameobject/ArchAttribType.java 2006-12-10 18:29:56 UTC (rev 1028) @@ -1,78 +0,0 @@ -/* - * Daimonin Java Editor. - * Copyright (C) 2005 Christian Hujer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - */ - -package cfeditor.gameobject; - -/** - * Enumeration for Archetype Attribute Types. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public enum ArchAttribType { - - /** Boolean -> Checkbox. */ - BOOL, - - /** Boolean -> Checkbox, with customized true/false values. */ - BOOL_SPEC, - - /** Integer -> Textfield. */ - INT, - - /** Long -> Textfield. */ - LONG, - - /** Float -> Textfield. */ - FLOAT, - - /** String -> Textfield. */ - STRING, - - /** Text -> Textarea. */ - TEXT, - - /** Fixed String -> (No input). */ - FIXED, - - /** Spell -> Spell number (Combobox). */ - SPELL, - - /** ZSpell -> Spell number (except that 0 is always 0, not magic bullet). */ - ZSPELL, - - /** Bitmask -> Special input with popup frame. */ - BITMASK, - - /** List -> Combobox. */ - LIST, - - /** Treasure -> treasurelist (Textfield and Tree). */ - TREASURE, - - /** Double List -> 2 × Combobox. */ - DBLLIST, - - /** Face name -> Textfield and Tree. */ - FACENAME, - - /** Animation name -> Textfield and Tree. */ - ANIMNAME - -} // enum ArchAttribType Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-10 18:10:58 UTC (rev 1027) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-10 18:29:56 UTC (rev 1028) @@ -24,7 +24,6 @@ package daieditor; -import daieditor.gameobject.ArchAttribType; import daieditor.gameobject.GameObject; import java.awt.BorderLayout; import java.awt.CardLayout; @@ -84,6 +83,7 @@ import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; +import net.sf.gridarta.gameobject.ArchAttribType; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.NamedObject; import net.sf.gridarta.gameobject.NamedObjects; Modified: trunk/daimonin/src/daieditor/CFArchAttrib.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchAttrib.java 2006-12-10 18:10:58 UTC (rev 1027) +++ trunk/daimonin/src/daieditor/CFArchAttrib.java 2006-12-10 18:29:56 UTC (rev 1028) @@ -24,7 +24,7 @@ package daieditor; -import daieditor.gameobject.ArchAttribType; +import net.sf.gridarta.gameobject.ArchAttribType; import org.apache.log4j.Logger; import org.w3c.dom.Attr; import org.w3c.dom.Element; Modified: trunk/daimonin/src/daieditor/CFArchType.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchType.java 2006-12-10 18:10:58 UTC (rev 1027) +++ trunk/daimonin/src/daieditor/CFArchType.java 2006-12-10 18:29:56 UTC (rev 1028) @@ -24,11 +24,11 @@ package daieditor; -import daieditor.gameobject.ArchAttribType; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import net.sf.gridarta.gameobject.ArchAttribType; import net.sf.japi.swing.ActionFactory; import net.sf.japi.xml.NodeListIterator; import static net.sf.japi.xml.NodeListIterator.getFirstChild; Deleted: trunk/daimonin/src/daieditor/gameobject/ArchAttribType.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchAttribType.java 2006-12-10 18:10:58 UTC (rev 1027) +++ trunk/daimonin/src/daieditor/gameobject/ArchAttribType.java 2006-12-10 18:29:56 UTC (rev 1028) @@ -1,78 +0,0 @@ -/* - * Daimonin Java Editor. - * Copyright (C) 2005 Christian Hujer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - */ - -package daieditor.gameobject; - -/** - * Enumeration for Archetype Attribute Types. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public enum ArchAttribType { - - /** Boolean -> Checkbox. */ - BOOL, - - /** Boolean -> Checkbox, with customized true/false values. */ - BOOL_SPEC, - - /** Integer -> Textfield. */ - INT, - - /** Long -> Textfield. */ - LONG, - - /** Float -> Textfield. */ - FLOAT, - - /** String -> Textfield. */ - STRING, - - /** Text -> Textarea. */ - TEXT, - - /** Fixed String -> (No input). */ - FIXED, - - /** Spell -> Spell number (Combobox). */ - SPELL, - - /** ZSpell -> Spell number (except that 0 is always 0, not magic bullet). */ - ZSPELL, - - /** Bitmask -> Special input with popup frame. */ - BITMASK, - - /** List -> Combobox. */ - LIST, - - /** Treasure -> treasurelist (Textfield and Tree). */ - TREASURE, - - /** Double List -> 2 × Combobox. */ - DBLLIST, - - /** Face name -> Textfield and Tree. */ - FACENAME, - - /** Animation name -> Textfield and Tree. */ - ANIMNAME - -} // enum ArchAttribType Added: trunk/src/app/net/sf/gridarta/gameobject/ArchAttribType.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/ArchAttribType.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gameobject/ArchAttribType.java 2006-12-10 18:29:56 UTC (rev 1028) @@ -0,0 +1,77 @@ +/* + * Gridarta Editor. + * Copyright (C) 2005 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package net.sf.gridarta.gameobject; + +/** + * Enumeration for Archetype Attribute Types. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public enum ArchAttribType { + + /** Boolean -> Checkbox. */ + BOOL, + + /** Boolean -> Checkbox, with customized true/false values. */ + BOOL_SPEC, + + /** Integer -> Textfield. */ + INT, + + /** Long -> Textfield. */ + LONG, + + /** Float -> Textfield. */ + FLOAT, + + /** String -> Textfield. */ + STRING, + + /** Text -> Textarea. */ + TEXT, + + /** Fixed String -> (No input). */ + FIXED, + + /** Spell -> Spell number (Combobox). */ + SPELL, + + /** ZSpell -> Spell number (except that 0 is always 0, not magic bullet). */ + ZSPELL, + + /** Bitmask -> Special input with popup frame. */ + BITMASK, + + /** List -> Combobox. */ + LIST, + + /** Treasure -> treasurelist (Textfield and Tree). */ + TREASURE, + + /** Double List -> 2 × Combobox. */ + DBLLIST, + + /** Face name -> Textfield and Tree. */ + FACENAME, + + /** Animation name -> Textfield and Tree. */ + ANIMNAME + +} // enum ArchAttribType Property changes on: trunk/src/app/net/sf/gridarta/gameobject/ArchAttribType.java ___________________________________________________________________ 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: <aki...@us...> - 2006-12-12 03:39:30
|
Revision: 1033 http://svn.sourceforge.net/gridarta/?rev=1033&view=rev Author: akirschbaum Date: 2006-12-10 11:39:20 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Unify variable names. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainView.java trunk/daimonin/src/daieditor/CMainView.java Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-12-10 19:14:38 UTC (rev 1032) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-12-10 19:39:20 UTC (rev 1033) @@ -329,8 +329,8 @@ return archPanel.getArchPanelSelection(); } - public void showArchPanelQuickObject(final GameObject arch) { - archPanel.showArchPanelQuickObject(arch); + public void showArchPanelQuickObject(final GameObject gameObject) { + archPanel.showArchPanelQuickObject(gameObject); } /** @@ -411,11 +411,11 @@ /** * Sets <code>true</code> when archpanel is merged into the bottom panel. - * @param state <code>true</code> when archpanel is merged into the bottom - * panel + * @param mapTileListBottom <code>true</code> when archpanel is merged into + * the bottom panel */ - public void setMapTileListBottom(final boolean state) { - mapTileListBottom = state; + public void setMapTileListBottom(final boolean mapTileListBottom) { + this.mapTileListBottom = mapTileListBottom; } /** Notifies that the application is about to exit. */ @@ -690,57 +690,57 @@ /** * Invoked when the internal frame view is opened. - * @param e the occurred <code>InternalFrameEvent</code> + * @param event the occurred <code>InternalFrameEvent</code> */ - public void internalFrameOpened(final InternalFrameEvent e) { + public void internalFrameOpened(final InternalFrameEvent event) { } /** * Invoked when the internal frame view is closing. - * @param e the occurred <code>InternalFrameEvent</code> + * @param event the occurred <code>InternalFrameEvent</code> */ - public void internalFrameClosing(final InternalFrameEvent e) { - final MapViewIFrame view = (MapViewIFrame) e.getSource(); + public void internalFrameClosing(final InternalFrameEvent event) { + final MapViewIFrame view = (MapViewIFrame) event.getSource(); removeLevelView(view); } /** * Invoked when the internal frame view is closed. - * @param e the occurred <code>InternalFrameEvent</code> + * @param event the occurred <code>InternalFrameEvent</code> */ - public void internalFrameClosed(final InternalFrameEvent e) { + public void internalFrameClosed(final InternalFrameEvent event) { } /** * Invoked when the internal frame view is iconified. - * @param e the occurred <code>InternalFrameEvent</code> + * @param event the occurred <code>InternalFrameEvent</code> */ - public void internalFrameIconified(final InternalFrameEvent e) { - final MapViewIFrame view = (MapViewIFrame) e.getSource(); + public void internalFrameIconified(final InternalFrameEvent event) { + final MapViewIFrame view = (MapViewIFrame) event.getSource(); levelViewFocusLostNotify(view); } /** * Invoked when the internal frame view is deiconified. - * @param e the occurred <code>InternalFrameEvent</code> + * @param event the occurred <code>InternalFrameEvent</code> */ - public void internalFrameDeiconified(final InternalFrameEvent e) { + public void internalFrameDeiconified(final InternalFrameEvent event) { } /** * Invoked when the internal frame view is activated. - * @param e the occurred <code>InternalFrameEvent</code> + * @param event the occurred <code>InternalFrameEvent</code> */ - public void internalFrameActivated(final InternalFrameEvent e) { - final MapViewIFrame view = (MapViewIFrame) e.getSource(); + public void internalFrameActivated(final InternalFrameEvent event) { + final MapViewIFrame view = (MapViewIFrame) event.getSource(); levelViewFocusGainedNotify(view); } /** * Invoked when the internal frame view is deactivated. - * @param e the occurred <code>InternalFrameEvent</code> + * @param event the occurred <code>InternalFrameEvent</code> */ - public void internalFrameDeactivated(final InternalFrameEvent e) { + public void internalFrameDeactivated(final InternalFrameEvent event) { } public CMainStatusbar getStatusBar() { Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-12-10 19:14:38 UTC (rev 1032) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-12-10 19:39:20 UTC (rev 1033) @@ -351,8 +351,8 @@ } // access mape tile list ... - public void setMapTileList(final MapControl map, final GameObject selArch) { - mapTileList.setMapTileList(map, selArch); + public void setMapTileList(final MapControl map, final GameObject gameObject) { + mapTileList.setMapTileList(map, gameObject); } public void refreshMapTileList() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-12 03:39:31
|
Revision: 1034 http://svn.sourceforge.net/gridarta/?rev=1034&view=rev Author: akirschbaum Date: 2006-12-10 11:47:45 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Whitespace changes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchAttrib.java trunk/crossfire/src/cfeditor/CGUIUtils.java trunk/crossfire/src/cfeditor/CMainToolbar.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFArchAttrib.java trunk/daimonin/src/daieditor/CMainView.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-10 19:39:20 UTC (rev 1033) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-10 19:47:45 UTC (rev 1034) @@ -433,7 +433,6 @@ gbc.gridy++; header.add(new JLabel("Archetype: ", SwingConstants.TRAILING), gbc); // create label - gbc.gridx = 3; gbc.gridy = 1; gbc.weightx = 1.0; @@ -1441,7 +1440,6 @@ public void focusLost(final FocusEvent e) { } - /** A single Attribute, combining the CFArchAttrib with its input component(s). */ private static class DialogAttrib<T> { @@ -1461,7 +1459,6 @@ } // class DialogAttrib - /** DialogAttrib for types with bitmasks to choose from. */ static final class BitmaskAttrib extends DialogAttrib<JTextComponent> { @@ -1502,7 +1499,6 @@ } // class BitmaskAttrib - /** ActionListener for help-buttons. */ private final class HelpActionListener implements ActionListener { @@ -1532,7 +1528,6 @@ } // class HelpActionListener - /** ActionListener for the change buttons of bitmasks. */ private static final class MaskChangeAL extends AbstractAction { @@ -1565,7 +1560,6 @@ } // class MaskChangeAL - /** * ActionListener for the buttons on treasurelists. When such a button is * pressed, the dialog with treasurelists pops up. @@ -1601,7 +1595,6 @@ } // class ViewTreasurelistAL - /** * ActionListener for the buttons in the ConfirmErrors popup dialog and * also WindowListener for the closebox of the dialog (which would equal a @@ -1661,7 +1654,6 @@ } // class ConfirmErrorsAL - /** ItemListener for the type-selection box on the attribute-dialog. */ private final class TypesBoxAL implements ItemListener { @@ -1737,7 +1729,6 @@ } // class TypesBoxAL - /** * KeySelectionManager to manage the select-per-keystroke in a JComboBox * (The default KeySelectionManager fails because all strings start with Modified: trunk/crossfire/src/cfeditor/CFArchAttrib.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-12-10 19:39:20 UTC (rev 1033) +++ trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-12-10 19:47:45 UTC (rev 1034) @@ -233,7 +233,6 @@ return false; } - final String listName1 = listNames.substring(0, seppos); final String listName2 = listNames.substring(seppos + 1); Modified: trunk/crossfire/src/cfeditor/CGUIUtils.java =================================================================== --- trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-12-10 19:39:20 UTC (rev 1033) +++ trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-12-10 19:47:45 UTC (rev 1034) @@ -160,7 +160,6 @@ return new ImageIcon(grayIcon); } - /** Grayscale filter to make grayscaled images. */ private final class CGrayScaleFilter extends RGBImageFilter { Modified: trunk/crossfire/src/cfeditor/CMainToolbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainToolbar.java 2006-12-10 19:39:20 UTC (rev 1033) +++ trunk/crossfire/src/cfeditor/CMainToolbar.java 2006-12-10 19:47:45 UTC (rev 1034) @@ -181,7 +181,6 @@ addSeparator(); - final JButton prevWindow = new CFancyButton( filterLabel("Prev"), "Show Previous Window", Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-12-10 19:39:20 UTC (rev 1033) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-12-10 19:47:45 UTC (rev 1034) @@ -213,7 +213,6 @@ // Build the placeholder for tile palette archPanel = new CArchPanel(mainControl); mapTileList = new CMapTileList(mainControl, this); - mapDesktop = new JDesktopPane(); if (!mapTileListBottom) { @@ -553,7 +552,6 @@ return null; } - /* * {@inheritDoc} * This implementation displays the exception in a modal message dialog. @@ -594,9 +592,8 @@ * all windows iconified by the user. */ void updateFocus(final boolean fCareAboutIconification) { - // Show the next level (if such exists) - for ( final MapViewIFrame view : mapViews) { + for (final MapViewIFrame view : mapViews) { if (view.isIcon()) { if (!fCareAboutIconification) { Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-10 19:39:20 UTC (rev 1033) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-10 19:47:45 UTC (rev 1034) @@ -296,8 +296,6 @@ // Highlight the selected area paintHighlightArea(grfx); } - - } /** @@ -388,7 +386,6 @@ paintHighlightTile(grfx, point); } - @Override public void setHighlightTile(final Point point) { if (isPickmap) { paintHighlightTile(getGraphics(), point); Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-10 19:39:20 UTC (rev 1033) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-10 19:47:45 UTC (rev 1034) @@ -429,7 +429,6 @@ gbc.gridy++; header.add(new JLabel("Archetype: ", SwingConstants.TRAILING), gbc); // create label - gbc.gridx = 3; gbc.gridy = 1; gbc.weightx = 1.0; @@ -1418,7 +1417,6 @@ public void focusLost(final FocusEvent e) { } - /** A single Attribute, combining the CFArchAttrib with its input component(s). */ private static class DialogAttrib<T> { @@ -1438,7 +1436,6 @@ } // class DialogAttrib - /** DialogAttrib for types with bitmasks to choose from. */ static final class BitmaskAttrib extends DialogAttrib<JTextComponent> { @@ -1479,7 +1476,6 @@ } // class BitmaskAttrib - /** ActionListener for help-buttons. */ private final class HelpActionListener implements ActionListener { @@ -1509,7 +1505,6 @@ } // class HelpActionListener - /** ActionListener for the change buttons of bitmasks. */ private static final class MaskChangeAL extends AbstractAction { @@ -1542,7 +1537,6 @@ } // class MaskChangeAL - /** * ActionListener for the buttons on treasurelists. When such a button is * pressed, the dialog with treasurelists pops up. @@ -1578,7 +1572,6 @@ } // class ViewTreasurelistAL - /** * ActionListener for the buttons in the ConfirmErrors popup dialog and * also WindowListener for the closebox of the dialog (which would equal a @@ -1638,7 +1631,6 @@ } // class ConfirmErrorsAL - /** ItemListener for the type-selection box on the attribute-dialog. */ private final class TypesBoxAL implements ItemListener { @@ -1712,7 +1704,6 @@ } // class TypesBoxAL - /** * KeySelectionManager to manage the select-per-keystroke in a JComboBox * (The default KeySelectionManager fails because all strings start with @@ -1750,7 +1741,6 @@ } // class StringKeyManager - /** Action for choosing a face or animation. */ private static final class TreeChooseAction extends AbstractAction { Modified: trunk/daimonin/src/daieditor/CFArchAttrib.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchAttrib.java 2006-12-10 19:39:20 UTC (rev 1033) +++ trunk/daimonin/src/daieditor/CFArchAttrib.java 2006-12-10 19:47:45 UTC (rev 1034) @@ -230,7 +230,6 @@ return false; } - final String listName1 = listNames.substring(0, seppos); final String listName2 = listNames.substring(seppos + 1); Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-12-10 19:39:20 UTC (rev 1033) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-12-10 19:47:45 UTC (rev 1034) @@ -518,7 +518,6 @@ * all windows iconified by the user. */ void updateFocus(final boolean fCareAboutIconification) { - // Show the next level (if such exists) for (final MapViewIFrame view : mapViews) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-12-13 19:22:38
|
Revision: 1060 http://svn.sourceforge.net/gridarta/?rev=1060&view=rev Author: christianhujer Date: 2006-12-13 11:22:35 -0800 (Wed, 13 Dec 2006) Log Message: ----------- Better handling of some == situations. Modified Paths: -------------- trunk/daimonin/src/daieditor/Updater.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gui/DirectionLayout.java trunk/daimonin/src/daieditor/gui/prefs/GUIPrefs.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java trunk/src/app/net/sf/gridarta/help/HtmlPane.java Modified: trunk/daimonin/src/daieditor/Updater.java =================================================================== --- trunk/daimonin/src/daieditor/Updater.java 2006-12-13 19:19:24 UTC (rev 1059) +++ trunk/daimonin/src/daieditor/Updater.java 2006-12-13 19:22:35 UTC (rev 1060) @@ -307,6 +307,7 @@ * @param other Other version information to compare to * @return <code>true</code> if this versionis newer than <var>other</var>, otherwise <code>false</code> */ + @SuppressWarnings({"ObjectEquality"}) boolean isNewerThan(final VersionInfo other) { return this != UNAVAILABLE && (other == UNAVAILABLE || tstamp.compareTo(other.tstamp) > 0); } Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-12-13 19:19:24 UTC (rev 1059) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-12-13 19:22:35 UTC (rev 1060) @@ -308,6 +308,7 @@ * * @return <code>true</code> iff this part if a tail part */ + @SuppressWarnings({"ObjectEquality"}) public boolean isTail() { return getHead() != this; } Modified: trunk/daimonin/src/daieditor/gui/DirectionLayout.java =================================================================== --- trunk/daimonin/src/daieditor/gui/DirectionLayout.java 2006-12-13 19:19:24 UTC (rev 1059) +++ trunk/daimonin/src/daieditor/gui/DirectionLayout.java 2006-12-13 19:22:35 UTC (rev 1060) @@ -299,6 +299,7 @@ } /** {@inheritDoc} */ + @SuppressWarnings({"ObjectEquality"}) public void removeLayoutComponent(final Component comp) { synchronized (comp.getTreeLock()) { if (cC == comp) { Modified: trunk/daimonin/src/daieditor/gui/prefs/GUIPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/GUIPrefs.java 2006-12-13 19:19:24 UTC (rev 1059) +++ trunk/daimonin/src/daieditor/gui/prefs/GUIPrefs.java 2006-12-13 19:22:35 UTC (rev 1060) @@ -123,7 +123,7 @@ final String currentName = userNodeForPackage(CMainControl.class).get(PREFS_LANGUAGE, null); final Locale current = currentName != null ? new Locale(currentName) : null; return !( - (loc == null ? loc == current : loc.equals(current)) + (loc == null ? current == null : loc.equals(current)) && mapPanelBottom.isSelected() == PREFS.getBoolean(MAP_TILE_LIST_BOTTOM_KEY, MAP_TILE_LIST_BOTTOM_DEFAULT) ); } @@ -134,8 +134,8 @@ */ private Component buildLocaleBox() { final Box lineLayout = createHorizontalBox(); - - final String[] locNames = ACTION_FACTORY.getString("availableLocales").split("\\s+"); + final String availableLocales = ACTION_FACTORY.getString("availableLocales"); + final String[] locNames = availableLocales != null ? availableLocales.split("\\s+") : new String[0]; locales = new Locale[locNames.length + 1]; // locales[0] is intentionally null. It will be displayed as default and always get sorted to the top. for (int i = 0; i < locNames.length; i++) { Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-13 19:19:24 UTC (rev 1059) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-12-13 19:22:35 UTC (rev 1060) @@ -201,6 +201,8 @@ final GameObject node = mapGrid[pos.x][pos.y].getLast(); int position = 0; for (final GameObject search : mapGrid[pos.x][pos.y].reverse()) { + // This is okay because next is on the desired square. + //noinspection ObjectEquality if (search == next) { break; } Modified: trunk/src/app/net/sf/gridarta/help/HtmlPane.java =================================================================== --- trunk/src/app/net/sf/gridarta/help/HtmlPane.java 2006-12-13 19:19:24 UTC (rev 1059) +++ trunk/src/app/net/sf/gridarta/help/HtmlPane.java 2006-12-13 19:22:35 UTC (rev 1060) @@ -150,7 +150,7 @@ * @param e occurred <code>HyperlinkEvent</code> */ public void hyperlinkUpdate(final HyperlinkEvent e) { - if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) { linkActivated(e.getURL()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-14 22:00:37
|
Revision: 1066 http://svn.sourceforge.net/gridarta/?rev=1066&view=rev Author: akirschbaum Date: 2006-12-14 14:00:37 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Unify declaration order and comments. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-14 21:49:25 UTC (rev 1065) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-14 22:00:37 UTC (rev 1066) @@ -106,6 +106,9 @@ /** The Animation Objects. */ private AnimationObjects animationObjects; + /** The Face Objects. */ + private FaceObjects faceObjects; + // icons for the map and arch pictures. private static ImageIcon mapSelIcon; @@ -174,8 +177,6 @@ /** Pickmaps cannot be edited while lockedPickmaps is true. */ private boolean lockAllPickmaps = false; - private FaceObjects faceObjects; - /** Constructs the main controller and its model and view. */ public CMainControl() { instance = this; @@ -193,6 +194,14 @@ } /** + * Get the Face Objects. + * @return faceObjects + */ + public FaceObjects getFaceObjects() { + return faceObjects; + } + + /** * Initialises this main controller. * @param doShow <code>true</code> for showing, <code>false</code> for not showing. */ @@ -285,14 +294,6 @@ } /** - * Get the Face Objects. - * @return faceObjects - */ - public FaceObjects getFaceObjects() { - return faceObjects; - } - - /** * Set the mapiew to show tiles of the given type. * (If no tileEdit is set, everything is displayed) * @param v tileedit bitmask of types to show Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-12-14 21:49:25 UTC (rev 1065) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-12-14 22:00:37 UTC (rev 1066) @@ -382,7 +382,9 @@ return faceObjects; } - /** Initialises this main controller. */ + /** + * Initialises this main controller. + */ void init() { // Get the current directory currentDir = new File(System.getProperty("user.dir")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-14 22:06:23
|
Revision: 1068 http://svn.sourceforge.net/gridarta/?rev=1068&view=rev Author: akirschbaum Date: 2006-12-14 14:06:24 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-14 22:03:54 UTC (rev 1067) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-14 22:06:24 UTC (rev 1068) @@ -952,7 +952,6 @@ * @param mapModel MapModel to save */ public void encodeMapFile(@NotNull final File file, final MapModel mapModel) { - final String fname = file.getAbsolutePath(); try { final CMapWriter mapFileEncoder = new CMapWriter(file); try { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-12-14 22:03:54 UTC (rev 1067) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-12-14 22:06:24 UTC (rev 1068) @@ -618,21 +618,6 @@ } /** - * A new edit type was selected from the view menu. Now - * we activate the new type and calculate it for each GameObject on - * each map where this type has not yet been used. - * @param newType new selected edit type (should not be more than one) - */ - void selectEditType(final int newType) { - // calculate the new type for all opened maps: - for (final MapControl level : levels) { - level.addEditType(newType); // calculate new type - } - - setTileEdit(newType); // activate the new type for all views - } - - /** * Return the map of a file if the file is opened. * @param path path to map file * @return map of file <var>path</var> or <code>null</code> if map not open This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-14 22:11:24
|
Revision: 1070 http://svn.sourceforge.net/gridarta/?rev=1070&view=rev Author: akirschbaum Date: 2006-12-14 14:11:23 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Unify comments. Modified Paths: -------------- trunk/crossfire/src/cfeditor/messages.properties trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/MapViewIFrame.java Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2006-12-14 22:08:07 UTC (rev 1069) +++ trunk/crossfire/src/cfeditor/messages.properties 2006-12-14 22:11:23 UTC (rev 1070) @@ -5,6 +5,7 @@ # <name>.<image set name>.111 availableImageSets=base +########## # Dialogs collectArchesNotReady.title=Arches still loading Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-12-14 22:08:07 UTC (rev 1069) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-12-14 22:11:23 UTC (rev 1070) @@ -1705,7 +1705,6 @@ if (activePickmap == null) { ACTION_FACTORY.showMessageDialog(mainView, "revertPickmapNoPickmaps"); } else { - // ask for confirmation if (!activePickmap.isLevelChanged() || ACTION_FACTORY.showQuestionDialog(mainView, "confirmRevertPickmap", activePickmap.getMapFileName())) { final File mfile = activePickmap.getMapFile(); // store file if (!mfile.exists()) { Modified: trunk/daimonin/src/daieditor/MapViewIFrame.java =================================================================== --- trunk/daimonin/src/daieditor/MapViewIFrame.java 2006-12-14 22:08:07 UTC (rev 1069) +++ trunk/daimonin/src/daieditor/MapViewIFrame.java 2006-12-14 22:11:23 UTC (rev 1070) @@ -66,7 +66,7 @@ /** * Constructs a level view. * @param mainControl the main controller - * @param mapControl the controller of this view + * @param mapControl the controller of this view * @param number Each view of a level will get a number */ public MapViewIFrame(final CMainControl mainControl, final MapControl mapControl, final int number) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-14 22:20:20
|
Revision: 1071 http://svn.sourceforge.net/gridarta/?rev=1071&view=rev Author: akirschbaum Date: 2006-12-14 14:20:20 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Fix typo. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanel.java trunk/crossfire/src/cfeditor/CFArchType.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/CFArchType.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-12-14 22:11:23 UTC (rev 1070) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-12-14 22:20:20 UTC (rev 1071) @@ -177,17 +177,17 @@ } tabDesktop.insertTab(name, null, newnode.data.getPanel(), null, i); - // careful: during the build proccess we are setting 'selectedPanel' + // careful: during the build process we are setting 'selectedPanel' // in spite of the fact that this panel might *not* actually be selected selectedPanel = newnode.data; } /** - * After the build proccess is completed and the panels have + * After the build process is completed and the panels have * been fully constructed, we must correct the 'selectedPanel' * setting and make sure the arch list is properly drawn. */ - public void finishBuildProccess() { + public void finishBuildProcess() { final Component sel = tabDesktop.getSelectedComponent(); for (final PanelNode node : panelNodeList) { if (node.data.getPanel() == sel) { Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-12-14 22:11:23 UTC (rev 1070) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-12-14 22:20:20 UTC (rev 1071) @@ -227,7 +227,7 @@ } } - // now get all children and proccess them in order: + // now get all children and process them in order: children = root.getChildren(); boolean inSection; String section = "?"; Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-12-14 22:11:23 UTC (rev 1070) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-12-14 22:20:20 UTC (rev 1071) @@ -318,8 +318,8 @@ archPanel.movePickmapPanelToFront(); } - public void finishArchPanelBuildProccess() { - archPanel.finishBuildProccess(); + public void finishArchPanelBuildProcess() { + archPanel.finishBuildProcess(); } /** Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-14 22:11:23 UTC (rev 1070) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2006-12-14 22:20:20 UTC (rev 1071) @@ -145,7 +145,7 @@ mainControl.setStatusText("Sorting..."); connectFaces(); // attach faces to arches mainControl.setTabPaneEnabled(true); - mainControl.getMainView().finishArchPanelBuildProccess(); + mainControl.getMainView().finishArchPanelBuildProcess(); System.gc(); // load the autojoin lists Modified: trunk/daimonin/src/daieditor/CFArchType.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchType.java 2006-12-14 22:11:23 UTC (rev 1070) +++ trunk/daimonin/src/daieditor/CFArchType.java 2006-12-14 22:20:20 UTC (rev 1071) @@ -224,7 +224,7 @@ } } - // now get all children and proccess them in order: + // now get all children and process them in order: for (final Element elem : new NodeListIterator<Element>(root, ELEMENT_NODE)) { // attribute directly in type element if (elem.getNodeName().equalsIgnoreCase(XML_ATTRIBUTE)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 20:11:50
|
Revision: 1076 http://svn.sourceforge.net/gridarta/?rev=1076&view=rev Author: akirschbaum Date: 2006-12-15 12:11:50 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Remove unused methods. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanel.java trunk/daimonin/src/daieditor/CArchPanel.java trunk/daimonin/src/daieditor/CArchPanelPan.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-12-15 20:09:11 UTC (rev 1075) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-12-15 20:11:50 UTC (rev 1076) @@ -113,10 +113,6 @@ add(splitPane, BorderLayout.CENTER); } - public static List<PanelNode> getPanelNodeList() { - return panelNodeList; - } - /** Move the pickmap panel in front of the default-archpanel. */ public void movePickmapPanelToFront() { if (archAndPickPane != null && archAndPickPane.getTabCount() > 1) { Modified: trunk/daimonin/src/daieditor/CArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanel.java 2006-12-15 20:09:11 UTC (rev 1075) +++ trunk/daimonin/src/daieditor/CArchPanel.java 2006-12-15 20:11:50 UTC (rev 1076) @@ -119,10 +119,6 @@ }); } - public static List<PanelNode> getPanelNodeList() { - return panelNodeList; - } - /** Move the pickmap panel in front of the default-archpanel. */ public void movePickmapPanelToFront() { if (archAndPickPane != null && archAndPickPane.getTabCount() > 1) { Modified: trunk/daimonin/src/daieditor/CArchPanelPan.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-15 20:09:11 UTC (rev 1075) +++ trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-12-15 20:11:50 UTC (rev 1076) @@ -196,28 +196,6 @@ return archList; } - /** - * Returns an array with category numbers as Strings. - * This is only needed when arche collection is run, so we want - * to know to which categories the arches belong to. - * @return an array of the categories of all arches in this panel - */ - public String[] getListCategoryArray() { - final String[] catList = new String[archList.size()]; - - int i = 0; - for (final PanelEntry p : archList) { - try { - final int index = p.getIndex(); - catList[i++] = jbox.getItemAt(index).toString().trim(); - } catch (final NullPointerException e) { - log.warn("Nullpointer in getListCategoryArray()!", e); - } - } - - return catList; - } - void showArchList() { final int index = jbox.getSelectedIndex(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 22:01:25
|
Revision: 1083 http://svn.sourceforge.net/gridarta/?rev=1083&view=rev Author: akirschbaum Date: 2006-12-15 14:01:25 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Unify comments. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchAttrib.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CGUIUtils.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/MapViewIFrame.java trunk/crossfire/src/cfeditor/MultiPositionData.java trunk/crossfire/src/cfeditor/ReplaceDialog.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFArchAttrib.java trunk/daimonin/src/daieditor/CFArchTypeList.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/CMapTileList.java trunk/daimonin/src/daieditor/CPickmapPanel.java trunk/daimonin/src/daieditor/IGUIConstants.java trunk/daimonin/src/daieditor/MapViewIFrame.java trunk/daimonin/src/daieditor/MultiPositionData.java trunk/daimonin/src/daieditor/ReplaceDialog.java trunk/daimonin/src/daieditor/ScriptArchData.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -1330,7 +1330,7 @@ imagePanel.setIcon(mainControl.getArchetypeSet().getFace(gameObject.getFaceNr())); if (newMsg != null) { - // set new msg text only when it is not equal to default gameObject + // set new msg text only when it is not equal to Archetype if (!newMsg.trim().equals(archetype.getMsgText() == null ? "" : archetype.getMsgText().trim())) { gameObject.deleteMsgText(); gameObject.addMsgText(newMsg); Modified: trunk/crossfire/src/cfeditor/CFArchAttrib.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -59,7 +59,7 @@ private String nameOld; // original attr. name (from the CF arches) - private String endingOld; // for dataType = 'ArchAttribType.TEXT' this is the terminating string + private String endingOld; // for dataType = ArchAttribType.TEXT this is the terminating string // (example: 'endmsg' for arch message) private String nameNew; // new attr. name (for the user-friendly GUI) Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -256,7 +256,7 @@ /** * Parse a list vector from an xml list element. * @param root element to parse - * @return List with data parsed from <var>root</var>. + * @return List with data parsed from <var>root</var> */ private List<?> parseListFromElement(final Element root) { final List<Object> list = new ArrayList<Object>(); Modified: trunk/crossfire/src/cfeditor/CGUIUtils.java =================================================================== --- trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -54,6 +54,7 @@ private static final Map<String, ImageIcon> imageCache = new HashMap<String, ImageIcon>(); + /** Do not subclass. */ private CGUIUtils() { } Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -966,7 +966,7 @@ /** * Browse first through the default arch list and attach map arches to it * then browse through the face list and try to find the pictures. - * @param objects GameObjects to collect. + * @param objects List of GameObjects to collect * @param file File (for error messages). * @return <code>true</code> in case of success, otherwise <code>false</code>. * @note The current implementation always returns <code>true</code>. Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -161,7 +161,7 @@ /** * Constructs the main view and registers the given main controller. - * @param mainControl The controller of this view. + * @param mainControl the controller of this view */ CMainView() { super(IGUIConstants.APP_NAME + " - " + IGUIConstants.APP_WINDOW_TITLE); @@ -183,7 +183,7 @@ /** * Initialises (builds) this view. - * @param doShow <code>true</code> whether to show, otherwise <code>false</code>. + * @param doShow <code>true</code> whether to show, otherwise <code>false</code> */ void init(final boolean doShow) { final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); @@ -306,8 +306,8 @@ } /** - * Returns whether selection would be from a pickmap (otherwise it would be from the archlist). - * @return <code>true</code> if selection would be from a pickmap, <code>false</code> for the archlist. + * Returns whether a pickmap is active. + * @return <code>true</code> if a pickmap is active, <code>false</code> if the archlist is active */ public boolean isPickmapActive() { return pickmapActive; @@ -323,12 +323,12 @@ } /** - * Returns the highlighted Archetype / GameObject. - * @return the active arch in the left-side panel. - * This can either be a Archetype from the archlist, or - * a custom GameObject from a pickmap. - * IMPORTANT: The returned GameObject is not a clone. A copy - * must be generated before inserting such an arch to the map. + * Returns the active arch in the left-side panel. + * This can either be a default arch from the archlist, or + * a custom arch from a pickmap. + * IMPORTANT: The returned GameObject is not a clone. A copy + * must be generated before inserting such an arch to the map. + * @return the active arch in the left-side panel */ public GameObject getArchPanelHighlight() { @@ -360,7 +360,7 @@ /** * Returns the JTabbedPane with all pickmaps. - * @return The JTabbedPane with all pickmaps. + * @return the JTabbedPane with all pickmaps */ public JTabbedPane getPickmapPanel() { return pickmapPanel; @@ -395,7 +395,7 @@ /** * Sets the enabled state of the tab pane for Archetypes. - * @param tabPaneEnabled <code>true</code> to enable tab pane, <code>false</code> to disable it. + * @param tabPaneEnabled <code>true</code> to enable tab pane, <code>false</code> to disable it */ public void setTabPaneEnabled(final boolean tabPaneEnabled) { archPanel.setTabPaneEnabled(tabPaneEnabled); @@ -462,7 +462,7 @@ } /** - * Refreshes the state of menu items and toolbar buttons. + * Refresh the state of menu items and toolbar buttons. * Beware!! Executing this function eats up a lot of time! * Avoid using it whenever possible. */ @@ -476,7 +476,7 @@ refresh3(); } - /** Refreshes the map arch panel (bottom window). */ + /** Refresh the map arch panel (bottom window). */ void refreshMapArchPanel() { mapArchPanel.refresh(); } @@ -492,7 +492,7 @@ aSave.setEnabled(state && mainControl.isPlainSaveEnabled()); } - /** Refreshes the state of the menu only. */ + /** Refresh the state of the menu only. */ public void refreshMenus() { // TODO: This method shouldn't really be invoked. // Each action should be setEnabled() individually as needed. @@ -531,7 +531,7 @@ /** * Removes (closes) the level view. - * @param mapView the map view to be removed (closed). + * @param mapView the map view to be removed (closed) */ void removeLevelView(final MapViewIFrame mapView) { if (!mapViews.contains(mapView)) { @@ -576,9 +576,9 @@ /** * Shows the given message in the UI. - * @param strTitle The title of the message. - * @param strMessage The message to be shown. - * @param messageType Type of message (see JOptionPane constants), defines icon used + * @param strTitle the title of the message + * @param strMessage the message to be shown + * @param messageType type of message (see JOptionPane constants), defines icon used */ public void showMessage(final String strTitle, final String strMessage, final int messageType) { JOptionPane.showMessageDialog(this, strMessage, strTitle, messageType); @@ -591,9 +591,9 @@ /** * Shows the given confirmation message in the UI. The message * is a yes/no option. - * @param strTitle The title of the message. - * @param strMessage The message to be shown. - * @return Ture if the user agrees, false if user disagrees. + * @param strTitle the title of the message + * @param strMessage the message to be shown + * @return <code>true</code> if the user agrees, <code>false</code> if user disagrees */ public boolean askConfirm(final String strTitle, final String strMessage) { return JOptionPane.showConfirmDialog(this, strMessage, strTitle, JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION; @@ -655,7 +655,7 @@ /** * Sets the given level view as the current one. - * @param view The new current level view. + * @param view the new current level view */ public void setCurrentLevelView(final MapViewIFrame view) { mapViews.remove(view); @@ -676,7 +676,7 @@ /** * Notifies that the level views focus is lost it is inserted * as the second in line to the level view vector. - * @param view The level view who lost the focus. + * @param view the level view who lost the focus */ public void levelViewFocusLostNotify(final MapViewIFrame view) { @@ -689,7 +689,7 @@ /** * Notifies that the given level view is now set as the current one. - * @param view The new current level view. + * @param view the new current level view */ public void levelViewFocusGainedNotify(final MapViewIFrame view) { @@ -743,7 +743,7 @@ } /** - * Rebuild the "window" menu. + * Rebuild the window menu. */ private void rebuildWindowMenu() { final JMenu menuWindow = (JMenu) ACTION_FACTORY.find(getJMenuBar(), "window"); @@ -761,7 +761,7 @@ } /** - * Rebuild the "look and feel" menu entries in the view menu. + * Rebuild the look and feel menu entries in the view menu. */ private void rebuildLookAndFeelMenuEntries() { final JMenu menuView = (JMenu) ACTION_FACTORY.find(getJMenuBar(), "view"); Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -241,8 +241,8 @@ } /** - * Returns the selected GameObject within this list (currently selected square). - * @return The selected GameObject within this list. + * Return the currently selected GameObject within this list (currently selected MapSquare). + * @return the currently selected GameObject */ @Nullable public GameObject getMapTileSelection() { return (GameObject) list.getSelectedValue(); Modified: trunk/crossfire/src/cfeditor/CPickmapPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -69,7 +69,9 @@ /** The current active pickmap ontop. */ private MapControl currentPickMap; - /** Creates a PickmapPanel. */ + /** + * Create a CPickmapPanel. + */ public CPickmapPanel() { mainControl = CMainControl.getInstance(); instance = this; @@ -78,16 +80,16 @@ } /** - * Returns the singleton instance of this class. - * @return The singleton instance of this class. + * Return the singleton instance of this class. + * @return the singleton instance of this class */ public static CPickmapPanel getInstance() { return instance; } /** - * Returns whether the loading process of pickmaps is complete and at least one pickmap is available. - * @return <code>true</code> if pickmaps are loaded, otherwise <code>false</code> + * Return whether loading of pickmaps is complete and at least one pickmap is available. + * @return <code>true</code> if loading of pickmaps is complete and at least one pickmap is available, otherwise <code>false</code> * @todo check whether this method returns <code>true</code> or <code>false</code> if the loading process is complete but no pickmaps are availbale. */ public boolean isLoadComplete() { @@ -95,15 +97,17 @@ } /** - * Returns the currently active pickmap. + * Return the currently active pickmap. * If there is no currently active pickmap, this method returns <code>null</code>. - * @return Currently active pickmap or <code>null</code> if there are no pickmaps. + * @return the currently active pickmap or <code>null</code> if there is no pickmap */ public MapControl getCurrentPickmap() { return currentPickMap; } - /** Load all pickmaps and build the pickmap-panel in the process. */ + /** + * Load all pickmaps and build the pickmap-panel. + */ public void loadPickmaps() { // the main-panel for pickmaps: tabpane = mainControl.getMainView().getPickmapPanel(); @@ -311,7 +315,7 @@ /** * Add the ArchNPickChangeListener to the panel containing both - * arcglist and pickmaps. + * archlist and pickmaps. * @param pane the left-side panel * @todo this method's name is a Bad Thing */ @@ -355,7 +359,7 @@ private int selectedIndex; // current state of selection /** - * Create a new ArchNPickChangeListener. + * Create an ArchNPickChangeListener. * @param mainView the main view * @param pane the JTabbedPane containing both archlist and pickmaps */ Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -39,8 +39,7 @@ /** * This class manages the cut/copy/paste actions in maps. The data is stored in - * an ordinary but invisible map-object. The CopyBuffer instance is currently - * attached to CMainControl. + * an ordinary but invisible map-object. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ public final class CopyBuffer { Modified: trunk/crossfire/src/cfeditor/MapViewIFrame.java =================================================================== --- trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -207,7 +207,7 @@ } /** - * Returns the Action for selecting this window. + * Return the Action for selecting this window. * @return the Action for selecting this window */ public WindowAction getWindowAction() { Modified: trunk/crossfire/src/cfeditor/MultiPositionData.java =================================================================== --- trunk/crossfire/src/cfeditor/MultiPositionData.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/crossfire/src/cfeditor/MultiPositionData.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -41,10 +41,10 @@ private static final Logger log = Logger.getLogger(MultiPositionData.class); - /** Number of rows and columns in the array. */ + /** Number of columns in the array. */ public static final int X_DIM = 34; - /** Number of rows and columns in the array. */ + /** Number of rows in the array. */ public static final int Y_DIM = 16; private static MultiPositionData instance = null; @@ -120,7 +120,7 @@ log.info("Loaded multipart position data from '" + IGUIConstants.ARCHDEF_FILE + "'"); } } catch (final IOException e) { - /* TODO ignore (really?) */ + // FIXME either do something or DOCUMENT TO IGNORE ME } } Modified: trunk/crossfire/src/cfeditor/ReplaceDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -109,7 +109,7 @@ /** * Returns whether this frame has been fully built. - * @return <code>true</code> when if this frame has been fully built, otherwise <code>false</code>. + * @return <code>true</code> if this frame has been fully built, otherwise <code>false</code> */ public static boolean isBuilt() { return instance != null && instance.isBuilt; Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -368,9 +368,9 @@ /** * A popup is opened and the user can create a new scripting event - * which gets attached to this arch. - * @param panelList JList from the MapArchPanel (script tab) which displays the events - * @param arch GameObject that's name should be used for creating a reasonable default script name. + * which gets attached to this gameObject. + * @param panelList JList from the MapArchPanel (script tab) which displays the events + * @param arch GameObject that's name should be used for creating a reasonable default script name */ public void addEventScript(final JList panelList, final GameObject arch) { final String archName = arch.getBestName(); Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -365,7 +365,7 @@ } /** - * Construct the Combo box for arrays of "list data" (this is used for LIST). + * Construct the Combo box for arrays of "list data" (this is used for ArchAttribType.LIST). * @param attr list attribute * @param listData List with list items and corresponding values, that means the types are altering: String,Integer * @return the completed <code>JComboBox</code> Modified: trunk/daimonin/src/daieditor/CFArchAttrib.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchAttrib.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/daimonin/src/daieditor/CFArchAttrib.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -74,7 +74,9 @@ private String section; // name of the section this attribute is in - /** Constructor. */ + /** + * Create a CFArchAttrib. + */ public CFArchAttrib() { nameOld = ""; nameNew = ""; Modified: trunk/daimonin/src/daieditor/CFArchTypeList.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -87,7 +87,6 @@ private final CFArchType defaultArchType = new CFArchType(null); // contains default type private final List<CFArchType> archTypeList = new ArrayList<CFArchType>(); // All but the default ArchType - // spell info: /** * Table with CAttribBitmask objects (value) accessible by name (key). Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -1237,7 +1237,7 @@ /** * Browse first through the default arch list and attach map arches to it * then browse through the face list and try to find the pictures. - * @param objects List of GameObjects to collect. + * @param objects List of GameObjects to collect * @param uri URI they were read from (for error messages). */ public void collectTempList(final List<GameObject> objects, final String uri) { Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -202,7 +202,7 @@ * @param prefs Preferences * @param defwidth default width * @param defheight default height - * @return Center panel. + * @return center panel */ private JPanel createCenterPanel(final Preferences prefs, final int defwidth, final int defheight) { final JPanel centerPanel = new JPanel(new BorderLayout()); @@ -257,7 +257,7 @@ /** * Returns whether a pickmap is active. - * @return <code>true</code> if a pickmap is active, <code>false</code> if the archlist is active. + * @return <code>true</code> if a pickmap is active, <code>false</code> if the archlist is active */ public boolean isPickmapActive() { return pickmapActive; @@ -274,7 +274,7 @@ * a custom arch from a pickmap. * IMPORTANT: The returned GameObject is not a clone. A copy * must be generated before inserting such an arch to the map. - * @return the active arch in the left-side panel. + * @return the active arch in the left-side panel */ @Nullable public GameObject getArchPanelHighlight() { @@ -309,7 +309,7 @@ * custom arches from a pickmap. * IMPORTANT: The returned GameObject list contains no clone. A copy * must be generated before inserting such arches to the map. - * @return the selected arches in the left-side panel. + * @return the selected arches in the left-side panel */ @Nullable public List<GameObject> getArchPanelSelection() { @@ -339,7 +339,7 @@ /** * Returns the JTabbedPane with all pickmaps. - * @return The JTabbedPane with all pickmaps. + * @return the JTabbedPane with all pickmaps */ public JTabbedPane getPickmapPanel() { return pickmapPanel; @@ -369,7 +369,7 @@ /** * Sets the enabled state of the tab pane for Archetypes. - * @param tabPaneEnabled <code>true</code> to enable tab pane, <code>false</code> to disable it. + * @param tabPaneEnabled <code>true</code> to enable tab pane, <code>false</code> to disable it */ public void setTabPaneEnabled(final boolean tabPaneEnabled) { archPanel.setTabPaneEnabled(tabPaneEnabled); @@ -435,7 +435,7 @@ } /** - * Refreshes the state of menu items and toolbar buttons. + * Refresh the state of menu items and toolbar buttons. * Beware!! Executing this function eats up a lot of time! * Avoid using it whenever possible. */ @@ -457,7 +457,7 @@ aRevert.setEnabled(state); } - /** Refreshes the state of the menu only. */ + /** Refresh the state of the menu only. */ public void refreshMenus() { // TODO: This method shouldn't really be invoked. // Each action should be setEnabled() individually as needed. @@ -484,7 +484,7 @@ /** * Removes (closes) the level view. - * @param mapView the map view to be removed (closed). + * @param mapView the map view to be removed (closed) */ public void removeLevelView(final MapViewIFrame mapView) { assert mapViews.contains(mapView); @@ -580,7 +580,7 @@ /** * Sets the given level view as the current one. - * @param view The new current level view. + * @param view the new current level view */ public void setCurrentLevelView(final MapViewIFrame view) { mapViews.remove(view); @@ -607,7 +607,7 @@ /** * Notifies that the level views focus is lost it is inserted * as the second in line to the level view vector. - * @param view The level view who lost the focus. + * @param view the level view who lost the focus */ public void levelViewFocusLostNotify(final MapViewIFrame view) { @@ -620,7 +620,7 @@ /** * Notifies that the given level view is now set as the current one. - * @param view The new current level view. + * @param view the new current level view */ public void levelViewFocusGainedNotify(final MapViewIFrame view) { @@ -667,7 +667,7 @@ /** * Update the recent menu. - * @param recents Current recents. + * @param recents current recents */ public void updateRecent(final List<CMainControl.Recent> recents) { final JMenu recentMenu = (JMenu) ACTION_FACTORY.find(getJMenuBar(), "recent"); @@ -677,7 +677,9 @@ } } - /** Rebuilds the window menu. */ + /** + * Rebuild the window menu. + */ private void rebuildWindowMenu() { final JMenu menuWindow = (JMenu) ACTION_FACTORY.find(getJMenuBar(), "window"); menuWindow.removeAll(); Modified: trunk/daimonin/src/daieditor/CMapTileList.java =================================================================== --- trunk/daimonin/src/daieditor/CMapTileList.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/daimonin/src/daieditor/CMapTileList.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -280,8 +280,8 @@ } /** - * Returns the currently selected GameObject within this list (currently selected MapSquare). - * @return The currently selected GameObject. + * Return the currently selected GameObject within this list (currently selected MapSquare). + * @return the currently selected GameObject */ public GameObject getMapTileSelection() { return (GameObject) list.getSelectedValue(); Modified: trunk/daimonin/src/daieditor/CPickmapPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -68,7 +68,7 @@ private MapControl currentPickMap; /** - * Creates a CPickmapPanel. + * Create a CPickmapPanel. */ public CPickmapPanel() { mainControl = CMainControl.getInstance(); @@ -78,31 +78,31 @@ } /** - * Returns the Singleton instance of this class. - * @return The Singleton instance of this class. + * Return the singleton instance of this class. + * @return the singleton instance of this class */ public static CPickmapPanel getInstance() { return instance; } /** - * Returns whether loading of pickmaps is complete and at least one pickmap is available. - * @return <code>true</code> if loading of pickmaps is complete and at least one pickmap is available, otherwise <code>false</code>. + * Return whether loading of pickmaps is complete and at least one pickmap is available. + * @return <code>true</code> if loading of pickmaps is complete and at least one pickmap is available, otherwise <code>false</code> */ public boolean isLoadComplete() { return loadComplete; } /** - * Returns the currently active pickmap (is on top). - * @return The currently active pickmap or <code>null</code> if there is no pickmap. + * Return the currently active pickmap (is on top). + * @return the currently active pickmap or <code>null</code> if there is no pickmap */ public MapControl getCurrentPickmap() { return currentPickMap; } /** - * Loads all pickmaps and builds the pickmap-panel. + * Load all pickmaps and build the pickmap-panel. */ public void loadPickmaps() { // the main-panel for pickmaps: @@ -343,8 +343,8 @@ } /** - * Add the ArchNPickChangeListener to the panel containing both. - * arcglist and pickmaps. + * Add the ArchNPickChangeListener to the panel containing both + * archlist and pickmaps. * @param pane the left-side panel * @todo this method's name is a Bad Thing */ @@ -390,7 +390,7 @@ private int selectedIndex; // current state of selection /** - * Creates an ArchNPickChangeListener. + * Create an ArchNPickChangeListener. * @param mainView the main view * @param pane the JTabbedPane containing both archlist and pickmaps */ Modified: trunk/daimonin/src/daieditor/IGUIConstants.java =================================================================== --- trunk/daimonin/src/daieditor/IGUIConstants.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/daimonin/src/daieditor/IGUIConstants.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -40,7 +40,7 @@ /** * Internal version number of the included online-documentation. * Increasing the number causes an automated popup of the docu - * when users upgrade their editor and run for the first time + * when users upgrade their editor and run for the first time. */ int DOCU_VERSION = 1; Modified: trunk/daimonin/src/daieditor/MapViewIFrame.java =================================================================== --- trunk/daimonin/src/daieditor/MapViewIFrame.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/daimonin/src/daieditor/MapViewIFrame.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -141,8 +141,8 @@ } /** - * Returns the Action for selecting this Window. - * @return The Action for selecting this Window. + * Return the Action for selecting this window. + * @return the Action for selecting this window */ public WindowAction getWindowAction() { return windowAction; @@ -152,7 +152,7 @@ return view; } - /** Action class for selecting this Window. */ + /** Action class for selecting this window. */ public final class WindowAction extends AbstractAction { /** Constructor. */ Modified: trunk/daimonin/src/daieditor/MultiPositionData.java =================================================================== --- trunk/daimonin/src/daieditor/MultiPositionData.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/daimonin/src/daieditor/MultiPositionData.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -79,7 +79,7 @@ try { final Dimension d = new Dimension(); final Point p = new Point(); - int yp = 0; // y-index in the data array + int yp = 0; // y-index in the data array // read the whole file line by line for (String line; (line = reader.readLine()) != null;) { Modified: trunk/daimonin/src/daieditor/ReplaceDialog.java =================================================================== --- trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -115,7 +115,7 @@ /** * Returns whether this frame has been fully built. - * @return <code>true</code> if this frame has been fully built, otherwise <code>false</code>. + * @return <code>true</code> if this frame has been fully built, otherwise <code>false</code> */ public static boolean isBuilt() { return instance != null && instance.isBuilt; Modified: trunk/daimonin/src/daieditor/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/ScriptArchData.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/daimonin/src/daieditor/ScriptArchData.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -241,7 +241,7 @@ } /** - * Try to create a reasonable default script name for lazy users :-). + * Try to create a reasonable default script name for lazy users. * @param archName the best suitable name for the arch (see GameObject.getBestName()) * @return a nice default script name without whitespaces */ @@ -324,8 +324,8 @@ /** * A popup is opened and the user can create a new scripting event * which gets attached to this gameObject. - * @param panelList JList from the MapArchPanel (script tab) which displays the events - * @param gameObject GameObject to add event to. + * @param panelList JList from the MapArchPanel (script tab) which displays the events + * @param gameObject GameObject to add event to * @return <code>true</code> if a script was added, <code>false</code> if the user cancelled */ public boolean addEventScript(final JList panelList, final GameObject gameObject) { Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2006-12-15 21:06:55 UTC (rev 1082) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2006-12-15 22:01:25 UTC (rev 1083) @@ -81,7 +81,7 @@ private List<File> animFiles; /** - * Create the GameObject stack. + * Create the ArchetypeSet. * @param mainControl reference to CMainControl */ public ArchetypeSet(final CMainControl mainControl) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 22:18:13
|
Revision: 1084 http://svn.sourceforge.net/gridarta/?rev=1084&view=rev Author: akirschbaum Date: 2006-12-15 14:18:14 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Unify use of ActionFactory in ScriptArchData. Modified Paths: -------------- trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/daimonin/src/daieditor/ScriptArchData.java trunk/daimonin/src/daieditor/messages.properties Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-12-15 22:01:25 UTC (rev 1083) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-12-15 22:18:14 UTC (rev 1084) @@ -49,6 +49,7 @@ import javax.swing.WindowConstants; import static javax.swing.WindowConstants.HIDE_ON_CLOSE; import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; +import net.sf.japi.swing.ActionFactory; import net.sf.japi.util.Arrays2; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -71,6 +72,9 @@ public static final int EDATA_EVENT_OPTIONS = 2; + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + // popup frame to edit script paths: private static JDialog pathFrame; @@ -526,8 +530,7 @@ } else { // if map dir doesn't exist, this is not going to work frame.setVisible(false); - mainControl.showMessage("Invalid Map Directory", "The map directory '" + mapDir + "' does not exist!\n" + - "Please select menu 'File->Options...' and correct that.", JOptionPane.ERROR_MESSAGE); + ACTION_FACTORY.showMessageDialog(frame, "mapDirDoesntExist", mapDir); return; } } else { @@ -712,8 +715,7 @@ ScriptEditControl.getInstance().openScriptFile(scriptFile.getAbsolutePath()); } else { // file does not exist! - mainControl.showMessage("Script file not found", - "The file '" + path + "' does not exist.\nPlease correct the path.", JOptionPane.ERROR_MESSAGE); + ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "openScriptNotFound", path); } } Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2006-12-15 22:01:25 UTC (rev 1083) +++ trunk/crossfire/src/cfeditor/messages.properties 2006-12-15 22:18:14 UTC (rev 1084) @@ -11,6 +11,9 @@ collectArchesNotReady.title=Arches still loading collectArchesNotReady.message=You have to wait for all arches to be loaded\nbefore you can collect them. +mapDirDoesntExist.title=Invalid map directory +mapDirDoesntExist.message=The map directory "{0}" doesn''t exist.\nPlease select menu ''File->Options...'' and correct that. + openFileWantedNoArches.title=Cannot open map openFileWantedNoArches.message=There are currently no arches avaliable!\nYou need to have arches loaded before opening a map. openFileWantedNotReady.title=Cannot open map @@ -25,6 +28,9 @@ enterExitNotSaved.title=Map not saved enterExitNotSaved.message=You must save the map first to follow a relative path. +openScriptNotFound.title=Script file not found +openScriptNotFound.message=The file ''{0}'' does not exist.\nPlease correct the path. + # Map Properties mapParametersTabTitle=Parameters mapShopTabTitle=Shop Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-15 22:01:25 UTC (rev 1083) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-15 22:18:14 UTC (rev 1084) @@ -6,6 +6,9 @@ collectArchesNotReady.title=Archetypen noch nicht geladen collectArchesNotReady.message=Sie m\xFCssen warten bis die Archetypen geladen\nsind, bevor Sie sie neu sammeln k\xF6nnen. +mapDirDoesntExist.title=Ung\xFCltiges Verzeichnis +mapDirDoesntExist.message=Das Verzeichnis f\xFCr Karten "{0}" existiert nicht.\nBitte legen sie es unter ''Datei->Optionen...'' fest. + closePickmapNotLoaded.title=Kann Pickmap nicht schlie\xDFen closePickmapNotLoaded.message=Es sind keine Pickmaps geladen.\nEntweder existieren keine Pickmaps oder\nsie sind noch nicht vollst\xE4ndig geladen. closePickmapHidden.title=Kann Pickmap nicht schlie\xDFen @@ -63,6 +66,9 @@ enterExitNotSaved.title=Karte nicht gesichert enterExitNotSaved.message=Der Ausgang verwendet einen relativen Dateinamen. Um ihm zu folgen m\xFCssen Sie die Karte vorher sichern. +openScriptNotFound.title=Script-Datei nicht gefunden +openScriptNotFound.message=Die Datei ''{0}'' existiert nicht.\nBitte geben sie einen g\xFCltigen Dateinamen an. + enterTileNoTile.title=Ziel ung\xFCltig enterTileNoTile.message=In die angegebene Richtung existiert kein Verbindungspfad. Modified: trunk/daimonin/src/daieditor/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/ScriptArchData.java 2006-12-15 22:01:25 UTC (rev 1083) +++ trunk/daimonin/src/daieditor/ScriptArchData.java 2006-12-15 22:18:14 UTC (rev 1084) @@ -485,7 +485,7 @@ if (!mapDir.exists()) { // if map dir doesn't exist, this is not going to work frame.setVisible(false); - ACTION_FACTORY.showMessageDialog(frame, "mapDirDoesntExist"); + ACTION_FACTORY.showMessageDialog(frame, "mapDirDoesntExist", mapDir); return false; } else { absScriptPath = mapDir.getAbsolutePath() + scriptPath; Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-12-15 22:01:25 UTC (rev 1083) +++ trunk/daimonin/src/daieditor/messages.properties 2006-12-15 22:18:14 UTC (rev 1084) @@ -57,7 +57,7 @@ mapUnsaved.title=Map Not Saved mapUnsaved.message=Please save this map first. -mapDirDoesntExist.title=Invalid Map Directory +mapDirDoesntExist.title=Invalid map directory mapDirDoesntExist.message=The map directory "{0}" doesn''t exist.\nPlease select menu ''File->Options...'' and correct that. openFileWantedNoArches.title=Cannot open map This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 22:29:23
|
Revision: 1088 http://svn.sourceforge.net/gridarta/?rev=1088&view=rev Author: akirschbaum Date: 2006-12-15 14:29:24 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Remove redundant class qualifier. 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-12-15 22:24:34 UTC (rev 1087) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-15 22:29:24 UTC (rev 1088) @@ -1144,7 +1144,7 @@ } } catch (final NumberFormatException e) { // parsing failed: wrong entry!! - JOptionPane.showMessageDialog(this, "Attribute '" + attr.ref.getNameNew() + "' must be a number!", "Input Error", JOptionPane.ERROR_MESSAGE); + showMessageDialog(this, "Attribute '" + attr.ref.getNameNew() + "' must be a number!", "Input Error", ERROR_MESSAGE); return false; } } @@ -1254,7 +1254,7 @@ if (!isNone && !CFTreasureListTree.containsTreasureList(inline) && !inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld()))) { // The user has specified a WRONG treasurelist name, and it does not come // from the default gameObject. -> Error and out. - JOptionPane.showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + "'" + inline + "' is not a known treasurelist name!", "Input Error", JOptionPane.ERROR_MESSAGE); + showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + "'" + inline + "' is not a known treasurelist name!", "Input Error", ERROR_MESSAGE); return false; } @@ -1698,7 +1698,7 @@ if (deselected == null) { deselected = frame.type.getTypeName(); } - if (JOptionPane.showConfirmDialog(frame, "Do you really want to change the type of this\nobject from \"" + deselected + "\" to \"" + newType.getTypeName() + "\"?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION) { + if (showConfirmDialog(frame, "Do you really want to change the type of this\nobject from \"" + deselected + "\" to \"" + newType.getTypeName() + "\"?", "Confirm", YES_NO_OPTION, INFORMATION_MESSAGE) == YES_OPTION) { // change is confirmed, now get it on... frame.type = newType; // set new type structure Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 22:24:34 UTC (rev 1087) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 22:29:24 UTC (rev 1088) @@ -1677,7 +1677,7 @@ if (deselected == null) { deselected = frame.type.getTypeName(); } - if (JOptionPane.showConfirmDialog(frame, "Do you really want to change the type of this\nobject from \"" + deselected + "\" to \"" + newType.getTypeName() + "\"?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION) { + if (showConfirmDialog(frame, "Do you really want to change the type of this\nobject from \"" + deselected + "\" to \"" + newType.getTypeName() + "\"?", "Confirm", YES_NO_OPTION, INFORMATION_MESSAGE) == YES_OPTION) { // change is confirmed, now get it on... frame.type = newType; // set new type structure This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 22:44:48
|
Revision: 1089 http://svn.sourceforge.net/gridarta/?rev=1089&view=rev Author: akirschbaum Date: 2006-12-15 14:44:47 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Prefer string constants over character constants in string concatenation. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/crossfire/src/cfeditor/map/MapArchObject.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFArchTypeList.java trunk/daimonin/src/daieditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/ScriptArchData.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -796,7 +796,7 @@ // fetch the bitmask data, then build the attribute panel final CAttribBitmask bitmask = typelist.getBitmaskTable().get((String) (attrib.getMisc()[0])); ((BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr).bitmask = bitmask; - cLabel = new JButton(new MaskChangeAL(attrib.getNameNew() + ':', (BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr)); + cLabel = new JButton(new MaskChangeAL(attrib.getNameNew() + ":", (BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr)); final JTextArea input = new JTextArea(); input.setBackground(getBackground()); input.setEditable(false); @@ -959,7 +959,7 @@ case BOOL_SPEC: { final boolean value = ((DialogAttrib<JCheckBox>) attr).input.isSelected(); // true/false if (value) { - doc.insertString(doc.getLength(), '<' + attr.ref.getNameNew() + ">\n", docStyle); + doc.insertString(doc.getLength(), "<" + attr.ref.getNameNew() + ">\n", docStyle); } } break; @@ -968,7 +968,7 @@ case FLOAT: { final String value = ((DialogAttrib<JFormattedTextField>) attr).input.getText(); // the attrib value if (value != null && value.length() > 0 && !value.equals("0")) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -977,7 +977,7 @@ case ANIMNAME: { final String value = ((DialogAttrib<JTextField>) attr).input.getText(); // the attrib value if (value != null && value.length() > 0) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -986,7 +986,7 @@ case LIST: { final String value = ((DialogAttrib<JComboBox>) attr).input.getSelectedItem().toString().trim(); // the attrib value if (value != null && value.length() > 0 && !value.startsWith("<")) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -1019,7 +1019,7 @@ case TREASURE: { final String value = ((DialogAttrib<JTextField>) attr).input.getText().trim(); // the attrib value if (value != null && value.length() > 0 && !value.equals(CFTreasureListTree.NONE_SYM)) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -1071,7 +1071,7 @@ case BOOL: { // a boolean attribute (flag) if (((DialogAttrib<JCheckBox>) attr).input.isSelected() != (archetype.getAttributeInt(attr.ref.getNameOld()) == 1)) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + (((DialogAttrib<JCheckBox>) attr).input.isSelected() ? 1 : 0) + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + (((DialogAttrib<JCheckBox>) attr).input.isSelected() ? 1 : 0) + "\n"; } } break; @@ -1085,7 +1085,7 @@ } // now see if we need to write it into the archtext or not if ((valString.equals("0") && !(archetype.getAttributeString(attr.ref.getNameOld()).length() == 0)) || (!valString.equals("0") && !archetype.getAttributeString(attr.ref.getNameOld()).equals(valString))) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + valString + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + valString + "\n"; } } break; @@ -1111,14 +1111,14 @@ case INT: { final int value = ((Number) ((DialogAttrib<JFormattedTextField>) attr).input.getValue()).intValue(); if (archetype.getAttributeInt(attr.ref.getNameOld()) != value) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + value + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } break; case LONG: { final long value = ((Number) ((DialogAttrib<JFormattedTextField>) attr).input.getValue()).longValue(); if (archetype.getAttributeLong(attr.ref.getNameOld()) != value) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + value + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } break; @@ -1281,7 +1281,7 @@ // we assume the default gameObject is "right" and we are "wrong". The typedefs aren't that trustworthy. // BUT - if the gameObject has a changed type, the archetype has lost it's credibility. // So, in this special case, the fixed attribute applies always. - newArchText = newArchText + type.getAttr()[i].getNameOld() + ' ' + type.getAttr()[i].getNameNew() + '\n'; + newArchText = newArchText + type.getAttr()[i].getNameOld() + " " + type.getAttr()[i].getNameNew() + "\n"; } } } Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -472,7 +472,7 @@ * @return name of this type, as defined in "typenumbers.xml" */ public String getArchTypeName(final int typeNr) { - return archTypeNumbers.containsKey(typeNr) ? archTypeNumbers.get(typeNr) : "*UNKNOWN" + typeNr + '*'; + return archTypeNumbers.containsKey(typeNr) ? archTypeNumbers.get(typeNr) : "*UNKNOWN" + typeNr + "*"; } /** Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -703,7 +703,7 @@ // file path is relative to map dir path = mainControl.getCurrentMap().getMapFile().getParentFile().getAbsolutePath(); // map dir if (!path.endsWith("/")) { - path += "/"; // append slash to map dir + path += '/'; // append slash to map dir } path += filePath; // append relative path to map dir path = path.replace('\\', '/'); // make sure there's only one kind of slash Modified: trunk/crossfire/src/cfeditor/map/MapArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -361,7 +361,7 @@ msgflag = false; } else { if (msgText.length() > 0) { - msgText.append("\n"); + msgText.append('\n'); } msgText.append(line2); } Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -312,7 +312,7 @@ // read all type names int i = 0; for (final CFArchType tmp : typelist) { - namelist[i++] = ' ' + tmp.getTypeName(); + namelist[i++] = " " + tmp.getTypeName(); } // the active type appears selected in the box @@ -792,7 +792,7 @@ // fetch the bitmask data, then build the attribute panel final CAttribBitmask bitmask = typelist.getBitmaskTable().get(attrib.getMisc()[0]); ((BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr).bitmask = bitmask; - cLabel = new JButton(new MaskChangeAL(attrib.getNameNew() + ':', (BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr)); + cLabel = new JButton(new MaskChangeAL(attrib.getNameNew() + ":", (BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr)); final JTextArea input = new JTextArea(); input.setBackground(getBackground()); input.setEditable(false); @@ -813,7 +813,7 @@ if (treasureName.trim().length() == 0 || "none".equalsIgnoreCase(treasureName.trim())) { treasureName = CFTreasureListTree.NONE_SYM; } - final JTextField input = new JTextField(' ' + treasureName, TEXTFIELD_COLUMNS); + final JTextField input = new JTextField(" " + treasureName, TEXTFIELD_COLUMNS); input.setEditable(false); cLabel = new JButton(new ViewTreasurelistAL((DialogAttrib<JTextField>) newAttr, this)); cComp = input; @@ -955,7 +955,7 @@ case BOOL_SPEC: { final boolean value = ((DialogAttrib<JCheckBox>) attr).input.isSelected(); // true/false if (value) { - doc.insertString(doc.getLength(), '<' + attr.ref.getNameNew() + ">\n", docStyle); + doc.insertString(doc.getLength(), "<" + attr.ref.getNameNew() + ">\n", docStyle); } } break; @@ -964,7 +964,7 @@ case FLOAT: { final String value = ((DialogAttrib<JFormattedTextField>) attr).input.getText(); // the attrib value if (value != null && value.length() > 0 && !value.equals("0")) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -973,7 +973,7 @@ case ANIMNAME: { final String value = ((DialogAttrib<JTextField>) attr).input.getText(); // the attrib value if (value != null && value.length() > 0) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -982,7 +982,7 @@ case LIST: { final String value = ((DialogAttrib<JComboBox>) attr).input.getSelectedItem().toString().trim(); // the attrib value if (value != null && value.length() > 0 && !value.startsWith("<")) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -1001,21 +1001,21 @@ } } if (out != null) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + out + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + out + "\n", docStyle); } } break; case BITMASK: { final String value = ((BitmaskAttrib) attr).input.getText().trim(); if (value != null && value.length() > 0 && !value.startsWith("<")) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; case TREASURE: { final String value = ((DialogAttrib<JTextField>) attr).input.getText().trim(); // the attrib value if (value != null && value.length() > 0 && !value.equals(CFTreasureListTree.NONE_SYM)) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -1065,7 +1065,7 @@ case BOOL: { // a boolean attribute (flag) if (((DialogAttrib<JCheckBox>) attr).input.isSelected() != (archetype.getAttributeInt(attr.ref.getNameOld()) == 1)) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + (((DialogAttrib<JCheckBox>) attr).input.isSelected() ? 1 : 0) + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + (((DialogAttrib<JCheckBox>) attr).input.isSelected() ? 1 : 0) + "\n"; } } break; @@ -1079,7 +1079,7 @@ } // now see if we need to write it into the archtext or not if ("0".equals(valString) && !(archetype.getAttributeString(attr.ref.getNameOld()).length() == 0) || !valString.equals("0") && !archetype.getAttributeString(attr.ref.getNameOld()).equals(valString)) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + valString + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + valString + "\n"; } } break; @@ -1099,14 +1099,14 @@ case INT: { final int value = ((Number) ((DialogAttrib<JFormattedTextField>) attr).input.getValue()).intValue(); if (archetype.getAttributeInt(attr.ref.getNameOld()) != value) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + value + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } break; case LONG: { final long value = ((Number) ((DialogAttrib<JFormattedTextField>) attr).input.getValue()).longValue(); if (archetype.getAttributeLong(attr.ref.getNameOld()) != value) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + value + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } break; @@ -1115,7 +1115,7 @@ // The following floating point equality comparison is okay and known not to cause problems. //noinspection FloatingPointEquality if (archetype.getAttributeDouble(attr.ref.getNameOld()) != value) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + value + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } break; @@ -1153,7 +1153,7 @@ } } else if ("animation".equalsIgnoreCase(attr.ref.getNameOld())) { if (inline.length() > 0 && !inline.equals(archetype.getAttributeString(attr.ref.getNameOld()))) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + inline + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + inline + "\n"; gameObject.setAnimName(inline); } else { gameObject.setAnimName(archetype.getAnimName()); @@ -1163,13 +1163,13 @@ // decide we have to add a "face <name>" string to the gameObject text // Note, that the realFaceName itself is set below if (archetype.getFaceRealName() == null || archetype.getFaceRealName().compareTo(inline.trim()) != 0) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + inline + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + inline + "\n"; } } newFace = inline; } else { if (!inline.equals(archetype.getAttributeString(attr.ref.getNameOld()))) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + inline + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + inline + "\n"; } } } @@ -1215,7 +1215,7 @@ } else if (attrVal == 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0\n"; } else if (archetype.getAttributeInt(attr.ref.getNameOld()) != attrVal) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + attrVal + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + attrVal + "\n"; } } break; @@ -1225,7 +1225,7 @@ final int combinedVal = val1 + val2; if (archetype.getAttributeInt(attr.ref.getNameOld()) != combinedVal) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + combinedVal + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + combinedVal + "\n"; } } break; @@ -1234,7 +1234,7 @@ final int value = ((BitmaskAttrib) attr).getValue(); // get bitmask value if (archetype.getAttributeInt(attr.ref.getNameOld()) != value) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + value + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } break; @@ -1248,7 +1248,7 @@ if (!isNone && !CFTreasureListTree.containsTreasureList(inline) && !inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld()))) { // The user has specified a WRONG treasurelist name, and it does not come // from the default gameObject. -> Error and out. - showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + '\'' + inline + "' is not a known treasurelist name!", "Input Error", ERROR_MESSAGE); + showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + "\'" + inline + "' is not a known treasurelist name!", "Input Error", ERROR_MESSAGE); return false; } @@ -1256,7 +1256,7 @@ if (isNone) { newArchText = newArchText + attr.ref.getNameOld() + " none\n"; } else { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + inline + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + inline + "\n"; } } } @@ -1276,7 +1276,7 @@ // we assume the default gameObject is "right" and we are "wrong". The typedefs aren't that trustworthy. // BUT - if the gameObject has a changed type, the archetype has lost it's credibility. // So, in this special case, the fixed attribute applies always. - newArchText = newArchText + type.getAttr()[i].getNameOld() + ' ' + type.getAttr()[i].getNameNew() + '\n'; + newArchText = newArchText + type.getAttr()[i].getNameOld() + " " + type.getAttr()[i].getNameNew() + "\n"; } } } @@ -1286,7 +1286,7 @@ * But we need to add when needed the gameObject text - we do it here. */ if (gameObject.getDirection() != ((GameObject) archetype).getDirection()) { - newArchText = newArchText + "direction " + gameObject.getDirection() + '\n'; + newArchText = newArchText + "direction " + gameObject.getDirection() + "\n"; } // before we modify the archtext, we look for errors and save them. // later the user must confirm whether to keep or dump those errors Modified: trunk/daimonin/src/daieditor/CFArchTypeList.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -178,7 +178,7 @@ parseTypes(root); if (log.isInfoEnabled()) { - log.info("Loaded " + archTypeList.size() + " types from '" + IGUIConstants.TYPEDEF_FILE + '\''); + log.info("Loaded " + archTypeList.size() + " types from '" + IGUIConstants.TYPEDEF_FILE + "\'"); } } catch (final SAXException e) { log.error("Parsing error in '" + IGUIConstants.TYPEDEF_FILE + "':\n" + e.getMessage()); @@ -222,7 +222,7 @@ // every list entry adds value (Integer) and name (String) to the vector try { list.add(Integer.valueOf(elem.getAttribute("value"))); - list.add(' ' + elem.getAttribute("name").trim()); + list.add(" " + elem.getAttribute("name").trim()); } catch (final NumberFormatException ignore) { throw new RuntimeException("In '" + IGUIConstants.TYPEDEF_FILE + "', list " + root.getAttribute("name") + ": value '" + elem.getAttribute("value") + "' is not an integer."); } @@ -349,7 +349,7 @@ * @return name of this type, as defined in "typenumbers.xml" */ public String getArchTypeName(final int typeNr) { - return archTypeNumbers.containsKey(typeNr) ? archTypeNumbers.get(typeNr) : "*UNKNOWN" + typeNr + '*'; + return archTypeNumbers.containsKey(typeNr) ? archTypeNumbers.get(typeNr) : "*UNKNOWN" + typeNr + "*"; } /** Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -593,7 +593,7 @@ public void actionPerformed(final ActionEvent e) { final String result = getSelectedTreasureList(); if (result != null) { - input.setText(' ' + result); + input.setText(" " + result); frame.setVisible(false); } } @@ -604,7 +604,7 @@ noneButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { // print "none" into the attribute dialog - input.setText(' ' + NONE_SYM); + input.setText(" " + NONE_SYM); frame.setVisible(false); } }); Modified: trunk/daimonin/src/daieditor/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/ScriptArchData.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/daimonin/src/daieditor/ScriptArchData.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -182,7 +182,7 @@ final Vector<String> content = new Vector<String>(); for (final GameObject tmp : owner) { if (tmp.getArchTypNr() == 118) { - content.add(' ' + typeName(tmp.getAttributeInt("sub_type"))); + content.add(" " + typeName(tmp.getAttributeInt("sub_type"))); } } @@ -304,7 +304,7 @@ } path = path.replace('\\', '/'); if (!path.startsWith("/")) { - path = '/' + path; // leading slash + path = "/" + path; // leading slash } } else { // scriptfile is in a subirectory of mapfile -> relative path This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 23:24:28
|
Revision: 1092 http://svn.sourceforge.net/gridarta/?rev=1092&view=rev Author: akirschbaum Date: 2006-12-15 15:24:28 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Rename variable names. 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-12-15 22:52:33 UTC (rev 1091) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-15 23:24:28 UTC (rev 1092) @@ -114,7 +114,7 @@ private final CMainControl mainControl; // reference to the main control - private final CFArchTypeList typelist; // reference to the list of CF type-data + private final CFArchTypeList archTypeList; // reference to the list of CF type-data private List<DialogAttrib<?>> dialogAttribs = new ArrayList<DialogAttrib<?>>(); @@ -164,16 +164,16 @@ /** * Wrapper method for the constructor. * This method only creates a CAttribDialog if there's no dialog for the same gameObject already. - * @param atList the list of CF type-data + * @param archTypeList the list of CF type-data * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control */ - public static void showAttribDialog(final CFArchTypeList atList, final GameObject gameObject, final CMainControl mainControl) { + public static void showAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final CMainControl mainControl) { synchronized (dialogs) { if (dialogs.containsKey(gameObject)) { dialogs.get(gameObject).toFront(); } else { - final CAttribDialog pane = new CAttribDialog(atList, gameObject, mainControl); + final CAttribDialog pane = new CAttribDialog(archTypeList, gameObject, mainControl); final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); @@ -186,22 +186,22 @@ /** * Constructor, creates the GUI layout. - * @param atList the list of CF type-data + * @param archTypeList the list of CF type-data * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control */ - private CAttribDialog(final CFArchTypeList atList, final GameObject gameObject, final CMainControl mainControl) { + private CAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final CMainControl mainControl) { listNr = 0; this.mainControl = mainControl; // reference to the main control - typelist = atList; // reference to the typelist + this.archTypeList = archTypeList; // reference to the typelist // reference to the GameObject this.gameObject = gameObject.getHead(); archetype = this.gameObject.getArchetype(); // check if the type of the object is present in the definitions - CFArchType tmp = typelist.getHead().getNext(); + CFArchType tmp = archTypeList.getHead().getNext(); //typeNr = 0; // for invalid types, we take "type 0" type = tmp; boolean typeFound = false; @@ -256,7 +256,7 @@ } // get the type data - //type = typelist.getType(typeNr); + //type = archTypeList.getType(typeNr); // first split top-left and -right final JComponent leftPane = buildHeader(); @@ -306,10 +306,10 @@ * @return a <code>JComponent</code> with the combo box in it */ private JComponent buildTypesBox() { - final String[] namelist = new String[typelist.getLength()]; // list of typenames + final String[] namelist = new String[archTypeList.getLength()]; // list of typenames // read all type names - CFArchType tmp = typelist.getHead().getNext(); + CFArchType tmp = archTypeList.getHead().getNext(); for (int i = 0; tmp != null; tmp = tmp.getNext(), i++) { namelist[i] = " " + tmp.getTypeName(); } @@ -339,7 +339,7 @@ // first parse the spell-number value from gameObject int spnum = gameObject.getAttributeInt(attr.getNameOld()); // spell number - if (spnum < 0 || spnum >= typelist.getSpellNum().length - 1) { + if (spnum < 0 || spnum >= archTypeList.getSpellNum().length - 1) { spnum = 0; // undefined spellnumbers be zero } @@ -350,15 +350,15 @@ } else { // now look up the spell-number in the array of spells active = 0; - for (int i = 0; i < typelist.getSpellNum().length; i++) { - if (typelist.getSpellNum()[i] == spnum) { + for (int i = 0; i < archTypeList.getSpellNum().length; i++) { + if (archTypeList.getSpellNum()[i] == spnum) { active = i; // set selection - i = typelist.getSpellNum().length + 10; // end loop + i = archTypeList.getSpellNum().length + 10; // end loop } } } - final JComboBox spellsel = new JComboBox(typelist.getSpellName()); // set "content" + final JComboBox spellsel = new JComboBox(archTypeList.getSpellName()); // set "content" spellsel.setSelectedIndex(active); // set active selection spellsel.setMaximumRowCount(10); spellsel.setKeySelectionManager(new StringKeyManager(spellsel)); @@ -738,9 +738,9 @@ input = buildSpellBox(attrib); break; case LIST: - if (attrib.getMisc() != null && typelist.getListTable().containsKey(attrib.getMisc()[0])) { + if (attrib.getMisc() != null && archTypeList.getListTable().containsKey(attrib.getMisc()[0])) { // build the list from vector data - input = buildArrayBox(attrib, typelist.getListTable().get(attrib.getMisc()[0])); + input = buildArrayBox(attrib, archTypeList.getListTable().get(attrib.getMisc()[0])); } else { // error: list data is missing or corrupt cComp = new JLabel("Error: Undefined List"); @@ -765,13 +765,13 @@ newAttr = new DialogAttrib<JComboBox[]>(attrib); // create ComboBox with parsed selection final JComboBox[] inputs = new JComboBox[2]; - if (attrib.getMisc() != null && typelist.getListTable().containsKey(attrib.getMisc()[0]) && typelist.getListTable().containsKey(attrib.getMisc()[1])) { + if (attrib.getMisc() != null && archTypeList.getListTable().containsKey(attrib.getMisc()[0]) && archTypeList.getListTable().containsKey(attrib.getMisc()[1])) { // Hack to set preselected if available final int active = gameObject.getAttributeInt(nameOld); final int[] activepart = {active & 0x0F, active & 0xF0}; // build the lists from vector data for (int j = 0; j < 2; j++) { - final List<?> listData = typelist.getListTable().get(attrib.getMisc()[j]); + final List<?> listData = archTypeList.getListTable().get(attrib.getMisc()[j]); inputs[j] = buildArrayBox(attrib, listData); for (int k = 0; (double) k < listData.size() / 2.0; k++) { if ((Integer) listData.get(k << 1) == activepart[j]) { @@ -792,9 +792,9 @@ break; case BITMASK: { newAttr = new BitmaskAttrib(attrib); - if (attrib.getMisc() != null && typelist.getBitmaskTable().containsKey(attrib.getMisc()[0])) { + if (attrib.getMisc() != null && archTypeList.getBitmaskTable().containsKey(attrib.getMisc()[0])) { // fetch the bitmask data, then build the attribute panel - final CAttribBitmask bitmask = typelist.getBitmaskTable().get((String) (attrib.getMisc()[0])); + final CAttribBitmask bitmask = archTypeList.getBitmaskTable().get((String) (attrib.getMisc()[0])); ((BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr).bitmask = bitmask; cLabel = new JButton(new MaskChangeAL(attrib.getNameNew() + ":", (BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr)); final JTextArea input = new JTextArea(); @@ -1058,7 +1058,7 @@ private boolean applySettings() { final String oldArchText = gameObject.getObjectText(); // the old ArchText final String oldMsg = gameObject.getMsgText(); // old gameObject msg - final CFArchType typeStruct = typelist.getTypeOfArch(gameObject); // the type structure for this gameObject + final CFArchType typeStruct = archTypeList.getTypeOfArch(gameObject); // the type structure for this gameObject String newArchText = ""; String newName = null; @@ -1200,13 +1200,13 @@ switch (dType) { case SPELL: case ZSPELL: - attrVal = typelist.getSpellNum()[((DialogAttrib<JComboBox>) attr).input.getSelectedIndex()]; + attrVal = archTypeList.getSpellNum()[((DialogAttrib<JComboBox>) attr).input.getSelectedIndex()]; break; case LIST: // get selected index of ComboBox final int attrValTmp = ((JComboBox) attr.input).getSelectedIndex(); // fetch value according to this list entry: - attrVal = (Integer) (typelist.getListTable().get(attr.ref.getMisc()[0])).get(2 * attrValTmp); + attrVal = (Integer) (archTypeList.getListTable().get(attr.ref.getMisc()[0])).get(2 * attrValTmp); break; default: assert false; @@ -1226,8 +1226,8 @@ } break; case DBLLIST: { - final int val1 = (Integer) typelist.getListTable().get(attr.ref.getMisc()[0]).get(2 * ((JComboBox[]) attr.input)[0].getSelectedIndex()); - final int val2 = (Integer) typelist.getListTable().get(attr.ref.getMisc()[1]).get(2 * ((JComboBox[]) attr.input)[1].getSelectedIndex()); + final int val1 = (Integer) archTypeList.getListTable().get(attr.ref.getMisc()[0]).get(2 * ((JComboBox[]) attr.input)[0].getSelectedIndex()); + final int val2 = (Integer) archTypeList.getListTable().get(attr.ref.getMisc()[1]).get(2 * ((JComboBox[]) attr.input)[1].getSelectedIndex()); final int combinedVal = val1 + val2; if (archetype.getAttributeInt(attr.ref.getNameOld()) != combinedVal) { @@ -1347,7 +1347,7 @@ // deal with syntax errors now if (errors != null) { - if (typeStruct == typelist.getHead().getNext()) { + if (typeStruct == archTypeList.getHead().getNext()) { // for generic (misc) type, all errors are automatically kept. // "misc" is no real type - it is more a default mask for unknown types gameObject.addObjectText(errors.trim()); @@ -1690,7 +1690,7 @@ } else if (e.getStateChange() == ItemEvent.SELECTED && !e.getItem().equals(deselected)) { // new type was selected // first, get new type structure - final CFArchType newType = typelist.getTypeByName((String) e.getItem()); + final CFArchType newType = archTypeList.getTypeByName((String) e.getItem()); frame.typesel.hidePopup(); frame.update(frame.getGraphics()); Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 22:52:33 UTC (rev 1091) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 23:24:28 UTC (rev 1092) @@ -114,7 +114,7 @@ private final CMainControl mainControl; // reference to the main control - private final CFArchTypeList typelist; // reference to the list of CF type-data + private final CFArchTypeList archTypeList; // reference to the list of CF type-data private List<DialogAttrib<?>> dialogAttribs = new ArrayList<DialogAttrib<?>>(); @@ -164,16 +164,16 @@ /** * Wrapper method for the constructor. * This method only creates a CAttribDialog if there's no dialog for the same gameObject already. - * @param atList the list of CF type-data + * @param archTypeList the list of CF type-data * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control */ - public static void showAttribDialog(final CFArchTypeList atList, final GameObject gameObject, final CMainControl mainControl) { + public static void showAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final CMainControl mainControl) { synchronized (dialogs) { if (dialogs.containsKey(gameObject)) { dialogs.get(gameObject).toFront(); } else { - final CAttribDialog pane = new CAttribDialog(atList, gameObject, mainControl); + final CAttribDialog pane = new CAttribDialog(archTypeList, gameObject, mainControl); final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); @@ -186,15 +186,15 @@ /** * Constructor, creates the GUI layout. - * @param atList the list of CF type-data + * @param archTypeList the list of CF type-data * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control */ - private CAttribDialog(final CFArchTypeList atList, final GameObject gameObject, final CMainControl mainControl) { + private CAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final CMainControl mainControl) { listNr = 0; this.mainControl = mainControl; // reference to the main control - typelist = atList; // reference to the typelist + this.archTypeList = archTypeList; // reference to the typelist // reference to the GameObject this.gameObject = gameObject.getHead(); @@ -204,7 +204,7 @@ //typeNr = 0; // for invalid types, we take "type 0" boolean typeFound = false; int i = 0; - for (final CFArchType tmp : typelist) { + for (final CFArchType tmp : archTypeList) { if (tmp.getTypeNr() == this.gameObject.getArchTypNr()) { if (tmp.getTypeAttr() == null) { // no type-attributes, so we only compared type-numbers @@ -253,11 +253,11 @@ i++; } if (!typeFound) { - type = typelist.getArchType(0); + type = archTypeList.getArchType(0); } // get the type data - //type = typelist.getType(typeNr); + //type = archTypeList.getType(typeNr); // first split top-left and -right final JComponent leftPane = buildHeader(); @@ -307,11 +307,11 @@ * @return a <code>JComponent</code> with the combo box in it */ private JComponent buildTypesBox() { - final String[] namelist = new String[typelist.getLength()]; // list of typenames + final String[] namelist = new String[archTypeList.getLength()]; // list of typenames // read all type names int i = 0; - for (final CFArchType tmp : typelist) { + for (final CFArchType tmp : archTypeList) { namelist[i++] = " " + tmp.getTypeName(); } @@ -734,9 +734,9 @@ input = buildSpellBox(attrib); break; case LIST: - if (attrib.getMisc() != null && typelist.getListTable().containsKey(attrib.getMisc()[0])) { + if (attrib.getMisc() != null && archTypeList.getListTable().containsKey(attrib.getMisc()[0])) { // build the list from vector data - input = buildArrayBox(attrib, typelist.getListTable().get(attrib.getMisc()[0])); + input = buildArrayBox(attrib, archTypeList.getListTable().get(attrib.getMisc()[0])); } else { // error: list data is missing or corrupt cComp = new JLabel("Error: Undefined List"); @@ -761,13 +761,13 @@ newAttr = new DialogAttrib<JComboBox[]>(attrib); // create ComboBox with parsed selection final JComboBox[] inputs = new JComboBox[2]; - if (attrib.getMisc() != null && typelist.getListTable().containsKey(attrib.getMisc()[0]) && typelist.getListTable().containsKey(attrib.getMisc()[1])) { + if (attrib.getMisc() != null && archTypeList.getListTable().containsKey(attrib.getMisc()[0]) && archTypeList.getListTable().containsKey(attrib.getMisc()[1])) { // Hack to set preselected if available final int active = gameObject.getAttributeInt(nameOld); final int[] activepart = {active & 0x0F, active & 0xF0}; // build the lists from vector data for (int j = 0; j < 2; j++) { - final List<?> listData = typelist.getListTable().get(attrib.getMisc()[j]); + final List<?> listData = archTypeList.getListTable().get(attrib.getMisc()[j]); inputs[j] = buildArrayBox(attrib, listData); for (int k = 0; (double) k < listData.size() / 2.0; k++) { if ((Integer) listData.get(k << 1) == activepart[j]) { @@ -788,9 +788,9 @@ break; case BITMASK: { newAttr = new BitmaskAttrib(attrib); - if (attrib.getMisc() != null && typelist.getBitmaskTable().containsKey(attrib.getMisc()[0])) { + if (attrib.getMisc() != null && archTypeList.getBitmaskTable().containsKey(attrib.getMisc()[0])) { // fetch the bitmask data, then build the attribute panel - final CAttribBitmask bitmask = typelist.getBitmaskTable().get(attrib.getMisc()[0]); + final CAttribBitmask bitmask = archTypeList.getBitmaskTable().get(attrib.getMisc()[0]); ((BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr).bitmask = bitmask; cLabel = new JButton(new MaskChangeAL(attrib.getNameNew() + ":", (BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr)); final JTextArea input = new JTextArea(); @@ -1052,7 +1052,7 @@ * @return true if the settings were applied, false if error occurred */ private boolean applySettings() { - final CFArchType typeStruct = typelist.getTypeOfArch(gameObject); // the type structure for this gameObject + final CFArchType typeStruct = archTypeList.getTypeOfArch(gameObject); // the type structure for this gameObject String newArchText = ""; String newName = null; @@ -1196,7 +1196,7 @@ // get selected index of ComboBox final int attrValTmp = ((JComboBox) attr.input).getSelectedIndex(); // fetch value according to this list entry: - attrVal = (Integer) typelist.getListTable().get(attr.ref.getMisc()[0]).get(2 * attrValTmp); + attrVal = (Integer) archTypeList.getListTable().get(attr.ref.getMisc()[0]).get(2 * attrValTmp); break; default: assert false; @@ -1220,8 +1220,8 @@ } break; case DBLLIST: { - final int val1 = (Integer) typelist.getListTable().get(attr.ref.getMisc()[0]).get(2 * ((JComboBox[]) attr.input)[0].getSelectedIndex()); - final int val2 = (Integer) typelist.getListTable().get(attr.ref.getMisc()[1]).get(2 * ((JComboBox[]) attr.input)[1].getSelectedIndex()); + final int val1 = (Integer) archTypeList.getListTable().get(attr.ref.getMisc()[0]).get(2 * ((JComboBox[]) attr.input)[0].getSelectedIndex()); + final int val2 = (Integer) archTypeList.getListTable().get(attr.ref.getMisc()[1]).get(2 * ((JComboBox[]) attr.input)[1].getSelectedIndex()); final int combinedVal = val1 + val2; if (archetype.getAttributeInt(attr.ref.getNameOld()) != combinedVal) { @@ -1329,7 +1329,7 @@ // deal with syntax errors now if (errors != null) { - if (typeStruct == typelist.getArchType(0)) { + if (typeStruct == archTypeList.getArchType(0)) { // for generic (misc) type, all errors are automatically kept. // "misc" is no real type - it is more a default mask for unknown types gameObject.addObjectText(errors.trim()); @@ -1669,7 +1669,7 @@ } else if (e.getStateChange() == ItemEvent.SELECTED && !e.getItem().equals(deselected)) { // new type was selected // first, get new type structure - final CFArchType newType = typelist.getTypeByName((String) e.getItem()); + final CFArchType newType = archTypeList.getTypeByName((String) e.getItem()); frame.typesel.hidePopup(); frame.update(frame.getGraphics()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 00:08:35
|
Revision: 1096 http://svn.sourceforge.net/gridarta/?rev=1096&view=rev Author: akirschbaum Date: 2006-12-15 16:08:36 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Unify comments and whitespace. Modified Paths: -------------- trunk/crossfire/src/cfeditor/Spells.java trunk/daimonin/src/daieditor/Spells.java Modified: trunk/crossfire/src/cfeditor/Spells.java =================================================================== --- trunk/crossfire/src/cfeditor/Spells.java 2006-12-16 00:05:22 UTC (rev 1095) +++ trunk/crossfire/src/cfeditor/Spells.java 2006-12-16 00:08:36 UTC (rev 1096) @@ -94,7 +94,7 @@ /** * Read all spells from a CF spellist file and write an - * alphabetical list into "spells.def" + * alphabetical list into "spells.def". * @param spellfile spellfile to read * @return number of successfully collected spells */ @@ -221,7 +221,7 @@ /** * Read the spells from "spells.xml" into the arrays 'spellNames' - * and 'spellNumbers'. This method is called at startup + * and 'spellNumbers'. This method is called at startup. */ public void loadSpellsFromXML() { spellNames = null; Modified: trunk/daimonin/src/daieditor/Spells.java =================================================================== --- trunk/daimonin/src/daieditor/Spells.java 2006-12-16 00:05:22 UTC (rev 1095) +++ trunk/daimonin/src/daieditor/Spells.java 2006-12-16 00:08:36 UTC (rev 1096) @@ -186,8 +186,8 @@ } /** - * Read the spells from "spells.xml" into the arrays 'spell_name' - * and 'spell_num'. This method is called at startup + * Read the spells from "spells.xml" into the arrays 'spellNames' + * and 'spellNumbers'. This method is called at startup. * @param documentBuilder Document Builder to use for parsing */ public void loadSpellsFromXML(final DocumentBuilder documentBuilder) { @@ -255,4 +255,5 @@ public int[] getSpellNumbers() { return spellNumbers; } + } // class Spells This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 00:21:28
|
Revision: 1099 http://svn.sourceforge.net/gridarta/?rev=1099&view=rev Author: akirschbaum Date: 2006-12-15 16:21:28 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/Spells.java trunk/daimonin/src/daieditor/Spells.java Modified: trunk/crossfire/src/cfeditor/Spells.java =================================================================== --- trunk/crossfire/src/cfeditor/Spells.java 2006-12-16 00:15:27 UTC (rev 1098) +++ trunk/crossfire/src/cfeditor/Spells.java 2006-12-16 00:21:28 UTC (rev 1099) @@ -164,22 +164,22 @@ // --------- now write the "spells.def" file --------- if (list != null && list.size() > 0) { - File dfile = null; - try { - // create new file for writing (replaces old one if existent) - if (IGUIConstants.CONFIG_DIR != null && IGUIConstants.CONFIG_DIR.length() > 0) { - final File dir = new File(IGUIConstants.CONFIG_DIR); - if (!dir.exists() || !dir.isDirectory()) { - // create the config dir - new File("resource").mkdir(); - new File(IGUIConstants.CONFIG_DIR).mkdir(); - } - - dfile = new File(IGUIConstants.CONFIG_DIR + File.separator + IGUIConstants.SPELL_FILE); - } else { - dfile = new File(IGUIConstants.SPELL_FILE); + final File dfile; + // create new file for writing (replaces old one if existent) + if (IGUIConstants.CONFIG_DIR != null && IGUIConstants.CONFIG_DIR.length() > 0) { + final File dir = new File(IGUIConstants.CONFIG_DIR); + if (!dir.exists() || !dir.isDirectory()) { + // create the config dir + new File("resource").mkdir(); + new File(IGUIConstants.CONFIG_DIR).mkdir(); } + dfile = new File(IGUIConstants.CONFIG_DIR + File.separator + IGUIConstants.SPELL_FILE); + } else { + dfile = new File(IGUIConstants.SPELL_FILE); + } + + try { fileWriter = new FileWriter(dfile); bufferedWriter = new BufferedWriter(fileWriter); Modified: trunk/daimonin/src/daieditor/Spells.java =================================================================== --- trunk/daimonin/src/daieditor/Spells.java 2006-12-16 00:15:27 UTC (rev 1098) +++ trunk/daimonin/src/daieditor/Spells.java 2006-12-16 00:21:28 UTC (rev 1099) @@ -137,7 +137,7 @@ // --------- now write the "spells.def" file --------- if (spells.size() > 0) { // FIXME: This should use DOM for writing the file. - File dfile; + final File dfile; // create new file for writing (replaces old one if existent) if (IGUIConstants.CONFIG_DIR != null && IGUIConstants.CONFIG_DIR.length() > 0) { final String baseDir = CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 00:47:33
|
Revision: 1102 http://svn.sourceforge.net/gridarta/?rev=1102&view=rev Author: akirschbaum Date: 2006-12-15 16:47:32 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Use ActionFactory to create HTML help text. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFArchType.java trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/daimonin/src/daieditor/messages.properties trunk/daimonin/src/daieditor/messages_de.properties Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-12-16 00:30:12 UTC (rev 1101) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-12-16 00:47:32 UTC (rev 1102) @@ -29,6 +29,7 @@ import java.util.List; import java.util.Map; import net.sf.gridarta.gameobject.ArchAttribType; +import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; import org.jdom.Attribute; import org.jdom.Element; @@ -43,6 +44,9 @@ private static final Logger log = Logger.getLogger(CFArchType.class); + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + public static final String XML_TYPE = "type"; /** Attribute Element Name. */ @@ -411,42 +415,7 @@ * @fixme my HTML is broken */ public String createHtmlDocu() { - String text = ""; // String containing the whole html text - - // write header (not displayed) - text += "<HTML>\n<HEAD>\n<META NAME=\"CFJavaEditor\" CONTENT=\"tmp\">\n<TITLE>"; - text += "Type: " + typeName; - text += "</HEAD>\n<BODY>\n"; - - text += "<H1 align=center color=navy>Type: " + typeName + "</H1>\n"; // title - - if (desc != null && desc.trim().length() > 0) { - text += "<P><H3 color=navy>Functionality of " + typeName + ":</H3>"; - text += desc.trim() + "</P>"; - } - if (use != null && use.trim().length() > 0) { - text += "<P><H3 color=navy>Notes on Usage:</H3>"; - text += use.trim() + "</P>"; - } - - /* - if (attr != null && attr.length > 0) { - // create table with attributes - text += "<br><br><TABLE BORDER>"; - for (int i = 0; i < attr.length; i++) { - if (attr[i].getDataType() != ArchAttribType.FIXED && !attr[i].getSecName().equalsIgnoreCase("general")) { - text += "<TR><B>"+attr[i].getNameNew()+":</B><br>"+attr[i].getText()+"</TR>"; - } - } - text += "</TABLE>"; - }*/ - - text += "</BODY>\n</HTML>\n"; - - if (log.isDebugEnabled()) { - log.debug(text); - } - return text; + return ACTION_FACTORY.format("arcDoc.htmlText", typeName, desc != null ? desc.trim() : "", use != null ? use.trim() : ""); } // convenience functions: Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2006-12-16 00:30:12 UTC (rev 1101) +++ trunk/crossfire/src/cfeditor/messages.properties 2006-12-16 00:47:32 UTC (rev 1102) @@ -63,6 +63,8 @@ mapTop=Top mapBottom=Bottom +arcDoc.htmlText=<html><head><meta name="CFJavaEditor" content="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">{0}</h1><h3 style="colour:navy;">Functionality of {0}:</h3><p>{1}</p><h3 style="colour:navy;">Notes on Usage:</h3><p>{2}</p></body></html> + # Options optionsImageSet=Image Set optionsImageSet.shortdescription=The image set to use Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-16 00:30:12 UTC (rev 1101) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-16 00:47:32 UTC (rev 1102) @@ -259,6 +259,8 @@ prefsRes.title=Pfade & Ressourcen prefsGUI.title=Aussehen +arcDoc.htmlText=<html><head><meta name="CFJavaEditor" content="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">{0}</h1><h3 style="colour:navy;">Funktionalität von {0}:</h3><p>{1}</p><h3 style="colour:navy;">Nutzungshinweise:</h3><p>{2}</p></body></html> + # Options optionsLanguage=Sprache Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-12-16 00:30:12 UTC (rev 1101) +++ trunk/daimonin/src/daieditor/messages.properties 2006-12-16 00:47:32 UTC (rev 1102) @@ -152,7 +152,7 @@ replaceByPickmap=pickmap -arcDoc.htmlText=<html><head><meta name="CFJavaEditor" content="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">Type: {0}</h1><h3 style="colour:navy;">Functionality of {0}</h3><p>{1}</p><h3 style="colour:navy;">Notes on Usage:</h3><p>{2}</p></body></html> +arcDoc.htmlText=<html><head><meta name="CFJavaEditor" content="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">{0}</h1><h3 style="colour:navy;">Functionality of {0}:</h3><p>{1}</p><h3 style="colour:navy;">Notes on Usage:</h3><p>{2}</p></body></html> # Options Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2006-12-16 00:30:12 UTC (rev 1101) +++ trunk/daimonin/src/daieditor/messages_de.properties 2006-12-16 00:47:32 UTC (rev 1102) @@ -134,6 +134,8 @@ replacedMany.title=Ersetzung erfolgreich replacedMany.message={0} Objekte ersetzt. +arcDoc.htmlText=<html><head><meta name="CFJavaEditor" content="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">{0}</h1><h3 style="colour:navy;">Funktionalität von {0}:</h3><p>{1}</p><h3 style="colour:navy;">Nutzungshinweise:</h3><p>{2}</p></body></html> + # Options optionsTitle=Optionen @@ -150,8 +152,6 @@ optionsCheckMaps.text=Analysiere Kartendateien bei Dateiauswahl -arcDoc.htmlText=<html><head><meta name="CFJavaEditor" content="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">Type: {0}</h1><h3 style="colour:navy;">Funktionalit\xE4t von {0}</h3><p>{1}</p><h3 style="colour:navy;">Nutzungshinweise:</h3><p>{2}</p></body></html> - #attribute dialog attribTitle=Objektattribute attribHelp.text=Hilfe This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 00:59:42
|
Revision: 1103 http://svn.sourceforge.net/gridarta/?rev=1103&view=rev Author: akirschbaum Date: 2006-12-15 16:59:42 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Change shortcut for 'undo' to CTRL+Y. Modified Paths: -------------- trunk/daimonin/src/daieditor/messages_de.properties trunk/daimonin/src/daieditor/messages_fr.properties trunk/daimonin/src/daieditor/messages_sv.properties trunk/src/app/net/sf/gridarta/messages.properties Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2006-12-16 00:47:32 UTC (rev 1102) +++ trunk/daimonin/src/daieditor/messages_de.properties 2006-12-16 00:59:42 UTC (rev 1103) @@ -258,7 +258,7 @@ redo.shortdescription=Letztes R\xFCckg\xE4ngig wiederherstellen redo.longdescription=Stellt die zuletzt r\xFCckg\xE4ngig gemachte \xC4nderung wieder her. redo.mnemonic=R -redo.accel=ctrl shift pressed Z +redo.accel=ctrl pressed Y redo.error.text=Kann \xC4nderung nicht widerherstellen. clear.text=L\xF6schen Modified: trunk/daimonin/src/daieditor/messages_fr.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_fr.properties 2006-12-16 00:47:32 UTC (rev 1102) +++ trunk/daimonin/src/daieditor/messages_fr.properties 2006-12-16 00:59:42 UTC (rev 1103) @@ -124,7 +124,7 @@ redo.shortdescription=R\xE9p\xE9ter la derni\xE8re action annul\xE9e redo.longdescription=R\xE9p\xE8te la derni\xE8re action annul\xE9e si cela est possible redo.mnemonic=R -redo.accel=ctrl shift pressed Z +redo.accel=ctrl pressed Y redo.error.text=Impossible de r\xE9p\xE9ter. clear.text=Effacer Modified: trunk/daimonin/src/daieditor/messages_sv.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_sv.properties 2006-12-16 00:47:32 UTC (rev 1102) +++ trunk/daimonin/src/daieditor/messages_sv.properties 2006-12-16 00:59:42 UTC (rev 1103) @@ -440,7 +440,7 @@ redo.shortdescription=G\xF6r om senaste \xE4ndringen redo.longdescription=G\xF6r om den senast \xE5ngrade \xE4ndringen om m\xF6jligt redo.mnemonic=R -redo.accel=ctrl shift pressed Z +redo.accel=ctrl pressed Y redo.error.text=Kan inte g\xF6ra om clear.text=Rensa Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2006-12-16 00:47:32 UTC (rev 1102) +++ trunk/src/app/net/sf/gridarta/messages.properties 2006-12-16 00:59:42 UTC (rev 1103) @@ -205,7 +205,7 @@ redo.shortdescription=Redo last undo action redo.longdescription=Redoes the last undone action if possible redo.mnemonic=R -redo.accel=ctrl shift pressed Z +redo.accel=ctrl pressed Y ################# # Map Arch Panel This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 10:43:28
|
Revision: 1106 http://svn.sourceforge.net/gridarta/?rev=1106&view=rev Author: akirschbaum Date: 2006-12-16 02:43:28 -0800 (Sat, 16 Dec 2006) Log Message: ----------- Unify comments. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-16 01:19:23 UTC (rev 1105) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-16 10:43:28 UTC (rev 1106) @@ -99,12 +99,11 @@ /** * Creates a DefaultLevelRenderer. - * @param mapViewBasic MapView to render. - * @param mainControl MainControl, used e.g. for icons. - * @param mapControl MapControl of the map to render. - * @param pickmap <code>true</code> if the rendered map is a pickmap, otherwise <code>false</code> + * @param mapViewBasic MapView to render. + * @param mainControl MainControl, used for getting icons and similar. + * @param mapControl MapControl of the map to render. + * @param pickmap <code>true</code> if the rendered map is a pickmap, otherwise <code>false</code> */ - /** Constructor */ public DefaultLevelRenderer(final CMapViewBasic mapViewBasic, final CMainControl mainControl, final MapControl mapControl, final boolean pickmap) { this.mapViewBasic = mapViewBasic; this.mainControl = mainControl; Modified: trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-16 01:19:23 UTC (rev 1105) +++ trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-16 10:43:28 UTC (rev 1106) @@ -100,7 +100,7 @@ * Creates a DefaultLevelRenderer. * @param mainControl MainControl, used for getting icons and similar. * @param mapControl MapControl of the map to render. - * @param pickmap Set to <code>true</code> for pickmaps. + * @param pickmap <code>true</code> if the rendered map is a pickmap, otherwise <code>false</code> * @param mapGrid Grid to render. */ public DefaultLevelRenderer(final CMainControl mainControl, final MapControl mapControl, final boolean pickmap, final MapGrid mapGrid) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 11:51:59
|
Revision: 1109 http://svn.sourceforge.net/gridarta/?rev=1109&view=rev Author: akirschbaum Date: 2006-12-16 03:52:00 -0800 (Sat, 16 Dec 2006) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/map/MapControl.java Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-16 11:46:07 UTC (rev 1108) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-16 11:52:00 UTC (rev 1109) @@ -278,12 +278,11 @@ } /** - * Take the currently selected arch (from archlist or pickmap) and - * insert it to the defined spot on the currently active map. Redraw - * info is stored to 'needRedraw', no views get redrawn/updated here. - * @param pos tile-coordinates in map - * @param allowMany when true, it is possible to insert same arches - * many times. when false, only one arch of a kind can be inserted + * Take the currently selected arch (from archlist or pickmap) and insert + * it to the defined spot on the currently active map. Redraw info is + * stored to 'needRedraw', no views get redrawn/updated here. + * @param pos coordinates on map + * @param allowMany when true, it is possible to insert same arches many times * @return array of coordinates for tiles that need to be redrawn */ public Point[] insertSelArchToMap(final Point pos, final boolean allowMany) { @@ -295,6 +294,7 @@ if (!mainControl.getMainView().isPickmapActive() || isPickmap() || (newarch != null && newarch.isArchetype())) { // insert default arch from archlist: + mapModel.beginTransaction("Insert"); // TODO: I18N/L10N if (!addArchToMap(mainControl.getPanelArchName(), pos, allowMany, MapModel.JOIN_ENABLE)) { // mainControl.getMainView().mapPanel.setMapArchList(null); // Toolkit.getDefaultToolkit().beep(); @@ -306,13 +306,14 @@ needRedraw = calcArchRedraw(newarch); } } + mapModel.endTransaction(); } else { // insert custom arch from the pickmap: if (newarch != null) { boolean insertAllowed = true; // are we allowed to insert this? if (!allowMany) { // check if there is already an arch of that kind - for (final GameObject t : getMapModel().getMapSquare(pos)) { + for (final GameObject t : mapModel.getMapSquare(pos)) { if (t.getArchetypeName().equals(newarch.getArchetypeName()) && t.getArchTypNr() == newarch.getArchTypNr()) { insertAllowed = false; // there's a match - don't insert a second one } Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-12-16 11:46:07 UTC (rev 1108) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-12-16 11:52:00 UTC (rev 1109) @@ -401,19 +401,19 @@ /** * Take the currently selected arch (from archlist or pickmap) and insert * it to the defined spot on the currently active map. Redraw info is - * stored to 'need_redraw', no views get redrawn/updated here. - * @param p Coordinates on map + * stored to 'needRedraw', no views get redrawn/updated here. + * @param pos coordinates on map * @param allowMany when true, it is possible to insert same arches many times */ - public void insertSelArchToMap(final Point p, final boolean allowMany) { + public void insertSelArchToMap(final Point pos, final boolean allowMany) { // this is the arch that would get inserted from pickmap, but it also could // be a default arch (when pickmap has no selection) GameObject newarch = CopyBuffer.getRandomMapArch(CPickmapPanel.getInstance().getCurrentPickmap(), 100); - if (!mainControl.getMainView().isPickmapActive() || isPickmap() || newarch != null && newarch.isArchetype()) { + if (!mainControl.getMainView().isPickmapActive() || isPickmap() || (newarch != null && newarch.isArchetype())) { // insert default arch from archlist: mapModel.beginTransaction("Insert"); // TODO: I18N/L10N - if (!mapModel.addArchToMap(mainControl.getPanelArchName(), p, allowMany, false)) { + if (!mapModel.addArchToMap(mainControl.getPanelArchName(), pos, allowMany, false)) { // todo } mapModel.endTransaction(); @@ -423,7 +423,7 @@ boolean insertAllowed = true; // are we allowed to insert this? if (!allowMany) { // check if there is already an arch of that kind - for (final GameObject t : mapModel.getMapSquare(p)) { + for (final GameObject t : mapModel.getMapSquare(pos)) { if (t.hasSameArchetype(newarch) || t.getArchTypNr() == newarch.getArchTypNr()) { insertAllowed = false; // there's a match - don't insert a second one } @@ -433,17 +433,17 @@ if (insertAllowed) { if (!newarch.isMulti()) { // insert single tile from pickmap - newarch = newarch.createClone(p.x, p.y); + newarch = newarch.createClone(pos.x, pos.y); mapModel.addGameObjectToMap(newarch, false); } else { // insert multi tile from pickmap: newarch = newarch.getHead(); // first insert default arch from archlist - if (!mapModel.addArchToMap(newarch.getArchetypeName(), p, allowMany, false)) { + if (!mapModel.addArchToMap(newarch.getArchetypeName(), pos, allowMany, false)) { // do nothing } else { // insertion successful, now get redraw info - final GameObject newdef = mapModel.getMapSquare(p).getLast(); + final GameObject newdef = mapModel.getMapSquare(pos).getLast(); if (newdef != null) { // now we've got the inserted arch, copy the custom stuff from pickmap newdef.setObjectText(newarch.getObjectText()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-12-16 22:46:33
|
Revision: 1117 http://svn.sourceforge.net/gridarta/?rev=1117&view=rev Author: derdanny Date: 2006-12-16 14:46:32 -0800 (Sat, 16 Dec 2006) Log Message: ----------- Fixed javadoc. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-16 22:38:19 UTC (rev 1116) +++ trunk/crossfire/src/cfeditor/gui/map/LevelRenderer.java 2006-12-16 22:46:32 UTC (rev 1117) @@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable; /** - * A lavel renderer, mainly used as central point to iso and flat renderer. + * A level renderer, mainly used as central point to iso and flat renderer. * * @author tchize */ @@ -47,7 +47,7 @@ * Returns the map location at the given point or null if no map location * is at the point. * @param point The coordinates in the renderer view. - * @param retPoint if <cod>(retPoint != null)</code> this point will be returned otherwise a new point will be created + * @param retPoint if <code>(retPoint != null)</code> this point will be returned otherwise a new point will be created * @return The map location. */ @Nullable public abstract Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint); Modified: trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java 2006-12-16 22:38:19 UTC (rev 1116) +++ trunk/daimonin/src/daieditor/gui/map/LevelRenderer.java 2006-12-16 22:46:32 UTC (rev 1117) @@ -28,7 +28,7 @@ import org.jetbrains.annotations.Nullable; /** - * A lavel renderer, mainly used as central point to iso and flat renderer. + * A level renderer, mainly used as central point to iso and flat renderer. * * @author tchize */ @@ -44,7 +44,7 @@ * Returns the map location at the given point or null if no map location * is at the point. * @param point The coordinates in the renderer view. - * @param retPoint if <cod>(retPoint != null)</code> this point will be returned otherwise a new point will be created + * @param retPoint if <code>(retPoint != null)</code> this point will be returned otherwise a new point will be created * @return The map location. */ @Nullable public abstract Point getTileLocationAt(@NotNull final Point point, @Nullable final Point retPoint); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-17 00:01:21
|
Revision: 1118 http://svn.sourceforge.net/gridarta/?rev=1118&view=rev Author: akirschbaum Date: 2006-12-16 16:01:21 -0800 (Sat, 16 Dec 2006) Log Message: ----------- Properly enable/disable cursor menu entries. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/gui/map/MapCursorControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/CMapViewBasic.java trunk/daimonin/src/daieditor/gui/map/MapCursorControl.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2006-12-16 22:46:32 UTC (rev 1117) +++ trunk/crossfire/ChangeLog 2006-12-17 00:01:21 UTC (rev 1118) @@ -1,3 +1,7 @@ +2006-12-17 Andreas Kirschbaum + + * Properly enable/disable cursor menu entries. + 2006-12-16 Andreas Kirschbaum * Implement non-rectangular selections. For now, it does not take Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-16 22:46:32 UTC (rev 1117) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-17 00:01:21 UTC (rev 1118) @@ -785,11 +785,12 @@ level.levelCloseNotify(); mainView.removeLevelView(level.getMapViewFrame()); levels.remove(level); - currentMap = null; if (levels.size() > 0) { // get next open map we can find and set it to currentMap - currentMap = levels.get(levels.size() - 1); + setCurrentLevel(levels.get(levels.size() - 1)); + } else { + setCurrentLevel(null); } } refreshMenusAndToolbars(); @@ -1427,6 +1428,7 @@ public void setCurrentLevel(final MapControl map) { currentMap = map; refreshMenusAndToolbars(); + mapCursorControl.refreshMenus(); //CMainStatusbar.getInstance().setLevelInfo(level); } Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-12-16 22:46:32 UTC (rev 1117) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-12-17 00:01:21 UTC (rev 1118) @@ -824,19 +824,12 @@ private final String[] directionsMap = {"enterNorthMap", "enterEastMap", "enterSouthMap", "enterWestMap", "enterUpperMap", "enterLowerMap"}; - private final String[] directionsGo = {"goNorth", "goEast", "goSouth", "goWest", "goNorthEast", "goSouthEast", "goSouthWest", "goNorthWest"}; - private void initActions() { ACTION_FACTORY.createActions(true, mainControl, "createNew", "open", "options", "exit", "gc", "onlineHelp", "about"); ACTION_FACTORY.createActions(true, mainControl.getScriptController().getView(), "editPlugins", "savePlugins", "exportPluginAs", "importPlugin"); ACTION_FACTORY.createActions(true, mainControl, directionsMap); ACTION_FACTORY.createActions(true, this, "resetView"); ACTION_FACTORY.createToggles(true, mainControl, "autoJoin"); - ACTION_FACTORY.createActions(true, mainControl.getMapCursorControl(), directionsGo); - ACTION_FACTORY.createActions(true, mainControl.getMapCursorControl(), "selectTile", "startStopDrag", "addToSelection", "subFromSelection", "releaseDrag"); - ACTION_FACTORY.createActions(true, mainControl.getMapCursorControl(), "insertArch", "deleteArch"); - ACTION_FACTORY.createActions(true, mainControl.getMapCursorControl(), "selectArchAbove", "selectArchBelow"); - ACTION_FACTORY.createAction(true, "archAttributes", mainControl.getMapCursorControl()); ACTION_FACTORY.createToggles(true, this, "lockAllPickmaps"); aTileShow.setEnabled(false); // not yet implemented @@ -945,9 +938,6 @@ final String mtp = mapState ? mainControl.getCurrentMap().getMapArch().getTilePath(direction) : null; ACTION_FACTORY.getAction(directionsMap[direction]).setEnabled(mtp != null && mtp.length() > 0); } - for (int direction = 0; direction < directionsGo.length; direction++) { - ACTION_FACTORY.getAction(directionsGo[direction]).setEnabled(selState); - } aClear.setEnabled(selState); aCut.setEnabled(selState); aCopy.setEnabled(selState); Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-16 22:46:32 UTC (rev 1117) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-17 00:01:21 UTC (rev 1118) @@ -128,6 +128,7 @@ if (!mapControl.isPickmap()) { mapCursor.addMapCursorListener(mainControl.getMainView().getMapTileList()); mapCursor.addMapCursorListener(mainControl.getMainView().getStatusBar()); + mapCursor.addMapCursorListener(mainControl.getMapCursorControl()); } this.mainControl = mainControl; frame = fi; Modified: trunk/crossfire/src/cfeditor/gui/map/MapCursorControl.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapCursorControl.java 2006-12-16 22:46:32 UTC (rev 1117) +++ trunk/crossfire/src/cfeditor/gui/map/MapCursorControl.java 2006-12-17 00:01:21 UTC (rev 1118) @@ -28,25 +28,61 @@ import cfeditor.gameobject.GameObject; import cfeditor.map.MapControl; import java.awt.Point; +import javax.swing.Action; import net.sf.gridarta.gui.map.MapCursor; +import net.sf.gridarta.gui.map.MapCursorEvent; +import net.sf.gridarta.gui.map.MapCursorListener; import net.sf.gridarta.gui.map.MapGrid; +import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; /** * This class processes events from the cursor menu. * Moving the cursor, selecting map tiles/arches, inserting/deleting arches and open arch property dialog is supported. * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> + * @author Andreas Kirschbaum */ -public class MapCursorControl { +public class MapCursorControl implements MapCursorListener { + /** Action Factory to create Actions. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + /** The MainControl. */ private final CMainControl mainControl; + /** Directions for cursor movement. */ + private final String[] directionsGo = {"goNorth", "goEast", "goSouth", "goWest", "goNorthEast", "goSouthEast", "goSouthWest", "goNorthWest"}; + + private final Action aSelectTile = ACTION_FACTORY.createAction(true, "selectTile", this); + + private final Action aStartStopDrag = ACTION_FACTORY.createAction(true, "startStopDrag", this); + + private final Action aAddToSelection = ACTION_FACTORY.createAction(true, "addToSelection", this); + + private final Action aSubFromSelection = ACTION_FACTORY.createAction(true, "subFromSelection", this); + + private final Action aReleaseDrag = ACTION_FACTORY.createAction(true, "releaseDrag", this); + + private final Action aInsertArch = ACTION_FACTORY.createAction(true, "insertArch", this); + + private final Action aDeleteArch = ACTION_FACTORY.createAction(true, "deleteArch", this); + + private final Action aSelectArchAbove = ACTION_FACTORY.createAction(true, "selectArchAbove", this); + + private final Action aSelectArchBelow = ACTION_FACTORY.createAction(true, "selectArchBelow", this); + + private final Action aArchAttributes = ACTION_FACTORY.createAction(true, "archAttributes", this); + /** * Create a MapCursorControl. * @param mainControl MainControl to use (used for getting the current map etc.) */ public MapCursorControl(final CMainControl mainControl) { this.mainControl = mainControl; + + ACTION_FACTORY.createActions(true, this, directionsGo); + + refreshMenus(); } /** @@ -210,4 +246,39 @@ assert mapCursor != null; return mapCursor; } + + /** {@inheritDoc} */ + public void mapCursorChangedPos(@NotNull MapCursorEvent e) { + // ignore + } + + /** {@inheritDoc} */ + public void mapCursorChangedMode(@NotNull MapCursorEvent e) { + refreshMenus(); + } + + /** + * Enable/disable menu entries based on the current cursor state. + */ + public void refreshMenus() { + final MapControl mapControl = mainControl.getCurrentMap(); + final MapCursor mapCursor = mapControl != null ? mapControl.getMapCursor() : null; + + final boolean hasCursor = mapCursor != null && mapCursor.isActive(); + + for (int direction = 0; direction < directionsGo.length; direction++) { + ACTION_FACTORY.getAction(directionsGo[direction]).setEnabled(hasCursor); + } + aSelectTile.setEnabled(hasCursor); + aStartStopDrag.setEnabled(hasCursor); + aAddToSelection.setEnabled(hasCursor); + aSubFromSelection.setEnabled(hasCursor); + aReleaseDrag.setEnabled(hasCursor); + aInsertArch.setEnabled(hasCursor); + aDeleteArch.setEnabled(hasCursor); + aSelectArchAbove.setEnabled(hasCursor); + aSelectArchBelow.setEnabled(hasCursor); + aArchAttributes.setEnabled(hasCursor); + } + } // class MapCursorControl Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-12-16 22:46:32 UTC (rev 1117) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-12-17 00:01:21 UTC (rev 1118) @@ -997,9 +997,9 @@ if (levels.size() > 0) { // get next open map we can find and set it to currentMap - currentMap = levels.get(levels.size() - 1); + setCurrentLevel(levels.get(levels.size() - 1)); } else { - currentMap = null; + setCurrentLevel(null); } } refreshMenusAndToolbars(); @@ -1676,6 +1676,7 @@ public void setCurrentLevel(final MapControl map) { currentMap = map; refreshMenusAndToolbars(); + mapCursorControl.refreshMenus(); //CMainStatusbar.getInstance().setLevelInfo(level); } Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-12-16 22:46:32 UTC (rev 1117) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-12-17 00:01:21 UTC (rev 1118) @@ -727,16 +727,9 @@ private final String[] directionsMap = {"enterNorthMap", "enterEastMap", "enterSouthMap", "enterWestMap", "enterNorthEastMap", "enterSouthEastMap", "enterSouthWestMap", "enterNorthWestMap"}; - private final String[] directionsGo = {"goNorth", "goEast", "goSouth", "goWest", "goNorthEast", "goSouthEast", "goSouthWest", "goNorthWest"}; - private void initActions() { ACTION_FACTORY.createActions(true, mainControl, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "validateMap", "cleanCompletelyBlockedSquares", "zoom", "gc", "prevWindow", "nextWindow", "onlineHelp", "tod", "about", "update"); ACTION_FACTORY.createActions(true, mainControl, directionsMap); - ACTION_FACTORY.createActions(true, mainControl.getMapCursorControl(), directionsGo); - ACTION_FACTORY.createActions(true, mainControl.getMapCursorControl(), "selectTile", "startStopDrag", "addToSelection", "subFromSelection", "releaseDrag"); - ACTION_FACTORY.createActions(true, mainControl.getMapCursorControl(), "insertArch", "deleteArch"); - ACTION_FACTORY.createActions(true, mainControl.getMapCursorControl(), "selectArchAbove", "selectArchBelow"); - ACTION_FACTORY.createAction(true, "archAttributes", mainControl.getMapCursorControl()); ACTION_FACTORY.createToggles(true, mainControl, "drawDouble", "gridVisible"); ACTION_FACTORY.createToggles(true, this, "lockAllPickmaps"); } @@ -838,7 +831,6 @@ for (int direction = 0; direction < 8; direction++) { final String mtp = mapState ? mainControl.getCurrentMap().getMapArch().getTilePath(direction) : null; ACTION_FACTORY.getAction(directionsMap[direction]).setEnabled(mtp != null && mtp.length() > 0); - ACTION_FACTORY.getAction(directionsGo[direction]).setEnabled(selState); } aClear.setEnabled(selState); aCut.setEnabled(selState); Modified: trunk/daimonin/src/daieditor/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-12-16 22:46:32 UTC (rev 1117) +++ trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-12-17 00:01:21 UTC (rev 1118) @@ -125,6 +125,7 @@ if (!mapControl.isPickmap()) { mapCursor.addMapCursorListener(mainControl.getMainView().getMapTileList()); mapCursor.addMapCursorListener(mainControl.getMainView().getStatusBar()); + mapCursor.addMapCursorListener(mainControl.getMapCursorControl()); } this.mainControl = mainControl; Modified: trunk/daimonin/src/daieditor/gui/map/MapCursorControl.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapCursorControl.java 2006-12-16 22:46:32 UTC (rev 1117) +++ trunk/daimonin/src/daieditor/gui/map/MapCursorControl.java 2006-12-17 00:01:21 UTC (rev 1118) @@ -28,25 +28,61 @@ import daieditor.gameobject.GameObject; import daieditor.map.MapControl; import java.awt.Point; +import javax.swing.Action; import net.sf.gridarta.gui.map.MapCursor; +import net.sf.gridarta.gui.map.MapCursorEvent; +import net.sf.gridarta.gui.map.MapCursorListener; import net.sf.gridarta.gui.map.MapGrid; +import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; /** * This class processes events from the cursor menu. * Moving the cursor, selecting map tiles/arches, inserting/deleting arches and open arch property dialog is supported. * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> + * @author Andreas Kirschbaum */ -public class MapCursorControl { +public class MapCursorControl implements MapCursorListener { + /** Action Factory to create Actions. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); + /** The MainControl. */ private final CMainControl mainControl; + /** Directions for cursor movement. */ + private final String[] directionsGo = {"goNorth", "goEast", "goSouth", "goWest", "goNorthEast", "goSouthEast", "goSouthWest", "goNorthWest"}; + + private final Action aSelectTile = ACTION_FACTORY.createAction(true, "selectTile", this); + + private final Action aStartStopDrag = ACTION_FACTORY.createAction(true, "startStopDrag", this); + + private final Action aAddToSelection = ACTION_FACTORY.createAction(true, "addToSelection", this); + + private final Action aSubFromSelection = ACTION_FACTORY.createAction(true, "subFromSelection", this); + + private final Action aReleaseDrag = ACTION_FACTORY.createAction(true, "releaseDrag", this); + + private final Action aInsertArch = ACTION_FACTORY.createAction(true, "insertArch", this); + + private final Action aDeleteArch = ACTION_FACTORY.createAction(true, "deleteArch", this); + + private final Action aSelectArchAbove = ACTION_FACTORY.createAction(true, "selectArchAbove", this); + + private final Action aSelectArchBelow = ACTION_FACTORY.createAction(true, "selectArchBelow", this); + + private final Action aArchAttributes = ACTION_FACTORY.createAction(true, "archAttributes", this); + /** * Create a MapCursorControl. * @param mainControl MainControl to use (used for getting the current map etc.) */ public MapCursorControl(final CMainControl mainControl) { this.mainControl = mainControl; + + ACTION_FACTORY.createActions(true, this, directionsGo); + + refreshMenus(); } /** @@ -209,4 +245,39 @@ assert mapCursor != null; return mapCursor; } + + /** {@inheritDoc} */ + public void mapCursorChangedPos(@NotNull MapCursorEvent e) { + // ignore + } + + /** {@inheritDoc} */ + public void mapCursorChangedMode(@NotNull MapCursorEvent e) { + refreshMenus(); + } + + /** + * Enable/disable menu entries based on the current cursor state. + */ + public void refreshMenus() { + final MapControl mapControl = mainControl.getCurrentMap(); + final MapCursor mapCursor = mapControl != null ? mapControl.getMapCursor() : null; + + final boolean hasCursor = mapCursor != null && mapCursor.isActive(); + + for (int direction = 0; direction < directionsGo.length; direction++) { + ACTION_FACTORY.getAction(directionsGo[direction]).setEnabled(hasCursor); + } + aSelectTile.setEnabled(hasCursor); + aStartStopDrag.setEnabled(hasCursor); + aAddToSelection.setEnabled(hasCursor); + aSubFromSelection.setEnabled(hasCursor); + aReleaseDrag.setEnabled(hasCursor); + aInsertArch.setEnabled(hasCursor); + aDeleteArch.setEnabled(hasCursor); + aSelectArchAbove.setEnabled(hasCursor); + aSelectArchBelow.setEnabled(hasCursor); + aArchAttributes.setEnabled(hasCursor); + } + } // class MapCursorControl This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |