From: <aki...@us...> - 2006-12-14 21:49:25
|
Revision: 1065 http://svn.sourceforge.net/gridarta/?rev=1065&view=rev Author: akirschbaum Date: 2006-12-14 13:49:25 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Use ActionFactory to create main menu. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFilterControl.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CScriptView.java trunk/crossfire/src/cfeditor/IGUIConstants.java trunk/crossfire/src/cfeditor/MapViewIFrame.java trunk/crossfire/src/cfeditor/action.properties trunk/crossfire/src/cfeditor/filter/AttributeFilter.java trunk/crossfire/src/cfeditor/filter/Filter.java trunk/crossfire/src/cfeditor/filter/NamedFilterList.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/crossfire/src/cfeditor/parameter/FilterParameterView.java Added Paths: ----------- trunk/crossfire/resource/icons/development/Jar16.gif trunk/crossfire/resource/icons/general/About16.gif trunk/crossfire/resource/icons/general/Copy16.gif trunk/crossfire/resource/icons/general/Cut16.gif trunk/crossfire/resource/icons/general/Delete16.gif trunk/crossfire/resource/icons/general/Help16.gif trunk/crossfire/resource/icons/general/New16.gif trunk/crossfire/resource/icons/general/Paste16.gif trunk/crossfire/resource/icons/general/Preferences16.gif trunk/crossfire/resource/icons/general/Properties16.gif trunk/crossfire/resource/icons/general/Refresh16.gif trunk/crossfire/resource/icons/general/Remove16.gif trunk/crossfire/resource/icons/general/Replace16.gif trunk/crossfire/resource/icons/general/Save16.gif trunk/crossfire/resource/icons/general/SaveAs16.gif Removed Paths: ------------- trunk/crossfire/resource/icons/ImportTilesetSmallIcon.gif trunk/crossfire/resource/icons/NewLevelSmallIcon.gif trunk/crossfire/resource/icons/NextWindowSmallIcon.gif trunk/crossfire/resource/icons/OpenLevelSmallIcon.gif trunk/crossfire/resource/icons/PrevWindowSmallIcon.gif trunk/crossfire/resource/icons/RedoSmallIcon.gif trunk/crossfire/resource/icons/RemoveTilesetSmallIcon.gif trunk/crossfire/resource/icons/UndoSmallIcon.gif trunk/crossfire/src/cfeditor/CMainMenu.java Deleted: trunk/crossfire/resource/icons/ImportTilesetSmallIcon.gif =================================================================== (Binary files differ) Deleted: trunk/crossfire/resource/icons/NewLevelSmallIcon.gif =================================================================== (Binary files differ) Deleted: trunk/crossfire/resource/icons/NextWindowSmallIcon.gif =================================================================== (Binary files differ) Deleted: trunk/crossfire/resource/icons/OpenLevelSmallIcon.gif =================================================================== (Binary files differ) Deleted: trunk/crossfire/resource/icons/PrevWindowSmallIcon.gif =================================================================== (Binary files differ) Deleted: trunk/crossfire/resource/icons/RedoSmallIcon.gif =================================================================== (Binary files differ) Deleted: trunk/crossfire/resource/icons/RemoveTilesetSmallIcon.gif =================================================================== (Binary files differ) Deleted: trunk/crossfire/resource/icons/UndoSmallIcon.gif =================================================================== (Binary files differ) Added: trunk/crossfire/resource/icons/development/Jar16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/development/Jar16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/About16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/About16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/Copy16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/Copy16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/Cut16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/Cut16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/Delete16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/Delete16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/Help16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/Help16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/New16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/New16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/Paste16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/Paste16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/Preferences16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/Preferences16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/Properties16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/Properties16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/Refresh16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/Refresh16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/Remove16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/Remove16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/Replace16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/Replace16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/Save16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/Save16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/crossfire/resource/icons/general/SaveAs16.gif =================================================================== (Binary files differ) Property changes on: trunk/crossfire/resource/icons/general/SaveAs16.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/crossfire/src/cfeditor/CFilterControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CFilterControl.java 2006-12-14 21:36:04 UTC (rev 1064) +++ trunk/crossfire/src/cfeditor/CFilterControl.java 2006-12-14 21:49:25 UTC (rev 1065) @@ -16,10 +16,9 @@ import cfeditor.filter.NamedFilterListener; import cfeditor.gameobject.GameObject; import cfeditor.map.MapControl; -import cfeditor.menu.BasicMenuEntry; -import javax.swing.JComponent; import javax.swing.JMenu; -import org.jetbrains.annotations.Nullable; +import javax.swing.JMenuItem; +import net.sf.japi.swing.ActionFactory; /** * Control for filters. @@ -42,6 +41,9 @@ //TODO allow implementation of own filter public final class CFilterControl implements NamedFilterListener, ConfigListener { + /** Action Factory to create Actions. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + public static final int MAX_HIGHLIGHT = 3; private final boolean filterOut = false; @@ -83,8 +85,16 @@ return defaultFilter; } - public BasicMenuEntry createMenuEntry() { - return new FilterControlMenuEntry(); + public void createMenuEntries(final JMenu menu) { + final JMenuItem menuItem = filterList.createMenuEntry(filterOutConfig); + menuItem.setText("Filter view"); + menu.add(menuItem); + menu.addSeparator(); + for (int i = 0; i < MAX_HIGHLIGHT; i++) { + final JMenuItem menuItem2 = filterList.createMenuEntry(highLightConfig[i]); + menuItem2.setText("Highlight " + i); + menu.add(menuItem2); + } } /* ---------- use part --------------*/ @@ -140,45 +150,6 @@ } } - private final class FilterControlMenuEntry extends BasicMenuEntry { - - FilterControlMenuEntry() { - super("<<set me>>"); - } - - @Override protected void update() { - // nothing to do - } - - @Override protected void updateItem(final JComponent item) { - // nothing to do - } - - @Override public JComponent getMenuBarComponent() { - final JMenu menu = new JMenu(getName()); - final BasicMenuEntry outEntry = filterList.createMenuEntry(filterOutConfig); - outEntry.setName("Filter view"); - final JComponent out = outEntry.getMenuItemComponent(); - menu.add(out); - menu.addSeparator(); - for (int i = 0; i < MAX_HIGHLIGHT; i++) { - final BasicMenuEntry bme = filterList.createMenuEntry(highLightConfig[i]); - bme.setName("Highlight " + i); - final JComponent hl = bme.getMenuItemComponent(); - menu.add(hl); - } - return menu; - } - - @Override public JComponent getMenuItemComponent() { - return getMenuBarComponent(); - } - - @Override @Nullable public JComponent getToolbarComponent() { - return null; - } - } - public boolean addFilter(final String name, final Filter f) { return filterList.addFilter(name, f); } Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-14 21:36:04 UTC (rev 1064) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-12-14 21:49:25 UTC (rev 1065) @@ -90,7 +90,7 @@ public static final String LOAD_ARCH_COLL = "loadArchFromCollection"; - public static final String PICKMAPS_LOCKED = "pickmapsLocked"; + private static final String PICKMAPS_LOCKED = "pickmapsLocked"; /** Preferences key for language. */ public static final String PREFS_LANGUAGE = "language"; @@ -180,8 +180,8 @@ public CMainControl() { instance = this; archetypeSet = new ArchetypeSet(this); - mainView = new CMainView(this); scriptControl = new CScriptController(this); + mainView = new CMainView(); } /** @@ -215,7 +215,7 @@ if (autoPopupDocu) { // do an automated help popup because the docu version has increased // (people won't notice the docu otherwise - nobody expects a docu in opensource) - openHelpWindow(); + onlineHelp(); autoPopupDocu = false; } @@ -248,8 +248,15 @@ } } + /** Show about dialog. */ + @ActionMethod public void about() { + mainView.about(); + } + /** Collect crossfire archetypes. */ public void collectArches() { + getMainView().update(getMainView().getGraphics()); + if (archetypeSet.getLoadStatus() != ArchetypeSet.LoadStatus.COMPLETE) { // must not collect arches while arch stack not complete ACTION_FACTORY.showMessageDialog(mainView, "collectArchesNotReady"); @@ -267,6 +274,11 @@ collector.start(); } + /** Collect Spells. */ + @ActionMethod public void collectSpells() { + getTypeList().importSpellsWanted(this); + } + /** View Treasure Lists. */ @ActionMethod public void viewTreasurelists() { CFTreasureListTree.getInstance().showDialog(); @@ -324,7 +336,7 @@ * each map where this type has not yet been used. * @param newType new selected edit type (should not be more than one) */ - void selectEditType(final int newType) { + private void selectEditType(final int newType) { // calculate the new type for all opened maps: for (final MapControl level : levels) { level.addEditType(newType); // calculate new type @@ -333,15 +345,88 @@ setTileEdit(newType); // activate the new type for all views } + public boolean isAutoJoin() { + return autoJoin; + } + public void setAutoJoin(final boolean autoJoin) { this.autoJoin = autoJoin; } - public boolean isAutoJoin() { - return autoJoin; + private void setShow(final boolean show, final int editType) { + if (show) { + selectEditType(editType); + } else { + unsetTileEdit(editType); + } + refreshCurrentMap(); } - public void openHelpWindow() { + public boolean isShowMonster() { + return isTileEdit(IGUIConstants.TILE_EDIT_MONSTER); + } + + public void setShowMonster(final boolean showMonster) { + setShow(showMonster, IGUIConstants.TILE_EDIT_MONSTER); + } + + public boolean isShowExit() { + return isTileEdit(IGUIConstants.TILE_EDIT_EXIT); + } + + public void setShowExit(final boolean showExit) { + setShow(showExit, IGUIConstants.TILE_EDIT_EXIT); + } + + public boolean isShowBackground() { + return isTileEdit(IGUIConstants.TILE_EDIT_BACKGROUND); + } + + public void setShowBackground(final boolean showBackground) { + setShow(showBackground, IGUIConstants.TILE_EDIT_BACKGROUND); + } + + public boolean isShowDoor() { + return isTileEdit(IGUIConstants.TILE_EDIT_DOOR); + } + + public void setShowDoor(final boolean showDoor) { + setShow(showDoor, IGUIConstants.TILE_EDIT_DOOR); + } + + public boolean isShowWall() { + return isTileEdit(IGUIConstants.TILE_EDIT_WALL); + } + + public void setShowWall(final boolean showWall) { + setShow(showWall, IGUIConstants.TILE_EDIT_WALL); + } + + public boolean isShowEquipment() { + return isTileEdit(IGUIConstants.TILE_EDIT_EQUIP); + } + + public void setShowEquipment(final boolean showEquipment) { + setShow(showEquipment, IGUIConstants.TILE_EDIT_EQUIP); + } + + public boolean isShowTreasure() { + return isTileEdit(IGUIConstants.TILE_EDIT_TREASURE); + } + + public void setShowTreasure(final boolean showTreasure) { + setShow(showTreasure, IGUIConstants.TILE_EDIT_TREASURE); + } + + public boolean isShowConnected() { + return isTileEdit(IGUIConstants.TILE_EDIT_CONNECTED); + } + + public void setShowConnected(final boolean showConnected) { + setShow(showConnected, IGUIConstants.TILE_EDIT_CONNECTED); + } + + public void onlineHelp() { mainView.openHelpWindow(); } @@ -1110,17 +1195,14 @@ } } - boolean isTileShow() { + public boolean isTileShow() { return currentMap.isTileShow(); } - void setTileShow() { - // TODO: implement this + public void setTileShow(final boolean tileShow) { + currentMap.setTileShow(tileShow); } - void toggleShowTiles() { - } - private PreferencesGroup prefsGroup; public void options() { @@ -1225,6 +1307,36 @@ } } + /** Action method for entering the north map. */ + public void enterNorthMap() { + enterTileWanted(IGUIConstants.NORTH); + } + + /** Action method for entering the east map. */ + public void enterEastMap() { + enterTileWanted(IGUIConstants.EAST); + } + + /** Action method for entering the south map. */ + public void enterSouthMap() { + enterTileWanted(IGUIConstants.SOUTH); + } + + /** Action method for entering the west map. */ + public void enterWestMap() { + enterTileWanted(IGUIConstants.WEST); + } + + /** Action method for entering the upper map. */ + public void enterUpperMap() { + enterTileWanted(IGUIConstants.TOP); + } + + /** Action method for entering the lower map. */ + public void enterLowerMap() { + enterTileWanted(IGUIConstants.BOTTOM); + } + /** * Try to load the map where the specified map-tile path points to. * Usually this method can only be invoked when such a path exists. @@ -1525,7 +1637,7 @@ * @return true if a level is being edited or false if not */ boolean isLevelEdited() { - return currentMap != null; + return currentMap != null && currentMap.isLevelChanged(); } /** Deleted: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-12-14 21:36:04 UTC (rev 1064) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-12-14 21:49:25 UTC (rev 1065) @@ -1,1354 +0,0 @@ -/* - * Crossfire Java Editor. - * Copyright (C) 2000 Michael Toennies - * Copyright (C) 2001 Andreas Vogl - * - * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - */ - -package cfeditor; - -import cfeditor.gameobject.ArchetypeSet; -import cfeditor.menu.AggregateMenuLocation; -import cfeditor.menu.BasicMenuEntry; -import cfeditor.menu.CheckBoxMenuEntry; -import cfeditor.menu.LocationMenuEntry; -import cfeditor.menu.MenuGroup; -import cfeditor.menu.MenuManager; -import cfeditor.menu.SimpleMenuEntry; -import cfeditor.menu.SimpleMenuLocation; -import cfeditor.menu.MenuEntry; -import java.awt.Event; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyEvent; -import java.util.List; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.KeyStroke; -import javax.swing.UIManager; - -/** - * <code>CMainMenu</code implements the main menu of the application. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - */ -public final class CMainMenu extends JMenuBar { - - /** Controller of this menu view. */ - private final CMainControl mainControl; - - private AggregateMenuLocation mainLocation; - - private AggregateMenuLocation currentmapLocation; - - private JMenu windowMenu; - - private SimpleMenuEntry close; - - private SimpleMenuEntry revert; - - private SimpleMenuEntry save; - - private SimpleMenuEntry saveAs; - - private SimpleMenuEntry createImg; - - private SimpleMenuEntry collectArch; - - private SimpleMenuEntry spellC; - - private SimpleMenuEntry viewTreasure; - - private CheckBoxMenuEntry autojoin; - - private CheckBoxMenuEntry gridToggle; - - private SimpleMenuEntry properties; - - private SimpleMenuEntry enterExit; - - private SimpleMenuEntry enterNorth; - - private SimpleMenuEntry enterEast; - - private SimpleMenuEntry enterWest; - - private SimpleMenuEntry enterSouth; - - private SimpleMenuEntry enterUpper; - - private SimpleMenuEntry enterLower; - - private CheckBoxMenuEntry showTiles; - - private CheckBoxMenuEntry lockPickmaps; - - private SimpleMenuEntry newPickmap; - - private SimpleMenuEntry deletePickmap; - - private SimpleMenuEntry loadPickmap; - - private SimpleMenuEntry savePickmap; - - private SimpleMenuEntry revertPickmap; - - private SimpleMenuEntry clear; - - private SimpleMenuEntry cut; - - private SimpleMenuEntry copy; - - private SimpleMenuEntry paste; - - private SimpleMenuEntry replace; - - private SimpleMenuEntry fillAbove; - - private SimpleMenuEntry fillBelow; - - private CheckBoxMenuEntry monster; - - private CheckBoxMenuEntry exit; - - private CheckBoxMenuEntry background; - - private CheckBoxMenuEntry door; - - private CheckBoxMenuEntry wall; - - private CheckBoxMenuEntry equip; - - private CheckBoxMenuEntry treasure; - - private CheckBoxMenuEntry connected; - - private JMenuItem newWindow; - - private JMenuItem closeAll; - - /*private JCheckBoxMenuItem[] m_analyze_show_filters; - private JCheckBoxMenuItem m_analyze_show_activate; - private JCheckBoxMenuItem m_analyze_show_invert; - private JMenu m_analyze_show; - private JCheckBoxMenuItem[][] m_analyze_highLight_filters; - private JCheckBoxMenuItem[] m_analyze_highLight_activate; - private JCheckBoxMenuItem[] m_analyze_highLight_invert; - private JMenu[] m_analyze_highLight;*/ - - private static final long serialVersionUID = 1491480879950551491L; - - /** - * Constructs a main menu. - * @param mainControl The controller of this main menu. - */ - CMainMenu(final CMainControl mainControl) { - this.mainControl = mainControl; // reference to main control - buildAggregates(); - buildFileMenu(); - buildEditMenu(); - buildMapMenu(); - buildPickmapsMenu(); - buildResourceMenu(); - //buildScriptMenu(); - buildAnalyzeMenu(); - buildViewMenu(); - buildBshMenu(); - buildWindowMenu(); - buildHelpMenu(); - buildCurrentMapMenu(); - } - - private void buildAggregates() { - mainLocation = new AggregateMenuLocation("main"); - final AggregateMenuLocation toolbarLocation = new AggregateMenuLocation("toolbar"); - currentmapLocation = new AggregateMenuLocation("currentmap"); - MenuManager.getMenuManager().addMenuLocation(mainLocation); - MenuManager.getMenuManager().addMenuLocation(toolbarLocation); - MenuManager.getMenuManager().addMenuLocation(currentmapLocation); - } - - private void buildCurrentMapMenu() { - currentmapLocation.addMenuEntry(save); - currentmapLocation.addMenuEntry(saveAs); - currentmapLocation.addMenuEntry(createImg); - currentmapLocation.addMenuEntry(revert); - currentmapLocation.addMenuEntry(autojoin); - currentmapLocation.addMenuEntry(properties); - currentmapLocation.addMenuEntry(fillAbove); - currentmapLocation.addMenuEntry(fillBelow); - } - - /** - * Creates the "File"-Menu. - */ - private void buildFileMenu() { - final MenuManager menuManager = MenuManager.getMenuManager(); - final SimpleMenuLocation fileMenu = new SimpleMenuLocation("main.file"); - menuManager.addMenuLocation(fileMenu); - mainLocation.addMenuLocation(fileMenu); - final LocationMenuEntry entry = new LocationMenuEntry("main.file", "File"); - menuManager.addMenuEntry("main", entry); - entry.setMnemonic('F'); - - final SimpleMenuEntry newME = new SimpleMenuEntry("New..."); - newME.setIcon(CGUIUtils.getIcon(IGUIConstants.NEW_LEVEL_SMALLICON)); - newME.setMnemonic('N'); - newME.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK)); - newME.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.createNew(); - } - }); - menuManager.addMenuEntry("main.file", newME); - - final SimpleMenuEntry open = new SimpleMenuEntry("Open..."); - open.setIcon(CGUIUtils.getIcon(IGUIConstants.OPEN_LEVEL_SMALLICON)); - open.setMnemonic('O'); - open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.CTRL_MASK)); - open.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.open(); - } - }); - menuManager.addMenuEntry("main.file", open); - - close = new SimpleMenuEntry("Close"); - close.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - close.setMnemonic('C'); - close.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, Event.CTRL_MASK)); - close.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.close(); - } - }); - menuManager.addMenuEntry("main.file", close); - - menuManager.addMenuEntry("main.file", MenuEntry.getSeparator()); - - save = new SimpleMenuEntry("Save"); - save.setIcon(CGUIUtils.getIcon(IGUIConstants.SAVE_LEVEL_SMALLICON)); - save.setMnemonic('S'); - save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK)); - save.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.save(); - } - }); - menuManager.addMenuEntry("main.file", save); - - saveAs = new SimpleMenuEntry("Save as..."); - saveAs.setIcon(CGUIUtils.getIcon(IGUIConstants.SAVE_LEVEL_AS_SMALLICON)); - saveAs.setMnemonic('A'); - saveAs.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, Event.CTRL_MASK)); - saveAs.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.saveAs(); - } - }); - menuManager.addMenuEntry("main.file", saveAs); - - revert = new SimpleMenuEntry("Revert"); - revert.setMnemonic('R'); - revert.setIcon(CGUIUtils.getIcon(IGUIConstants.REVERT_ICON)); - revert.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.revert(); - } - }); - menuManager.addMenuEntry("main.file", revert); - - createImg = new SimpleMenuEntry("Create image"); - createImg.setMnemonic('I'); - createImg.setIcon(CGUIUtils.getIcon(IGUIConstants.CREATE_IMAGE_SMALLICON)); - createImg.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.createImg(); - } - }); - menuManager.addMenuEntry("main.file", createImg); - - menuManager.addMenuEntry("main.file", SimpleMenuEntry.getSeparator()); - - final SimpleMenuEntry options = new SimpleMenuEntry("Options..."); - options.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - options.setMnemonic('P'); - options.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, Event.ALT_MASK)); - options.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.options(); - } - }); - menuManager.addMenuEntry("main.file", options); - - menuManager.addMenuEntry("main.file", SimpleMenuEntry.getSeparator()); - - final SimpleMenuEntry exit = new SimpleMenuEntry("Exit"); - exit.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - exit.setMnemonic('X'); - exit.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.exit(); - } - }); - menuManager.addMenuEntry("main.file", exit); - add(entry.getMenuBarComponent()); - } - - /** - * Creates the "Edit"-Menu. - */ - private void buildEditMenu() { - final MenuManager menuManager = MenuManager.getMenuManager(); - final SimpleMenuLocation editMenu = new SimpleMenuLocation("main.edit"); - mainLocation.addMenuLocation(editMenu); - menuManager.addMenuLocation(editMenu); - final LocationMenuEntry entry = new LocationMenuEntry("main.edit", "Edit"); - menuManager.addMenuEntry("main", entry); - entry.setMnemonic('E'); - - // Clear: - clear = new SimpleMenuEntry("Clear"); - clear.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - clear.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.clear(); - } - }); - menuManager.addMenuEntry("main.edit", clear); - - // Cut: - cut = new SimpleMenuEntry("Cut"); - cut.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - cut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.CTRL_MASK)); - cut.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.cut(); - } - }); - menuManager.addMenuEntry("main.edit", cut); - - // Copy: - copy = new SimpleMenuEntry("Copy"); - copy.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - copy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, Event.CTRL_MASK)); - copy.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.copy(); - } - }); - menuManager.addMenuEntry("main.edit", copy); - - // Paste: - paste = new SimpleMenuEntry("Paste"); - paste.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - paste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, Event.CTRL_MASK)); - paste.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.paste(); - } - }); - menuManager.addMenuEntry("main.edit", paste); - - menuManager.addMenuEntry("main.edit", MenuEntry.getSeparator()); - - // Replace: - replace = new SimpleMenuEntry("Replace"); - replace.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - replace.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, Event.CTRL_MASK)); - replace.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.replace(); - } - }); - menuManager.addMenuEntry("main.edit", replace); - - // Fill: - fillAbove = new SimpleMenuEntry("Fill Above"); - fillAbove.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - fillAbove.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, Event.CTRL_MASK)); - fillAbove.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.fillAbove(); - } - }); - menuManager.addMenuEntry("main.edit", fillAbove); - - // Fill: - fillBelow = new SimpleMenuEntry("Fill Below"); - fillBelow.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - fillBelow.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, Event.CTRL_MASK | Event.SHIFT_MASK)); - fillBelow.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.fillBelow(); - } - }); - menuManager.addMenuEntry("main.edit", fillBelow); - - // Random Fill: - final SimpleMenuEntry randFillAbove = new SimpleMenuEntry("Random Fill Above"); - randFillAbove.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - randFillAbove.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, Event.CTRL_MASK)); - randFillAbove.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.randFillAbove(); - } - }); - menuManager.addMenuEntry("main.edit", randFillAbove); - - // Random Fill: - final SimpleMenuEntry randFillBelow = new SimpleMenuEntry("Random Fill Below"); - randFillBelow.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - randFillBelow.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, Event.CTRL_MASK | Event.SHIFT_MASK)); - randFillBelow.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.randFillBelow(); - } - }); - menuManager.addMenuEntry("main.edit", randFillBelow); - - final SimpleMenuEntry garbageCollection = new SimpleMenuEntry("Run Garbage Collection"); - garbageCollection.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - garbageCollection.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.gc(); - } - }); - menuManager.addMenuEntry("main.edit", garbageCollection); - - add(entry.getMenuBarComponent()); - } - - private void buildViewMenu() { - final MenuManager menuManager = MenuManager.getMenuManager(); - final SimpleMenuLocation viewMenu = new SimpleMenuLocation("main.view"); - mainLocation.addMenuLocation(viewMenu); - menuManager.addMenuLocation(viewMenu); - final LocationMenuEntry entry = new LocationMenuEntry("main.view", "View"); - menuManager.addMenuEntry("main", entry); - entry.setMnemonic('V'); - - final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); - final UIManager.LookAndFeelInfo[] lafInfos = UIManager.getInstalledLookAndFeels(); - final MenuGroup group = new MenuGroup(); - //JCheckBoxMenuItem selectedMenuItem = null; - final String strSelectedLNFName = settings.getProperty(CMainView.SELECTED_LNF_KEY, - UIManager.getCrossPlatformLookAndFeelClassName()); - for (final UIManager.LookAndFeelInfo lafInfo : lafInfos) { - final CheckBoxMenuEntry menuItem = new CheckBoxMenuEntry(lafInfo.getName()); - if (strSelectedLNFName.compareTo(lafInfo.getClassName()) == 0) { - menuItem.setChecked(true); - } - - menuItem.addActionListener(new CLNFActionListener(lafInfo.getClassName())); - menuManager.addMenuEntry("main.view", menuItem); - group.add(menuItem); - } - - menuManager.addMenuEntry("main.view", MenuEntry.getSeparator()); - - menuManager.addMenuEntry("main.view", MenuEntry.getSeparator()); - - monster = new CheckBoxMenuEntry("Show Monsters"); - monster.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_MONSTER)); - monster.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - if (monster.isChecked()) { - mainControl.selectEditType(IGUIConstants.TILE_EDIT_MONSTER); - } else { - mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_MONSTER); - } - mainControl.refreshCurrentMap(); - } - }); - menuManager.addMenuEntry("main.view", monster); - - exit = new CheckBoxMenuEntry("Show Exits"); - exit.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_EXIT)); - exit.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - if (exit.isChecked()) { - mainControl.selectEditType(IGUIConstants.TILE_EDIT_EXIT); - } else { - mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_EXIT); - } - mainControl.refreshCurrentMap(); - } - }); - menuManager.addMenuEntry("main.view", exit); - - background = new CheckBoxMenuEntry("Show Background"); - background.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_BACKGROUND)); - background.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - if (background.isChecked()) { - mainControl.selectEditType(IGUIConstants.TILE_EDIT_BACKGROUND); - } else { - mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_BACKGROUND); - } - mainControl.refreshCurrentMap(); - } - }); - menuManager.addMenuEntry("main.view", background); - - door = new CheckBoxMenuEntry("Show Doors & Keys"); - door.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_DOOR)); - door.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - if (door.isChecked()) { - mainControl.selectEditType(IGUIConstants.TILE_EDIT_DOOR); - } else { - mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_DOOR); - } - mainControl.refreshCurrentMap(); - } - }); - menuManager.addMenuEntry("main.view", door); - wall = new CheckBoxMenuEntry("Show Wall"); - wall.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_WALL)); - wall.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - if (wall.isChecked()) { - mainControl.selectEditType(IGUIConstants.TILE_EDIT_WALL); - } else { - mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_WALL); - } - mainControl.refreshCurrentMap(); - } - }); - menuManager.addMenuEntry("main.view", wall); - equip = new CheckBoxMenuEntry("Show Equipment"); - equip.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_EQUIP)); - equip.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - if (equip.isChecked()) { - mainControl.selectEditType(IGUIConstants.TILE_EDIT_EQUIP); - } else { - mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_EQUIP); - } - mainControl.refreshCurrentMap(); - } - }); - menuManager.addMenuEntry("main.view", equip); - treasure = new CheckBoxMenuEntry("Show Treasure"); - treasure.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_TREASURE)); - treasure.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - if (treasure.isChecked()) { - mainControl.selectEditType(IGUIConstants.TILE_EDIT_TREASURE); - } else { - mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_TREASURE); - } - mainControl.refreshCurrentMap(); - } - }); - menuManager.addMenuEntry("main.view", treasure); - connected = new CheckBoxMenuEntry("Show Connected"); - connected.setChecked(mainControl.isTileEdit(IGUIConstants.TILE_EDIT_CONNECTED)); - connected.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - if (connected.isChecked()) { - mainControl.selectEditType(IGUIConstants.TILE_EDIT_CONNECTED); - } else { - mainControl.unsetTileEdit(IGUIConstants.TILE_EDIT_CONNECTED); - } - mainControl.refreshCurrentMap(); - } - }); - menuManager.addMenuEntry("main.view", connected); - menuManager.addMenuEntry("main.view", MenuEntry.getSeparator()); - final SimpleMenuEntry showAll = new SimpleMenuEntry("Reset View"); - showAll.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - // set tileEdit to zero (-> show all) - mainControl.unsetTileEdit(~0); - monster.setChecked(false); - exit.setChecked(false); - background.setChecked(false); - door.setChecked(false); - wall.setChecked(false); - equip.setChecked(false); - treasure.setChecked(false); - connected.setChecked(false); - mainControl.refreshCurrentMap(); // redraw map - } - }); - menuManager.addMenuEntry("main.view", showAll); - - add(entry.getMenuBarComponent()); - } - - private void buildMapMenu() { - final SimpleMenuLocation mapMenu = new SimpleMenuLocation("main.map"); - final LocationMenuEntry entry = new LocationMenuEntry("main.map", "Map"); - final MenuManager menuManager = MenuManager.getMenuManager(); - menuManager.addMenuLocation(mapMenu); - mainLocation.addMenuLocation(mapMenu); - entry.setMnemonic('M'); - menuManager.addMenuEntry("main", entry); - - autojoin = new CheckBoxMenuEntry("Auto-Joining"); - autojoin.setMnemonic('A'); - autojoin.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, Event.CTRL_MASK)); - autojoin.setChecked(mainControl.isAutoJoin()); - autojoin.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - // toggle autojoining state on/off - mainControl.setAutoJoin(autojoin.isChecked()); - } - }); - menuManager.addMenuEntry("main.map", autojoin); - - menuManager.addMenuEntry("main.map", MenuEntry.getSeparator()); - - gridToggle = new CheckBoxMenuEntry("Show Grid"); - gridToggle.setMnemonic('G'); - gridToggle.setChecked(mainControl.isGridVisible()); - - gridToggle.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.setGridVisible(gridToggle.isChecked()); - } - }); - menuManager.addMenuEntry("main.map", gridToggle); - - enterExit = new SimpleMenuEntry("Enter Exit"); - enterExit.setMnemonic('E'); - enterExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, Event.CTRL_MASK)); - enterExit.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.enterExit(); - } - }); - menuManager.addMenuEntry("main.map", enterExit); - menuManager.addMenuEntry("main.map", MenuEntry.getSeparator()); - - enterNorth = new SimpleMenuEntry("Enter North Map"); - enterNorth.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_UP, Event.CTRL_MASK)); - enterNorth.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.enterTileWanted(IGUIConstants.NORTH); - } - }); - menuManager.addMenuEntry("main.map", enterNorth); - - enterEast = new SimpleMenuEntry("Enter East Map"); - enterEast.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Event.CTRL_MASK)); - enterEast.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.enterTileWanted(IGUIConstants.EAST); - } - }); - menuManager.addMenuEntry("main.map", enterEast); - - enterSouth = new SimpleMenuEntry("Enter South Map"); - enterSouth.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, Event.CTRL_MASK)); - enterSouth.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.enterTileWanted(IGUIConstants.SOUTH); - } - }); - menuManager.addMenuEntry("main.map", enterSouth); - - enterWest = new SimpleMenuEntry("Enter West Map"); - enterWest.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.CTRL_MASK)); - enterWest.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.enterTileWanted(IGUIConstants.WEST); - } - }); - menuManager.addMenuEntry("main.map", enterWest); - - enterUpper = new SimpleMenuEntry("Enter Upper Map"); - enterUpper.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, Event.CTRL_MASK)); - enterUpper.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.enterTileWanted(IGUIConstants.TOP); - } - }); - menuManager.addMenuEntry("main.map", enterUpper); - - enterLower = new SimpleMenuEntry("Enter Lower Map"); - enterLower.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, Event.CTRL_MASK)); - enterLower.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.enterTileWanted(IGUIConstants.BOTTOM); - } - }); - menuManager.addMenuEntry("main.map", enterLower); - - menuManager.addMenuEntry("main.map", MenuEntry.getSeparator()); - - showTiles = new CheckBoxMenuEntry("Show Tiles around"); - showTiles.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.toggleShowTiles(); - } - }); - menuManager.addMenuEntry("main.map", showTiles); - - menuManager.addMenuEntry("main.map", MenuEntry.getSeparator()); - properties = new SimpleMenuEntry("Map Properties"); - properties.setMnemonic('P'); - properties.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, Event.CTRL_MASK)); - properties.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.mapProperties(); - } - }); - menuManager.addMenuEntry("main.map", properties); - add(entry.getMenuBarComponent()); - } - - private void buildPickmapsMenu() { - final SimpleMenuLocation pickmapsMenu = new SimpleMenuLocation("main.pickmaps"); - final LocationMenuEntry entry = new LocationMenuEntry("main.pickmaps", "Pickmaps"); - final MenuManager menuManager = MenuManager.getMenuManager(); - mainLocation.addMenuLocation(pickmapsMenu); - menuManager.addMenuLocation(pickmapsMenu); - entry.setMnemonic('P'); - menuManager.addMenuEntry("main", entry); - - lockPickmaps = new CheckBoxMenuEntry("Lock All Pickmaps"); - lockPickmaps.setMnemonic('L'); - lockPickmaps.setChecked(Boolean.valueOf(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( - CMainControl.PICKMAPS_LOCKED, "false"))); - lockPickmaps.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - // lock pickmaps - mainControl.setLockAllPickmaps(lockPickmaps.isChecked()); - newPickmap.setEnabled(!lockPickmaps.isChecked()); - - final boolean isArchLoadComplete = mainControl.getArchetypeSet().getLoadStatus() == ArchetypeSet.LoadStatus.COMPLETE; - if (isArchLoadComplete) { - deletePickmap.setEnabled(!lockPickmaps.isChecked()); - loadPickmap.setEnabled(!lockPickmaps.isChecked()); - savePickmap.setEnabled(!lockPickmaps.isChecked()); - revertPickmap.setEnabled(!lockPickmaps.isChecked()); - } else { - deletePickmap.setEnabled(false); - loadPickmap.setEnabled(false); - savePickmap.setEnabled(false); - revertPickmap.setEnabled(false); - } - - // store this in the settings - CSettings.getInstance(IGUIConstants.APP_NAME).setProperty(CMainControl.PICKMAPS_LOCKED, lockPickmaps.isChecked() ? "true" : "false"); - } - }); - menuManager.addMenuEntry("main.pickmaps", lockPickmaps); - - menuManager.addMenuEntry("main.pickmaps", MenuEntry.getSeparator()); - - newPickmap = new SimpleMenuEntry("Add New Pickmap"); - newPickmap.setMnemonic('N'); - newPickmap.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - newPickmap.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - // create new pickmap - mainControl.addNewPickmap(); - } - }); - menuManager.addMenuEntry("main.pickmaps", newPickmap); - - deletePickmap = new SimpleMenuEntry("Close Active Pickmap"); - deletePickmap.setMnemonic('C'); - deletePickmap.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - deletePickmap.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - // close pickmap - mainControl.closePickmap(); - } - }); - menuManager.addMenuEntry("main.pickmaps", deletePickmap); - menuManager.addMenuEntry("main.pickmaps", MenuEntry.getSeparator()); - - loadPickmap = new SimpleMenuEntry("Open Active Pickmap as Map"); - loadPickmap.setMnemonic('O'); - loadPickmap.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); - loadPickmap.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - // load pickmap as normal map - mainControl.openPickmapMap(); - } - }); - menuManager.addMenuEntry("main.pickmaps", loadPickmap); - - savePickmap = new SimpleMenuEntry("Save Active Pickmap"); - savePickmap.setMnemonic('S'); - savePickmap.setIcon(CGUIUtils.getIcon(IGUIConstants.SAVE_LEVEL_SMALLICON)); - savePickmap.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - // save pickmap - mainControl.savePickmap(); - } - }); - menuManager.addMenuEntry("main.pickmaps", savePickmap); - - revertPickmap = new SimpleMenuEntry("Revert Active Pickmap"); - revertPickmap.setMnemonic('R'); - revertPickmap.setIcon(CGUIUtils.getIcon(IGUIConstants.REVERT_ICON)); - revertPickmap.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - // revert pickmap - mainControl.revertPickmap(); - } - }); - menuManager.addMenuEntry("main.pickmaps", revertPickmap); - - add(entry.getMenuBarComponent()); - } - - private void buildResourceMenu() { - final SimpleMenuLocation collectMenu = new SimpleMenuLocation("main.resources"); - final LocationMenuEntry entry = new LocationMenuEntry("main.resources", "Resources"); - final MenuManager menuManager = MenuManager.getMenuManager(); - mainLocation.addMenuLocation(collectMenu); - menuManager.addMenuLocation(collectMenu); - menuManager.addMenuEntry("main", entry); - entry.setMnemonic('R'); - - collectArch = new SimpleMenuEntry("Collect CF Arches"); - collectArch.setMnemonic('A'); - collectArch.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - //TODO fix this - //collectMenu.setPopupMenuVisible(false); - mainControl.getMainView().update(mainControl.getMainView().getGraphics()); - mainControl.collectArches(); - } - }); - menuManager.addMenuEntry("main.resources", collectArch); - - spellC = new SimpleMenuEntry("Collect Spells"); - spellC.setMnemonic('S'); - spellC.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.getTypeList().importSpellsWanted(mainControl); - } - }); - menuManager.addMenuEntry("main.resources", spellC); - menuManager.addMenuEntry("main.resources", MenuEntry.getSeparator()); - - viewTreasure = new SimpleMenuEntry("View Treasurelists"); - viewTreasure.setMnemonic('T'); - viewTreasure.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - // show the treasurelist tree - CFTreasureListTree.getInstance().showDialog(); - } - }); - menuManager.addMenuEntry("main.resources", viewTreasure); - - add(entry.getMenuBarComponent()); - } - - /*private void buildScriptMenu() { - menu_script = new JMenu("Scriptfire"); - menu_script.setMnemonic('S'); - - m_scriptMenu = new JMenuItem("under construction..."); - m_scriptMenu.setMnemonic('N'); - m_scriptMenu.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - } - }); - menu_script.add(m_scriptMenu); - //add(menu_script); - }*/ - - public void buildAnalyzeMenu() { - final MenuManager menuManager = MenuManager.getMenuManager(); - final CFilterControl filter = mainControl.getFilterControl(); - final BasicMenuEntry entry = filter.createMenuEntry(); - entry.setVisible(true); - entry.setMnemonic('y'); - entry.setName("Analyze"); - menuManager.addMenuEntry("main", entry); - add(entry.getMenuBarComponent()); - } - -/* - private void buildAnalyzeMenu() { - menu_analyze = new SimpleMenuLocation("main.analyze"); - final LocationMenuEntry entry = new LocationMenuEntry("main.analyze", "Analyze"); - final MenuManager menuManager = MenuManager.getMenuManager(); - mainLocation.addMenuLocation(menu_analyze); - menuManager.addMenuLocation(menu_analyze); - menuManager.addMenuEntry("main", entry); - entry.setMnemonic('y'); - final CFilterControl filter = mainControl.getFilterControl(); - m_analyze_show = new JMenu("Filter View"); - m_analyze_show.setMnemonic('v'); - m_analyze_show.setEnabled(false); - ActionListener showListener = new ActionListener() { - public void actionPerformed(final ActionEvent event) { - try {... [truncated message content] |