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: <aki...@us...> - 2006-12-16 11:51:59
|
Revision: 1109 http://svn.sourceforge.net/gridarta/?rev=1109&view=rev Author: akirschbaum Date: 2006-12-16 03:52:00 -0800 (Sat, 16 Dec 2006) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/map/MapControl.java Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-16 11:46:07 UTC (rev 1108) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-16 11:52:00 UTC (rev 1109) @@ -278,12 +278,11 @@ } /** - * Take the currently selected arch (from archlist or pickmap) and - * insert it to the defined spot on the currently active map. Redraw - * info is stored to 'needRedraw', no views get redrawn/updated here. - * @param pos tile-coordinates in map - * @param allowMany when true, it is possible to insert same arches - * many times. when false, only one arch of a kind can be inserted + * Take the currently selected arch (from archlist or pickmap) and insert + * it to the defined spot on the currently active map. Redraw info is + * stored to 'needRedraw', no views get redrawn/updated here. + * @param pos coordinates on map + * @param allowMany when true, it is possible to insert same arches many times * @return array of coordinates for tiles that need to be redrawn */ public Point[] insertSelArchToMap(final Point pos, final boolean allowMany) { @@ -295,6 +294,7 @@ if (!mainControl.getMainView().isPickmapActive() || isPickmap() || (newarch != null && newarch.isArchetype())) { // insert default arch from archlist: + mapModel.beginTransaction("Insert"); // TODO: I18N/L10N if (!addArchToMap(mainControl.getPanelArchName(), pos, allowMany, MapModel.JOIN_ENABLE)) { // mainControl.getMainView().mapPanel.setMapArchList(null); // Toolkit.getDefaultToolkit().beep(); @@ -306,13 +306,14 @@ needRedraw = calcArchRedraw(newarch); } } + mapModel.endTransaction(); } else { // insert custom arch from the pickmap: if (newarch != null) { boolean insertAllowed = true; // are we allowed to insert this? if (!allowMany) { // check if there is already an arch of that kind - for (final GameObject t : getMapModel().getMapSquare(pos)) { + for (final GameObject t : mapModel.getMapSquare(pos)) { if (t.getArchetypeName().equals(newarch.getArchetypeName()) && t.getArchTypNr() == newarch.getArchTypNr()) { insertAllowed = false; // there's a match - don't insert a second one } Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-12-16 11:46:07 UTC (rev 1108) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-12-16 11:52:00 UTC (rev 1109) @@ -401,19 +401,19 @@ /** * Take the currently selected arch (from archlist or pickmap) and insert * it to the defined spot on the currently active map. Redraw info is - * stored to 'need_redraw', no views get redrawn/updated here. - * @param p Coordinates on map + * stored to 'needRedraw', no views get redrawn/updated here. + * @param pos coordinates on map * @param allowMany when true, it is possible to insert same arches many times */ - public void insertSelArchToMap(final Point p, final boolean allowMany) { + public void insertSelArchToMap(final Point pos, final boolean allowMany) { // this is the arch that would get inserted from pickmap, but it also could // be a default arch (when pickmap has no selection) GameObject newarch = CopyBuffer.getRandomMapArch(CPickmapPanel.getInstance().getCurrentPickmap(), 100); - if (!mainControl.getMainView().isPickmapActive() || isPickmap() || newarch != null && newarch.isArchetype()) { + if (!mainControl.getMainView().isPickmapActive() || isPickmap() || (newarch != null && newarch.isArchetype())) { // insert default arch from archlist: mapModel.beginTransaction("Insert"); // TODO: I18N/L10N - if (!mapModel.addArchToMap(mainControl.getPanelArchName(), p, allowMany, false)) { + if (!mapModel.addArchToMap(mainControl.getPanelArchName(), pos, allowMany, false)) { // todo } mapModel.endTransaction(); @@ -423,7 +423,7 @@ boolean insertAllowed = true; // are we allowed to insert this? if (!allowMany) { // check if there is already an arch of that kind - for (final GameObject t : mapModel.getMapSquare(p)) { + for (final GameObject t : mapModel.getMapSquare(pos)) { if (t.hasSameArchetype(newarch) || t.getArchTypNr() == newarch.getArchTypNr()) { insertAllowed = false; // there's a match - don't insert a second one } @@ -433,17 +433,17 @@ if (insertAllowed) { if (!newarch.isMulti()) { // insert single tile from pickmap - newarch = newarch.createClone(p.x, p.y); + newarch = newarch.createClone(pos.x, pos.y); mapModel.addGameObjectToMap(newarch, false); } else { // insert multi tile from pickmap: newarch = newarch.getHead(); // first insert default arch from archlist - if (!mapModel.addArchToMap(newarch.getArchetypeName(), p, allowMany, false)) { + if (!mapModel.addArchToMap(newarch.getArchetypeName(), pos, allowMany, false)) { // do nothing } else { // insertion successful, now get redraw info - final GameObject newdef = mapModel.getMapSquare(p).getLast(); + final GameObject newdef = mapModel.getMapSquare(pos).getLast(); if (newdef != null) { // now we've got the inserted arch, copy the custom stuff from pickmap newdef.setObjectText(newarch.getObjectText()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 11:46:08
|
Revision: 1108 http://svn.sourceforge.net/gridarta/?rev=1108&view=rev Author: akirschbaum Date: 2006-12-16 03:46:07 -0800 (Sat, 16 Dec 2006) Log Message: ----------- Move functions to MapControl. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/MapViewIFrame.java trunk/crossfire/src/cfeditor/map/MapControl.java Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-16 11:16:16 UTC (rev 1107) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-16 11:46:07 UTC (rev 1108) @@ -348,73 +348,6 @@ } /** - * Determine which map-squares need to be redrawn after inserting/deleting - * the given GameObject. - * @param gameObject the gameObject that is inserted or deleted - * @return a <code>Point</code> array containing the coords of the tiles - * which need to be redrawn - */ - @Nullable Point[] calcArchRedraw(GameObject gameObject) { - if (gameObject == null) { // safety check - return null; - } - - final Point[] redraw; // return value (coords needing redraw) - - if (mainControl.isAutoJoin() && gameObject.getArchetype().getJoinList() != null) { - // this gameObject does autojoining: - - // first look how many we need - int num = 1; - if (mapControl.isPointValid(new Point(gameObject.getMapX() + 1, gameObject.getMapY()))) { - num++; - } - if (mapControl.isPointValid(new Point(gameObject.getMapX(), gameObject.getMapY() + 1))) { - num++; - } - if (mapControl.isPointValid(new Point(gameObject.getMapX() - 1, gameObject.getMapY()))) { - num++; - } - if (mapControl.isPointValid(new Point(gameObject.getMapX(), gameObject.getMapY() - 1))) { - num++; - } - - // now get the coordinates - redraw = new Point[num]; // create instance of needed size - redraw[--num] = new Point(gameObject.getMapX(), gameObject.getMapY()); // center square - if (mapControl.isPointValid(new Point(gameObject.getMapX() + 1, gameObject.getMapY()))) { - redraw[--num] = new Point(gameObject.getMapX() + 1, gameObject.getMapY()); - } - if (mapControl.isPointValid(new Point(gameObject.getMapX(), gameObject.getMapY() + 1))) { - redraw[--num] = new Point(gameObject.getMapX(), gameObject.getMapY() + 1); - } - if (mapControl.isPointValid(new Point(gameObject.getMapX() - 1, gameObject.getMapY()))) { - redraw[--num] = new Point(gameObject.getMapX() - 1, gameObject.getMapY()); - } - if (mapControl.isPointValid(new Point(gameObject.getMapX(), gameObject.getMapY() - 1))) { - redraw[--num] = new Point(gameObject.getMapX(), gameObject.getMapY() - 1); - } - assert num == 0; - } else if (gameObject.isMulti()) { - gameObject = gameObject.getHead(); // make sure we got the head - - int num = gameObject.getMultiRefCount(); // get number of parts - redraw = new Point[num]; // create instance of needed size - for (GameObject tmp = gameObject; num > 0 && tmp != null; - num--, tmp = tmp.getMultiNext()) { - redraw[num - 1] = new Point(tmp.getMapX(), tmp.getMapY()); - } - assert num == 0; - } else { - // just an ordinary single-square gameObject - redraw = new Point[1]; - redraw[0] = new Point(gameObject.getMapX(), gameObject.getMapY()); - } - - return redraw; - } - - /** * Determine which map-squares need to be painted if the given rectangle is * to be redrawn. * @param ax map x-coords. of first corner of the rect @@ -642,7 +575,7 @@ if (temp.x == -1 || temp.y == -1) { mainControl.getMainView().setMapTileList(null, null); } else { - needRedraw = insertSelArchToMap(temp, false); + needRedraw = mapControl.insertSelArchToMap(temp, false); needMpanelUpdate[2] = true; // when dragging is done, update map panel } } @@ -669,7 +602,7 @@ } } if (tmpArch != null) { - needRedraw = calcArchRedraw(tmpArch); // get redraw info + needRedraw = mapControl.calcArchRedraw(tmpArch); // get redraw info mapControl.deleteMapArch(tmpArch, temp, false, MapModel.JOIN_ENABLE); } @@ -704,7 +637,7 @@ mapMouseRightPos.x = mapLoc.x; mapMouseRightPos.y = mapLoc.y; - needRedraw = insertSelArchToMap(mapLoc, true); + needRedraw = mapControl.insertSelArchToMap(mapLoc, true); // get name of inserted arch (this is display in status bar while dragging) @Nullable final GameObject insArch = mainControl.getArchPanelHighlight(); @@ -790,7 +723,7 @@ } } if (tmpArch != null) { - needRedraw = calcArchRedraw(tmpArch); // get redraw info + needRedraw = mapControl.calcArchRedraw(tmpArch); // get redraw info mapControl.deleteMapArch(tmpArch, mapLoc, false, MapModel.JOIN_ENABLE); // update mapArch panel @@ -800,81 +733,6 @@ } /** - * Take the currently selected arch (from archlist or pickmap) and - * insert it to the defined spot on the currently active map. Redraw - * info is stored to 'needRedraw', no views get redrawn/updated here. - * @param pos tile-coordinates in map - * @param allowMany when true, it is possible to insert same arches - * many times. when false, only one arch of a kind can be inserted - * @return array of coordinates for tiles that need to be redrawn - */ - private Point[] insertSelArchToMap(final Point pos, final boolean allowMany) { - Point[] needRedraw = null; // returned array of points which need redraw - - // this is the arch that would get inserted from pickmap, but it also could - // be a default arch (when pickmap has no selection) - GameObject newarch = mainControl.getArchPanelHighlight(); - - if (!mainControl.getMainView().isPickmapActive() || mapControl.isPickmap() || (newarch != null && newarch.isArchetype())) { - // insert default arch from archlist: - if (!mapControl.addArchToMap(mainControl.getPanelArchName(), pos, allowMany, MapModel.JOIN_ENABLE)) { - // mainControl.getMainView().mapPanel.setMapArchList(null); - // Toolkit.getDefaultToolkit().beep(); - } else { - // insertion successful, now get redraw info - newarch = mapControl.getTopArchObject(pos); - if (newarch != null) { - // now we've got the inserted arch - needRedraw = calcArchRedraw(newarch); - } - } - } else { - // insert custom arch from the pickmap: - if (newarch != null) { - boolean insertAllowed = true; // are we allowed to insert this? - if (!allowMany) { - // check if there is already an arch of that kind - for (final GameObject t : mapControl.getMapModel().getMapSquare(pos)) { - if (t.getArchetypeName().equals(newarch.getArchetypeName()) && t.getArchTypNr() == newarch.getArchTypNr()) { - insertAllowed = false; // there's a match - don't insert a second one - } - } - } - - if (insertAllowed) { - if (!newarch.isMulti()) { - // insert single tile from pickmap - newarch = newarch.createClone(pos.x, pos.y); - mapControl.addArchObjectToMap(newarch); - needRedraw = calcArchRedraw(newarch); - } else { - // insert multi tile from pickmap: - newarch = newarch.getHead(); - // first insert default arch from archlist - if (!mapControl.addArchToMap(newarch.getArchetypeName(), pos, allowMany, MapModel.JOIN_DISABLE)) { - // do nothing - } else { - // insertion successful, now get redraw info - final GameObject newdef = mapControl.getTopArchObject(pos); // new inserted default arch - if (newdef != null) { - // now we've got the inserted arch, copy the custom stuff from pickmap - newdef.setObjectText(newarch.getObjectText()); - newdef.setObjName(newarch.getObjName()); - newdef.resetMsgText(); - newdef.addMsgText(newarch.getMsgText()); - - needRedraw = calcArchRedraw(newdef); - } - } - } - } - } - } - - return needRedraw; - } - - /** * This method is only called for pickmaps. Take the currently * highlighted arch on the map (if any) and insert it on this pickmap. * Redraw info is stored to 'needRedraw', no views get redrawn/updated @@ -895,7 +753,7 @@ // insert single tile from pickmap newarch = newarch.createClone(pos.x, pos.y); mapControl.addArchObjectToMap(newarch); - needRedraw = calcArchRedraw(newarch); + needRedraw = mapControl.calcArchRedraw(newarch); } else { // insert multi tile from pickmap: newarch = newarch.getHead(); @@ -924,7 +782,7 @@ newdef.resetMsgText(); newdef.addMsgText(newarch.getMsgText()); - needRedraw = calcArchRedraw(newdef); + needRedraw = mapControl.calcArchRedraw(newdef); } } } Modified: trunk/crossfire/src/cfeditor/MapViewIFrame.java =================================================================== --- trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-12-16 11:16:16 UTC (rev 1107) +++ trunk/crossfire/src/cfeditor/MapViewIFrame.java 2006-12-16 11:46:07 UTC (rev 1108) @@ -194,10 +194,6 @@ view.setMapAndArchPosition(gameObject, pos); } - Point[] calcArchRedraw(final GameObject 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); } Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-16 11:16:16 UTC (rev 1107) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-12-16 11:46:07 UTC (rev 1108) @@ -34,6 +34,7 @@ import java.util.List; import net.sf.gridarta.Size2D; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * The <code>MapControl</code>. @@ -277,6 +278,148 @@ } /** + * Take the currently selected arch (from archlist or pickmap) and + * insert it to the defined spot on the currently active map. Redraw + * info is stored to 'needRedraw', no views get redrawn/updated here. + * @param pos tile-coordinates in map + * @param allowMany when true, it is possible to insert same arches + * many times. when false, only one arch of a kind can be inserted + * @return array of coordinates for tiles that need to be redrawn + */ + public Point[] insertSelArchToMap(final Point pos, final boolean allowMany) { + Point[] needRedraw = null; // returned array of points which need redraw + + // this is the arch that would get inserted from pickmap, but it also could + // be a default arch (when pickmap has no selection) + GameObject newarch = mainControl.getArchPanelHighlight(); + + if (!mainControl.getMainView().isPickmapActive() || isPickmap() || (newarch != null && newarch.isArchetype())) { + // insert default arch from archlist: + if (!addArchToMap(mainControl.getPanelArchName(), pos, allowMany, MapModel.JOIN_ENABLE)) { + // mainControl.getMainView().mapPanel.setMapArchList(null); + // Toolkit.getDefaultToolkit().beep(); + } else { + // insertion successful, now get redraw info + newarch = getTopArchObject(pos); + if (newarch != null) { + // now we've got the inserted arch + needRedraw = calcArchRedraw(newarch); + } + } + } else { + // insert custom arch from the pickmap: + if (newarch != null) { + boolean insertAllowed = true; // are we allowed to insert this? + if (!allowMany) { + // check if there is already an arch of that kind + for (final GameObject t : getMapModel().getMapSquare(pos)) { + if (t.getArchetypeName().equals(newarch.getArchetypeName()) && t.getArchTypNr() == newarch.getArchTypNr()) { + insertAllowed = false; // there's a match - don't insert a second one + } + } + } + + if (insertAllowed) { + if (!newarch.isMulti()) { + // insert single tile from pickmap + newarch = newarch.createClone(pos.x, pos.y); + addArchObjectToMap(newarch); + needRedraw = calcArchRedraw(newarch); + } else { + // insert multi tile from pickmap: + newarch = newarch.getHead(); + // first insert default arch from archlist + if (!addArchToMap(newarch.getArchetypeName(), pos, allowMany, MapModel.JOIN_DISABLE)) { + // do nothing + } else { + // insertion successful, now get redraw info + final GameObject newdef = getTopArchObject(pos); // new inserted default arch + if (newdef != null) { + // now we've got the inserted arch, copy the custom stuff from pickmap + newdef.setObjectText(newarch.getObjectText()); + newdef.setObjName(newarch.getObjName()); + newdef.resetMsgText(); + newdef.addMsgText(newarch.getMsgText()); + + needRedraw = calcArchRedraw(newdef); + } + } + } + } + } + } + + return needRedraw; + } + + /** + * Determine which map-squares need to be redrawn after inserting/deleting + * the given GameObject. + * @param gameObject the gameObject that is inserted or deleted + * @return a <code>Point</code> array containing the coords of the tiles + * which need to be redrawn + */ + @Nullable public Point[] calcArchRedraw(GameObject gameObject) { + if (gameObject == null) { // safety check + return null; + } + + final Point[] redraw; // return value (coords needing redraw) + + if (mainControl.isAutoJoin() && gameObject.getArchetype().getJoinList() != null) { + // this gameObject does autojoining: + + // first look how many we need + int num = 1; + if (isPointValid(new Point(gameObject.getMapX() + 1, gameObject.getMapY()))) { + num++; + } + if (isPointValid(new Point(gameObject.getMapX(), gameObject.getMapY() + 1))) { + num++; + } + if (isPointValid(new Point(gameObject.getMapX() - 1, gameObject.getMapY()))) { + num++; + } + if (isPointValid(new Point(gameObject.getMapX(), gameObject.getMapY() - 1))) { + num++; + } + + // now get the coordinates + redraw = new Point[num]; // create instance of needed size + redraw[--num] = new Point(gameObject.getMapX(), gameObject.getMapY()); // center square + if (isPointValid(new Point(gameObject.getMapX() + 1, gameObject.getMapY()))) { + redraw[--num] = new Point(gameObject.getMapX() + 1, gameObject.getMapY()); + } + if (isPointValid(new Point(gameObject.getMapX(), gameObject.getMapY() + 1))) { + redraw[--num] = new Point(gameObject.getMapX(), gameObject.getMapY() + 1); + } + if (isPointValid(new Point(gameObject.getMapX() - 1, gameObject.getMapY()))) { + redraw[--num] = new Point(gameObject.getMapX() - 1, gameObject.getMapY()); + } + if (isPointValid(new Point(gameObject.getMapX(), gameObject.getMapY() - 1))) { + redraw[--num] = new Point(gameObject.getMapX(), gameObject.getMapY() - 1); + } + assert num == 0; + } else if (gameObject.isMulti()) { + gameObject = gameObject.getHead(); // make sure we got the head + + int num = gameObject.getMultiRefCount(); // get number of parts + redraw = new Point[num]; // create instance of needed size + for (GameObject tmp = gameObject; num > 0 && tmp != null; + num--, tmp = tmp.getMultiNext()) { + redraw[num - 1] = new Point(tmp.getMapX(), tmp.getMapY()); + } + assert num == 0; + } else { + // just an ordinary single-square gameObject + redraw = new Point[1]; + redraw[0] = new Point(gameObject.getMapX(), gameObject.getMapY()); + } + + return redraw; + } + + /** * Repaints the view. */ public void repaint() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 11:16:17
|
Revision: 1107 http://svn.sourceforge.net/gridarta/?rev=1107&view=rev Author: akirschbaum Date: 2006-12-16 03:16:16 -0800 (Sat, 16 Dec 2006) Log Message: ----------- Use MapGrid for DefaultLevelRenderer. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-16 10:43:28 UTC (rev 1106) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-12-16 11:16:16 UTC (rev 1107) @@ -27,7 +27,6 @@ import cfeditor.gameobject.GameObject; import cfeditor.gui.MapView; import cfeditor.gui.map.DefaultLevelRenderer; -import cfeditor.gui.map.LevelRenderer; import cfeditor.map.MapControl; import cfeditor.map.MapModel; import java.awt.Dimension; @@ -46,6 +45,7 @@ import javax.swing.ScrollPaneConstants; import net.sf.gridarta.EditOperation; import net.sf.gridarta.Size2D; +import net.sf.gridarta.gui.map.MapGrid; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -86,7 +86,7 @@ private Size2D mapSize = new Size2D(1, 1); /** The tile palette renderer. */ - private final LevelRenderer renderer; + private final DefaultLevelRenderer renderer; private boolean changed = false; @@ -103,6 +103,8 @@ private final boolean[] needMpanelUpdate; // indicates that the mapArchPanel needs + private MapGrid mapGrid; + // interface for the mapview frame private final MapView frame; @@ -119,6 +121,7 @@ super(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); this.mapControl = mapControl; this.mainControl = mainControl; + mapGrid = new MapGrid(mapControl.getMapModel().getMapSize()); frame = fi; highlightOn = false; @@ -136,7 +139,7 @@ if (isPickmap()) { setBackground(IGUIConstants.BG_COLOR); } - renderer = new DefaultLevelRenderer(this, mainControl, mapControl, isPickmap()); + renderer = new DefaultLevelRenderer(this, mainControl, mapControl, isPickmap(), mapGrid); setViewportView(renderer); getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); @@ -157,6 +160,7 @@ renderer.addMouseMotionListener(mainControl.getMainView().getStatusBar()); } renderer.updateLookAndFeel(); + mapGrid.addMapGridListener(renderer); } public boolean isChanged() { Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-16 10:43:28 UTC (rev 1106) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-16 11:16:16 UTC (rev 1107) @@ -49,6 +49,9 @@ import javax.swing.ImageIcon; import javax.swing.JComponent; import net.sf.gridarta.Size2D; +import net.sf.gridarta.gui.map.MapGrid; +import net.sf.gridarta.gui.map.MapGridEvent; +import net.sf.gridarta.gui.map.MapGridListener; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -58,7 +61,7 @@ * Flat version. * @author unknown (probably Ragnor) */ -public final class DefaultLevelRenderer extends LevelRenderer { +public final class DefaultLevelRenderer extends LevelRenderer implements MapGridListener { private static final Logger log = Logger.getLogger(DefaultLevelRenderer.class); @@ -97,17 +100,24 @@ private final AffineTransform renderTransform; + private Size2D mapSize = new Size2D(1, 1); + + private final MapGrid mapGrid; + /** * Creates a DefaultLevelRenderer. * @param mapViewBasic MapView to render. * @param mainControl MainControl, used for getting icons and similar. * @param mapControl MapControl of the map to render. * @param pickmap <code>true</code> if the rendered map is a pickmap, otherwise <code>false</code> + * @param mapGrid Grid to render. */ - public DefaultLevelRenderer(final CMapViewBasic mapViewBasic, final CMainControl mainControl, final MapControl mapControl, final boolean pickmap) { + public DefaultLevelRenderer(final CMapViewBasic mapViewBasic, final CMainControl mainControl, final MapControl mapControl, final boolean pickmap, final MapGrid mapGrid) { this.mapViewBasic = mapViewBasic; this.mainControl = mainControl; this.mapControl = mapControl; + mapSize = mapControl.getMapModel().getMapSize(); + this.mapGrid = mapGrid; final AttributeFilter af = new AttributeFilter(); af.addAttribute("no_pass", "1"); @@ -219,8 +229,8 @@ // this vector contains all heads of multi-tiles with oversized images final Vector<GameObject> oversizedMultiHeads = new Vector<GameObject>(); final CFilterControl filter = mainControl.getFilterControl(); - for (int y = 0; y < mapViewBasic.getMapSize().getHeight(); y++) { - for (int x = 0; x < mapViewBasic.getMapSize().getWidth(); x++) { + for (int y = 0; y < mapGrid.getSize().getHeight(); y++) { + for (int x = 0; x < mapGrid.getSize().getWidth(); x++) { filter.newSquare(); if (!mapControl.getMapModel().containsArchObject(new Point(x, y))) { // empty square @@ -276,18 +286,18 @@ // grid lines if (mapViewBasic.isGridVisible() && !isSnapshot) { - for (int x = 0; x <= mapViewBasic.getMapSize().getWidth(); x++) { + for (int x = 0; x <= mapGrid.getSize().getWidth(); x++) { grfx.drawLine( x * 32 + borderOffset, borderOffset, x * 32 + borderOffset, - mapViewBasic.getMapSize().getHeight() * 32 + borderOffset); + mapGrid.getSize().getHeight() * 32 + borderOffset); } - for (int y = 0; y <= mapViewBasic.getMapSize().getHeight(); y++) { + for (int y = 0; y <= mapGrid.getSize().getHeight(); y++) { grfx.drawLine( borderOffset, y * 32 + borderOffset, - mapViewBasic.getMapSize().getWidth() * 32 + borderOffset, + mapGrid.getSize().getWidth() * 32 + borderOffset, y * 32 + borderOffset); } } @@ -487,6 +497,17 @@ return new Point(xm, ym); } + /** {@inheritDoc} */ + public void mapGridChanged(@NotNull final MapGridEvent e) { + repaint(); + } + + /** {@inheritDoc} */ + public void mapGridResized(@NotNull final MapGridEvent e) { + mapSize = e.getSource().getSize(); + repaint(); + } + @Override public boolean resizeBackBuffer() { if (isPickmap) { return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 10:43:28
|
Revision: 1106 http://svn.sourceforge.net/gridarta/?rev=1106&view=rev Author: akirschbaum Date: 2006-12-16 02:43:28 -0800 (Sat, 16 Dec 2006) Log Message: ----------- Unify comments. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-16 01:19:23 UTC (rev 1105) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2006-12-16 10:43:28 UTC (rev 1106) @@ -99,12 +99,11 @@ /** * Creates a DefaultLevelRenderer. - * @param mapViewBasic MapView to render. - * @param mainControl MainControl, used e.g. for icons. - * @param mapControl MapControl of the map to render. - * @param pickmap <code>true</code> if the rendered map is a pickmap, otherwise <code>false</code> + * @param mapViewBasic MapView to render. + * @param mainControl MainControl, used for getting icons and similar. + * @param mapControl MapControl of the map to render. + * @param pickmap <code>true</code> if the rendered map is a pickmap, otherwise <code>false</code> */ - /** Constructor */ public DefaultLevelRenderer(final CMapViewBasic mapViewBasic, final CMainControl mainControl, final MapControl mapControl, final boolean pickmap) { this.mapViewBasic = mapViewBasic; this.mainControl = mainControl; Modified: trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-16 01:19:23 UTC (rev 1105) +++ trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-12-16 10:43:28 UTC (rev 1106) @@ -100,7 +100,7 @@ * Creates a DefaultLevelRenderer. * @param mainControl MainControl, used for getting icons and similar. * @param mapControl MapControl of the map to render. - * @param pickmap Set to <code>true</code> for pickmaps. + * @param pickmap <code>true</code> if the rendered map is a pickmap, otherwise <code>false</code> * @param mapGrid Grid to render. */ public DefaultLevelRenderer(final CMainControl mainControl, final MapControl mapControl, final boolean pickmap, final MapGrid mapGrid) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 01:19:23
|
Revision: 1105 http://svn.sourceforge.net/gridarta/?rev=1105&view=rev Author: akirschbaum Date: 2006-12-15 17:19:23 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Unify mnemonics. Modified Paths: -------------- trunk/daimonin/src/daieditor/messages.properties trunk/daimonin/src/daieditor/messages_de.properties Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-12-16 01:06:08 UTC (rev 1104) +++ trunk/daimonin/src/daieditor/messages.properties 2006-12-16 01:19:23 UTC (rev 1105) @@ -294,27 +294,34 @@ redo.error.text=Can''t redo clear.text=Clear +clear.mnemonic=L clear.shortdescription=Clear selection clear.longdescription=Clears the selected tiles #clear.accel=ctrl pressed DELETE clear.accel=DELETE cut.text=Cut +cut.mnemonic=U cut.accel=ctrl pressed X copy.text=Copy +copy.mnemonic=C copy.accel=ctrl pressed C paste.text=Paste +paste.mnemonic=P paste.accel=ctrl pressed V replace.text=Replace +replace.mnemonic=R replace.accel=ctrl pressed R fillAbove.text=Fill Above +fillAbove.mnemonic=A fillAbove.accel=ctrl pressed F fillBelow.text=Fill Below +fillBelow.mnemonic=B fillBelow.accel=ctrl shift pressed F randFillAbove.text=Random Fill Above @@ -324,6 +331,7 @@ randFillBelow.accel=ctrl shift pressed D selectAll.text=Select All +selectAll.mnemonic=S selectAll.accel=ctrl pressed A @@ -366,6 +374,7 @@ mapCreateView.text=Create View mapProperties.text=Map Properties +mapProperties.mnemonic=M mapProperties.accel=ctrl pressed M ####### Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2006-12-16 01:06:08 UTC (rev 1104) +++ trunk/daimonin/src/daieditor/messages_de.properties 2006-12-16 01:19:23 UTC (rev 1105) @@ -190,7 +190,7 @@ open.text=\xD6ffnen... open.shortdescription=\xD6ffne eine Karte open.longdescription=L\xE4dt eine Karte aus einer Datei -open.mnemonic=O +open.mnemonic=F open.accel=ctrl pressed O open.error.text=Fehler beim Laden @@ -238,7 +238,8 @@ exit.text=Beenden exit.shortdescription=Programm beenden exit.longdescription=Beendet das Programm -exit.mnemonic=X +exit.mnemonic=B +exit.accel=ctrl pressed Q ####### @@ -250,39 +251,46 @@ undo.text=R\xFCckg\xE4ngig undo.shortdescription=Letze \xC4nderung r\xFCckg\xE4ngig undo.longdescription=Macht die letzte \xC4nderung r\xFCckg\xE4ngig, falls m\xF6glich -undo.mnemonic=U +undo.mnemonic=R undo.accel=ctrl pressed Z undo.error.text=Kann \xC4nderung nicht r\xFCckg\xE4ngig machen. redo.text=Wiederherstellen redo.shortdescription=Letztes R\xFCckg\xE4ngig wiederherstellen redo.longdescription=Stellt die zuletzt r\xFCckg\xE4ngig gemachte \xC4nderung wieder her. -redo.mnemonic=R +redo.mnemonic=W redo.accel=ctrl pressed Y redo.error.text=Kann \xC4nderung nicht widerherstellen. clear.text=L\xF6schen +clear.mnemonic=L clear.shortdescription=Auswahl l\xF6schen clear.longdescription=L\xF6scht den ausgew\xE4hlten Bereich. #clear.accel=ctrl pressed DELETE clear.accel=DELETE cut.text=Ausschneiden +cut.mnemonic=A cut.accel=ctrl pressed X copy.text=Kopieren +copy.mnemonic=K copy.accel=ctrl pressed C paste.text=Einf\xFCgen +paste.mnemonic=E paste.accel=ctrl pressed V replace.text=Ersetzen +replace.mnemonic=Z replace.accel=ctrl pressed R fillAbove.text=Oben f\xFCllen +fillAbove.mnemonic=O fillAbove.accel=ctrl pressed F fillBelow.text=Unten f\xFCllen +fillBelow.mnemonic=U fillBelow.accel=ctrl shift pressed F randFillAbove.text=Zuf\xE4llig oben f\xFCllen @@ -302,7 +310,7 @@ map.mnemonic=K enterExit.text=Gehe zu Ausgang -enterExit.mnemonic=Z +enterExit.mnemonic=A enterNorthMap.text=Gehe zu Nord-Karte @@ -321,6 +329,7 @@ enterNorthWestMap.text=Gehe zu Nordwest-Karte mapProperties.text=Karteneigenschaften +mapProperties.mnemonic=K mapProperties.accel=ctrl pressed M @@ -331,22 +340,22 @@ pickmaps.mnemonic=P lockAllPickmaps.text=Alle Pickmaps sperren -lockAllPickmaps.mnemonic=L +lockAllPickmaps.mnemonic=P -addNewPickmap.text=Neue Pickmap hinzuf\xFCgen -addNewPickmap.mnemonic=N +addNewPickmap.text=Pickmap hinzuf\xFCgen +addNewPickmap.mnemonic=H closePickmap.text=Aktive Pickmap schlie\xDFen -closePickmap.mnemonic=C +closePickmap.mnemonic=S openPickmapMap.text=Aktive Pickmap als Karte \xF6ffnen -openPickmapMap.mnemonic=O +openPickmapMap.mnemonic=F savePickmap.text=Aktive Pickmap speichern savePickmap.mnemonic=S revertPickmap.text=Aktive Pickmap zur\xFCcksetzen -revertPickmap.mnemonic=R +revertPickmap.mnemonic=Z ############ @@ -359,14 +368,14 @@ collectArches.mnemonic=A collectSpells.text=Zauberspr\xFCche sammeln -collectSpells.mnemonic=S +collectSpells.mnemonic=Z reloadFaces.text=Grafiken neu laden reloadFaces.mnemonic=F reloadFaces.accel=ctrl pressed F5 viewTreasurelists.text=Schatzlisten anschauen -viewTreasurelists.mnemonic=T +viewTreasurelists.mnemonic=S ######## @@ -463,7 +472,7 @@ onlineHelp.accel=F1 about.text=\xDCber... -about.mnemonic=A +about.mnemonic=B about.title=\xDCber Gridarta about=<html><h1 align="center">Gridarta f\xFCr Daimonin</h1><p>Editor f\xFCr Daimonin MMORPG Karten und Objekte</p><table><tr><td valign="top" align="right" width="50%">Copyright \xA9 2001-2006</td><td width="50%">Michael Toennies<br>Andreas Vogl<br>Peter Plischewsky<br>Gecko<br>Christian Hujer<br>Daniel Viegas</td></tr><tr><td align="right">Java version:</td><td>{0}</td></tr><tr><td align="right">Build-Nummer:</td><td>{1}</td></tr><tr><td align="right">Build-Entwickler:</td><td>{2}</td></tr><tr><td align="right">Build-Zeit:</td><td>{3}</td></tr></table></html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 01:06:08
|
Revision: 1104 http://svn.sourceforge.net/gridarta/?rev=1104&view=rev Author: akirschbaum Date: 2006-12-15 17:06:08 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Correct message files. Modified Paths: -------------- trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2006-12-16 00:59:42 UTC (rev 1103) +++ trunk/crossfire/src/cfeditor/messages.properties 2006-12-16 01:06:08 UTC (rev 1104) @@ -67,7 +67,6 @@ # Options optionsImageSet=Image Set -optionsImageSet.shortdescription=The image set to use ####### # File Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-16 00:59:42 UTC (rev 1103) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-16 01:06:08 UTC (rev 1104) @@ -132,7 +132,7 @@ mapDarkness=Dunkelheit mapSwapTime=Swap-Zeit mapNosmooth=Ohne Bild\xFCberg\xE4ng -#mapUnique=??? +mapUnique=Permanente Karte mapResetTimeout=Reset-Zeit mapNorth=Norden mapEast=Osten @@ -162,7 +162,7 @@ mapHumidity=Luftfeuchte mapPressure=Luftdruck -#mapSkySetting=??? +mapSkySetting=Wetterbedingung mapTemperature=Temperatur mapWindDirection=Windrichtung mapWindSpeed=Windgeschwindigkeit @@ -236,6 +236,19 @@ statusNormal=Cursor x:{0,number,integer} y:{1,number,integer} statusCursorOff=Maus nicht auf Karte +# Edit +undo.text=R\xFCckg\xE4ngig +undo.shortdescription=Letze Aktion zur\xFCcknehmen +undo.longdescription=Nimmt die letzte durchgef\xFChrte Aktion zur\xFCck. +undo.mnemonic=R +undo.accel=ctrl pressed Z + +redo.text=Wiederholen +redo.shortdescription=Letze Aktion wiederholen +redo.longdescription=Wiederholt die letzte durchgef\xFChrte Aktion. +redo.mnemonic=W +redo.accel=ctrl pressed Y + ################# # Map Arch Panel @@ -277,7 +290,6 @@ optionsResScripts=Skripte optionsResScripts.shortdescription=Verzeichnis f\xFCr Scripte optionsImageSet=Image Set -optionsImageSet.shortdescription=Verwendetes Image Set zur Darstellung von Karten optionsRestart.title=Warnung optionsRestart.message=Viele Optionen erfordern einen Programmneustart, um effektiv zu werden. @@ -562,7 +574,7 @@ onlineHelp.accel=F1 about.text=\xDCber... -#about.mnemonic=\xDC +about.mnemonic=B ############ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 00:59:42
|
Revision: 1103 http://svn.sourceforge.net/gridarta/?rev=1103&view=rev Author: akirschbaum Date: 2006-12-15 16:59:42 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Change shortcut for 'undo' to CTRL+Y. Modified Paths: -------------- trunk/daimonin/src/daieditor/messages_de.properties trunk/daimonin/src/daieditor/messages_fr.properties trunk/daimonin/src/daieditor/messages_sv.properties trunk/src/app/net/sf/gridarta/messages.properties Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2006-12-16 00:47:32 UTC (rev 1102) +++ trunk/daimonin/src/daieditor/messages_de.properties 2006-12-16 00:59:42 UTC (rev 1103) @@ -258,7 +258,7 @@ redo.shortdescription=Letztes R\xFCckg\xE4ngig wiederherstellen redo.longdescription=Stellt die zuletzt r\xFCckg\xE4ngig gemachte \xC4nderung wieder her. redo.mnemonic=R -redo.accel=ctrl shift pressed Z +redo.accel=ctrl pressed Y redo.error.text=Kann \xC4nderung nicht widerherstellen. clear.text=L\xF6schen Modified: trunk/daimonin/src/daieditor/messages_fr.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_fr.properties 2006-12-16 00:47:32 UTC (rev 1102) +++ trunk/daimonin/src/daieditor/messages_fr.properties 2006-12-16 00:59:42 UTC (rev 1103) @@ -124,7 +124,7 @@ redo.shortdescription=R\xE9p\xE9ter la derni\xE8re action annul\xE9e redo.longdescription=R\xE9p\xE8te la derni\xE8re action annul\xE9e si cela est possible redo.mnemonic=R -redo.accel=ctrl shift pressed Z +redo.accel=ctrl pressed Y redo.error.text=Impossible de r\xE9p\xE9ter. clear.text=Effacer Modified: trunk/daimonin/src/daieditor/messages_sv.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_sv.properties 2006-12-16 00:47:32 UTC (rev 1102) +++ trunk/daimonin/src/daieditor/messages_sv.properties 2006-12-16 00:59:42 UTC (rev 1103) @@ -440,7 +440,7 @@ redo.shortdescription=G\xF6r om senaste \xE4ndringen redo.longdescription=G\xF6r om den senast \xE5ngrade \xE4ndringen om m\xF6jligt redo.mnemonic=R -redo.accel=ctrl shift pressed Z +redo.accel=ctrl pressed Y redo.error.text=Kan inte g\xF6ra om clear.text=Rensa Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2006-12-16 00:47:32 UTC (rev 1102) +++ trunk/src/app/net/sf/gridarta/messages.properties 2006-12-16 00:59:42 UTC (rev 1103) @@ -205,7 +205,7 @@ redo.shortdescription=Redo last undo action redo.longdescription=Redoes the last undone action if possible redo.mnemonic=R -redo.accel=ctrl shift pressed Z +redo.accel=ctrl pressed Y ################# # Map Arch Panel This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 00:47:33
|
Revision: 1102 http://svn.sourceforge.net/gridarta/?rev=1102&view=rev Author: akirschbaum Date: 2006-12-15 16:47:32 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Use ActionFactory to create HTML help text. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFArchType.java trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/daimonin/src/daieditor/messages.properties trunk/daimonin/src/daieditor/messages_de.properties Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-12-16 00:30:12 UTC (rev 1101) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-12-16 00:47:32 UTC (rev 1102) @@ -29,6 +29,7 @@ import java.util.List; import java.util.Map; import net.sf.gridarta.gameobject.ArchAttribType; +import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; import org.jdom.Attribute; import org.jdom.Element; @@ -43,6 +44,9 @@ private static final Logger log = Logger.getLogger(CFArchType.class); + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + public static final String XML_TYPE = "type"; /** Attribute Element Name. */ @@ -411,42 +415,7 @@ * @fixme my HTML is broken */ public String createHtmlDocu() { - String text = ""; // String containing the whole html text - - // write header (not displayed) - text += "<HTML>\n<HEAD>\n<META NAME=\"CFJavaEditor\" CONTENT=\"tmp\">\n<TITLE>"; - text += "Type: " + typeName; - text += "</HEAD>\n<BODY>\n"; - - text += "<H1 align=center color=navy>Type: " + typeName + "</H1>\n"; // title - - if (desc != null && desc.trim().length() > 0) { - text += "<P><H3 color=navy>Functionality of " + typeName + ":</H3>"; - text += desc.trim() + "</P>"; - } - if (use != null && use.trim().length() > 0) { - text += "<P><H3 color=navy>Notes on Usage:</H3>"; - text += use.trim() + "</P>"; - } - - /* - if (attr != null && attr.length > 0) { - // create table with attributes - text += "<br><br><TABLE BORDER>"; - for (int i = 0; i < attr.length; i++) { - if (attr[i].getDataType() != ArchAttribType.FIXED && !attr[i].getSecName().equalsIgnoreCase("general")) { - text += "<TR><B>"+attr[i].getNameNew()+":</B><br>"+attr[i].getText()+"</TR>"; - } - } - text += "</TABLE>"; - }*/ - - text += "</BODY>\n</HTML>\n"; - - if (log.isDebugEnabled()) { - log.debug(text); - } - return text; + return ACTION_FACTORY.format("arcDoc.htmlText", typeName, desc != null ? desc.trim() : "", use != null ? use.trim() : ""); } // convenience functions: Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2006-12-16 00:30:12 UTC (rev 1101) +++ trunk/crossfire/src/cfeditor/messages.properties 2006-12-16 00:47:32 UTC (rev 1102) @@ -63,6 +63,8 @@ mapTop=Top mapBottom=Bottom +arcDoc.htmlText=<html><head><meta name="CFJavaEditor" content="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">{0}</h1><h3 style="colour:navy;">Functionality of {0}:</h3><p>{1}</p><h3 style="colour:navy;">Notes on Usage:</h3><p>{2}</p></body></html> + # Options optionsImageSet=Image Set optionsImageSet.shortdescription=The image set to use Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-16 00:30:12 UTC (rev 1101) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-16 00:47:32 UTC (rev 1102) @@ -259,6 +259,8 @@ prefsRes.title=Pfade & Ressourcen prefsGUI.title=Aussehen +arcDoc.htmlText=<html><head><meta name="CFJavaEditor" content="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">{0}</h1><h3 style="colour:navy;">Funktionalität von {0}:</h3><p>{1}</p><h3 style="colour:navy;">Nutzungshinweise:</h3><p>{2}</p></body></html> + # Options optionsLanguage=Sprache Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-12-16 00:30:12 UTC (rev 1101) +++ trunk/daimonin/src/daieditor/messages.properties 2006-12-16 00:47:32 UTC (rev 1102) @@ -152,7 +152,7 @@ replaceByPickmap=pickmap -arcDoc.htmlText=<html><head><meta name="CFJavaEditor" content="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">Type: {0}</h1><h3 style="colour:navy;">Functionality of {0}</h3><p>{1}</p><h3 style="colour:navy;">Notes on Usage:</h3><p>{2}</p></body></html> +arcDoc.htmlText=<html><head><meta name="CFJavaEditor" content="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">{0}</h1><h3 style="colour:navy;">Functionality of {0}:</h3><p>{1}</p><h3 style="colour:navy;">Notes on Usage:</h3><p>{2}</p></body></html> # Options Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2006-12-16 00:30:12 UTC (rev 1101) +++ trunk/daimonin/src/daieditor/messages_de.properties 2006-12-16 00:47:32 UTC (rev 1102) @@ -134,6 +134,8 @@ replacedMany.title=Ersetzung erfolgreich replacedMany.message={0} Objekte ersetzt. +arcDoc.htmlText=<html><head><meta name="CFJavaEditor" content="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">{0}</h1><h3 style="colour:navy;">Funktionalität von {0}:</h3><p>{1}</p><h3 style="colour:navy;">Nutzungshinweise:</h3><p>{2}</p></body></html> + # Options optionsTitle=Optionen @@ -150,8 +152,6 @@ optionsCheckMaps.text=Analysiere Kartendateien bei Dateiauswahl -arcDoc.htmlText=<html><head><meta name="CFJavaEditor" content="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">Type: {0}</h1><h3 style="colour:navy;">Funktionalit\xE4t von {0}</h3><p>{1}</p><h3 style="colour:navy;">Nutzungshinweise:</h3><p>{2}</p></body></html> - #attribute dialog attribTitle=Objektattribute attribHelp.text=Hilfe This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 00:30:12
|
Revision: 1101 http://svn.sourceforge.net/gridarta/?rev=1101&view=rev Author: akirschbaum Date: 2006-12-15 16:30:12 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFArchType.java Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-12-16 00:27:38 UTC (rev 1100) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-12-16 00:30:12 UTC (rev 1101) @@ -483,12 +483,4 @@ return typeAttributes; } - public String getTypeDesc() { - return desc; - } - - public String getTypeUse() { - return use; - } - } // class CFArchType This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 00:27:38
|
Revision: 1100 http://svn.sourceforge.net/gridarta/?rev=1100&view=rev Author: akirschbaum Date: 2006-12-15 16:27:38 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/Spells.java Modified: trunk/crossfire/src/cfeditor/Spells.java =================================================================== --- trunk/crossfire/src/cfeditor/Spells.java 2006-12-16 00:21:28 UTC (rev 1099) +++ trunk/crossfire/src/cfeditor/Spells.java 2006-12-16 00:27:38 UTC (rev 1100) @@ -22,13 +22,15 @@ package cfeditor; import java.io.BufferedReader; -import java.io.BufferedWriter; import java.io.EOFException; import java.io.File; import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import javax.swing.JFileChooser; @@ -102,9 +104,6 @@ List<String> list = null; // growable array of spellnames+numbers String tmp; // tmp String for spell names - final FileWriter fileWriter; // file writer for "spells.def" - final BufferedWriter bufferedWriter; // buffered writer - if (spellfile.getName().equalsIgnoreCase("spellist.h")) { list = new ArrayList<String>(); FileReader fileReader = null; @@ -180,36 +179,36 @@ } try { - fileWriter = new FileWriter(dfile); - bufferedWriter = new BufferedWriter(fileWriter); + final PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(dfile), "utf-8")); + try { + // header: + out.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); + out.println("<spells>"); + out.println("<!--"); + out.println(" ##########################################################"); + out.println(" # You may add new spells to this file, but there's no #"); + out.println(" # need to do it because the file can be autogenerated. #"); + out.println(" # In the editor, select menu \"Resources->Collect Spells\" #"); + out.println(" # to generate a new version of this file. #"); + out.println(" ##########################################################\n-->"); - // header: - bufferedWriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"); - bufferedWriter.write("<spells>\n<!--\n"); - bufferedWriter.write(" ##########################################################\n"); - bufferedWriter.write(" # You may add new spells to this file, but there's no #\n"); - bufferedWriter.write(" # need to do it because the file can be autogenerated. #\n"); - bufferedWriter.write(" # In the editor, select menu \"Resources->Collect Spells\" #\n"); - bufferedWriter.write(" # to generate a new version of this file. #\n"); - bufferedWriter.write(" ##########################################################\n-->\n"); - - // write spell-entries: - for (final String entry : list) { - tmp = String.valueOf(entry); - final String id = tmp.substring(0, tmp.indexOf(" ")).trim(); - final String name = tmp.substring(tmp.indexOf(" ") + 1).trim(); - String space = ""; - if (id.length() == 1) { - space = " "; - } else if (id.length() == 2) { - space = " "; + // write spell-entries: + for (final String entry : list) { + tmp = String.valueOf(entry); + final String id = tmp.substring(0, tmp.indexOf(" ")).trim(); + final String name = tmp.substring(tmp.indexOf(" ") + 1).trim(); + String space = ""; + if (id.length() == 1) { + space = " "; + } else if (id.length() == 2) { + space = " "; + } + out.println(" <spell id=\"" + id + "\"" + space + " name=\"" + name + "\" />"); } - bufferedWriter.write(" <spell id=\"" + id + "\"" + space + " name=\"" + name + "\" />\n"); + out.println("</spells>"); + } finally { + out.close(); } - bufferedWriter.write("</spells>"); - - bufferedWriter.close(); - fileWriter.close(); return list.size(); } catch (final IOException e) { log.error("Cannot write file '" + dfile.getAbsolutePath() + "'!"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 00:21:28
|
Revision: 1099 http://svn.sourceforge.net/gridarta/?rev=1099&view=rev Author: akirschbaum Date: 2006-12-15 16:21:28 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/Spells.java trunk/daimonin/src/daieditor/Spells.java Modified: trunk/crossfire/src/cfeditor/Spells.java =================================================================== --- trunk/crossfire/src/cfeditor/Spells.java 2006-12-16 00:15:27 UTC (rev 1098) +++ trunk/crossfire/src/cfeditor/Spells.java 2006-12-16 00:21:28 UTC (rev 1099) @@ -164,22 +164,22 @@ // --------- now write the "spells.def" file --------- if (list != null && list.size() > 0) { - File dfile = null; - try { - // create new file for writing (replaces old one if existent) - if (IGUIConstants.CONFIG_DIR != null && IGUIConstants.CONFIG_DIR.length() > 0) { - final File dir = new File(IGUIConstants.CONFIG_DIR); - if (!dir.exists() || !dir.isDirectory()) { - // create the config dir - new File("resource").mkdir(); - new File(IGUIConstants.CONFIG_DIR).mkdir(); - } - - dfile = new File(IGUIConstants.CONFIG_DIR + File.separator + IGUIConstants.SPELL_FILE); - } else { - dfile = new File(IGUIConstants.SPELL_FILE); + final File dfile; + // create new file for writing (replaces old one if existent) + if (IGUIConstants.CONFIG_DIR != null && IGUIConstants.CONFIG_DIR.length() > 0) { + final File dir = new File(IGUIConstants.CONFIG_DIR); + if (!dir.exists() || !dir.isDirectory()) { + // create the config dir + new File("resource").mkdir(); + new File(IGUIConstants.CONFIG_DIR).mkdir(); } + dfile = new File(IGUIConstants.CONFIG_DIR + File.separator + IGUIConstants.SPELL_FILE); + } else { + dfile = new File(IGUIConstants.SPELL_FILE); + } + + try { fileWriter = new FileWriter(dfile); bufferedWriter = new BufferedWriter(fileWriter); Modified: trunk/daimonin/src/daieditor/Spells.java =================================================================== --- trunk/daimonin/src/daieditor/Spells.java 2006-12-16 00:15:27 UTC (rev 1098) +++ trunk/daimonin/src/daieditor/Spells.java 2006-12-16 00:21:28 UTC (rev 1099) @@ -137,7 +137,7 @@ // --------- now write the "spells.def" file --------- if (spells.size() > 0) { // FIXME: This should use DOM for writing the file. - File dfile; + final File dfile; // create new file for writing (replaces old one if existent) if (IGUIConstants.CONFIG_DIR != null && IGUIConstants.CONFIG_DIR.length() > 0) { final String baseDir = CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 00:15:27
|
Revision: 1098 http://svn.sourceforge.net/gridarta/?rev=1098&view=rev Author: akirschbaum Date: 2006-12-15 16:15:27 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Use log4j for logging. Modified Paths: -------------- trunk/daimonin/src/daieditor/Spells.java Modified: trunk/daimonin/src/daieditor/Spells.java =================================================================== --- trunk/daimonin/src/daieditor/Spells.java 2006-12-16 00:14:37 UTC (rev 1097) +++ trunk/daimonin/src/daieditor/Spells.java 2006-12-16 00:15:27 UTC (rev 1098) @@ -43,6 +43,7 @@ import net.sf.japi.swing.ActionFactory; import net.sf.japi.util.filter.file.FilenameFileFilter; import net.sf.japi.xml.NodeListIterator; +import org.apache.log4j.Logger; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; @@ -57,6 +58,8 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); + private static final Logger log = Logger.getLogger(Spells.class); + private String[] spellNames; // array of spell names (these all begin with a ' ' space!) private int[] spellNumbers; // array of spell numbers @@ -123,11 +126,11 @@ in.close(); } } catch (final FileNotFoundException e) { - System.err.println("File '" + spellfile.getAbsolutePath() + "' not found!"); + log.error("File '" + spellfile.getAbsolutePath() + "' not found!"); } catch (final EOFException e) { // Eventually expected exception, don't handle. } catch (final IOException e) { - System.err.println("Cannot read file '" + spellfile.getAbsolutePath() + "'!"); + log.error("Cannot read file '" + spellfile.getAbsolutePath() + "'!"); } } @@ -179,7 +182,7 @@ out.close(); } } catch (final IOException e) { - System.err.println("Cannot write file '" + dfile.getAbsolutePath() + "'!"); + log.error("Cannot write file '" + dfile.getAbsolutePath() + "'!"); } } return spells.size(); @@ -204,7 +207,7 @@ // retrieve the spell data from the xml final Element root = doc.getDocumentElement(); if (root == null || !"spells".equalsIgnoreCase(root.getNodeName())) { - System.err.println("File '" + IGUIConstants.SPELL_FILE + "' lacks root element 'spells'."); + log.warn("File '" + IGUIConstants.SPELL_FILE + "' lacks root element 'spells'."); } else { final List<String> tmpSpellNames = new ArrayList<String>(); final List<Integer> tmpSpellNumbers = new ArrayList<Integer>(); @@ -212,24 +215,24 @@ for (final Element spellElem : new NodeListIterator<Element>(root, "spell")) { if (spellElem.getAttribute("id") == null) { - System.err.println("In File '" + IGUIConstants.SPELL_FILE + "': Found 'spell' element without 'id'"); + log.warn("In File '" + IGUIConstants.SPELL_FILE + "': Found 'spell' element without 'id'"); } else if (spellElem.getAttribute("name") == null) { - System.err.println("In File '" + IGUIConstants.SPELL_FILE + "': Found 'spell' element without 'name'"); + log.warn("In File '" + IGUIConstants.SPELL_FILE + "': Found 'spell' element without 'name'"); } else { try { // parse spell number and -name tmpSpellNumbers.add(Integer.parseInt(spellElem.getAttribute("id"))); tmpSpellNames.add(spellElem.getAttribute("name").trim()); } catch (final NumberFormatException de) { - System.err.println("Parsing error in '" + IGUIConstants.SPELL_FILE + "':\n spell id '" + spellElem.getAttribute("id") + "' is not an integer."); + log.warn("Parsing error in '" + IGUIConstants.SPELL_FILE + "':\n spell id '" + spellElem.getAttribute("id") + "' is not an integer."); } } } // loading successful - System.err.println("Loaded " + tmpSpellNames.size() + " defined spells from '" + IGUIConstants.SPELL_FILE + "'"); + log.info("Loaded " + tmpSpellNames.size() + " defined spells from '" + IGUIConstants.SPELL_FILE + "'"); if (tmpSpellNames.size() == 0) { - System.err.println("File '" + IGUIConstants.SPELL_FILE + "' has no content."); + log.warn("File '" + IGUIConstants.SPELL_FILE + "' has no content."); } else { tmpSpellNames.add(0, "<none>"); tmpSpellNumbers.add(0, -1); @@ -242,9 +245,9 @@ } } } catch (final SAXException e) { - System.err.println("Parsing error in '" + IGUIConstants.SPELL_FILE + "':\n" + e.getMessage() + '\n'); + log.error("Parsing error in '" + IGUIConstants.SPELL_FILE + "':\n" + e.getMessage() + '\n'); } catch (final IOException e) { - System.err.println("Cannot read file '" + IGUIConstants.SPELL_FILE + "'!"); + log.error("Cannot read file '" + IGUIConstants.SPELL_FILE + "'!"); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 00:14:36
|
Revision: 1097 http://svn.sourceforge.net/gridarta/?rev=1097&view=rev Author: akirschbaum Date: 2006-12-15 16:14:37 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Use correct loggger name. Modified Paths: -------------- trunk/crossfire/src/cfeditor/Spells.java Modified: trunk/crossfire/src/cfeditor/Spells.java =================================================================== --- trunk/crossfire/src/cfeditor/Spells.java 2006-12-16 00:08:36 UTC (rev 1096) +++ trunk/crossfire/src/cfeditor/Spells.java 2006-12-16 00:14:37 UTC (rev 1097) @@ -53,7 +53,7 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); - private static final Logger log = Logger.getLogger(CFArchTypeList.class); + private static final Logger log = Logger.getLogger(Spells.class); private String[] spellNames; // array of spell names (these all begin with a ' ' space!) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 00:08:35
|
Revision: 1096 http://svn.sourceforge.net/gridarta/?rev=1096&view=rev Author: akirschbaum Date: 2006-12-15 16:08:36 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Unify comments and whitespace. Modified Paths: -------------- trunk/crossfire/src/cfeditor/Spells.java trunk/daimonin/src/daieditor/Spells.java Modified: trunk/crossfire/src/cfeditor/Spells.java =================================================================== --- trunk/crossfire/src/cfeditor/Spells.java 2006-12-16 00:05:22 UTC (rev 1095) +++ trunk/crossfire/src/cfeditor/Spells.java 2006-12-16 00:08:36 UTC (rev 1096) @@ -94,7 +94,7 @@ /** * Read all spells from a CF spellist file and write an - * alphabetical list into "spells.def" + * alphabetical list into "spells.def". * @param spellfile spellfile to read * @return number of successfully collected spells */ @@ -221,7 +221,7 @@ /** * Read the spells from "spells.xml" into the arrays 'spellNames' - * and 'spellNumbers'. This method is called at startup + * and 'spellNumbers'. This method is called at startup. */ public void loadSpellsFromXML() { spellNames = null; Modified: trunk/daimonin/src/daieditor/Spells.java =================================================================== --- trunk/daimonin/src/daieditor/Spells.java 2006-12-16 00:05:22 UTC (rev 1095) +++ trunk/daimonin/src/daieditor/Spells.java 2006-12-16 00:08:36 UTC (rev 1096) @@ -186,8 +186,8 @@ } /** - * Read the spells from "spells.xml" into the arrays 'spell_name' - * and 'spell_num'. This method is called at startup + * Read the spells from "spells.xml" into the arrays 'spellNames' + * and 'spellNumbers'. This method is called at startup. * @param documentBuilder Document Builder to use for parsing */ public void loadSpellsFromXML(final DocumentBuilder documentBuilder) { @@ -255,4 +255,5 @@ public int[] getSpellNumbers() { return spellNumbers; } + } // class Spells This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-16 00:05:21
|
Revision: 1095 http://svn.sourceforge.net/gridarta/?rev=1095&view=rev Author: akirschbaum Date: 2006-12-15 16:05:22 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Use ActionFactory for text messages. Modified Paths: -------------- trunk/crossfire/src/cfeditor/Spells.java trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties Modified: trunk/crossfire/src/cfeditor/Spells.java =================================================================== --- trunk/crossfire/src/cfeditor/Spells.java 2006-12-15 23:59:59 UTC (rev 1094) +++ trunk/crossfire/src/cfeditor/Spells.java 2006-12-16 00:05:22 UTC (rev 1095) @@ -84,13 +84,10 @@ final int spnum = importSpells(spellfile); if (spnum > 0) { // yeah it worked - mainControl.showMessage("Collect Spells", - "Successfully collected " + spnum + " spells."); + ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "importSpellsSuccess", spnum); } else { // spell collect failed - mainControl.showMessage("Collect Spells", - "Collecting spells failed!\n" + - "Maybe the specified file is of wrong format."); + ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "importSpellsFailed"); } } } Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2006-12-15 23:59:59 UTC (rev 1094) +++ trunk/crossfire/src/cfeditor/messages.properties 2006-12-16 00:05:22 UTC (rev 1095) @@ -28,6 +28,11 @@ enterExitNotSaved.title=Map not saved enterExitNotSaved.message=You must save the map first to follow a relative path. +importSpellsSuccess.title=Collect spells +importSpellsSuccess.message=Successfully collected {0} spells. +importSpellsFailed.title=Collect spells +importSpellsFailed.message=Collecting spells failed!\nMaybe the specified file is of wrong format. + openScriptNotFound.title=Script file not found openScriptNotFound.message=The file ''{0}'' does not exist.\nPlease correct the path. Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-15 23:59:59 UTC (rev 1094) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2006-12-16 00:05:22 UTC (rev 1095) @@ -66,6 +66,11 @@ enterExitNotSaved.title=Karte nicht gesichert enterExitNotSaved.message=Der Ausgang verwendet einen relativen Dateinamen. Um ihm zu folgen m\xFCssen Sie die Karte vorher sichern. +importSpellsSuccess.title=Zauberspr\xFCche sammeln +importSpellsSuccess.message={0} Zauberspr\xFCche geladen. +importSpellsFailed.title=Zauberspr\xFCche sammeln +importSpellsFailed.message=Das Sammeln der Zauberspr\xFCche ist fehlgeschlagen.\nEvtl. ist das Dateiformat falsch? + openScriptNotFound.title=Script-Datei nicht gefunden openScriptNotFound.message=Die Datei ''{0}'' existiert nicht.\nBitte geben sie einen g\xFCltigen Dateinamen an. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 23:59:59
|
Revision: 1094 http://svn.sourceforge.net/gridarta/?rev=1094&view=rev Author: akirschbaum Date: 2006-12-15 15:59:59 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Use JAPI for file name filter implementation. Modified Paths: -------------- trunk/crossfire/src/cfeditor/Spells.java Modified: trunk/crossfire/src/cfeditor/Spells.java =================================================================== --- trunk/crossfire/src/cfeditor/Spells.java 2006-12-15 23:54:10 UTC (rev 1093) +++ trunk/crossfire/src/cfeditor/Spells.java 2006-12-15 23:59:59 UTC (rev 1094) @@ -35,6 +35,7 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.io.IOUtils; import net.sf.japi.swing.ActionFactory; +import net.sf.japi.util.filter.file.FilenameFileFilter; import org.apache.log4j.Logger; import org.jdom.DataConversionException; import org.jdom.Document; @@ -58,6 +59,9 @@ private int[] spellNumbers; // array of spell numbers + /** File filter for filtering spellist.h files. */ + private static final FileFilter SPELLIST_H_FILE_FILTER = new FilenameFileFilter(true, "spellist.h", "spellist.h"); + /** * Opens a file chooser to select the spellist file, * then import spells. @@ -69,7 +73,7 @@ fileChooser.setDialogTitle("Open CF Spellist File"); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setMultiSelectionEnabled(false); - fileChooser.setFileFilter(new SpellFileFilter()); // apply file filter + fileChooser.setFileFilter(SPELLIST_H_FILE_FILTER); // apply file filter fileChooser.setCurrentDirectory(new File(System.getProperty("user.dir"))); final int returnVal = fileChooser.showOpenDialog(mainControl.getMainView()); @@ -303,25 +307,4 @@ return spellNumbers; } - /** FileFilter to accept only known CF spellist files. */ - static class SpellFileFilter extends FileFilter { - - SpellFileFilter() { - } - - /** - * The description of this filter. For example: "JPG and GIF Images" - * @return filter description - */ - @Override public String getDescription() { - return "spellist.h"; - } - - /** {@inheritDoc} */ - @Override public boolean accept(final File f) { - return f.isDirectory() || f.getName().equalsIgnoreCase("spellist.h"); - } - - } // class SpellFileFilter - } // class Spells This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 23:54:10
|
Revision: 1093 http://svn.sourceforge.net/gridarta/?rev=1093&view=rev Author: akirschbaum Date: 2006-12-15 15:54:10 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Move spell related code into separate class. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchAttrib.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CMainControl.java Added Paths: ----------- trunk/crossfire/src/cfeditor/Spells.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-15 23:24:28 UTC (rev 1092) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-15 23:54:10 UTC (rev 1093) @@ -339,7 +339,7 @@ // first parse the spell-number value from gameObject int spnum = gameObject.getAttributeInt(attr.getNameOld()); // spell number - if (spnum < 0 || spnum >= archTypeList.getSpellNum().length - 1) { + if (spnum < 0 || spnum >= CFArchTypeList.getSpells().getSpellNumbers().length - 1) { spnum = 0; // undefined spellnumbers be zero } @@ -350,15 +350,15 @@ } else { // now look up the spell-number in the array of spells active = 0; - for (int i = 0; i < archTypeList.getSpellNum().length; i++) { - if (archTypeList.getSpellNum()[i] == spnum) { + for (int i = 0; i < CFArchTypeList.getSpells().getSpellNumbers().length; i++) { + if (CFArchTypeList.getSpells().getSpellNumbers()[i] == spnum) { active = i; // set selection - i = archTypeList.getSpellNum().length + 10; // end loop + i = CFArchTypeList.getSpells().getSpellNumbers().length + 10; // end loop } } } - final JComboBox spellsel = new JComboBox(archTypeList.getSpellName()); // set "content" + final JComboBox spellsel = new JComboBox(CFArchTypeList.getSpells().getSpellNames()); // set "content" spellsel.setSelectedIndex(active); // set active selection spellsel.setMaximumRowCount(10); spellsel.setKeySelectionManager(new StringKeyManager(spellsel)); @@ -1200,7 +1200,7 @@ switch (dType) { case SPELL: case ZSPELL: - attrVal = archTypeList.getSpellNum()[((DialogAttrib<JComboBox>) attr).input.getSelectedIndex()]; + attrVal = CFArchTypeList.getSpells().getSpellNumbers()[((DialogAttrib<JComboBox>) attr).input.getSelectedIndex()]; break; case LIST: // get selected index of ComboBox Modified: trunk/crossfire/src/cfeditor/CFArchAttrib.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-12-15 23:24:28 UTC (rev 1092) +++ trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-12-15 23:54:10 UTC (rev 1093) @@ -188,14 +188,14 @@ } } else if ("spell".equalsIgnoreCase(atype)) { // spell attribute - if (tlist.getSpellNum() == null) { + if (CFArchTypeList.getSpells().getSpellNumbers() == null) { dataType = ArchAttribType.INT; // if we have no spells, use an INT field instead } else { dataType = ArchAttribType.SPELL; } } else if ("nz_spell".equalsIgnoreCase(atype)) { // spell attribute - if (tlist.getSpellNum() == null) { + if (CFArchTypeList.getSpells().getSpellNumbers() == null) { dataType = ArchAttribType.INT; // if we have no spells, use an INT field instead } else { dataType = ArchAttribType.ZSPELL; Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-15 23:24:28 UTC (rev 1092) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-15 23:54:10 UTC (rev 1093) @@ -26,12 +26,6 @@ import cfeditor.gameobject.GameObject; import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.EOFException; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -39,8 +33,6 @@ import java.util.List; import java.util.Map; import java.util.Iterator; -import javax.swing.JFileChooser; -import javax.swing.filechooser.FileFilter; import net.sf.gridarta.io.IOUtils; import org.apache.log4j.Logger; import org.jdom.Attribute; @@ -61,11 +53,8 @@ private final CFArchType head = new CFArchType(null); // head of CFArchType list (head contains default type) - // spell info: - private String[] spellName; // array of spell names (these all begin with a ' ' space!) + private static final Spells spells = new Spells(); - private int[] spellNum; // array of spell numbers - /** * Table with type numbers as keys (Integer), and type names as values (String). */ @@ -117,6 +106,10 @@ return arch != null && EXIT_TYPES.contains(arch.getHead().getArchTypNr()); } + public static Spells getSpells() { + return spells; + } + /** * Constructor - Parsing all the data from the xml definitions file * 'types.xml'. @@ -128,7 +121,7 @@ listTable = new HashMap<String, List<?>>(); ignoreListTable = new HashMap<String, List<String>>(); - loadSpellsFromXML(); // load spells from file + spells.loadSpellsFromXML(); // load spells from file try { // open ascii filestream to the xml data @@ -319,14 +312,6 @@ } } - public String[] getSpellName() { - return spellName; - } - - public int[] getSpellNum() { - return spellNum; - } - /** * Return the bitmask table which contains all definitions of bitmask types for arch attributes. * @return bitmask table @@ -357,116 +342,6 @@ } /** - * Read the spells from "spells.xml" into the arrays 'spellName' - * and 'spellNum'. This method is called at startup - */ - public void loadSpellsFromXML() { - spellName = null; - spellNum = null; - - try { - // open reading stream to the spells xml file - final String baseDir = IGUIConstants.CONFIG_DIR; - final BufferedReader reader = IOUtils.createReader(baseDir, IGUIConstants.SPELL_FILE); - try { - // parse xml document - final SAXBuilder builder = new SAXBuilder(); - final Document doc = builder.build(reader); - - // retrieve the spell data from the xml - final Element root = doc.getRootElement(); - Element spellElem; - if (root == null || !root.getName().equalsIgnoreCase("spells")) { - log.warn("File '" + IGUIConstants.SPELL_FILE + "' lacks root element 'spells'."); - } else { - final List spells = root.getChildren("spell"); - if (spells == null || spells.size() == 0) { - log.warn("File '" + IGUIConstants.SPELL_FILE + "' has no content."); - } else { - // initialize array with appropriate size - spellName = new String[spells.size() + 1]; - spellNum = new int[spells.size() + 1]; - - // first element is <none> - spellName[0] = " <none>"; - spellNum[0] = -1; - - int i; - int j; - for (j = 0, i = 1; j < spells.size(); j++) { - spellElem = (Element) spells.get(j); - - if (spellElem.getAttribute("id") == null) { - log.warn("In File '" + IGUIConstants.SPELL_FILE + "': Found 'spell' element without 'id'"); - } else if (spellElem.getAttribute("name") == null) { - log.warn("In File '" + IGUIConstants.SPELL_FILE + "': Found 'spell' element without 'name'"); - } else { - try { - // parse spell number and -name - spellNum[i] = spellElem.getAttribute("id").getIntValue(); - spellName[i] = spellElem.getAttribute("name").getValue().trim(); - i++; - } catch (final DataConversionException de) { - log.error("in '" + IGUIConstants.SPELL_FILE + "': spell id '" + spellElem.getAttribute("id").getValue() + "' is not an integer."); - } - } - } - - // loading successful - i--; - if (log.isInfoEnabled()) { - if (i == spells.size()) { - log.info("Loaded " + i + " spells from '" + IGUIConstants.SPELL_FILE + "'"); - } else { - log.info("Loaded " + i + " of " + spells.size() + " defined spells from '" + IGUIConstants.SPELL_FILE + "'"); - } - } - } - } - } finally { - reader.close(); - } - } catch (final JDOMException e) { - log.error("Parsing error in '" + IGUIConstants.SPELL_FILE + "'", e); - } catch (final IOException e) { - log.error("Cannot read file '" + IGUIConstants.SPELL_FILE + "'!"); - } - } - - /** - * Opens a file chooser to select the spellist file, - * then import spells. - * @param mainControl main control - */ - public void importSpellsWanted(final CMainControl mainControl) { - // open a file chooser window - final JFileChooser fileChooser = new JFileChooser(); - fileChooser.setDialogTitle("Open CF Spellist File"); - fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); - fileChooser.setMultiSelectionEnabled(false); - fileChooser.setFileFilter(new SpellFileFilter()); // apply file filter - fileChooser.setCurrentDirectory(new File(System.getProperty("user.dir"))); - - final int returnVal = fileChooser.showOpenDialog(mainControl.getMainView()); - - if (returnVal == JFileChooser.APPROVE_OPTION) { - // now import spells from selected file - final File spellfile = fileChooser.getSelectedFile(); - final int spnum = importSpells(spellfile); - if (spnum > 0) { - // yeah it worked - mainControl.showMessage("Collect Spells", - "Successfully collected " + spnum + " spells."); - } else { - // spell collect failed - mainControl.showMessage("Collect Spells", - "Collecting spells failed!\n" + - "Maybe the specified file is of wrong format."); - } - } - } - - /** * Lookup the name of an archtype. * @param typeNr type number * @return name of this type, as defined in "typenumbers.xml" @@ -476,133 +351,6 @@ } /** - * Read all spells from a CF spellist file and write an - * alphabetical list into "spells.def" - * @param spellfile spellfile to read - * @return number of successfully collected spells - */ - private int importSpells(final File spellfile) { - List<String> list = null; // growable array of spellnames+numbers - String tmp; // tmp String for spell names - - final FileWriter fileWriter; // file writer for "spells.def" - final BufferedWriter bufferedWriter; // buffered writer - - if (spellfile.getName().equalsIgnoreCase("spellist.h")) { - list = new ArrayList<String>(); - FileReader fileReader = null; - BufferedReader bufferedReader = null; - - try { - fileReader = new FileReader(spellfile.getAbsolutePath()); - bufferedReader = new BufferedReader(fileReader); - - IOUtils.readUntil(bufferedReader, "spell spells", null); - IOUtils.readUntil(bufferedReader, "{", null); - - // reading spellnames one after the other, - // this loop is terminated by an EOFException - int i; // index for insertion in the vector - for (int counter = 0; true; counter++) { - IOUtils.readUntil(bufferedReader, "{", "}"); - IOUtils.readUntil(bufferedReader, "\"", null); - String name = IOUtils.readUntil(bufferedReader, "\""); - IOUtils.readUntil(bufferedReader, "}", null); - - name = name.trim(); - // now insert this string lexographically into the vector - for (i = 0; i < list.size(); i++) { - tmp = list.get(i); - tmp = tmp.substring(tmp.indexOf(" ") + 1); - - if (name.compareTo(tmp) < 0) { - // everything okay, now insert - list.add(i, counter + " " + name); - i = list.size() + 10; // end for - } else if (name.compareTo(tmp) == 0) { - // this spell already exist in the list - i = list.size() + 10; // end for - counter--; // next loop with same counter value - } - } - - // if no insertion spot found, add to end of list - if (i < list.size() + 10) { - list.add(counter + " " + name); - } - } - } catch (final FileNotFoundException e) { - log.error("File '" + spellfile.getAbsolutePath() + "' not found!"); - } catch (final EOFException e) { - // end of file/spell struct reached - try { - fileReader.close(); - bufferedReader.close(); - } catch (final IOException ioe) { - } - } catch (final IOException e) { - log.error("Cannot read file '" + spellfile.getAbsolutePath() + "'!"); - } - } - - // --------- now write the "spells.def" file --------- - if (list != null && list.size() > 0) { - File dfile = null; - try { - // create new file for writing (replaces old one if existent) - if (IGUIConstants.CONFIG_DIR != null && IGUIConstants.CONFIG_DIR.length() > 0) { - final File dir = new File(IGUIConstants.CONFIG_DIR); - if (!dir.exists() || !dir.isDirectory()) { - // create the config dir - new File("resource").mkdir(); - new File(IGUIConstants.CONFIG_DIR).mkdir(); - } - - dfile = new File(IGUIConstants.CONFIG_DIR + File.separator + IGUIConstants.SPELL_FILE); - } else { - dfile = new File(IGUIConstants.SPELL_FILE); - } - - fileWriter = new FileWriter(dfile); - bufferedWriter = new BufferedWriter(fileWriter); - - // header: - bufferedWriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"); - bufferedWriter.write("<spells>\n<!--\n"); - bufferedWriter.write(" ##########################################################\n"); - bufferedWriter.write(" # You may add new spells to this file, but there's no #\n"); - bufferedWriter.write(" # need to do it because the file can be autogenerated. #\n"); - bufferedWriter.write(" # In the editor, select menu \"Resources->Collect Spells\" #\n"); - bufferedWriter.write(" # to generate a new version of this file. #\n"); - bufferedWriter.write(" ##########################################################\n-->\n"); - - // write spell-entries: - for (final String entry : list) { - tmp = String.valueOf(entry); - final String id = tmp.substring(0, tmp.indexOf(" ")).trim(); - final String name = tmp.substring(tmp.indexOf(" ") + 1).trim(); - String space = ""; - if (id.length() == 1) { - space = " "; - } else if (id.length() == 2) { - space = " "; - } - bufferedWriter.write(" <spell id=\"" + id + "\"" + space + " name=\"" + name + "\" />\n"); - } - bufferedWriter.write("</spells>"); - - bufferedWriter.close(); - fileWriter.close(); - return list.size(); - } catch (final IOException e) { - log.error("Cannot write file '" + dfile.getAbsolutePath() + "'!"); - } - } - - return 0; - } - - /** * Find and return the type-structure (<code>CFArchType</code>) that * matches for the given arch. This is not only a comparison between * type numbers - special type-attributes must also be dealt with. @@ -691,25 +439,4 @@ return type; } - /** FileFilter to accept only known CF spellist files. */ - static class SpellFileFilter extends FileFilter { - - SpellFileFilter() { - } - - /** - * The description of this filter. For example: "JPG and GIF Images" - * @return filter description - */ - @Override public String getDescription() { - return "spellist.h"; - } - - /** {@inheritDoc} */ - @Override public boolean accept(final File f) { - return f.isDirectory() || f.getName().equalsIgnoreCase("spellist.h"); - } - - } // class SpellFileFilter - } // class CFArchTypeList Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-15 23:24:28 UTC (rev 1092) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-15 23:54:10 UTC (rev 1093) @@ -284,7 +284,7 @@ /** Collect Spells. */ @ActionMethod public void collectSpells() { - getTypeList().importSpellsWanted(this); + Spells.importSpellsWanted(this); } /** View Treasure Lists. */ Added: trunk/crossfire/src/cfeditor/Spells.java =================================================================== --- trunk/crossfire/src/cfeditor/Spells.java (rev 0) +++ trunk/crossfire/src/cfeditor/Spells.java 2006-12-15 23:54:10 UTC (rev 1093) @@ -0,0 +1,327 @@ +/* + * Daimonin Java Editor. + * Copyright (C) 2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package cfeditor; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.EOFException; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import javax.swing.JFileChooser; +import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.io.IOUtils; +import net.sf.japi.swing.ActionFactory; +import org.apache.log4j.Logger; +import org.jdom.DataConversionException; +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.JDOMException; +import org.jdom.input.SAXBuilder; + +/** + * This class manages the spells and spell lists. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @todo move spell related stuff from CFArchTypeList to this class. + */ +public final class Spells { + + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + + private static final Logger log = Logger.getLogger(CFArchTypeList.class); + + private String[] spellNames; // array of spell names (these all begin with a ' ' space!) + + private int[] spellNumbers; // array of spell numbers + + /** + * Opens a file chooser to select the spellist file, + * then import spells. + * @param mainControl main control + */ + public static void importSpellsWanted(final CMainControl mainControl) { + // open a file chooser window + final JFileChooser fileChooser = new JFileChooser(); + fileChooser.setDialogTitle("Open CF Spellist File"); + fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + fileChooser.setMultiSelectionEnabled(false); + fileChooser.setFileFilter(new SpellFileFilter()); // apply file filter + fileChooser.setCurrentDirectory(new File(System.getProperty("user.dir"))); + + final int returnVal = fileChooser.showOpenDialog(mainControl.getMainView()); + + if (returnVal == JFileChooser.APPROVE_OPTION) { + // now import spells from selected file + final File spellfile = fileChooser.getSelectedFile(); + final int spnum = importSpells(spellfile); + if (spnum > 0) { + // yeah it worked + mainControl.showMessage("Collect Spells", + "Successfully collected " + spnum + " spells."); + } else { + // spell collect failed + mainControl.showMessage("Collect Spells", + "Collecting spells failed!\n" + + "Maybe the specified file is of wrong format."); + } + } + } + + /** + * Read all spells from a CF spellist file and write an + * alphabetical list into "spells.def" + * @param spellfile spellfile to read + * @return number of successfully collected spells + */ + private static int importSpells(final File spellfile) { + List<String> list = null; // growable array of spellnames+numbers + String tmp; // tmp String for spell names + + final FileWriter fileWriter; // file writer for "spells.def" + final BufferedWriter bufferedWriter; // buffered writer + + if (spellfile.getName().equalsIgnoreCase("spellist.h")) { + list = new ArrayList<String>(); + FileReader fileReader = null; + BufferedReader bufferedReader = null; + + try { + fileReader = new FileReader(spellfile.getAbsolutePath()); + bufferedReader = new BufferedReader(fileReader); + + IOUtils.readUntil(bufferedReader, "spell spells", null); + IOUtils.readUntil(bufferedReader, "{", null); + + // reading spellnames one after the other, + // this loop is terminated by an EOFException + int i; // index for insertion in the vector + for (int counter = 0; true; counter++) { + IOUtils.readUntil(bufferedReader, "{", "}"); + IOUtils.readUntil(bufferedReader, "\"", null); + String name = IOUtils.readUntil(bufferedReader, "\""); + IOUtils.readUntil(bufferedReader, "}", null); + + name = name.trim(); + // now insert this string lexographically into the vector + for (i = 0; i < list.size(); i++) { + tmp = list.get(i); + tmp = tmp.substring(tmp.indexOf(" ") + 1); + + if (name.compareTo(tmp) < 0) { + // everything okay, now insert + list.add(i, counter + " " + name); + i = list.size() + 10; // end for + } else if (name.compareTo(tmp) == 0) { + // this spell already exist in the list + i = list.size() + 10; // end for + counter--; // next loop with same counter value + } + } + + // if no insertion spot found, add to end of list + if (i < list.size() + 10) { + list.add(counter + " " + name); + } + } + } catch (final FileNotFoundException e) { + log.error("File '" + spellfile.getAbsolutePath() + "' not found!"); + } catch (final EOFException e) { + // end of file/spell struct reached + try { + fileReader.close(); + bufferedReader.close(); + } catch (final IOException ioe) { + } + } catch (final IOException e) { + log.error("Cannot read file '" + spellfile.getAbsolutePath() + "'!"); + } + } + + // --------- now write the "spells.def" file --------- + if (list != null && list.size() > 0) { + File dfile = null; + try { + // create new file for writing (replaces old one if existent) + if (IGUIConstants.CONFIG_DIR != null && IGUIConstants.CONFIG_DIR.length() > 0) { + final File dir = new File(IGUIConstants.CONFIG_DIR); + if (!dir.exists() || !dir.isDirectory()) { + // create the config dir + new File("resource").mkdir(); + new File(IGUIConstants.CONFIG_DIR).mkdir(); + } + + dfile = new File(IGUIConstants.CONFIG_DIR + File.separator + IGUIConstants.SPELL_FILE); + } else { + dfile = new File(IGUIConstants.SPELL_FILE); + } + + fileWriter = new FileWriter(dfile); + bufferedWriter = new BufferedWriter(fileWriter); + + // header: + bufferedWriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"); + bufferedWriter.write("<spells>\n<!--\n"); + bufferedWriter.write(" ##########################################################\n"); + bufferedWriter.write(" # You may add new spells to this file, but there's no #\n"); + bufferedWriter.write(" # need to do it because the file can be autogenerated. #\n"); + bufferedWriter.write(" # In the editor, select menu \"Resources->Collect Spells\" #\n"); + bufferedWriter.write(" # to generate a new version of this file. #\n"); + bufferedWriter.write(" ##########################################################\n-->\n"); + + // write spell-entries: + for (final String entry : list) { + tmp = String.valueOf(entry); + final String id = tmp.substring(0, tmp.indexOf(" ")).trim(); + final String name = tmp.substring(tmp.indexOf(" ") + 1).trim(); + String space = ""; + if (id.length() == 1) { + space = " "; + } else if (id.length() == 2) { + space = " "; + } + bufferedWriter.write(" <spell id=\"" + id + "\"" + space + " name=\"" + name + "\" />\n"); + } + bufferedWriter.write("</spells>"); + + bufferedWriter.close(); + fileWriter.close(); + return list.size(); + } catch (final IOException e) { + log.error("Cannot write file '" + dfile.getAbsolutePath() + "'!"); + } + } + + return 0; + } + + /** + * Read the spells from "spells.xml" into the arrays 'spellNames' + * and 'spellNumbers'. This method is called at startup + */ + public void loadSpellsFromXML() { + spellNames = null; + spellNumbers = null; + + try { + // open reading stream to the spells xml file + final String baseDir = IGUIConstants.CONFIG_DIR; + final BufferedReader reader = IOUtils.createReader(baseDir, IGUIConstants.SPELL_FILE); + try { + // parse xml document + final SAXBuilder builder = new SAXBuilder(); + final Document doc = builder.build(reader); + + // retrieve the spell data from the xml + final Element root = doc.getRootElement(); + Element spellElem; + if (root == null || !root.getName().equalsIgnoreCase("spells")) { + log.warn("File '" + IGUIConstants.SPELL_FILE + "' lacks root element 'spells'."); + } else { + final List spells = root.getChildren("spell"); + if (spells == null || spells.size() == 0) { + log.warn("File '" + IGUIConstants.SPELL_FILE + "' has no content."); + } else { + // initialize array with appropriate size + spellNames = new String[spells.size() + 1]; + spellNumbers = new int[spells.size() + 1]; + + // first element is <none> + spellNames[0] = " <none>"; + spellNumbers[0] = -1; + + int i; + int j; + for (j = 0, i = 1; j < spells.size(); j++) { + spellElem = (Element) spells.get(j); + + if (spellElem.getAttribute("id") == null) { + log.warn("In File '" + IGUIConstants.SPELL_FILE + "': Found 'spell' element without 'id'"); + } else if (spellElem.getAttribute("name") == null) { + log.warn("In File '" + IGUIConstants.SPELL_FILE + "': Found 'spell' element without 'name'"); + } else { + try { + // parse spell number and -name + spellNumbers[i] = spellElem.getAttribute("id").getIntValue(); + spellNames[i] = spellElem.getAttribute("name").getValue().trim(); + i++; + } catch (final DataConversionException de) { + log.error("in '" + IGUIConstants.SPELL_FILE + "': spell id '" + spellElem.getAttribute("id").getValue() + "' is not an integer."); + } + } + } + + // loading successful + i--; + if (log.isInfoEnabled()) { + if (i == spells.size()) { + log.info("Loaded " + i + " spells from '" + IGUIConstants.SPELL_FILE + "'"); + } else { + log.info("Loaded " + i + " of " + spells.size() + " defined spells from '" + IGUIConstants.SPELL_FILE + "'"); + } + } + } + } + } finally { + reader.close(); + } + } catch (final JDOMException e) { + log.error("Parsing error in '" + IGUIConstants.SPELL_FILE + "'", e); + } catch (final IOException e) { + log.error("Cannot read file '" + IGUIConstants.SPELL_FILE + "'!"); + } + } + + public String[] getSpellNames() { + return spellNames; + } + + public int[] getSpellNumbers() { + return spellNumbers; + } + + /** FileFilter to accept only known CF spellist files. */ + static class SpellFileFilter extends FileFilter { + + SpellFileFilter() { + } + + /** + * The description of this filter. For example: "JPG and GIF Images" + * @return filter description + */ + @Override public String getDescription() { + return "spellist.h"; + } + + /** {@inheritDoc} */ + @Override public boolean accept(final File f) { + return f.isDirectory() || f.getName().equalsIgnoreCase("spellist.h"); + } + + } // class SpellFileFilter + +} // class Spells Property changes on: trunk/crossfire/src/cfeditor/Spells.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 23:24:28
|
Revision: 1092 http://svn.sourceforge.net/gridarta/?rev=1092&view=rev Author: akirschbaum Date: 2006-12-15 15:24:28 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Rename variable names. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/daimonin/src/daieditor/CAttribDialog.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-15 22:52:33 UTC (rev 1091) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-15 23:24:28 UTC (rev 1092) @@ -114,7 +114,7 @@ private final CMainControl mainControl; // reference to the main control - private final CFArchTypeList typelist; // reference to the list of CF type-data + private final CFArchTypeList archTypeList; // reference to the list of CF type-data private List<DialogAttrib<?>> dialogAttribs = new ArrayList<DialogAttrib<?>>(); @@ -164,16 +164,16 @@ /** * Wrapper method for the constructor. * This method only creates a CAttribDialog if there's no dialog for the same gameObject already. - * @param atList the list of CF type-data + * @param archTypeList the list of CF type-data * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control */ - public static void showAttribDialog(final CFArchTypeList atList, final GameObject gameObject, final CMainControl mainControl) { + public static void showAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final CMainControl mainControl) { synchronized (dialogs) { if (dialogs.containsKey(gameObject)) { dialogs.get(gameObject).toFront(); } else { - final CAttribDialog pane = new CAttribDialog(atList, gameObject, mainControl); + final CAttribDialog pane = new CAttribDialog(archTypeList, gameObject, mainControl); final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); @@ -186,22 +186,22 @@ /** * Constructor, creates the GUI layout. - * @param atList the list of CF type-data + * @param archTypeList the list of CF type-data * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control */ - private CAttribDialog(final CFArchTypeList atList, final GameObject gameObject, final CMainControl mainControl) { + private CAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final CMainControl mainControl) { listNr = 0; this.mainControl = mainControl; // reference to the main control - typelist = atList; // reference to the typelist + this.archTypeList = archTypeList; // reference to the typelist // reference to the GameObject this.gameObject = gameObject.getHead(); archetype = this.gameObject.getArchetype(); // check if the type of the object is present in the definitions - CFArchType tmp = typelist.getHead().getNext(); + CFArchType tmp = archTypeList.getHead().getNext(); //typeNr = 0; // for invalid types, we take "type 0" type = tmp; boolean typeFound = false; @@ -256,7 +256,7 @@ } // get the type data - //type = typelist.getType(typeNr); + //type = archTypeList.getType(typeNr); // first split top-left and -right final JComponent leftPane = buildHeader(); @@ -306,10 +306,10 @@ * @return a <code>JComponent</code> with the combo box in it */ private JComponent buildTypesBox() { - final String[] namelist = new String[typelist.getLength()]; // list of typenames + final String[] namelist = new String[archTypeList.getLength()]; // list of typenames // read all type names - CFArchType tmp = typelist.getHead().getNext(); + CFArchType tmp = archTypeList.getHead().getNext(); for (int i = 0; tmp != null; tmp = tmp.getNext(), i++) { namelist[i] = " " + tmp.getTypeName(); } @@ -339,7 +339,7 @@ // first parse the spell-number value from gameObject int spnum = gameObject.getAttributeInt(attr.getNameOld()); // spell number - if (spnum < 0 || spnum >= typelist.getSpellNum().length - 1) { + if (spnum < 0 || spnum >= archTypeList.getSpellNum().length - 1) { spnum = 0; // undefined spellnumbers be zero } @@ -350,15 +350,15 @@ } else { // now look up the spell-number in the array of spells active = 0; - for (int i = 0; i < typelist.getSpellNum().length; i++) { - if (typelist.getSpellNum()[i] == spnum) { + for (int i = 0; i < archTypeList.getSpellNum().length; i++) { + if (archTypeList.getSpellNum()[i] == spnum) { active = i; // set selection - i = typelist.getSpellNum().length + 10; // end loop + i = archTypeList.getSpellNum().length + 10; // end loop } } } - final JComboBox spellsel = new JComboBox(typelist.getSpellName()); // set "content" + final JComboBox spellsel = new JComboBox(archTypeList.getSpellName()); // set "content" spellsel.setSelectedIndex(active); // set active selection spellsel.setMaximumRowCount(10); spellsel.setKeySelectionManager(new StringKeyManager(spellsel)); @@ -738,9 +738,9 @@ input = buildSpellBox(attrib); break; case LIST: - if (attrib.getMisc() != null && typelist.getListTable().containsKey(attrib.getMisc()[0])) { + if (attrib.getMisc() != null && archTypeList.getListTable().containsKey(attrib.getMisc()[0])) { // build the list from vector data - input = buildArrayBox(attrib, typelist.getListTable().get(attrib.getMisc()[0])); + input = buildArrayBox(attrib, archTypeList.getListTable().get(attrib.getMisc()[0])); } else { // error: list data is missing or corrupt cComp = new JLabel("Error: Undefined List"); @@ -765,13 +765,13 @@ newAttr = new DialogAttrib<JComboBox[]>(attrib); // create ComboBox with parsed selection final JComboBox[] inputs = new JComboBox[2]; - if (attrib.getMisc() != null && typelist.getListTable().containsKey(attrib.getMisc()[0]) && typelist.getListTable().containsKey(attrib.getMisc()[1])) { + if (attrib.getMisc() != null && archTypeList.getListTable().containsKey(attrib.getMisc()[0]) && archTypeList.getListTable().containsKey(attrib.getMisc()[1])) { // Hack to set preselected if available final int active = gameObject.getAttributeInt(nameOld); final int[] activepart = {active & 0x0F, active & 0xF0}; // build the lists from vector data for (int j = 0; j < 2; j++) { - final List<?> listData = typelist.getListTable().get(attrib.getMisc()[j]); + final List<?> listData = archTypeList.getListTable().get(attrib.getMisc()[j]); inputs[j] = buildArrayBox(attrib, listData); for (int k = 0; (double) k < listData.size() / 2.0; k++) { if ((Integer) listData.get(k << 1) == activepart[j]) { @@ -792,9 +792,9 @@ break; case BITMASK: { newAttr = new BitmaskAttrib(attrib); - if (attrib.getMisc() != null && typelist.getBitmaskTable().containsKey(attrib.getMisc()[0])) { + if (attrib.getMisc() != null && archTypeList.getBitmaskTable().containsKey(attrib.getMisc()[0])) { // fetch the bitmask data, then build the attribute panel - final CAttribBitmask bitmask = typelist.getBitmaskTable().get((String) (attrib.getMisc()[0])); + final CAttribBitmask bitmask = archTypeList.getBitmaskTable().get((String) (attrib.getMisc()[0])); ((BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr).bitmask = bitmask; cLabel = new JButton(new MaskChangeAL(attrib.getNameNew() + ":", (BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr)); final JTextArea input = new JTextArea(); @@ -1058,7 +1058,7 @@ private boolean applySettings() { final String oldArchText = gameObject.getObjectText(); // the old ArchText final String oldMsg = gameObject.getMsgText(); // old gameObject msg - final CFArchType typeStruct = typelist.getTypeOfArch(gameObject); // the type structure for this gameObject + final CFArchType typeStruct = archTypeList.getTypeOfArch(gameObject); // the type structure for this gameObject String newArchText = ""; String newName = null; @@ -1200,13 +1200,13 @@ switch (dType) { case SPELL: case ZSPELL: - attrVal = typelist.getSpellNum()[((DialogAttrib<JComboBox>) attr).input.getSelectedIndex()]; + attrVal = archTypeList.getSpellNum()[((DialogAttrib<JComboBox>) attr).input.getSelectedIndex()]; break; case LIST: // get selected index of ComboBox final int attrValTmp = ((JComboBox) attr.input).getSelectedIndex(); // fetch value according to this list entry: - attrVal = (Integer) (typelist.getListTable().get(attr.ref.getMisc()[0])).get(2 * attrValTmp); + attrVal = (Integer) (archTypeList.getListTable().get(attr.ref.getMisc()[0])).get(2 * attrValTmp); break; default: assert false; @@ -1226,8 +1226,8 @@ } break; case DBLLIST: { - final int val1 = (Integer) typelist.getListTable().get(attr.ref.getMisc()[0]).get(2 * ((JComboBox[]) attr.input)[0].getSelectedIndex()); - final int val2 = (Integer) typelist.getListTable().get(attr.ref.getMisc()[1]).get(2 * ((JComboBox[]) attr.input)[1].getSelectedIndex()); + final int val1 = (Integer) archTypeList.getListTable().get(attr.ref.getMisc()[0]).get(2 * ((JComboBox[]) attr.input)[0].getSelectedIndex()); + final int val2 = (Integer) archTypeList.getListTable().get(attr.ref.getMisc()[1]).get(2 * ((JComboBox[]) attr.input)[1].getSelectedIndex()); final int combinedVal = val1 + val2; if (archetype.getAttributeInt(attr.ref.getNameOld()) != combinedVal) { @@ -1347,7 +1347,7 @@ // deal with syntax errors now if (errors != null) { - if (typeStruct == typelist.getHead().getNext()) { + if (typeStruct == archTypeList.getHead().getNext()) { // for generic (misc) type, all errors are automatically kept. // "misc" is no real type - it is more a default mask for unknown types gameObject.addObjectText(errors.trim()); @@ -1690,7 +1690,7 @@ } else if (e.getStateChange() == ItemEvent.SELECTED && !e.getItem().equals(deselected)) { // new type was selected // first, get new type structure - final CFArchType newType = typelist.getTypeByName((String) e.getItem()); + final CFArchType newType = archTypeList.getTypeByName((String) e.getItem()); frame.typesel.hidePopup(); frame.update(frame.getGraphics()); Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 22:52:33 UTC (rev 1091) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 23:24:28 UTC (rev 1092) @@ -114,7 +114,7 @@ private final CMainControl mainControl; // reference to the main control - private final CFArchTypeList typelist; // reference to the list of CF type-data + private final CFArchTypeList archTypeList; // reference to the list of CF type-data private List<DialogAttrib<?>> dialogAttribs = new ArrayList<DialogAttrib<?>>(); @@ -164,16 +164,16 @@ /** * Wrapper method for the constructor. * This method only creates a CAttribDialog if there's no dialog for the same gameObject already. - * @param atList the list of CF type-data + * @param archTypeList the list of CF type-data * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control */ - public static void showAttribDialog(final CFArchTypeList atList, final GameObject gameObject, final CMainControl mainControl) { + public static void showAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final CMainControl mainControl) { synchronized (dialogs) { if (dialogs.containsKey(gameObject)) { dialogs.get(gameObject).toFront(); } else { - final CAttribDialog pane = new CAttribDialog(atList, gameObject, mainControl); + final CAttribDialog pane = new CAttribDialog(archTypeList, gameObject, mainControl); final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); @@ -186,15 +186,15 @@ /** * Constructor, creates the GUI layout. - * @param atList the list of CF type-data + * @param archTypeList the list of CF type-data * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control */ - private CAttribDialog(final CFArchTypeList atList, final GameObject gameObject, final CMainControl mainControl) { + private CAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final CMainControl mainControl) { listNr = 0; this.mainControl = mainControl; // reference to the main control - typelist = atList; // reference to the typelist + this.archTypeList = archTypeList; // reference to the typelist // reference to the GameObject this.gameObject = gameObject.getHead(); @@ -204,7 +204,7 @@ //typeNr = 0; // for invalid types, we take "type 0" boolean typeFound = false; int i = 0; - for (final CFArchType tmp : typelist) { + for (final CFArchType tmp : archTypeList) { if (tmp.getTypeNr() == this.gameObject.getArchTypNr()) { if (tmp.getTypeAttr() == null) { // no type-attributes, so we only compared type-numbers @@ -253,11 +253,11 @@ i++; } if (!typeFound) { - type = typelist.getArchType(0); + type = archTypeList.getArchType(0); } // get the type data - //type = typelist.getType(typeNr); + //type = archTypeList.getType(typeNr); // first split top-left and -right final JComponent leftPane = buildHeader(); @@ -307,11 +307,11 @@ * @return a <code>JComponent</code> with the combo box in it */ private JComponent buildTypesBox() { - final String[] namelist = new String[typelist.getLength()]; // list of typenames + final String[] namelist = new String[archTypeList.getLength()]; // list of typenames // read all type names int i = 0; - for (final CFArchType tmp : typelist) { + for (final CFArchType tmp : archTypeList) { namelist[i++] = " " + tmp.getTypeName(); } @@ -734,9 +734,9 @@ input = buildSpellBox(attrib); break; case LIST: - if (attrib.getMisc() != null && typelist.getListTable().containsKey(attrib.getMisc()[0])) { + if (attrib.getMisc() != null && archTypeList.getListTable().containsKey(attrib.getMisc()[0])) { // build the list from vector data - input = buildArrayBox(attrib, typelist.getListTable().get(attrib.getMisc()[0])); + input = buildArrayBox(attrib, archTypeList.getListTable().get(attrib.getMisc()[0])); } else { // error: list data is missing or corrupt cComp = new JLabel("Error: Undefined List"); @@ -761,13 +761,13 @@ newAttr = new DialogAttrib<JComboBox[]>(attrib); // create ComboBox with parsed selection final JComboBox[] inputs = new JComboBox[2]; - if (attrib.getMisc() != null && typelist.getListTable().containsKey(attrib.getMisc()[0]) && typelist.getListTable().containsKey(attrib.getMisc()[1])) { + if (attrib.getMisc() != null && archTypeList.getListTable().containsKey(attrib.getMisc()[0]) && archTypeList.getListTable().containsKey(attrib.getMisc()[1])) { // Hack to set preselected if available final int active = gameObject.getAttributeInt(nameOld); final int[] activepart = {active & 0x0F, active & 0xF0}; // build the lists from vector data for (int j = 0; j < 2; j++) { - final List<?> listData = typelist.getListTable().get(attrib.getMisc()[j]); + final List<?> listData = archTypeList.getListTable().get(attrib.getMisc()[j]); inputs[j] = buildArrayBox(attrib, listData); for (int k = 0; (double) k < listData.size() / 2.0; k++) { if ((Integer) listData.get(k << 1) == activepart[j]) { @@ -788,9 +788,9 @@ break; case BITMASK: { newAttr = new BitmaskAttrib(attrib); - if (attrib.getMisc() != null && typelist.getBitmaskTable().containsKey(attrib.getMisc()[0])) { + if (attrib.getMisc() != null && archTypeList.getBitmaskTable().containsKey(attrib.getMisc()[0])) { // fetch the bitmask data, then build the attribute panel - final CAttribBitmask bitmask = typelist.getBitmaskTable().get(attrib.getMisc()[0]); + final CAttribBitmask bitmask = archTypeList.getBitmaskTable().get(attrib.getMisc()[0]); ((BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr).bitmask = bitmask; cLabel = new JButton(new MaskChangeAL(attrib.getNameNew() + ":", (BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr)); final JTextArea input = new JTextArea(); @@ -1052,7 +1052,7 @@ * @return true if the settings were applied, false if error occurred */ private boolean applySettings() { - final CFArchType typeStruct = typelist.getTypeOfArch(gameObject); // the type structure for this gameObject + final CFArchType typeStruct = archTypeList.getTypeOfArch(gameObject); // the type structure for this gameObject String newArchText = ""; String newName = null; @@ -1196,7 +1196,7 @@ // get selected index of ComboBox final int attrValTmp = ((JComboBox) attr.input).getSelectedIndex(); // fetch value according to this list entry: - attrVal = (Integer) typelist.getListTable().get(attr.ref.getMisc()[0]).get(2 * attrValTmp); + attrVal = (Integer) archTypeList.getListTable().get(attr.ref.getMisc()[0]).get(2 * attrValTmp); break; default: assert false; @@ -1220,8 +1220,8 @@ } break; case DBLLIST: { - final int val1 = (Integer) typelist.getListTable().get(attr.ref.getMisc()[0]).get(2 * ((JComboBox[]) attr.input)[0].getSelectedIndex()); - final int val2 = (Integer) typelist.getListTable().get(attr.ref.getMisc()[1]).get(2 * ((JComboBox[]) attr.input)[1].getSelectedIndex()); + final int val1 = (Integer) archTypeList.getListTable().get(attr.ref.getMisc()[0]).get(2 * ((JComboBox[]) attr.input)[0].getSelectedIndex()); + final int val2 = (Integer) archTypeList.getListTable().get(attr.ref.getMisc()[1]).get(2 * ((JComboBox[]) attr.input)[1].getSelectedIndex()); final int combinedVal = val1 + val2; if (archetype.getAttributeInt(attr.ref.getNameOld()) != combinedVal) { @@ -1329,7 +1329,7 @@ // deal with syntax errors now if (errors != null) { - if (typeStruct == typelist.getArchType(0)) { + if (typeStruct == archTypeList.getArchType(0)) { // for generic (misc) type, all errors are automatically kept. // "misc" is no real type - it is more a default mask for unknown types gameObject.addObjectText(errors.trim()); @@ -1669,7 +1669,7 @@ } else if (e.getStateChange() == ItemEvent.SELECTED && !e.getItem().equals(deselected)) { // new type was selected // first, get new type structure - final CFArchType newType = typelist.getTypeByName((String) e.getItem()); + final CFArchType newType = archTypeList.getTypeByName((String) e.getItem()); frame.typesel.hidePopup(); frame.update(frame.getGraphics()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 22:52:33
|
Revision: 1091 http://svn.sourceforge.net/gridarta/?rev=1091&view=rev Author: akirschbaum Date: 2006-12-15 14:52:33 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Whitespace change. Modified Paths: -------------- trunk/daimonin/src/daieditor/CGUIUtils.java Modified: trunk/daimonin/src/daieditor/CGUIUtils.java =================================================================== --- trunk/daimonin/src/daieditor/CGUIUtils.java 2006-12-15 22:45:48 UTC (rev 1090) +++ trunk/daimonin/src/daieditor/CGUIUtils.java 2006-12-15 22:52:33 UTC (rev 1091) @@ -84,8 +84,7 @@ } else if (dirName.contains(File.separator)) { // let's try it again without first directory (okay, this may look // a bit weird, but usually this is the correct icon path in the jar) - imageResource = CGUIUtils.class.getClassLoader().getResource(dirName.substring(dirName.indexOf(File.separator) + 1) - + '/' + strIconName); + imageResource = CGUIUtils.class.getClassLoader().getResource(dirName.substring(dirName.indexOf(File.separator) + 1) + '/' + strIconName); if (imageResource != null) { icon = new ImageIcon(imageResource); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 22:45:47
|
Revision: 1090 http://svn.sourceforge.net/gridarta/?rev=1090&view=rev Author: akirschbaum Date: 2006-12-15 14:45:48 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Whitespace changes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CGUIUtils.java trunk/crossfire/src/cfeditor/CNewMapDialog.java Modified: trunk/crossfire/src/cfeditor/CGUIUtils.java =================================================================== --- trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-12-15 22:44:47 UTC (rev 1089) +++ trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-12-15 22:45:48 UTC (rev 1090) @@ -101,8 +101,7 @@ } else if (dirName.contains(File.separator)) { // let's try it again without first directory (okay, this may look // a bit weird, but usually this is the correct icon path in the jar) - imageResource = ClassLoader.getSystemResource(dirName.substring(dirName.indexOf(File.separator) + 1) - + '/' + strIconName); + imageResource = ClassLoader.getSystemResource(dirName.substring(dirName.indexOf(File.separator) + 1) + '/' + strIconName); if (imageResource != null) { icon = new ImageIcon(imageResource); } else { Modified: trunk/crossfire/src/cfeditor/CNewMapDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-12-15 22:44:47 UTC (rev 1089) +++ trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-12-15 22:45:48 UTC (rev 1090) @@ -251,8 +251,7 @@ // default map text: final Calendar today = Calendar.getInstance(); // get current date maparch.addText("Creator: CF Java Map Editor\n"); - maparch.addText("Date: " + (today.get(Calendar.MONTH) + 1) + "/" + - today.get(Calendar.DAY_OF_MONTH) + "/" + today.get(Calendar.YEAR)); + maparch.addText("Date: " + (today.get(Calendar.MONTH) + 1) + "/" + today.get(Calendar.DAY_OF_MONTH) + "/" + today.get(Calendar.YEAR)); if (mapType == MapType.GAMEMAP) { mainControl.newLevel(null, maparch, true, null); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 22:44:48
|
Revision: 1089 http://svn.sourceforge.net/gridarta/?rev=1089&view=rev Author: akirschbaum Date: 2006-12-15 14:44:47 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Prefer string constants over character constants in string concatenation. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/crossfire/src/cfeditor/map/MapArchObject.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFArchTypeList.java trunk/daimonin/src/daieditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/ScriptArchData.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -796,7 +796,7 @@ // fetch the bitmask data, then build the attribute panel final CAttribBitmask bitmask = typelist.getBitmaskTable().get((String) (attrib.getMisc()[0])); ((BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr).bitmask = bitmask; - cLabel = new JButton(new MaskChangeAL(attrib.getNameNew() + ':', (BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr)); + cLabel = new JButton(new MaskChangeAL(attrib.getNameNew() + ":", (BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr)); final JTextArea input = new JTextArea(); input.setBackground(getBackground()); input.setEditable(false); @@ -959,7 +959,7 @@ case BOOL_SPEC: { final boolean value = ((DialogAttrib<JCheckBox>) attr).input.isSelected(); // true/false if (value) { - doc.insertString(doc.getLength(), '<' + attr.ref.getNameNew() + ">\n", docStyle); + doc.insertString(doc.getLength(), "<" + attr.ref.getNameNew() + ">\n", docStyle); } } break; @@ -968,7 +968,7 @@ case FLOAT: { final String value = ((DialogAttrib<JFormattedTextField>) attr).input.getText(); // the attrib value if (value != null && value.length() > 0 && !value.equals("0")) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -977,7 +977,7 @@ case ANIMNAME: { final String value = ((DialogAttrib<JTextField>) attr).input.getText(); // the attrib value if (value != null && value.length() > 0) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -986,7 +986,7 @@ case LIST: { final String value = ((DialogAttrib<JComboBox>) attr).input.getSelectedItem().toString().trim(); // the attrib value if (value != null && value.length() > 0 && !value.startsWith("<")) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -1019,7 +1019,7 @@ case TREASURE: { final String value = ((DialogAttrib<JTextField>) attr).input.getText().trim(); // the attrib value if (value != null && value.length() > 0 && !value.equals(CFTreasureListTree.NONE_SYM)) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -1071,7 +1071,7 @@ case BOOL: { // a boolean attribute (flag) if (((DialogAttrib<JCheckBox>) attr).input.isSelected() != (archetype.getAttributeInt(attr.ref.getNameOld()) == 1)) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + (((DialogAttrib<JCheckBox>) attr).input.isSelected() ? 1 : 0) + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + (((DialogAttrib<JCheckBox>) attr).input.isSelected() ? 1 : 0) + "\n"; } } break; @@ -1085,7 +1085,7 @@ } // now see if we need to write it into the archtext or not if ((valString.equals("0") && !(archetype.getAttributeString(attr.ref.getNameOld()).length() == 0)) || (!valString.equals("0") && !archetype.getAttributeString(attr.ref.getNameOld()).equals(valString))) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + valString + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + valString + "\n"; } } break; @@ -1111,14 +1111,14 @@ case INT: { final int value = ((Number) ((DialogAttrib<JFormattedTextField>) attr).input.getValue()).intValue(); if (archetype.getAttributeInt(attr.ref.getNameOld()) != value) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + value + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } break; case LONG: { final long value = ((Number) ((DialogAttrib<JFormattedTextField>) attr).input.getValue()).longValue(); if (archetype.getAttributeLong(attr.ref.getNameOld()) != value) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + value + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } break; @@ -1281,7 +1281,7 @@ // we assume the default gameObject is "right" and we are "wrong". The typedefs aren't that trustworthy. // BUT - if the gameObject has a changed type, the archetype has lost it's credibility. // So, in this special case, the fixed attribute applies always. - newArchText = newArchText + type.getAttr()[i].getNameOld() + ' ' + type.getAttr()[i].getNameNew() + '\n'; + newArchText = newArchText + type.getAttr()[i].getNameOld() + " " + type.getAttr()[i].getNameNew() + "\n"; } } } Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -472,7 +472,7 @@ * @return name of this type, as defined in "typenumbers.xml" */ public String getArchTypeName(final int typeNr) { - return archTypeNumbers.containsKey(typeNr) ? archTypeNumbers.get(typeNr) : "*UNKNOWN" + typeNr + '*'; + return archTypeNumbers.containsKey(typeNr) ? archTypeNumbers.get(typeNr) : "*UNKNOWN" + typeNr + "*"; } /** Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -703,7 +703,7 @@ // file path is relative to map dir path = mainControl.getCurrentMap().getMapFile().getParentFile().getAbsolutePath(); // map dir if (!path.endsWith("/")) { - path += "/"; // append slash to map dir + path += '/'; // append slash to map dir } path += filePath; // append relative path to map dir path = path.replace('\\', '/'); // make sure there's only one kind of slash Modified: trunk/crossfire/src/cfeditor/map/MapArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -361,7 +361,7 @@ msgflag = false; } else { if (msgText.length() > 0) { - msgText.append("\n"); + msgText.append('\n'); } msgText.append(line2); } Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -312,7 +312,7 @@ // read all type names int i = 0; for (final CFArchType tmp : typelist) { - namelist[i++] = ' ' + tmp.getTypeName(); + namelist[i++] = " " + tmp.getTypeName(); } // the active type appears selected in the box @@ -792,7 +792,7 @@ // fetch the bitmask data, then build the attribute panel final CAttribBitmask bitmask = typelist.getBitmaskTable().get(attrib.getMisc()[0]); ((BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr).bitmask = bitmask; - cLabel = new JButton(new MaskChangeAL(attrib.getNameNew() + ':', (BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr)); + cLabel = new JButton(new MaskChangeAL(attrib.getNameNew() + ":", (BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr)); final JTextArea input = new JTextArea(); input.setBackground(getBackground()); input.setEditable(false); @@ -813,7 +813,7 @@ if (treasureName.trim().length() == 0 || "none".equalsIgnoreCase(treasureName.trim())) { treasureName = CFTreasureListTree.NONE_SYM; } - final JTextField input = new JTextField(' ' + treasureName, TEXTFIELD_COLUMNS); + final JTextField input = new JTextField(" " + treasureName, TEXTFIELD_COLUMNS); input.setEditable(false); cLabel = new JButton(new ViewTreasurelistAL((DialogAttrib<JTextField>) newAttr, this)); cComp = input; @@ -955,7 +955,7 @@ case BOOL_SPEC: { final boolean value = ((DialogAttrib<JCheckBox>) attr).input.isSelected(); // true/false if (value) { - doc.insertString(doc.getLength(), '<' + attr.ref.getNameNew() + ">\n", docStyle); + doc.insertString(doc.getLength(), "<" + attr.ref.getNameNew() + ">\n", docStyle); } } break; @@ -964,7 +964,7 @@ case FLOAT: { final String value = ((DialogAttrib<JFormattedTextField>) attr).input.getText(); // the attrib value if (value != null && value.length() > 0 && !value.equals("0")) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -973,7 +973,7 @@ case ANIMNAME: { final String value = ((DialogAttrib<JTextField>) attr).input.getText(); // the attrib value if (value != null && value.length() > 0) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -982,7 +982,7 @@ case LIST: { final String value = ((DialogAttrib<JComboBox>) attr).input.getSelectedItem().toString().trim(); // the attrib value if (value != null && value.length() > 0 && !value.startsWith("<")) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -1001,21 +1001,21 @@ } } if (out != null) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + out + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + out + "\n", docStyle); } } break; case BITMASK: { final String value = ((BitmaskAttrib) attr).input.getText().trim(); if (value != null && value.length() > 0 && !value.startsWith("<")) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; case TREASURE: { final String value = ((DialogAttrib<JTextField>) attr).input.getText().trim(); // the attrib value if (value != null && value.length() > 0 && !value.equals(CFTreasureListTree.NONE_SYM)) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + '\n', docStyle); + doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; @@ -1065,7 +1065,7 @@ case BOOL: { // a boolean attribute (flag) if (((DialogAttrib<JCheckBox>) attr).input.isSelected() != (archetype.getAttributeInt(attr.ref.getNameOld()) == 1)) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + (((DialogAttrib<JCheckBox>) attr).input.isSelected() ? 1 : 0) + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + (((DialogAttrib<JCheckBox>) attr).input.isSelected() ? 1 : 0) + "\n"; } } break; @@ -1079,7 +1079,7 @@ } // now see if we need to write it into the archtext or not if ("0".equals(valString) && !(archetype.getAttributeString(attr.ref.getNameOld()).length() == 0) || !valString.equals("0") && !archetype.getAttributeString(attr.ref.getNameOld()).equals(valString)) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + valString + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + valString + "\n"; } } break; @@ -1099,14 +1099,14 @@ case INT: { final int value = ((Number) ((DialogAttrib<JFormattedTextField>) attr).input.getValue()).intValue(); if (archetype.getAttributeInt(attr.ref.getNameOld()) != value) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + value + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } break; case LONG: { final long value = ((Number) ((DialogAttrib<JFormattedTextField>) attr).input.getValue()).longValue(); if (archetype.getAttributeLong(attr.ref.getNameOld()) != value) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + value + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } break; @@ -1115,7 +1115,7 @@ // The following floating point equality comparison is okay and known not to cause problems. //noinspection FloatingPointEquality if (archetype.getAttributeDouble(attr.ref.getNameOld()) != value) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + value + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } break; @@ -1153,7 +1153,7 @@ } } else if ("animation".equalsIgnoreCase(attr.ref.getNameOld())) { if (inline.length() > 0 && !inline.equals(archetype.getAttributeString(attr.ref.getNameOld()))) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + inline + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + inline + "\n"; gameObject.setAnimName(inline); } else { gameObject.setAnimName(archetype.getAnimName()); @@ -1163,13 +1163,13 @@ // decide we have to add a "face <name>" string to the gameObject text // Note, that the realFaceName itself is set below if (archetype.getFaceRealName() == null || archetype.getFaceRealName().compareTo(inline.trim()) != 0) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + inline + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + inline + "\n"; } } newFace = inline; } else { if (!inline.equals(archetype.getAttributeString(attr.ref.getNameOld()))) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + inline + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + inline + "\n"; } } } @@ -1215,7 +1215,7 @@ } else if (attrVal == 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0\n"; } else if (archetype.getAttributeInt(attr.ref.getNameOld()) != attrVal) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + attrVal + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + attrVal + "\n"; } } break; @@ -1225,7 +1225,7 @@ final int combinedVal = val1 + val2; if (archetype.getAttributeInt(attr.ref.getNameOld()) != combinedVal) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + combinedVal + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + combinedVal + "\n"; } } break; @@ -1234,7 +1234,7 @@ final int value = ((BitmaskAttrib) attr).getValue(); // get bitmask value if (archetype.getAttributeInt(attr.ref.getNameOld()) != value) { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + value + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } break; @@ -1248,7 +1248,7 @@ if (!isNone && !CFTreasureListTree.containsTreasureList(inline) && !inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld()))) { // The user has specified a WRONG treasurelist name, and it does not come // from the default gameObject. -> Error and out. - showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + '\'' + inline + "' is not a known treasurelist name!", "Input Error", ERROR_MESSAGE); + showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + "\'" + inline + "' is not a known treasurelist name!", "Input Error", ERROR_MESSAGE); return false; } @@ -1256,7 +1256,7 @@ if (isNone) { newArchText = newArchText + attr.ref.getNameOld() + " none\n"; } else { - newArchText = newArchText + attr.ref.getNameOld() + ' ' + inline + '\n'; + newArchText = newArchText + attr.ref.getNameOld() + " " + inline + "\n"; } } } @@ -1276,7 +1276,7 @@ // we assume the default gameObject is "right" and we are "wrong". The typedefs aren't that trustworthy. // BUT - if the gameObject has a changed type, the archetype has lost it's credibility. // So, in this special case, the fixed attribute applies always. - newArchText = newArchText + type.getAttr()[i].getNameOld() + ' ' + type.getAttr()[i].getNameNew() + '\n'; + newArchText = newArchText + type.getAttr()[i].getNameOld() + " " + type.getAttr()[i].getNameNew() + "\n"; } } } @@ -1286,7 +1286,7 @@ * But we need to add when needed the gameObject text - we do it here. */ if (gameObject.getDirection() != ((GameObject) archetype).getDirection()) { - newArchText = newArchText + "direction " + gameObject.getDirection() + '\n'; + newArchText = newArchText + "direction " + gameObject.getDirection() + "\n"; } // before we modify the archtext, we look for errors and save them. // later the user must confirm whether to keep or dump those errors Modified: trunk/daimonin/src/daieditor/CFArchTypeList.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -178,7 +178,7 @@ parseTypes(root); if (log.isInfoEnabled()) { - log.info("Loaded " + archTypeList.size() + " types from '" + IGUIConstants.TYPEDEF_FILE + '\''); + log.info("Loaded " + archTypeList.size() + " types from '" + IGUIConstants.TYPEDEF_FILE + "\'"); } } catch (final SAXException e) { log.error("Parsing error in '" + IGUIConstants.TYPEDEF_FILE + "':\n" + e.getMessage()); @@ -222,7 +222,7 @@ // every list entry adds value (Integer) and name (String) to the vector try { list.add(Integer.valueOf(elem.getAttribute("value"))); - list.add(' ' + elem.getAttribute("name").trim()); + list.add(" " + elem.getAttribute("name").trim()); } catch (final NumberFormatException ignore) { throw new RuntimeException("In '" + IGUIConstants.TYPEDEF_FILE + "', list " + root.getAttribute("name") + ": value '" + elem.getAttribute("value") + "' is not an integer."); } @@ -349,7 +349,7 @@ * @return name of this type, as defined in "typenumbers.xml" */ public String getArchTypeName(final int typeNr) { - return archTypeNumbers.containsKey(typeNr) ? archTypeNumbers.get(typeNr) : "*UNKNOWN" + typeNr + '*'; + return archTypeNumbers.containsKey(typeNr) ? archTypeNumbers.get(typeNr) : "*UNKNOWN" + typeNr + "*"; } /** Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -593,7 +593,7 @@ public void actionPerformed(final ActionEvent e) { final String result = getSelectedTreasureList(); if (result != null) { - input.setText(' ' + result); + input.setText(" " + result); frame.setVisible(false); } } @@ -604,7 +604,7 @@ noneButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { // print "none" into the attribute dialog - input.setText(' ' + NONE_SYM); + input.setText(" " + NONE_SYM); frame.setVisible(false); } }); Modified: trunk/daimonin/src/daieditor/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/ScriptArchData.java 2006-12-15 22:29:24 UTC (rev 1088) +++ trunk/daimonin/src/daieditor/ScriptArchData.java 2006-12-15 22:44:47 UTC (rev 1089) @@ -182,7 +182,7 @@ final Vector<String> content = new Vector<String>(); for (final GameObject tmp : owner) { if (tmp.getArchTypNr() == 118) { - content.add(' ' + typeName(tmp.getAttributeInt("sub_type"))); + content.add(" " + typeName(tmp.getAttributeInt("sub_type"))); } } @@ -304,7 +304,7 @@ } path = path.replace('\\', '/'); if (!path.startsWith("/")) { - path = '/' + path; // leading slash + path = "/" + path; // leading slash } } else { // scriptfile is in a subirectory of mapfile -> relative path This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 22:29:23
|
Revision: 1088 http://svn.sourceforge.net/gridarta/?rev=1088&view=rev Author: akirschbaum Date: 2006-12-15 14:29:24 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Remove redundant class qualifier. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/daimonin/src/daieditor/CAttribDialog.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-15 22:24:34 UTC (rev 1087) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-15 22:29:24 UTC (rev 1088) @@ -1144,7 +1144,7 @@ } } catch (final NumberFormatException e) { // parsing failed: wrong entry!! - JOptionPane.showMessageDialog(this, "Attribute '" + attr.ref.getNameNew() + "' must be a number!", "Input Error", JOptionPane.ERROR_MESSAGE); + showMessageDialog(this, "Attribute '" + attr.ref.getNameNew() + "' must be a number!", "Input Error", ERROR_MESSAGE); return false; } } @@ -1254,7 +1254,7 @@ if (!isNone && !CFTreasureListTree.containsTreasureList(inline) && !inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld()))) { // The user has specified a WRONG treasurelist name, and it does not come // from the default gameObject. -> Error and out. - JOptionPane.showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + "'" + inline + "' is not a known treasurelist name!", "Input Error", JOptionPane.ERROR_MESSAGE); + showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + "'" + inline + "' is not a known treasurelist name!", "Input Error", ERROR_MESSAGE); return false; } @@ -1698,7 +1698,7 @@ if (deselected == null) { deselected = frame.type.getTypeName(); } - if (JOptionPane.showConfirmDialog(frame, "Do you really want to change the type of this\nobject from \"" + deselected + "\" to \"" + newType.getTypeName() + "\"?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION) { + if (showConfirmDialog(frame, "Do you really want to change the type of this\nobject from \"" + deselected + "\" to \"" + newType.getTypeName() + "\"?", "Confirm", YES_NO_OPTION, INFORMATION_MESSAGE) == YES_OPTION) { // change is confirmed, now get it on... frame.type = newType; // set new type structure Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 22:24:34 UTC (rev 1087) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 22:29:24 UTC (rev 1088) @@ -1677,7 +1677,7 @@ if (deselected == null) { deselected = frame.type.getTypeName(); } - if (JOptionPane.showConfirmDialog(frame, "Do you really want to change the type of this\nobject from \"" + deselected + "\" to \"" + newType.getTypeName() + "\"?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION) { + if (showConfirmDialog(frame, "Do you really want to change the type of this\nobject from \"" + deselected + "\" to \"" + newType.getTypeName() + "\"?", "Confirm", YES_NO_OPTION, INFORMATION_MESSAGE) == YES_OPTION) { // change is confirmed, now get it on... frame.type = newType; // set new type structure This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 22:24:35
|
Revision: 1087 http://svn.sourceforge.net/gridarta/?rev=1087&view=rev Author: akirschbaum Date: 2006-12-15 14:24:34 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Unify expression. Modified Paths: -------------- trunk/daimonin/src/daieditor/CAttribDialog.java Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 22:22:35 UTC (rev 1086) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-12-15 22:24:34 UTC (rev 1087) @@ -1270,7 +1270,7 @@ // ### TODO: for changed types, copy fixed attributes over default arches ### if (type.getAttr()[i].getDataType() == ArchAttribType.FIXED) { final String defaultValue = archetype.getAttributeString(type.getAttr()[i].getNameOld()); - if (defaultValue.length() == 0 || gameObject.getArchTypNr() != archetype.getArchTypNr() && !defaultValue.equalsIgnoreCase(type.getAttr()[i].getNameNew())) { + if (defaultValue.length() == 0 || (gameObject.getArchTypNr() != archetype.getArchTypNr() && !defaultValue.equalsIgnoreCase(type.getAttr()[i].getNameNew()))) { // usually, fixed attributes are only applied when *not* defined in the archetype. // the reason behind this is: if the default gameObject violates our fixed attribute, // we assume the default gameObject is "right" and we are "wrong". The typedefs aren't that trustworthy. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 22:22:35
|
Revision: 1086 http://svn.sourceforge.net/gridarta/?rev=1086&view=rev Author: akirschbaum Date: 2006-12-15 14:22:35 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Remove unused file. Removed Paths: ------------- trunk/crossfire/src/cfeditor/MultiPositionData.java Deleted: trunk/crossfire/src/cfeditor/MultiPositionData.java =================================================================== --- trunk/crossfire/src/cfeditor/MultiPositionData.java 2006-12-15 22:19:56 UTC (rev 1085) +++ trunk/crossfire/src/cfeditor/MultiPositionData.java 2006-12-15 22:22:35 UTC (rev 1086) @@ -1,143 +0,0 @@ -/* - * Crossfire Java Editor. - * Copyright (C) 2000 Michael Toennies - * Copyright (C) 2001 Andreas Vogl - * - * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - */ - -package cfeditor; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.util.StringTokenizer; -import net.sf.gridarta.io.IOUtils; -import org.apache.log4j.Logger; - -/** - * The MultiPositionData class stores an array of numbers which is required - * in order to calculate display positions of ISO multipart objects. - * (This class is never used in Crossfire modus) - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - */ -public final class MultiPositionData { - - private static final Logger log = Logger.getLogger(MultiPositionData.class); - - /** Number of columns in the array. */ - public static final int X_DIM = 34; - - /** Number of rows in the array. */ - public static final int Y_DIM = 16; - - private static MultiPositionData instance = null; - - /** Array with position data. */ - private final int[][] data; - - /** Private constructor: initialize array. */ - private MultiPositionData() { - data = new int[Y_DIM][X_DIM]; - } - - /** - * This is the static init method. It is called once in the global - * initialization phase. - */ - public static synchronized void init() { - if (instance == null) { - instance = new MultiPositionData(); - instance.load(); - } - } - - /** - * Load the array-data from file. An error is reported when the numbers in - * the file don't match expected array dimensions. - */ - private void load() { - // read datafile line by line, parsing numbers into the array - try { - final BufferedReader reader = IOUtils.createReader(CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR, IGUIConstants.ARCHDEF_FILE); - try { - String num; // number, still in string format - int xp = 0; // x-index in the data array - int yp = 0; // y-index in the data array - - // read the whole file line by line - for (String line; (line = reader.readLine()) != null;) { - line = line.trim(); - if (line.length() > 0 && !line.startsWith("#") && yp < Y_DIM) { - final StringTokenizer s = new StringTokenizer(line, " ", false); - while (s != null && s.hasMoreTokens()) { - num = s.nextToken(); // get one number - if (num.length() > 0 && xp < X_DIM) { - try { - // parse and store it as integer - data[yp][xp] = Integer.parseInt(num); - xp++; // increase index - } catch (final NumberFormatException e) { - } - } - } - - // report if there haven't been enough numbers in this row - if (xp < X_DIM) { - log.warn("In file " + IGUIConstants.ARCHDEF_FILE + ": Missing " + (X_DIM - xp) + " numbers in row " + (yp + 1) + "."); - } - - xp = 0; // prepare indices for next row - yp++; - } - } - if (yp < Y_DIM) { - log.warn("In file " + IGUIConstants.ARCHDEF_FILE + ": Missing " + (Y_DIM - yp) + " entire rows of data."); - } - - } finally { - reader.close(); // close filereader - } - // report if there haven't been enough rows in the file - // confirm load process - if (log.isInfoEnabled()) { - log.info("Loaded multipart position data from '" + IGUIConstants.ARCHDEF_FILE + "'"); - } - } catch (final IOException e) { - // FIXME either do something or DOCUMENT TO IGNORE ME - } - } - - /** - * Calculate the x-offset from the leftmost pixel of the big face image and - * the default x-position (The default position is where a single-tile - * image would be put). - * @param shapeID ID number for the multisquare shape (-> rows in position - * data file) - * @param positionID number of tile in the big bunch - * @return x-offset - */ - public static synchronized int getXOffset(final int shapeID, final int positionID) { - if (instance != null) { - return instance.data[shapeID][2 + (positionID << 1)]; - } - return 0; - } - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-12-15 22:19:56
|
Revision: 1085 http://svn.sourceforge.net/gridarta/?rev=1085&view=rev Author: akirschbaum Date: 2006-12-15 14:19:56 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Rename variable name. Modified Paths: -------------- trunk/crossfire/src/cfeditor/ScriptArchData.java Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-12-15 22:18:14 UTC (rev 1084) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-12-15 22:19:56 UTC (rev 1085) @@ -374,10 +374,10 @@ * A popup is opened and the user can create a new scripting event * which gets attached to this gameObject. * @param panelList JList from the MapArchPanel (script tab) which displays the events - * @param arch GameObject that's name should be used for creating a reasonable default script name + * @param gameObject GameObject that's name should be used for creating a reasonable default script name */ - public void addEventScript(final JList panelList, final GameObject arch) { - final String archName = arch.getBestName(); + public void addEventScript(final JList panelList, final GameObject gameObject) { + final String archName = gameObject.getBestName(); // create a reasonable default script name for lazy users :-) final String defScriptName = chooseDefaultScriptName(archName); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |