From: <aki...@us...> - 2007-01-10 22:18:43
|
Revision: 1550 http://svn.sourceforge.net/gridarta/?rev=1550&view=rev Author: akirschbaum Date: 2007-01-10 14:18:44 -0800 (Wed, 10 Jan 2007) Log Message: ----------- When saving a map which in fact is a pickmap, reflect the changes to the pickmap. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/gui/pickmapchooser/PickmapChooserControl.java trunk/crossfire/src/cfeditor/map/MapControl.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2007-01-10 22:13:24 UTC (rev 1549) +++ trunk/crossfire/ChangeLog 2007-01-10 22:18:44 UTC (rev 1550) @@ -1,5 +1,8 @@ 2007-01-10 Andreas Kirschbaum + * When saving a map which in fact is a pickmap, reflect the + changes to the pickmap. + * Add support for "Event" game objects (type 116). * Fix #1556003 (Crossfire script editor doesn't support new plugin Modified: trunk/crossfire/src/cfeditor/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/pickmapchooser/PickmapChooserControl.java 2007-01-10 22:13:24 UTC (rev 1549) +++ trunk/crossfire/src/cfeditor/gui/pickmapchooser/PickmapChooserControl.java 2007-01-10 22:18:44 UTC (rev 1550) @@ -219,6 +219,20 @@ } /** + * Close a pickmap: Remove it from the panel and the data vector. + * @param file the map file name to remove + * @return true when closing successful + */ + public boolean closePickmap(final File file) { + for (final MapControl pickmap : pickmaps) { + if (pickmap.getMapFile().equals(file)) { + return closePickmap(pickmap); + } + } + return false; + } + + /** * Set pickmap with given tab index to be the active one (ontop). * @param index the index into <code>pickmaps</code> */ Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2007-01-10 22:13:24 UTC (rev 1549) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2007-01-10 22:18:44 UTC (rev 1550) @@ -30,6 +30,7 @@ import cfeditor.gameobject.GameObject; import java.awt.Point; import java.io.File; +import java.io.IOException; import java.util.List; import net.sf.gridarta.Size2D; import net.sf.gridarta.gui.map.MapCursor; @@ -277,6 +278,23 @@ } assert mapFile != null; mainControl.encodeMapFile(mapFile, mapModel); + /* if we open a pickmap in the editor, is handled as normal map. + * to find out its original a pickmap we check the file name. + */ + if (isPickmap()) { + // this is called when we do a "add-new-pickmap from the pickmap menu + // we need to link the full path & save the map at creation time + // so the pickmap menu can handle it right + try { + mapModel.getMapArchObject().setFileName(mapFile.getCanonicalPath()); + } catch (final IOException e) { + // TODO + } + } else { + if (mainControl.getMainView().getPickmapChooserControl().closePickmap(mapFile)) { + mainControl.getMainView().getPickmapChooserControl().openPickmap(mapFile); + } + } resetModified(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |