From: <aki...@us...> - 2008-07-14 20:21:23
|
Revision: 4330 http://gridarta.svn.sourceforge.net/gridarta/?rev=4330&view=rev Author: akirschbaum Date: 2008-07-14 13:21:29 -0700 (Mon, 14 Jul 2008) Log Message: ----------- Remove calls to MainControl.getSelectedSquareControl(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-14 20:12:19 UTC (rev 4329) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-14 20:21:29 UTC (rev 4330) @@ -233,7 +233,9 @@ animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); archetypeSet = new ArchetypeSet(this, animationObjects, faceObjects); scriptControl = new ScriptController(this); - mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, getMapManager()); + final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); + selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, mapTileListBottom, null); + mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, getMapManager(), selectedSquareControl, selectedSquareControl.getSelectedSquareView()); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "about"); mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); globalSettings.readGlobalSettings(); @@ -242,8 +244,6 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); - selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, mapTileListBottom, null); objectChooser = new ObjectChooser(this, selectedSquareControl.getSelectedSquareView(), archetypeChooserControl, mapManager, pickmapChooserControl); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, pickmapChooserControl, selectedSquareControl.getSelectedSquareView()); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-14 20:12:19 UTC (rev 4329) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-14 20:21:29 UTC (rev 4330) @@ -284,7 +284,9 @@ instance = this; animationObjects = new daieditor.gameobject.anim.AnimationObjects(); archetypeSet = new ArchetypeSet(this, animationObjects, faceObjects); - mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, getMapManager()); + final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); + selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH)); + mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, getMapManager(), selectedSquareControl, selectedSquareControl.getSelectedSquareView()); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod", "about"); ACTION_FACTORY.createToggles(true, this, "drawDouble"); ACTION_FACTORY.createAction(true, "collectSpells", this); @@ -295,8 +297,6 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); - selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH)); objectChooser = new ObjectChooser(this, selectedSquareControl.getSelectedSquareView(), archetypeChooserControl, mapManager, pickmapChooserControl); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, pickmapChooserControl, selectedSquareControl.getSelectedSquareView()); Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java 2008-07-14 20:12:19 UTC (rev 4329) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java 2008-07-14 20:21:29 UTC (rev 4330) @@ -41,6 +41,12 @@ /** The MainControl. */ private final MainControl<G, A, R, V> mainControl; + /** The selected square control. */ + private final SelectedSquareControl<G, A, R, V> selectedSquareControl; + + /** The selected square view. */ + private final SelectedSquareView<G, A, R, V> selectedSquareView; + @NotNull private final MapCursorActions<G, A, R, V> actions; @@ -56,9 +62,13 @@ * @param mainControl MainControl to use (used for getting the current map * etc.) * @param mapManager the map manager + * @param selectedSquareControl the selected square control + * @param selectedSquareView the selected square view */ - public MapCursorControl(final String key, final MainControl<G, A, R, V> mainControl, final MapManager<G, A, R, V> mapManager) { + public MapCursorControl(final String key, final MainControl<G, A, R, V> mainControl, final MapManager<G, A, R, V> mapManager, @NotNull final SelectedSquareControl<G, A, R, V> selectedSquareControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView) { this.mainControl = mainControl; + this.selectedSquareControl = selectedSquareControl; + this.selectedSquareView = selectedSquareView; goLocationDialogManager = new GoLocationDialogManager<G, A, R, V>(mapManager); actions = new MapCursorActions<G, A, R, V>(key, this, mainControl, mapManager); } @@ -100,14 +110,10 @@ } public void insertArch() { - final SelectedSquareControl<G, A, R, V> selectedSquareControl = mainControl.getSelectedSquareControl(); - assert selectedSquareControl != null; selectedSquareControl.insertGameObjectFromObjectChooser(); } public void deleteArch() { - final SelectedSquareControl<G, A, R, V> selectedSquareControl = mainControl.getSelectedSquareControl(); - assert selectedSquareControl != null; selectedSquareControl.deleteSelection(); } @@ -117,17 +123,11 @@ * below is selected */ public void selectArch(final boolean above) { - final SelectedSquareControl<G, A, R, V> selectedSquareControl = mainControl.getSelectedSquareControl(); - assert selectedSquareControl != null; - final SelectedSquareView<G, A, R, V> selectedSquareView = selectedSquareControl.getSelectedSquareView(); - assert selectedSquareView != null; selectedSquareView.selectArch(above); } public void archAttributes() { - final SelectedSquareControl<G, A, R, V> selectedSquareControl = mainControl.getSelectedSquareControl(); - assert selectedSquareControl != null; - final G arch = selectedSquareControl.getSelectedSquareView().getSelectedGameObject(); + final G arch = selectedSquareView.getSelectedGameObject(); if (arch != null) { mainControl.openAttrDialog(arch); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |