From: <aki...@us...> - 2008-08-03 20:28:30
|
Revision: 4740 http://gridarta.svn.sourceforge.net/gridarta/?rev=4740&view=rev Author: akirschbaum Date: 2008-08-03 20:28:36 +0000 (Sun, 03 Aug 2008) Log Message: ----------- Split off unrelated GUI code from DefaultObjectChooser. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/gui/MainView.java trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/LeftPanel.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 15:37:42 UTC (rev 4739) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -69,6 +69,7 @@ import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.About; import net.sf.gridarta.gui.HideFileFilterProxy; +import net.sf.gridarta.gui.LeftPanel; import net.sf.gridarta.gui.MainActions; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapFileFilter; @@ -84,7 +85,9 @@ import net.sf.gridarta.gui.map.MapCursorControl; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.tools.DeletionTool; +import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; +import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; @@ -239,7 +242,7 @@ newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, copyBuffer); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, copyBuffer); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); replaceDialogManager.setObjectChooser(objectChooser); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); @@ -326,11 +329,14 @@ final CFilterControl filterControl = new CFilterControl(null, mapManager, defaultNamedFilterList); ((CrossfireObjectsFactory) gridartaObjectsFactory).setFilterControl(filterControl); scriptControl = new ScriptController(this, filterControl, archetypeSet, mainView); - mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); + final ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChoiceDisplay = new ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserControl, pickmapChooserControl); + final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, objectChoiceDisplay, pickmapChooserControl, copyBuffer); + final LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic> leftPanel = new LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic>(objectChooser, toolPalette, objectChoiceDisplay); + mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); final ArchetypeParser archetypeParser = new ArchetypeParser(gridartaObjectsFactory, archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists); + gridartaObjectsFactory.init(faceObjects, archetypeChooserControl, selectedSquareView, this, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists, toolPalette); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-03 15:37:42 UTC (rev 4739) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -47,7 +47,7 @@ import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; -import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; +import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; @@ -71,9 +71,6 @@ /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - /** The {@link ObjectChooser} instance to use. */ - private ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser = null; - /** The {@link ArchetypeChooserControl} instance to use. */ @NotNull private ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = null; @@ -113,6 +110,10 @@ @NotNull private CFilterControl filterControl; + /** The tool palette instance. */ + @NotNull + private ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -172,12 +173,11 @@ /** {@inheritDoc} */ @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainControl, mapControl, viewCounter, new CMapViewBasic(filterControl, editTypes, mapControl, viewPosition, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), 32, 32, selectedSquareView), ACTION_FACTORY, mapImageCache); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainControl, mapControl, viewCounter, new CMapViewBasic(filterControl, editTypes, mapControl, viewPosition, toolPalette, 32, 32, selectedSquareView), ACTION_FACTORY, mapImageCache); } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { - this.objectChooser = objectChooser; + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { this.archetypeChooserControl = archetypeChooserControl; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; @@ -187,6 +187,7 @@ this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; this.autojoinLists = autojoinLists; + this.toolPalette = toolPalette; } public void setFilterControl(@NotNull final CFilterControl filterControl) { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 15:37:42 UTC (rev 4739) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -78,6 +78,7 @@ import net.sf.gridarta.gui.About; import net.sf.gridarta.gui.GUIUtils; import net.sf.gridarta.gui.HideFileFilterProxy; +import net.sf.gridarta.gui.LeftPanel; import net.sf.gridarta.gui.MainActions; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapFileFilter; @@ -93,7 +94,9 @@ import net.sf.gridarta.gui.map.MapCursorControl; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.tools.DeletionTool; +import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; +import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; @@ -302,7 +305,7 @@ newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, copyBuffer); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, copyBuffer); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); replaceDialogManager.setObjectChooser(objectChooser); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); @@ -387,10 +390,13 @@ // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER); gameObjectAttributesPanel = new GameObjectAttributesPanel(this, objectChooser, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); - mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); + final ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChoiceDisplay = new ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserControl, pickmapChooserControl); + final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, objectChoiceDisplay, pickmapChooserControl, copyBuffer); + final LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic> leftPanel = new LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic>(objectChooser, toolPalette, objectChoiceDisplay); + mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); final ArchetypeParser archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists); + gridartaObjectsFactory.init(faceObjects, archetypeChooserControl, selectedSquareView, this, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists, toolPalette); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-03 15:37:42 UTC (rev 4739) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -47,7 +47,7 @@ import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; -import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; +import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; @@ -74,9 +74,6 @@ /** The {@link FaceObjects} instance to use. */ private FaceObjects faceObjects = null; - /** The {@link ObjectChooser} instance to use. */ - private ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser = null; - /** The {@link ArchetypeChooserControl} instance to use. */ @NotNull private ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = null; @@ -113,6 +110,10 @@ @NotNull private AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists = null; + /** The tool palette instance. */ + @NotNull + private ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -174,13 +175,12 @@ /** {@inheritDoc} */ @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainControl, mapControl, viewCounter, new CMapViewBasic((CMainControl) mainControl, editTypes, mapControl, viewPosition, faceObjects, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY, mapImageCache); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainControl, mapControl, viewCounter, new CMapViewBasic((CMainControl) mainControl, editTypes, mapControl, viewPosition, faceObjects, toolPalette, IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY, mapImageCache); } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { this.faceObjects = faceObjects; - this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; @@ -190,6 +190,7 @@ this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; this.autojoinLists = autojoinLists; + this.toolPalette = toolPalette; } } // class DaimoninObjectsFactory Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-03 15:37:42 UTC (rev 4739) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -33,7 +33,7 @@ import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.gui.objectchooser.ObjectChooser; +import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.GameObjectParser; import net.sf.gridarta.io.MapArchObjectParser; @@ -137,7 +137,6 @@ /** * Initializes the instance. * @param faceObjects the FaceObjects instance - * @param objectChooser the ObjectChooser instance * @param archetypeChooserControl the ArchetypeChooserControl instance * @param selectedSquareView the selected square view instance * @param mainControl the main control instance @@ -147,7 +146,8 @@ * @param archetypeParser the archetype parser instance * @param archetypeSet the archetype set instance * @param autojoinLists the autojoin lists instance + * @param toolPalette the tool palette instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions, @NotNull ArchetypeParser<G, A, R> archetypeParser, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull final AutojoinLists<G, A, R> autojoinLists); + void init(@NotNull FaceObjects faceObjects, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions, @NotNull ArchetypeParser<G, A, R> archetypeParser, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull ToolPalette<G, A, R, V> toolPalette); } // interface GridartaObjectsFactory Added: trunk/src/app/net/sf/gridarta/gui/LeftPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/LeftPanel.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/LeftPanel.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -0,0 +1,62 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui; + +import java.awt.BorderLayout; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.map.tools.ToolPalette; +import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; +import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; +import net.sf.gridarta.map.MapArchObject; +import org.jetbrains.annotations.NotNull; + +/** + * The gui panel on the left side. It holds the tool palette, the object + * chooser, and the object choice display. + * @author Andreas Kirschbaum + */ +public class LeftPanel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends JPanel { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1; + + /** + * Creates a new instance. + * @param objectChooser the object chooser + * @param toolPalette the tool palette + * @param objectChoiceDisplay the object choice display + */ + public LeftPanel(@NotNull final DefaultObjectChooser<G, A, R, V> objectChooser, @NotNull final ToolPalette<G, A, R, V> toolPalette, @NotNull final ObjectChoiceDisplay<G, A, R, V> objectChoiceDisplay) { + super(new BorderLayout()); + + // TODO: introduce a tool registry + final JSplitPane splitPane = new GSplitPane(JSplitPane.VERTICAL_SPLIT, toolPalette, objectChooser); + splitPane.setContinuousLayout(true); + add(splitPane, BorderLayout.CENTER); + add(objectChoiceDisplay, BorderLayout.SOUTH); + } + +} // class LeftPanel Property changes on: trunk/src/app/net/sf/gridarta/gui/LeftPanel.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-03 15:37:42 UTC (rev 4739) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -386,7 +386,7 @@ * @param archetypeChooserControl the archetype chooser control * @param objectChooser the object chooser */ - public void init(@NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final ArchetypeTypeSet archetypeTypeSet, final boolean mapTileListBottom, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser) { + public void init(@NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final ArchetypeTypeSet archetypeTypeSet, final boolean mapTileListBottom, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser, @NotNull final LeftPanel<G, A, R, V> leftPanel) { // calculate some default values in case there is no settings file final Rectangle screen = getGraphicsConfiguration().getBounds(); final int defwidth = (int) (0.9 * screen.getWidth()); @@ -396,7 +396,7 @@ final JPanel toolbarPanel = new JPanel(new BorderLayout()); toolbarPanel.add(mainToolbar, BorderLayout.NORTH); - toolbarPanel.add(createCenterPanel(defwidth, defheight, selectedSquareView, mapTileListBottom, gameObjectAttributesPanel, objectChooser), BorderLayout.CENTER); + toolbarPanel.add(createCenterPanel(defwidth, defheight, selectedSquareView, mapTileListBottom, gameObjectAttributesPanel, leftPanel), BorderLayout.CENTER); add(toolbarPanel, BorderLayout.CENTER); archetypesActions = new ArchetypesActions<G, A, R, V>(this, archetypeChooserControl, archetypeChooserControl.getArchetypeChooserView(), objectChooser, archetypeTypeSet); @@ -434,9 +434,9 @@ * @param selectedSquareView the selected square view * @param mapTileListBottom whether the map tile should be at the bottom * @return center panel - * @param objectChooser the object chooser + * @param leftPanel the left panel */ - private JPanel createCenterPanel(final int defwidth, final int defheight, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final boolean mapTileListBottom, @NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser) { + private JPanel createCenterPanel(final int defwidth, final int defheight, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final boolean mapTileListBottom, @NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel, @NotNull final LeftPanel<G, A, R, V> leftPanel) { final JPanel centerPanel = new JPanel(new BorderLayout()); final int divLocationRight = prefs.getInt(DIVIDER_LOCATION_KEY3, (int) (defwidth * 0.62)); @@ -456,7 +456,7 @@ splitDownPane.setDividerLocation(divLocationDown); splitDownPane.setContinuousLayout(true); splitDownPane.setResizeWeight(1); - splitPane = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, objectChooser, splitDownPane); + splitPane = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, splitDownPane); splitPane.setDividerLocation(divLocation); splitPane.setContinuousLayout(true); Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2008-08-03 15:37:42 UTC (rev 4739) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -24,22 +24,13 @@ import java.util.List; import javax.swing.JMenu; import javax.swing.JPanel; -import javax.swing.JSplitPane; import javax.swing.JTabbedPane; import javax.swing.SwingConstants; -import net.sf.gridarta.CopyBuffer; -import net.sf.gridarta.EditTypes; -import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.GSplitPane; -import net.sf.gridarta.gui.ReplaceDialogManager; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.gui.map.tools.ToolPalette; -import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapModel; @@ -65,9 +56,6 @@ /** The archetype chooser control. */ private final PickmapChooserControl<G, A, R, V> pickmapChooserControl; - /** ToolSelector of this subview. */ - private final ToolPalette<G, A, R, V> toolPalette; - /** Panel holding both archlist and pickmaps. */ private final JTabbedPane archAndPickPane = new JTabbedPane(SwingConstants.TOP); @@ -79,32 +67,19 @@ /** * Creates a new instance. - * @param replaceDialogManager the replace dialog manager - * @param archetypeTypeSet the archetype type set - * @param editTypes the edit types instance - * @param selectedSquareView the selected square view * @param archetypeChooserControl the archetype chooser control * @param pickmapChooserControl the pickmap chooser control - * @param copyBuffer the copy buffer instance to use */ - public DefaultObjectChooser(@NotNull final ReplaceDialogManager<G, A, R, V> replaceDialogManager, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { + public DefaultObjectChooser(@NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { super(new BorderLayout()); this.archetypeChooserControl = archetypeChooserControl; this.pickmapChooserControl = pickmapChooserControl; - final ObjectChoiceDisplay<G, A, R, V> objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(replaceDialogManager, archetypeTypeSet, this, archetypeChooserControl, pickmapChooserControl); - toolPalette = new ToolPalette<G, A, R, V>(editTypes, selectedSquareView, this, objectChoiceDisplay, pickmapChooserControl, copyBuffer); // archAndPickPane is the panel containing both archpanel and pickmaps archAndPickPane.addTab(ACTION_FACTORY.getString("objectChooser.archetypesTabTitle"), archetypeChooserControl.getArchetypeChooserView()); archAndPickPane.addTab(ACTION_FACTORY.getString("objectChooser.pickmapsTabTitle"), pickmapChooserControl.getPickmapPanel()); // this listener informs the mainview which panel is active: archlist or pickmaps? archAndPickPane.addChangeListener(new ArchNPickChangeListener(this, archAndPickPane)); - - // TODO: introduce a tool registry - final JSplitPane splitPane = new GSplitPane(JSplitPane.VERTICAL_SPLIT, toolPalette, archAndPickPane); - splitPane.setContinuousLayout(true); - add(splitPane, BorderLayout.CENTER); - add(objectChoiceDisplay, BorderLayout.SOUTH); } /** {@inheritDoc} */ @@ -160,14 +135,6 @@ return pickmapActive ? pickmapChooserControl.getSelections() : archetypeChooserControl.getSelections(); } - /** - * Returns the tool selector pane. - * @return The tool selector pane. - */ - public ToolPalette<G, A, R, V> getToolSelectorPane() { - return toolPalette; - } - /** {@inheritDoc} */ public void selectArchetype(final R archetype) { moveArchetypeChooserToFront(); Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-03 15:37:42 UTC (rev 4739) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -57,6 +57,7 @@ import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.GameObjectParser; @@ -887,7 +888,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> archetypeParser, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> archetypeParser, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final ToolPalette<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> toolPalette) { throw new AssertionError(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |