You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <chr...@us...> - 2006-08-15 15:19:53
|
Revision: 259 Author: christianhujer Date: 2006-08-15 08:19:46 -0700 (Tue, 15 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=259&view=rev Log Message: ----------- Optimized imports. Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/MapModel.java Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-08-13 14:40:07 UTC (rev 258) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-08-15 15:19:46 UTC (rev 259) @@ -4,10 +4,7 @@ import cfeditor.arch.ArchObjectIterator; import cfeditor.arch.ArchObjectIteratorDeleteMapArch; import java.awt.Point; -import java.util.List; -import net.sf.gridarta.Size2D; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; /** * Interface for MapModels. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-08-13 14:40:20
|
Revision: 258 Author: akirschbaum Date: 2006-08-13 07:40:07 -0700 (Sun, 13 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=258&view=rev Log Message: ----------- Make readArch() private. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapFileDecode.java Modified: trunk/crossfire/src/cfeditor/CMapFileDecode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-08-13 13:54:26 UTC (rev 257) +++ trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-08-13 14:40:07 UTC (rev 258) @@ -120,7 +120,7 @@ * @return the new parsed <code>ArchObject</code> * @throws IOException when an I/O-error occured during file reading */ - @Nullable public ArchObject readArch(final BufferedReader myInput, String thisLine, final ArchObject container) + @Nullable private ArchObject readArch(final BufferedReader myInput, String thisLine, final ArchObject container) throws IOException { ArchObject arch; String thisLine2; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-08-13 13:54:35
|
Revision: 257 Author: christianhujer Date: 2006-08-13 06:54:26 -0700 (Sun, 13 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=257&view=rev Log Message: ----------- Added significant change to changelog. Modified Paths: -------------- trunk/crossfire/CHANGES.txt Modified: trunk/crossfire/CHANGES.txt =================================================================== --- trunk/crossfire/CHANGES.txt 2006-08-13 13:50:21 UTC (rev 256) +++ trunk/crossfire/CHANGES.txt 2006-08-13 13:54:26 UTC (rev 257) @@ -1007,6 +1007,12 @@ --- 12/08/2006 --- +Removed all ISO code. + +Christian Hujer + +--- 12/08/2006 --- + Prevent crash when saving inventory objects having a msg...endmsg field. Andreas Kirschbaum This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-08-13 13:50:31
|
Revision: 256 Author: christianhujer Date: 2006-08-13 06:50:21 -0700 (Sun, 13 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=256&view=rev Log Message: ----------- Minor unification. Modified Paths: -------------- trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/daimonin/src/daieditor/ScriptArchData.java Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-08-13 13:45:58 UTC (rev 255) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-08-13 13:50:21 UTC (rev 256) @@ -51,12 +51,13 @@ import org.jetbrains.annotations.Nullable; /** - * Subclass of ArchObject to store and manage information about scripted events. + * Stores and manages information about scripted events. * This data is only needed for those arches with one or more events defined. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ public final class ScriptArchData { + /** Logger. */ private static final Logger log = Logger.getLogger(ScriptArchData.class); // constants for addEventData() parameters Modified: trunk/daimonin/src/daieditor/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/ScriptArchData.java 2006-08-13 13:45:58 UTC (rev 255) +++ trunk/daimonin/src/daieditor/ScriptArchData.java 2006-08-13 13:50:21 UTC (rev 256) @@ -49,10 +49,11 @@ import static javax.swing.WindowConstants.HIDE_ON_CLOSE; import net.sf.japi.swing.ActionFactory; import static net.sf.japi.swing.ActionFactory.getFactory; +import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; /** - * Subclass of ArchObject to store and manage information about scripted events. + * Stores and manages information about scripted events. * This data is only needed for those arches with one or more events defined. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ @@ -61,6 +62,9 @@ /** ActionFactory. */ private static final ActionFactory ACTION_FACTORY = getFactory("daieditor"); + /** Logger. */ + private static final Logger log = Logger.getLogger(ScriptArchData.class); + // popup frame to edit script paths: private static JDialog pathFrame; @@ -267,7 +271,7 @@ final File mapDir = new File(mainControl.getMapDefaultFolder()); // global map directory if (!mapDir.exists()) { - System.err.println("Map directory '" + mapDir.getAbsolutePath() + "' does not exist!"); + log.warn("Map directory '" + mapDir.getAbsolutePath() + "' does not exist!"); return f.getName(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-08-13 13:46:06
|
Revision: 255 Author: akirschbaum Date: 2006-08-13 06:45:58 -0700 (Sun, 13 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=255&view=rev Log Message: ----------- Remove loop with constant iteration count of one. Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-08-13 13:28:29 UTC (rev 254) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-08-13 13:45:58 UTC (rev 255) @@ -638,51 +638,49 @@ final int mapx = arch.getMapX(); final int mapy = arch.getMapY(); - for (int c = 0; c <= 0; c++) { - if (oldarch != null) { - arch.setMapMultiHead(startarch); - oldarch.setMapMultiNext(arch); - } else { - startarch = arch; - } - oldarch = arch; + if (oldarch != null) { + arch.setMapMultiHead(startarch); + oldarch.setMapMultiNext(arch); + } else { + startarch = arch; + } + oldarch = arch; - // insert ít in map or add to arch in map - ArchObject node = mapGrid[mapx][mapy]; - if (node == null) { - mapGrid[mapx][mapy] = arch; - mapGrid[mapx][mapy].setMapX(mapx); - mapGrid[mapx][mapy].setMapY(mapy); - } else { - if (!insertBelow) { - // if we want to insert on top, we need to get last node element - for (int i = 0; node.getNext() != null; i++) { - node = node.getNext(); - } - - node.setNext(arch); - node.getNext().setPrev(node); - node.getNext().setMapX(mapx); - node.getNext().setMapY(mapy); - } else { - // insert below, so just put it on first place - node.setPrev(arch); - arch.setNext(node); - mapGrid[mapx][mapy] = arch; - arch.setMapX(mapx); - arch.setMapY(mapy); - arch.propagateElevation(node); + // insert ít in map or add to arch in map + ArchObject node = mapGrid[mapx][mapy]; + if (node == null) { + mapGrid[mapx][mapy] = arch; + mapGrid[mapx][mapy].setMapX(mapx); + mapGrid[mapx][mapy].setMapY(mapy); + } else { + if (!insertBelow) { + // if we want to insert on top, we need to get last node element + for (int i = 0; node.getNext() != null; i++) { + node = node.getNext(); } - } - // calculate edit type - if (arch.isReferenced() && arch.getMapMultiHead() != null) { - arch.setEditType(arch.getMapMultiHead().getEditType()); // copy from head - } else if (mapControl.getActiveEditType() != 0) { - arch.setEditType(arch.calculateEditType(mapControl.getActiveEditType())); // calculate new + node.setNext(arch); + node.getNext().setPrev(node); + node.getNext().setMapX(mapx); + node.getNext().setMapY(mapy); + } else { + // insert below, so just put it on first place + node.setPrev(arch); + arch.setNext(node); + mapGrid[mapx][mapy] = arch; + arch.setMapX(mapx); + arch.setMapY(mapy); + arch.propagateElevation(node); } } + // calculate edit type + if (arch.isReferenced() && arch.getMapMultiHead() != null) { + arch.setEditType(arch.getMapMultiHead().getEditType()); // copy from head + } else if (mapControl.getActiveEditType() != 0) { + arch.setEditType(arch.calculateEditType(mapControl.getActiveEditType())); // calculate new + } + setLevelChangedFlag(); // Level data has changed return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-08-13 13:28:34
|
Revision: 254 Author: akirschbaum Date: 2006-08-13 06:28:29 -0700 (Sun, 13 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=254&view=rev Log Message: ----------- Copy all fields when cloning. Modified Paths: -------------- trunk/crossfire/src/cfeditor/MultiArchData.java Modified: trunk/crossfire/src/cfeditor/MultiArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/MultiArchData.java 2006-08-13 13:26:59 UTC (rev 253) +++ trunk/crossfire/src/cfeditor/MultiArchData.java 2006-08-13 13:28:29 UTC (rev 254) @@ -91,6 +91,7 @@ // and NOT the head clone.refnr = refnr; // if != -1 - multi tile; if refnr == nodenr then first tile // else refnr==first tile; multi tile: offset pos from head + clone.refx = refx; clone.refy = refy; // sic! clone.refcount = refcount; // head: number of parts clone.refmaxx = refmaxx; // head: parts in x This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-08-13 13:27:15
|
Revision: 253 Author: christianhujer Date: 2006-08-13 06:26:59 -0700 (Sun, 13 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=253&view=rev Log Message: ----------- Deprecated some methods. Modified Paths: -------------- trunk/daimonin/src/daieditor/arch/ArchObject.java trunk/src/app/net/sf/gridarta/arch/ArchObject.java Modified: trunk/daimonin/src/daieditor/arch/ArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-08-13 13:25:14 UTC (rev 252) +++ trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-08-13 13:26:59 UTC (rev 253) @@ -312,20 +312,17 @@ return editType; } - /** - * Get the String of an arch attribute from the archText both of the arch - * itself and if n.e. in it's default arch. If the attribute doesn't exist - * in either one, an empty String "" is returned. - * @param attr search for "attr <value>" - * @param defarch default arch of this arch, or <code>null</code> if this - * arch is a default arch or the default arch should be ignored - * @return <string>, "" if not found - */ - public String getAttributeString(final String attr, final net.sf.gridarta.arch.ArchObject defarch) { + /** {@inheritDoc} */ + @Deprecated public String getAttributeString(final String attr, final net.sf.gridarta.arch.ArchObject defarch) { + throw new Error("deprecated and not used in Daimonin"); + } + + /** {@inheritDoc} */ + public String getAttributeString(final String attr, final boolean useDefArch) { String aText = archText.toString(); // The "real" Archtext from arch & defarch // Add all attributes from defarch that don't already exist in aText - if (defarch != null) { - aText += diffArchText(defarch.getArchText(), true); + if (useDefArch) { + aText += diffArchText(defaultArch.getArchText(), true); } final String attr2 = attr.trim() + ' '; // attr must be followed by space String result = ""; // returned String @@ -338,11 +335,6 @@ } /** {@inheritDoc} */ - public String getAttributeString(final String attr, final boolean useDefArch) { - return getAttributeString(attr, useDefArch ? defaultArch : null); - } - - /** {@inheritDoc} */ public String getAttributeString(final String attr) { return getAttributeString(attr, true); } Modified: trunk/src/app/net/sf/gridarta/arch/ArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/arch/ArchObject.java 2006-08-13 13:25:14 UTC (rev 252) +++ trunk/src/app/net/sf/gridarta/arch/ArchObject.java 2006-08-13 13:26:59 UTC (rev 253) @@ -28,8 +28,9 @@ * @param defarch default arch of this arch, or <code>null</code> if this * arch is a default arch or the default arch should be ignored * @return <string>, "" if not found + * @deprecated an ArchObject knows its own default arch and there is no purpose for using another ArchObject as defarch. Because of that this method will be removed. */ - String getAttributeString(String attr, ArchObject defarch); + @Deprecated String getAttributeString(String attr, ArchObject defarch); /** * Get the value of an attribute of this ArchObject. @@ -58,8 +59,9 @@ * @param defarch default arch of this arch, or <code>null</code> if this * arch is a default arch or the default arch should be ignored * @return <code><var>value</var></code>, zero if not found + * @deprecated an ArchObject knows its own default arch and there is no purpose for using another ArchObject as defarch. Because of that this method will be removed. */ - int getAttributeInt(String attr, ArchObject defarch); + @Deprecated int getAttributeInt(String attr, ArchObject defarch); /** * Get the value of an arch attribute from the archText both of the arch @@ -80,8 +82,9 @@ * @param defarch default arch of this arch, or <code>null</code> if this * arch is a default arch or the default arch should be ignored * @return <value>, zero if not found + * @deprecated an ArchObject knows its own default arch and there is no purpose for using another ArchObject as defarch. Because of that this method will be removed. */ - long getAttributeLong(String attr, ArchObject defarch); + @Deprecated long getAttributeLong(String attr, ArchObject defarch); /** * Get the value of an arch attribute from the archText both of the arch @@ -102,8 +105,9 @@ * @param defarch default arch of this arch, or <code>null</code> if this * arch is a default arch or the default arch should be ignored * @return <value>, zero if not found + * @deprecated an ArchObject knows its own default arch and there is no purpose for using another ArchObject as defarch. Because of that this method will be removed. */ - double getAttributeDouble(String attr, ArchObject defarch); + @Deprecated double getAttributeDouble(String attr, ArchObject defarch); /** * Get the value of an arch attribute from the archText both of the arch This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-08-13 13:25:27
|
Revision: 252 Author: christianhujer Date: 2006-08-13 06:25:14 -0700 (Sun, 13 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=252&view=rev Log Message: ----------- Replaced CSplitPane classes with GSplitPane. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/src/app/net/sf/gridarta/gui/GSplitPane.java Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-08-13 13:24:17 UTC (rev 251) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-08-13 13:25:14 UTC (rev 252) @@ -27,27 +27,25 @@ import cfeditor.arch.ArchObject; import cfeditor.map.MapControl; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.Dimension; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.beans.PropertyVetoException; -import java.util.List; import java.util.ArrayList; import java.util.Collections; +import java.util.List; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JOptionPane; -import javax.swing.JSplitPane; import javax.swing.JTabbedPane; import javax.swing.UIManager; import javax.swing.event.InternalFrameEvent; import javax.swing.event.InternalFrameListener; -import cfeditor.GridderException; +import net.sf.gridarta.gui.GSplitPane; import net.sf.gridarta.help.Help; import org.jetbrains.annotations.Nullable; @@ -111,13 +109,13 @@ private CMainMenu menu; /** The split pane. */ - private CSplitPane splitPane; + private GSplitPane splitPane; /** All open level views. */ - private CSplitPane splitDownPane; + private GSplitPane splitDownPane; /** All open level views. */ - private CSplitPane splitRightPane; + private GSplitPane splitRightPane; /** All open level views. */ private List<MapViewIFrame> mapViews = new ArrayList<MapViewIFrame>(); @@ -214,7 +212,7 @@ if (!mapTileListBottom) { // the map tile list is on the right side - splitRightPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT, mapDesktop, mapTileList); + splitRightPane = new GSplitPane(GSplitPane.HORIZONTAL_SPLIT, mapDesktop, mapTileList); splitRightPane.setDividerLocation(divLocationRight); splitRightPane.setDividerSize(BORDER_SIZE); @@ -222,14 +220,14 @@ getContentPane().add(splitRightPane, BorderLayout.CENTER); mapArchPanel = new CMapArchPanel(mainControl, this); - splitDownPane = new CSplitPane(CSplitPane.VERTICAL_SPLIT, splitRightPane, mapArchPanel); + splitDownPane = new GSplitPane(GSplitPane.VERTICAL_SPLIT, splitRightPane, mapArchPanel); splitDownPane.setDividerLocation(divLocationDown); splitDownPane.setDividerSize(BORDER_SIZE); getContentPane().add(splitDownPane, BorderLayout.CENTER); - splitPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT, archPanel, splitDownPane); + splitPane = new GSplitPane(GSplitPane.HORIZONTAL_SPLIT, archPanel, splitDownPane); splitPane.setDividerLocation(divLocation); splitPane.setDividerSize(BORDER_SIZE); @@ -237,20 +235,20 @@ } else { // the map tile list is merged into the bottom panel mapArchPanel = new CMapArchPanel(mainControl, this); - splitRightPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT, mapArchPanel, mapTileList); + splitRightPane = new GSplitPane(GSplitPane.HORIZONTAL_SPLIT, mapArchPanel, mapTileList); splitRightPane.setDividerLocation(divLocationRight); splitRightPane.setDividerSize(BORDER_SIZE); // split off the bottom panel - splitDownPane = new CSplitPane(CSplitPane.VERTICAL_SPLIT, mapDesktop, splitRightPane); + splitDownPane = new GSplitPane(GSplitPane.VERTICAL_SPLIT, mapDesktop, splitRightPane); splitDownPane.setDividerLocation(divLocationDown); splitDownPane.setDividerSize(BORDER_SIZE); getContentPane().add(splitDownPane, BorderLayout.CENTER); // split off the left arch panel - splitPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT, archPanel, splitDownPane); + splitPane = new GSplitPane(GSplitPane.HORIZONTAL_SPLIT, archPanel, splitDownPane); splitPane.setDividerLocation(divLocation); splitPane.setDividerSize(BORDER_SIZE); @@ -746,28 +744,4 @@ public void internalFrameDeactivated(final InternalFrameEvent e) { } - /** Splitpane class that keeps its size even upon L'n'F change. */ - public static final class CSplitPane extends JSplitPane { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - public CSplitPane(final int newOrientation, final Component newLeftComponent, final Component newRightComponent) { - super(newOrientation, newLeftComponent, newRightComponent); - } - - /** - * Overridden to store and restore the divider location upon - * UI change. - */ - @Override public void updateUI() { - final int dividerLocation = getDividerLocation(); - final int dividerSize = getDividerSize(); - super.updateUI(); - setDividerLocation(dividerLocation); - setDividerSize(dividerSize); - } - - } // class CSplitPane - } // class CMainView Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-08-13 13:24:17 UTC (rev 251) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-08-13 13:25:14 UTC (rev 252) @@ -56,6 +56,7 @@ import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; +import net.sf.gridarta.gui.GSplitPane; /** * <code>CMapArchPanel</code> implements the panel that holds information about @@ -106,7 +107,7 @@ private final CMainView mainView; - private final CSplitPane splitPane; + private final GSplitPane splitPane; private final JTabbedPane panelDesktop; @@ -186,8 +187,8 @@ panelDesktop = new JTabbedPane(JTabbedPane.TOP); mapArchPanel.setLayout(new BorderLayout()); - splitPane = new CSplitPane( - CSplitPane.HORIZONTAL_SPLIT, + splitPane = new GSplitPane( + GSplitPane.HORIZONTAL_SPLIT, scrollPane3, scrollPane2); @@ -892,28 +893,4 @@ s_remove.setEnabled(removeButton); } - /** Splitpane class that keeps its size even upon L'n'F change. */ - public final class CSplitPane extends JSplitPane { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - public CSplitPane(final int newOrientation, - final Component newLeftComponent, - final Component newRightComponent) { - super(newOrientation, newLeftComponent, newRightComponent); - } - - /** - * Overridden to store and restore the divider location upon - * UI change. - */ - @Override public void updateUI() { - final int dividerLocation = getDividerLocation(); - final int dividerSize = getDividerSize(); - super.updateUI(); - setDividerLocation(dividerLocation); - setDividerSize(dividerSize); - } - } -} +} // class CMapArchPanel Modified: trunk/src/app/net/sf/gridarta/gui/GSplitPane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GSplitPane.java 2006-08-13 13:24:17 UTC (rev 251) +++ trunk/src/app/net/sf/gridarta/gui/GSplitPane.java 2006-08-13 13:25:14 UTC (rev 252) @@ -55,10 +55,10 @@ // Overridden to store and restore the divider location upon UI change. @Override public void updateUI() { final int dividerLocationBackup = getDividerLocation(); - //final int dividerSizeBackup = getDividerSize(); + final int dividerSizeBackup = getDividerSize(); super.updateUI(); setDividerLocation(dividerLocationBackup); - //setDividerSize(dividerSizeBackup); + setDividerSize(dividerSizeBackup); } } // class DSplitPane This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-08-13 13:24:22
|
Revision: 251 Author: christianhujer Date: 2006-08-13 06:24:17 -0700 (Sun, 13 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=251&view=rev Log Message: ----------- Cosmetic improvements. Modified Paths: -------------- trunk/daimonin/src/daieditor/ScriptArchData.java Modified: trunk/daimonin/src/daieditor/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/ScriptArchData.java 2006-08-12 22:34:57 UTC (rev 250) +++ trunk/daimonin/src/daieditor/ScriptArchData.java 2006-08-13 13:24:17 UTC (rev 251) @@ -128,7 +128,7 @@ * @return index of ScriptedEvent in 'eventList' if found, -1 if not found */ @Nullable private ArchObject getScriptedEvent(final int eventType) { - for (ArchObject tmp : owner) { + for (final ArchObject tmp : owner) { if (tmp.getArchTypNr() == 118 && tmp.getAttributeInt("sub_type", owner.getDefaultArch()) == eventType) { return tmp; } @@ -142,7 +142,7 @@ * ScriptedEvent objects get removed. */ public void validateAllEvents() { - for (ArchObject tmp : owner) { + for (final ArchObject tmp : owner) { if (tmp.getArchTypNr() == 118) { final ScriptedEvent se = new ScriptedEvent(tmp); // validate this event @@ -161,6 +161,8 @@ * @param list JList */ public void addEventsToJList(final JList list) { + //huj: JList expects Vector, so we MUST use an obsolete concrete collection. + //noinspection CollectionDeclaredAsConcreteClass,UseOfObsoleteCollectionType final Vector<String> content = new Vector<String>(); for (final ArchObject tmp : owner) { if (tmp.getArchTypNr() == 118) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-08-12 22:35:57
|
Revision: 250 Author: christianhujer Date: 2006-08-12 15:34:57 -0700 (Sat, 12 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=250&view=rev Log Message: ----------- More unification. Removed ISO code from CFEditor. Removed GridderException usage from Daimonin Editor. Moved GridderException from Gridarta to CFEditor. Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapFileDecode.java trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/COptionDialog.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/IGUIConstants.java trunk/crossfire/src/cfeditor/MultiArchData.java trunk/crossfire/src/cfeditor/MultiPositionData.java trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/crossfire/src/cfeditor/map/MapArchObject.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/map/MapModel.java trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMapFileDecode.java trunk/daimonin/src/daieditor/CMapFileEncode.java trunk/daimonin/src/daieditor/CPickmapPanel.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java trunk/daimonin/src/daieditor/gui/map/MapTilePane.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/MapModel.java trunk/daimonin/src/daieditor/map/validation/checks/MapDifficultyChecker.java trunk/daimonin/src/daieditor/map/validation/checks/TilePathsChecker.java trunk/src/app/net/sf/gridarta/map/MapModel.java Added Paths: ----------- trunk/crossfire/src/cfeditor/GridderException.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/GridderException.java Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-08-11 22:56:44 UTC (rev 249) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-08-12 22:34:57 UTC (rev 250) @@ -94,7 +94,7 @@ // (starting at 'this') // open the resource file - final String baseDir = (IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR : IGUIConstants.CONFIG_DIR); + final String baseDir = IGUIConstants.CONFIG_DIR; final CFileReader stream = new CFileReader(baseDir, filename); // read the file Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-08-11 22:56:44 UTC (rev 249) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-08-12 22:34:57 UTC (rev 250) @@ -66,7 +66,7 @@ import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; -import net.sf.gridarta.GridderException; +import cfeditor.GridderException; import net.sf.gridarta.help.Help; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-08-11 22:56:44 UTC (rev 249) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-08-12 22:34:57 UTC (rev 250) @@ -89,7 +89,7 @@ try { // open ascii filestream to the xml data - final String baseDir = (IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR : IGUIConstants.CONFIG_DIR); + final String baseDir = IGUIConstants.CONFIG_DIR; fread = new CFileReader(baseDir, IGUIConstants.TYPEDEF_FILE); // parse xml document @@ -289,7 +289,7 @@ try { // open reading stream to the spells xml file - final String baseDir = (IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR : IGUIConstants.CONFIG_DIR); + final String baseDir = IGUIConstants.CONFIG_DIR; reader = new CFileReader(baseDir, IGUIConstants.SPELL_FILE); // parse xml document Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-08-11 22:56:44 UTC (rev 249) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-08-12 22:34:57 UTC (rev 250) @@ -52,7 +52,7 @@ import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreePath; -import net.sf.gridarta.GridderException; +import cfeditor.GridderException; import net.sf.gridarta.help.Help; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -246,7 +246,7 @@ // first step: parsing datafile, adding all treasurelists to the tmpList vector try { - final String baseDir = IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() : IGUIConstants.CONFIG_DIR; + final String baseDir = IGUIConstants.CONFIG_DIR; final CFileReader reader = new CFileReader(baseDir, IGUIConstants.TREASURES_FILE); String line = null; // read line of file @@ -433,10 +433,8 @@ insideArch = true; } else { - if (!IGUIConstants.isoView) { - errorLog.append("in list " + parentNode.getTreasureObj().getName() - + ": unknown line:\n\"" + line + "\"\n"); - } + errorLog.append("in list " + parentNode.getTreasureObj().getName() + + ": unknown line:\n\"" + line + "\"\n"); } } else { // reading inside an arch-section @@ -489,10 +487,8 @@ // parse this subtree readInsideList(subNode, reader, needLink); } else { - if (!IGUIConstants.isoView) { - errorLog.append("in list " + parentNode.getTreasureObj().getName() + ", arch " - + node.getTreasureObj().getName() + ": unexpected line:\n\"" + line + "\"\n"); - } + errorLog.append("in list " + parentNode.getTreasureObj().getName() + ", arch " + + node.getTreasureObj().getName() + ": unexpected line:\n\"" + line + "\"\n"); } } } @@ -679,7 +675,7 @@ /** * @return The name of the currently selected treasurelist. * If nothing is selected, null is returned. - * @throws net.sf.gridarta.GridderException when user selected an invalid + * @throws GridderException when user selected an invalid * treasurelist (e.g. a god-list) */ @Nullable private String getSelectedTreasureList() throws GridderException { Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-08-11 22:56:44 UTC (rev 249) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-08-12 22:34:57 UTC (rev 250) @@ -53,7 +53,7 @@ import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.GridderException; +import cfeditor.GridderException; import net.sf.gridarta.Size2D; import net.sf.japi.swing.ActionFactory; import static net.sf.japi.swing.ActionFactory.getFactory; @@ -83,11 +83,11 @@ public static final String MAP_DIR_KEY = "mapDirectory"; - public static final String DEFAULT_MAP_DIR = IGUIConstants.isoView ? "../maps" : "maps"; + public static final String DEFAULT_MAP_DIR = "maps"; public static final String ARCH_DIR_KEY = "archDirectory"; - public static final String DEFAULT_ARCH_DIR = IGUIConstants.isoView ? "../arch" : "arch"; + public static final String DEFAULT_ARCH_DIR = "arch"; public static final String SCRIPT_DIR_KEY = "scriptDirectory"; @@ -250,11 +250,6 @@ JFontChooser.setUIFont(getPlainFont()); } - // initialize & load - if (IGUIConstants.isoView) { - MultiPositionData.init(); - } - // initialize the script-editor pad ScriptEditControl.init(getMapDefaultFolder(), this); @@ -468,7 +463,7 @@ mapDir = new File(currentDir.getAbsolutePath(), mapDir.getPath()); } - imageSet = new String(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(USE_IMAGESET, (IGUIConstants.isoView ? "none" : "base"))); + imageSet = new String(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(USE_IMAGESET, "base")); if (imageSet.equalsIgnoreCase("none")) { imageSet = null; } @@ -1401,38 +1396,36 @@ openFile(newfile); // open the new map // set viewport view on the new map - if (!IGUIConstants.isoView) { - final JViewport newViewPort = currentMap.getMapView().getViewPort(); - final JViewport oldViewPort = oldmap.getMapView().getViewPort(); + final JViewport newViewPort = currentMap.getMapView().getViewPort(); + final JViewport oldViewPort = oldmap.getMapView().getViewPort(); - final Rectangle scrollto; // new vieport rect - if (direction == IGUIConstants.SOUTH) { - scrollto = new Rectangle(oldViewPort.getViewRect().x, 0, oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); - } else if (direction == IGUIConstants.NORTH) { - scrollto = new Rectangle(oldViewPort.getViewRect().x, newViewPort.getViewSize().height - oldViewPort.getViewRect().height, oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); - } else if (direction == IGUIConstants.EAST) { - scrollto = new Rectangle(0, oldViewPort.getViewRect().y, oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); - } else if (direction == IGUIConstants.WEST) { - scrollto = new Rectangle(newViewPort.getViewSize().width - oldViewPort.getViewRect().width, oldViewPort.getViewRect().y, oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); - } else { - scrollto = null; - } + final Rectangle scrollto; // new vieport rect + if (direction == IGUIConstants.SOUTH) { + scrollto = new Rectangle(oldViewPort.getViewRect().x, 0, oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); + } else if (direction == IGUIConstants.NORTH) { + scrollto = new Rectangle(oldViewPort.getViewRect().x, newViewPort.getViewSize().height - oldViewPort.getViewRect().height, oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); + } else if (direction == IGUIConstants.EAST) { + scrollto = new Rectangle(0, oldViewPort.getViewRect().y, oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); + } else if (direction == IGUIConstants.WEST) { + scrollto = new Rectangle(newViewPort.getViewSize().width - oldViewPort.getViewRect().width, oldViewPort.getViewRect().y, oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); + } else { + scrollto = null; + } - if (scrollto.x + scrollto.width > newViewPort.getViewSize().width) { - scrollto.x = newViewPort.getViewSize().width - scrollto.width; - } - if (scrollto.x < 0) { - scrollto.x = 0; - } - if (scrollto.y + scrollto.height > newViewPort.getViewSize().height) { - scrollto.y = newViewPort.getViewSize().height - scrollto.height; - } - if (scrollto.y < 0) { - scrollto.y = 0; - } - newViewPort.setViewPosition(scrollto.getLocation()); - //getViewport().scrollRectToVisible(scrollto); + if (scrollto.x + scrollto.width > newViewPort.getViewSize().width) { + scrollto.x = newViewPort.getViewSize().width - scrollto.width; } + if (scrollto.x < 0) { + scrollto.x = 0; + } + if (scrollto.y + scrollto.height > newViewPort.getViewSize().height) { + scrollto.y = newViewPort.getViewSize().height - scrollto.height; + } + if (scrollto.y < 0) { + scrollto.y = 0; + } + newViewPort.setViewPosition(scrollto.getLocation()); + //getViewport().scrollRectToVisible(scrollto); // Update the main view so the new map instantly pops up. mainView.update(mainView.getGraphics()); @@ -1649,7 +1642,7 @@ * Returns all level windows that exist in the main view. * @return All level windows */ - Enumeration getAllLevelWindows() { + List<MapViewIFrame> getAllLevelWindows() { return mainView.getAllLevelWindows(); } @@ -1715,7 +1708,7 @@ } public ImageIcon getUnknownTileIcon() { - return IGUIConstants.isoView ? unknownTileIcon : unknownTileIconX; + return unknownTileIconX; } public ImageIcon getUnknownTileIconX() { @@ -1723,7 +1716,7 @@ } public ImageIcon getNoarchTileIcon() { - return IGUIConstants.isoView ? noarchTileIcon : noarchTileIconX; + return noarchTileIconX; } public ImageIcon getNoarchTileIconF() { @@ -1735,7 +1728,7 @@ } public ImageIcon getNofaceTileIcon() { - return IGUIConstants.isoView ? nofaceTileIcon : nofaceTileIconX; + return nofaceTileIconX; } public ImageIcon getNofaceTileIconF() { @@ -1816,7 +1809,7 @@ } public ImageIcon getEmptyTileIcon() { - return IGUIConstants.isoView ? nofaceTileIcon : nofaceTileIconX; + return nofaceTileIconX; } public MapControl[] getOpenedMaps() { Modified: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-08-11 22:56:44 UTC (rev 249) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-08-12 22:34:57 UTC (rev 250) @@ -40,6 +40,7 @@ import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.util.Enumeration; +import java.util.List; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; @@ -953,7 +954,7 @@ menuManager.addMenuEntry("main", entry); entry.setMnemonic('R'); - m_collectArch = new SimpleMenuEntry(IGUIConstants.isoView ? "Collect Arches" : "Collect CF Arches"); + m_collectArch = new SimpleMenuEntry("Collect CF Arches"); m_collectArch.setMnemonic('A'); m_collectArch.addActionListener( new ActionListener() { @@ -1207,12 +1208,11 @@ menu_window.addSeparator(); menu_window.add(m_closeAll); - final Enumeration windows = mainControl.getAllLevelWindows(); + final List<MapViewIFrame> windows = mainControl.getAllLevelWindows(); if (windows != null) { menu_window.addSeparator(); int index = 1; - while (windows.hasMoreElements()) { - final MapViewIFrame view = (MapViewIFrame) windows.nextElement(); + for (final MapViewIFrame view : windows) { final JMenuItem menuItem; if (index < 10) { menuItem = new JMenuItem("" + index + " " + view.getTitle()); Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-08-11 22:56:44 UTC (rev 249) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-08-12 22:34:57 UTC (rev 250) @@ -34,8 +34,9 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.beans.PropertyVetoException; -import java.util.Enumeration; -import java.util.Vector; +import java.util.List; +import java.util.ArrayList; +import java.util.Collections; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JDesktopPane; @@ -46,7 +47,7 @@ import javax.swing.UIManager; import javax.swing.event.InternalFrameEvent; import javax.swing.event.InternalFrameListener; -import net.sf.gridarta.GridderException; +import cfeditor.GridderException; import net.sf.gridarta.help.Help; import org.jetbrains.annotations.Nullable; @@ -119,7 +120,7 @@ private CSplitPane splitRightPane; /** All open level views. */ - private Vector mapViews = new Vector(1, 2); + private List<MapViewIFrame> mapViews = new ArrayList<MapViewIFrame>(); /** List of objects on map (right side). */ private CMapTileList mapTileList; @@ -530,7 +531,7 @@ return; } - mapViews.removeElement(mapView); + mapViews.remove(mapView); mapView.closeNotify(); mapDesktop.remove(mapView); mapView.dispose(); @@ -543,9 +544,9 @@ * Returns all level windows that exist in the main view. * @return All level windows */ - @Nullable Enumeration getAllLevelWindows() { + @Nullable List<MapViewIFrame> getAllLevelWindows() { if (mapViews != null && mapViews.size() > 0) { - return mapViews.elements(); + return Collections.unmodifiableList(mapViews); } return null; @@ -592,8 +593,7 @@ void updateFocus(final boolean fCareAboutIconification) { // Show the next level (if such exists) - for (Enumeration enu = mapViews.elements(); enu.hasMoreElements();) { - final MapViewIFrame view = (MapViewIFrame) enu.nextElement(); + for ( final MapViewIFrame view : mapViews) { if (view.isIcon()) { if (!fCareAboutIconification) { @@ -622,9 +622,9 @@ public void previousWindowWanted() { if (mapViews.size() > 1) { - final Object view = mapViews.firstElement(); - mapViews.removeElement(view); - mapViews.addElement(view); + final MapViewIFrame view = mapViews.get(0); + mapViews.remove(view); + mapViews.add(view); } updateFocus(false); } @@ -633,9 +633,9 @@ public void nextWindowWanted() { if (mapViews.size() > 1) { - final Object view = mapViews.lastElement(); - mapViews.removeElement(view); - mapViews.insertElementAt(view, 0); + final MapViewIFrame view = mapViews.get(mapViews.size() - 1); + mapViews.remove(view); + mapViews.add(0, view); } updateFocus(false); @@ -646,8 +646,8 @@ * @param view The new current level view. */ public void setCurrentLevelView(final MapViewIFrame view) { - mapViews.removeElement(view); - mapViews.insertElementAt(view, 0); + mapViews.remove(view); + mapViews.add(0, view); // Deiconify if necessary if (view.isIcon()) { @@ -669,8 +669,8 @@ public void levelViewFocusLostNotify(final MapViewIFrame view) { if (mapViews.size() > 1) { - mapViews.removeElement(view); - mapViews.addElement(view); + mapViews.remove(view); + mapViews.add(view); updateFocus(true); } } @@ -681,8 +681,8 @@ */ public void levelViewFocusGainedNotify(final MapViewIFrame view) { - mapViews.removeElement(view); - mapViews.insertElementAt(view, 0); + mapViews.remove(view); + mapViews.add(0, view); final MapControl level = view.getLevel(); mainControl.setCurrentLevel(level); //statusBar.setLevelInfo(level); @@ -691,63 +691,63 @@ /** * Invoked when the internal frame view is opened. - * @param event the occurred <code>InternalFrameEvent</code> + * @param e the occurred <code>InternalFrameEvent</code> */ - public void internalFrameOpened(final InternalFrameEvent event) { + public void internalFrameOpened(final InternalFrameEvent e) { } /** * Invoked when the internal frame view is closing. - * @param event the occurred <code>InternalFrameEvent</code> + * @param e the occurred <code>InternalFrameEvent</code> */ - public void internalFrameClosing(final InternalFrameEvent event) { + public void internalFrameClosing(final InternalFrameEvent e) { - final MapViewIFrame view = (MapViewIFrame) event.getSource(); + final MapViewIFrame view = (MapViewIFrame) e.getSource(); removeLevelView(view); } /** * Invoked when the internal frame view is closed. - * @param event the occurred <code>InternalFrameEvent</code> + * @param e the occurred <code>InternalFrameEvent</code> */ - public void internalFrameClosed(final InternalFrameEvent event) { + public void internalFrameClosed(final InternalFrameEvent e) { } /** * Invoked when the internal frame view is iconified. - * @param event the occurred <code>InternalFrameEvent</code> + * @param e the occurred <code>InternalFrameEvent</code> */ - public void internalFrameIconified(final InternalFrameEvent event) { - final MapViewIFrame view = (MapViewIFrame) event.getSource(); + public void internalFrameIconified(final InternalFrameEvent e) { + final MapViewIFrame view = (MapViewIFrame) e.getSource(); levelViewFocusLostNotify(view); } /** * Invoked when the internal frame view is deiconified. - * @param event the occurred <code>InternalFrameEvent</code> + * @param e the occurred <code>InternalFrameEvent</code> */ - public void internalFrameDeiconified(final InternalFrameEvent event) { + public void internalFrameDeiconified(final InternalFrameEvent e) { } /** * Invoked when the internal frame view is activated. - * @param event the occurred <code>InternalFrameEvent</code> + * @param e the occurred <code>InternalFrameEvent</code> */ - public void internalFrameActivated(final InternalFrameEvent event) { - final MapViewIFrame view = (MapViewIFrame) event.getSource(); + public void internalFrameActivated(final InternalFrameEvent e) { + final MapViewIFrame view = (MapViewIFrame) e.getSource(); levelViewFocusGainedNotify(view); } /** * Invoked when the internal frame view is deactivated. - * @param event the occurred <code>InternalFrameEvent</code> + * @param e the occurred <code>InternalFrameEvent</code> */ - public void internalFrameDeactivated(final InternalFrameEvent event) { + public void internalFrameDeactivated(final InternalFrameEvent e) { } /** Splitpane class that keeps its size even upon L'n'F change. */ - public final class CSplitPane extends JSplitPane { + public static final class CSplitPane extends JSplitPane { /** Serial Version UID. */ private static final long serialVersionUID = 1L; Modified: trunk/crossfire/src/cfeditor/CMapFileDecode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-08-11 22:56:44 UTC (rev 249) +++ trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-08-12 22:34:57 UTC (rev 250) @@ -32,7 +32,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import net.sf.gridarta.GridderException; +import cfeditor.GridderException; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; Modified: trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-08-11 22:56:44 UTC (rev 249) +++ trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-08-12 22:34:57 UTC (rev 250) @@ -52,7 +52,7 @@ import javax.swing.border.EmptyBorder; import javax.swing.border.EtchedBorder; import javax.swing.border.TitledBorder; -import net.sf.gridarta.GridderException; +import cfeditor.GridderException; import net.sf.gridarta.Size2D; import net.sf.gridarta.help.Help; @@ -208,16 +208,6 @@ tabPane.setBorder(BorderFactory.createEmptyBorder(0, 3, 3, 0)); final JPanel optionPanel = new JPanel(new GridLayout(1, 1)); - if (IGUIConstants.isoView) { - optionPanel.setBorder( - new CompoundBorder( - new TitledBorder(new EtchedBorder(), "Options"), - new EmptyBorder( - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS, - IGUIConstants.DIALOG_INSETS))); - } final JPanel optionPanel2 = new JPanel(); optionPanel2.setLayout(new BoxLayout(optionPanel2, BoxLayout.Y_AXIS)); final JScrollPane scrollPane2 = new JScrollPane(optionPanel2); @@ -232,30 +222,18 @@ createPanelLine(optionPanel2, m_swapTime, 10, String.valueOf(map.getSwapTime()), "Swap Time: "); createPanelLine(optionPanel2, m_resetTimeout, 10, String.valueOf(map.getResetTimeout()), "Reset Timeout: "); - if (!IGUIConstants.isoView) { - createPanelLine(optionPanel2, m_shopitems, 10, map.getShopItems(), "Shop Type: "); - createPanelLine(optionPanel2, m_shopgreed, 10, String.valueOf(map.getShopGreed()), "Shop Greed: "); - createPanelLine(optionPanel2, m_shopmax, 10, String.valueOf(map.getShopMax()), "Upper Price Limit: "); - createPanelLine(optionPanel2, m_shopmin, 10, String.valueOf(map.getShopMin()), "Lower Price Limit: "); - createPanelLine(optionPanel2, m_shoprace, 10, map.getShopRace(), "Shop Race: "); + createPanelLine(optionPanel2, m_shopitems, 10, map.getShopItems(), "Shop Type: "); + createPanelLine(optionPanel2, m_shopgreed, 10, String.valueOf(map.getShopGreed()), "Shop Greed: "); + createPanelLine(optionPanel2, m_shopmax, 10, String.valueOf(map.getShopMax()), "Upper Price Limit: "); + createPanelLine(optionPanel2, m_shopmin, 10, String.valueOf(map.getShopMin()), "Lower Price Limit: "); + createPanelLine(optionPanel2, m_shoprace, 10, map.getShopRace(), "Shop Race: "); - createPanelLine(optionPanel2, m_temp, 10, String.valueOf(map.getTemp()), "Temperature: "); - createPanelLine(optionPanel2, m_pressure, 10, String.valueOf(map.getPressure()), "Pressure: "); - createPanelLine(optionPanel2, m_humid, 10, String.valueOf(map.getHumid()), "Humidity: "); - createPanelLine(optionPanel2, m_windspeed, 10, String.valueOf(map.getWindspeed()), "Wind Speed: "); - createPanelLine(optionPanel2, m_winddir, 10, String.valueOf(map.getWinddir()), "Wind Direction: "); - createPanelLine(optionPanel2, m_sky, 10, String.valueOf(map.getSky()), "Sky Setting: "); - } else { - createPanelCBox(optionPanel2, m_no_magic, map.isNoMagic(), " No Magic"); - createPanelCBox(optionPanel2, m_no_priest, map.isNoPriest(), " No Prayers"); - createPanelCBox(optionPanel2, m_no_harm, map.isNoHarm(), " No Harmful Spells"); - createPanelCBox(optionPanel2, m_no_summon, map.isNoSummon(), " No Summoning"); - createPanelCBox(optionPanel2, m_fixed_login, map.isFixedLogin(), " Fixed Login"); - createPanelCBox(optionPanel2, m_perm_death, map.isPermDeath(), " Permanent Death"); - createPanelCBox(optionPanel2, m_ultra_death, map.isUltraDeath(), " Ultra Death"); - createPanelCBox(optionPanel2, m_ultimate_death, map.isUltimateDeath(), " Instant Death"); - createPanelCBox(optionPanel2, m_pvp, map.isPvp(), " PvP Enabled"); - } + createPanelLine(optionPanel2, m_temp, 10, String.valueOf(map.getTemp()), "Temperature: "); + createPanelLine(optionPanel2, m_pressure, 10, String.valueOf(map.getPressure()), "Pressure: "); + createPanelLine(optionPanel2, m_humid, 10, String.valueOf(map.getHumid()), "Humidity: "); + createPanelLine(optionPanel2, m_windspeed, 10, String.valueOf(map.getWindspeed()), "Wind Speed: "); + createPanelLine(optionPanel2, m_winddir, 10, String.valueOf(map.getWinddir()), "Wind Direction: "); + createPanelLine(optionPanel2, m_sky, 10, String.valueOf(map.getSky()), "Sky Setting: "); optionPanel.add(scrollPane2); @@ -270,24 +248,19 @@ c.weighty = 1.0; c.gridwidth = GridBagConstraints.REMAINDER; //end row m_loreArea = new JTextArea(); - if (IGUIConstants.isoView) { - gridbag.setConstraints(optionPanel, c); - mainPanel.add(optionPanel); - } else { - gridbag.setConstraints(tabPane, c); + gridbag.setConstraints(tabPane, c); - tabPane.addTab("Options", optionPanel); - m_loreArea.setText(m_level.getMapLore()); - m_loreArea.setCaretPosition(0); - m_loreArea.setBorder(BorderFactory.createEmptyBorder(1, 4, 0, 0)); - final JScrollPane lscrollPane = new JScrollPane(m_loreArea); - lscrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - lscrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - lscrollPane.setPreferredSize(new Dimension(20, 20)); + tabPane.addTab("Options", optionPanel); + m_loreArea.setText(m_level.getMapLore()); + m_loreArea.setCaretPosition(0); + m_loreArea.setBorder(BorderFactory.createEmptyBorder(1, 4, 0, 0)); + final JScrollPane lscrollPane = new JScrollPane(m_loreArea); + lscrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + lscrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + lscrollPane.setPreferredSize(new Dimension(20, 20)); - tabPane.addTab("Lore", lscrollPane); - mainPanel.add(tabPane); - } + tabPane.addTab("Lore", lscrollPane); + mainPanel.add(tabPane); // 3. map text panel: final JPanel mapDataPanel = new JPanel(new BorderLayout(1, 1)); @@ -477,31 +450,17 @@ t_darkness = parseProperty(m_darkness.getText(), "Darkness"); t_region = m_regionField.getText(); - if (!IGUIConstants.isoView) { - t_shopitems = m_shopitems.getText(); - t_shoprace = m_shoprace.getText(); - t_shopmax = parseProperty(m_shopmax.getText(), "Shop Maximum"); - t_shopmin = parseProperty(m_shopmin.getText(), "Shop Minimum"); - t_shopgreed = parsePropertyToDouble(m_shopgreed.getText(), "Shop Greed"); - t_temp = parseProperty(m_temp.getText(), "Temperature"); - t_pressure = parseProperty(m_pressure.getText(), "Pressure"); - t_humid = parseProperty(m_humid.getText(), "Humidity"); - t_winds = parseProperty(m_windspeed.getText(), "Wind Speed"); - t_windd = parseProperty(m_winddir.getText(), "Wind Direction"); - t_sky = parseProperty(m_sky.getText(), "Sky Setting"); - } else { - t_shopitems = ""; - t_shoprace = ""; - t_shopmax = 0; - t_shopmin = 0; - t_shopgreed = 0; - t_temp = 0; - t_pressure = 0; - t_humid = 0; - t_winds = 0; - t_windd = 0; - t_sky = 0; - } + t_shopitems = m_shopitems.getText(); + t_shoprace = m_shoprace.getText(); + t_shopmax = parseProperty(m_shopmax.getText(), "Shop Maximum"); + t_shopmin = parseProperty(m_shopmin.getText(), "Shop Minimum"); + t_shopgreed = parsePropertyToDouble(m_shopgreed.getText(), "Shop Greed"); + t_temp = parseProperty(m_temp.getText(), "Temperature"); + t_pressure = parseProperty(m_pressure.getText(), "Pressure"); + t_humid = parseProperty(m_humid.getText(), "Humidity"); + t_winds = parseProperty(m_windspeed.getText(), "Wind Speed"); + t_windd = parseProperty(m_winddir.getText(), "Wind Direction"); + t_sky = parseProperty(m_sky.getText(), "Sky Setting"); // Now do some sanity checks: if (width < 1 || height < 1) { @@ -565,19 +524,6 @@ map.setWinddir(t_windd); map.setSky(t_sky); - if (IGUIConstants.isoView) { - // these flags are for daimonin only - map.setNoMagic(m_no_magic.isSelected()); - map.setNoPriest(m_no_priest.isSelected()); - map.setNoHarm(m_no_harm.isSelected()); - map.setNoSummon(m_no_summon.isSelected()); - map.setFixedLogin(m_fixed_login.isSelected()); - map.setPermDeath(m_perm_death.isSelected()); - map.setUltraDeath(m_ultra_death.isSelected()); - map.setUltimateDeath(m_ultimate_death.isSelected()); - map.setPvp(m_pvp.isSelected()); - } - // update tilepaths for (int i = 0; i < IGUIConstants.DIRECTIONS; i++) { if ((map.getTilePath(i) == null && (m_tilePath[i].getText() == null || m_tilePath[i].getText().length() == 0)) @@ -664,6 +610,7 @@ private void restoreMapProperties() { final MapArchObject map = m_level.getMapModel().getMapArchObject(); // map arch object + m_level.getMapModel().getMapArchObject().getText(); m_textArea.setText(m_level.getMapText()); m_loreArea.setText(m_level.getMapLore()); m_nameField.setText(m_level.getMapName()); @@ -683,29 +630,17 @@ m_fixedReset.setSelected(map.isFixedReset()); m_nosmooth.setSelected(map.isNosmooth()); - if (!IGUIConstants.isoView) { - m_shopitems.setText("" + map.getShopItems()); - m_shoprace.setText("" + map.getShopRace()); - m_shopmax.setText("" + map.getShopMax()); - m_shopmin.setText("" + map.getShopMin()); - m_shopgreed.setText("" + map.getShopGreed()); - m_temp.setText("" + map.getTemp()); - m_pressure.setText("" + map.getPressure()); - m_humid.setText("" + map.getHumid()); - m_windspeed.setText("" + map.getWindspeed()); - m_winddir.setText("" + map.getWinddir()); - m_sky.setText("" + map.getSky()); - } else { - m_no_magic.setSelected(map.isNoMagic()); - m_no_priest.setSelected(map.isNoPriest()); - m_no_harm.setSelected(map.isNoHarm()); - m_no_summon.setSelected(map.isNoSummon()); - m_fixed_login.setSelected(map.isFixedLogin()); - m_perm_death.setSelected(map.isPermDeath()); - m_ultra_death.setSelected(map.isUltraDeath()); - m_ultimate_death.setSelected(map.isUltimateDeath()); - m_pvp.setSelected(map.isPvp()); - } + m_shopitems.setText("" + map.getShopItems()); + m_shoprace.setText("" + map.getShopRace()); + m_shopmax.setText("" + map.getShopMax()); + m_shopmin.setText("" + map.getShopMin()); + m_shopgreed.setText("" + map.getShopGreed()); + m_temp.setText("" + map.getTemp()); + m_pressure.setText("" + map.getPressure()); + m_humid.setText("" + map.getHumid()); + m_windspeed.setText("" + map.getWindspeed()); + m_winddir.setText("" + map.getWinddir()); + m_sky.setText("" + map.getSky()); for (int i = 0; i < 4; i++) { m_tilePath[i].setText("" + map.getTilePath(i)); @@ -727,4 +662,5 @@ JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION; } -} + +} // class CMapPropertiesDialog Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-08-11 22:56:44 UTC (rev 249) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-08-12 22:34:57 UTC (rev 250) @@ -449,10 +449,6 @@ this.setBackground(IGUIConstants.BG_COLOR); } - if (IGUIConstants.isoView && arch.isMulti() && arch.getMapMultiHead() != null) { - arch = arch.getMapMultiHead(); - } - if (arch.getNodeNr() == -1) { setIcon(mainControl.getNoarchTileIcon()); } else if (arch.getFaceFlag()) { Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-08-11 22:56:44 UTC (rev 249) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-08-12 22:34:57 UTC (rev 250) @@ -183,24 +183,15 @@ if (isPickmap()) { setBackground(IGUIConstants.BG_COLOR); } - if (IGUIConstants.isoView) { - renderer = new CIsoLevelRenderer(mapControl.getMapModel(), isPickmap()); - } else { - renderer = new CFlatLevelRenderer(mapControl.getMapModel(), isPickmap()); - } + renderer = new CFlatLevelRenderer(mapControl.getMapModel(), isPickmap()); setViewportView((JComponent) renderer); getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); refreshDataFromModel(); // set the pixel increment scrolling for clicking once on a scrollbar arrow - if (!IGUIConstants.isoView) { - getVerticalScrollBar().setUnitIncrement(32); - getHorizontalScrollBar().setUnitIncrement(32); - } else { - getVerticalScrollBar().setUnitIncrement(IGUIConstants.TILE_ISO_YLEN); - getHorizontalScrollBar().setUnitIncrement(IGUIConstants.TILE_ISO_XLEN); - } + getVerticalScrollBar().setUnitIncrement(32); + getHorizontalScrollBar().setUnitIncrement(32); if (initial != null) { getViewport().setViewPosition(initial); @@ -322,26 +313,24 @@ mapMouseRightOff.y = 0; // set scroll position accordingly to center on target - if (!IGUIConstants.isoView) { - final Rectangle scrollto = new Rectangle((dx + 1) * 32 + 16 - getViewport().getViewRect().width / 2, - (dy + 1) * 32 + 16 - getViewport().getViewRect().height / 2, - getViewport().getViewRect().width, - getViewport().getViewRect().height); - if (scrollto.x + scrollto.width > getViewport().getViewSize().width) { - scrollto.x = getViewport().getViewSize().width - scrollto.width; - } - if (scrollto.x < 0) { - scrollto.x = 0; - } - if (scrollto.y + scrollto.height > getViewport().getViewSize().height) { - scrollto.y = getViewport().getViewSize().height - scrollto.height; - } - if (scrollto.y < 0) { - scrollto.y = 0; - } - getViewport().setViewPosition(scrollto.getLocation()); - //getViewport().scrollRectToVisible(scrollto); + final Rectangle scrollto = new Rectangle((dx + 1) * 32 + 16 - getViewport().getViewRect().width / 2, + (dy + 1) * 32 + 16 - getViewport().getViewRect().height / 2, + getViewport().getViewRect().width, + getViewport().getViewRect().height); + if (scrollto.x + scrollto.width > getViewport().getViewSize().width) { + scrollto.x = getViewport().getViewSize().width - scrollto.width; } + if (scrollto.x < 0) { + scrollto.x = 0; + } + if (scrollto.y + scrollto.height > getViewport().getViewSize().height) { + scrollto.y = getViewport().getViewSize().height - scrollto.height; + } + if (scrollto.y < 0) { + scrollto.y = 0; + } + getViewport().setViewPosition(scrollto.getLocation()); + //getViewport().scrollRectToVisible(scrollto); if (!highlightOn) { highlightOn = true; @@ -376,13 +365,7 @@ log.debug("refreshDataFromModel"); // define how much drawing space we need for the map - if (IGUIConstants.isoView) { - forcedSize = new Dimension( - (isPickmap() ? 3 + 2 * IGUIConstants.TILE_ISO_YLEN : mapSize.getHeight() * IGUIConstants.TILE_ISO_YLEN) + mapSize.getWidth() * IGUIConstants.TILE_ISO_YLEN + IGUIConstants.TILE_ISO_XLEN, - ((isPickmap() ? Math.max(mapSize.getHeight() - 2, 0) : mapSize.getHeight()) * IGUIConstants.TILE_ISO_YLEN + (mapSize.getWidth() - mapSize.getHeight()) * IGUIConstants.TILE_ISO_YLEN2) + 1 + IGUIConstants.TILE_ISO_XLEN); - } else { - forcedSize = new Dimension(mapSize.getWidth() * 32 + (isPickmap() ? 0 : 64), mapSize.getHeight() * 32 + (isPickmap() ? 0 : 64)); - } + forcedSize = new Dimension(mapSize.getWidth() * 32 + (isPickmap() ? 0 : 64), mapSize.getHeight() * 32 + (isPickmap() ? 0 : 64)); ((JComponent) renderer).setPreferredSize(forcedSize); ((JComponent) renderer).setMinimumSize(forcedSize); changedFlagNotify(); @@ -531,28 +514,23 @@ */ public void paintTileArray(final Point[] tile) { if (tile != null) { - if (IGUIConstants.isoView) { - // for iso maps we still repaint the whole view :(( - repaint(); - } else { - // for rectangular maps we paint only the needed tiles - log.debug("-> redraw map:"); - if (tile.length <= 25) { - for (int i = tile.length - 1; i >= 0; i--) { - // paint the tiles - if (mapControl.getMapModel().isPointValid(tile[i].x, tile[i].y)) { - renderer.paintTile(tile[i].x, tile[i].y); - } - if (log.isDebugEnabled()) { - log.debug("redraw: (" + tile[i].x + ", " + tile[i].y + ")"); - } + // for rectangular maps we paint only the needed tiles + log.debug("-> redraw map:"); + if (tile.length <= 25) { + for (int i = tile.length - 1; i >= 0; i--) { + // paint the tiles + if (mapControl.getMapModel().isPointValid(tile[i].x, tile[i].y)) { + renderer.paintTile(tile[i].x, tile[i].y); } - if (!isPickmap()) { - repaint(); + if (log.isDebugEnabled()) { + log.debug("redraw: (" + tile[i].x + ", " + tile[i].y + ")"); } - } else { - modelChanged(); // at some point it's more efficient to draw the whole thing } + if (!isPickmap()) { + repaint(); + } + } else { + modelChanged(); // at some point it's more efficient to draw the whole thing } } } @@ -948,11 +926,7 @@ // Highlight the selected square if (x >= topx && x <= botx && y >= topy && y <= boty) { - if (!IGUIConstants.isoView) { - mainControl.getMapSelIconX().paintIcon(this, grfx, x * 32, y * 32); - } else { - // not used yet - } + mainControl.getMapSelIconX().paintIcon(this, grfx, x * 32, y * 32); } } } @@ -1071,415 +1045,6 @@ } } - public final class CIsoLevelRenderer extends JComponent implements CLevelRenderer { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - private final MapModel mapModel; - - /** 32x32 Image and Icon for temprary storing tiles before drawing */ - private Image tmpImage; - - private Graphics tmpGrfx; - - private ImageIcon tmpIcon; - - /** true if the map is a pickmap (those have different layout!) */ - private final boolean isPickmap; - - /** offset to map borders (32 for std. rect. maps, 0 for pickmaps) */ - private int bOffset; - - private final AttributeFilter af; - - private final Color[] highLightMask; - - /** Constructor */ - CIsoLevelRenderer(final MapModel model, final boolean pickmap) { - mapModel = model; - - af = new AttributeFilter(); - af.addAttribute("no_pass", "1"); - isPickmap = pickmap; - // initialize the tmp. graphic buffer - tmpImage = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB); - tmpGrfx = tmpImage.getGraphics(); - if (!pickmap) { - tmpGrfx.setColor(mainControl.getMainView().getBackground()); // background color of window - } else { - tmpGrfx.setColor(IGUIConstants.BG_COLOR); - } - tmpIcon = new ImageIcon(); - - bOffset = !pickmap ? 32 : 0; - - highLightMask = new Color[]{ - new Color(1.0f, 0.0f, 0.0f, 0.33f), - new Color(0.0f, 1.0f, 0.0f, 0.33f), - new Color(0.0f, 1.0f, 1.0f, 0.33f)}; - /*taken from java doc, scroll while dragged*/ - final MouseMotionListener doScrollRectToVisible = new MouseMotionAdapter() { - @Override public void mouseDragged(final MouseEvent e) { - final Rectangle r = new Rectangle(e.getX(), e.getY(), 1, 1); - ((JComponent) e.getSource()).scrollRectToVisible(r); - } - }; - this.addMouseMotionListener(doScrollRectToVisible); - - } - - public void modelChanged() { - // If don't have needed ressources to implement - // the iso double buffering of map views, so - // i choose not to handle a double buffer here - repaint(); - } - - public void setHighlightTile(final int x, final int y) { - PaintHighlightTile(this.getGraphics(), x, y); - } - - /** This method is called when the look and feel has changed */ - public void updateLookAndFeel() { - // update background color of window - if (!isPickmap) { - tmpGrfx.setColor(getBackground()); - } - } - - /** @return wether rendered map is a pickmap */ - public boolean isPickmap() { - return isPickmap; - } - - /** @return an image of the entire mapview */ - public Image getFullImage() { - final int storeOffset; // tmp. storage to save map offset - - final Size2D mapSize = getMapControl().getMapSize(); - final int mapWidth = mapSize.getHeight() * IGUIConstants.TILE_ISO_YLEN - + mapSize.getWidth() * IGUIConstants.TILE_ISO_YLEN + IGUIConstants.TILE_ISO_XLEN; - final int mapHeight = (mapSize.getHeight() * IGUIConstants.TILE_ISO_YLEN + (mapSize.getWidth() - - mapSize.getHeight()) * IGUIConstants.TILE_ISO_YLEN2) + 1 + IGUIConstants.TILE_ISO_XLEN; - - // first create a storing place for the image - final Image bufImage = new BufferedImage(mapWidth, mapHeight, BufferedImage.TYPE_INT_ARGB); - final Graphics bufGrfx = bufImage.getGraphics(); - bufGrfx.setColor(Color.white); - bufGrfx.setColor(Color.white); - bufGrfx.fillRect(0, 0, mapWidth, mapHeight); - - // paint the mapview into the image - storeOffset = bOffset; - bOffset = 0; - paintComponent(bufGrfx, true); - bOffset = storeOffset; - //return bufImage.getScaledInstance(16 * mapSize.getWidth(), 16 * mapSize.getHeight(), Image.SCALE_SMOOTH); - return bufImage; - } - - @Override public void paintComponent(final Graphics grfx) { - paintComponent(grfx, false); - } - - /** - * Paints this component. - * @param grfx The graphics context to paint to. - * @param isSnapshot true when this drawing is for a - * "screenshot"-image, false for normal drawing - */ - public void paintComponent(final Graphics grfx, final boolean isSnapshot) { - int xstart, ystart; - - final ArchObjectStack archlist = mainControl.getArchObjectStack(); - - if (isPickmap) { - // draw greenisch background for pickmaps - grfx.setColor(IGUIConstants.BG_COLOR); - grfx.fillRect(0, 0, getWidth(), getHeight()); - } - - // ---------- draw iso map -------------- - for (int y = 0; y < mapSize.getHeight(); y++) { - if (!isPickmap) { - xstart = (mapSize.getHeight()) * IGUIConstants.TILE_ISO_YLEN - y * IGUIConstants.TILE_ISO_XLEN2; - } else { - xstart = 3 + 2 * IGUIConstants.TILE_ISO_YLEN - y * IGUIConstants.TILE_ISO_XLEN2; - } - ystart = y * IGUIConstants.TILE_ISO_YLEN2 + (isPickmap ? 0 : IGUIConstants.TILE_ISO_YLEN); - for (int x = 0; x < mapSize.getWidth(); x++) { - if (!mapModel.containsArchObject(x, y)) { - // empty square - if (!isPickmap) { - mainControl.getUnknownTileIcon().paintIcon(this, grfx, xstart, ystart); - } - } else { - final Iterator it = mapModel.getArchObjects(x, y); - while (it.hasNext()) { - ArchObject node = (ArchObject) it.next(); - - final ArchObject tmpNode; - if (node.isMulti() && node.getMultiRefCount() == 0 && node.getMapMultiHead() != null) { - // this is a multipart tail: - tmpNode = node; // save old node - node = node.getMapMultiHead(); // go to multipart head - } else { - tmpNode = null; - } - - if (mainControl.isTileEdit(node.getEditType()) || mainControl.getTileEdit() == 0 || isPickmap) { - if (node.getNodeNr() == -1) { - mainControl.getNoarchTileIconF().paintIcon(this, grfx, xstart, ystart); - } else if (node.getFaceFlag()) { - mainControl.getNofaceTileIconF().paintIcon(this, grfx, xstart, ystart); - } else { - if (node.getFaceNr() == -1) { - mainControl.getUnknownTileIcon().paintIcon(this, grfx, xstart, ystart); - } else { - final ImageIcon img = archlist.getFace(node.getFaceNr()); - final int yoff; - if (img.getIconHeight() > IGUIConstants.TILE_ISO_YLEN) { - yoff = img.getIconHeight() - IGUIConstants.TILE_ISO_YLEN; - } else { - yoff = 0; - } - - if (node.isMulti() && node.getMultiRefCount() > 0) { - // multipart images have to be painted with correct offset - if ((tmpNode != null && tmpNode.isLowestPart()) || node.isLowestPart()) { - img.paintIcon(this, grfx, xstart - MultiPositionData.getXOffset(node.getMultiShapeID(), (tmpNode == null ? node.getMultiPartNr() : tmpNode.getMultiPartNr())), - ystart - yoff + MultiPositionData.getYOffset(node.getMultiShapeID(), (tmpNode == null ? node.getMultiPartNr() : tmpNode.getMultiPartNr()))); - } - } else { - img.paintIcon(this, grfx, xstart, ystart - yoff); - } - } - } - } - } - } - xstart += IGUIConstants.TILE_ISO_XLEN2; - ystart += IGUIConstants.TILE_ISO_YLEN2; - } - } - - if (showMapGrid) { - // draw iso grid - grfx.setColor(Color.black); - - for (int x = 0; x <= mapSize.getWidth(); x++) { - grfx.drawLine((mapSize.getHeight()) * IGUIConstants.TILE_ISO_YLEN + (x + 1) * IGUIConstants.TILE_ISO_XLEN2 - 1, - IGUIConstants.TILE_ISO_YLEN + x * IGUIConstants.TILE_ISO_YLEN2 - 1, - (mapSize.getHeight()) * IGUIConstants.TILE_ISO_YLEN - (mapSize.getHeight()) * IGUIConstants.TILE_ISO_XLEN2 - + (x + 1) * IGUIConstants.TILE_ISO_XLEN2, - (mapSize.getHeight()) * IGUIConstants.TILE_ISO_YLEN2 + IGUIConstants.TILE_ISO_YLEN - + x * IGUIConstants.TILE_ISO_YLEN2 - 1); - } - - for (int y = 0; y <= mapSize.getHeight(); y++) { - grfx.drawLine((mapSize.getHeight()) * IGUIConstants.TILE_ISO_YLEN - y * IGUIConstants.TILE_ISO_XLEN2 - + IGUIConstants.TILE_ISO_XLEN2 - 1, - y * IGUIConstants.TILE_ISO_YLEN2 + IGUIConstants.TILE_ISO_YLEN - 1, - (mapSize.getHeight()) * IGUIConstants.TILE_ISO_YLEN - y * IGUIConstants.TILE_ISO_XLEN2 - + (mapSize.getWidth() + 1) * IGUIConstants.TILE_ISO_XLEN2, - y * IGUIConstants.TILE_ISO_YLEN2 + IGUIConstants.TILE_ISO_YLEN - + (mapSize.getWidth()) * IGUIConstants.TILE_ISO_YLEN2 - 1); - } - } - if (highlightOn && mapMouseRightPos.y != -1 && mapMouseRightPos.x != -1) { - // Highlight the selected area - PaintHighlightArea(grfx); - } - - /* - if (mapMousePos.y != -1 && mapMousePos.x != -1) { - mainControl.getGridIcon().paintIcon(this, grfx, (mapHeight-1)*26+mapMousePos.x*26-mapMousePos.y*26+26, mapMousePos.x*13+mapMousePos.y*13+26); - } - */ - } - - /** - * Paints only one tile of the map. This is an incredible time-saver - * for insert/select/delete tile actions. - * <p/> - * Important: This method currently works only for standard - * (rectangular) view. Iso has overlapping tiles which makes this a lot - * more difficult. :( - * @param x map coordinates for the tile to draw - * @param y map coordinates for the tile to draw - */ - public void paintTile(final int x, final int y) { - final Graphics grfx = getGraphics(); // graphics context for drawing in the mapview - - final ArchObjectStack archlist = mainControl.getArchObjectStack(); // arch stack - - // Hey you! Yes you, behind the screen! - please - // implement this part :-) - // Hey, no time AV! :) - // - // Sorry, I looked behind my screen but there was nobody - // Tchize - } - - /** - * If the given map-square is highlighted, the highligh-icon is drawn - * on that square. - * @param x map coords of the square - * @param y map coords of the square - * @param grfx graphics context to draw in - */ - public void PaintHighlightTile(final Graphics grfx, final int x, final int y) { - // if tile is highlighted, draw the highlight icon: - if (highlightOn && mapMouseRightPos.y != -1 && mapMouseRightPos.x != -1) { - // get rect. coords of highlighted area: top(left) and bot(tomright) corner - final int topx = Math.min(mapMouseRightPos.x, mapMouseRightPos.x + mapMouseRightOff.x); - final int topy = Math.min(mapMouseRightPos.y, mapMouseRightPos.y + mapMouseRightOff.y); - final int botx = Math.max(mapMouseRightPos.x, mapMouseRightPos.x + mapMouseRightOff.x); - final int boty = Math.max(mapMouseRightPos.y, mapMouseRightPos.y + mapMouseRightOff.y); - - // Highlight the selected square - if (x >= topx && x <= botx && y >= topy && y <= boty) { - if (!IGUIConstants.isoView) { - mainControl.getMapSelIconX().paintIcon(this, grfx, x * 32 + bOffset, y * 32 + bOffset); - } else { - // not used yet - } - } - } - } - - /** - * Painting the highlited (selected) area on the map - * @param grfx graphics context of mapview - */ - public void PaintHighlightArea(final Graphics grfx) { - final int signX, signY; // sign = "direction" of the dragging offset - - if (mapMouseRightOff.x > 0) { - signX = 1; - } else if (mapMouseRightOff.x < 0) { - signX = -1; - } else { - signX = 0; - } - - if (mapMouseRightOff.y > 0) { - signY = 1; - } else if (mapMouseRightOff.y < 0) { - signY = -1; - } else { - signY = 0; - } - - // Highlight all tiles that are in the rectangle between drag-start and mouse - for (int posx = mapMouseRightPos.x; Math.abs(posx - mapMouseRightPos.x) - <= Math.abs(mapMouseRightOff.x); posx += signX) { - for (int posy = mapMouseRightPos.y; Math.abs(posy - mapMouseRightPos.y) - <= Math.abs(mapMouseRightOff.y); posy += signY)... [truncated message content] |
From: <aki...@us...> - 2006-08-11 22:56:50
|
Revision: 249 Author: akirschbaum Date: 2006-08-11 15:56:44 -0700 (Fri, 11 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=249&view=rev Log Message: ----------- Prevent crash when saving inventory objects having a msg...endmsg field. Modified Paths: -------------- trunk/crossfire/CHANGES.txt trunk/crossfire/src/cfeditor/CMapFileEncode.java Modified: trunk/crossfire/CHANGES.txt =================================================================== --- trunk/crossfire/CHANGES.txt 2006-08-05 13:32:52 UTC (rev 248) +++ trunk/crossfire/CHANGES.txt 2006-08-11 22:56:44 UTC (rev 249) @@ -1004,3 +1004,9 @@ directories. Now such directories are silently ignored. Andreas Kirschbaum + +--- 12/08/2006 --- + +Prevent crash when saving inventory objects having a msg...endmsg field. + +Andreas Kirschbaum Modified: trunk/crossfire/src/cfeditor/CMapFileEncode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-08-05 13:32:52 UTC (rev 248) +++ trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-08-11 22:56:44 UTC (rev 249) @@ -190,7 +190,7 @@ } } - if (arch.getMsgText() != null && !arch.getMsgText().trim().equals(defarch.getMsgText() == null ? "" : defarch.getMsgText().trim())) { + if (arch.getMsgText() != null && !arch.getMsgText().trim().equals((defarch == null || defarch.getMsgText() == null) ? "" : defarch.getMsgText().trim())) { String msg = ""; if (arch.getMsgText().trim().length() > 0) { msg = arch.getMsgText(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-08-05 13:33:16
|
Revision: 248 Author: christianhujer Date: 2006-08-05 06:32:52 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=248&view=rev Log Message: ----------- Added some MapModel unification. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/map/MapModel.java trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java trunk/daimonin/src/daieditor/map/MapControl.java trunk/daimonin/src/daieditor/map/MapModel.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/map/ trunk/src/app/net/sf/gridarta/map/MapModel.java Modified: trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-08-04 19:58:10 UTC (rev 247) +++ trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-08-05 13:32:52 UTC (rev 248) @@ -529,7 +529,7 @@ // if the mapsize has been modified, see if we should ask for a confirm Size2D size = new Size2D(width, height); - if (m_level.checkResizeMap(size)) { + if (!m_level.isCutoffSave(size)) { if (!askConfirmResize(size)) { // resizing has been cancelled size = m_level.getMapSize(); Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-08-04 19:58:10 UTC (rev 247) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-08-05 13:32:52 UTC (rev 248) @@ -978,15 +978,15 @@ /** * Check if objects get cut off if the map was resized to the given bounds. * @param newSize the new level size - * @return true if objects would be cut off + * @return true if objects would not be cut off, so cut off is safe, otherwise <code>false</code> */ - public boolean isCutoffUnsafe(final Size2D newSize) { + public boolean isCutoffSafe(final Size2D newSize) { if (mapSize.getWidth() > newSize.getWidth()) { // search the right stripe (as far as being cut off) for (int x = newSize.getWidth(); x < mapSize.getWidth(); x++) { for (int y = 0; y < mapSize.getHeight(); y++) { if (mapGrid[x][y] != null) { - return true; + return false; } } } @@ -997,13 +997,13 @@ for (int y = newSize.getHeight(); y < mapSize.getHeight(); y++) { for (int x = 0; x < mapSize.getWidth(); x++) { if (mapGrid[x][y] != null) { - return true; + return false; } } } } - return false; + return true; } /** Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-08-04 19:58:10 UTC (rev 247) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-08-05 13:32:52 UTC (rev 248) @@ -511,8 +511,8 @@ return mapModel.isPointValid(pos); } - public boolean checkResizeMap(final Size2D size) { - return mapModel.isCutoffUnsafe(size); + public boolean isCutoffSave(final Size2D size) { + return mapModel.isCutoffSafe(size); } /** Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-08-04 19:58:10 UTC (rev 247) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-08-05 13:32:52 UTC (rev 248) @@ -7,12 +7,13 @@ import java.util.List; import net.sf.gridarta.Size2D; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** * Interface for MapModels. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public interface MapModel { +public interface MapModel extends net.sf.gridarta.map.MapModel { /** Enable autojoin when inserting objects. */ boolean JOIN_ENABLE = true; @@ -39,14 +40,6 @@ @Nullable ArchObject getMouseRightPosObject(); - void resetLevelChangedFlag(); - - void setLevelChangedFlag(); - - boolean isLevelChanged(); - - Size2D getMapSize(); - @Deprecated boolean addArchToMap(int archnr, int xx, int yy, int intern, boolean join, boolean insertBelow); boolean addArchToMap(int archnr, Point pos, int intern, boolean join, boolean insertBelow); @@ -62,14 +55,9 @@ @Nullable ArchObject getMapArch(int id, Point pos); @Deprecated boolean isPointValid(int x, int y); - boolean isPointValid(Point pos); @Nullable ArchObject getExit(); - boolean isCutoffUnsafe(Size2D newSize); - - void resizeMap(Size2D newSize); - void moveTileUp(ArchObject prev, boolean refresh); void moveTileDown(ArchObject arch, boolean refresh); Modified: trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2006-08-04 19:58:10 UTC (rev 247) +++ trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2006-08-05 13:32:52 UTC (rev 248) @@ -431,7 +431,7 @@ } // if the mapsize has been modified, see if we should ask for a confirm - if (mapControl.checkResizeMap(mapSize)) { + if (!mapControl.isCutoffSafe(mapSize)) { if (!askConfirmResize(mapSize)) { // resizing has been cancelled mapSize = mapControl.getMapSize(); Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-08-04 19:58:10 UTC (rev 247) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-08-05 13:32:52 UTC (rev 248) @@ -338,7 +338,7 @@ return mapModel.isPointValid(pos); } - public boolean checkResizeMap(final Size2D size) { + public boolean isCutoffSafe(final Size2D size) { return mapModel.isCutoffSafe(size); } Modified: trunk/daimonin/src/daieditor/map/MapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapModel.java 2006-08-04 19:58:10 UTC (rev 247) +++ trunk/daimonin/src/daieditor/map/MapModel.java 2006-08-05 13:32:52 UTC (rev 248) @@ -18,7 +18,7 @@ * And there is no rollback. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public interface MapModel extends Iterable<MapSquare> { +public interface MapModel extends Iterable<MapSquare>, net.sf.gridarta.map.MapModel { /** {@inheritDoc} */ Iterator<MapSquare> iterator(); @@ -39,31 +39,6 @@ @Deprecated @Nullable MapSquare getMouseRightPosObject(); /** - * Reset the level changed flag to false. - * @todo this probably belongs to CMapControl instead - */ - void resetLevelChangedFlag(); - - /** - * Set the level changed flag to true. - * @todo this probably belongs to CMapControl instead - */ - void setLevelChangedFlag(); - - /** - * Return whether the level has changed since it was last saved or not. - * @return <code>true</code> if level has changed, <code>false</code> if not. - * @todo this probably belongs to CMapControl instead - */ - boolean isLevelChanged(); - - /** - * Return the map size of this level. - * @return map size of this level - */ - Size2D getMapSize(); - - /** * Checks whether an ArchObject (multi-arch) would still fit on this map. * @param archname name of arch to check * @param pos position of multitile head @@ -141,13 +116,6 @@ MapArchObject getMapArch(); /** - * Check whether the given coordinate is within map bounds. - * @param pos the coordinates to check - * @return <code>true</code> if the given coordinates are on the map, otherwise <code>false</code> (also returns <code>false</code> if <code><var>pos</var> == null</code>) - */ - boolean isPointValid(@Nullable Point pos); - - /** * Get the first exit on the MapSquare described by <var>hspot</var>. * Possible exits include teleporters, exits and pits. * @param hspot Point to get exit at @@ -157,21 +125,6 @@ @Nullable ArchObject getExit(@Nullable Point hspot); /** - * Check if no objects get cut off if the map was resized to the given bounds so cutoff is safe. - * @param newSize the new level size - * @return true if no objects would be cut off - */ - boolean isCutoffSafe(@NotNull Size2D newSize); - - /** - * Resize this map to the new size. - * If any bounds are smaller than before, the map gets cut on the right and bottom side. - * Accordingly, new space is attached to right and bottom. - * @param newSize new map size - */ - void resizeMap(@NotNull Size2D newSize); - - /** * Returns the MapControl that controls this MapModel. * @return the MapControl that controls this MapModel */ Added: trunk/src/app/net/sf/gridarta/map/MapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapModel.java (rev 0) +++ trunk/src/app/net/sf/gridarta/map/MapModel.java 2006-08-05 13:32:52 UTC (rev 248) @@ -0,0 +1,62 @@ +package net.sf.gridarta.map; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import net.sf.gridarta.Size2D; +import java.awt.Point; + +/** + * A MapModel reflects the data of a map. + * This MapModel interface covers the similarities between the current CFEditor and DaiEditor implementations. + */ +public interface MapModel { + + /** + * Return the map size of this level. + * @return map size of this level + */ + Size2D getMapSize(); + + /** + * Check if no objects get cut off if the map was resized to the given bounds so cutoff is safe. + * @param newSize the new level size + * @return true if no objects would be cut off + */ + boolean isCutoffSafe(@NotNull Size2D newSize); + + /** + * Resize this map to the new size. + * If any bounds are smaller than before, the map gets cut on the right and bottom side. + * Accordingly, new space is attached to right and bottom. + * @param newSize new map size + * @see {@link #isCutoffSafe(net.sf.gridarta.Size2D)} for checking whether map contents would get cut off. + */ + void resizeMap(@NotNull Size2D newSize); + + /** + * Check whether the given coordinate is within map bounds. + * @param pos the coordinates to check + * @return <code>true</code> if the given coordinates are on the map, otherwise <code>false</code> (also returns <code>false</code> if <code><var>pos</var> == null</code>) + */ + boolean isPointValid(@Nullable Point pos); + + /** + * Reset the level changed flag to false. + * @todo this probably belongs to CMapControl instead + */ + void resetLevelChangedFlag(); + + /** + * Set the level changed flag to true. + * @todo this probably belongs to CMapControl instead + */ + void setLevelChangedFlag(); + + /** + * Return whether the level has changed since it was last saved or not. + * @return <code>true</code> if level has changed, <code>false</code> if not. + * @todo this probably belongs to CMapControl instead + */ + boolean isLevelChanged(); + +} // interface MapModel Property changes on: trunk/src/app/net/sf/gridarta/map/MapModel.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: <chr...@us...> - 2006-08-04 19:58:20
|
Revision: 247 Author: christianhujer Date: 2006-08-04 12:58:10 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=247&view=rev Log Message: ----------- Encapsulated view field in MapViewIFrame. Modified Paths: -------------- trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/CopyBuffer.java trunk/daimonin/src/daieditor/MapViewIFrame.java trunk/daimonin/src/daieditor/ReplaceDialog.java Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-08-04 19:55:25 UTC (rev 246) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-08-04 19:58:10 UTC (rev 247) @@ -500,7 +500,7 @@ final ErrorCollector errorCollector = new DefaultErrorCollector(); validators.validateAll(map, errorCollector); for (final MapViewIFrame mapViewIFrame : map.getMapControl().getMapViewFrames()) { - mapViewIFrame.view.setErrors(errorCollector); + mapViewIFrame.getView().setErrors(errorCollector); } mainView.setErrors(errorCollector); } @@ -1575,7 +1575,7 @@ public void enterExit() { ArchObject exit = getMainView().getMapTileSelection(); if (exit == null || !CFArchTypeList.isExitType(exit)) { - exit = currentMap.getMapModel().getExit(currentMap.getMapViewFrame().view.getCursorPosition()); + exit = currentMap.getMapModel().getExit(currentMap.getMapViewFrame().getView().getCursorPosition()); } if (exit == null) { // no exit found @@ -2059,7 +2059,7 @@ showMessageDialog(mainView, "No map loaded! Please load a map!!", "Error", ERROR_MESSAGE); return; } - final CMapViewBasic view = currentMap.getMapViewFrame().view; + final CMapViewBasic view = currentMap.getMapViewFrame().getView(); view.paintOnlyMap(true); new CPreview(view.getFullImage()); view.paintOnlyMap(false); @@ -2154,7 +2154,7 @@ if (squares != null) { final ErrorCollector errorCollector = new DefaultErrorCollector(); validators.validate(squares, errorCollector); - e.getMap().getMapControl().getMapViewFrame().view.setErrors(errorCollector); + e.getMap().getMapControl().getMapViewFrame().getView().setErrors(errorCollector); mainView.setErrors(errorCollector); } } @@ -2167,7 +2167,7 @@ if (arches != null) { final ErrorCollector errorCollector = new DefaultErrorCollector(); validators.validate(arches, errorCollector); - e.getMap().getMapControl().getMapViewFrame().view.setErrors(errorCollector); + e.getMap().getMapControl().getMapViewFrame().getView().setErrors(errorCollector); mainView.setErrors(errorCollector); } } Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-08-04 19:55:25 UTC (rev 246) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-08-04 19:58:10 UTC (rev 247) @@ -285,7 +285,7 @@ if (pmap != null && pmap.getMapViewFrame().isHighlight()) { // now try to get the topmost object ArchObject arch = null; - final Point cursor = pmap.getMapViewFrame().view.getCursorPosition(); + final Point cursor = pmap.getMapViewFrame().getView().getCursorPosition(); if (pmap.isPointValid(cursor)) { arch = pmap.getMapModel().getMapSquare(cursor).getFirst(); } Modified: trunk/daimonin/src/daieditor/CopyBuffer.java =================================================================== --- trunk/daimonin/src/daieditor/CopyBuffer.java 2006-08-04 19:55:25 UTC (rev 246) +++ trunk/daimonin/src/daieditor/CopyBuffer.java 2006-08-04 19:58:10 UTC (rev 247) @@ -149,7 +149,7 @@ final Point offset = selRec.getLocation(); mapControl.getMapModel().beginTransaction(); - for (final MapSquare square : mapControl.getMapViewFrame().view.getSelectedSquares()) { + for (final MapSquare square : mapControl.getMapViewFrame().getView().getSelectedSquares()) { final int posx = square.getMapX(); final int posy = square.getMapY(); for (final ArchObject arch : square) { @@ -277,13 +277,13 @@ } // If offset is zero and map-spot empty, a floodfill at the cursor is done - if (!mapControl.getMapViewFrame().view.hasSelection() && mapControl.getMapViewFrame().view.getCursorSquare().isEmpty()) { - final Point p = mapControl.getMapViewFrame().view.getCursorPosition(); + if (!mapControl.getMapViewFrame().getView().hasSelection() && mapControl.getMapViewFrame().getView().getCursorSquare().isEmpty()) { + final Point p = mapControl.getMapViewFrame().getView().getCursorPosition(); assert p != null; floodfill(mapControl, p.x, p.y, archList); // floodfill } else { mapControl.getMapModel().beginTransaction(); - for (final Point p : mapControl.getMapViewFrame().view.getSelection()) { + for (final Point p : mapControl.getMapViewFrame().getView().getSelection()) { if (rand != -1 && rand != 100 && rand < rnd.nextInt(100) + 1) { continue; } @@ -366,7 +366,7 @@ if (mapViewIFrame == null) { mapSquares = mapControl.getAllSquares(); } else { - final List<MapSquare> selectedMapSquares = mapViewIFrame.view.getSelectedSquares(); + final List<MapSquare> selectedMapSquares = mapViewIFrame.getView().getSelectedSquares(); if (selectedMapSquares.size() == 0) { mapSquares = mapControl.getAllSquares(); } else { Modified: trunk/daimonin/src/daieditor/MapViewIFrame.java =================================================================== --- trunk/daimonin/src/daieditor/MapViewIFrame.java 2006-08-04 19:55:25 UTC (rev 246) +++ trunk/daimonin/src/daieditor/MapViewIFrame.java 2006-08-04 19:58:10 UTC (rev 247) @@ -61,7 +61,7 @@ private final CMainControl mainControl; /** The underlying mapview object. */ - public final CMapViewBasic view; + private final CMapViewBasic view; /** Number of this view. */ private final int viewNumber; @@ -171,6 +171,10 @@ return windowAction; } + public CMapViewBasic getView() { + return view; + } + /** Action class for selecting this Window. */ public final class WindowAction extends AbstractAction { Modified: trunk/daimonin/src/daieditor/ReplaceDialog.java =================================================================== --- trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-08-04 19:55:25 UTC (rev 246) +++ trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-08-04 19:58:10 UTC (rev 247) @@ -313,7 +313,7 @@ assert mapViewIFrame != null; int replaceCount = 0; final int replaceListSize = replaceList == null ? 0 : replaceList.size(); - for (MapSquare square : entireMap ? mapControl.getMapModel() : mapViewIFrame.view.getSelectedSquares()) { + for (MapSquare square : entireMap ? mapControl.getMapModel() : mapViewIFrame.getView().getSelectedSquares()) { for (ArchObject node : square) { if ((!node.isMulti() || node.getMultiRefCount() > 0) && (matchCriteria == MATCH_ARCH_NAME && node.getArchName() != null && node.getArchName().equalsIgnoreCase(matchString) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-08-04 19:56:10
|
Revision: 246 Author: christianhujer Date: 2006-08-04 12:55:25 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=246&view=rev Log Message: ----------- Some unification, especially regarding MapViewInterface. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CNewMapDialog.java trunk/crossfire/src/cfeditor/MultiPositionData.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/CMapViewBasic.java trunk/daimonin/src/daieditor/CPickmapPanel.java trunk/daimonin/src/daieditor/CopyBuffer.java trunk/daimonin/src/daieditor/MultiPositionData.java trunk/daimonin/src/daieditor/ReplaceDialog.java trunk/daimonin/src/daieditor/ScriptArchData.java trunk/daimonin/src/daieditor/map/MapControl.java Added Paths: ----------- trunk/crossfire/src/cfeditor/MapViewIFrame.java trunk/daimonin/src/daieditor/MapViewIFrame.java trunk/src/app/net/sf/gridarta/gui/MapView.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/CMapViewIFrame.java trunk/crossfire/src/cfeditor/CMapViewInterface.java trunk/daimonin/src/daieditor/CMapViewIFrame.java trunk/daimonin/src/daieditor/CMapViewInterface.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-08-04 19:55:25 UTC (rev 246) @@ -1658,7 +1658,7 @@ * @param view The new current level view. */ - void setCurrentLevelView(final CMapViewIFrame view) { + void setCurrentLevelView(final MapViewIFrame view) { mainView.setCurrentLevelView(view); } Modified: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-08-04 19:55:25 UTC (rev 246) @@ -1212,7 +1212,7 @@ menu_window.addSeparator(); int index = 1; while (windows.hasMoreElements()) { - final CMapViewIFrame view = (CMapViewIFrame) windows.nextElement(); + final MapViewIFrame view = (MapViewIFrame) windows.nextElement(); final JMenuItem menuItem; if (index < 10) { menuItem = new JMenuItem("" + index + " " + view.getTitle()); Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-08-04 19:55:25 UTC (rev 246) @@ -505,7 +505,7 @@ * Adds the level view. * @param mapView the map view to add */ - public void addLevelView(final CMapViewIFrame mapView) { + public void addLevelView(final MapViewIFrame mapView) { mapViews.add(mapView); mapView.addInternalFrameListener(this); mapDesktop.add(mapView); @@ -525,7 +525,7 @@ * Removes (closes) the level view. * @param mapView the map view to be removed (closed). */ - void removeLevelView(final CMapViewIFrame mapView) { + void removeLevelView(final MapViewIFrame mapView) { if (!mapViews.contains(mapView)) { return; } @@ -593,7 +593,7 @@ // Show the next level (if such exists) for (Enumeration enu = mapViews.elements(); enu.hasMoreElements();) { - final CMapViewIFrame view = (CMapViewIFrame) enu.nextElement(); + final MapViewIFrame view = (MapViewIFrame) enu.nextElement(); if (view.isIcon()) { if (!fCareAboutIconification) { @@ -645,7 +645,7 @@ * Sets the given level view as the current one. * @param view The new current level view. */ - public void setCurrentLevelView(final CMapViewIFrame view) { + public void setCurrentLevelView(final MapViewIFrame view) { mapViews.removeElement(view); mapViews.insertElementAt(view, 0); @@ -667,7 +667,7 @@ * @param view The level view who lost the focus. */ - public void levelViewFocusLostNotify(final CMapViewIFrame view) { + public void levelViewFocusLostNotify(final MapViewIFrame view) { if (mapViews.size() > 1) { mapViews.removeElement(view); mapViews.addElement(view); @@ -680,7 +680,7 @@ * @param view The new current level view. */ - public void levelViewFocusGainedNotify(final CMapViewIFrame view) { + public void levelViewFocusGainedNotify(final MapViewIFrame view) { mapViews.removeElement(view); mapViews.insertElementAt(view, 0); final MapControl level = view.getLevel(); @@ -702,7 +702,7 @@ */ public void internalFrameClosing(final InternalFrameEvent event) { - final CMapViewIFrame view = (CMapViewIFrame) event.getSource(); + final MapViewIFrame view = (MapViewIFrame) event.getSource(); removeLevelView(view); } @@ -719,7 +719,7 @@ * @param event the occurred <code>InternalFrameEvent</code> */ public void internalFrameIconified(final InternalFrameEvent event) { - final CMapViewIFrame view = (CMapViewIFrame) event.getSource(); + final MapViewIFrame view = (MapViewIFrame) event.getSource(); levelViewFocusLostNotify(view); } @@ -735,7 +735,7 @@ * @param event the occurred <code>InternalFrameEvent</code> */ public void internalFrameActivated(final InternalFrameEvent event) { - final CMapViewIFrame view = (CMapViewIFrame) event.getSource(); + final MapViewIFrame view = (MapViewIFrame) event.getSource(); levelViewFocusGainedNotify(view); } Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-08-04 19:55:25 UTC (rev 246) @@ -54,6 +54,7 @@ import javax.swing.JViewport; import net.sf.gridarta.Size2D; import net.sf.gridarta.Undoable; +import net.sf.gridarta.gui.MapView; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -61,7 +62,7 @@ * <code>CMapViewBasic</code> is the true mapview object. However, it is not * bound to a certain type of frame (in order to allow maps be displayed in * different types of frames). An instance of this class must only exist in - * "wrapper classes" like CMapViewIFrame which create a frame, showing the + * "wrapper classes" like MapViewIFrame which create a frame, showing the * mapview. * <p/> * Note for developers: To avoid confusion regarding terminology, please use @@ -122,7 +123,7 @@ private int drawInternDrag; // interface for the mapview frame - private final CMapViewInterface frameInterface; + private final MapView frame; /** * Constructs a level view. @@ -131,12 +132,12 @@ * @param initial the initial view position to show; null=show top left * corner */ - CMapViewBasic(final CMainControl mainControl, final MapControl mapControl, final CMapViewInterface fi, final Point initial) { + CMapViewBasic(final CMainControl mainControl, final MapControl mapControl, final MapView fi, final Point initial) { //super("Map ["+control.getMapFileName()+"]", true, true, true, true); super(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); this.mapControl = mapControl; this.mainControl = mainControl; - frameInterface = fi; + frame = fi; showMapGrid = false; highlightOn = false; @@ -399,7 +400,7 @@ /** Notifies that the level changed flag has been changed. */ void changedFlagNotify() { changed = mapControl.isLevelChanged(); - frameInterface.updateTitle(); + frame.updateTitle(); } @Deprecated void setMapAndArchPosition(final int archid, final int x, final int y) { Deleted: trunk/crossfire/src/cfeditor/CMapViewIFrame.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewIFrame.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/crossfire/src/cfeditor/CMapViewIFrame.java 2006-08-04 19:55:25 UTC (rev 246) @@ -1,232 +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 cfeditor.arch.ArchObject; -import cfeditor.map.MapControl; -import cfeditor.menu.MenuHelper; -import cfeditor.menu.MenuManager; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Point; -import java.io.IOException; -import javax.swing.JInternalFrame; -import javax.swing.JViewport; - -/** - * The <code>CMapViewIFrame</code> is mainly a wrapper class which creates a - * basic mapview (-> CMapViewBasic) and displays it in a - * <code>JInternalFrame</code>. - * <p/> - * Admittedly the implementation is not as clean as it could be, because the - * CMapViewBasic is still tied with this object to a certain degree. Full - * seperation would be nasty to do. - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - */ -public final class CMapViewIFrame extends JInternalFrame implements CMapViewInterface { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - /** The controller of this view. */ - private final MapControl mapControl; - - /** The underlying mapview object. */ - private final CMapViewBasic view; - - /** - * Constructs a level view. - * @param mainControl the main controller - * @param mapControl the controller of this view - * @param initial the view position to show initially; null=show top left - * corner - */ - public CMapViewIFrame(final CMainControl mainControl, final MapControl mapControl, final Point initial) { - // set title - super("Map [" + mapControl.getMapFileName() + "]", true, true, true, true); - this.mapControl = mapControl; - - setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - - // create instance of "real" view object and add it to the frame - view = new CMapViewBasic(mainControl, mapControl, this, initial); - getContentPane().setLayout(new BorderLayout()); - getContentPane().add(view, BorderLayout.CENTER); - //TODO fix this - /*JMenuBar mb = new JMenuBar(); - mb.add(((MenuEntry) - (MenuManager.getMenuManager().getMenuLocation("main").getMenuEntries().toArray()[0])).getMenuComponent()); - setJMenuBar(mb);*/ - setJMenuBar(MenuHelper.getLocationBar(MenuManager.getMenuManager().getMenuLocation("currentmap"))); - } - - /** - * Okay, this is a bit of a hack. True seperation of mapview and - * frame-component would really mess up the code, or maybe make it - * "cleaner" but blow things up tenfold. - * @return basic view component - */ - public CMapViewBasic getBasicView() { - return view; - } - - /** Update the Map-Window Title (according to name and changeFlag) */ - public void updateTitle() { - String strTitle = "Map [" + mapControl.getMapFileName() + "]"; - - if (view != null && view.isChanged()) { - strTitle += "*"; // * map has changed - } - - setTitle(strTitle); // display new title - } - - /** - * Returns the controller of this view. - * @return The controller of this view. - */ - public MapControl getLevel() { - return mapControl; - } - - // following a bunch of wrapper methods which just pass access - // to the basic mapview object 'view': - public Point getMapMouseRightPos() { - return view.getMapMouseRightPos(); - } - - public JViewport getViewPort() { - return view.getViewport(); - } - - @Override public Dimension getSize() { - return view.getSize(); - } - - public boolean isGridVisible() { - return view.isGridVisible(); - } - - public void updateLookAndFeel() { - view.updateLookAndFeel(); - } - - public boolean isHighlight() { - return view.isHighlight(); - } - - public void unHighlight() { - view.unHighlight(); - } - - public int getActiveEditType() { - return view.getActiveEditType(); - } - - /** - * Returns the controller of this view. - * @return the controller of this view. - */ - public MapControl getMapControl() { - return mapControl; - } - - public void setGridVisibility(final boolean fVisible) { - view.setGridVisibility(fVisible); - } - - public void appExitNotify() { - view.appExitNotify(); - } - - public void closeNotify() { - view.closeNotify(); - } - - public Point getHighlightStart() { - return view.getHighlightStart(); - } - - public Point getHighlightOffset() { - return view.getHighlightOffset(); - } - - public void setHotspot(final int dx, final int dy) { - view.setHotspot(dx, dy); - } - - public void printFullImage(final String filename) throws IOException { - view.printFullImage(filename); - } - - public void refreshDataFromModel() { - view.refreshDataFromModel(); - } - - public void modelChanged() { - view.modelChanged(); - } - - public void changedFlagNotify() { - view.changedFlagNotify(); - } - - @Deprecated void setMapAndArchPosition(final int archid, final int x, final int y) { - setMapAndArchPosition(archid, new Point(x, y)); - } - - void setMapAndArchPosition(final int archid, final Point pos) { - view.setMapAndArchPosition(archid, pos); - } - - Point[] calcArchRedraw(final ArchObject arch) { - return view.calcArchRedraw(arch); - } - - Point[] calcRectRedraw(final int ax, final int ay, final int bx, final int by) { - return view.calcRectRedraw(ax, ay, bx, by); - } - - public void paintTileArray(final Point[] tile) { - view.paintTileArray(tile); - } - - /** - * Return the current view position. - * @return the current view position - */ - public Point getViewPosition() { - return view.getViewPosition(); - } - - @Override public void dispose() { - super.dispose(); - /* workaround jvm 1.4 bug, does not free IFrame - * so let's free a maximum of ressources used by - * iframe*/ - view.freeMap(); - } - -} // class CMapViewIFrame Deleted: trunk/crossfire/src/cfeditor/CMapViewInterface.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewInterface.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/crossfire/src/cfeditor/CMapViewInterface.java 2006-08-04 19:55:25 UTC (rev 246) @@ -1,39 +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; - -/** - * A mapview consists of two classes: The CMapViewBasic instance which contains - * the real mapview, and the wrapper frame class which extends a frame - * displaying the mapview. Now the communication "frame -> basic mapview" is no - * problem, but "basic mapview -> frame" can only be realized with this - * interface. - */ -public interface CMapViewInterface { - - /** Update the title on the frame. */ - void updateTitle(); - -} // interface CMapViewInterface Modified: trunk/crossfire/src/cfeditor/CNewMapDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-08-04 19:55:25 UTC (rev 246) @@ -64,21 +64,11 @@ /** Map types. */ public static final int TYPE_PICKMAP = 1; - /** The key value used to store the last used tile width to INI file. */ - public static final String DEFAULT_TILE_WIDTH_KEY = - "NewLevelDialog.tileWidth"; - - /** The key value used to store the last used tile height to INI file. */ - public static final String DEFAULT_TILE_HEIGHT_KEY = - "NewLevelDialog.tileHeight"; - /** The key value used to store the last used level width to INI file. */ - public static final String DEFAULT_LEVEL_WIDTH_KEY = - "NewLevelDialog.mapWidth"; + private static final String DEFAULT_LEVEL_WIDTH_KEY = "NewLevelDialog.mapWidth"; /** The key value used to store the last used level height to INI file. */ - public static final String DEFAULT_LEVEL_HEIGHT_KEY = - "NewLevelDialog.mapHeight"; + private static final String DEFAULT_LEVEL_HEIGHT_KEY = "NewLevelDialog.mapHeight"; /** The controller of this new level dialog view. */ private final CMainControl mainControl; @@ -95,8 +85,6 @@ private final JTextField mapHeightField; - private final JPanel newLevelFromScratchPanel; - /** * Constructs a new level dialog. Builds the dialog UI. * @param mainControl the controller of this dialog. @@ -110,7 +98,7 @@ this.mapType = mapType; getContentPane().setLayout(new BorderLayout()); - newLevelFromScratchPanel = new JPanel(); + final JPanel newLevelFromScratchPanel = new JPanel(); newLevelFromScratchPanel.setLayout(new BoxLayout(newLevelFromScratchPanel, BoxLayout.Y_AXIS)); newLevelFromScratchPanel.setBorder(new EmptyBorder( Copied: trunk/crossfire/src/cfeditor/MapViewIFrame.java (from rev 241, trunk/crossfire/src/cfeditor/CMapViewIFrame.java) =================================================================== --- trunk/crossfire/src/cfeditor/MapViewIFrame.java (rev 0) +++ trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-08-04 19:55:25 UTC (rev 246) @@ -0,0 +1,233 @@ +/* + * 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 cfeditor.arch.ArchObject; +import cfeditor.map.MapControl; +import cfeditor.menu.MenuHelper; +import cfeditor.menu.MenuManager; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Point; +import java.io.IOException; +import javax.swing.JInternalFrame; +import javax.swing.JViewport; +import net.sf.gridarta.gui.MapView; + +/** + * The <code>MapViewIFrame</code> is mainly a wrapper class which creates a + * basic mapview (-> CMapViewBasic) and displays it in a + * <code>JInternalFrame</code>. + * <p/> + * Admittedly the implementation is not as clean as it could be, because the + * CMapViewBasic is still tied with this object to a certain degree. Full + * seperation would be nasty to do. + * @author <a href="mailto:and...@gm...">Andreas Vogl</a> + */ +public final class MapViewIFrame extends JInternalFrame implements MapView { + + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + + /** The controller of this view. */ + private final MapControl mapControl; + + /** The underlying mapview object. */ + private final CMapViewBasic view; + + /** + * Constructs a level view. + * @param mainControl the main controller + * @param mapControl the controller of this view + * @param initial the view position to show initially; null=show top left + * corner + */ + public MapViewIFrame(final CMainControl mainControl, final MapControl mapControl, final Point initial) { + // set title + super("Map [" + mapControl.getMapFileName() + "]", true, true, true, true); + this.mapControl = mapControl; + + setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + + // create instance of "real" view object and add it to the frame + view = new CMapViewBasic(mainControl, mapControl, this, initial); + getContentPane().setLayout(new BorderLayout()); + getContentPane().add(view, BorderLayout.CENTER); + //TODO fix this + /*JMenuBar mb = new JMenuBar(); + mb.add(((MenuEntry) + (MenuManager.getMenuManager().getMenuLocation("main").getMenuEntries().toArray()[0])).getMenuComponent()); + setJMenuBar(mb);*/ + setJMenuBar(MenuHelper.getLocationBar(MenuManager.getMenuManager().getMenuLocation("currentmap"))); + } + + /** + * Okay, this is a bit of a hack. True seperation of mapview and + * frame-component would really mess up the code, or maybe make it + * "cleaner" but blow things up tenfold. + * @return basic view component + */ + public CMapViewBasic getBasicView() { + return view; + } + + /** Update the Map-Window Title (according to name and changeFlag) */ + public void updateTitle() { + String strTitle = "Map [" + mapControl.getMapFileName() + "]"; + + if (view != null && view.isChanged()) { + strTitle += "*"; // * map has changed + } + + setTitle(strTitle); // display new title + } + + /** + * Returns the controller of this view. + * @return The controller of this view. + */ + public MapControl getLevel() { + return mapControl; + } + + // following a bunch of wrapper methods which just pass access + // to the basic mapview object 'view': + public Point getMapMouseRightPos() { + return view.getMapMouseRightPos(); + } + + public JViewport getViewPort() { + return view.getViewport(); + } + + @Override public Dimension getSize() { + return view.getSize(); + } + + public boolean isGridVisible() { + return view.isGridVisible(); + } + + public void updateLookAndFeel() { + view.updateLookAndFeel(); + } + + public boolean isHighlight() { + return view.isHighlight(); + } + + public void unHighlight() { + view.unHighlight(); + } + + public int getActiveEditType() { + return view.getActiveEditType(); + } + + /** + * Returns the controller of this view. + * @return the controller of this view. + */ + public MapControl getMapControl() { + return mapControl; + } + + public void setGridVisibility(final boolean fVisible) { + view.setGridVisibility(fVisible); + } + + public void appExitNotify() { + view.appExitNotify(); + } + + public void closeNotify() { + view.closeNotify(); + } + + public Point getHighlightStart() { + return view.getHighlightStart(); + } + + public Point getHighlightOffset() { + return view.getHighlightOffset(); + } + + public void setHotspot(final int dx, final int dy) { + view.setHotspot(dx, dy); + } + + public void printFullImage(final String filename) throws IOException { + view.printFullImage(filename); + } + + public void refreshDataFromModel() { + view.refreshDataFromModel(); + } + + public void modelChanged() { + view.modelChanged(); + } + + public void changedFlagNotify() { + view.changedFlagNotify(); + } + + @Deprecated void setMapAndArchPosition(final int archid, final int x, final int y) { + setMapAndArchPosition(archid, new Point(x, y)); + } + + void setMapAndArchPosition(final int archid, final Point pos) { + view.setMapAndArchPosition(archid, pos); + } + + Point[] calcArchRedraw(final ArchObject arch) { + return view.calcArchRedraw(arch); + } + + Point[] calcRectRedraw(final int ax, final int ay, final int bx, final int by) { + return view.calcRectRedraw(ax, ay, bx, by); + } + + public void paintTileArray(final Point[] tile) { + view.paintTileArray(tile); + } + + /** + * Return the current view position. + * @return the current view position + */ + public Point getViewPosition() { + return view.getViewPosition(); + } + + @Override public void dispose() { + super.dispose(); + /* workaround jvm 1.4 bug, does not free IFrame + * so let's free a maximum of ressources used by + * iframe*/ + view.freeMap(); + } + +} // class MapViewIFrame Property changes on: trunk/crossfire/src/cfeditor/MapViewIFrame.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/crossfire/src/cfeditor/MultiPositionData.java =================================================================== --- trunk/crossfire/src/cfeditor/MultiPositionData.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/crossfire/src/cfeditor/MultiPositionData.java 2006-08-04 19:55:25 UTC (rev 246) @@ -134,7 +134,7 @@ */ public static synchronized int getXOffset(final int shapeID, final int positionID) { if (instance != null) { - return instance.data[shapeID][2 + positionID * 2]; + return instance.data[shapeID][2 + (positionID << 1)]; } return 0; } @@ -150,7 +150,7 @@ */ public static synchronized int getYOffset(final int shapeID, final int positionID) { if (instance != null) { - return instance.data[shapeID][1] - IGUIConstants.TILE_ISO_YLEN - instance.data[shapeID][3 + positionID * 2]; + return instance.data[shapeID][1] - IGUIConstants.TILE_ISO_YLEN - instance.data[shapeID][3 + (positionID << 1)]; } return 0; } Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-08-04 19:55:25 UTC (rev 246) @@ -603,7 +603,7 @@ return eventList == null || eventList.size() == 0; } - /** Subclass which stores information about one scripted event. */ + /** Inner class which stores information about one scripted event. */ private final class ScriptedEvent { private String pluginName; // name of plugin ("Python" expected) Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-08-04 19:55:25 UTC (rev 246) @@ -27,7 +27,7 @@ import cfeditor.CMainControl; import cfeditor.CMainStatusbar; import cfeditor.CMapViewBasic; -import cfeditor.CMapViewIFrame; +import cfeditor.MapViewIFrame; import cfeditor.CUndoStack; import cfeditor.IGUIConstants; import cfeditor.arch.ArchObject; @@ -60,7 +60,7 @@ /** * Main view of this map. */ - private final CMapViewIFrame mapView; + private final MapViewIFrame mapView; private File mapFile; @@ -112,7 +112,7 @@ // we create model (= data) mapModel = new DefaultMapModel(mainControl, this, objects, maparch); // and create a view (= window) - mapView = new CMapViewIFrame(mainControl, this, initial); + mapView = new MapViewIFrame(mainControl, this, initial); } /** Notifies that the application is about to exit. */ @@ -595,7 +595,7 @@ return mapModel; } - public CMapViewIFrame getMapView() { + public MapViewIFrame getMapView() { return mapView; } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-08-04 19:55:25 UTC (rev 246) @@ -499,7 +499,7 @@ public void checkMap(final MapModel map) { final ErrorCollector errorCollector = new DefaultErrorCollector(); validators.validateAll(map, errorCollector); - for (final CMapViewIFrame mapViewIFrame : map.getMapControl().getMapViewFrames()) { + for (final MapViewIFrame mapViewIFrame : map.getMapControl().getMapViewFrames()) { mapViewIFrame.view.setErrors(errorCollector); } mainView.setErrors(errorCollector); @@ -931,7 +931,7 @@ * If there is only 1 view left the level will be closed. * @param mapViewIFrame View to close */ - public void closeView(final CMapViewIFrame mapViewIFrame) { + public void closeView(final MapViewIFrame mapViewIFrame) { final MapControl mapControl = mapViewIFrame.getMapControl(); if (mapControl.nViews() <= 1) { closeLevel(mapControl); @@ -1977,7 +1977,7 @@ * @param view The new current level view. */ - void setCurrentLevelView(final CMapViewIFrame view) { + void setCurrentLevelView(final MapViewIFrame view) { mainView.setCurrentLevelView(view); } Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-08-04 19:55:25 UTC (rev 246) @@ -140,7 +140,7 @@ private GSplitPane splitRightPane; /** All open level views. */ - private final List<CMapViewIFrame> mapViews = synchronizedList(new ArrayList<CMapViewIFrame>()); + private final List<MapViewIFrame> mapViews = synchronizedList(new ArrayList<MapViewIFrame>()); /** List of objects on map (right side). */ private CMapTileList mapTileList; @@ -467,7 +467,7 @@ * Adds the level view. * @param mapView the map view to add */ - public void addLevelView(final CMapViewIFrame mapView) { + public void addLevelView(final MapViewIFrame mapView) { mapViews.add(mapView); mapView.addInternalFrameListener(this); mapDesktop.add(mapView); @@ -485,7 +485,7 @@ * Removes (closes) the level view. * @param mapView the map view to be removed (closed). */ - public void removeLevelView(final CMapViewIFrame mapView) { + public void removeLevelView(final MapViewIFrame mapView) { assert mapViews.contains(mapView); mapViews.remove(mapView); @@ -513,7 +513,7 @@ void updateFocus(final boolean fCareAboutIconification) { // Show the next level (if such exists) - for (final CMapViewIFrame view : mapViews) { + for (final MapViewIFrame view : mapViews) { if (view.isIcon()) { if (!fCareAboutIconification) { @@ -553,7 +553,7 @@ /** Gives focus to the next window. */ public void previousWindowWanted() { if (mapViews.size() > 1) { - final CMapViewIFrame view = mapViews.get(0); + final MapViewIFrame view = mapViews.get(0); // XXX I might work I might not work, use AWT/Swing focus traversal mapViews.remove(view); mapViews.add(view); @@ -564,7 +564,7 @@ /** Gives focus to the previous window. */ public void nextWindowWanted() { if (mapViews.size() > 1) { - final CMapViewIFrame view = mapViews.get(mapViews.size() - 1); + final MapViewIFrame view = mapViews.get(mapViews.size() - 1); // XXX I might work I might not work, use AWT/Swing focus traversal mapViews.remove(view); mapViews.add(0, view); @@ -576,7 +576,7 @@ * Sets the given level view as the current one. * @param view The new current level view. */ - public void setCurrentLevelView(final CMapViewIFrame view) { + public void setCurrentLevelView(final MapViewIFrame view) { mapViews.remove(view); mapViews.add(0, view); @@ -604,7 +604,7 @@ * @param view The level view who lost the focus. */ - public void levelViewFocusLostNotify(final CMapViewIFrame view) { + public void levelViewFocusLostNotify(final MapViewIFrame view) { if (mapViews.size() > 1) { mapViews.remove(view); mapViews.add(view); @@ -618,7 +618,7 @@ * @param view The new current level view. */ - public void levelViewFocusGainedNotify(final CMapViewIFrame view) { + public void levelViewFocusGainedNotify(final MapViewIFrame view) { mapViews.remove(view); mapViews.add(0, view); final MapControl level = view.getMapControl(); @@ -634,7 +634,7 @@ /** {@inheritDoc} */ public void internalFrameClosing(final InternalFrameEvent event) { - mainControl.closeView((CMapViewIFrame) event.getInternalFrame()); + mainControl.closeView((MapViewIFrame) event.getInternalFrame()); } /** {@inheritDoc} */ @@ -643,7 +643,7 @@ /** {@inheritDoc} */ public void internalFrameIconified(final InternalFrameEvent event) { - final CMapViewIFrame view = (CMapViewIFrame) event.getSource(); + final MapViewIFrame view = (MapViewIFrame) event.getSource(); levelViewFocusLostNotify(view); } @@ -653,7 +653,7 @@ /** {@inheritDoc} */ public void internalFrameActivated(final InternalFrameEvent event) { - final CMapViewIFrame view = (CMapViewIFrame) event.getSource(); + final MapViewIFrame view = (MapViewIFrame) event.getSource(); levelViewFocusGainedNotify(view); } @@ -682,8 +682,8 @@ menuWindow.addSeparator(); } int index = 0; - for (final CMapViewIFrame frame : mapViews) { - final CMapViewIFrame.WindowAction windowAction = frame.getWindowAction(); + for (final MapViewIFrame frame : mapViews) { + final MapViewIFrame.WindowAction windowAction = frame.getWindowAction(); windowAction.setIndex(index++); menuWindow.add(windowAction); } Modified: trunk/daimonin/src/daieditor/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-08-04 19:55:25 UTC (rev 246) @@ -54,13 +54,14 @@ import net.sf.gridarta.gui.map.MapCursorEvent; import net.sf.gridarta.gui.map.MapCursorListener; import net.sf.gridarta.gui.map.MapGrid; +import net.sf.gridarta.gui.MapView; import org.jetbrains.annotations.Nullable; /** * <code>CMapViewBasic</code> is the true mapview object. However, it is not * bound to a certain type of frame (in order to allow maps be displayed in * different types of frames). An instance of this class must only exist in - * "wrapper classes" like CMapViewIFrame which create a frame, showing the + * "wrapper classes" like MapViewIFrame which create a frame, showing the * mapview. * <p/> * Note for developers: To avoid confusion regarding terminology, please use @@ -101,7 +102,7 @@ private boolean changed; // interface for the mapview frame - private final CMapViewInterface frameInterface; + private final MapView frame; /** The MapSquares that are known to contain errors. */ private Map<MapSquare, ValidationError> erraneousMapSquares = new HashMap<MapSquare, ValidationError>(); @@ -114,7 +115,7 @@ * @param mainControl the main controller * @param mapControl the controller of this view */ - CMapViewBasic(final CMainControl mainControl, final MapControl mapControl, final CMapViewInterface fi) { + CMapViewBasic(final CMainControl mainControl, final MapControl mapControl, final MapView fi) { super(VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED); this.mapControl = mapControl; mapModel = mapControl.getMapModel(); @@ -126,7 +127,7 @@ mapCursor.addMapCursorListener(mainControl.getMainView().getStatusBar()); } this.mainControl = mainControl; - frameInterface = fi; + frame = fi; if (isPickmap()) { setBackground(IGUIConstants.BG_COLOR); @@ -374,7 +375,7 @@ /** Notifies that the level changed flag has been changed. */ void changedFlagNotify() { changed = mapControl.isLevelChanged(); - frameInterface.updateTitle(); + frame.updateTitle(); } /** {@inheritDoc} */ Deleted: trunk/daimonin/src/daieditor/CMapViewIFrame.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewIFrame.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/daimonin/src/daieditor/CMapViewIFrame.java 2006-08-04 19:55:25 UTC (rev 246) @@ -1,209 +0,0 @@ -/* - * Daimonin 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 daieditor; - -import daieditor.map.MapControl; -import java.awt.BorderLayout; -import java.awt.Image; -import java.awt.Point; -import java.awt.event.ActionEvent; -import java.io.IOException; -import javax.swing.AbstractAction; -import static javax.swing.Action.SMALL_ICON; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JInternalFrame; -import static javax.swing.KeyStroke.getKeyStroke; - -/** - * The <code>CMapViewIFrame</code> is mainly a wrapper class which creates a - * basic mapview (-> CMapViewBasic) and displays it in a - * <code>JInternalFrame</code>. - * <p/> - * Admittedly the implementation is not as clean as it could be, because the - * CMapViewBasic is still tied with this object to a certain degree. Full - * seperation would be nasty to do. - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @fixme these are also created for Pickmaps - */ -public final class CMapViewIFrame extends JInternalFrame implements CMapViewInterface { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - /** The controller of this view. */ - private final MapControl mapControl; - - /** The controller of this view. */ - private final CMainControl mainControl; - - /** The underlying mapview object. */ - public final CMapViewBasic view; - - /** Number of this view. */ - private final int viewNumber; - - /** - * Constructs a level view. - * @param mainControl the main controller - * @param control the controller of this view - * @param number Each view of a level will get a number - */ - public CMapViewIFrame(final CMainControl mainControl, final MapControl control, final int number) { - // set title - super(control.getMapFileName() + " [ " + control.getMapArch().getMapNameWithoutMusic() + " ] ("+ number + ')', true, true, true, true); - mapControl = control; - this.mainControl = mainControl; - viewNumber = number; - - setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - - // create instance of "real" view object and add it to the frame - view = new CMapViewBasic(mainControl, control, this); - getContentPane().setLayout(new BorderLayout()); - getContentPane().add(view, BorderLayout.CENTER); - final Image img = mapControl.getIconImage(); - if (img != null) { - setFrameIcon(new ImageIcon(img)); - } - } - - /** - * Okay, this is a bit of a hack. True seperation of mapview and - * frame-component would really mess up the code, or maybe make it - * "cleaner" but blow things up tenfold. - * @return basic view component - */ - public CMapViewBasic getBasicView() { - return view; - } - - /** Update the Map-Window Title (according to name and changeFlag) */ - public void updateTitle() { - - if (view == null || mapControl == null) { - return; - } - - final StringBuilder strTitle = new StringBuilder(); - strTitle.append(mapControl.getMapFileName()).append(" [ ").append(mapControl.getMapArch().getMapNameWithoutMusic()).append(" ] ("); - strTitle.append(viewNumber).append(')'); - - if (view.isChanged()) { - strTitle.append('*'); // * map has changed - } - - setTitle(strTitle.toString()); // display new title - } - - // following a bunch of wrapper methods which just pass access - // to the basic mapview object 'view': - - public boolean isHighlight() { - return view.isHighlight(); - } - - public void unHighlight() { - view.unHighlight(); - } - - public int getActiveEditType() { - return view.getActiveEditType(); - } - - /** - * Returns the controller of this view. - * @return the controller of this view. - */ - public MapControl getMapControl() { - return mapControl; - } - - public void setHotspot(final Point pos) { - view.setHotspot(pos); - } - - public void printFullImage(final String filename) throws IOException { - view.printFullImage(filename); - } - - public void changedFlagNotify() { - view.changedFlagNotify(); - } - - /** The Action to select this Window. */ - private WindowAction windowAction = new WindowAction(); - - /** {@inheritDoc} */ - @Override public void setFrameIcon(final Icon icon) { - super.setFrameIcon(icon); - if (windowAction != null) { - // This is null during creation - windowAction.putValue(SMALL_ICON, icon); - } - } - - /** Get the Window Action. */ - public WindowAction getWindowAction() { - return windowAction; - } - - /** Action class for selecting this Window. */ - public final class WindowAction extends AbstractAction { - - /** Constructor. */ - private WindowAction() { - putValue(SHORT_DESCRIPTION, "Switches to map " + getTitle()); - } - - /** - * Set the index of this action so this Action knows what Mnemonic and Accelerator to use. - * @param index index (with 1 for first entry) - */ - public void setIndex(final int index) { - if (index <= 10) { - putValue(NAME, index + ": " + getTitle()); - putValue(MNEMONIC_KEY, getKeyStroke(Integer.toString(index % 10)).getKeyCode()); - putValue(ACCELERATOR_KEY, getKeyStroke("ctrl pressed " + index % 10)); - } else { - putValue(NAME, title); - putValue(MNEMONIC_KEY, null); - putValue(ACCELERATOR_KEY, null); - } - } - - /** {@inheritDoc} */ - public void actionPerformed(final ActionEvent event) { - mainControl.setCurrentLevelView(CMapViewIFrame.this); - } - - /** {@inheritDoc} */ - @Override public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - } // class WindowAction - -} // class CMapViewIFrame Deleted: trunk/daimonin/src/daieditor/CMapViewInterface.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewInterface.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/daimonin/src/daieditor/CMapViewInterface.java 2006-08-04 19:55:25 UTC (rev 246) @@ -1,39 +0,0 @@ -/* - * Daimonin 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 daieditor; - -/** - * A mapview consists of two classes: The CMapViewBasic instance which contains - * the real mapview, and the wrapper frame class which extends a frame - * displaying the mapview. Now the communication "frame -> basic mapview" is no - * problem, but "basic mapview -> frame" can only be realized with this - * interface. - */ -public interface CMapViewInterface { - - /** Update the title on the frame. */ - void updateTitle(); - -} // interface CMapViewInterface Modified: trunk/daimonin/src/daieditor/CPickmapPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-08-04 19:55:25 UTC (rev 246) @@ -355,7 +355,7 @@ // ------------------------ nested and inner classes ------------------------ /** listener class to keep track of the currently active pickmap */ - public final class PickmapSelectionListener implements ChangeListener { + private final class PickmapSelectionListener implements ChangeListener { private final String activePickmap; // file-name of active pickmap @@ -381,7 +381,7 @@ * This listener gets to know which of them is active and * keeps the main view informed whenever the state changes. */ - public static final class ArchNPickChangeListener implements ChangeListener { + private static final class ArchNPickChangeListener implements ChangeListener { private final CMainView mainview; // main view @@ -391,11 +391,11 @@ /** * Constructor - * @param mview the main view + * @param mainView the main view * @param pane the JTabbedPane containing both archlist and pickmaps */ - public ArchNPickChangeListener(final CMainView mview, final JTabbedPane pane) { - mainview = mview; + public ArchNPickChangeListener(final CMainView mainView, final JTabbedPane pane) { + mainview = mainView; tabpane = pane; selectedIndex = tabpane.getSelectedIndex(); } Modified: trunk/daimonin/src/daieditor/CopyBuffer.java =================================================================== --- trunk/daimonin/src/daieditor/CopyBuffer.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/daimonin/src/daieditor/CopyBuffer.java 2006-08-04 19:55:25 UTC (rev 246) @@ -361,7 +361,7 @@ if (mapControl == null) { return null; } - final CMapViewIFrame mapViewIFrame = mapControl.getMapViewFrame(); + final MapViewIFrame mapViewIFrame = mapControl.getMapViewFrame(); final Iterable<MapSquare> mapSquares; if (mapViewIFrame == null) { mapSquares = mapControl.getAllSquares(); Copied: trunk/daimonin/src/daieditor/MapViewIFrame.java (from rev 241, trunk/daimonin/src/daieditor/CMapViewIFrame.java) =================================================================== --- trunk/daimonin/src/daieditor/MapViewIFrame.java (rev 0) +++ trunk/daimonin/src/daieditor/MapViewIFrame.java 2006-08-04 19:55:25 UTC (rev 246) @@ -0,0 +1,210 @@ +/* + * Daimonin 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 daieditor; + +import daieditor.map.MapControl; +import java.awt.BorderLayout; +import java.awt.Image; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.io.IOException; +import javax.swing.AbstractAction; +import static javax.swing.Action.SMALL_ICON; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JInternalFrame; +import static javax.swing.KeyStroke.getKeyStroke; +import net.sf.gridarta.gui.MapView; + +/** + * The <code>MapViewIFrame</code> is mainly a wrapper class which creates a + * basic mapview (-> CMapViewBasic) and displays it in a + * <code>JInternalFrame</code>. + * <p/> + * Admittedly the implementation is not as clean as it could be, because the + * CMapViewBasic is still tied with this object to a certain degree. Full + * seperation would be nasty to do. + * @author <a href="mailto:and...@gm...">Andreas Vogl</a> + * @fixme these are also created for Pickmaps + */ +public final class MapViewIFrame extends JInternalFrame implements MapView { + + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + + /** The controller of this view. */ + private final MapControl mapControl; + + /** The controller of this view. */ + private final CMainControl mainControl; + + /** The underlying mapview object. */ + public final CMapViewBasic view; + + /** Number of this view. */ + private final int viewNumber; + + /** + * Constructs a level view. + * @param mainControl the main controller + * @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) { + // set title + super(mapControl.getMapFileName() + " [ " + mapControl.getMapArch().getMapNameWithoutMusic() + " ] ("+ number + ')', true, true, true, true); + this.mapControl = mapControl; + this.mainControl = mainControl; + viewNumber = number; + + setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + + // create instance of "real" view object and add it to the frame + view = new CMapViewBasic(mainControl, mapControl, this); + getContentPane().setLayout(new BorderLayout()); + getContentPane().add(view, BorderLayout.CENTER); + final Image img = this.mapControl.getIconImage(); + if (img != null) { + setFrameIcon(new ImageIcon(img)); + } + } + + /** + * Okay, this is a bit of a hack. True seperation of mapview and + * frame-component would really mess up the code, or maybe make it + * "cleaner" but blow things up tenfold. + * @return basic view component + */ + public CMapViewBasic getBasicView() { + return view; + } + + /** Update the Map-Window Title (according to name and changeFlag) */ + public void updateTitle() { + + if (view == null || mapControl == null) { + return; + } + + final StringBuilder strTitle = new StringBuilder(); + strTitle.append(mapControl.getMapFileName()).append(" [ ").append(mapControl.getMapArch().getMapNameWithoutMusic()).append(" ] ("); + strTitle.append(viewNumber).append(')'); + + if (view.isChanged()) { + strTitle.append('*'); // * map has changed + } + + setTitle(strTitle.toString()); // display new title + } + + // following a bunch of wrapper methods which just pass access + // to the basic mapview object 'view': + + public boolean isHighlight() { + return view.isHighlight(); + } + + public void unHighlight() { + view.unHighlight(); + } + + public int getActiveEditType() { + return view.getActiveEditType(); + } + + /** + * Returns the controller of this view. + * @return the controller of this view. + */ + public MapControl getMapControl() { + return mapControl; + } + + public void setHotspot(final Point pos) { + view.setHotspot(pos); + } + + public void printFullImage(final String filename) throws IOException { + view.printFullImage(filename); + } + + public void changedFlagNotify() { + view.changedFlagNotify(); + } + + /** The Action to select this Window. */ + private WindowAction windowAction = new WindowAction(); + + /** {@inheritDoc} */ + @Override public void setFrameIcon(final Icon icon) { + super.setFrameIcon(icon); + if (windowAction != null) { + // This is null during creation + windowAction.putValue(SMALL_ICON, icon); + } + } + + /** Get the Window Action. */ + public WindowAction getWindowAction() { + return windowAction; + } + + /** Action class for selecting this Window. */ + public final class WindowAction extends AbstractAction { + + /** Constructor. */ + private WindowAction() { + putValue(SHORT_DESCRIPTION, "Switches to map " + getTitle()); + } + + /** + * Set the index of this action so this Action knows what Mnemonic and Accelerator to use. + * @param index index (with 1 for first entry) + */ + public void setIndex(final int index) { + if (index <= 10) { + putValue(NAME, index + ": " + getTitle()); + putValue(MNEMONIC_KEY, getKeyStroke(Integer.toString(index % 10)).getKeyCode()); + putValue(ACCELERATOR_KEY, getKeyStroke("ctrl pressed " + index % 10)); + } else { + putValue(NAME, title); + putValue(MNEMONIC_KEY, null); + putValue(ACCELERATOR_KEY, null); + } + } + + /** {@inheritDoc} */ + public void actionPerformed(final ActionEvent event) { + mainControl.setCurrentLevelView(MapViewIFrame.this); + } + + /** {@inheritDoc} */ + @Override public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + } // class WindowAction + +} // class MapViewIFrame Property changes on: trunk/daimonin/src/daieditor/MapViewIFrame.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/MultiPositionData.java =================================================================== --- trunk/daimonin/src/daieditor/MultiPositionData.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/daimonin/src/daieditor/MultiPositionData.java 2006-08-04 19:55:25 UTC (rev 246) @@ -29,6 +29,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import org.apache.log4j.Logger; /** * The MultiPositionData class stores an array of numbers which is required @@ -37,6 +38,8 @@ */ public final class MultiPositionData { + private static final Logger log = Logger.getLogger(MultiPositionData.class); + /** number of rows and columns in the array */ public static final int X_DIM = 34; @@ -115,11 +118,13 @@ // report if there haven't been enough rows in the file if (yp < Y_DIM) { - System.err.println("In file " + IGUIConstants.ARCHDEF_FILE + ": Missing " + (Y_DIM - yp) + " entire rows of data."); + log.warn("In file " + IGUIConstants.ARCHDEF_FILE + ": Missing " + (Y_DIM - yp) + " entire rows of data."); } // confirm load process - System.err.println("Loaded multipart position data from '" + IGUIConstants.ARCHDEF_FILE + '\''); + if (log.isInfoEnabled()) { + log.info("Loaded multipart position data from '" + IGUIConstants.ARCHDEF_FILE + "'"); + } } catch (final FileNotFoundException e) { // FIXME either do something or DOCUMENT TO IGNORE ME } catch (final IOException e) { Modified: trunk/daimonin/src/daieditor/ReplaceDialog.java =================================================================== --- trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-08-04 19:03:06 UTC (rev 245) +++ trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-08-04 19:55:25 UTC (rev 246) @@ -148,7 +148,7 @@ line1.add(labelon); line1.add(Box.createVerticalStrut(3)); replaceEntireBox = new JComboBox(new String[]{ACTION_FACTORY.ge... [truncated message content] |
From: <chr...@us...> - 2006-08-04 19:03:29
|
Revision: 245 Author: christianhujer Date: 2006-08-04 12:03:06 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=245&view=rev Log Message: ----------- Moved Undoable to gridarta. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CUndoStack.java trunk/daimonin/src/daieditor/CMapViewBasic.java trunk/daimonin/src/daieditor/CUndoStack.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/Undoable.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/IUndoable.java trunk/daimonin/src/daieditor/IUndoable.java Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-08-04 18:30:20 UTC (rev 244) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-08-04 19:03:06 UTC (rev 245) @@ -53,6 +53,7 @@ import javax.swing.JScrollPane; import javax.swing.JViewport; import net.sf.gridarta.Size2D; +import net.sf.gridarta.Undoable; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -1972,7 +1973,7 @@ } } - public final class CPaintOp implements IUndoable { + public final class CPaintOp implements Undoable { final Rectangle fillRect; Modified: trunk/crossfire/src/cfeditor/CUndoStack.java =================================================================== --- trunk/crossfire/src/cfeditor/CUndoStack.java 2006-08-04 18:30:20 UTC (rev 244) +++ trunk/crossfire/src/cfeditor/CUndoStack.java 2006-08-04 19:03:06 UTC (rev 245) @@ -29,6 +29,7 @@ import java.util.List; import java.util.Map; import java.util.WeakHashMap; +import net.sf.gridarta.Undoable; /** * The undo/redo stack that is used when undoing/redoing operations. @@ -44,10 +45,10 @@ private static final Map<MapControl, CUndoStack> hashFromLevelToStack = new WeakHashMap<MapControl, CUndoStack>(); /** The undo stack. Contains all undoable operations. */ - private final List<IUndoable> undoStack = new ArrayList<IUndoable>(); + private final List<Undoable> undoStack = new ArrayList<Undoable>(); /** The redo stack. Contains all redoable operations. */ - private final List<IUndoable> redoStack = new ArrayList<IUndoable>(); + private final List<Undoable> redoStack = new ArrayList<Undoable>(); /** The maximum size of the stacks. */ private int maxStackSize = 10; @@ -99,7 +100,7 @@ * Adds a new undoable/redoable operation to the undo/redo stack. * @param undoOp the new operation to be added to the stack */ - public void add(final IUndoable undoOp) { + public void add(final Undoable undoOp) { undoStack.add(undoOp); redoStack.clear(); if (undoStack.size() > maxStackSize) { @@ -118,7 +119,7 @@ */ public boolean canUndo() { if (undoStack.size() > 0) { - final IUndoable op = undoStack.get(undoStack.size() - 1); + final Undoable op = undoStack.get(undoStack.size() - 1); return op.isUndoable(); } @@ -131,7 +132,7 @@ */ public String getUndoName() { if (canUndo()) { - final IUndoable op = undoStack.get(undoStack.size() - 1); + final Undoable op = undoStack.get(undoStack.size() - 1); return op.getName(); } @@ -141,7 +142,7 @@ /** Undoes the last operation in the undo stack. */ public void undo() { if (canUndo()) { - final IUndoable op = undoStack.get(undoStack.size() - 1); + final Undoable op = undoStack.get(undoStack.size() - 1); undoStack.remove(op); op.undo(); redoStack.add(op); @@ -159,7 +160,7 @@ */ public boolean canRedo() { if (redoStack.size() > 0) { - final IUndoable op = redoStack.get(redoStack.size() - 1); + final Undoable op = redoStack.get(redoStack.size() - 1); return op.isRedoable(); } @@ -172,7 +173,7 @@ */ public String getRedoName() { if (canRedo()) { - final IUndoable op = redoStack.get(redoStack.size() - 1); + final Undoable op = redoStack.get(redoStack.size() - 1); return op.getName(); } @@ -182,7 +183,7 @@ /** Redoes the last operation in the redo stack. */ public void redo() { if (canRedo()) { - final IUndoable op = redoStack.get(redoStack.size() - 1); + final Undoable op = redoStack.get(redoStack.size() - 1); redoStack.remove(op); op.redo(); undoStack.add(op); Deleted: trunk/crossfire/src/cfeditor/IUndoable.java =================================================================== --- trunk/crossfire/src/cfeditor/IUndoable.java 2006-08-04 18:30:20 UTC (rev 244) +++ trunk/crossfire/src/cfeditor/IUndoable.java 2006-08-04 19:03:06 UTC (rev 245) @@ -1,58 +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; - -/** - * A generic interface for undoable/redoable operations. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - */ -public interface IUndoable { - - /** - * Returns whether the operation is undoable. - * @return True if the operation is undoable, false if not. - */ - boolean isUndoable(); - - /** Undoes the operation (if that is possible). */ - void undo(); - - /** - * Returns whether the operation is redoable. - * @return True if the operation is redoable, false if not. - */ - boolean isRedoable(); - - /** Reapplies the operation (if that is possible). */ - void redo(); - - /** - * Returns the operations short (about 8 chars max) name. The name is used - * to show the operation in the menuitems and toolbar buttons tooltips. - * @return The name of the operation. - */ - String getName(); - -} // interface IUndoable Modified: trunk/daimonin/src/daieditor/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-08-04 18:30:20 UTC (rev 244) +++ trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-08-04 19:03:06 UTC (rev 245) @@ -426,7 +426,7 @@ } // This can be done later, it was unused anyway. - //public static final class CPaintOp implements IUndoable { + //public static final class CPaintOp implements Undoable { // final Rectangle fillRect; // final int[][] aOrigData; Modified: trunk/daimonin/src/daieditor/CUndoStack.java =================================================================== --- trunk/daimonin/src/daieditor/CUndoStack.java 2006-08-04 18:30:20 UTC (rev 244) +++ trunk/daimonin/src/daieditor/CUndoStack.java 2006-08-04 19:03:06 UTC (rev 245) @@ -29,6 +29,7 @@ import java.util.List; import java.util.Map; import java.util.WeakHashMap; +import net.sf.gridarta.Undoable; /** * The undo/redo stack that is used when undoing/redoing operations. @@ -44,10 +45,10 @@ private static final Map<MapControl, CUndoStack> hashFromLevelToStack = new WeakHashMap<MapControl, CUndoStack>(); /** The undo stack. Contains all undoable operations. */ - private final List<IUndoable> undoStack = new ArrayList<IUndoable>(); + private final List<Undoable> undoStack = new ArrayList<Undoable>(); /** The redo stack. Contains all redoable operations. */ - private final List<IUndoable> redoStack = new ArrayList<IUndoable>(); + private final List<Undoable> redoStack = new ArrayList<Undoable>(); /** The maximum size of the stacks. */ private int maxStackSize = 10; @@ -99,7 +100,7 @@ * Adds a new undoable/redoable operation to the undo/redo stack. * @param undoOp the new operation to be added to the stack */ - public void add(final IUndoable undoOp) { + public void add(final Undoable undoOp) { undoStack.add(undoOp); redoStack.clear(); if (undoStack.size() > maxStackSize) { @@ -118,7 +119,7 @@ */ public boolean canUndo() { if (undoStack.size() > 0) { - final IUndoable op = undoStack.get(undoStack.size() - 1); + final Undoable op = undoStack.get(undoStack.size() - 1); return op.isUndoable(); } @@ -131,7 +132,7 @@ */ public String getUndoName() { if (canUndo()) { - final IUndoable op = undoStack.get(undoStack.size() - 1); + final Undoable op = undoStack.get(undoStack.size() - 1); return op.getName(); } @@ -141,7 +142,7 @@ /** Undoes the last operation in the undo stack. */ public void undo() { if (canUndo()) { - final IUndoable op = undoStack.get(undoStack.size() - 1); + final Undoable op = undoStack.get(undoStack.size() - 1); undoStack.remove(op); op.undo(); redoStack.add(op); @@ -159,7 +160,7 @@ */ public boolean canRedo() { if (redoStack.size() > 0) { - final IUndoable op = redoStack.get(redoStack.size() - 1); + final Undoable op = redoStack.get(redoStack.size() - 1); return op.isRedoable(); } @@ -172,7 +173,7 @@ */ public String getRedoName() { if (canRedo()) { - final IUndoable op = redoStack.get(redoStack.size() - 1); + final Undoable op = redoStack.get(redoStack.size() - 1); return op.getName(); } @@ -182,7 +183,7 @@ /** Redoes the last operation in the redo stack. */ public void redo() { if (canRedo()) { - final IUndoable op = redoStack.get(redoStack.size() - 1); + final Undoable op = redoStack.get(redoStack.size() - 1); redoStack.remove(op); op.redo(); undoStack.add(op); Deleted: trunk/daimonin/src/daieditor/IUndoable.java =================================================================== --- trunk/daimonin/src/daieditor/IUndoable.java 2006-08-04 18:30:20 UTC (rev 244) +++ trunk/daimonin/src/daieditor/IUndoable.java 2006-08-04 19:03:06 UTC (rev 245) @@ -1,58 +0,0 @@ -/* - * Daimonin 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 daieditor; - -/** - * A generic interface for undoable/redoable operations. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - */ -public interface IUndoable { - - /** - * Returns whether the operation is undoable. - * @return True if the operation is undoable, false if not. - */ - boolean isUndoable(); - - /** Undoes the operation (if that is possible). */ - void undo(); - - /** - * Returns whether the operation is redoable. - * @return True if the operation is redoable, false if not. - */ - boolean isRedoable(); - - /** Reapplies the operation (if that is possible). */ - void redo(); - - /** - * Returns the operations short (about 8 chars max) name. The name is used - * to show the operation in the menuitems and toolbar buttons tooltips. - * @return The name of the operation. - */ - String getName(); - -} // interface IUndoable Copied: trunk/src/app/net/sf/gridarta/Undoable.java (from rev 241, trunk/crossfire/src/cfeditor/IUndoable.java) =================================================================== --- trunk/src/app/net/sf/gridarta/Undoable.java (rev 0) +++ trunk/src/app/net/sf/gridarta/Undoable.java 2006-08-04 19:03:06 UTC (rev 245) @@ -0,0 +1,58 @@ +/* + * 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 net.sf.gridarta; + +/** + * A generic interface for undoable/redoable operations. + * @author <a href="mailto:mic...@no...">Michael Toennies</a> + */ +public interface Undoable { + + /** + * Returns whether the operation is undoable. + * @return True if the operation is undoable, false if not. + */ + boolean isUndoable(); + + /** Undoes the operation (if that is possible). */ + void undo(); + + /** + * Returns whether the operation is redoable. + * @return True if the operation is redoable, false if not. + */ + boolean isRedoable(); + + /** Reapplies the operation (if that is possible). */ + void redo(); + + /** + * Returns the operations short (about 8 chars max) name. The name is used + * to show the operation in the menuitems and toolbar buttons tooltips. + * @return The name of the operation. + */ + String getName(); + +} // interface Undoable Property changes on: trunk/src/app/net/sf/gridarta/Undoable.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: <chr...@us...> - 2006-08-04 18:30:32
|
Revision: 244 Author: christianhujer Date: 2006-08-04 11:30:20 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=244&view=rev Log Message: ----------- Modified Paths: -------------- trunk/crossfire/src/cfeditor/ExitTypes.java Modified: trunk/crossfire/src/cfeditor/ExitTypes.java =================================================================== --- trunk/crossfire/src/cfeditor/ExitTypes.java 2006-08-02 21:46:32 UTC (rev 243) +++ trunk/crossfire/src/cfeditor/ExitTypes.java 2006-08-04 18:30:20 UTC (rev 244) @@ -9,7 +9,6 @@ /** * Contains a list of all types that are exits. * @author Andreas Kirschbaum - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public final class ExitTypes { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-08-02 21:46:47
|
Revision: 243 Author: christianhujer Date: 2006-08-02 14:46:32 -0700 (Wed, 02 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=243&view=rev Log Message: ----------- Improved MapModel and DefaultMapModel: * Moved documentation from implementation to interface. * Documented future plans, e.g. deprecated symbols planned to be removed. * Added several @Nullable and @NotNull annotations. * Removed unused positioning parameters from deleteMapArch methods. Modified Paths: -------------- trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CopyBuffer.java trunk/daimonin/src/daieditor/gui/map/MapCursorControl.java trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/MapArchObject.java trunk/daimonin/src/daieditor/map/MapControl.java trunk/daimonin/src/daieditor/map/MapModel.java Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-08-02 21:45:26 UTC (rev 242) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-08-02 21:46:32 UTC (rev 243) @@ -805,7 +805,7 @@ } public void deleteMapArch(final ArchObject arch, final int mapx, final int mapy, final boolean refreshMap) { - currentMap.deleteMapArch(arch, mapx, mapy, refreshMap); + currentMap.deleteMapArch(arch, refreshMap); } /** Modified: trunk/daimonin/src/daieditor/CopyBuffer.java =================================================================== --- trunk/daimonin/src/daieditor/CopyBuffer.java 2006-08-02 21:45:26 UTC (rev 242) +++ trunk/daimonin/src/daieditor/CopyBuffer.java 2006-08-02 21:46:32 UTC (rev 243) @@ -173,7 +173,7 @@ // above the head (we would miss to copy them otherwise). if (mode == Mode.DO_CLEAR || !arch.isMulti() || arch.getMultiRefCount() > 0 || arch.getMapMultiHead() != null && arch.getMultiRefX() >= 0 && arch.getMultiRefY() >= 0) { - mapControl.deleteMapArch(arch, posx, posy, false); + mapControl.deleteMapArch(arch, false); } } } Modified: trunk/daimonin/src/daieditor/gui/map/MapCursorControl.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapCursorControl.java 2006-08-02 21:45:26 UTC (rev 242) +++ trunk/daimonin/src/daieditor/gui/map/MapCursorControl.java 2006-08-02 21:46:32 UTC (rev 243) @@ -126,7 +126,7 @@ if (arch != null) { final Point pos = mapCursor.getLocation(); assert pos != null; - mapControl.deleteMapArch(arch, pos.x, pos.y, true); + mapControl.deleteMapArch(arch, true); } } } Modified: trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java 2006-08-02 21:45:26 UTC (rev 242) +++ trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java 2006-08-02 21:46:32 UTC (rev 243) @@ -72,7 +72,7 @@ } } if (delArch != null) { - mapControl.deleteMapArch(delArch, mapLoc.x, mapLoc.y, false); + mapControl.deleteMapArch(delArch, false); } } Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-08-02 21:45:26 UTC (rev 242) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-08-02 21:46:32 UTC (rev 243) @@ -41,6 +41,7 @@ import net.sf.japi.swing.ActionFactory; import static net.sf.japi.swing.ActionFactory.getFactory; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** * The level model that represents a level. @@ -67,7 +68,10 @@ /** The registered event listeners. */ private EventListenerList listenerList = new EventListenerList(); - /** The Map Arch Object with the meta information about the map. */ + /** + * The MapArchObject with the meta information about the map. + * The model knows the MapArchObject because one of them has to know the other for updating the size in case a map is resized. + */ private final MapArchObject mapArch; /** @@ -82,11 +86,17 @@ /** Flag that indicates if the level has been changed since last save. */ private boolean levelChanged = false; - /** CMainControl. */ - private final CMainControl mainControl; + /** + * The CMainControl used for various operations. + * @deprecated it's not a good idea to require the MapModel implementation to know such a heavy-weight strongly UI-related glue class like {@link CMainControl}. + */ + @Deprecated private final CMainControl mainControl; - /** The MapControl that controls this MapModel. */ - private final MapControl mapControl; + /** + * The MapControl that controls this MapModel. + * @deprecated it's not a good idea to require the MapModel implementation to know such a heavy-weight strongly UI-related glue class like {@link CMapControl}. + */ + @Deprecated private final MapControl mapControl; /** The transaction depth. */ private int transactionDepth; @@ -112,9 +122,17 @@ /** Iterator for iterating over all squares of a model. */ private class MapSquareIterator implements Iterator<MapSquare> { - /** Index of current map square. */ + /** + * Index of current map square. + * The point is used as single value index to a two dimensional array. + * That works fine because the two dimensional array is a rectangular array. + */ private int point; + private MapSquareIterator() { + assert isRectangular(); + } + /** {@inheritDoc} */ public void remove() { throw new UnsupportedOperationException(); @@ -138,27 +156,41 @@ } // class MapSquareIterator + /** + * This method checks whether the map is rectangular. + * A map always MUST be rectangular, this method can be used for assertions regarding this assumption. + * The check for rectangularity is a check whether the array dimensions of {@link #mapGrid} match the size specified in {@link #mapSize}. + * @return <code>true</code> if the map is rectangular, otherwise <code>false</code>. + */ + private boolean isRectangular() { + final int width = mapSize.getWidth(); + final int height = mapSize.getHeight(); + if (mapGrid.length != height) { + return false; + } + for (int y = 0; y < height; y++) { + if (mapGrid[y].length != width) { + return false; + } + } + return true; + } + /** {@inheritDoc} */ public Iterator<MapSquare> iterator() { return new MapSquareIterator(); } - /** - * Get the map square at a given point. - * @param p Point to get map square at - * @return Map Square at <var>p</var> - * @throws ArrayIndexOutOfBoundsException in case the coordinates are outside the map - */ + /** {@inheritDoc} */ public MapSquare getMapSquare(final Point p) throws ArrayIndexOutOfBoundsException { return mapGrid[p.x][p.y]; } /** - * Get the currently selected map square. - * XXX: This method should be moved to the view. - * @return currently selected map square + * {@inheritDoc} + * @todo This method should be moved to the view. */ - @Nullable public MapSquare getMouseRightPosObject() { + @Deprecated @Nullable public MapSquare getMouseRightPosObject() { final Point p = mapControl.getMapCursor().getLocation(); return p == null ? null : mapGrid[p.x][p.y]; } @@ -180,7 +212,7 @@ } /** - * Reset the level changed flag to false. + * {@inheritDoc} * @todo it's not a good idea to use the mapViewFrame here */ public void resetLevelChangedFlag() { @@ -196,7 +228,7 @@ } /** - * Set the level changed flag to true. + * {@inheritDoc} * @todo it's not a good idea to use the mapViewFrame here */ public void setLevelChangedFlag() { @@ -217,19 +249,10 @@ } } - /** - * Return whether the level has changed since it was last saved or not. - * @return <code>true</code> if level has changed, <code>false</code> if - * not. - */ public boolean isLevelChanged() { return levelChanged; } - /** - * Return the map size of this level. - * @return map size of this level - */ public Size2D getMapSize() { return mapSize; } @@ -378,15 +401,7 @@ } } - /** - * Link an existing arch to the map. Including multi tile arches. This - * function allows to insert any given arch (can be non-default). Make sure - * that the given 'arch' is a new and unlinked object. - * @param arch the new arch to be linked onto the map. (Dest. - * coordinates must be set (arch.mapx/y)!) - * @param insertBelow true: new arch is inserted on top, false: new arch - * is inserted below - */ + /** {@inheritDoc} */ public void addArchObjectToMap(final ArchObject arch, final boolean insertBelow) { // Make sure this arch has the proper edit_type if (arch.getEditType() == IGUIConstants.TILE_EDIT_NONE) { @@ -422,20 +437,8 @@ setLevelChangedFlag(); // the map has been modified } - /** - * Delete an existing arch from the map. (If the specified arch doesn't - * exist, nothing happens.) (This includes deletion of multiparts and - * inventory.) - * <p/> - * XXX This method looks extremely strange. We have xx and yy and the arch, - * yet we look whether the arch is on the current square! Probably this - * method is not just bogus but also not neccessary. - * @param arch Arch to be removed - * @param pos location of the arch to be removed - * @param refreshMap If true, mapview is redrawn after deletion. Keep in - * mind: drawing consumes time! - */ - public void deleteMapArch(final ArchObject arch, final Point pos, final boolean refreshMap) { + /** {@inheritDoc} */ + public void deleteMapArch(final ArchObject arch, final boolean refreshMap) { // Okay, it's in an inventory then arch.remove(); setLevelChangedFlag(); // the map has been modified @@ -444,7 +447,10 @@ } } - /** Clear this map. */ + /** {@inheritDoc} + * This implementation is very safe by recreating every single MapSquare as new empty square with the trade-off of some strain of the garbage-collector. + * An alternative implemenation would manually clean every existing MapSquare but that probably wouldn't really be faster until we have reusage of ArchObject instances similar to J2EE. + */ public void clearMap() { for (int x = 0; x < mapSize.getWidth(); x++) { for (int y = 0; y < mapSize.getHeight(); y++) { @@ -453,30 +459,17 @@ } } - /** - * Returns the Map Arch Object with the meta information about the map. - * @return the Map Arch Object with the meta information about the map. - */ + /** {@inheritDoc} */ public MapArchObject getMapArch() { return mapArch; } - /** - * Check whether the given coordinate is within map bounds. - * @param pos the coordinates to check - * @return true=the given coordinates are within map bounds - */ + /** {@inheritDoc} */ public boolean isPointValid(@Nullable final Point pos) { return pos != null && pos.x >= 0 && pos.y >= 0 && pos.x < mapSize.getWidth() && pos.y < mapSize.getHeight(); } - /** - * Searching for a valid exit at the highlighted map-spot. (This can be a - * teleporter, exit, pit etc.) selected Arch - this method should NOT - * retrieve that data itself. - * @param hspot Point to get exit at - * @return ArchObject exit-arch if existent, otherwise null - */ + /** {@inheritDoc} */ @Nullable public ArchObject getExit(@Nullable final Point hspot) { if (hspot == null) { return null; // out of map @@ -490,17 +483,17 @@ } /** - * Check if objects get cut off if the map was resized to the given bounds. + * Check if no objects get cut off if the map was resized to the given bounds so cutoff is safe. * @param newSize the new level size - * @return true if objects would be cut off + * @return true if no objects would be cut off */ - public boolean isCutoffUnsafe(final Size2D newSize) { + public boolean isCutoffSafe(@NotNull final Size2D newSize) { if (mapSize.getWidth() > newSize.getWidth()) { // search the right stripe (as far as being cut off) for (int x = newSize.getWidth(); x < mapSize.getWidth(); x++) { for (int y = 0; y < mapSize.getHeight(); y++) { if (!mapGrid[x][y].isEmpty()) { - return true; + return false; } } } @@ -511,22 +504,17 @@ for (int y = newSize.getHeight(); y < mapSize.getHeight(); y++) { for (int x = 0; x < mapSize.getWidth(); x++) { if (!mapGrid[x][y].isEmpty()) { - return true; + return false; } } } } - return false; + return true; } - /** - * Resize this map to the new size. If any bounds are smaller than before, - * the map gets cut on the right and bottom side. Accordingly, new space is - * attached to right and bottom. - * @param newSize new map size - */ - public void resizeMap(final Size2D newSize) { + /** {@inheritDoc} */ + public void resizeMap(@NotNull final Size2D newSize) { if (newSize.equals(mapSize)) { return; } @@ -540,8 +528,8 @@ for (int x = newSize.getWidth(); x < mapSize.getWidth(); x++) { for (int y = 0; y < mapSize.getHeight(); y++) { // for every map square: delete all arches on it - for (ArchObject node : mapGrid[x][y]) { - deleteMapArch(node, new Point(x, y), false); // delete previous one + for (final ArchObject node : mapGrid[x][y]) { + deleteMapArch(node, false); // delete previous one } } } @@ -554,8 +542,8 @@ for (int y = newSize.getHeight(); y < mapSize.getHeight(); y++) { for (int x = 0; x < mapSize.getWidth(); x++) { // for every map square: delete all arches on it - for (ArchObject node : mapGrid[x][y]) { - deleteMapArch(node, new Point(x, y), false); // delete previous one + for (final ArchObject node : mapGrid[x][y]) { + deleteMapArch(node, false); // delete previous one } } } Modified: trunk/daimonin/src/daieditor/map/MapArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapArchObject.java 2006-08-02 21:45:26 UTC (rev 242) +++ trunk/daimonin/src/daieditor/map/MapArchObject.java 2006-08-02 21:46:32 UTC (rev 243) @@ -29,6 +29,8 @@ import java.io.BufferedWriter; import java.io.IOException; import net.sf.gridarta.Size2D; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * MapArchObject contains the specific meta data about a map that is stored in @@ -56,7 +58,7 @@ * Map size. * @fixme this is redundant with {@link DefaultMapModel}. */ - private Size2D mapSize = new Size2D(1, 1); + @NotNull private Size2D mapSize = new Size2D(1, 1); /** Default enter coordinates (usage not recommended). */ private int enterX, enterY; @@ -186,11 +188,7 @@ * Set map size. * @param mapSize new map size */ - public void setMapSize(final Size2D mapSize) { - if (mapSize == null) { - throw new IllegalArgumentException("No map size set"); - } - + public void setMapSize(@NotNull final Size2D mapSize) { this.mapSize = mapSize; } @@ -203,7 +201,7 @@ mapSize = new Size2D(Math.max(mapSize.getWidth(), width), Math.max(mapSize.getHeight(), height)); } - public Size2D getMapSize() { + @NotNull public Size2D getMapSize() { return mapSize; } @@ -315,7 +313,7 @@ return tilePaths[n]; } - public void setTilePath(final int n, final String tilePath) { + public void setTilePath(final int n, @Nullable final String tilePath) { tilePaths[n] = tilePath; } @@ -403,7 +401,7 @@ * Append 'text' to the map text. * @param text string to add */ - public void addText(final String text) { + public void addText(@NotNull final String text) { msgText.append(text); } @@ -413,7 +411,7 @@ } /** @return the maptext */ - public String getText() { + public @NotNull String getText() { return msgText.toString(); } @@ -426,7 +424,7 @@ * @return true if reading the MapArchObject succeeded with sane results, * otherwise false */ - public boolean parseMapArch(final BufferedReader reader, final String fname) { + public boolean parseMapArch(@NotNull final BufferedReader reader, @NotNull final String fname) { filename = fname; // store file name boolean archflag = false; // flag for arch<->end int width = 0; @@ -571,7 +569,7 @@ * @param s the attribute line to be parsed * @return attribute value, zero if value not readable */ - private static int getLineValue(final String s) { + private static int getLineValue(@NotNull final String s) { try { if (s.lastIndexOf(" ") > 0) { return Integer.valueOf(s.substring(s.lastIndexOf(" ") + 1)); @@ -587,7 +585,7 @@ * @param stream <code>BufferedWriter</code> to the mapfile * @throws IOException an I/O error occured during writing to the file */ - public void writeMapArch(final BufferedWriter stream) throws IOException { + public void writeMapArch(@NotNull final BufferedWriter stream) throws IOException { stream.append("arch map\n"); if (name.length() > 0) { Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-08-02 21:45:26 UTC (rev 242) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-08-02 21:46:32 UTC (rev 243) @@ -233,8 +233,8 @@ mapModel.addArchObjectToMap(arch, false); } - public void deleteMapArch(final ArchObject arch, final int mapx, final int mapy, final boolean refreshMap) { - mapModel.deleteMapArch(arch, new Point(mapx, mapy), refreshMap); + public void deleteMapArch(final ArchObject arch, final boolean refreshMap) { + mapModel.deleteMapArch(arch, refreshMap); } /** @@ -339,7 +339,7 @@ } public boolean checkResizeMap(final Size2D size) { - return mapModel.isCutoffUnsafe(size); + return mapModel.isCutoffSafe(size); } public String getMapFileName() { Modified: trunk/daimonin/src/daieditor/map/MapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapModel.java 2006-08-02 21:45:26 UTC (rev 242) +++ trunk/daimonin/src/daieditor/map/MapModel.java 2006-08-02 21:46:32 UTC (rev 243) @@ -5,9 +5,17 @@ import java.util.Iterator; import net.sf.gridarta.Size2D; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** * Interface for MapModels. + * <h2>Transaction System</h2> + * The purpose of the transaction system in MapModel is to allow several subsequent changes to the model to be collected as a single big change before the registered listeners (usually the user interface) gets notified. + * This prevents the user interface from performing hundrets of updates when a single one would be enough. + * <p /> + * It is not the purpose of the transaction system to provide real transactions (ACID). + * Queries to the MapModel during an ongoing transaction will reflect the intermediate state. + * And there is no rollback. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public interface MapModel extends Iterable<MapSquare> { @@ -23,15 +31,36 @@ */ MapSquare getMapSquare(Point p) throws ArrayIndexOutOfBoundsException; - // TODO Remove this method - @Nullable MapSquare getMouseRightPosObject(); + /** + * Get the currently selected map square. + * @return currently selected map square + * @deprecated this method requires MapModel implementations to know their views + */ + @Deprecated @Nullable MapSquare getMouseRightPosObject(); + /** + * Reset the level changed flag to false. + * @todo this probably belongs to CMapControl instead + */ void resetLevelChangedFlag(); + /** + * Set the level changed flag to true. + * @todo this probably belongs to CMapControl instead + */ void setLevelChangedFlag(); + /** + * Return whether the level has changed since it was last saved or not. + * @return <code>true</code> if level has changed, <code>false</code> if not. + * @todo this probably belongs to CMapControl instead + */ boolean isLevelChanged(); + /** + * Return the map size of this level. + * @return map size of this level + */ Size2D getMapSize(); /** @@ -79,21 +108,68 @@ */ boolean insertArchToMap(ArchObject newarch, String archname, ArchObject next, Point pos); + /** + * Link an existing arch to the map. Including multi tile arches. This + * function allows to insert any given arch (can be non-default). Make sure + * that the given 'arch' is a new and unlinked object. + * @param arch the new arch to be linked onto the map. (Dest. + * coordinates must be set (arch.mapx/y)!) + * @param insertBelow true: new arch is inserted on top, false: new arch + * is inserted below + */ void addArchObjectToMap(ArchObject arch, boolean insertBelow); - void deleteMapArch(ArchObject arch, Point pos, boolean refreshMap); + /** + * Delete an existing arch from the map. (If the specified arch doesn't + * exist, nothing happens.) (This includes deletion of multiparts and + * inventory.) + * @param arch Arch to be removed + * @param refreshMap If true, mapview is redrawn after deletion. + * @todo eventually remove this method as arch has its own remove() method and refreshMap is controlled via the transaction system. + */ + void deleteMapArch(ArchObject arch, boolean refreshMap); + /** + * Clear this map. + */ void clearMap(); + /** + * Returns the Map Arch Object with the meta information about the map. + * @return the Map Arch Object with the meta information about the map + */ MapArchObject getMapArch(); + /** + * Check whether the given coordinate is within map bounds. + * @param pos the coordinates to check + * @return <code>true</code> if the given coordinates are on the map, otherwise <code>false</code> (also returns <code>false</code> if <code><var>pos</var> == null</code>) + */ boolean isPointValid(@Nullable Point pos); + /** + * Get the first exit on the MapSquare described by <var>hspot</var>. + * Possible exits include teleporters, exits and pits. + * @param hspot Point to get exit at + * @return first exit found or <code>null</code> if no exit was found + * @todo move this method somewhere else because the model should not know about arch types + */ @Nullable ArchObject getExit(@Nullable Point hspot); - boolean isCutoffUnsafe(Size2D newSize); + /** + * Check if no objects get cut off if the map was resized to the given bounds so cutoff is safe. + * @param newSize the new level size + * @return true if no objects would be cut off + */ + boolean isCutoffSafe(@NotNull Size2D newSize); - void resizeMap(Size2D newSize); + /** + * Resize this map to the new size. + * If any bounds are smaller than before, the map gets cut on the right and bottom side. + * Accordingly, new space is attached to right and bottom. + * @param newSize new map size + */ + void resizeMap(@NotNull Size2D newSize); /** * Returns the MapControl that controls this MapModel. @@ -105,13 +181,13 @@ * Register a map listener. * @param listener MapListener to register */ - void addMapModelListener(MapModelListener listener); + void addMapModelListener(@NotNull MapModelListener listener); /** * Unregister a map listener. * @param listener MapListener to unregsiter */ - void removeMapModelListener(MapModelListener listener); + void removeMapModelListener(@NotNull MapModelListener listener); /** * Method to notify the model that a map square was changed. @@ -119,7 +195,7 @@ * The model then notifies the registered listeners of the changes. * @param square MapSquare that has changed */ - void squareChanged(MapSquare square); + void squareChanged(@NotNull MapSquare square); /** * Start a new transaction. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-08-02 21:45:31
|
Revision: 242 Author: christianhujer Date: 2006-08-02 14:45:26 -0700 (Wed, 02 Aug 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=242&view=rev Log Message: ----------- Added log4j to DaimoninEditor.jar. Modified Paths: -------------- trunk/daimonin/build.xml Modified: trunk/daimonin/build.xml =================================================================== --- trunk/daimonin/build.xml 2006-07-31 20:35:54 UTC (rev 241) +++ trunk/daimonin/build.xml 2006-08-02 21:45:26 UTC (rev 242) @@ -131,6 +131,7 @@ <include name="arch/dev/editor/conf/ArchObjectMatchers.dtd" /> <include name="arch/dev/editor/conf/ArchObjectMatchers.xml" /> </fileset> + <zipfileset src="../lib/log4j-1.2.13.jar" /> <zipfileset src="../lib/japi.jar"> <include name="net/sf/japi/swing/ActionFactory.class" /> <include name="net/sf/japi/swing/action*.properties" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-07-31 20:36:06
|
Revision: 241 Author: christianhujer Date: 2006-07-31 13:35:54 -0700 (Mon, 31 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=241&view=rev Log Message: ----------- Replaced bogus @Nullable with correct @NotNull. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java Modified: trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java 2006-07-31 20:07:17 UTC (rev 240) +++ trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java 2006-07-31 20:35:54 UTC (rev 241) @@ -29,6 +29,7 @@ import javax.swing.JPopupMenu; import javax.swing.text.BadLocationException; import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -360,7 +361,7 @@ * @param evt the event * @return the JEditTextArea found as the source of <var>evt</var> */ - @Nullable private static JEditTextArea getTextArea(final EventObject evt) { + @NotNull private static JEditTextArea getTextArea(final EventObject evt) { if (evt != null) { final Object o = evt.getSource(); if (o instanceof Component) { Modified: trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java 2006-07-31 20:07:17 UTC (rev 240) +++ trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java 2006-07-31 20:35:54 UTC (rev 241) @@ -29,6 +29,7 @@ import javax.swing.JPopupMenu; import javax.swing.text.BadLocationException; import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -360,7 +361,7 @@ * @param evt the event * @return the JEditTextArea found as the source of <var>evt</var> */ - @Nullable private static JEditTextArea getTextArea(final EventObject evt) { + @NotNull private static JEditTextArea getTextArea(final EventObject evt) { if (evt != null) { final Object o = evt.getSource(); if (o instanceof Component) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-07-31 20:07:33
|
Revision: 240 Author: christianhujer Date: 2006-07-31 13:07:17 -0700 (Mon, 31 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=240&view=rev Log Message: ----------- Fixed some code style violations. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java Modified: trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java 2006-07-31 18:41:56 UTC (rev 239) +++ trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java 2006-07-31 20:07:17 UTC (rev 240) @@ -186,17 +186,19 @@ /** * Returns a named text area action. * @param name the action name + * @return action stored for <var>name</var> or <code>null</code> if no such action was found */ - public static ActionListener getAction(final String name) { + @Nullable public static ActionListener getAction(final String name) { return actions.get(name); } /** * Returns the name of the specified text area action. * @param listener the action name + * @return name for the supplied <var>listener</var> or <code>null</code> if no name was found */ @Nullable public static String getActionName(final ActionListener listener) { - for (String name : actions.keySet()) { + for (final String name : actions.keySet()) { if (actions.get(name) == listener) { return name; } @@ -204,10 +206,6 @@ return null; } - public static CFPythonPopup getPopup() { - return cfPythonPopup; - } - /** * Adds the default key bindings to this input handler. This should not be * called in the constructor of this input handler, because applications @@ -242,18 +240,20 @@ } /** - * Returns if repeating is enabled. When repeating is enabled, actions will - * be executed multiple times. This is usually invoked with a special key - * stroke in the input handler. + * Returns if repetition is enabled. + * When repetition is enabled, actions will be executed multiple times. + * This is usually invoked with a special key stroke in the input handler. + * @return <code>true</code> if repeating is enabled, otherwise <code>false</code> */ public final boolean isRepeatEnabled() { return repeat; } /** - * Enables repeating. When repeating is enabled, actions will be executed - * multiple times. Once repeating is enabled, the input handler should read - * a number from the keyboard. + * Sets the enabled state of repetition. + * When repetition is enabled, actions will be executed multiple times. + * Once repeating is enabled, the input handler should read a number from the keyboard. + * @param repeat <code>true</code> for enabling repetition, <code>false</code> for disabling it */ public final void setRepeatEnabled(final boolean repeat) { this.repeat = repeat; @@ -261,6 +261,7 @@ /** * Returns the number of times the next action will be repeated. + * @return number of times the next action will be repeated (1 or the set repeat count) */ public final int getRepeatCount() { return repeat ? Math.max(1, repeatCount) : 1; @@ -275,10 +276,11 @@ } /** - * Returns the macro recorder. If this is non-null, all executed actions - * should be forwarded to the recorder. + * Returns the macro recorder. + * If this is non-null, all executed actions should be forwarded to the recorder. + * @return the macro recorder */ - public final InputHandler.MacroRecorder getMacroRecorder() { + @Nullable public final InputHandler.MacroRecorder getMacroRecorder() { return recorder; } @@ -287,13 +289,14 @@ * should be forwarded to the recorder. * @param recorder the macro recorder */ - public final void setMacroRecorder(final InputHandler.MacroRecorder recorder) { + public final void setMacroRecorder(@Nullable final InputHandler.MacroRecorder recorder) { this.recorder = recorder; } /** * Returns a copy of this input handler that shares the same key bindings. * Setting key bindings in the copy will also set them in the original. + * @return copy of this InputHandler */ public abstract InputHandler copy(); @@ -333,9 +336,11 @@ if (recorder != null) { if (!(listener instanceof InputHandler.NonRecordable)) { if (repeatCountBak != 1) { + //noinspection ConstantConditions recorder.actionPerformed(REPEAT, String.valueOf(repeatCountBak)); } + //noinspection ConstantConditions recorder.actionPerformed(listener, actionCommand); } } @@ -351,9 +356,11 @@ /** * Returns the text area that fired the specified event. + * This method will throw an {@link Error} if <var>evt</var> does not have a JEditTextArea in it's source component hierarchy. * @param evt the event + * @return the JEditTextArea found as the source of <var>evt</var> */ - @Nullable public static JEditTextArea getTextArea(final EventObject evt) { + @Nullable private static JEditTextArea getTextArea(final EventObject evt) { if (evt != null) { final Object o = evt.getSource(); if (o instanceof Component) { @@ -377,15 +384,17 @@ // this shouldn't happen log.fatal("BUG: getTextArea() returning null"); log.fatal("Report this to Slava Pestov <sp...@gj...>"); - return null; + assert false : "BUG: getTextArea() returning null"; + throw new Error("BUG: getTextArea() returning null"); } // protected members /** * If a key is being grabbed, this method should be called with the - * appropriate key event. It executes the grab action with the typed - * character as the parameter. + * appropriate key event. + * It executes the grab action with the typed character as the parameter. + * @param evt The KeyEvent the key should be grabbed of */ protected final void handleGrabAction(final KeyEvent evt) { // Clear it *before* it is executed so that executeAction() @@ -402,13 +411,13 @@ protected int repeatCount; - protected InputHandler.MacroRecorder recorder; + @Nullable protected InputHandler.MacroRecorder recorder; /** * If an action implements this interface, it should not be repeated. * Instead, it will handle the repetition itself. */ - public interface NonRepeatable { + public static interface NonRepeatable { } @@ -416,7 +425,7 @@ * If an action implements this interface, it should not be recorded * by the macro recorder. Instead, it will do its own recording. */ - public interface NonRecordable { + public static interface NonRecordable { } @@ -424,12 +433,12 @@ * For use by EditAction.Wrapper only. * @since jEdit 2.2final */ - public interface Wrapper { + public static interface Wrapper { } /** Macro recorder. */ - public interface MacroRecorder { + public static interface MacroRecorder { void actionPerformed(ActionListener listener, String actionCommand); @@ -437,8 +446,9 @@ public static final class backspace implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); if (!textArea.isEditable()) { textArea.getToolkit().beep(); @@ -465,8 +475,9 @@ public static final class backspace_word implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); final int start = textArea.getSelectionStart(); if (start != textArea.getSelectionEnd()) { textArea.setSelectedText(""); @@ -499,8 +510,9 @@ public static final class delete implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); if (!textArea.isEditable()) { textArea.getToolkit().beep(); @@ -527,8 +539,9 @@ public static final class delete_word implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); final int start = textArea.getSelectionStart(); if (start != textArea.getSelectionEnd()) { textArea.setSelectedText(""); @@ -567,8 +580,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); int caret = textArea.getCaretPosition(); @@ -612,8 +626,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); if (select) { textArea.select(textArea.getMarkPosition(), textArea.getDocumentLength()); } else { @@ -630,8 +645,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); int caret = textArea.getCaretPosition(); @@ -670,8 +686,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); if (select) { textArea.select(textArea.getMarkPosition(), 0); } else { @@ -682,8 +699,8 @@ public static final class insert_break implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); if (!textArea.isEditable()) { textArea.getToolkit().beep(); @@ -696,8 +713,9 @@ public static final class insert_tab implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); if (!textArea.isEditable()) { textArea.getToolkit().beep(); @@ -717,8 +735,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); final int caret = textArea.getCaretPosition(); if (caret == textArea.getDocumentLength()) { textArea.getToolkit().beep(); @@ -741,8 +760,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); int caret = textArea.getCaretPosition(); final int line = textArea.getCaretLine(); @@ -774,8 +794,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); final int lineCount = textArea.getLineCount(); int firstLine = textArea.getFirstLine(); final int visibleLines = textArea.getVisibleLines(); @@ -806,8 +827,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); int caret = textArea.getCaretPosition(); final int line = textArea.getCaretLine(); final int lineStart = textArea.getLineStartOffset(line); @@ -836,8 +858,9 @@ public static final class overwrite implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); textArea.setOverwriteEnabled( !textArea.isOverwriteEnabled()); } @@ -851,8 +874,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); final int caret = textArea.getCaretPosition(); if (caret == 0) { textArea.getToolkit().beep(); @@ -875,8 +899,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); int caret = textArea.getCaretPosition(); final int line = textArea.getCaretLine(); @@ -908,8 +933,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); int firstLine = textArea.getFirstLine(); final int visibleLines = textArea.getVisibleLines(); final int line = textArea.getCaretLine(); @@ -937,8 +963,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); int caret = textArea.getCaretPosition(); final int line = textArea.getCaretLine(); final int lineStart = textArea.getLineStartOffset(line); @@ -967,10 +994,11 @@ public static final class repeat implements ActionListener, InputHandler.NonRecordable { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); textArea.getInputHandler().setRepeatEnabled(true); - final String actionCommand = evt.getActionCommand(); + final String actionCommand = e.getActionCommand(); if (actionCommand != null) { textArea.getInputHandler().setRepeatCount(Integer.parseInt(actionCommand)); } @@ -979,17 +1007,19 @@ public static final class toggle_rect implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); textArea.setSelectionRectangular(!textArea.isSelectionRectangular()); } } public static final class insert_char implements ActionListener, InputHandler.NonRepeatable { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); - final String str = evt.getActionCommand(); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); + final String str = e.getActionCommand(); final int repeatCount = textArea.getInputHandler().getRepeatCount(); if (textArea.isEditable()) { @@ -1012,11 +1042,11 @@ /** * Copy current selection into the system clipboard. - * @param evt ActionEvent (was Control-C) + * {@inheritDoc} */ - public final void actionPerformed(final ActionEvent evt) { + public final void actionPerformed(final ActionEvent e) { // get the selected string - final String text = getTextArea(evt).getSelectedText(); + final String text = getTextArea(e).getSelectedText(); if (text != null) { final StringSelection selection = new StringSelection(text); // set above string to the system clipboard @@ -1032,19 +1062,19 @@ public static final class cut implements ActionListener { /** + * {@inheritDoc} * Copy current selection into the system clipboard, then delete the * selected text. - * @param evt ActionEvent (was Control-X) */ - public final void actionPerformed(final ActionEvent evt) { + public final void actionPerformed(final ActionEvent e) { // get the selected string - final String text = getTextArea(evt).getSelectedText(); + final String text = getTextArea(e).getSelectedText(); if (text != null) { final StringSelection selection = new StringSelection(text); // set above string to the system clipboard Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection); // now delete the original text - getTextArea(evt).setSelectedText(""); + getTextArea(e).setSelectedText(""); } } } @@ -1056,11 +1086,11 @@ public static final class paste implements ActionListener { /** + * {@inheritDoc} * Get content of the system clipboard and insert it at caret position. - * @param evt ActionEvent (was Control-V) */ - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textarea = getTextArea(evt); + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textarea = getTextArea(e); final StringBuffer buff = new StringBuffer(""); // set above string to the system clipboard @@ -1091,15 +1121,15 @@ // insert text at caret position textarea.getDocument().insertString(textarea.getCaretPosition(), buff.toString(), null); } - } catch (final ClassNotFoundException e) { + } catch (final ClassNotFoundException ex) { System.err.println("syntax.InputHandler: Paste action failed due to ClassNotFoundException"); - } catch (final UnsupportedFlavorException e) { + } catch (final UnsupportedFlavorException ex) { System.err.println("syntax.InputHandler: Paste action failed because clipboard data flavour is not supported."); - } catch (final IOException e) { + } catch (final IOException ex) { System.err.println("syntax.InputHandler: Paste action failed due to IOException"); - } catch (final BadLocationException e) { + } catch (final BadLocationException ex) { System.err.println("syntax.InputHandler: Paste action failed due to BadLocationException"); - } catch (final NullPointerException e) { + } catch (final NullPointerException ex) { // this happens when clipboard is empty, it's not an error } @@ -1113,10 +1143,10 @@ public static final class save implements ActionListener { /** + * {@inheritDoc} * Save the currently active tab - * @param evt ActionEvent (was Control-S) */ - public final void actionPerformed(final ActionEvent evt) { + public final void actionPerformed(final ActionEvent e) { ScriptEditControl.getInstance().saveActiveTab(); } } @@ -1129,11 +1159,11 @@ public static final class function_menu implements ActionListener { /** + * {@inheritDoc} * Get content of the system clipboard and insert it at caret position. - * @param evt ActionEvent (was Control-V) */ - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textarea = getTextArea(evt); + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textarea = getTextArea(e); final int caretPos = textarea.getCaretPosition(); // caret position try { @@ -1157,8 +1187,10 @@ cfPythonPopup.getMenu().show(textarea, textarea._offsetToX(line, offset), 30 + textarea.lineToY(line)); } } - } catch (final BadLocationException e) { + } catch (final BadLocationException ble) { } } - } -} + + } // class function_menu + +} // class InputHandler Modified: trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java 2006-07-31 18:41:56 UTC (rev 239) +++ trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java 2006-07-31 20:07:17 UTC (rev 240) @@ -186,17 +186,19 @@ /** * Returns a named text area action. * @param name the action name + * @return action stored for <var>name</var> or <code>null</code> if no such action was found */ - public static ActionListener getAction(final String name) { + @Nullable public static ActionListener getAction(final String name) { return actions.get(name); } /** * Returns the name of the specified text area action. * @param listener the action name + * @return name for the supplied <var>listener</var> or <code>null</code> if no name was found */ @Nullable public static String getActionName(final ActionListener listener) { - for (String name : actions.keySet()) { + for (final String name : actions.keySet()) { if (actions.get(name) == listener) { return name; } @@ -204,10 +206,6 @@ return null; } - public static CFPythonPopup getPopup() { - return cfPythonPopup; - } - /** * Adds the default key bindings to this input handler. This should not be * called in the constructor of this input handler, because applications @@ -242,18 +240,20 @@ } /** - * Returns if repeating is enabled. When repeating is enabled, actions will - * be executed multiple times. This is usually invoked with a special key - * stroke in the input handler. + * Returns if repetition is enabled. + * When repetition is enabled, actions will be executed multiple times. + * This is usually invoked with a special key stroke in the input handler. + * @return <code>true</code> if repeating is enabled, otherwise <code>false</code> */ public final boolean isRepeatEnabled() { return repeat; } /** - * Enables repeating. When repeating is enabled, actions will be executed - * multiple times. Once repeating is enabled, the input handler should read - * a number from the keyboard. + * Sets the enabled state of repetition. + * When repetition is enabled, actions will be executed multiple times. + * Once repeating is enabled, the input handler should read a number from the keyboard. + * @param repeat <code>true</code> for enabling repetition, <code>false</code> for disabling it */ public final void setRepeatEnabled(final boolean repeat) { this.repeat = repeat; @@ -261,6 +261,7 @@ /** * Returns the number of times the next action will be repeated. + * @return number of times the next action will be repeated (1 or the set repeat count) */ public final int getRepeatCount() { return repeat ? Math.max(1, repeatCount) : 1; @@ -275,10 +276,11 @@ } /** - * Returns the macro recorder. If this is non-null, all executed actions - * should be forwarded to the recorder. + * Returns the macro recorder. + * If this is non-null, all executed actions should be forwarded to the recorder. + * @return the macro recorder */ - public final InputHandler.MacroRecorder getMacroRecorder() { + @Nullable public final InputHandler.MacroRecorder getMacroRecorder() { return recorder; } @@ -287,13 +289,14 @@ * should be forwarded to the recorder. * @param recorder the macro recorder */ - public final void setMacroRecorder(final InputHandler.MacroRecorder recorder) { + public final void setMacroRecorder(@Nullable final InputHandler.MacroRecorder recorder) { this.recorder = recorder; } /** * Returns a copy of this input handler that shares the same key bindings. * Setting key bindings in the copy will also set them in the original. + * @return copy of this InputHandler */ public abstract InputHandler copy(); @@ -333,9 +336,11 @@ if (recorder != null) { if (!(listener instanceof InputHandler.NonRecordable)) { if (repeatCountBak != 1) { + //noinspection ConstantConditions recorder.actionPerformed(REPEAT, String.valueOf(repeatCountBak)); } + //noinspection ConstantConditions recorder.actionPerformed(listener, actionCommand); } } @@ -351,9 +356,11 @@ /** * Returns the text area that fired the specified event. + * This method will throw an {@link Error} if <var>evt</var> does not have a JEditTextArea in it's source component hierarchy. * @param evt the event + * @return the JEditTextArea found as the source of <var>evt</var> */ - @Nullable public static JEditTextArea getTextArea(final EventObject evt) { + @Nullable private static JEditTextArea getTextArea(final EventObject evt) { if (evt != null) { final Object o = evt.getSource(); if (o instanceof Component) { @@ -377,15 +384,17 @@ // this shouldn't happen log.fatal("BUG: getTextArea() returning null"); log.fatal("Report this to Slava Pestov <sp...@gj...>"); - return null; + assert false : "BUG: getTextArea() returning null"; + throw new Error("BUG: getTextArea() returning null"); } // protected members /** * If a key is being grabbed, this method should be called with the - * appropriate key event. It executes the grab action with the typed - * character as the parameter. + * appropriate key event. + * It executes the grab action with the typed character as the parameter. + * @param evt The KeyEvent the key should be grabbed of */ protected final void handleGrabAction(final KeyEvent evt) { // Clear it *before* it is executed so that executeAction() @@ -402,13 +411,13 @@ protected int repeatCount; - protected InputHandler.MacroRecorder recorder; + @Nullable protected InputHandler.MacroRecorder recorder; /** * If an action implements this interface, it should not be repeated. * Instead, it will handle the repetition itself. */ - public interface NonRepeatable { + public static interface NonRepeatable { } @@ -416,7 +425,7 @@ * If an action implements this interface, it should not be recorded * by the macro recorder. Instead, it will do its own recording. */ - public interface NonRecordable { + public static interface NonRecordable { } @@ -424,12 +433,12 @@ * For use by EditAction.Wrapper only. * @since jEdit 2.2final */ - public interface Wrapper { + public static interface Wrapper { } /** Macro recorder. */ - public interface MacroRecorder { + public static interface MacroRecorder { void actionPerformed(ActionListener listener, String actionCommand); @@ -437,8 +446,9 @@ public static final class backspace implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); if (!textArea.isEditable()) { textArea.getToolkit().beep(); @@ -465,8 +475,9 @@ public static final class backspace_word implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); final int start = textArea.getSelectionStart(); if (start != textArea.getSelectionEnd()) { textArea.setSelectedText(""); @@ -499,8 +510,9 @@ public static final class delete implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); if (!textArea.isEditable()) { textArea.getToolkit().beep(); @@ -527,8 +539,9 @@ public static final class delete_word implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); final int start = textArea.getSelectionStart(); if (start != textArea.getSelectionEnd()) { textArea.setSelectedText(""); @@ -567,8 +580,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); int caret = textArea.getCaretPosition(); @@ -612,8 +626,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); if (select) { textArea.select(textArea.getMarkPosition(), textArea.getDocumentLength()); } else { @@ -630,8 +645,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); int caret = textArea.getCaretPosition(); @@ -670,8 +686,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); if (select) { textArea.select(textArea.getMarkPosition(), 0); } else { @@ -682,8 +699,8 @@ public static final class insert_break implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); if (!textArea.isEditable()) { textArea.getToolkit().beep(); @@ -696,8 +713,9 @@ public static final class insert_tab implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); if (!textArea.isEditable()) { textArea.getToolkit().beep(); @@ -717,8 +735,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); final int caret = textArea.getCaretPosition(); if (caret == textArea.getDocumentLength()) { textArea.getToolkit().beep(); @@ -741,8 +760,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); int caret = textArea.getCaretPosition(); final int line = textArea.getCaretLine(); @@ -774,8 +794,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); final int lineCount = textArea.getLineCount(); int firstLine = textArea.getFirstLine(); final int visibleLines = textArea.getVisibleLines(); @@ -806,8 +827,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); int caret = textArea.getCaretPosition(); final int line = textArea.getCaretLine(); final int lineStart = textArea.getLineStartOffset(line); @@ -836,8 +858,9 @@ public static final class overwrite implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); textArea.setOverwriteEnabled( !textArea.isOverwriteEnabled()); } @@ -851,8 +874,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); final int caret = textArea.getCaretPosition(); if (caret == 0) { textArea.getToolkit().beep(); @@ -875,8 +899,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); int caret = textArea.getCaretPosition(); final int line = textArea.getCaretLine(); @@ -908,8 +933,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); int firstLine = textArea.getFirstLine(); final int visibleLines = textArea.getVisibleLines(); final int line = textArea.getCaretLine(); @@ -937,8 +963,9 @@ this.select = select; } - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); int caret = textArea.getCaretPosition(); final int line = textArea.getCaretLine(); final int lineStart = textArea.getLineStartOffset(line); @@ -967,10 +994,11 @@ public static final class repeat implements ActionListener, InputHandler.NonRecordable { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); textArea.getInputHandler().setRepeatEnabled(true); - final String actionCommand = evt.getActionCommand(); + final String actionCommand = e.getActionCommand(); if (actionCommand != null) { textArea.getInputHandler().setRepeatCount(Integer.parseInt(actionCommand)); } @@ -979,17 +1007,19 @@ public static final class toggle_rect implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); textArea.setSelectionRectangular(!textArea.isSelectionRectangular()); } } public static final class insert_char implements ActionListener, InputHandler.NonRepeatable { - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textArea = getTextArea(evt); - final String str = evt.getActionCommand(); + /** {@inheritDoc} */ + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textArea = getTextArea(e); + final String str = e.getActionCommand(); final int repeatCount = textArea.getInputHandler().getRepeatCount(); if (textArea.isEditable()) { @@ -1012,11 +1042,11 @@ /** * Copy current selection into the system clipboard. - * @param evt ActionEvent (was Control-C) + * {@inheritDoc} */ - public final void actionPerformed(final ActionEvent evt) { + public final void actionPerformed(final ActionEvent e) { // get the selected string - final String text = getTextArea(evt).getSelectedText(); + final String text = getTextArea(e).getSelectedText(); if (text != null) { final StringSelection selection = new StringSelection(text); // set above string to the system clipboard @@ -1032,19 +1062,19 @@ public static final class cut implements ActionListener { /** + * {@inheritDoc} * Copy current selection into the system clipboard, then delete the * selected text. - * @param evt ActionEvent (was Control-X) */ - public final void actionPerformed(final ActionEvent evt) { + public final void actionPerformed(final ActionEvent e) { // get the selected string - final String text = getTextArea(evt).getSelectedText(); + final String text = getTextArea(e).getSelectedText(); if (text != null) { final StringSelection selection = new StringSelection(text); // set above string to the system clipboard Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection); // now delete the original text - getTextArea(evt).setSelectedText(""); + getTextArea(e).setSelectedText(""); } } } @@ -1056,11 +1086,11 @@ public static final class paste implements ActionListener { /** + * {@inheritDoc} * Get content of the system clipboard and insert it at caret position. - * @param evt ActionEvent (was Control-V) */ - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textarea = getTextArea(evt); + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textarea = getTextArea(e); final StringBuffer buff = new StringBuffer(""); // set above string to the system clipboard @@ -1091,15 +1121,15 @@ // insert text at caret position textarea.getDocument().insertString(textarea.getCaretPosition(), buff.toString(), null); } - } catch (final ClassNotFoundException e) { + } catch (final ClassNotFoundException ex) { System.err.println("syntax.InputHandler: Paste action failed due to ClassNotFoundException"); - } catch (final UnsupportedFlavorException e) { + } catch (final UnsupportedFlavorException ex) { System.err.println("syntax.InputHandler: Paste action failed because clipboard data flavour is not supported."); - } catch (final IOException e) { + } catch (final IOException ex) { System.err.println("syntax.InputHandler: Paste action failed due to IOException"); - } catch (final BadLocationException e) { + } catch (final BadLocationException ex) { System.err.println("syntax.InputHandler: Paste action failed due to BadLocationException"); - } catch (final NullPointerException e) { + } catch (final NullPointerException ex) { // this happens when clipboard is empty, it's not an error } @@ -1113,10 +1143,10 @@ public static final class save implements ActionListener { /** + * {@inheritDoc} * Save the currently active tab - * @param evt ActionEvent (was Control-S) */ - public final void actionPerformed(final ActionEvent evt) { + public final void actionPerformed(final ActionEvent e) { ScriptEditControl.getInstance().saveActiveTab(); } } @@ -1129,11 +1159,11 @@ public static final class function_menu implements ActionListener { /** + * {@inheritDoc} * Get content of the system clipboard and insert it at caret position. - * @param evt ActionEvent (was Control-V) */ - public final void actionPerformed(final ActionEvent evt) { - final JEditTextArea textarea = getTextArea(evt); + public final void actionPerformed(final ActionEvent e) { + final JEditTextArea textarea = getTextArea(e); final int caretPos = textarea.getCaretPosition(); // caret position try { @@ -1157,8 +1187,10 @@ cfPythonPopup.getMenu().show(textarea, textarea._offsetToX(line, offset), 30 + textarea.lineToY(line)); } } - } catch (final BadLocationException e) { + } catch (final BadLocationException ble) { } } - } -} + + } // class function_menu + +} // class InputHandler This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-07-31 18:42:10
|
Revision: 239 Author: christianhujer Date: 2006-07-31 11:41:56 -0700 (Mon, 31 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=239&view=rev Log Message: ----------- Removed unused import. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java Modified: trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java 2006-07-31 18:29:27 UTC (rev 238) +++ trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java 2006-07-31 18:41:56 UTC (rev 239) @@ -23,7 +23,6 @@ import java.awt.event.KeyEvent; import java.io.BufferedReader; import java.io.IOException; -import java.util.Enumeration; import java.util.EventObject; import java.util.HashMap; import java.util.Map; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-07-31 18:30:16
|
Revision: 238 Author: christianhujer Date: 2006-07-31 11:29:27 -0700 (Mon, 31 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=238&view=rev Log Message: ----------- Removed version information from textedit files for easier diff. Also, in SVN they are unused. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/textarea/CTokenMarker.java trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java trunk/crossfire/src/cfeditor/textedit/textarea/HTMLTokenMarker.java trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java trunk/crossfire/src/cfeditor/textedit/textarea/JavaScriptTokenMarker.java trunk/crossfire/src/cfeditor/textedit/textarea/KeywordMap.java trunk/crossfire/src/cfeditor/textedit/textarea/PythonTokenMarker.java trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxDocument.java trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxStyle.java trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxUtilities.java trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java trunk/crossfire/src/cfeditor/textedit/textarea/TextUtilities.java trunk/crossfire/src/cfeditor/textedit/textarea/Token.java trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java trunk/crossfire/src/cfeditor/textedit/textarea/XMLTokenMarker.java trunk/daimonin/src/daieditor/textedit/textarea/CTokenMarker.java trunk/daimonin/src/daieditor/textedit/textarea/DefaultInputHandler.java trunk/daimonin/src/daieditor/textedit/textarea/HTMLTokenMarker.java trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java trunk/daimonin/src/daieditor/textedit/textarea/JavaScriptTokenMarker.java trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java trunk/daimonin/src/daieditor/textedit/textarea/SyntaxDocument.java trunk/daimonin/src/daieditor/textedit/textarea/SyntaxStyle.java trunk/daimonin/src/daieditor/textedit/textarea/SyntaxUtilities.java trunk/daimonin/src/daieditor/textedit/textarea/TextAreaPainter.java trunk/daimonin/src/daieditor/textedit/textarea/TextUtilities.java trunk/daimonin/src/daieditor/textedit/textarea/Token.java trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java trunk/daimonin/src/daieditor/textedit/textarea/XMLTokenMarker.java Modified: trunk/crossfire/src/cfeditor/textedit/textarea/CTokenMarker.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/CTokenMarker.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/CTokenMarker.java 2006-07-31 18:29:27 UTC (rev 238) @@ -14,7 +14,6 @@ /** * C token marker. * @author Slava Pestov - * @version $Id: CTokenMarker.java,v 1.5 2006/03/26 00:48:57 akirschbaum Exp $ */ public class CTokenMarker extends TokenMarker { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java 2006-07-31 18:29:27 UTC (rev 238) @@ -25,7 +25,6 @@ * and inserts key typed events into the text area. * @author Slava Pestov * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @version $Id: DefaultInputHandler.java,v 1.7 2006/03/26 00:48:57 akirschbaum Exp $ */ public final class DefaultInputHandler extends InputHandler { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/HTMLTokenMarker.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/HTMLTokenMarker.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/HTMLTokenMarker.java 2006-07-31 18:29:27 UTC (rev 238) @@ -14,7 +14,6 @@ /** * HTML token marker. * @author Slava Pestov - * @version $Id: HTMLTokenMarker.java,v 1.4 2006/03/01 21:13:44 akirschbaum Exp $ */ public class HTMLTokenMarker extends TokenMarker { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java 2006-07-31 18:29:27 UTC (rev 238) @@ -41,7 +41,6 @@ * to the implementations of this class to do so. * @author Slava Pestov * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @version $Id: InputHandler.java,v 1.10 2006/03/26 00:48:57 akirschbaum Exp $ * @see DefaultInputHandler */ public abstract class InputHandler extends KeyAdapter { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java 2006-07-31 18:29:27 UTC (rev 238) @@ -89,7 +89,6 @@ * + "}");</pre> * @author Slava Pestov * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @version $Id: JEditTextArea.java,v 1.11 2006/03/26 00:48:57 akirschbaum Exp $ */ public final class JEditTextArea extends JComponent { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/JavaScriptTokenMarker.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/JavaScriptTokenMarker.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/JavaScriptTokenMarker.java 2006-07-31 18:29:27 UTC (rev 238) @@ -12,7 +12,6 @@ /** * JavaScript token marker. * @author Slava Pestov - * @version $Id: JavaScriptTokenMarker.java,v 1.5 2006/03/01 21:13:44 akirschbaum Exp $ */ public final class JavaScriptTokenMarker extends CTokenMarker { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/KeywordMap.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/KeywordMap.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/KeywordMap.java 2006-07-31 18:29:27 UTC (rev 238) @@ -19,7 +19,6 @@ * <p/> * This class is used by <code>CTokenMarker</code> to map keywords to ids. * @author Slava Pestov, Mike Dillon - * @version $Id: KeywordMap.java,v 1.6 2006/03/26 00:48:57 akirschbaum Exp $ */ public final class KeywordMap { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/PythonTokenMarker.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/PythonTokenMarker.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/PythonTokenMarker.java 2006-07-31 18:29:27 UTC (rev 238) @@ -15,7 +15,6 @@ /** * Python token marker. * @author Jonathan Revusky - * @version $Id: PythonTokenMarker.java,v 1.5 2006/03/26 00:48:57 akirschbaum Exp $ */ public class PythonTokenMarker extends TokenMarker { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxDocument.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxDocument.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxDocument.java 2006-07-31 18:29:27 UTC (rev 238) @@ -20,7 +20,6 @@ * A document implementation that can be tokenized by the syntax highlighting * system. * @author Slava Pestov - * @version $Id: SyntaxDocument.java,v 1.6 2006/03/25 23:19:57 akirschbaum Exp $ */ public final class SyntaxDocument extends PlainDocument { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxStyle.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxStyle.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxStyle.java 2006-07-31 18:29:27 UTC (rev 238) @@ -18,7 +18,6 @@ * A simple text style class. It can specify the color, italic flag, * and bold flag of a run of text. * @author Slava Pestov - * @version $Id: SyntaxStyle.java,v 1.7 2006/03/26 00:48:57 akirschbaum Exp $ */ public final class SyntaxStyle { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxUtilities.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxUtilities.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxUtilities.java 2006-07-31 18:29:27 UTC (rev 238) @@ -20,7 +20,6 @@ * Class with several utility functions used by jEdit's syntax colorizing * subsystem. * @author Slava Pestov - * @version $Id: SyntaxUtilities.java,v 1.6 2006/03/25 22:04:22 akirschbaum Exp $ */ public final class SyntaxUtilities { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java 2006-07-31 18:29:27 UTC (rev 238) @@ -33,7 +33,6 @@ * of text. * @author Slava Pestov * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @version $Id: TextAreaPainter.java,v 1.11 2006/03/26 00:48:57 akirschbaum Exp $ */ public final class TextAreaPainter extends JComponent implements TabExpander { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/TextUtilities.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/TextUtilities.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/TextUtilities.java 2006-07-31 18:29:27 UTC (rev 238) @@ -15,7 +15,6 @@ /** * Class with several utility functions used by the text area component. * @author Slava Pestov - * @version $Id: TextUtilities.java,v 1.6 2006/04/06 18:31:36 akirschbaum Exp $ */ public final class TextUtilities { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/Token.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/Token.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/Token.java 2006-07-31 18:29:27 UTC (rev 238) @@ -16,7 +16,6 @@ * which is the length of the token in the text, and a pointer to the next * token in the list. * @author Slava Pestov - * @version $Id: Token.java,v 1.5 2006/03/25 22:04:22 akirschbaum Exp $ */ public final class Token { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java 2006-07-31 18:29:27 UTC (rev 238) @@ -20,7 +20,6 @@ * is tokenized. Therefore, the return value of <code>markTokens</code> should * only be used for immediate painting. Notably, it cannot be cached. * @author Slava Pestov - * @version $Id: TokenMarker.java,v 1.7 2006/03/25 22:04:22 akirschbaum Exp $ * @see Token */ public abstract class TokenMarker { Modified: trunk/crossfire/src/cfeditor/textedit/textarea/XMLTokenMarker.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/XMLTokenMarker.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/crossfire/src/cfeditor/textedit/textarea/XMLTokenMarker.java 2006-07-31 18:29:27 UTC (rev 238) @@ -12,7 +12,6 @@ /** * XML token marker. * @author Slava Pestov - * @version $Id: XMLTokenMarker.java,v 1.4 2006/03/01 21:13:44 akirschbaum Exp $ */ public final class XMLTokenMarker extends HTMLTokenMarker { Modified: trunk/daimonin/src/daieditor/textedit/textarea/CTokenMarker.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/CTokenMarker.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/daimonin/src/daieditor/textedit/textarea/CTokenMarker.java 2006-07-31 18:29:27 UTC (rev 238) @@ -14,7 +14,6 @@ /** * C token marker. * @author Slava Pestov - * @version $Id: CTokenMarker.java,v 1.7 2006/02/26 15:44:39 christianhujer Exp $ */ public class CTokenMarker extends TokenMarker { Modified: trunk/daimonin/src/daieditor/textedit/textarea/DefaultInputHandler.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/DefaultInputHandler.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/daimonin/src/daieditor/textedit/textarea/DefaultInputHandler.java 2006-07-31 18:29:27 UTC (rev 238) @@ -25,7 +25,6 @@ * and inserts key typed events into the text area. * @author Slava Pestov * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @version $Id: DefaultInputHandler.java,v 1.12 2006/04/20 15:07:04 derdanny Exp $ */ public final class DefaultInputHandler extends InputHandler { Modified: trunk/daimonin/src/daieditor/textedit/textarea/HTMLTokenMarker.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/HTMLTokenMarker.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/daimonin/src/daieditor/textedit/textarea/HTMLTokenMarker.java 2006-07-31 18:29:27 UTC (rev 238) @@ -14,7 +14,6 @@ /** * HTML token marker. * @author Slava Pestov - * @version $Id: HTMLTokenMarker.java,v 1.5 2005/08/09 13:41:54 christianhujer Exp $ */ public class HTMLTokenMarker extends TokenMarker { Modified: trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java 2006-07-31 18:29:27 UTC (rev 238) @@ -40,7 +40,6 @@ * to the implementations of this class to do so. * @author Slava Pestov * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @version $Id: InputHandler.java,v 1.14 2006/04/20 15:07:04 derdanny Exp $ * @see DefaultInputHandler */ public abstract class InputHandler extends KeyAdapter { Modified: trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java 2006-07-31 18:29:27 UTC (rev 238) @@ -89,7 +89,6 @@ * + "}");</pre> * @author Slava Pestov * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @version $Id: JEditTextArea.java,v 1.16 2006/04/20 15:07:04 derdanny Exp $ */ public final class JEditTextArea extends JComponent { Modified: trunk/daimonin/src/daieditor/textedit/textarea/JavaScriptTokenMarker.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/JavaScriptTokenMarker.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/daimonin/src/daieditor/textedit/textarea/JavaScriptTokenMarker.java 2006-07-31 18:29:27 UTC (rev 238) @@ -12,7 +12,6 @@ /** * JavaScript token marker. * @author Slava Pestov - * @version $Id: JavaScriptTokenMarker.java,v 1.6 2005/05/20 20:13:45 christianhujer Exp $ */ public final class JavaScriptTokenMarker extends CTokenMarker { Modified: trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java 2006-07-31 18:29:27 UTC (rev 238) @@ -19,7 +19,6 @@ * <p/> * This class is used by <code>CTokenMarker</code> to map keywords to ids. * @author Slava Pestov, Mike Dillon - * @version $Id: KeywordMap.java,v 1.7 2005/08/09 13:41:55 christianhujer Exp $ */ public final class KeywordMap { Modified: trunk/daimonin/src/daieditor/textedit/textarea/SyntaxDocument.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/SyntaxDocument.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/daimonin/src/daieditor/textedit/textarea/SyntaxDocument.java 2006-07-31 18:29:27 UTC (rev 238) @@ -20,7 +20,6 @@ * A document implementation that can be tokenized by the syntax highlighting * system. * @author Slava Pestov - * @version $Id: SyntaxDocument.java,v 1.10 2005/11/05 23:31:39 christianhujer Exp $ */ public final class SyntaxDocument extends PlainDocument { Modified: trunk/daimonin/src/daieditor/textedit/textarea/SyntaxStyle.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/SyntaxStyle.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/daimonin/src/daieditor/textedit/textarea/SyntaxStyle.java 2006-07-31 18:29:27 UTC (rev 238) @@ -18,7 +18,6 @@ * A simple text style class. It can specify the color, italic flag, * and bold flag of a run of text. * @author Slava Pestov - * @version $Id: SyntaxStyle.java,v 1.9 2006/04/14 14:08:45 derdanny Exp $ */ public final class SyntaxStyle { Modified: trunk/daimonin/src/daieditor/textedit/textarea/SyntaxUtilities.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/SyntaxUtilities.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/daimonin/src/daieditor/textedit/textarea/SyntaxUtilities.java 2006-07-31 18:29:27 UTC (rev 238) @@ -20,7 +20,6 @@ * Class with several utility functions used by jEdit's syntax colorizing * subsystem. * @author Slava Pestov - * @version $Id: SyntaxUtilities.java,v 1.7 2006/04/14 14:08:45 derdanny Exp $ */ public final class SyntaxUtilities { Modified: trunk/daimonin/src/daieditor/textedit/textarea/TextAreaPainter.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/TextAreaPainter.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/daimonin/src/daieditor/textedit/textarea/TextAreaPainter.java 2006-07-31 18:29:27 UTC (rev 238) @@ -33,7 +33,6 @@ * of text. * @author Slava Pestov * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @version $Id: TextAreaPainter.java,v 1.15 2006/04/20 15:07:04 derdanny Exp $ */ public final class TextAreaPainter extends JComponent implements TabExpander { Modified: trunk/daimonin/src/daieditor/textedit/textarea/TextUtilities.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/TextUtilities.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/daimonin/src/daieditor/textedit/textarea/TextUtilities.java 2006-07-31 18:29:27 UTC (rev 238) @@ -15,7 +15,6 @@ /** * Class with several utility functions used by the text area component. * @author Slava Pestov - * @version $Id: TextUtilities.java,v 1.7 2006/04/20 15:07:04 derdanny Exp $ */ public final class TextUtilities { Modified: trunk/daimonin/src/daieditor/textedit/textarea/Token.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/Token.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/daimonin/src/daieditor/textedit/textarea/Token.java 2006-07-31 18:29:27 UTC (rev 238) @@ -16,7 +16,6 @@ * which is the length of the token in the text, and a pointer to the next * token in the list. * @author Slava Pestov - * @version $Id: Token.java,v 1.7 2005/08/09 13:41:55 christianhujer Exp $ */ public final class Token { Modified: trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java 2006-07-31 18:29:27 UTC (rev 238) @@ -20,7 +20,6 @@ * is tokenized. Therefore, the return value of <code>markTokens</code> should * only be used for immediate painting. Notably, it cannot be cached. * @author Slava Pestov - * @version $Id: TokenMarker.java,v 1.8 2005/08/09 13:41:55 christianhujer Exp $ * @see Token */ public abstract class TokenMarker { Modified: trunk/daimonin/src/daieditor/textedit/textarea/XMLTokenMarker.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/XMLTokenMarker.java 2006-07-30 17:56:25 UTC (rev 237) +++ trunk/daimonin/src/daieditor/textedit/textarea/XMLTokenMarker.java 2006-07-31 18:29:27 UTC (rev 238) @@ -12,7 +12,6 @@ /** * XML token marker. * @author Slava Pestov - * @version $Id: XMLTokenMarker.java,v 1.5 2005/08/09 13:41:55 christianhujer Exp $ */ public final class XMLTokenMarker extends HTMLTokenMarker { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-07-30 17:56:57
|
Revision: 237 Author: christianhujer Date: 2006-07-30 10:56:25 -0700 (Sun, 30 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=237&view=rev Log Message: ----------- Unified some source code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapFileDecode.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java trunk/daimonin/src/daieditor/CArchPanel.java trunk/daimonin/src/daieditor/textedit/scripteditor/CFPythonPopup.java trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditControl.java trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditView.java trunk/daimonin/src/daieditor/textedit/textarea/DefaultInputHandler.java trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java trunk/daimonin/src/daieditor/textedit/textarea/TextAreaPainter.java Modified: trunk/crossfire/src/cfeditor/CMapFileDecode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-07-30 17:56:25 UTC (rev 237) @@ -74,7 +74,8 @@ final FileReader fr = new FileReader(file); final BufferedReader myInput = new BufferedReader(fr); - maxxlen = maxylen = 0; + maxxlen = 0; + maxylen = 0; objects = new ArrayList<ArchObject>(); // first of all we read the map arch (if that fails we throw an exception) Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-07-30 17:56:25 UTC (rev 237) @@ -59,7 +59,7 @@ private MapControl buffCtrl; // map-control structure for mapData - private boolean isEmpty; // Is the CopyBuffer empty? + private boolean empty; // Is the CopyBuffer empty? private MapArchObject mapArch; // dummy for mapArch @@ -72,7 +72,7 @@ * @param mainControl main control */ public CopyBuffer(final CMainControl mainControl) { - isEmpty = true; // Buffer is empty + empty = true; // Buffer is empty this.mainControl = mainControl; // link main control in mapArch = new MapArchObject(); @@ -91,7 +91,7 @@ * <code>false</code> */ public boolean isEmpty() { - return isEmpty; + return empty; } /** @@ -144,8 +144,8 @@ // Prepare the buffer (if it's a cut or copy) if (mode == DO_CUT || mode == DO_COPY) { - if (isEmpty) { - isEmpty = false; // from now on the buffer is never empty again + if (empty) { + empty = false; // from now on the buffer is never empty again mainControl.getMainView().refreshMenus(); // "Paste" enabled } Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java 2006-07-30 17:56:25 UTC (rev 237) @@ -35,7 +35,10 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; -import java.util.Vector; +import static java.lang.String.CASE_INSENSITIVE_ORDER; +import java.util.ArrayList; +import static java.util.Collections.sort; +import java.util.List; import javax.swing.JComboBox; import javax.swing.plaf.basic.BasicComboPopup; import javax.swing.text.BadLocationException; @@ -86,8 +89,8 @@ menu = new CFPythonPopupMenu(this); if (menuEntries != null) { - for (int i = 0; i < menuEntries.length; i++) { - addItem(" " + menuEntries[i]); + for (final String menuEntry : menuEntries) { + addItem(" " + menuEntry); } } @@ -106,7 +109,7 @@ */ public static void loadCommandlist() { CFileReader reader = null; // file reader - final Vector cmdList = new Vector(); // temporare list to store commands + final List<String> cmdList = new ArrayList<String>(); // temporare list to store commands try { String isoArchDefFolder = ""; @@ -122,9 +125,8 @@ reader = new CFileReader(baseDir, IGUIConstants.PYTHONMENU_FILE); // read file into the cmdList vector: - String line; // tmp string for reading lines - line = reader.getReader().readLine(); // read first line - while (line != null) { + String line; + while ((line = reader.getReader().readLine()) != null) { line = line.trim(); if (line.length() > 0 && !line.startsWith("#")) { // ATM, the descriptive info about method headers is cut out @@ -137,21 +139,14 @@ System.err.println(" \"" + line + "\" missing '()'"); line += "()"; // that line is probably garbage, but will work } - cmdList.addElement(line); + cmdList.add(line); } - - // read next line - line = reader.getReader().readLine(); } - sortVector(cmdList); + sort(cmdList, CASE_INSENSITIVE_ORDER); // now create the 'menuEntries' array if (cmdList.size() > 0) { - menuEntries = new String[cmdList.size()]; // set array dimension - - for (int i = 0; i < cmdList.size(); i++) { - menuEntries[i] = (String) cmdList.elementAt(i); - } + menuEntries = cmdList.toArray(new String[cmdList.size()]); } // close file reader @@ -169,23 +164,6 @@ } /** - * Sort a string vector in alphabetical order. The used sorting strategy is - * bubblesort because the expected number of objects is low (~300). - * @param v Vector to be sorted - */ - private static void sortVector(final Vector v) { - for (int j = 0; j < v.size() + 1; j++) { - for (int i = 0; i < v.size() - 1; i++) { - if (((String) v.elementAt(i)).compareToIgnoreCase((String) v.elementAt(i + 1)) > 0) { - final Object node = v.elementAt(i); - v.setElementAt(v.elementAt(i + 1), i); - v.setElementAt(node, i + 1); - } - } - } - } - - /** * @return true when this popup menu has been fully initialized and is * ready for use */ @@ -198,8 +176,8 @@ * @param pos caret position in the document */ public final void setCaretPosition(final int pos) { - this.caretPos = pos; - this.getMenu().requestFocus(); + caretPos = pos; + getMenu().requestFocus(); control.registerActivePopup(this); } @@ -218,7 +196,7 @@ private boolean ignore; // while true, all ActionEvents get ignored - public MenuActionListener(final CFPythonPopup popup) { + MenuActionListener(final CFPythonPopup popup) { this.popup = popup; ignore = false; } @@ -239,7 +217,7 @@ ignore = true; popup.setSelectedIndex(0); ignore = false; - popup.getMenu().hide(); // in some JRE versions, this doesn't happen automatically + popup.getMenu().setVisible(false); // in some JRE versions, this doesn't happen automatically } } } // class MenuActionListener @@ -260,7 +238,7 @@ super(box); this.comboBox = box; //this.addMouseListener(new ListenerMenuClick()); - this.setPreferredSize(new Dimension(220, 200)); + setPreferredSize(new Dimension(220, 200)); } } // class CFPythonPopupMenu Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java 2006-07-30 17:56:25 UTC (rev 237) @@ -30,7 +30,8 @@ import java.io.File; import java.io.FileWriter; import java.io.IOException; -import java.util.Vector; +import java.util.ArrayList; +import java.util.List; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.filechooser.FileFilter; @@ -62,11 +63,11 @@ private final ScriptEditView view; // view (window with textareas) - private final Vector opened; // open tabs, contains absolute filenames (or "<>") in order left to right + private final List<String> opened; // open tabs, contains absolute filenames (or "<>") in order left to right /** Constructor is private, instance is created by calling 'init()' */ private ScriptEditControl(final CMainControl mainControl) { - opened = new Vector(); // start with empty vector + opened = new ArrayList<String>(); // start with empty vector this.mainControl = mainControl; view = new ScriptEditView(this); // initialize window } @@ -132,7 +133,7 @@ * Open a new empty Python script document. */ public final void openScriptNew() { - opened.addElement("<>"); // this script has no filename assigned yet + opened.add("<>"); // this script has no filename assigned yet view.addTab("<New Script>", null); } @@ -143,7 +144,7 @@ final File file = new File(pathname); if (file.exists() && file.isFile()) { - opened.addElement(file.getAbsolutePath()); + opened.add(file.getAbsolutePath()); view.addTab(file.getName(), file); } else { if (log.isInfoEnabled()) { @@ -189,14 +190,14 @@ */ public final void closeActiveTab() { if (view.getSelectedIndex() >= 0 && opened.size() > 0) { - opened.removeElementAt(view.getSelectedIndex()); // dump the filename + opened.remove(view.getSelectedIndex()); // dump the filename } view.closeActiveTab(); // close tab in the view // hide view when last tab has been closed if (view.getTabCount() <= 0) { if (activePopup != null && (activePopup.isShowing() || activePopup.getMenu().isShowing())) { - activePopup.getMenu().hide(); + activePopup.getMenu().setVisible(false); } view.setVisible(false); if (isStandAlone()) { @@ -242,14 +243,14 @@ if (activePath != null) { final File file = new File(activePath); - if (file != null && file.getParentFile().exists() && file.getParentFile().isDirectory()) { + if (file.getParentFile().exists() && file.getParentFile().isDirectory()) { fileChooser.setCurrentDirectory(file.getParentFile()); fileChooser.setSelectedFile(file); // select this name } } else { // set default folder for new scripts final File baseDir = new File(defaultScriptDir); - if (baseDir != null && baseDir.exists() && baseDir.isDirectory()) { + if (baseDir.exists() && baseDir.isDirectory()) { fileChooser.setCurrentDirectory(baseDir); } } @@ -275,7 +276,7 @@ //String path = (String)(opened.elementAt(tabIndex)); // set new path - opened.setElementAt(file.getAbsolutePath(), tabIndex); + opened.set(tabIndex, file.getAbsolutePath()); view.setTitleAt(tabIndex, file.getName()); view.refreshMenuBar(); @@ -344,9 +345,9 @@ @Nullable final String getActiveFilePath() { if (view != null && opened != null && view.getSelectedIndex() >= 0 && opened.size() > 0) { // get stored path - final String path = (String) opened.elementAt(view.getSelectedIndex()); + final String path = opened.get(view.getSelectedIndex()); - if (path == null || path.length() == 0 || path.equals("<>")) { + if (path == null || path.length() == 0 || "<>".equals(path)) { return null; } else { return path; @@ -366,7 +367,7 @@ * Main method for testing purpose. * @param args */ - public static void main(final String[] args) { + public static void main(final String... args) { init(System.getProperty("user.dir")); getInstance().openScriptNew(); getInstance().openScriptNew(); Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java 2006-07-30 17:56:25 UTC (rev 237) @@ -32,14 +32,15 @@ import java.awt.Dimension; import java.awt.Rectangle; import java.awt.Toolkit; +import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; -import java.util.Vector; +import java.util.ArrayList; +import java.util.List; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JOptionPane; @@ -80,7 +81,7 @@ private final JTabbedPane tabPane; // tab pane - private final Vector textAreas; // list of 'JEditTextArea' objects, same order as tabs + private final List<JEditTextArea> textAreas; // list of 'JEditTextArea' objects, same order as tabs /** * Build frame but keep it hidden (it is shown when first file is opened). @@ -90,7 +91,7 @@ setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.control = control; - textAreas = new Vector(); + textAreas = new ArrayList<JEditTextArea>(); menuBar = new ScriptEditMenuBar(control); // build menu bar setJMenuBar(menuBar); // add menu bar to frame @@ -135,7 +136,7 @@ tabPane.addTab(title, ta); if (getTabCount() <= 1 || !isShowing()) { - this.setVisible(true); + setVisible(true); isFirstTimeShowing = true; } @@ -147,7 +148,7 @@ this.update(this.getGraphics()); //} - textAreas.addElement(ta); + textAreas.add(ta); if (file != null && file.exists()) { // print file into this document @@ -197,7 +198,7 @@ public final void closeActiveTab() { if (textAreas.size() > 0) { // remove textArea - textAreas.removeElementAt(tabPane.getSelectedIndex()); + textAreas.remove(tabPane.getSelectedIndex()); tabPane.remove(tabPane.getSelectedIndex()); } else { setVisible(false); @@ -209,7 +210,7 @@ */ @Nullable public final JEditTextArea getActiveTextArea() { if (getTabCount() > 0) { - return (JEditTextArea) (textAreas.elementAt(tabPane.getSelectedIndex())); + return textAreas.get(tabPane.getSelectedIndex()); } return null; // no window is open @@ -326,7 +327,7 @@ /** * Inner class: Listener for closebox on the window. */ - private static final class EditWindowListener implements WindowListener { + private static final class EditWindowListener extends WindowAdapter { private final ScriptEditControl control; // controller @@ -342,29 +343,14 @@ * Window closebox has been clicked. * @param e WindowEvent */ - public final void windowClosing(final WindowEvent e) { + @Override public final void windowClosing(final WindowEvent e) { control.closeAllTabs(); } - public final void windowClosed(final WindowEvent e) { + @Override public final void windowClosed(final WindowEvent e) { control.closeAllTabs(); // (just make sure tabs are removed...) } - public void windowActivated(final WindowEvent e) { - } - - public void windowDeactivated(final WindowEvent e) { - } - - public void windowDeiconified(final WindowEvent e) { - } - - public void windowIconified(final WindowEvent e) { - } - - public void windowOpened(final WindowEvent e) { - } - } // class EditWindowListener } // class ScriptEditView Modified: trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java 2006-07-30 17:56:25 UTC (rev 237) @@ -13,7 +13,8 @@ import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; -import java.util.Hashtable; +import java.util.HashMap; +import java.util.Map; import java.util.StringTokenizer; import javax.swing.KeyStroke; import org.apache.log4j.Logger; @@ -28,9 +29,9 @@ */ public final class DefaultInputHandler extends InputHandler { - private Hashtable bindings; + private final Map<KeyStroke, Object> bindings; - private Hashtable currentBindings; + private Map<KeyStroke, Object> currentBindings; private static final Logger log = Logger.getLogger(DefaultInputHandler.class); @@ -38,7 +39,7 @@ * Creates a new input handler with no key bindings defined. */ public DefaultInputHandler() { - currentBindings = new Hashtable(); + currentBindings = new HashMap<KeyStroke, Object>(); bindings = currentBindings; } @@ -104,7 +105,7 @@ * @param action the action */ @Override public void addKeyBinding(final String keyBinding, final ActionListener action) { - Hashtable current = bindings; + Map<KeyStroke, Object> current = bindings; final StringTokenizer st = new StringTokenizer(keyBinding); while (st.hasMoreTokens()) { @@ -115,12 +116,12 @@ if (st.hasMoreTokens()) { Object o = current.get(keyStroke); - if (o instanceof Hashtable) { - current = (Hashtable) o; + if (o instanceof Map) { + current = (Map<KeyStroke, Object>) o; } else { - o = new Hashtable(); + o = new HashMap<KeyStroke, Object>(); current.put(keyStroke, o); - current = (Hashtable) o; + current = (Map<KeyStroke, Object>) o; } } else { current.put(keyStroke, action); @@ -154,9 +155,9 @@ * Handle a key pressed event. This will look up the binding for the key * stroke and execute it. */ - @Override public void keyPressed(final KeyEvent evt) { - final int keyCode = evt.getKeyCode(); - final int modifiers = evt.getModifiers(); + @Override public void keyPressed(final KeyEvent e) { + final int keyCode = e.getKeyCode(); + final int modifiers = e.getModifiers(); if (keyCode == KeyEvent.VK_CONTROL || keyCode == KeyEvent.VK_SHIFT @@ -165,15 +166,15 @@ return; } - if ((modifiers & ~KeyEvent.SHIFT_MASK) != 0 - || evt.isActionKey() + if ((modifiers & ~InputEvent.SHIFT_MASK) != 0 + || e.isActionKey() || keyCode == KeyEvent.VK_BACK_SPACE || keyCode == KeyEvent.VK_DELETE || keyCode == KeyEvent.VK_ENTER || keyCode == KeyEvent.VK_TAB || keyCode == KeyEvent.VK_ESCAPE) { if (grabAction != null) { - handleGrabAction(evt); + handleGrabAction(e); return; } @@ -190,19 +191,16 @@ // shouldn't repeatCount = 0; repeat = false; - evt.consume(); + e.consume(); } currentBindings = bindings; - return; } else if (o instanceof ActionListener) { currentBindings = bindings; - executeAction((ActionListener) o, evt.getSource(), null); - evt.consume(); - return; - } else if (o instanceof Hashtable) { - currentBindings = (Hashtable) o; - evt.consume(); - return; + executeAction((ActionListener) o, e.getSource(), null); + e.consume(); + } else if (o instanceof Map) { + currentBindings = (Map<KeyStroke, Object>) o; + e.consume(); } } } @@ -210,22 +208,22 @@ /** * Handle a key typed event. This inserts the key into the text area. */ - @Override public void keyTyped(final KeyEvent evt) { - final int modifiers = evt.getModifiers(); - final char c = evt.getKeyChar(); + @Override public void keyTyped(final KeyEvent e) { + final int modifiers = e.getModifiers(); + final char c = e.getKeyChar(); - if (c != KeyEvent.CHAR_UNDEFINED && (modifiers & KeyEvent.ALT_MASK) == 0) { + if (c != KeyEvent.CHAR_UNDEFINED && (modifiers & InputEvent.ALT_MASK) == 0) { if (c >= 0x20 && c != 0x7f) { final KeyStroke keyStroke = KeyStroke.getKeyStroke(Character.toUpperCase(c)); final Object o = currentBindings.get(keyStroke); - if (o instanceof Hashtable) { - currentBindings = (Hashtable) o; + if (o instanceof Map) { + currentBindings = (Map<KeyStroke, Object>) o; return; } else if (o instanceof ActionListener) { currentBindings = bindings; executeAction((ActionListener) o, - evt.getSource(), + e.getSource(), String.valueOf(c)); return; } @@ -233,7 +231,7 @@ currentBindings = bindings; if (grabAction != null) { - handleGrabAction(evt); + handleGrabAction(e); return; } @@ -244,7 +242,7 @@ return; } - executeAction(INSERT_CHAR, evt.getSource(), String.valueOf(evt.getKeyChar())); + executeAction(INSERT_CHAR, e.getSource(), String.valueOf(e.getKeyChar())); repeatCount = 0; repeat = false; Modified: trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java 2006-07-30 17:56:25 UTC (rev 237) @@ -25,7 +25,8 @@ import java.io.IOException; import java.util.Enumeration; import java.util.EventObject; -import java.util.Hashtable; +import java.util.HashMap; +import java.util.Map; import javax.swing.JPopupMenu; import javax.swing.text.BadLocationException; import org.apache.log4j.Logger; @@ -134,13 +135,13 @@ // Default action public static final ActionListener INSERT_CHAR = new insert_char(); - private static final Hashtable actions; + private static final Map<String, ActionListener> actions; // popup menu for CFPython function private static final CFPythonPopup cfPythonPopup; static { - actions = new Hashtable(); + actions = new HashMap<String, ActionListener>(); actions.put("backspace", BACKSPACE); actions.put("backspace-word", BACKSPACE_WORD); actions.put("delete", DELETE); @@ -189,7 +190,7 @@ * @param name the action name */ public static ActionListener getAction(final String name) { - return (ActionListener) actions.get(name); + return actions.get(name); } /** @@ -197,24 +198,14 @@ * @param listener the action name */ @Nullable public static String getActionName(final ActionListener listener) { - final Enumeration enu = getActions(); - while (enu.hasMoreElements()) { - final String name = (String) enu.nextElement(); - final ActionListener _listener = getAction(name); - if (_listener == listener) { + for (String name : actions.keySet()) { + if (actions.get(name) == listener) { return name; } } return null; } - /** - * Returns an enumeration of all available actions. - */ - public static Enumeration getActions() { - return actions.keys(); - } - public static CFPythonPopup getPopup() { return cfPythonPopup; } @@ -401,9 +392,9 @@ protected final void handleGrabAction(final KeyEvent evt) { // Clear it *before* it is executed so that executeAction() // resets the repeat count - final ActionListener _grabAction = grabAction; + final ActionListener grabAction2 = grabAction; grabAction = null; - executeAction(_grabAction, evt.getSource(), String.valueOf(evt.getKeyChar())); + executeAction(grabAction2, evt.getSource(), String.valueOf(evt.getKeyChar())); } // protected members @@ -1072,7 +1063,6 @@ */ public final void actionPerformed(final ActionEvent evt) { final JEditTextArea textarea = getTextArea(evt); - String line; final StringBuffer buff = new StringBuffer(""); // set above string to the system clipboard @@ -1084,6 +1074,7 @@ // read everything into the buffer 'buff' boolean start = true; + String line; while ((line = breader.readLine()) != null) { if (start) { start = false; @@ -1145,7 +1136,6 @@ */ public final void actionPerformed(final ActionEvent evt) { final JEditTextArea textarea = getTextArea(evt); - final JEditTextArea textArea = getTextArea(evt); final int caretPos = textarea.getCaretPosition(); // caret position try { @@ -1160,10 +1150,10 @@ if (caretPos >= 7 && cfPythonPopup.isInitialized()) { final String fname = textarea.getDocument().getText(textarea.getCaretPosition() - 9, 8); //System.err.println("'"+fname+"'"); - if (fname.equalsIgnoreCase("cfpython")) { + if ("cfpython".equalsIgnoreCase(fname)) { // function cfpython was written: final int line = textarea.getCaretLine(); - final int offset = textArea.getCaretPosition() - textArea.getLineStartOffset(line); + final int offset = textarea.getCaretPosition() - textarea.getLineStartOffset(line); cfPythonPopup.setCaretPosition(caretPos + 1); cfPythonPopup.getMenu().show(textarea, textarea._offsetToX(line, offset), 30 + textarea.lineToY(line)); Modified: trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java 2006-07-30 17:56:25 UTC (rev 237) @@ -35,10 +35,10 @@ import java.awt.event.MouseMotionListener; import java.lang.reflect.Field; import java.lang.reflect.Method; -import java.util.Enumeration; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Set; -import java.util.Vector; import javax.swing.JComponent; import javax.swing.JPopupMenu; import javax.swing.JScrollBar; @@ -55,6 +55,8 @@ import javax.swing.text.Segment; import javax.swing.text.Utilities; import javax.swing.undo.AbstractUndoableEdit; +import javax.swing.undo.CannotRedoException; +import javax.swing.undo.CannotUndoException; import javax.swing.undo.UndoableEdit; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -184,21 +186,18 @@ private void freeTabKeyFromFocusTraversal() { try { // preparing the key set first, this should be harmless - final Set forwardTraversalKeys = new HashSet(); + final Set<KeyStroke> forwardTraversalKeys = new HashSet<KeyStroke>(); forwardTraversalKeys.add(KeyStroke.getKeyStroke("control TAB")); // here we try to access java.awt.KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS final Field field = Class.forName("java.awt.KeyboardFocusManager").getField("FORWARD_TRAVERSAL_KEYS"); - final Integer value = new Integer(field.getInt(field)); // store the value of this field + final Integer value = field.getInt(field); // store the value of this field - final Method[] methods = getClass().getMethods(); - if (methods != null) { - for (int i = 0; i < methods.length; i++) { - // here we try to find the method "setFocusTraversalKeys", and execute it if found - if (methods[i].getName().equalsIgnoreCase("setFocusTraversalKeys")) { - methods[i].invoke(this, new Object[] { value, forwardTraversalKeys, }); - // System.err.println("freeTabKeyFromFocusTraversal() succeeded!"); - } + for (Method method : getClass().getMethods()) { + // here we try to find the method "setFocusTraversalKeys", and execute it if found + if (method.getName().equalsIgnoreCase("setFocusTraversalKeys")) { + method.invoke(this, value, forwardTraversalKeys); + // System.err.println("freeTabKeyFromFocusTraversal() succeeded!"); } } } catch (final Exception e) { @@ -359,7 +358,7 @@ // get line height final int lineHeight; - if (painter == null || painter.getFontMetrics() == null) { + if (painter.getFontMetrics() == null) { lineHeight = painter.getDefaultLineHeight(); // default height might be wrong, take it only when needed } else { lineHeight = painter.getFontMetrics().getHeight(); @@ -579,11 +578,10 @@ if (offset + segmentOffset < lineSegment.offset + length) { lineSegment.count = offset - (lineSegment.offset - segmentOffset); return x + Utilities.getTabbedTextWidth(lineSegment, fm, x, painter, 0); - } else { - lineSegment.count = length; - x += Utilities.getTabbedTextWidth(lineSegment, fm, x, painter, 0); - lineSegment.offset += length; } + lineSegment.count = length; + x += Utilities.getTabbedTextWidth(lineSegment, fm, x, painter, 0); + lineSegment.offset += length; tokens = tokens.getNext(); } } @@ -1570,7 +1568,7 @@ } else if (name.equals(BOTTOM)) { bottom = comp; } else if (name.equals(LEFT_OF_SCROLLBAR)) { - leftOfScrollBar.addElement(comp); + leftOfScrollBar.add(comp); } } @@ -1586,7 +1584,7 @@ if (bottom == comp) { bottom = null; } else { - leftOfScrollBar.removeElement(comp); + leftOfScrollBar.remove(comp); } } @@ -1650,9 +1648,7 @@ centerHeight); // Lay out all status components, in order - final Enumeration status = leftOfScrollBar.elements(); - while (status.hasMoreElements()) { - final Component comp = (Component) status.nextElement(); + for (Component comp : leftOfScrollBar) { final Dimension dim = comp.getPreferredSize(); comp.setBounds(ileft, itop + centerHeight, dim.width, bottomHeight); ileft += dim.width; @@ -1672,12 +1668,12 @@ private Component bottom; - private final Vector leftOfScrollBar = new Vector(); + private final List<Component> leftOfScrollBar = new ArrayList<Component>(); } // class ScrollLayout static final class CaretBlinker implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { + public final void actionPerformed(final ActionEvent e) { if (focusedComponent != null && focusedComponent.hasFocus()) { focusedComponent.blinkCaret(); } @@ -1706,7 +1702,7 @@ final class AdjustHandler implements AdjustmentListener { - public final void adjustmentValueChanged(final AdjustmentEvent evt) { + public final void adjustmentValueChanged(final AdjustmentEvent e) { if (!scrollBarsInitialized) { return; } @@ -1716,7 +1712,7 @@ // the mouse is released SwingUtilities.invokeLater(new Runnable() { public void run() { - if (evt.getAdjustable() == vertical) { + if (e.getAdjustable() == vertical) { setFirstLine(vertical.getValue()); } else { setHorizontalOffset(-horizontal.getValue()); @@ -1728,7 +1724,7 @@ final class ComponentHandler extends ComponentAdapter { - @Override public final void componentResized(final ComponentEvent evt) { + @Override public final void componentResized(final ComponentEvent e) { recalculateVisibleLines(); scrollBarsInitialized = true; } @@ -1736,11 +1732,11 @@ final class DocumentHandler implements DocumentListener { - public final void insertUpdate(final DocumentEvent evt) { - documentChanged(evt); + public final void insertUpdate(final DocumentEvent e) { + documentChanged(e); - final int offset = evt.getOffset(); - final int length = evt.getLength(); + final int offset = e.getOffset(); + final int length = e.getLength(); final int newStart; final int newEnd; @@ -1760,11 +1756,11 @@ select(newStart, newEnd); } - public final void removeUpdate(final DocumentEvent evt) { - documentChanged(evt); + public final void removeUpdate(final DocumentEvent e) { + documentChanged(e); - final int offset = evt.getOffset(); - final int length = evt.getLength(); + final int offset = e.getOffset(); + final int length = e.getLength(); final int newStart; final int newEnd; @@ -1792,34 +1788,34 @@ select(newStart, newEnd); } - public final void changedUpdate(final DocumentEvent evt) { + public final void changedUpdate(final DocumentEvent e) { } } // class DocumentHandler final class DragHandler implements MouseMotionListener { - public final void mouseDragged(final MouseEvent evt) { + public final void mouseDragged(final MouseEvent e) { if (popup != null && popup.isVisible()) { return; } - setSelectionRectangular((evt.getModifiers() & InputEvent.CTRL_MASK) != 0); - select(getMarkPosition(), xyToOffset(evt.getX(), evt.getY())); + setSelectionRectangular((e.getModifiers() & InputEvent.CTRL_MASK) != 0); + select(getMarkPosition(), xyToOffset(e.getX(), e.getY())); } - public final void mouseMoved(final MouseEvent evt) { + public final void mouseMoved(final MouseEvent e) { } } // class DragHandler final class FocusHandler implements FocusListener { - public final void focusGained(final FocusEvent evt) { + public final void focusGained(final FocusEvent e) { setCaretVisible(true); focusedComponent = JEditTextArea.this; } - public final void focusLost(final FocusEvent evt) { + public final void focusLost(final FocusEvent e) { setCaretVisible(false); focusedComponent = null; } @@ -1828,37 +1824,31 @@ final class MouseHandler extends MouseAdapter { - @Override public final void mousePressed(final MouseEvent evt) { + @Override public final void mousePressed(final MouseEvent e) { requestFocus(); // Focus events not fired sometimes? setCaretVisible(true); focusedComponent = JEditTextArea.this; - if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) != 0 && popup != null) { - popup.show(painter, evt.getX(), evt.getY()); + if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 && popup != null) { + popup.show(painter, e.getX(), e.getY()); return; } - final int line = yToLine(evt.getY()); - final int offset = xToOffset(line, evt.getX()); + final int line = yToLine(e.getY()); + final int offset = xToOffset(line, e.getX()); final int dot = getLineStartOffset(line) + offset; - switch (evt.getClickCount()) { + switch (e.getClickCount()) { case 1: - doSingleClick(evt, line, offset, dot); + doSingleClick(e, line, offset, dot); break; case 2: - // It uses the bracket matching stuff, so - // it can throw a BLE - try { - doDoubleClick(evt, line, offset, dot); - } catch (final BadLocationException bl) { - bl.printStackTrace(); - } + doDoubleClick(e, line, offset, dot); break; case 3: - doTripleClick(evt, line, offset, dot); + doTripleClick(e, line, offset, dot); break; } } @@ -1872,7 +1862,7 @@ } } - private void doDoubleClick(final MouseEvent evt, final int line, final int offset, final int dot) throws BadLocationException { + private void doDoubleClick(final MouseEvent evt, final int line, final int offset, final int dot) { // Ignore empty lines if (getLineLength(line) == 0) { return; @@ -1970,13 +1960,13 @@ return "caret move"; } - @Override public final void undo() { + @Override public final void undo() throws CannotUndoException { super.undo(); select(start, end); } - @Override public final void redo() { + @Override public final void redo() throws CannotRedoException { super.redo(); select(start, end); Modified: trunk/daimonin/src/daieditor/CArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanel.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/daimonin/src/daieditor/CArchPanel.java 2006-07-30 17:56:25 UTC (rev 237) @@ -112,8 +112,7 @@ final JTabbedPane tp = (JTabbedPane) e.getSource(); setSelectedArch(null); - final PanelNode[] panelNodeArray = panelNodeList.toArray(new PanelNode[0]); - final PanelNode node = panelNodeArray[tp.getSelectedIndex()]; + final PanelNode node = panelNodeList.get(tp.getSelectedIndex()); selectedPanel = node.getData(); if (selectedPanel != null) { selectedPanel.showArchList(); @@ -134,11 +133,7 @@ } @Nullable public ArchObject getArchPanelSelection() { - if (selectedPanel == null) { - return null; - } - - return selectedPanel.getArchListObject(); + return selectedPanel != null ? selectedPanel.getArchListObject() : null; } public void showArchPanelQuickObject(final ArchObject arch) { Modified: trunk/daimonin/src/daieditor/textedit/scripteditor/CFPythonPopup.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/scripteditor/CFPythonPopup.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/daimonin/src/daieditor/textedit/scripteditor/CFPythonPopup.java 2006-07-30 17:56:25 UTC (rev 237) @@ -79,7 +79,6 @@ */ public CFPythonPopup() { setBackground(Color.white); // white background - //System.err.println("Initializing CFPythonPopup..."); control = ScriptEditControl.getInstance(); @@ -91,7 +90,7 @@ menu = new CFPythonPopupMenu(this); if (menuEntries != null) { - for (String menuEntry : menuEntries) { + for (final String menuEntry : menuEntries) { addItem(" " + menuEntry); } } Modified: trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditControl.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditControl.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditControl.java 2006-07-30 17:56:25 UTC (rev 237) @@ -32,6 +32,8 @@ import java.util.List; import javax.swing.JFileChooser; import javax.swing.JOptionPane; +import javax.swing.filechooser.FileFilter; +import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; /** @@ -42,6 +44,8 @@ */ public final class ScriptEditControl { + private static final Logger log = Logger.getLogger(ScriptEditControl.class); + // static instance of this class (there's only one controller and max. one open window) private static ScriptEditControl instance = null; @@ -141,8 +145,10 @@ opened.add(file.getAbsolutePath()); view.addTab(file.getName(), file); } else { - System.err.println("Error in ScriptEditControl.openScriptFile():"); - System.err.println(" File '" + pathname + "' doesn't exist."); + if (log.isInfoEnabled()) { + log.info("Error in ScriptEditControl.openScriptFile():"); + log.info(" File '" + pathname + "' doesn't exist."); + } } } Modified: trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditView.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditView.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditView.java 2006-07-30 17:56:25 UTC (rev 237) @@ -37,8 +37,8 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; +import java.util.ArrayList; import java.util.List; -import java.util.Vector; import java.util.prefs.Preferences; import static java.util.prefs.Preferences.userNodeForPackage; import javax.swing.ImageIcon; @@ -85,7 +85,7 @@ super("Script Pad"); // window title setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); - textAreas = new Vector<JEditTextArea>(); + textAreas = new ArrayList<JEditTextArea>(); menuBar = new ScriptEditMenuBar(control); // build menu bar setJMenuBar(menuBar); // add menu bar to frame Modified: trunk/daimonin/src/daieditor/textedit/textarea/DefaultInputHandler.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/DefaultInputHandler.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/daimonin/src/daieditor/textedit/textarea/DefaultInputHandler.java 2006-07-30 17:56:25 UTC (rev 237) @@ -14,10 +14,10 @@ import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.util.HashMap; -import java.util.Hashtable; import java.util.Map; import java.util.StringTokenizer; import javax.swing.KeyStroke; +import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; /** @@ -33,6 +33,8 @@ private Map<KeyStroke, Object> currentBindings; + private static final Logger log = Logger.getLogger(DefaultInputHandler.class); + /** * Creates a new input handler with no key bindings defined. */ @@ -86,7 +88,7 @@ addKeyBinding("C+ENTER", REPEAT); addKeyBinding("C+C", COPY); - addKeyBinding("C+x", CUT); + addKeyBinding("C+X", CUT); addKeyBinding("C+V", PASTE); addKeyBinding("C+S", SAVE); @@ -114,10 +116,10 @@ if (st.hasMoreTokens()) { Object o = current.get(keyStroke); - if (o instanceof Hashtable) { + if (o instanceof Map) { current = (Map<KeyStroke, Object>) o; } else { - o = new HashMap(); + o = new HashMap<KeyStroke, Object>(); current.put(keyStroke, o); current = (Map<KeyStroke, Object>) o; } @@ -153,9 +155,9 @@ * Handle a key pressed event. This will look up the binding for the key * stroke and execute it. */ - @Override public void keyPressed(final KeyEvent evt) { - final int keyCode = evt.getKeyCode(); - final int modifiers = evt.getModifiers(); + @Override public void keyPressed(final KeyEvent e) { + final int keyCode = e.getKeyCode(); + final int modifiers = e.getModifiers(); if (keyCode == KeyEvent.VK_CONTROL || keyCode == KeyEvent.VK_SHIFT @@ -165,14 +167,14 @@ } if ((modifiers & ~InputEvent.SHIFT_MASK) != 0 - || evt.isActionKey() + || e.isActionKey() || keyCode == KeyEvent.VK_BACK_SPACE || keyCode == KeyEvent.VK_DELETE || keyCode == KeyEvent.VK_ENTER || keyCode == KeyEvent.VK_TAB || keyCode == KeyEvent.VK_ESCAPE) { if (grabAction != null) { - handleGrabAction(evt); + handleGrabAction(e); return; } @@ -189,16 +191,16 @@ // shouldn't repeatCount = 0; repeat = false; - evt.consume(); + e.consume(); } currentBindings = bindings; } else if (o instanceof ActionListener) { currentBindings = bindings; - executeAction((ActionListener) o, evt.getSource(), null); - evt.consume(); - } else if (o instanceof Hashtable) { + executeAction((ActionListener) o, e.getSource(), null); + e.consume(); + } else if (o instanceof Map) { currentBindings = (Map<KeyStroke, Object>) o; - evt.consume(); + e.consume(); } } } @@ -206,22 +208,22 @@ /** * Handle a key typed event. This inserts the key into the text area. */ - @Override public void keyTyped(final KeyEvent evt) { - final int modifiers = evt.getModifiers(); - final char c = evt.getKeyChar(); + @Override public void keyTyped(final KeyEvent e) { + final int modifiers = e.getModifiers(); + final char c = e.getKeyChar(); if (c != KeyEvent.CHAR_UNDEFINED && (modifiers & InputEvent.ALT_MASK) == 0) { if (c >= 0x20 && c != 0x7f) { final KeyStroke keyStroke = KeyStroke.getKeyStroke(Character.toUpperCase(c)); final Object o = currentBindings.get(keyStroke); - if (o instanceof Hashtable) { + if (o instanceof Map) { currentBindings = (Map<KeyStroke, Object>) o; return; } else if (o instanceof ActionListener) { currentBindings = bindings; executeAction((ActionListener) o, - evt.getSource(), + e.getSource(), String.valueOf(c)); return; } @@ -229,7 +231,7 @@ currentBindings = bindings; if (grabAction != null) { - handleGrabAction(evt); + handleGrabAction(e); return; } @@ -240,7 +242,7 @@ return; } - executeAction(INSERT_CHAR, evt.getSource(), String.valueOf(evt.getKeyChar())); + executeAction(INSERT_CHAR, e.getSource(), String.valueOf(e.getKeyChar())); repeatCount = 0; repeat = false; @@ -291,7 +293,7 @@ return KeyStroke.getKeyStroke(ch, modifiers); } } else if (key.length() == 0) { - System.err.println("Invalid key stroke: " + keyStroke); + log.error("Invalid key stroke: " + keyStroke); return null; } else { final int ch; @@ -299,7 +301,7 @@ try { ch = KeyEvent.class.getField("VK_".concat(key)).getInt(null); } catch (final Exception e) { - System.err.println("Invalid key stroke: " + keyStroke); + log.error("Invalid key stroke: " + keyStroke); return null; } Modified: trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java 2006-07-30 17:56:25 UTC (rev 237) @@ -28,6 +28,7 @@ import java.util.Map; import javax.swing.JPopupMenu; import javax.swing.text.BadLocationException; +import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; /** @@ -44,6 +45,8 @@ */ public abstract class InputHandler extends KeyAdapter { + private static final Logger log = Logger.getLogger(InputHandler.class); + /** * If this client property is set to Boolean.TRUE on the text area, the * home/end keys will support 'smart' BRIEF-like behaviour (one press = @@ -373,8 +376,8 @@ } // this shouldn't happen - System.err.println("BUG: getTextArea() returning null"); - System.err.println("Report this to Slava Pestov <sp...@gj...>"); + log.fatal("BUG: getTextArea() returning null"); + log.fatal("Report this to Slava Pestov <sp...@gj...>"); return null; } Modified: trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java 2006-07-30 17:56:25 UTC (rev 237) @@ -58,6 +58,7 @@ import javax.swing.undo.CannotRedoException; import javax.swing.undo.CannotUndoException; import javax.swing.undo.UndoableEdit; +import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; /** @@ -92,6 +93,8 @@ */ public final class JEditTextArea extends JComponent { + private static final Logger log = Logger.getLogger(JEditTextArea.class); + /** * Serial Version UID. */ @@ -193,7 +196,7 @@ for (Method method : getClass().getMethods()) { // here we try to find the method "setFocusTraversalKeys", and execute it if found if (method.getName().equalsIgnoreCase("setFocusTraversalKeys")) { - method.invoke(this, new Object[] { value, forwardTraversalKeys, }); + method.invoke(this, value, forwardTraversalKeys); // System.err.println("freeTabKeyFromFocusTraversal() succeeded!"); } } @@ -1394,7 +1397,7 @@ setSelectedText(selection); } catch (final Exception e) { getToolkit().beep(); - System.err.println("Clipboard does not contain a string"); + log.error("Clipboard does not contain a string"); } } } @@ -1670,7 +1673,7 @@ static final class CaretBlinker implements ActionListener { - public final void actionPerformed(final ActionEvent evt) { + public final void actionPerformed(final ActionEvent e) { if (focusedComponent != null && focusedComponent.hasFocus()) { focusedComponent.blinkCaret(); } @@ -1699,7 +1702,7 @@ final class AdjustHandler implements AdjustmentListener { - public final void adjustmentValueChanged(final AdjustmentEvent evt) { + public final void adjustmentValueChanged(final AdjustmentEvent e) { if (!scrollBarsInitialized) { return; } @@ -1709,7 +1712,7 @@ // the mouse is released SwingUtilities.invokeLater(new Runnable() { public void run() { - if (evt.getAdjustable() == vertical) { + if (e.getAdjustable() == vertical) { setFirstLine(vertical.getValue()); } else { setHorizontalOffset(-horizontal.getValue()); @@ -1721,7 +1724,7 @@ final class ComponentHandler extends ComponentAdapter { - @Override public final void componentResized(final ComponentEvent evt) { + @Override public final void componentResized(final ComponentEvent e) { recalculateVisibleLines(); scrollBarsInitialized = true; } @@ -1729,11 +1732,11 @@ final class DocumentHandler implements DocumentListener { - public final void insertUpdate(final DocumentEvent evt) { - documentChanged(evt); + public final void insertUpdate(final DocumentEvent e) { + documentChanged(e); - final int offset = evt.getOffset(); - final int length = evt.getLength(); + final int offset = e.getOffset(); + final int length = e.getLength(); final int newStart; final int newEnd; @@ -1753,11 +1756,11 @@ select(newStart, newEnd); } - public final void removeUpdate(final DocumentEvent evt) { - documentChanged(evt); + public final void removeUpdate(final DocumentEvent e) { + documentChanged(e); - final int offset = evt.getOffset(); - final int length = evt.getLength(); + final int offset = e.getOffset(); + final int length = e.getLength(); final int newStart; final int newEnd; @@ -1785,34 +1788,34 @@ select(newStart, newEnd); } - public final void changedUpdate(final DocumentEvent evt) { + public final void changedUpdate(final DocumentEvent e) { } } // class DocumentHandler final class DragHandler implements MouseMotionListener { - public final void mouseDragged(final MouseEvent evt) { + public final void mouseDragged(final MouseEvent e) { if (popup != null && popup.isVisible()) { return; } - setSelectionRectangular((evt.getModifiers() & InputEvent.CTRL_MASK) != 0); - select(getMarkPosition(), xyToOffset(evt.getX(), evt.getY())); + setSelectionRectangular((e.getModifiers() & InputEvent.CTRL_MASK) != 0); + select(getMarkPosition(), xyToOffset(e.getX(), e.getY())); } - public final void mouseMoved(final MouseEvent evt) { + public final void mouseMoved(final MouseEvent e) { } } // class DragHandler final class FocusHandler implements FocusListener { - public final void focusGained(final FocusEvent evt) { + public final void focusGained(final FocusEvent e) { setCaretVisible(true); focusedComponent = JEditTextArea.this; } - public final void focusLost(final FocusEvent evt) { + public final void focusLost(final FocusEvent e) { setCaretVisible(false); focusedComponent = null; } @@ -1821,31 +1824,31 @@ final class MouseHandler extends MouseAdapter { - @Override public final void mousePressed(final MouseEvent evt) { + @Override public final void mousePressed(final MouseEvent e) { requestFocus(); // Focus events not fired sometimes? setCaretVisible(true); focusedComponent = JEditTextArea.this; - if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) != 0 && popup != null) { - popup.show(painter, evt.getX(), evt.getY()); + if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 && popup != null) { + popup.show(painter, e.getX(), e.getY()); return; } - final int line = yToLine(evt.getY()); - final int offset = xToOffset(line, evt.getX()); + final int line = yToLine(e.getY()); + final int offset = xToOffset(line, e.getX()); final int dot = getLineStartOffset(line) + offset; - switch (evt.getClickCount()) { + switch (e.getClickCount()) { case 1: - doSingleClick(evt, line, offset, dot); + doSingleClick(e, line, offset, dot); break; case 2: - doDoubleClick(evt, line, offset, dot); + doDoubleClick(e, line, offset, dot); break; case 3: - doTripleClick(evt, line, offset, dot); + doTripleClick(e, line, offset, dot); break; } } Modified: trunk/daimonin/src/daieditor/textedit/textarea/TextAreaPainter.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/TextAreaPainter.java 2006-07-30 16:12:18 UTC (rev 236) +++ trunk/daimonin/src/daieditor/textedit/textarea/TextAreaPainter.java 2006-07-30 17:56:25 UTC (rev 237) @@ -25,6 +25,7 @@ import javax.swing.text.Se... [truncated message content] |
From: <chr...@us...> - 2006-07-30 16:12:51
|
Revision: 236 Author: christianhujer Date: 2006-07-30 09:12:18 -0700 (Sun, 30 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=236&view=rev Log Message: ----------- Adding JUnit 4.1 and Log4J 1.2.13.. Added Paths: ----------- trunk/lib/LICENSE-junit-4.1.jar trunk/lib/LICENSE-log4j-1.2.13.jar trunk/lib/junit-4.1.jar trunk/lib/log4j-1.2.13.jar Added: trunk/lib/LICENSE-junit-4.1.jar =================================================================== --- trunk/lib/LICENSE-junit-4.1.jar (rev 0) +++ trunk/lib/LICENSE-junit-4.1.jar 2006-07-30 16:12:18 UTC (rev 236) @@ -0,0 +1,125 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> +<HTML> +<HEAD> +<TITLE>Common Public License - v 1.0</TITLE> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +</HEAD> + +<BODY BGCOLOR="#FFFFFF" VLINK="#800000"> + + +<P ALIGN="CENTER"><B>Common Public License - v 1.0</B> +<P><B></B><FONT SIZE="3"></FONT> +<P><FONT SIZE="3"></FONT><FONT SIZE="2">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.</FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"><B>1. DEFINITIONS</B></FONT> +<P><FONT SIZE="2">"Contribution" means:</FONT> + +<UL><FONT SIZE="2">a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and<BR CLEAR="LEFT"> +b) in the case of each subsequent Contributor:</FONT></UL> + + +<UL><FONT SIZE="2">i) changes to the Program, and</FONT></UL> + + +<UL><FONT SIZE="2">ii) additions to the Program;</FONT></UL> + + +<UL><FONT SIZE="2">where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. </FONT><FONT SIZE="2">A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. </FONT><FONT SIZE="2">Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. </FONT></UL> + +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">"Contributor" means any person or entity that distributes the Program.</FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. </FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2">"Program" means the Contributions distributed in accordance with this Agreement.</FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.</FONT> +<P><FONT SIZE="2"><B></B></FONT> +<P><FONT SIZE="2"><B>2. GRANT OF RIGHTS</B></FONT> + +<UL><FONT SIZE="2"></FONT><FONT SIZE="2">a) </FONT><FONT SIZE="2">Subject to the terms of this Agreement, each Contributor hereby grants</FONT><FONT SIZE="2"> Recipient a non-exclusive, worldwide, royalty-free copyright license to</FONT><FONT SIZE="2" COLOR="#FF0000"> </FONT><FONT SIZE="2">reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.</FONT></UL> + + +<UL><FONT SIZE="2"></FONT></UL> + + +<UL><FONT SIZE="2"></FONT><FONT SIZE="2">b) Subject to the terms of this Agreement, each Contributor hereby grants </FONT><FONT SIZE="2">Recipient a non-exclusive, worldwide,</FONT><FONT SIZE="2" COLOR="#008000"> </FONT><FONT SIZE="2">royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. </FONT></UL> + + +<UL><FONT SIZE="2"></FONT></UL> + + +<UL><FONT SIZE="2">c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.</FONT></UL> + + +<UL><FONT SIZE="2"></FONT></UL> + + +<UL><FONT SIZE="2">d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. </FONT></UL> + + +<UL><FONT SIZE="2"></FONT></UL> + +<P><FONT SIZE="2"><B>3. REQUIREMENTS</B></FONT> +<P><FONT SIZE="2"><B></B>A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:</FONT> + +<UL><FONT SIZE="2">a) it complies with the terms and conditions of this Agreement; and</FONT></UL> + + +<UL><FONT SIZE="2">b) its license agreement:</FONT></UL> + + +<UL><FONT SIZE="2">i) effectively disclaims</FONT><FONT SIZE="2"> on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; </FONT></UL> + + +<UL><FONT SIZE="2">ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; </FONT></UL> + + +<UL><FONT SIZE="2">iii)</FONT><FONT SIZE="2"> states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and</FONT></UL> + + +<UL><FONT SIZE="2">iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.</FONT><FONT SIZE="2" COLOR="#0000FF"> </FONT><FONT SIZE="2" COLOR="#FF0000"></FONT></UL> + + +<UL><FONT SIZE="2" COLOR="#FF0000"></FONT><FONT SIZE="2"></FONT></UL> + +<P><FONT SIZE="2">When the Program is made available in source code form:</FONT> + +<UL><FONT SIZE="2">a) it must be made available under this Agreement; and </FONT></UL> + + +<UL><FONT SIZE="2">b) a copy of this Agreement must be included with each copy of the Program. </FONT></UL> + +<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT> +<P><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT><FONT SIZE="2">Contributors may not remove or alter any copyright notices contained within the Program. </FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. </FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"><B>4. COMMERCIAL DISTRIBUTION</B></FONT> +<P><FONT SIZE="2">Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.</FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.</FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"></FONT> +<P><FONT SIZE="2" COLOR="#0000FF"></FONT><FONT SIZE="2"><B>5. NO WARRANTY</B></FONT> +<P><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is</FONT><FONT SIZE="2"> solely responsible for determining the appropriateness of using and distributing </FONT><FONT SIZE="2">the Program</FONT><FONT SIZE="2"> and assumes all risks associated with its exercise of rights under this Agreement</FONT><FONT SIZE="2">, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, </FONT><FONT SIZE="2">programs or equipment, and unavailability or interruption of operations</FONT><FONT SIZE="2">. </FONT><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2"><B>6. DISCLAIMER OF LIABILITY</B></FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES </FONT><FONT SIZE="2">(INCLUDING WITHOUT LIMITATION LOST PROFITS),</FONT><FONT SIZE="2"> HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"><B>7. GENERAL</B></FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2">If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.</FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. </FONT><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. </FONT><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2">Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to </FONT><FONT SIZE="2">publish new versions (including revisions) of this Agreement from time to </FONT><FONT SIZE="2">time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. </FONT><FONT SIZE="2">Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new </FONT><FONT SIZE="2">version. </FONT><FONT SIZE="2">Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, </FONT><FONT SIZE="2">by implication, estoppel or otherwise</FONT><FONT SIZE="2">.</FONT><FONT SIZE="2"> All rights in the Program not expressly granted under this Agreement are reserved.</FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.</FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"></FONT> + +</BODY> + +</HTML> \ No newline at end of file Property changes on: trunk/lib/LICENSE-junit-4.1.jar ___________________________________________________________________ Name: svn:mime-type + text/html Name: svn:eol-style + LF Added: trunk/lib/LICENSE-log4j-1.2.13.jar =================================================================== --- trunk/lib/LICENSE-log4j-1.2.13.jar (rev 0) +++ trunk/lib/LICENSE-log4j-1.2.13.jar 2006-07-30 16:12:18 UTC (rev 236) @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 1999-2005 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. Property changes on: trunk/lib/LICENSE-log4j-1.2.13.jar ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/lib/junit-4.1.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/junit-4.1.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/lib/log4j-1.2.13.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/log4j-1.2.13.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-07-07 08:29:48
|
Revision: 235 Author: akirschbaum Date: 2006-07-07 01:29:34 -0700 (Fri, 07 Jul 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=235&view=rev Log Message: ----------- Fix spelling errors (comments and identifiers). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/daimonin/src/daieditor/CArchPanelPan.java trunk/daimonin/src/daieditor/arch/ArchObjectStack.java Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-07-05 22:05:43 UTC (rev 234) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-07-07 08:29:34 UTC (rev 235) @@ -191,7 +191,7 @@ /** * this is only needed when arche collection is run, so we want - * to know to which cathegorys the arches belong to: + * to know to which categories the arches belong to: * @return an array of nodenumbers from all arches in this panel */ public int[] getListNodeNrArray() { @@ -207,23 +207,23 @@ /** * this is only needed when arche collection is run, so we want - * to know to which cathegorys the arches belong to: - * @return an array of the cathegorys of all arches in this panel<br> + * to know to which categories the arches belong to: + * @return an array of the categories of all arches in this panel<br> * note that the same indices are used for same arches in 'getListNodeNrArray()' */ - public String[] getListCathegoryArray() { - final String[] cathList = new String[(int) (list.length() / 10.0)]; + public String[] getListCategoryArray() { + final String[] catList = new String[(int) (list.length() / 10.0)]; for (int i = 0; i < (int) (list.length() / 10.0); i++) { try { final int index = Integer.parseInt(list.substring(5 + 10 * i, 10 + 10 * i)); - cathList[i] = jbox.getItemAt(index).toString().trim(); + catList[i] = jbox.getItemAt(index).toString().trim(); } catch (final NullPointerException e) { - LOG.warn("Nullpointer in getListCathegoryArray()!", e); + LOG.warn("Nullpointer in getListCategoryArray()!", e); } } - return cathList; + return catList; } void refresh() { Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-07-05 22:05:43 UTC (rev 234) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-07-07 08:29:34 UTC (rev 235) @@ -216,10 +216,10 @@ boolean animflag = false; boolean parsearch = false; boolean archmore = false; - String oldCath = "<xxx>"; - boolean isNewCathegory = true; + String oldCat = "<xxx>"; + boolean isNewCategory = true; int firstArch = -1; - String newCath = "no cathegory info"; + String newCat = "no category info"; int archmoreCount = 0; while (thisLine2 != null) { final String thisLine = thisLine2.trim(); @@ -314,13 +314,13 @@ mainControl.addArchPanelArch(mainControl.getArchCount(), index); } else { // loading from collected files, so we need process panels here - if (isNewCathegory) { - String folder = newCath; // main folder of new cath - if (newCath.indexOf("/") > 0) { - folder = newCath.substring(0, newCath.indexOf("/")); + if (isNewCategory) { + String folder = newCat; // main folder of new category + if (newCat.indexOf("/") > 0) { + folder = newCat.substring(0, newCat.indexOf("/")); } - if (!oldCath.startsWith(folder)) { + if (!oldCat.startsWith(folder)) { // an entire new panel must be opened mainControl.addArchPanel(folder); mainControl.addArchPanelCombo("show all"); @@ -328,11 +328,11 @@ index = 1; } - if (newCath.indexOf("/") > 0) { - folder = newCath.substring(newCath.indexOf("/") + 1); - if (newCath.startsWith(folder)) { + if (newCat.indexOf("/") > 0) { + folder = newCat.substring(newCat.indexOf("/") + 1); + if (newCat.startsWith(folder)) { index = 1; // add to the base folder - } else if (!oldCath.endsWith(folder)) { + } else if (!oldCat.endsWith(folder)) { // a new JComboBox must be added index = mainControl.addArchPanelCombo(folder); } @@ -340,8 +340,8 @@ index = 1; // add to the base folder } - isNewCathegory = false; - oldCath = newCath; + isNewCategory = false; + oldCat = newCat; } mainControl.addArchPanelArch(mainControl.getArchCount(), index); } @@ -423,10 +423,10 @@ arch.setFaceFlag(false); // we HAVE a face arch.setFaceName(thisLine.substring(x, thisLine.length())); } else if (thisLine.startsWith("editor_folder ")) { - // the display cathegory (= "folder" the arch belongs to) - newCath = thisLine.substring(14).trim(); - if (!newCath.equals(oldCath)) { - isNewCathegory = true; // this arch has a new cathegory + // the display category (= "folder" the arch belongs to) + newCat = thisLine.substring(14).trim(); + if (!newCat.equals(oldCat)) { + isNewCategory = true; // this arch has a new category } } else if (IGUIConstants.isoView && thisLine.startsWith("mpart_id ")) { // shape ID for multiparts Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-07-05 22:05:43 UTC (rev 234) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-07-07 08:29:34 UTC (rev 235) @@ -629,7 +629,7 @@ /** * Collect the existing arches and create archive-files for editor use as * well as the Crossfire server. The arches also get a special path - * variable included which is used in the editor to cathegorize the arches. + * variable included which is used in the editor to categorize the arches. * <p/> Output is: "archetypes", "crossfire.png" */ private void collectCFArches() { @@ -661,13 +661,13 @@ int count = 0; // count how much arches we've collected // loop through all existing ArchPanels and find all arches - // along with their display-cathegory + // along with their display-category ArchObject arch; for (CArchPanel.PanelNode node = CArchPanel.getStartPanelNode(); node != null; node = node.next) { final int[] numList = node.data.getListNodeNrArray(); // list of nodenumbers - final String[] cathList = node.data.getListCathegoryArray(); // list of cath. strings + final String[] catList = node.data.getListCategoryArray(); // list of category strings int multiparts = 0; @@ -692,8 +692,8 @@ binFile.writeBytes("type " + arch.getArchTypNr() + "\n"); } - // special: add a string-attribute with the display-cathegory - binFile.writeBytes("editor_folder " + node.getTitle() + "/" + cathList[i] + "\n"); + // special: add a string-attribute with the display-category + binFile.writeBytes("editor_folder " + node.getTitle() + "/" + catList[i] + "\n"); // add message text if (arch.getMsgText() != null && arch.getMsgText().trim().length() > 0) { @@ -741,8 +741,8 @@ binFile.writeBytes("type " + arch.getArchTypNr() + "\n"); } - // special: add a string-attribute with the display-cathegory - //binFile.writeBytes("editor_folder "+node.getTitle()+"/"+cathList[i]+"\n"); + // special: add a string-attribute with the display-category + //binFile.writeBytes("editor_folder "+node.getTitle()+"/"+catList[i]+"\n"); binFile.writeBytes(arch.getArchText()); if (arch.getArchText().lastIndexOf(0x0a) != arch.getArchText().length() - 1) { Modified: trunk/daimonin/src/daieditor/CArchPanelPan.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-07-05 22:05:43 UTC (rev 234) +++ trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-07-07 08:29:34 UTC (rev 235) @@ -203,23 +203,23 @@ /** * this is only needed when arche collection is run, so we want - * to know to which cathegorys the arches belong to: - * @return an array of the cathegorys of all arches in this panel<br> + * to know to which categories the arches belong to: + * @return an array of the categories of all arches in this panel<br> * note that the same indices are used for same arches in 'getListNodeNrArray()' */ - public String[] getListCathegoryArray() { - final String[] cathList = new String[archList.size()]; + public String[] getListCategoryArray() { + final String[] catList = new String[archList.size()]; int i = 0; for (final PanelEntry p : archList) { try { final int index = p.getIndex(); - cathList[i++] = jbox.getItemAt(index).toString().trim(); + catList[i++] = jbox.getItemAt(index).toString().trim(); } catch (final NullPointerException e) { - System.err.println("Nullpointer in getListCathegoryArray()!"); + System.err.println("Nullpointer in getListCategoryArray()!"); } } - return cathList; + return catList; } void showArchList() { Modified: trunk/daimonin/src/daieditor/arch/ArchObjectStack.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-07-05 22:05:43 UTC (rev 234) +++ trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-07-07 08:29:34 UTC (rev 235) @@ -527,7 +527,7 @@ /** * Collect the existing arches and create archive-files for editor use as * well as the Daimonin server. The arches also get a special path variable - * included which is used in the editor to cathegorize the arches. + * included which is used in the editor to categorize the arches. * <p/> * Output is: "archetypes", "daimonin.0", "animations", "bmaps" */ @@ -634,7 +634,7 @@ out.append("endmsg\n"); } - // special: add a string-attribute with the display-cathegory + // special: add a string-attribute with the display-category out.append("editor_folder ").append(arch.getEditorFolder()).append('\n'); out.append(arch.getArchText()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |