You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <chr...@us...> - 2006-10-03 12:35:30
|
Revision: 459 http://svn.sourceforge.net/gridarta/?rev=459&view=rev Author: christianhujer Date: 2006-10-03 05:35:02 -0700 (Tue, 03 Oct 2006) Log Message: ----------- Removed font-related features. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanel.java trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CArchQuickView.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchType.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CMainStatusbar.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/ReplaceDialog.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/MainControl.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-10-03 12:35:02 UTC (rev 459) @@ -90,12 +90,10 @@ setLayout(new BorderLayout()); tabDesktop = new JTabbedPane(SwingConstants.TOP); tabDesktop.setBorder(BorderFactory.createEmptyBorder(IGUIConstants.SPACE_PICKARCH_TOP, 0, 0, 0)); - mainControl.setBoldFont(tabDesktop); archQuickPanel = new CArchQuickView(mainControl); // archAndPickPane is the panel containing both archpanel and pickmaps archAndPickPane = new JTabbedPane(SwingConstants.TOP); - mainControl.setBoldFont(archAndPickPane); archAndPickPane.addTab(" Arch List ", tabDesktop); archAndPickPane.addTab(" Pickmaps ", mainControl.getMainView().getPickmapPanel()); // this listener informs the mainview which panel is active: archlist or pickmaps? @@ -236,11 +234,6 @@ repaint(); } - public void updateFont() { - mainControl.setBoldFont(tabDesktop); - refresh(); - } - public static final class PanelNode { public final CArchPanelPan data; Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-10-03 12:35:02 UTC (rev 459) @@ -81,7 +81,6 @@ panelDesktop.setLayout(new BorderLayout()); jbox = new JComboBox(); - this.mainControl.setBoldFont(jbox); model = new DefaultListModel(); theList = new JList(model); @@ -276,7 +275,6 @@ archPanel.setPanelArch(value.toString()); mainControl.setStatusText(" " + value + " "); } - mainControl.setPlainFont(this); setText(arch.getArchetypeName()); if (arch.getFaceFlag()) { Modified: trunk/crossfire/src/cfeditor/CArchQuickView.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-10-03 12:35:02 UTC (rev 459) @@ -59,12 +59,6 @@ this.mainControl = mainControl; setLayout(new BorderLayout(1, 1)); - // set font - mainControl.setPlainFont(archArchNameText); - mainControl.setPlainFont(archObjNameText); - mainControl.setPlainFont(archTypeText); - mainControl.setPlainFont(archTileText); - // setup a panel final JPanel panel = new JPanel(); final GridBagLayout gridbag = new GridBagLayout(); Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-03 12:35:02 UTC (rev 459) @@ -300,29 +300,11 @@ * lot more difficult, and probably not very convenient. */ public static void setDefaultBounds() { - final int fontsize; // size of current font - - if (CMainControl.getInstance().getPlainFont() != null) { - fontsize = CMainControl.getInstance().getPlainFont().getSize(); - } else { - fontsize = JFontChooser.getDefaultFont().getSize(); - } - - if (fontsize <= 13) { - // this is for fonts <= 13 (includes default font) - width = 395; - height = 505 + 30; - buttonBarHeight = 40; - inventoryWidth = 95; - chooseBoxHeight = 23; - } else { - // this is for the somewhat bigger fonts (>= 14) - width = 395 + 50; - height = 505 + 100; - buttonBarHeight = 40 + 5; - inventoryWidth = 120; - chooseBoxHeight = 25; - } + width = 395; + height = 505 + 30; + buttonBarHeight = 40; + inventoryWidth = 95; + chooseBoxHeight = 23; } /** @@ -1080,11 +1062,6 @@ } final Style docStyle = summaryTP.getStyle(StyleContext.DEFAULT_STYLE); - if (mainControl.getPlainFont() != null) { - StyleConstants.setFontFamily(docStyle, mainControl.getPlainFont().getFamily()); - StyleConstants.setFontSize(docStyle, mainControl.getPlainFont().getSize()); - //StyleConstants.setBold(docStyle, true); - } StyleConstants.setForeground(docStyle, Color.black); // now loop through all attributes and write out nonzero ones Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-10-03 12:35:02 UTC (rev 459) @@ -415,13 +415,11 @@ /** * Create the documentation to this GameObject-type. * @return the full html-text to be (parsed and) displayed + * @fixme my HTML is broken */ public String createHtmlDocu() { String text = ""; // String containing the whole html text - // there are two possible text sizes: normal and large - final boolean bigFont = CMainControl.getInstance().isBigFont(); - // write header (not displayed) text += "<HTML>\n<HEAD>\n<META NAME=\"CFJavaEditor\" CONTENT=\"tmp\">\n<TITLE>"; text += "Type: " + typeName; @@ -430,24 +428,12 @@ text += "<H1 align=center color=navy>Type: " + typeName + "</H1>\n"; // title if (desc != null && desc.trim().length() > 0) { - text += "<P><H" + (bigFont ? 2 : 3) + " color=navy>Functionality of " + typeName + ":</H" + (bigFont ? 2 : 3) + ">"; - if (bigFont) { - text += "<font size=\"4\">"; - } + text += "<P><H3 color=navy>Functionality of " + typeName + ":</H3>"; text += desc.trim() + "</P>"; - if (bigFont) { - text += "</font>"; - } } if (use != null && use.trim().length() > 0) { - text += "<P><H" + (bigFont ? 2 : 3) + " color=navy>Notes on Usage:</H" + (bigFont ? 2 : 3) + ">"; - if (bigFont) { - text += "<font size=\"4\">"; - } + text += "<P><H3 color=navy>Notes on Usage:</H3>"; text += use.trim() + "</P>"; - if (bigFont) { - text += "</font>"; - } } /* Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-10-03 12:35:02 UTC (rev 459) @@ -130,9 +130,6 @@ // draw thin blue lines connecting the nodes putClientProperty("JTree.lineStyle", "Angled"); - // font - CMainControl.getInstance().setPlainFont(this); - needSecondLink = new Vector<TreasureTreeNode>(); processSecondLinking = false; @@ -198,11 +195,6 @@ return instance; } - /** Update font for the JTree nodes */ - public void updateFont() { - renderer.updateFont(); - } - /** * @return The parent attribute dialog attached to this dialog. * If no attribute dialog is attached, or this dialog is hidden, @@ -910,18 +902,8 @@ final ImageIcon noarch; // icon for unknown arches - Font plain; // plain (editor-)font - - Font bold; // bold (editor-)font - /** Constructor: Load icons and initialize fonts */ public TreasureCellRenderer() { - plain = CMainControl.getInstance().getPlainFont(); - if (plain == null) { - plain = JFontChooser.getDefaultFont(); - } - bold = new Font(plain.getName(), Font.BOLD, plain.getSize()); - // get icons tlistIcon = cfeditor.CGUIUtils.getSysIcon(IGUIConstants.TILE_TREASURE); tlistOneIcon = cfeditor.CGUIUtils.getSysIcon(IGUIConstants.TILE_TREASUREONE); @@ -931,12 +913,6 @@ noarch = cfeditor.CGUIUtils.getSysIcon(IGUIConstants.TILE_NOARCH); } - /** Set current font provided by MainControl */ - public void updateFont() { - plain = CMainControl.getInstance().getPlainFont(); - bold = new Font(plain.getName(), Font.BOLD, plain.getSize()); - } - /** The cell-drawing method. */ @Override public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) { // first use the standard renderer to paint it all @@ -944,7 +920,6 @@ final DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; - setFont(plain); if (node.isRoot()) { this.setForeground(Color.gray); setIcon(null); @@ -998,18 +973,6 @@ setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); } - // set bold/plain font style - if (node.getParent() == root) { - if (content.getType() != TreasureObj.FOLDER) { - setFont(bold); - } - } else { - // parent is not root - final TreasureTreeNode parent = (TreasureTreeNode) node.getParent(); - if (parent.getTreasureObj().getType() == TreasureObj.FOLDER) { - setFont(bold); - } - } } return this; Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-03 12:35:02 UTC (rev 459) @@ -185,11 +185,6 @@ private boolean autoPopupDocu = false; // time for an automated docu popup? - // fonts used - private Font plainFont = null; // the plain font - - private Font boldFont = null; // the bold font - // buffer managing copy data private final CopyBuffer copybuffer = new CopyBuffer(this); @@ -234,27 +229,6 @@ // initialize pickmap panel (needed early during the loading process) final CPickmapPanel pickmappanel = new CPickmapPanel(); - // apply custom font - final String fontDesc = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(USE_FONT); - if (fontDesc != null) { - int fontsize = 0; // fontsize - - try { - // try to parse fontsize - fontsize = Integer.parseInt(fontDesc.substring(fontDesc.indexOf("|") + 1)); - - // okay, now set fonts - newPlainFont(new Font(fontDesc.substring(0, fontDesc.indexOf("|")), Font.PLAIN, fontsize)); - newBoldFont(new Font(fontDesc.substring(0, fontDesc.indexOf("|")), Font.BOLD, fontsize)); - } catch (final NumberFormatException e) { - } - } - - // set default font for all swing components - if (getPlainFont() != null) { - JFontChooser.setUIFont(getPlainFont()); - } - // initialize the script-editor pad ScriptEditControl.init(getMapDefaultFolder(), this); @@ -415,29 +389,6 @@ return copybuffer; } - /** IMPORTANT: plainFont can be null! */ - public Font getPlainFont() { - return plainFont; - } - - /** IMPORTANT: boldFont can be null! */ - public Font getBoldFont() { - return boldFont; - } - - public void newPlainFont(final Font newfont) { - plainFont = newfont; - } - - public void newBoldFont(final Font newfont) { - boldFont = newfont; - } - - public boolean isBigFont() { - return (getPlainFont() == null ? JFontChooser.getDefaultFont().getSize() : - getPlainFont().getSize()) > 13; - } - void setMapAndArchPosition(final int archid, final Point pos) { currentMap.getMapView().setMapAndArchPosition(archid, pos); } @@ -557,14 +508,6 @@ } /** {@inheritDoc} */ - public JComponent setBoldFont(final JComponent comp) { - if (boldFont != null) { - comp.setFont(boldFont); - } - return comp; - } - - /** {@inheritDoc} */ public FileFilter getScriptFileFilter() { return pythonFileFilter; } @@ -574,20 +517,8 @@ return ".py"; } - /** - * set plain font to the given component - * @param comp component - * @return same component from parameter (but now with accurate font) - */ - public JComponent setPlainFont(final JComponent comp) { - if (plainFont != null) { - comp.setFont(plainFont); - } - return comp; - } - public String msgToHtml(final String msg) { - return JFontChooser.msgToHtml(msg, getPlainFont()); + return JFontChooser.msgToHtml(msg, null); } boolean addArchToMap(final String archname, final Point pos, final int intern, final boolean join) { Modified: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-10-03 12:35:02 UTC (rev 459) @@ -34,7 +34,6 @@ import cfeditor.menu.SimpleMenuEntry; import cfeditor.menu.SimpleMenuLocation; import java.awt.Event; -import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; @@ -163,8 +162,6 @@ private SimpleMenuEntry m_rand_fill_below; - private SimpleMenuEntry m_font; - private CheckBoxMenuEntry se_monster; private CheckBoxMenuEntry se_exit; @@ -500,8 +497,6 @@ UIManager.getCrossPlatformLookAndFeelClassName()); for (int i = 0; i < aInfos.length; i++) { final CheckBoxMenuEntry menuItem = new CheckBoxMenuEntry(aInfos[i].getName()); - //TODO fix this - //mainControl.setBoldFont(menuItem); if (strSelectedLNFName.compareTo(aInfos[i].getClassName()) == 0) { menuItem.setChecked(true); } @@ -513,52 +508,6 @@ menuManager.addMenuEntry("main.view", SimpleMenuEntry.getSeparator()); - // menu: choose font - m_font = new SimpleMenuEntry("Change Font"); - m_font.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - // open font-dialog and let user choose new font - final Font newfont = JFontChooser.showDialog(mainControl.getMainView(), "Choose Font", - mainControl.getPlainFont() == null ? mainControl.getMainView().getFont() : mainControl.getPlainFont()); - if (newfont != null && !(newfont.getName().equals(mainControl.getMainView().getFont().getName()) - && newfont.getSize() == mainControl.getMainView().getFont().getSize())) { - // set new font - mainControl.newPlainFont(new Font(newfont.getName(), Font.PLAIN, newfont.getSize())); - mainControl.newBoldFont(new Font(newfont.getName(), Font.BOLD, newfont.getSize())); - - JFontChooser.setUIFont(mainControl.getPlainFont()); - - // update fonts - mainControl.getMainView().updateMapArchPanelFont(); - updateFont(true); - mainControl.getMainView().updateStatusBarFont(); - mainControl.getMainView().updateArchPanelFont(); - CFTreasureListTree.getInstance().updateFont(); - } else { - // update fonts - mainControl.newPlainFont(JFontChooser.getDefaultFont()); - mainControl.newBoldFont(new Font(JFontChooser.getDefaultFont().getFontName(), Font.BOLD, JFontChooser.getDefaultFont().getSize())); - JFontChooser.setUIFont(mainControl.getPlainFont()); - - mainControl.getMainView().updateMapArchPanelFont(); - updateFont(true); - mainControl.getMainView().updateStatusBarFont(); - mainControl.getMainView().updateArchPanelFont(); - CFTreasureListTree.getInstance().updateFont(); - - // revert to default fonts - mainControl.newPlainFont(null); - mainControl.newBoldFont(null); - CSettings.getInstance(IGUIConstants.APP_NAME).clearProperty(CMainControl.USE_FONT); - } - - mainControl.getMainView().refreshMapArchPanel(); - mainControl.getMainView().refreshMapTileList(); - } - }); - menuManager.addMenuEntry("main.view", m_font); - menuManager.addMenuEntry("main.view", SimpleMenuEntry.getSeparator()); se_monster = new CheckBoxMenuEntry("Show Monsters"); @@ -1413,95 +1362,6 @@ rebuildWindowMenu(); } - /** - * Redraws the whole menu with latest custom fonts - * @param do_redraw if true, menu is redrawn at the end - */ - public void updateFont(final boolean do_redraw) { - //mainControl.setBoldFont(menu_file); - //mainControl.setBoldFont(menu_edit); - //mainControl.setBoldFont(menu_view); - //mainControl.setBoldFont(menu_map); - //mainControl.setBoldFont(menu_pickmaps); - //mainControl.setBoldFont(menu_collect); - //mainControl.setBoldFont(menu_analyze); - //mainControl.setBoldFont(menu_script); - mainControl.setBoldFont(menu_help); - mainControl.setBoldFont(menu_window); - - // TODO fix this - /*mainControl.setBoldFont(m_new); - mainControl.setBoldFont(m_open); - mainControl.setBoldFont(m_close); - mainControl.setBoldFont(m_save); - mainControl.setBoldFont(m_saveAs); - mainControl.setBoldFont(m_revert); - mainControl.setBoldFont(m_options); - mainControl.setBoldFont(m_exit);*/ - - /*mainControl.setBoldFont(m_newPickmap); - mainControl.setBoldFont(m_deletePickmap); - mainControl.setBoldFont(m_savePickmap); - m_ontrol.setBoldFont(m_revertPickmap);*/ - - /*mainControl.setBoldFont(m_collectArch); - mainControl.setBoldFont(m_spellC); - mainControl.setBoldFont(m_viewTreasure);*/ - - //mainControl.setBoldFont(m_scriptMenu); - //mainControl.setBoldFont(m_analyzeMenu); - mainControl.setBoldFont(m_helpMenu); - mainControl.setBoldFont(m_aboutMenu); - - /*mainControl.setBoldFont(m_autojoin); - mainControl.setBoldFont(m_gridToggle); - mainControl.setBoldFont(m_properties); - mainControl.setBoldFont(m_enterExit); - mainControl.setBoldFont(m_enterNorth); - mainControl.setBoldFont(m_enterEast); - mainControl.setBoldFont(m_enterSouth); - mainControl.setBoldFont(m_enterWest); - mainControl.setBoldFont(m_enterUpper); - mainControl.setBoldFont(m_enterLower);*/ - - /*mainControl.setBoldFont(m_undo); - mainControl.setBoldFont(m_redo); - mainControl.setBoldFont(m_clear); - mainControl.setBoldFont(m_cut); - mainControl.setBoldFont(m_copy); - mainControl.setBoldFont(m_paste); - mainControl.setBoldFont(m_replace); - mainControl.setBoldFont(m_fill_above); - mainControl.setBoldFont(m_fill_below);*/ - - /*mainControl.setBoldFont(m_font); - mainControl.setBoldFont(se_monster); - mainControl.setBoldFont(se_exit); - mainControl.setBoldFont(se_background); - mainControl.setBoldFont(se_door); - mainControl.setBoldFont(se_wall); - mainControl.setBoldFont(se_equip); - mainControl.setBoldFont(se_treasure); - mainControl.setBoldFont(se_connected); - mainControl.setBoldFont(m_show_all);*/ - - mainControl.setBoldFont(m_newWindow); - mainControl.setBoldFont(m_closeAll); - - if (do_redraw) { - refresh(); - } - } - - /** Notifies that the application is about to exit. */ - void appExitNotify() { - final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); - if (mainControl.getPlainFont() != null) { - settings.setProperty(CMainControl.USE_FONT, mainControl.getPlainFont().getName() + "|" - + mainControl.getPlainFont().getSize()); - } - } - public final class CLNFActionListener implements ActionListener { private final String m_strClassName; Modified: trunk/crossfire/src/cfeditor/CMainStatusbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-10-03 12:35:02 UTC (rev 459) @@ -93,7 +93,6 @@ mainPanel.add(infoPanel, BorderLayout.EAST); staticStatusbar = this; - updateFont(); } /** @@ -117,13 +116,6 @@ levelStatus.setText(string != null ? string : " "); } - /** redraw status bar with latest custom fonts */ - public void updateFont() { - mainControl.setBoldFont(status); - mainControl.setBoldFont(memory); - refresh(); - } - /** Refreshes the memory usage info panel. */ void refresh() { final Runtime runtime = Runtime.getRuntime(); Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-10-03 12:35:02 UTC (rev 459) @@ -421,7 +421,6 @@ archPanel.appExitNotify(); mapArchPanel.appExitNotify(); - menu.appExitNotify(); } /** @@ -449,21 +448,6 @@ archPanel.refresh(); } - /** redraw map arch panel with latest custom fonts */ - void updateMapArchPanelFont() { - mapArchPanel.updateFont(true); - } - - /** redraw status bar with latest custom fonts */ - void updateStatusBarFont() { - statusBar.updateFont(); - } - - /** redraw arch panel with latest custom fonts */ - void updateArchPanelFont() { - archPanel.updateFont(); - } - public void setRevertMenuEnabled(final boolean state) { menu.setRevertEnabled(state); } Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-10-03 12:35:02 UTC (rev 459) @@ -508,9 +508,6 @@ c.gridy = 2; gridbag.setConstraints(archTileText, c); archPanel.add(archTileText); - - // apply fonts and refresh - updateFont(true); } /** @@ -544,7 +541,6 @@ scriptPanel.setLayout(new BoxLayout(scriptPanel, BoxLayout.X_AXIS)); eventList = new JList(); - mainControl.setPlainFont(eventList); // create ScrollPane for jlist scrolling final JScrollPane ssa = new JScrollPane(eventList); @@ -618,39 +614,6 @@ } /** - * update the map arch panel to display the custom font - * @param refresh if true, the window is redrawn after setting the fonts - */ - public void updateFont(final boolean refresh) { - mainControl.setPlainFont(archTextArea); - mainControl.setPlainFont(archFaceField); - mainControl.setPlainFont(archNameField); - - mainControl.setBoldFont(panelDesktop); - - mainControl.setPlainFont(archTileText); - archTileText.setForeground(Color.black); - mainControl.setPlainFont(archInvCount); - archInvCount.setForeground(Color.black); - mainControl.setPlainFont(archMapPos); - archMapPos.setForeground(Color.black); - mainControl.setPlainFont(archTypeText); - archTypeText.setForeground(Color.black); - - mainControl.setBoldFont(submitChange); - mainControl.setBoldFont(submitMultiChange); - mainControl.setBoldFont(invChange); - mainControl.setBoldFont(attrWin); - - // doc needs to be set! - - // refresh if desired - if (refresh) { - refresh(); - } - } - - /** * If an arch is selected, the MapArchPanels (bottom right windows) get * updated. * @return the selected arch @@ -784,11 +747,6 @@ archEdit.setEnabled(true); final Style currentAttributes = archEdit.getStyle(StyleContext.DEFAULT_STYLE); try { - if (mainControl.getPlainFont() != null) { - StyleConstants.setFontFamily(currentAttributes, mainControl.getPlainFont().getFamily()); - StyleConstants.setFontSize(currentAttributes, mainControl.getPlainFont().getSize()); - } - // blue: the "special" attributes, differ from the default archetype StyleConstants.setForeground(currentAttributes, Color.blue); if (arch.getObjectText() != null) { Modified: trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-10-03 12:35:02 UTC (rev 459) @@ -236,11 +236,7 @@ optionPanel.add(scrollPane2); - if (this.mainControl.isBigFont()) { - optionPanel.setPreferredSize(new Dimension(280, 185)); - } else { - optionPanel.setPreferredSize(new Dimension(240, 185)); - } + optionPanel.setPreferredSize(new Dimension(240, 185)); // set constraints c.weightx = 1.0; Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-10-03 12:35:02 UTC (rev 459) @@ -437,8 +437,6 @@ // In the map-tile-window the object names are displayed // next to the icons - mainControl.setPlainFont(this); - if (arch.getObjName() != null && arch.getObjName().length() > 0) { setText(arch.getObjName()); // special name } else { Modified: trunk/crossfire/src/cfeditor/ReplaceDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-10-03 12:35:02 UTC (rev 459) @@ -191,7 +191,6 @@ line3.add(colonLabel); line3.add(Box.createVerticalStrut(5)); rfArchName.setForeground(Color.black); - mainControl.setPlainFont(rfArchName); line3.add(iconLabel); line3.add(rfArchName); mainPanel.add(line3); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-10-03 12:35:02 UTC (rev 459) @@ -745,14 +745,6 @@ return strArchDir; } - /** - * {@inheritDoc} - * This implementation does nothing. - */ - public JComponent setBoldFont(final JComponent comp) { - return comp; - } - /** {@inheritDoc} */ public FileFilter getScriptFileFilter() { return luaFileFilter; Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2006-10-03 12:09:32 UTC (rev 458) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2006-10-03 12:35:02 UTC (rev 459) @@ -1,6 +1,5 @@ package net.sf.gridarta; -import javax.swing.JComponent; import javax.swing.filechooser.FileFilter; /** @@ -24,13 +23,6 @@ String getArchDefaultFolder(); /** - * Set bold font to the given component. - * @param comp component - * @return same component from parameter (but now with accurate font) - */ - JComponent setBoldFont(JComponent comp); - - /** * Get the FileFilter that matches script files of this implementation's server side scripting language. * @return FileFilter that matches script files of this implementation's server side scripting language. * @see #getScriptSuffix() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-03 12:09:38
|
Revision: 458 http://svn.sourceforge.net/gridarta/?rev=458&view=rev Author: christianhujer Date: 2006-10-03 05:09:32 -0700 (Tue, 03 Oct 2006) Log Message: ----------- (This is an automatic message!) Released new update version, committing next build number. Modified Paths: -------------- trunk/daimonin/nextBuildNumber.properties Modified: trunk/daimonin/nextBuildNumber.properties =================================================================== --- trunk/daimonin/nextBuildNumber.properties 2006-10-03 11:12:26 UTC (rev 457) +++ trunk/daimonin/nextBuildNumber.properties 2006-10-03 12:09:32 UTC (rev 458) @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Wed Sep 20 20:40:21 CEST 2006 -build.number=2933 +#Tue Oct 03 13:59:48 CEST 2006 +build.number=2934 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-10-03 11:12:31
|
Revision: 457 http://svn.sourceforge.net/gridarta/?rev=457&view=rev Author: akirschbaum Date: 2006-10-03 04:12:26 -0700 (Tue, 03 Oct 2006) Log Message: ----------- Allow the creation of new maps with non-default sizes. Modified Paths: -------------- trunk/daimonin/src/daieditor/CNewMapDialog.java Modified: trunk/daimonin/src/daieditor/CNewMapDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CNewMapDialog.java 2006-10-03 11:06:27 UTC (rev 456) +++ trunk/daimonin/src/daieditor/CNewMapDialog.java 2006-10-03 11:12:26 UTC (rev 457) @@ -248,7 +248,7 @@ // Get and validate the width final int width; final int height; - if (mapSizeDefault) { + if (!mapSizeDefault) { try { width = (Integer) mapWidthField.getValue(); } catch (final IllegalArgumentException e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-10-03 11:06:38
|
Revision: 456 http://svn.sourceforge.net/gridarta/?rev=456&view=rev Author: akirschbaum Date: 2006-10-03 04:06:27 -0700 (Tue, 03 Oct 2006) Log Message: ----------- Do not crash when a map resize cuts off only a parts of a multi-part object. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2006-10-02 19:16:37 UTC (rev 455) +++ trunk/crossfire/ChangeLog 2006-10-03 11:06:27 UTC (rev 456) @@ -1,3 +1,8 @@ +2006-10-03 Andreas Kirschbaum + + * Do not crash when a map resize cuts off only a parts of a + multi-part object. + 2006-10-01 Andreas Kirschbaum * Implement "Random Fill" function. Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-10-02 19:16:37 UTC (rev 455) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-10-03 11:06:27 UTC (rev 456) @@ -36,6 +36,7 @@ import cfeditor.gameobject.GameObjectIteratorDeleteGameMapObject; import cfeditor.gameobject.GameObjectIteratorDeleteMapGame; import java.awt.Point; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import net.sf.gridarta.Size2D; @@ -989,6 +990,9 @@ if (newSize.equals(mapSize)) { return; } + + final HashSet<GameObject> objectsToDelete = new HashSet<GameObject>(); + // no other thread may access this mapmodel while resizing synchronized (this) { // first delete all arches in the area that will get cut off @@ -1002,7 +1006,7 @@ final Iterator it = getArchObjectsDeleteMapArch(x, y, false, false); while (it.hasNext()) { final GameObject node = (GameObject) it.next(); - it.remove(); + objectsToDelete.add(node.getHead()); } } } @@ -1018,12 +1022,16 @@ final Iterator it = getArchObjectsDeleteMapArch(x, y, false, false); while (it.hasNext()) { final GameObject node = (GameObject) it.next(); - it.remove(); + objectsToDelete.add(node.getHead()); } } } } + for (final GameObject node : objectsToDelete) { + deleteMapArch(node.getMyID(), new Point(node.getMapX(), node.getMapY()), false, false); + } + // Now the critical step: create an GameObject array of new dimension, // copy all objects and set it to replace the current one. final GameObject[][] newGrid = new GameObject[newSize.getWidth()][newSize.getHeight()]; Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-10-02 19:16:37 UTC (rev 455) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-10-03 11:06:27 UTC (rev 456) @@ -33,6 +33,7 @@ import java.awt.Point; import java.awt.Toolkit; import java.util.ArrayList; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; @@ -474,6 +475,9 @@ if (newSize.equals(mapSize)) { return; } + + final HashSet<GameObject> objectsToDelete = new HashSet<GameObject>(); + // no other thread may access this mapmodel while resizing synchronized (syncLock) { // first delete all arches in the area that will get cut off @@ -485,7 +489,7 @@ for (int y = 0; y < mapSize.getHeight(); y++) { // for every map square: delete all arches on it for (final GameObject node : mapGrid[x][y]) { - deleteMapArch(node, false); // delete previous one + objectsToDelete.add(node.getHead()); } } } @@ -499,12 +503,16 @@ for (int x = 0; x < mapSize.getWidth(); x++) { // for every map square: delete all arches on it for (final GameObject node : mapGrid[x][y]) { - deleteMapArch(node, false); // delete previous one + objectsToDelete.add(node.getHead()); } } } } + for (final GameObject node : objectsToDelete) { + deleteMapArch(node, false); + } + // Now the critical step: create an GameObject array of new dimension, // copy all objects and set it to replace the current one. final MapSquare[][] newGrid = new MapSquare[newSize.getWidth()][newSize.getHeight()]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-02 19:17:10
|
Revision: 455 http://svn.sourceforge.net/gridarta/?rev=455&view=rev Author: christianhujer Date: 2006-10-02 12:16:37 -0700 (Mon, 02 Oct 2006) Log Message: ----------- Reworked undo / redo stuff: * Removed dead menu and toolbar entries from both editors. * Migrated UndoAndRedo to use actions. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CMainToolbar.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/action.properties trunk/daimonin/src/daieditor/map/MapControl.java trunk/src/app/net/sf/gridarta/UndoAndRedo.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/map/MapSelectionEvent.java trunk/src/app/net/sf/gridarta/gui/map/MapSelectionListener.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-02 19:16:37 UTC (rev 455) @@ -1529,70 +1529,6 @@ } } - /** Invoked when the user wants to undo a change in the current level. */ - void undoWanted() { - if (currentMap != null) { - currentMap.undo(); - } - } - - /** Invoked when the user wants to redo a change in the current level. */ - void redoWanted() { - if (currentMap != null) { - currentMap.redo(); - } - } - - /** - * Returns the name of the undo operation. - * @return name of the undo operation - */ - public String getUndoName() { - if (currentMap != null) { - return currentMap.getUndoName(); - } - - return ""; - } - - /** - * Returns the name of the redo operation. - * @return name of the redo operation - */ - public String getRedoName() { - if (currentMap != null) { - return currentMap.getRedoName(); - } - - return ""; - } - - /** - * Returns whether undo is possible or not. - * @return true if undo is possible, false if not possible - */ - - boolean isUndoPossible() { - if (currentMap != null) { - return currentMap.isUndoPossible(); - } - - return false; - } - - /** - * Returns whether redo is possible or not. - * @return true if redo is possible, false if not possible - */ - - boolean isRedoPossible() { - if (currentMap != null) { - return currentMap.isRedoPossible(); - } - - return false; - } - /** "Clear" was selected from the Edit menu. */ public void clearWanted() { if (currentMap == null || currentMap.getMapView() == null) { Modified: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-10-02 19:16:37 UTC (rev 455) @@ -145,10 +145,6 @@ private SimpleMenuEntry m_revertPickmap; - private SimpleMenuEntry m_undo; - - private SimpleMenuEntry m_redo; - private SimpleMenuEntry m_clear; private SimpleMenuEntry m_cut; @@ -376,34 +372,6 @@ menuManager.addMenuEntry("main", entry); entry.setMnemonic('E'); - // Undo: - m_undo = new SimpleMenuEntry("Undo"); - m_undo.setIcon(CGUIUtils.getIcon(IGUIConstants.UNDO_SMALLICON)); - m_undo.setMnemonic('U'); - m_undo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, Event.CTRL_MASK)); - m_undo.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - // mainControl.undoWanted(); - } - }); - menuManager.addMenuEntry("main.edit", m_undo); - - // Redo: - m_redo = new SimpleMenuEntry("Redo"); - m_redo.setIcon(CGUIUtils.getIcon(IGUIConstants.REDO_SMALLICON)); - m_redo.setMnemonic('R'); - m_redo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, Event.CTRL_MASK | Event.SHIFT_MASK)); - m_redo.addActionListener( - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - // mainControl.redoWanted(); - } - }); - menuManager.addMenuEntry("main.edit", m_redo); - - menuManager.addMenuEntry("main.edit", SimpleMenuEntry.getSeparator()); - // Clear: m_clear = new SimpleMenuEntry("Clear"); m_clear.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); @@ -1282,9 +1250,6 @@ public void refresh() { final boolean isArchLoadComplete = ArchetypeSet.getLoadStatus() == ArchetypeSet.IS_COMPLETE; - m_undo.setEnabled(false); - m_redo.setEnabled(false); - m_spellC.setEnabled(true); //m_scriptMenu.setEnabled(false); //m_analyzeMenu.setEnabled(false); Modified: trunk/crossfire/src/cfeditor/CMainToolbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainToolbar.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/crossfire/src/cfeditor/CMainToolbar.java 2006-10-02 19:16:37 UTC (rev 455) @@ -76,10 +76,6 @@ private JButton m_saveAs; - private JButton m_undo; - - private JButton m_redo; - private JButton m_nextWindow; private JButton m_prevWindow; @@ -202,36 +198,7 @@ addSeparator(); - m_undo = new CFancyButton( - checkLabel("Undo"), - "Undo Operation", - checkIcon(IGUIConstants.UNDO_ICON), - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.undoWanted(); - } - }); - m_undo.setVerticalTextPosition(JButton.BOTTOM); - m_undo.setHorizontalTextPosition(JButton.CENTER); - buttons.addElement(m_undo); - add(m_undo); - m_redo = new CFancyButton( - checkLabel("Redo"), - "Redo Operation", - checkIcon(IGUIConstants.REDO_ICON), - new ActionListener() { - public void actionPerformed(final ActionEvent event) { - mainControl.redoWanted(); - } - }); - m_redo.setVerticalTextPosition(JButton.BOTTOM); - m_redo.setHorizontalTextPosition(JButton.CENTER); - buttons.addElement(m_redo); - add(m_redo); - - addSeparator(); - m_prevWindow = new CFancyButton( checkLabel("Prev"), "Show Previous Window", @@ -312,11 +279,6 @@ final boolean fLevelEdited = mainControl.isLevelEdited(); m_save.setEnabled(mainControl.isPlainSaveEnabled()); m_saveAs.setEnabled(fLevelEdited); - - m_undo.setEnabled(mainControl.isUndoPossible()); - m_undo.setToolTipText("Undo " + mainControl.getUndoName()); - m_redo.setEnabled(mainControl.isRedoPossible()); - m_redo.setToolTipText("Redo " + mainControl.getRedoName()); } /** Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-10-02 19:16:37 UTC (rev 455) @@ -361,54 +361,6 @@ } /** - * Undoes a change in the level. - */ - public void undo() { - UndoAndRedo.getInstance(this).undo(); - } - - /** - * Redoes a change in the level. - */ - public void redo() { - UndoAndRedo.getInstance(this).redo(); - } - - /** - * Return the name of the undo operation. - * @return the name of the undo operation - */ - public String getUndoName() { - return UndoAndRedo.getInstance(this).getUndoName(); - } - - /** - * Return the name of the redo operation. - * @return the name of the redo operation - */ - public String getRedoName() { - return UndoAndRedo.getInstance(this).getRedoName(); - } - - /** - * Return whether undo is possible or not. - * @return <code>true</code> if undo is possible, <code>false</code> if not - * possible - */ - public boolean isUndoPossible() { - return UndoAndRedo.getInstance(this).canUndo(); - } - - /** - * Return whether redo is possible or not. - * @return <code>true</code> if redo is possible, <code>false</code> if not - * possible - */ - public boolean isRedoPossible() { - return UndoAndRedo.getInstance(this).canRedo(); - } - - /** * Repaints the view. */ public void repaint() { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-10-02 19:16:37 UTC (rev 455) @@ -1764,62 +1764,6 @@ } } - /** Invoked when the user wants to undo a change in the current level. */ - void undo() { - if (currentMap != null) { - currentMap.undo(); - } - } - - /** Invoked when the user wants to redo a change in the current level. */ - void redo() { - if (currentMap != null) { - currentMap.redo(); - } - } - - /** - * Returns the name of the undo operation. - * @return name of the undo operation - */ - public String getUndoName() { - return currentMap != null ? currentMap.getUndoName() : null; - } - - /** - * Returns the name of the redo operation. - * @return name of the redo operation - */ - public String getRedoName() { - return currentMap != null ? currentMap.getRedoName() : null; - } - - /** - * Returns whether undo is possible or not. - * @return true if undo is possible, false if not possible - */ - - boolean isUndoPossible() { - if (currentMap != null) { - return currentMap.isUndoPossible(); - } - - return false; - } - - /** - * Returns whether redo is possible or not. - * @return true if redo is possible, false if not possible - */ - - boolean isRedoPossible() { - if (currentMap != null) { - return currentMap.isRedoPossible(); - } - - return false; - } - /** "Clear" was selected from the Edit menu. */ public void clear() { if (currentMap == null || currentMap.getMapViewFrame() == null) { Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-10-02 19:16:37 UTC (rev 455) @@ -443,7 +443,6 @@ mapArchPanel.refresh(); statusBar.refresh(); - refresh2(); refresh3(); } @@ -792,19 +791,6 @@ private final Action aCloseAll = ACTION_FACTORY.createAction(true, "closeAll", mainControl); /** - * Refresh actions from toolbar. - * @todo remove me - */ - private void refresh2() { - //aSave.setEnabled(mainControl.isPlainSaveEnabled()); - //aSaveAs.setEnabled(mainControl.isLevelEdited()); - aUndo.setEnabled(mainControl.isUndoPossible()); - //aUndo.setToolTipText( "Undo " + mainControl.getUndoName() ); - aRedo.setEnabled(mainControl.isRedoPossible()); - //aRedo.setToolTipText( "Redo " + mainControl.getRedoName() ); - } - - /** * Refresh actions from menu. * @todo remove me */ Modified: trunk/daimonin/src/daieditor/action.properties =================================================================== --- trunk/daimonin/src/daieditor/action.properties 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/daimonin/src/daieditor/action.properties 2006-10-02 19:16:37 UTC (rev 455) @@ -9,7 +9,7 @@ # Menus main.menubar=file edit map cursor pickmaps resources tools view window help file.menu=createNew open recent close closeAll - save saveAs revert createImg - options - exit -edit.menu=undo redo - clear cut copy paste - replace fillAbove fillBelow randFillAbove randFillBelow - selectAll +edit.menu=clear cut copy paste - replace fillAbove fillBelow randFillAbove randFillBelow - selectAll map.menu=enterExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties cursor.menu=moveCursor - selectTile startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes @@ -36,7 +36,7 @@ ########## # ToolBars -main.toolbar=createNew open save saveAs - undo redo - prevWindow nextWindow +main.toolbar=createNew open save saveAs - prevWindow nextWindow mapTileRevert.icon=general/Undo16 mapTileClear.icon=general/Remove16 Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-10-02 19:16:37 UTC (rev 455) @@ -237,20 +237,6 @@ } /** - * Undoes a change in the level. - */ - public void undo() { - UndoAndRedo.getInstance(this).undo(); - } - - /** - * Redoes a change in the level. - */ - public void redo() { - UndoAndRedo.getInstance(this).redo(); - } - - /** * Selects all. */ public void selectAll() { @@ -258,40 +244,6 @@ } /** - * Return the name of the undo operation. - * @return the name of the undo operation - */ - public String getUndoName() { - return UndoAndRedo.getInstance(this).getUndoName(); - } - - /** - * Return the name of the redo operation. - * @return the name of the redo operation - */ - public String getRedoName() { - return UndoAndRedo.getInstance(this).getRedoName(); - } - - /** - * Return whether undo is possible or not. - * @return <code>true</code> if undo is possible, <code>false</code> if not - * possible - */ - public boolean isUndoPossible() { - return UndoAndRedo.getInstance(this).canUndo(); - } - - /** - * Return whether redo is possible or not. - * @return <code>true</code> if redo is possible, <code>false</code> if not - * possible - */ - public boolean isRedoPossible() { - return UndoAndRedo.getInstance(this).canRedo(); - } - - /** * Repaints the view. */ public void repaint() { Modified: trunk/src/app/net/sf/gridarta/UndoAndRedo.java =================================================================== --- trunk/src/app/net/sf/gridarta/UndoAndRedo.java 2006-10-02 17:46:54 UTC (rev 454) +++ trunk/src/app/net/sf/gridarta/UndoAndRedo.java 2006-10-02 19:16:37 UTC (rev 455) @@ -29,46 +29,42 @@ import java.util.Map; import java.util.WeakHashMap; import net.sf.gridarta.map.MapControl; +import net.sf.gridarta.gui.map.MapSelectionListener; +import net.sf.gridarta.gui.map.MapSelectionEvent; +import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; +import javax.swing.Action; /** - * The undo/redo stack that is used when undoing/redoing operations. + * The undoAction/redo stack that is used when undoing/redoing operations. * Every operation should add itself to the stack using the add() method. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @see EditOperation * @todo transform {@link #undo()} and {@link #redo()} into Actions. */ -public final class UndoAndRedo { +public final class UndoAndRedo implements MapSelectionListener { - /** The shared hashtable that maps levels to undo stacks. */ - private static final Map<MapControl, UndoAndRedo> hashFromLevelToStack = new WeakHashMap<MapControl, UndoAndRedo>(); + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); - /** The undo stack. Contains all undoable operations. */ - private final List<EditOperation> undoStack = new ArrayList<EditOperation>(); + /** The undoAction and redo operations stored for each map. */ + private final Map<MapControl, UndoRedoStack> undoAndRedoOperations = new WeakHashMap<MapControl, UndoRedoStack>(); - /** The redo stack. Contains all redoable operations. */ - private final List<EditOperation> redoStack = new ArrayList<EditOperation>(); + /** The current undoAction and redo stack. */ + @NotNull private UndoRedoStack currentStack; /** The maximum size of the stacks. */ private int maxStackSize = 10; - /** - * Returns the undo stack for the given level controller. - * @param mapControl the level whose undo/redo stack is to be returned - * @return the undo/redo stack for the given level - */ - public static UndoAndRedo getInstance(final MapControl mapControl) { - if (hashFromLevelToStack.containsKey(mapControl)) { - return hashFromLevelToStack.get(mapControl); - } + /** The Action for undoAction. */ + private final Action undoAction = ACTION_FACTORY.createAction(false, "undo", this); - final UndoAndRedo instance = new UndoAndRedo(); - hashFromLevelToStack.put(mapControl, instance); - return instance; - } + /** The Action for undoAction. */ + private final Action redoAction = ACTION_FACTORY.createAction(false, "redo", this); - /** Constructs an undo/redo stack. */ - private UndoAndRedo() { + /** Constructs an undoAction/redo stack. */ + public UndoAndRedo() { } /** @@ -88,42 +84,42 @@ } /** - * Adds a new undoable/redoable operation to the undo/redo stack. + * Adds a new undoable/redoable operation to the undoAction/redo stack. * @param undoOp the new operation to be added to the stack */ public void add(final EditOperation undoOp) { - undoStack.add(undoOp); - redoStack.clear(); - if (undoStack.size() > maxStackSize) { - undoStack.remove(0); + currentStack.undoStack.add(undoOp); + currentStack.redoStack.clear(); + if (currentStack.undoStack.size() > maxStackSize) { + currentStack.undoStack.remove(0); } } /** - * Returns whether the last operation in the undo stack can be undone. - * @return <code>true</code> if the last operation in the undo stack can be + * Returns whether the last operation in the undoAction stack can be undone. + * @return <code>true</code> if the last operation in the undoAction stack can be * undone, <code>false</code> if not */ public boolean canUndo() { - return undoStack.size() > 0 && undoStack.get(undoStack.size() - 1).isUndoable(); + return currentStack.undoStack.size() > 0 && currentStack.undoStack.get(currentStack.undoStack.size() - 1).isUndoable(); } /** - * Returns the name of the last operation in the undo stack. - * @return the name of the last operation in the undo stack + * Returns the name of the last operation in the undoAction stack. + * @return the name of the last operation in the undoAction stack */ public String getUndoName() { - return canUndo() ? undoStack.get(undoStack.size() - 1).getName() : ""; + return canUndo() ? currentStack.undoStack.get(currentStack.undoStack.size() - 1).getName() : ""; } - /** Undoes the last operation in the undo stack. */ + /** Undoes the last operation in the undoAction stack. */ public void undo() { if (canUndo()) { - final EditOperation op = undoStack.get(undoStack.size() - 1); - undoStack.remove(op); + final EditOperation op = currentStack.undoStack.get(currentStack.undoStack.size() - 1); + currentStack.undoStack.remove(op); op.undo(); - redoStack.add(op); + currentStack.redoStack.add(op); } } @@ -133,7 +129,7 @@ * redone, <code>false</code> if not */ public boolean canRedo() { - return redoStack.size() > 0 && redoStack.get(redoStack.size() - 1).isRedoable(); + return currentStack.redoStack.size() > 0 && currentStack.redoStack.get(currentStack.redoStack.size() - 1).isRedoable(); } @@ -142,17 +138,71 @@ * @return the name of the last operation in the redo stack */ public String getRedoName() { - return canRedo() ? redoStack.get(redoStack.size() - 1).getName() : ""; + return canRedo() ? currentStack.redoStack.get(currentStack.redoStack.size() - 1).getName() : ""; } /** Redoes the last operation in the redo stack. */ public void redo() { if (canRedo()) { - final EditOperation op = redoStack.get(redoStack.size() - 1); - redoStack.remove(op); + final EditOperation op = currentStack.redoStack.get(currentStack.redoStack.size() - 1); + currentStack.redoStack.remove(op); op.redo(); - undoStack.add(op); + currentStack.undoStack.add(op); } } + /** {@inheritDoc} */ + public void mapSelectionChanged(@NotNull final MapSelectionEvent e) { + setCurrentMapControl(e.getNewMap()); + } + + /** + * Sets the MapControl for which the current Actions should be displayed. + * @param mapControl MapControl to display actions for + */ + private void setCurrentMapControl(@NotNull final MapControl mapControl) { + UndoRedoStack newStack = undoAndRedoOperations.get(mapControl); + if (newStack == null) { + newStack = new UndoRedoStack(); + undoAndRedoOperations.put(mapControl, newStack); + } + currentStack = newStack; + updateActions(); + } + + /** + * Updates the actions. + */ + private void updateActions() { + undoAction.setEnabled(canUndo()); + redoAction.setEnabled(canRedo()); + } + + /** + * Returns the Action for undoing an edit operation. + * @return The Action for undoing an edit operation. + */ + @NotNull public Action getUndoAction() { + return undoAction; + } + + /** + * Returns the Action for redoing an edit operation. + * @return The Action for redoing an edit operation. + */ + @NotNull public Action getRedoAction() { + return redoAction; + } + + /** The Undo / Redo Stack. */ + private static final class UndoRedoStack { + + /** The undoAction stack. Contains all undoable operations. */ + private final List<EditOperation> undoStack = new ArrayList<EditOperation>(); + + /** The redo stack. Contains all redoable operations. */ + private final List<EditOperation> redoStack = new ArrayList<EditOperation>(); + + } // class UndoRedoStack + } // class UndoAndRedo Added: trunk/src/app/net/sf/gridarta/gui/map/MapSelectionEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapSelectionEvent.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/MapSelectionEvent.java 2006-10-02 19:16:37 UTC (rev 455) @@ -0,0 +1,60 @@ +package net.sf.gridarta.gui.map; + +import java.util.EventObject; +import net.sf.gridarta.MainControl; +import net.sf.gridarta.map.MapControl; +import org.jetbrains.annotations.NotNull; + +/** + * Event describing a MapSelection. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @see MapSelectionListener + * @note currently the source is a {@link MainControl}. This is subject of change. + */ +public class MapSelectionEvent extends EventObject { + + /** The MapControl of the map that got deselected. */ + @NotNull private final MapControl oldMap; + + /** The MapControl of the map that got selected. */ + @NotNull private final MapControl newMap; + + /** + * Constructs a MapSelectionEvent. + * + * @param source The MainControl on which the Event initially occurred. + * @param oldMap MapControl of the map that got deselected. + * @param newMap MapControl of the map that got selected. + * + * @throws IllegalArgumentException if source is null. + */ + public MapSelectionEvent(@NotNull final MainControl source, @NotNull final MapControl oldMap, @NotNull final MapControl newMap) { + super(source); + this.oldMap = oldMap; + this.newMap = newMap; + } + + /** + * Returns the MapControl of the map that got deselected. + * @return The MapControl of the map that got deselected. + * @see #getNewMap() + */ + @NotNull public MapControl getOldMap() { + return oldMap; + } + + /** + * Returns the MapControl of the map that got selected. + * @return The MapControl of the map that got selected. + * @see #getOldMap() + */ + @NotNull public MapControl getNewMap() { + return newMap; + } + + /** {@inheritDoc} */ + @Override @NotNull public MainControl getSource() { + return (MainControl) super.getSource(); + } + +} // class MapSelectionEvent Property changes on: trunk/src/app/net/sf/gridarta/gui/map/MapSelectionEvent.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/gui/map/MapSelectionListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapSelectionListener.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/MapSelectionListener.java 2006-10-02 19:16:37 UTC (rev 455) @@ -0,0 +1,20 @@ +package net.sf.gridarta.gui.map; + +import java.util.EventListener; +import org.jetbrains.annotations.NotNull; + +/** + * Interface for classes that want to be informed in case another map gets selected. + * The selected map is the map that would receive input events and edit operations. + * @note Clarification: This part of the event system is not about selection of squares within a map. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public interface MapSelectionListener extends EventListener { + + /** + * Inform this listener that a different map was selected. + * @param e MapSelectionEvent describing the selection of the new map + */ + void mapSelectionChanged(@NotNull MapSelectionEvent e); + +} // interface MapSelectionListener Property changes on: trunk/src/app/net/sf/gridarta/gui/map/MapSelectionListener.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-10-02 17:46:59
|
Revision: 454 http://svn.sourceforge.net/gridarta/?rev=454&view=rev Author: akirschbaum Date: 2006-10-02 10:46:54 -0700 (Mon, 02 Oct 2006) Log Message: ----------- Rename variable and function names. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CopyBuffer.java Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-10-02 17:34:02 UTC (rev 453) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-10-02 17:46:54 UTC (rev 454) @@ -579,7 +579,7 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; - private final MapModel _model; + private final MapModel mapModel; // 32x32 Image and Icon for temprary storing tiles before drawing private Image tmpImage; @@ -604,8 +604,8 @@ private final AffineTransform renderTransform; /** Constructor */ - CFlatLevelRenderer(final MapModel model, final boolean pickmap) { - _model = model; + CFlatLevelRenderer(final MapModel mapModel, final boolean pickmap) { + this.mapModel = mapModel; af = new AttributeFilter(); af.addAttribute("no_pass", "1"); @@ -721,7 +721,7 @@ for (int y = 0; y < mapSize.getHeight(); y++) { for (int x = 0; x < mapSize.getWidth(); x++) { filter.newSquare(); - if (!_model.containsArchObject(x, y)) { + if (!mapModel.containsArchObject(x, y)) { // empty square if (isPickmap) { grfx.fillRect(x * 32 + bOffset, y * 32 + bOffset, 32, 32); @@ -729,7 +729,7 @@ mainControl.getUnknownTileIconX().paintIcon(this, grfx, x * 32 + bOffset, y * 32 + bOffset); } } else { - final Iterator it = _model.getArchObjects(x, y); + final Iterator it = mapModel.getArchObjects(x, y); while (it.hasNext()) { final GameObject node = (GameObject) it.next(); filter.objectInSquare(node); @@ -824,7 +824,7 @@ final CFilterControl filter = mainControl.getFilterControl(); filter.newSquare(); // first, draw the object's faces: - if (!_model.containsArchObject(x, y)) { + if (!mapModel.containsArchObject(x, y)) { // draw the empty-tile icon (direcly to the mapview) if (isPickmap) { grfx.setColor(IGUIConstants.BG_COLOR); @@ -835,7 +835,7 @@ } else { tmpGrfx.fillRect(0, 0, 32, 32); // loop through all arches on that square and draw em - final Iterator it = _model.getArchObjects(x, y); + final Iterator it = mapModel.getArchObjects(x, y); while (it.hasNext()) { final GameObject node = (GameObject) it.next(); @@ -876,7 +876,7 @@ } // We have been drawing to the tmp. buffer, now convert it to // an ImageIcon and paint it into the mapview: - if (_model.containsArchObject(x, y)) { + if (mapModel.containsArchObject(x, y)) { tmpIcon.setImage(tmpImage); tmpIcon.paintIcon(this, grfx, x * 32, y * 32); } Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-10-02 17:34:02 UTC (rev 453) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-10-02 17:46:54 UTC (rev 454) @@ -99,7 +99,7 @@ * @param mapControl MapControl of the active map where we copy from */ public void clear(final MapControl mapControl) { - CopyNCut(mapControl, DO_CLEAR); + copyNCut(mapControl, DO_CLEAR); } /** @@ -107,7 +107,7 @@ * @param mapControl MapControl of the active map where we copy from */ public void cut(final MapControl mapControl) { - CopyNCut(mapControl, DO_CUT); + copyNCut(mapControl, DO_CUT); } /** @@ -115,7 +115,7 @@ * @param mapControl MapControl of the active map where we copy from */ public void copy(final MapControl mapControl) { - CopyNCut(mapControl, DO_COPY); + copyNCut(mapControl, DO_COPY); } /** @@ -124,7 +124,7 @@ * @param mapControl MapControl of the active map where we copy from * @param mode defines if we have a cut, copy or paste action */ - private void CopyNCut(final MapControl mapControl, final int mode) { + private void copyNCut(final MapControl mapControl, final int mode) { final Point startp = mapControl.getMapView().getHighlightStart(); // start of highlighted rect final Point offset = mapControl.getMapView().getHighlightOffset(); // offset of rect from startp This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-02 17:34:09
|
Revision: 453 http://svn.sourceforge.net/gridarta/?rev=453&view=rev Author: christianhujer Date: 2006-10-02 10:34:02 -0700 (Mon, 02 Oct 2006) Log Message: ----------- Cosmetic improvements: Class final, fixed bug in javadoc. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java 2006-10-02 17:25:25 UTC (rev 452) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java 2006-10-02 17:34:02 UTC (rev 453) @@ -41,7 +41,7 @@ * </ul> * When coordinates or state of MapCursor changes a {@link MapCursorEvent} is fired. */ -public class MapCursor implements MapGridListener { +public final class MapCursor implements MapGridListener { /** Current cursor position. When cursor is active it is highlighted on the MapGrid. */ private final Point pos = new Point(); @@ -79,7 +79,7 @@ private final Point tmpPoint = new Point(); /** The MapCursorListeners to inform of changes. */ - private EventListenerList listenerList = new EventListenerList(); + private final EventListenerList listenerList = new EventListenerList(); /** * Construct a MapCursor. The cursor will be deactivated after construction. @@ -93,8 +93,8 @@ } /** - * Get position of cursor - * @return coordinates of cursor or <code>false</code> if cursor is not active + * Get position of cursor. + * @return coordinates of cursor or <code>null</code> if cursor is not active */ @Nullable public Point getLocation() { return isOnMap ? pos : null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-10-02 17:25:32
|
Revision: 452 http://svn.sourceforge.net/gridarta/?rev=452&view=rev Author: akirschbaum Date: 2006-10-02 10:25:25 -0700 (Mon, 02 Oct 2006) Log Message: ----------- Remove unused function. Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/map/MapModel.java Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-10-02 14:47:35 UTC (rev 451) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-10-02 17:25:25 UTC (rev 452) @@ -253,22 +253,6 @@ return result; } - @Deprecated public void setArchObject(final int x, final int y, final GameObject arch) { - setArchObject(new Point(x, y), arch); - } - - /** Save a map square to the given GameObject. */ - public void setArchObject(final Point pos, final GameObject arch) { - if (!isPointValid(pos)) { - throw new IllegalArgumentException(); - } - if (arch == null) { - throw new IllegalArgumentException(); - } - - mapGrid[pos.x][pos.y] = arch; - } - /** * Return an Iterator of all ArchObjects in the given location. The * Iterator supports deleting objects. Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-10-02 14:47:35 UTC (rev 451) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-10-02 17:25:25 UTC (rev 452) @@ -318,10 +318,6 @@ return mapModel.getTopArchObject(pos); } - public void setArchObject(final Point pos, final GameObject arch) { - mapModel.setArchObject(pos, arch); - } - /** * Return whether the level has changed since it was last saved or not. * @return <code>true</code> if level has changed, <code>false</code> if Modified: trunk/crossfire/src/cfeditor/map/MapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapModel.java 2006-10-02 14:47:35 UTC (rev 451) +++ trunk/crossfire/src/cfeditor/map/MapModel.java 2006-10-02 17:25:25 UTC (rev 452) @@ -32,9 +32,6 @@ @Deprecated @Nullable GameObject getBottomArchObject(int x, int y); @Nullable GameObject getBottomArchObject(Point pos); - @Deprecated void setArchObject(int x, int y, GameObject arch); - void setArchObject(Point pos, GameObject arch); - @Nullable Point getMouseRightPos(); @Nullable GameObject getMouseRightPosObject(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-02 14:47:40
|
Revision: 451 http://svn.sourceforge.net/gridarta/?rev=451&view=rev Author: christianhujer Date: 2006-10-02 07:47:35 -0700 (Mon, 02 Oct 2006) Log Message: ----------- Declared Nullability. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java 2006-10-02 14:41:28 UTC (rev 450) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java 2006-10-02 14:47:35 UTC (rev 451) @@ -27,6 +27,7 @@ import static java.lang.Math.min; import javax.swing.event.EventListenerList; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** * MapCursor provides methods to move and drag on map. The MapCursor is bound to a @@ -324,12 +325,12 @@ } /** {@inheritDoc} */ - public void mapGridChanged(final MapGridEvent e) { + public void mapGridChanged(@NotNull final MapGridEvent e) { // We can ignore this event. Normally this MapCursor has caused it. } /** {@inheritDoc} */ - public void mapGridResized(final MapGridEvent e) { + public void mapGridResized(@NotNull final MapGridEvent e) { // Test if drag start point is outside map -> move inside if (isDragging && !mapRec.contains(dragStart)) { dragStart.x = min(dragStart.x, mapRec.width - 1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-02 14:41:37
|
Revision: 450 http://svn.sourceforge.net/gridarta/?rev=450&view=rev Author: christianhujer Date: 2006-10-02 07:41:28 -0700 (Mon, 02 Oct 2006) Log Message: ----------- Declared Nullability, improved JavaDoc. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java trunk/src/app/net/sf/gridarta/gui/map/MapGridListener.java Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java 2006-10-02 14:33:47 UTC (rev 449) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java 2006-10-02 14:41:28 UTC (rev 450) @@ -22,6 +22,7 @@ package net.sf.gridarta.gui.map; import java.util.EventObject; +import org.jetbrains.annotations.NotNull; /** This Event is created by {@link MapCursor}. */ public class MapCursorEvent extends EventObject { @@ -31,11 +32,12 @@ * @param source The object on which the Event initially occurred. * @throws IllegalArgumentException if source is null. */ - public MapCursorEvent(final MapCursor source) { + public MapCursorEvent(@NotNull final MapCursor source) { super(source); } - @Override public MapCursor getSource() { + /** {@inheritDoc} */ + @Override @NotNull public MapCursor getSource() { return (MapCursor) super.getSource(); } Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java 2006-10-02 14:33:47 UTC (rev 449) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java 2006-10-02 14:41:28 UTC (rev 450) @@ -22,6 +22,7 @@ package net.sf.gridarta.gui.map; import java.util.EventListener; +import org.jetbrains.annotations.NotNull; /** Interface for listeners listening to {@link MapCursorEvent}s. */ public interface MapCursorListener extends EventListener { @@ -30,12 +31,12 @@ * This event handler is called when {@link MapCursor} has moved, appeared or disappeared. * @param e MapCursorEvent */ - void mapCursorChangedPos(MapCursorEvent e); + void mapCursorChangedPos(@NotNull MapCursorEvent e); /** * This event handler is called when {@link MapCursor} changes mode (drag, select). * @param e MapCursorEvent */ - void mapCursorChangedMode(MapCursorEvent e); + void mapCursorChangedMode(@NotNull MapCursorEvent e); } // interface MapCursorListener Modified: trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java 2006-10-02 14:33:47 UTC (rev 449) +++ trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java 2006-10-02 14:41:28 UTC (rev 450) @@ -22,6 +22,7 @@ package net.sf.gridarta.gui.map; import java.util.EventObject; +import org.jetbrains.annotations.NotNull; /** This event is created by {@link MapGrid}. */ public class MapGridEvent extends EventObject { @@ -31,12 +32,12 @@ * @param source The MapGrid on which the Event initially occurred. * @throws IllegalArgumentException if source is null. */ - public MapGridEvent(final MapGrid source) { + public MapGridEvent(@NotNull final MapGrid source) { super(source); } /** {@inheritDoc} */ - @Override public MapGrid getSource() { + @Override @NotNull public MapGrid getSource() { return (MapGrid) super.getSource(); } Modified: trunk/src/app/net/sf/gridarta/gui/map/MapGridListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapGridListener.java 2006-10-02 14:33:47 UTC (rev 449) +++ trunk/src/app/net/sf/gridarta/gui/map/MapGridListener.java 2006-10-02 14:41:28 UTC (rev 450) @@ -22,6 +22,7 @@ package net.sf.gridarta.gui.map; import java.util.EventListener; +import org.jetbrains.annotations.NotNull; /** Interface for listeners listening to {@link MapGridEvent}s. */ public interface MapGridListener extends EventListener { @@ -30,12 +31,12 @@ * This event handler is called when flags on {@link MapGrid} have changed. * @param e MapGridEvent */ - void mapGridChanged(MapGridEvent e); + void mapGridChanged(@NotNull MapGridEvent e); /** * This event handler is called when size of {@link MapGrid} has changed. * @param e MapGridEvent */ - void mapGridResized(MapGridEvent e); + void mapGridResized(@NotNull MapGridEvent e); } // interface MapGridListener This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-02 14:33:52
|
Revision: 449 http://svn.sourceforge.net/gridarta/?rev=449&view=rev Author: christianhujer Date: 2006-10-02 07:33:47 -0700 (Mon, 02 Oct 2006) Log Message: ----------- Improved JavaDoc. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java Modified: trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java 2006-10-02 13:12:03 UTC (rev 448) +++ trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java 2006-10-02 14:33:47 UTC (rev 449) @@ -27,14 +27,15 @@ public class MapGridEvent extends EventObject { /** - * Constructs a prototypical Event. - * @param source The object on which the Event initially occurred. + * Constructs a MapGridEvent. + * @param source The MapGrid on which the Event initially occurred. * @throws IllegalArgumentException if source is null. */ public MapGridEvent(final MapGrid source) { super(source); } + /** {@inheritDoc} */ @Override public MapGrid getSource() { return (MapGrid) super.getSource(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-02 13:12:24
|
Revision: 448 http://svn.sourceforge.net/gridarta/?rev=448&view=rev Author: christianhujer Date: 2006-10-02 06:12:03 -0700 (Mon, 02 Oct 2006) Log Message: ----------- Renamed Undoable to EditOperation. Minor documentation improvement on undo system. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/daimonin/src/daieditor/CMapViewBasic.java trunk/src/app/net/sf/gridarta/UndoAndRedo.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/EditOperation.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/Undoable.java Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-10-02 12:54:12 UTC (rev 447) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-10-02 13:12:03 UTC (rev 448) @@ -53,7 +53,7 @@ import javax.swing.JScrollPane; import javax.swing.JViewport; import net.sf.gridarta.Size2D; -import net.sf.gridarta.Undoable; +import net.sf.gridarta.EditOperation; import net.sf.gridarta.gui.MapView; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -1545,7 +1545,7 @@ } } - public final class CPaintOp implements Undoable { + public final class CPaintOp implements EditOperation { final Rectangle fillRect; Modified: trunk/daimonin/src/daieditor/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-10-02 12:54:12 UTC (rev 447) +++ trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-10-02 13:12:03 UTC (rev 448) @@ -420,7 +420,7 @@ } // This can be done later, it was unused anyway. - //public static final class CPaintOp implements Undoable { + //public static final class CPaintOp implements EditOperation { // final Rectangle fillRect; // final int[][] aOrigData; Copied: trunk/src/app/net/sf/gridarta/EditOperation.java (from rev 447, trunk/src/app/net/sf/gridarta/Undoable.java) =================================================================== --- trunk/src/app/net/sf/gridarta/EditOperation.java (rev 0) +++ trunk/src/app/net/sf/gridarta/EditOperation.java 2006-10-02 13:12:03 UTC (rev 448) @@ -0,0 +1,68 @@ +/* + * 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 net.sf.gridarta; + +/** + * An operation that eventually can be undone or redone. + * Such operations can be registered / recorded by {@link UndoAndRedo}. + * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @see UndoAndRedo + */ +public interface EditOperation { + + /** + * Returns whether the operation is undoable. + * @return <code>true</code> if the operation is undoable, otherwise <code>false</code>. + */ + boolean isUndoable(); + + /** + * Undoes this operation. + * If this operation is not {@link #isUndoable() undoable}, this operation silently returns without doing anything. + */ + void undo(); + + /** + * Returns whether the operation is redoable. + * @return <code>true</code> if the operation is redoable, otherwise <code>false</code>. + */ + boolean isRedoable(); + + /** + * Redoes this operation. + * If this operation is not {@link #isRedoable() redoable}, this operation silently returns without doing anything. + */ + void redo(); + + /** + * Returns the operations short (about 8 chars max) name. The name is used + * to show the operation in the menuitems and toolbar buttons tooltips. + * @return The name of the operation. + * @todo decide whether it should be a key usable for i18n or the already localized message. + */ + String getName(); + +} // interface EditOperation Property changes on: trunk/src/app/net/sf/gridarta/EditOperation.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/UndoAndRedo.java =================================================================== --- trunk/src/app/net/sf/gridarta/UndoAndRedo.java 2006-10-02 12:54:12 UTC (rev 447) +++ trunk/src/app/net/sf/gridarta/UndoAndRedo.java 2006-10-02 13:12:03 UTC (rev 448) @@ -35,6 +35,7 @@ * Every operation should add itself to the stack using the add() method. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @see EditOperation * @todo transform {@link #undo()} and {@link #redo()} into Actions. */ public final class UndoAndRedo { @@ -43,10 +44,10 @@ private static final Map<MapControl, UndoAndRedo> hashFromLevelToStack = new WeakHashMap<MapControl, UndoAndRedo>(); /** The undo stack. Contains all undoable operations. */ - private final List<Undoable> undoStack = new ArrayList<Undoable>(); + private final List<EditOperation> undoStack = new ArrayList<EditOperation>(); /** The redo stack. Contains all redoable operations. */ - private final List<Undoable> redoStack = new ArrayList<Undoable>(); + private final List<EditOperation> redoStack = new ArrayList<EditOperation>(); /** The maximum size of the stacks. */ private int maxStackSize = 10; @@ -90,7 +91,7 @@ * Adds a new undoable/redoable operation to the undo/redo stack. * @param undoOp the new operation to be added to the stack */ - public void add(final Undoable undoOp) { + public void add(final EditOperation undoOp) { undoStack.add(undoOp); redoStack.clear(); if (undoStack.size() > maxStackSize) { @@ -119,7 +120,7 @@ /** Undoes the last operation in the undo stack. */ public void undo() { if (canUndo()) { - final Undoable op = undoStack.get(undoStack.size() - 1); + final EditOperation op = undoStack.get(undoStack.size() - 1); undoStack.remove(op); op.undo(); redoStack.add(op); @@ -147,7 +148,7 @@ /** Redoes the last operation in the redo stack. */ public void redo() { if (canRedo()) { - final Undoable op = redoStack.get(redoStack.size() - 1); + final EditOperation op = redoStack.get(redoStack.size() - 1); redoStack.remove(op); op.redo(); undoStack.add(op); Deleted: trunk/src/app/net/sf/gridarta/Undoable.java =================================================================== --- trunk/src/app/net/sf/gridarta/Undoable.java 2006-10-02 12:54:12 UTC (rev 447) +++ trunk/src/app/net/sf/gridarta/Undoable.java 2006-10-02 13:12:03 UTC (rev 448) @@ -1,66 +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 net.sf.gridarta; - -/** - * An Operation that eventually can be undone or redone. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public interface Undoable { - - /** - * Returns whether the operation is undoable. - * @return <code>true</code> if the operation is undoable, otherwise <code>false</code>. - */ - boolean isUndoable(); - - /** - * Undoes this operation. - * If this operation is not {@link #isUndoable() undoable}, this operation silently returns without doing anything. - */ - void undo(); - - /** - * Returns whether the operation is redoable. - * @return <code>true</code> if the operation is redoable, otherwise <code>false</code>. - */ - boolean isRedoable(); - - /** - * Redoes this operation. - * If this operation is not {@link #isRedoable() redoable}, this operation silently returns without doing anything. - */ - void redo(); - - /** - * Returns the operations short (about 8 chars max) name. The name is used - * to show the operation in the menuitems and toolbar buttons tooltips. - * @return The name of the operation. - * @todo decide whether it should be a key usable for i18n or the already localized message. - */ - String getName(); - -} // interface Undoable This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-02 12:54:40
|
Revision: 447 http://svn.sourceforge.net/gridarta/?rev=447&view=rev Author: christianhujer Date: 2006-10-02 05:54:12 -0700 (Mon, 02 Oct 2006) Log Message: ----------- Removed unused imports from CMainControl. Renamed CUndoStack to the more appropriate name UndoAndRedo. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/map/MapControl.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/UndoAndRedo.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/CUndoStack.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-02 12:51:21 UTC (rev 446) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-02 12:54:12 UTC (rev 447) @@ -54,7 +54,6 @@ import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.CUndoStack; import net.sf.gridarta.MainControl; import net.sf.gridarta.Size2D; import net.sf.gridarta.gui.HideFileFilterProxy; Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-10-02 12:51:21 UTC (rev 446) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-10-02 12:54:12 UTC (rev 447) @@ -1107,7 +1107,7 @@ mainControl.getMainView().setMapTileList(null, -1); // for secure... } /* - CUndoStack.getInstance(mapControl).add(new CPaintOp(previewRect, aOrigData, (short)mapControl.getSelectedTile())); + UndoAndRedo.getInstance(mapControl).add(new CPaintOp(previewRect, aOrigData, (short)mapControl.getSelectedTile())); */ endFill(); Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-10-02 12:51:21 UTC (rev 446) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-10-02 12:54:12 UTC (rev 447) @@ -37,7 +37,7 @@ import java.io.File; import java.util.Iterator; import java.util.List; -import net.sf.gridarta.CUndoStack; +import net.sf.gridarta.UndoAndRedo; import net.sf.gridarta.Size2D; import org.jetbrains.annotations.NotNull; @@ -368,14 +368,14 @@ * Undoes a change in the level. */ public void undo() { - CUndoStack.getInstance(this).undo(); + UndoAndRedo.getInstance(this).undo(); } /** * Redoes a change in the level. */ public void redo() { - CUndoStack.getInstance(this).redo(); + UndoAndRedo.getInstance(this).redo(); } /** @@ -383,7 +383,7 @@ * @return the name of the undo operation */ public String getUndoName() { - return CUndoStack.getInstance(this).getUndoName(); + return UndoAndRedo.getInstance(this).getUndoName(); } /** @@ -391,7 +391,7 @@ * @return the name of the redo operation */ public String getRedoName() { - return CUndoStack.getInstance(this).getRedoName(); + return UndoAndRedo.getInstance(this).getRedoName(); } /** @@ -400,7 +400,7 @@ * possible */ public boolean isUndoPossible() { - return CUndoStack.getInstance(this).canUndo(); + return UndoAndRedo.getInstance(this).canUndo(); } /** @@ -409,7 +409,7 @@ * possible */ public boolean isRedoPossible() { - return CUndoStack.getInstance(this).canRedo(); + return UndoAndRedo.getInstance(this).canRedo(); } /** Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-10-02 12:51:21 UTC (rev 446) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-10-02 12:54:12 UTC (rev 447) @@ -113,7 +113,6 @@ import static javax.swing.JOptionPane.showMessageDialog; import static javax.swing.KeyStroke.getKeyStroke; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.CUndoStack; import net.sf.gridarta.MainControl; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.map.MapType; Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-10-02 12:51:21 UTC (rev 446) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-10-02 12:54:12 UTC (rev 447) @@ -45,7 +45,7 @@ import java.util.List; import javax.imageio.ImageIO; import javax.swing.ImageIcon; -import net.sf.gridarta.CUndoStack; +import net.sf.gridarta.UndoAndRedo; import net.sf.gridarta.Size2D; import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapGrid; @@ -240,14 +240,14 @@ * Undoes a change in the level. */ public void undo() { - CUndoStack.getInstance(this).undo(); + UndoAndRedo.getInstance(this).undo(); } /** * Redoes a change in the level. */ public void redo() { - CUndoStack.getInstance(this).redo(); + UndoAndRedo.getInstance(this).redo(); } /** @@ -262,7 +262,7 @@ * @return the name of the undo operation */ public String getUndoName() { - return CUndoStack.getInstance(this).getUndoName(); + return UndoAndRedo.getInstance(this).getUndoName(); } /** @@ -270,7 +270,7 @@ * @return the name of the redo operation */ public String getRedoName() { - return CUndoStack.getInstance(this).getRedoName(); + return UndoAndRedo.getInstance(this).getRedoName(); } /** @@ -279,7 +279,7 @@ * possible */ public boolean isUndoPossible() { - return CUndoStack.getInstance(this).canUndo(); + return UndoAndRedo.getInstance(this).canUndo(); } /** @@ -288,7 +288,7 @@ * possible */ public boolean isRedoPossible() { - return CUndoStack.getInstance(this).canRedo(); + return UndoAndRedo.getInstance(this).canRedo(); } /** Deleted: trunk/src/app/net/sf/gridarta/CUndoStack.java =================================================================== --- trunk/src/app/net/sf/gridarta/CUndoStack.java 2006-10-02 12:51:21 UTC (rev 446) +++ trunk/src/app/net/sf/gridarta/CUndoStack.java 2006-10-02 12:54:12 UTC (rev 447) @@ -1,157 +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 net.sf.gridarta; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.WeakHashMap; -import net.sf.gridarta.map.MapControl; - -/** - * The undo/redo stack that is used when undoing/redoing operations. - * Every operation should add itself to the stack using the add() method. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @todo transform {@link #undo()} and {@link #redo()} into Actions. - */ -public final class CUndoStack { - - /** The shared hashtable that maps levels to undo stacks. */ - private static final Map<MapControl, CUndoStack> hashFromLevelToStack = new WeakHashMap<MapControl, CUndoStack>(); - - /** The undo stack. Contains all undoable operations. */ - private final List<Undoable> undoStack = new ArrayList<Undoable>(); - - /** The redo stack. Contains all redoable operations. */ - private final List<Undoable> redoStack = new ArrayList<Undoable>(); - - /** The maximum size of the stacks. */ - private int maxStackSize = 10; - - /** - * Returns the undo stack for the given level controller. - * @param mapControl the level whose undo/redo stack is to be returned - * @return the undo/redo stack for the given level - */ - public static CUndoStack getInstance(final MapControl mapControl) { - if (hashFromLevelToStack.containsKey(mapControl)) { - return hashFromLevelToStack.get(mapControl); - } - - final CUndoStack instance = new CUndoStack(); - hashFromLevelToStack.put(mapControl, instance); - return instance; - } - - /** Constructs an undo/redo stack. */ - private CUndoStack() { - } - - /** - * Returns the maximum stack size. - * @return the maximum stack size - */ - int getMaxStackSize() { - return maxStackSize; - } - - /** - * Sets the maximum stack size. - * @param size the new maximum stack size - */ - void setMaxStackSize(final int size) { - maxStackSize = size; - } - - /** - * Adds a new undoable/redoable operation to the undo/redo stack. - * @param undoOp the new operation to be added to the stack - */ - public void add(final Undoable undoOp) { - undoStack.add(undoOp); - redoStack.clear(); - if (undoStack.size() > maxStackSize) { - undoStack.remove(0); - } - } - - /** - * Returns whether the last operation in the undo stack can be undone. - * @return <code>true</code> if the last operation in the undo stack can be - * undone, <code>false</code> if not - */ - public boolean canUndo() { - return undoStack.size() > 0 && undoStack.get(undoStack.size() - 1).isUndoable(); - - } - - /** - * Returns the name of the last operation in the undo stack. - * @return the name of the last operation in the undo stack - */ - public String getUndoName() { - return canUndo() ? undoStack.get(undoStack.size() - 1).getName() : ""; - } - - /** Undoes the last operation in the undo stack. */ - public void undo() { - if (canUndo()) { - final Undoable op = undoStack.get(undoStack.size() - 1); - undoStack.remove(op); - op.undo(); - redoStack.add(op); - } - } - - /** - * Returns whether the last operation in the redo stack can be redone. - * @return <code>true</code> if the last operation in the redo stack can be - * redone, <code>false</code> if not - */ - public boolean canRedo() { - return redoStack.size() > 0 && redoStack.get(redoStack.size() - 1).isRedoable(); - - } - - /** - * Returns the name of the last operation in the redo stack. - * @return the name of the last operation in the redo stack - */ - public String getRedoName() { - return canRedo() ? redoStack.get(redoStack.size() - 1).getName() : ""; - } - - /** Redoes the last operation in the redo stack. */ - public void redo() { - if (canRedo()) { - final Undoable op = redoStack.get(redoStack.size() - 1); - redoStack.remove(op); - op.redo(); - undoStack.add(op); - } - } - -} // class CUndoStack Copied: trunk/src/app/net/sf/gridarta/UndoAndRedo.java (from rev 446, trunk/src/app/net/sf/gridarta/CUndoStack.java) =================================================================== --- trunk/src/app/net/sf/gridarta/UndoAndRedo.java (rev 0) +++ trunk/src/app/net/sf/gridarta/UndoAndRedo.java 2006-10-02 12:54:12 UTC (rev 447) @@ -0,0 +1,157 @@ +/* + * 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 net.sf.gridarta; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; +import net.sf.gridarta.map.MapControl; + +/** + * The undo/redo stack that is used when undoing/redoing operations. + * Every operation should add itself to the stack using the add() method. + * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @todo transform {@link #undo()} and {@link #redo()} into Actions. + */ +public final class UndoAndRedo { + + /** The shared hashtable that maps levels to undo stacks. */ + private static final Map<MapControl, UndoAndRedo> hashFromLevelToStack = new WeakHashMap<MapControl, UndoAndRedo>(); + + /** The undo stack. Contains all undoable operations. */ + private final List<Undoable> undoStack = new ArrayList<Undoable>(); + + /** The redo stack. Contains all redoable operations. */ + private final List<Undoable> redoStack = new ArrayList<Undoable>(); + + /** The maximum size of the stacks. */ + private int maxStackSize = 10; + + /** + * Returns the undo stack for the given level controller. + * @param mapControl the level whose undo/redo stack is to be returned + * @return the undo/redo stack for the given level + */ + public static UndoAndRedo getInstance(final MapControl mapControl) { + if (hashFromLevelToStack.containsKey(mapControl)) { + return hashFromLevelToStack.get(mapControl); + } + + final UndoAndRedo instance = new UndoAndRedo(); + hashFromLevelToStack.put(mapControl, instance); + return instance; + } + + /** Constructs an undo/redo stack. */ + private UndoAndRedo() { + } + + /** + * Returns the maximum stack size. + * @return the maximum stack size + */ + int getMaxStackSize() { + return maxStackSize; + } + + /** + * Sets the maximum stack size. + * @param size the new maximum stack size + */ + void setMaxStackSize(final int size) { + maxStackSize = size; + } + + /** + * Adds a new undoable/redoable operation to the undo/redo stack. + * @param undoOp the new operation to be added to the stack + */ + public void add(final Undoable undoOp) { + undoStack.add(undoOp); + redoStack.clear(); + if (undoStack.size() > maxStackSize) { + undoStack.remove(0); + } + } + + /** + * Returns whether the last operation in the undo stack can be undone. + * @return <code>true</code> if the last operation in the undo stack can be + * undone, <code>false</code> if not + */ + public boolean canUndo() { + return undoStack.size() > 0 && undoStack.get(undoStack.size() - 1).isUndoable(); + + } + + /** + * Returns the name of the last operation in the undo stack. + * @return the name of the last operation in the undo stack + */ + public String getUndoName() { + return canUndo() ? undoStack.get(undoStack.size() - 1).getName() : ""; + } + + /** Undoes the last operation in the undo stack. */ + public void undo() { + if (canUndo()) { + final Undoable op = undoStack.get(undoStack.size() - 1); + undoStack.remove(op); + op.undo(); + redoStack.add(op); + } + } + + /** + * Returns whether the last operation in the redo stack can be redone. + * @return <code>true</code> if the last operation in the redo stack can be + * redone, <code>false</code> if not + */ + public boolean canRedo() { + return redoStack.size() > 0 && redoStack.get(redoStack.size() - 1).isRedoable(); + + } + + /** + * Returns the name of the last operation in the redo stack. + * @return the name of the last operation in the redo stack + */ + public String getRedoName() { + return canRedo() ? redoStack.get(redoStack.size() - 1).getName() : ""; + } + + /** Redoes the last operation in the redo stack. */ + public void redo() { + if (canRedo()) { + final Undoable op = redoStack.get(redoStack.size() - 1); + redoStack.remove(op); + op.redo(); + undoStack.add(op); + } + } + +} // class UndoAndRedo Property changes on: trunk/src/app/net/sf/gridarta/UndoAndRedo.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-02 12:51:38
|
Revision: 446 http://svn.sourceforge.net/gridarta/?rev=446&view=rev Author: christianhujer Date: 2006-10-02 05:51:21 -0700 (Mon, 02 Oct 2006) Log Message: ----------- Removed dependency of CUndoStack to CMainControl. Improved documentation on Undo system. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/CUndoStack.java trunk/src/app/net/sf/gridarta/Undoable.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-01 22:50:54 UTC (rev 445) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-02 12:51:21 UTC (rev 446) @@ -226,9 +226,6 @@ * Initialises this main controller. */ void init(final boolean doShow) { - // Register ourselves to the undo/redo stack - CUndoStack.setMainControl(this); - // Get the current directory strCurrentDir = System.getProperty("user.dir"); currentDir = new File(strCurrentDir); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-10-01 22:50:54 UTC (rev 445) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-10-02 12:51:21 UTC (rev 446) @@ -393,9 +393,6 @@ /** Initialises this main controller. */ void init() { - // Register ourselves to the undo/redo stack - CUndoStack.setMainControl(this); - // Get the current directory currentDir = new File(System.getProperty("user.dir")); Modified: trunk/src/app/net/sf/gridarta/CUndoStack.java =================================================================== --- trunk/src/app/net/sf/gridarta/CUndoStack.java 2006-10-01 22:50:54 UTC (rev 445) +++ trunk/src/app/net/sf/gridarta/CUndoStack.java 2006-10-02 12:51:21 UTC (rev 446) @@ -34,12 +34,11 @@ * The undo/redo stack that is used when undoing/redoing operations. * Every operation should add itself to the stack using the add() method. * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @todo transform {@link #undo()} and {@link #redo()} into Actions. */ public final class CUndoStack { - /** The controller of the undo stack model. */ - private static MainControl mainControl; - /** The shared hashtable that maps levels to undo stacks. */ private static final Map<MapControl, CUndoStack> hashFromLevelToStack = new WeakHashMap<MapControl, CUndoStack>(); @@ -67,14 +66,6 @@ return instance; } - /** - * Sets the main controller of all undo/redo stack models. - * @param mainControl the controller of all undo/redo stacks - */ - public static void setMainControl(final MainControl mainControl) { - CUndoStack.mainControl = mainControl; - } - /** Constructs an undo/redo stack. */ private CUndoStack() { } @@ -105,10 +96,6 @@ if (undoStack.size() > maxStackSize) { undoStack.remove(0); } - - if (mainControl != null) { - mainControl.refreshMenusAndToolbars(); - } } /** @@ -136,10 +123,6 @@ undoStack.remove(op); op.undo(); redoStack.add(op); - - if (mainControl != null) { - mainControl.refreshMenusAndToolbars(); - } } } @@ -168,10 +151,6 @@ redoStack.remove(op); op.redo(); undoStack.add(op); - - if (mainControl != null) { - mainControl.refreshMenusAndToolbars(); - } } } Modified: trunk/src/app/net/sf/gridarta/Undoable.java =================================================================== --- trunk/src/app/net/sf/gridarta/Undoable.java 2006-10-01 22:50:54 UTC (rev 445) +++ trunk/src/app/net/sf/gridarta/Undoable.java 2006-10-02 12:51:21 UTC (rev 446) @@ -25,33 +25,41 @@ package net.sf.gridarta; /** - * A generic interface for undoable/redoable operations. + * An Operation that eventually can be undone or redone. * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public interface Undoable { /** * Returns whether the operation is undoable. - * @return True if the operation is undoable, false if not. + * @return <code>true</code> if the operation is undoable, otherwise <code>false</code>. */ boolean isUndoable(); - /** Undoes the operation (if that is possible). */ + /** + * Undoes this operation. + * If this operation is not {@link #isUndoable() undoable}, this operation silently returns without doing anything. + */ void undo(); /** * Returns whether the operation is redoable. - * @return True if the operation is redoable, false if not. + * @return <code>true</code> if the operation is redoable, otherwise <code>false</code>. */ boolean isRedoable(); - /** Reapplies the operation (if that is possible). */ + /** + * Redoes this operation. + * If this operation is not {@link #isRedoable() redoable}, this operation silently returns without doing anything. + */ void redo(); /** * Returns the operations short (about 8 chars max) name. The name is used * to show the operation in the menuitems and toolbar buttons tooltips. * @return The name of the operation. + * @todo decide whether it should be a key usable for i18n or the already localized message. */ String getName(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-01 22:51:04
|
Revision: 445 http://svn.sourceforge.net/gridarta/?rev=445&view=rev Author: christianhujer Date: 2006-10-01 15:50:54 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Improved documentation: More links. Added more common implementation methods to interface. Changed method order to be more logical. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-10-01 22:31:26 UTC (rev 444) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-10-01 22:50:54 UTC (rev 445) @@ -58,6 +58,7 @@ * @param attributeName Name of the attribute to search. * @param queryArchetype Whether to query the Archetype of this GameObject. * @return attribute value or zero if not found. + * @see #getAttributeInt(String) * @see #getAttributeString(String, boolean) */ int getAttributeInt(@NotNull String attributeName, boolean queryArchetype); @@ -66,15 +67,17 @@ * Get the requested attribute value of this GameObject as <code>int</code>. * @param attributeName Name of the attribute to search. * @return Attribute value or zero if not found + * @see #getAttributeInt(String, boolean) * @see #getAttributeString(String) */ int getAttributeInt(@NotNull String attributeName); /** - * Get the requested attribute value of this GameObject as <code>int</code>. + * Get the requested attribute value of this GameObject as <code>long</code>. * @param attributeName Name of the attribute to search. * @param queryArchetype Whether to query the Archetype of this GameObject. * @return attribute value or zero if not found. + * @see #getAttributeLong(String) * @see #getAttributeString(String, boolean) */ long getAttributeLong(@NotNull String attributeName, boolean queryArchetype); @@ -83,6 +86,7 @@ * Get the requested attribute value of this GameObject as <code>long</code>. * @param attributeName Name of the attribute to search. * @return Attribute value or zero if not found + * @see #getAttributeLong(String, boolean) * @see #getAttributeString(String) */ long getAttributeLong(@NotNull String attributeName); @@ -92,6 +96,7 @@ * @param attributeName Name of the attribute to search. * @param queryArchetype Whether to query the Archetype of this GameObject. * @return attribute value or zero if not found. + * @see #getAttributeDouble(String) * @see #getAttributeString(String, boolean) */ double getAttributeDouble(@NotNull String attributeName, boolean queryArchetype); @@ -100,6 +105,7 @@ * Get the requested attribute value of this GameObject as <code>double</code>. * @param attributeName Name of the attribute to search. * @return attribute value or zero if not found. + * @see #getAttributeDouble(String, boolean) * @see #getAttributeString(String) */ double getAttributeDouble(@NotNull String attributeName); @@ -112,6 +118,7 @@ * <li>A MapSquare, which means that this GameObject is top level on that MapSquare (Crossfire returns <code>null</code> for this).</li> * </ul> * @return container of this GameObject. + * @see #getTopContainer() */ @Nullable Object getContainer(); // todo: change return type to something more specific. @@ -120,33 +127,49 @@ * means being in a MapSquare isn't, but being in an GameObject is). * @return the topmost container but always GameObject, never MapSquare. * If this object is topmost itself, it returns itself. + * @see #getContainer() */ @NotNull GameObject getTopContainer(); /** * Get the Archetype this GameObject is based on. * @return Archetype this GameObject is based on. + * @note For Archetypes, this method returns <code>thus</code>. * @note currently this method returns the GameObject that reflects the Archetype data because there is no separate Archetype class. * This will change in future, and you should be aware of this fact. + * @see #isArchetype() + * @see #setArchetype(GameObject) */ @NotNull GameObject getArchetype(); /** + * Returns whether this GameObject is an Archetype. + * @return <code>true</code> if this GameObject is an Archetype, otherwise <code>false</code> + * @see #getArchetype() + * @see #setArchetype(GameObject) + * @see #isArtifact() + */ + boolean isArchetype(); + + /** * Set the Archetype of this GameObject. * @param archetype new Archetype of this GameObject. * @note currently this method takes a GameObject that reflects the Archetype data because there is no separate Archetype class. * This will change in future, and you should be aware of this fact. + * @see #getArchetype() * @see #isArchetype() */ void setArchetype(@NotNull final GameObject archetype); /** - * Returns whether this GameObject is an Archetype. - * @return <code>true</code> if this GameObject is an Archetype, otherwise <code>false</code> - * @see #isArtifact() - * @see #setArchetype(GameObject) + * Returns whether this GameObject is an Artifact. + * Artifacts are special forms of Archetypes, and they are excluded from Archetypes collection. + * @return <code>true</code> if this GameObject is an Artifact, otherwise <code>false</code>. + * @invariant if this method returns <code>true</code>, {@link #isArchetype()} also returns <code>true</code>. + * @see #setArtifact(boolean) + * @see #isArchetype() */ - boolean isArchetype(); + boolean isArtifact(); /** * Sets whether this GameObject is an Artifact. @@ -156,33 +179,47 @@ void setArtifact(boolean artifact); /** - * Returns whether this GameObject is an Artifact. - * Artifacts are special forms of Archetypes, and they are excluded from Archetypes collection. - * @return <code>true</code> if this GameObject is an Artifact, otherwise <code>false</code>. - * @invariant if this method returns <code>true</code>, {@link #isArchetype()} also returns <code>true</code>. - * @see #isArchetype() - * @see #setArtifact(boolean) + * Get the EditType of an GameObject (e.g. floor, monster, etc). These are + * determined by the various attributes of the GameObject (->objectText). + * @param checkType bitmask containing the edit type(s) to be calculated + * @return new editType for this GameObject + * @see #getEditType() + * @see #setEditType(int) */ - boolean isArtifact(); + int calculateEditType(int checkType); /** * Returns the edit type. * @return edit type + * @see #calculateEditType(int) + * @see #setEditType(int) */ int getEditType(); /** * Sets the edit type of this GameObject. * @param editType edit type of this GameObject. + * @see #calculateEditType(int) + * @see #getEditType() */ void setEditType(int editType); /** - * Get the EditType of an GameObject (e.g. floor, monster, etc). These are - * determined by the various attributes of the GameObject (->objectText). - * @param checkType bitmask containing the edit type(s) to be calculated - * @return new editType for this GameObject + * Get the X coordinate of this GameObject on its map. + * This method only guarantees a reasonable value for GameObjects that are directly bound to a map. + * Implementations may also return reasonable values for GameObjects inside containers, but they are not required to do so. + * @return X coordinate on map + * @see #getMapY() */ - int calculateEditType(int checkType); + int getMapX(); + /** + * Get the Y coordinate of this GameObject on its map. + * This method only guarantees a reasonable value for GameObjects that are directly bound to a map. + * Implementations may also return reasonable values for GameObjects inside containers, but they are not required to do so. + * @return Y coordinate on map + * @see #getMapX() + */ + int getMapY(); + } // interface GameObject This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-01 22:31:43
|
Revision: 444 http://svn.sourceforge.net/gridarta/?rev=444&view=rev Author: christianhujer Date: 2006-10-01 15:31:26 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Extracted GameObject artifact status to interface. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-10-01 22:17:42 UTC (rev 443) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-10-01 22:31:26 UTC (rev 444) @@ -561,25 +561,12 @@ myId = num; } - /** - * Sets if this flag is set, the arch is not a "real" arch but comes from - * the artifacts file. Such GameObject instances are not included in the - * arch collection, since the artifacts file is the same for editor and - * server. - * @param artifact if this flag is set, the arch is not a "real" arch but comes from the artifacts file. - */ + /** {@inheritDoc} */ public void setArtifact(final boolean artifact) { this.artifact = artifact; } - /** - * Returns if this flag is set, the arch is not a "real" arch but comes - * from the artifacts file. Such GameObject instances are not included in - * the arch collection, since the artifacts file is the same for editor and - * server. - * @return if this flag is set, the arch is not a "real" arch but comes - * from the artifacts file. - */ + /** {@inheritDoc} */ public boolean isArtifact() { return artifact; } Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-10-01 22:17:42 UTC (rev 443) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-10-01 22:31:26 UTC (rev 444) @@ -460,25 +460,12 @@ return container != null ? container.getMapSquare() : null; } - /** - * Sets if this flag is set, the arch is not a "real" arch but comes from - * the artifacts file. Such GameObject instances are not included in the - * arch collection, since the artifacts file is the same for editor and - * server. - * @param artifact if this flag is set, the arch is not a "real" arch but comes from the artifacts file. - */ + /** {@inheritDoc} */ public void setArtifact(final boolean artifact) { this.artifact = artifact; } - /** - * Returns if this flag is set, the arch is not a "real" arch but comes - * from the artifacts file. Such GameObject instances are not included in - * the arch collection, since the artifacts file is the same for editor and - * server. - * @return if this flag is set, the arch is not a "real" arch but comes - * from the artifacts file. - */ + /** {@inheritDoc} */ public boolean isArtifact() { return artifact; } @@ -521,7 +508,7 @@ } /** - * Insert an GameObject before this GameObject. + * Insert a GameObject before this GameObject. * @param node GameObject to append */ public void insertBefore(final GameObject node) { @@ -529,7 +516,7 @@ } /** - * Insert an GameObject after this GameObject. + * Insert a GameObject after this GameObject. * @param node GameObject to append */ public void insertAfter(final GameObject node) { Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-10-01 22:17:42 UTC (rev 443) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-10-01 22:31:26 UTC (rev 444) @@ -136,16 +136,36 @@ * @param archetype new Archetype of this GameObject. * @note currently this method takes a GameObject that reflects the Archetype data because there is no separate Archetype class. * This will change in future, and you should be aware of this fact. + * @see #isArchetype() */ void setArchetype(@NotNull final GameObject archetype); /** * Returns whether this GameObject is an Archetype. * @return <code>true</code> if this GameObject is an Archetype, otherwise <code>false</code> + * @see #isArtifact() + * @see #setArchetype(GameObject) */ boolean isArchetype(); /** + * Sets whether this GameObject is an Artifact. + * @param artifact <code>true</code> if this GameObject is an Artifact, otherwise <code>false</code>. + * @see #isArtifact() + */ + void setArtifact(boolean artifact); + + /** + * Returns whether this GameObject is an Artifact. + * Artifacts are special forms of Archetypes, and they are excluded from Archetypes collection. + * @return <code>true</code> if this GameObject is an Artifact, otherwise <code>false</code>. + * @invariant if this method returns <code>true</code>, {@link #isArchetype()} also returns <code>true</code>. + * @see #isArchetype() + * @see #setArtifact(boolean) + */ + boolean isArtifact(); + + /** * Returns the edit type. * @return edit type */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-01 22:17:49
|
Revision: 443 http://svn.sourceforge.net/gridarta/?rev=443&view=rev Author: christianhujer Date: 2006-10-01 15:17:42 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Fixed bogus description of calculateEditType(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-10-01 22:15:08 UTC (rev 442) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-10-01 22:17:42 UTC (rev 443) @@ -159,9 +159,9 @@ /** * Get the EditType of an GameObject (e.g. floor, monster, etc). These are - * determined by the various attributes of the arch (->objectText). + * determined by the various attributes of the GameObject (->objectText). * @param checkType bitmask containing the edit type(s) to be calculated - * @return new editType for this arch + * @return new editType for this GameObject */ int calculateEditType(int checkType); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-01 22:15:20
|
Revision: 442 http://svn.sourceforge.net/gridarta/?rev=442&view=rev Author: christianhujer Date: 2006-10-01 15:15:08 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Inlined private methods that were used only once. daimonin: Also removed bug that queried the wrong archetype for ScriptArchData. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/ScriptArchData.java trunk/daimonin/src/daieditor/gameobject/GameObject.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-10-01 21:45:45 UTC (rev 441) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-10-01 22:15:08 UTC (rev 442) @@ -312,19 +312,8 @@ return editType; } - /** - * Get the requested attribute value of this GameObject as {@link String}. - * The attribute value is first searched in this GameObject. - * If the attribute value is not found and <code><var>archetype</var> != null</code>, - * the attribute value is searched in <var>archetype</var>, too. - * If it's not found at all, an empty String is returned. - * @param attributeName Name of the attribute to search. - * This will be <code>"<var>attributeName</var> value"</code> - * in the {@link #getObjectText() object text}. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or empty String if not found. - */ - @NotNull private String getAttributeString(@NotNull String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** {@inheritDoc} */ + @NotNull public String getAttributeString(@NotNull String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype int j; attributeName = attributeName.trim() + " "; // attributeName must be followed by space @@ -367,23 +356,12 @@ } /** {@inheritDoc} */ - @NotNull public String getAttributeString(@NotNull final String attributeName, final boolean queryArchetype) { - return getAttributeString(attributeName, queryArchetype ? archetype : null); - } - - /** {@inheritDoc} */ @NotNull public String getAttributeString(@NotNull final String attributeName) { return getAttributeString(attributeName, true); } - /** - * Get the requested attribute value of this GameObject as <code>int</code>. - * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - */ - public int getAttributeInt(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** {@inheritDoc} */ + public int getAttributeInt(@NotNull final String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -405,23 +383,12 @@ } /** {@inheritDoc} */ - public int getAttributeInt(@NotNull final String attributeName, final boolean queryArchetype) { - return getAttributeInt(attributeName, queryArchetype ? archetype : null); - } - - /** {@inheritDoc} */ public int getAttributeInt(@NotNull final String attributeName) { return getAttributeInt(attributeName, true); } - /** - * Get the requested attribute value of this GameObject as <code>long</code>. - * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - */ - private long getAttributeLong(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** {@inheritDoc} */ + public long getAttributeLong(@NotNull final String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -442,23 +409,12 @@ } /** {@inheritDoc} */ - public long getAttributeLong(@NotNull final String attributeName, final boolean queryArchetype) { - return getAttributeLong(attributeName, queryArchetype ? archetype : null); - } - - /** {@inheritDoc} */ public long getAttributeLong(@NotNull final String attributeName) { return getAttributeLong(attributeName, true); } - /** - * Get the requested attribute value of this GameObject as <code>double</code>. - * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - */ - private double getAttributeDouble(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** {@inheritDoc} */ + public double getAttributeDouble(@NotNull final String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -479,11 +435,6 @@ } /** {@inheritDoc} */ - public double getAttributeDouble(@NotNull final String attributeName, final boolean queryArchetype) { - return getAttributeDouble(attributeName, queryArchetype ? archetype : null); - } - - /** {@inheritDoc} */ public double getAttributeDouble(@NotNull final String attributeName) { return getAttributeDouble(attributeName, true); } Modified: trunk/daimonin/src/daieditor/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/ScriptArchData.java 2006-10-01 21:45:45 UTC (rev 441) +++ trunk/daimonin/src/daieditor/ScriptArchData.java 2006-10-01 22:15:08 UTC (rev 442) @@ -140,7 +140,7 @@ @Nullable private GameObject getScriptedEvent(final int eventType) { for (final GameObject tmp : owner) { // FIXME: using tmp.getAttributeInt("sub_type") with owner.getArchetype() instead of tmp.getArchetype() looks bogus. - if (tmp.getArchTypNr() == 118 && tmp.getAttributeInt("sub_type", owner.getArchetype()) == eventType) { + if (tmp.getArchTypNr() == 118 && tmp.getAttributeInt("sub_type") == eventType) { return tmp; } } @@ -177,8 +177,7 @@ final Vector<String> content = new Vector<String>(); for (final GameObject tmp : owner) { if (tmp.getArchTypNr() == 118) { - // FIXME: using tmp.getAttributeInt("sub_type") with owner.getArchetype() instead of tmp.getArchetype() looks bogus. - content.add(' ' + typeName(tmp.getAttributeInt("sub_type", owner.getArchetype()))); + content.add(' ' + typeName(tmp.getAttributeInt("sub_type"))); } } Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-10-01 21:45:45 UTC (rev 441) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-10-01 22:15:08 UTC (rev 442) @@ -342,14 +342,8 @@ return getAttributeString(attributeName, true); } - /** - * Get the requested attribute value of this GameObject as <code>int</code>. - * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - */ - public int getAttributeInt(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** {@inheritDoc} */ + public int getAttributeInt(@NotNull final String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -371,23 +365,12 @@ } /** {@inheritDoc} */ - public int getAttributeInt(@NotNull final String attributeName, final boolean queryArchetype) { - return getAttributeInt(attributeName, queryArchetype ? archetype : null); - } - - /** {@inheritDoc} */ public int getAttributeInt(@NotNull final String attributeName) { return getAttributeInt(attributeName, true); } - /** - * Get the requested attribute value of this GameObject as <code>long</code>. - * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - */ - private long getAttributeLong(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** {@inheritDoc} */ + public long getAttributeLong(@NotNull final String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -408,23 +391,12 @@ } /** {@inheritDoc} */ - public long getAttributeLong(@NotNull final String attributeName, final boolean queryArchetype) { - return getAttributeLong(attributeName, queryArchetype ? archetype : null); - } - - /** {@inheritDoc} */ public long getAttributeLong(@NotNull final String attributeName) { return getAttributeLong(attributeName, true); } - /** - * Get the requested attribute value of this GameObject as <code>double</code>. - * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - */ - private double getAttributeDouble(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** {@inheritDoc} */ + public double getAttributeDouble(@NotNull final String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -445,11 +417,6 @@ } /** {@inheritDoc} */ - public double getAttributeDouble(@NotNull final String attributeName, final boolean queryArchetype) { - return getAttributeDouble(attributeName, queryArchetype ? archetype : null); - } - - /** {@inheritDoc} */ public double getAttributeDouble(@NotNull final String attributeName) { return getAttributeDouble(attributeName, true); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-01 21:46:07
|
Revision: 441 http://svn.sourceforge.net/gridarta/?rev=441&view=rev Author: christianhujer Date: 2006-10-01 14:45:45 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Removed deprecated methods from gridarta GameObject. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/filter/AttributeFilter.java trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/ScriptArchData.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-01 21:45:45 UTC (rev 441) @@ -206,7 +206,7 @@ } for (int t = 0; t < argsNum * 2; t += 2) { - attrValue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t], archetype); + attrValue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t]); if (log.isDebugEnabled()) { log.debug(" arch: '" + attrValue + "', type: '" + tmp.getTypeAttr()[t + 1] + "'"); @@ -369,7 +369,7 @@ private JComboBox buildSpellBox(final CFArchAttrib attr) { // first parse the spell-number value from gameObject - int spnum = gameObject.getAttributeInt(attr.getNameOld(), archetype); // spell number + int spnum = gameObject.getAttributeInt(attr.getNameOld()); // spell number if (spnum < 0 || spnum >= typelist.getSpellNum().length - 1) { spnum = 0; // undefined spellnumbers be zero @@ -377,7 +377,7 @@ // do we have "none" spell? int active; - if (spnum == 0 && (gameObject.getAttributeString(attr.getNameOld(), archetype).length() == 0 || attr.getDataType() == CFArchAttrib.T_ZSPELL)) { + if (spnum == 0 && (gameObject.getAttributeString(attr.getNameOld()).length() == 0 || attr.getDataType() == CFArchAttrib.T_ZSPELL)) { active = 0; } else { // now look up the spell-number in the array of spells @@ -412,7 +412,7 @@ // build the array of list-items final String []array = new String[(int) (listData.size() / 2.)]; boolean hasSelection = false; - int active = gameObject.getAttributeInt(attr.getNameOld(), archetype); + int active = gameObject.getAttributeInt(attr.getNameOld()); for (int i = 0; i < array.length; i++) { array[i] = (String) listData.elementAt(i * 2 + 1); // put string to array @@ -447,7 +447,7 @@ */ private void buildBitmask(final CFArchAttrib attr, final BitmaskAttrib guiAttr, final CAttribBitmask bitmask, final JPanel mainPanel) { // initialize bitmask value - guiAttr.setValue(gameObject.getAttributeInt(attr.getNameOld(), archetype)); + guiAttr.setValue(gameObject.getAttributeInt(attr.getNameOld())); guiAttr.bitmask = bitmask; // add button @@ -677,16 +677,16 @@ final JCheckBox input; if (dType == CFArchAttrib.T_BOOL) { // normal bool - input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (gameObject.getAttributeInt(type.getAttr()[i].getNameOld(), archetype) == 1)); + input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (gameObject.getAttributeInt(type.getAttr()[i].getNameOld()) == 1)); } else { // parse values for customized bool final String trueVal = type.getAttr()[i].getMisc()[0]; if (trueVal.equals("0")) { - final String attrString = gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype); + final String attrString = gameObject.getAttributeString(type.getAttr()[i].getNameOld()); input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (attrString.length() == 0 || attrString.equals("0"))); } else { - input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype).equals(trueVal))); + input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (gameObject.getAttributeString(type.getAttr()[i].getNameOld()).equals(trueVal))); } } @@ -718,7 +718,7 @@ // parse value from gameObject final int fieldLength = (type.getAttr()[i].getInputLength() == 0 ? textFieldColumns : type.getAttr()[i].getInputLength()); - final int attrval = gameObject.getAttributeInt(type.getAttr()[i].getNameOld(), archetype); + final int attrval = gameObject.getAttributeInt(type.getAttr()[i].getNameOld()); if (attrval != 0) { input = new JTextField(String.valueOf(attrval), fieldLength); } else { @@ -778,7 +778,7 @@ dtxt = archetype.getFaceName(); } } else { - dtxt = gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype); + dtxt = gameObject.getAttributeString(type.getAttr()[i].getNameOld()); } input = new JTextField(dtxt, textFieldColumns); @@ -895,7 +895,7 @@ // textfield (no direct input, text is set by the treasurelist dialog) final JTextField input; - String treasureName = gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype); + String treasureName = gameObject.getAttributeString(type.getAttr()[i].getNameOld()); if (treasureName.trim().length() == 0 || treasureName.trim().equalsIgnoreCase("none")) { treasureName = CFTreasureListTree.NONE_SYM; } @@ -1192,7 +1192,7 @@ if (dType == CFArchAttrib.T_BOOL) { // a boolean attribute (flag) if (((BoolAttrib) attr).input.isSelected() != - (archetype.getAttributeInt(attr.ref.getNameOld(), null) == 1)) { + (archetype.getAttributeInt(attr.ref.getNameOld(), false) == 1)) { newArchText = newArchText + attr.ref.getNameOld() + " " + (((BoolAttrib) attr).input.isSelected() ? 1 : 0) + "\n"; } @@ -1205,31 +1205,31 @@ valString = attr.ref.getMisc()[1]; // false string } // now see if we need to write it into the archtext or not - if ((valString.equals("0") && !(archetype.getAttributeString(attr.ref.getNameOld(), null).length() == 0)) || (!valString.equals("0") && !archetype.getAttributeString(attr.ref.getNameOld(), null).equals(valString))) { + if ((valString.equals("0") && !(archetype.getAttributeString(attr.ref.getNameOld(), false).length() == 0)) || (!valString.equals("0") && !archetype.getAttributeString(attr.ref.getNameOld(), false).equals(valString))) { newArchText = newArchText + attr.ref.getNameOld() + " " + valString + "\n"; } } else if (dType == CFArchAttrib.T_INT || dType == CFArchAttrib.T_FLOAT) { // an int attribute if (dType == CFArchAttrib.T_INT && ((IntAttrib) attr).input.getText().trim().length() == 0) { - if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != 0) { + if (archetype.getAttributeInt(attr.ref.getNameOld(), false) != 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0\n"; } } else if (dType == CFArchAttrib.T_FLOAT && ((FloatAttrib) attr).input.getText().trim().length() == 0) { - if (archetype.getAttributeString(attr.ref.getNameOld(), null).length() > 0) { + if (archetype.getAttributeString(attr.ref.getNameOld(), false).length() > 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0.0\n"; } } else { try { if (dType == CFArchAttrib.T_INT) { final int value = Integer.parseInt(((IntAttrib) attr).input.getText().trim()); - if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != value) { + if (archetype.getAttributeInt(attr.ref.getNameOld(), false) != value) { newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } else { // try to parse floating point final double value = Double.parseDouble(((FloatAttrib) attr).input.getText().trim()); - final String defValueStr = archetype.getAttributeString(attr.ref.getNameOld(), null).trim(); + final String defValueStr = archetype.getAttributeString(attr.ref.getNameOld(), false).trim(); final double defValue; if (defValueStr.length() > 0) { defValue = Double.parseDouble(defValueStr); @@ -1275,7 +1275,7 @@ newFace = ""; } } else { - if (!inline.equals(archetype.getAttributeString(attr.ref.getNameOld(), null))) { + if (!inline.equals(archetype.getAttributeString(attr.ref.getNameOld(), false))) { newArchText = newArchText + attr.ref.getNameOld() + " " + inline + "\n"; } } @@ -1301,19 +1301,19 @@ if (attrVal == -1 || (attrVal == 0 && dType != CFArchAttrib.T_SPELL && dType != CFArchAttrib.T_ZSPELL)) { - if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != 0) { + if (archetype.getAttributeInt(attr.ref.getNameOld(), false) != 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0\n"; } } else if (attrVal == 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0\n"; - } else if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != attrVal) { + } else if (archetype.getAttributeInt(attr.ref.getNameOld(), false) != attrVal) { newArchText = newArchText + attr.ref.getNameOld() + " " + attrVal + "\n"; } } else if (dType == CFArchAttrib.T_BITMASK) { // a bitmask attribute (similar to integer, but easier because no parsing needed) final int value = ((BitmaskAttrib) attr).getValue(); // get bitmask value - if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != value) { + if (archetype.getAttributeInt(attr.ref.getNameOld(), false) != value) { newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } else if (dType == CFArchAttrib.T_TREASURE) { @@ -1324,7 +1324,7 @@ final boolean isNone = inline.equals(CFTreasureListTree.NONE_SYM) || inline.length() == 0; if (!isNone && !CFTreasureListTree.getInstance().containsTreasureList(inline) && - !inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld(), null))) { + !inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld(), false))) { // The user has specified a WRONG treasurelist name, and it does not come // from the default gameObject. -> Error and out. JOptionPane.showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + @@ -1333,8 +1333,8 @@ throw new GridderException(""); // bail out } - if (!inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld(), null)) - && !(isNone && archetype.getAttributeString(attr.ref.getNameOld(), null).length() == 0)) { + if (!inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld(), false)) + && !(isNone && archetype.getAttributeString(attr.ref.getNameOld(), false).length() == 0)) { if (isNone) { newArchText = newArchText + attr.ref.getNameOld() + " none\n"; } else { @@ -1348,7 +1348,7 @@ // Also write all the 'fixed' attributes into the archtext for (int i = 0; type.getAttr().length > i; i++) { if (type.getAttr()[i].getDataType() == CFArchAttrib.T_FIXED) { - final String defaultValue = archetype.getAttributeString(type.getAttr()[i].getNameOld(), null); + final String defaultValue = archetype.getAttributeString(type.getAttr()[i].getNameOld(), false); if (defaultValue.length() == 0 || (gameObject.getArchTypNr() != archetype.getArchTypNr() && !defaultValue.equalsIgnoreCase(type.getAttr()[i].getNameNew()))) { // usually, fixed attributes are only applied when *not* defined in the archetype. Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-10-01 21:45:45 UTC (rev 441) @@ -558,7 +558,7 @@ boolean match = true; for (int t = 0; t < argsNum * 2; t += 2) { - final String archvalue = arch.getAttributeString(tmp.getTypeAttr()[t], defarch); + final String archvalue = arch.getAttributeString(tmp.getTypeAttr()[t]); if (!archvalue.equals(tmp.getTypeAttr()[t + 1]) && !(tmp.getTypeAttr()[t + 1].equals("0") && archvalue.length() == 0)) { Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-01 21:45:45 UTC (rev 441) @@ -1325,10 +1325,10 @@ return; } - final String path = exit.getAttributeString("slaying", getArch(exit.getArchetypeName())); + final String path = exit.getAttributeString("slaying"); final Point exitPos = new Point(); - exitPos.x = exit.getAttributeInt("hp", getArch(exit.getArchetypeName())); - exitPos.y = exit.getAttributeInt("sp", getArch(exit.getArchetypeName())); + exitPos.x = exit.getAttributeInt("hp"); + exitPos.y = exit.getAttributeInt("sp"); if (path.length() == 0 || (currentMap.getMapFile() != null && path.equals(currentMap.getMapFile().getName()))) { Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-10-01 21:45:45 UTC (rev 441) @@ -417,8 +417,8 @@ // we look for 'type' in the ArchText. In future maybe type should get // a seperate textfield - if (arch.getAttributeString("type", null).length() > 0) { - arch.setArchTypNr(arch.getAttributeInt("type", null)); // specified type + if (arch.getAttributeString("type", false).length() > 0) { + arch.setArchTypNr(arch.getAttributeInt("type", false)); // specified type } // Recalculate the editType value. It shall stay 100% accurate ;) Modified: trunk/crossfire/src/cfeditor/filter/AttributeFilter.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/AttributeFilter.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/crossfire/src/cfeditor/filter/AttributeFilter.java 2006-10-01 21:45:45 UTC (rev 441) @@ -61,11 +61,10 @@ final Set<Map.Entry<String, String>> pairs = attrList.entrySet(); if (!pairs.isEmpty()) { hasChecked = true; - final GameObject def = object.getArchetype(); for (final Map.Entry<String, String> ent : pairs) { final String key = ent.getKey(); final String val = ent.getValue(); - if (!object.getAttributeString(key, def).equals(val)) { + if (!object.getAttributeString(key).equals(val)) { return false; } } Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2006-10-01 21:45:45 UTC (rev 441) @@ -312,8 +312,19 @@ return editType; } - /** {@inheritDoc} */ - @NotNull public String getAttributeString(@NotNull String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + /** + * Get the requested attribute value of this GameObject as {@link String}. + * The attribute value is first searched in this GameObject. + * If the attribute value is not found and <code><var>archetype</var> != null</code>, + * the attribute value is searched in <var>archetype</var>, too. + * If it's not found at all, an empty String is returned. + * @param attributeName Name of the attribute to search. + * This will be <code>"<var>attributeName</var> value"</code> + * in the {@link #getObjectText() object text}. + * @param archetype Archetype of this arch, or <code>null</code> to ignore. + * @return Attribute value or empty String if not found. + */ + @NotNull private String getAttributeString(@NotNull String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype int j; attributeName = attributeName.trim() + " "; // attributeName must be followed by space @@ -365,7 +376,13 @@ return getAttributeString(attributeName, true); } - /** {@inheritDoc} */ + /** + * Get the requested attribute value of this GameObject as <code>int</code>. + * @param attributeName Name of the attribute to search. + * @param archetype Archetype of this arch, or <code>null</code> to ignore. + * @return Attribute value or zero if not found. + * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. + */ public int getAttributeInt(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText @@ -393,7 +410,18 @@ } /** {@inheritDoc} */ - public long getAttributeLong(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + public int getAttributeInt(@NotNull final String attributeName) { + return getAttributeInt(attributeName, true); + } + + /** + * Get the requested attribute value of this GameObject as <code>long</code>. + * @param attributeName Name of the attribute to search. + * @param archetype Archetype of this arch, or <code>null</code> to ignore. + * @return Attribute value or zero if not found. + * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. + */ + private long getAttributeLong(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -419,7 +447,18 @@ } /** {@inheritDoc} */ - public double getAttributeDouble(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + public long getAttributeLong(@NotNull final String attributeName) { + return getAttributeLong(attributeName, true); + } + + /** + * Get the requested attribute value of this GameObject as <code>double</code>. + * @param attributeName Name of the attribute to search. + * @param archetype Archetype of this arch, or <code>null</code> to ignore. + * @return Attribute value or zero if not found. + * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. + */ + private double getAttributeDouble(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -445,6 +484,11 @@ } /** {@inheritDoc} */ + public double getAttributeDouble(@NotNull final String attributeName) { + return getAttributeDouble(attributeName, true); + } + + /** {@inheritDoc} */ @Nullable public GameObject getContainer() { return container; } @@ -551,7 +595,7 @@ return; } - final String elevation = arch.getAttributeString("elevation", null); + final String elevation = arch.getAttributeString("elevation", false); if (!elevation.equals("")) { setAttributeString("elevation", elevation); arch.removeAttribute("elevation"); Modified: trunk/daimonin/src/daieditor/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/ScriptArchData.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/daimonin/src/daieditor/ScriptArchData.java 2006-10-01 21:45:45 UTC (rev 441) @@ -139,6 +139,7 @@ */ @Nullable private GameObject getScriptedEvent(final int eventType) { for (final GameObject tmp : owner) { + // FIXME: using tmp.getAttributeInt("sub_type") with owner.getArchetype() instead of tmp.getArchetype() looks bogus. if (tmp.getArchTypNr() == 118 && tmp.getAttributeInt("sub_type", owner.getArchetype()) == eventType) { return tmp; } @@ -176,6 +177,7 @@ final Vector<String> content = new Vector<String>(); for (final GameObject tmp : owner) { if (tmp.getArchTypNr() == 118) { + // FIXME: using tmp.getAttributeInt("sub_type") with owner.getArchetype() instead of tmp.getArchetype() looks bogus. content.add(' ' + typeName(tmp.getAttributeInt("sub_type", owner.getArchetype()))); } } Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2006-10-01 21:45:45 UTC (rev 441) @@ -321,11 +321,6 @@ } /** {@inheritDoc} */ - @NotNull public String getAttributeString(@NotNull String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { - throw new Error("deprecated and not used in Daimonin"); - } - - /** {@inheritDoc} */ @NotNull public String getAttributeString(@NotNull final String attributeName, final boolean queryArchetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText @@ -347,7 +342,13 @@ return getAttributeString(attributeName, true); } - /** {@inheritDoc} */ + /** + * Get the requested attribute value of this GameObject as <code>int</code>. + * @param attributeName Name of the attribute to search. + * @param archetype Archetype of this arch, or <code>null</code> to ignore. + * @return Attribute value or zero if not found. + * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. + */ public int getAttributeInt(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // The "real" Archtext from arch & archetype // Add all attributes from archetype that don't already exist in aText @@ -375,7 +376,18 @@ } /** {@inheritDoc} */ - public long getAttributeLong(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + public int getAttributeInt(@NotNull final String attributeName) { + return getAttributeInt(attributeName, true); + } + + /** + * Get the requested attribute value of this GameObject as <code>long</code>. + * @param attributeName Name of the attribute to search. + * @param archetype Archetype of this arch, or <code>null</code> to ignore. + * @return Attribute value or zero if not found. + * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. + */ + private long getAttributeLong(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -401,7 +413,18 @@ } /** {@inheritDoc} */ - public double getAttributeDouble(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { + public long getAttributeLong(@NotNull final String attributeName) { + return getAttributeLong(attributeName, true); + } + + /** + * Get the requested attribute value of this GameObject as <code>double</code>. + * @param attributeName Name of the attribute to search. + * @param archetype Archetype of this arch, or <code>null</code> to ignore. + * @return Attribute value or zero if not found. + * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. + */ + private double getAttributeDouble(@NotNull final String attributeName, @Nullable final net.sf.gridarta.gameobject.GameObject archetype) { String aText = objectText.toString(); // Add all attributes from archetype that don't already exist in aText if (archetype != null) { @@ -427,6 +450,11 @@ } /** {@inheritDoc} */ + public double getAttributeDouble(@NotNull final String attributeName) { + return getAttributeDouble(attributeName, true); + } + + /** {@inheritDoc} */ @NotNull public GameObjectContainer getContainer() { return container; } Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-10-01 18:24:46 UTC (rev 440) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2006-10-01 21:45:45 UTC (rev 441) @@ -26,21 +26,6 @@ /** * Get the requested attribute value of this GameObject as {@link String}. * The attribute value is first searched in this GameObject. - * If the attribute value is not found and <code><var>archetype</var> != null</code>, - * the attribute value is searched in <var>archetype</var>, too. - * If it's not found at all, an empty String is returned. - * @param attributeName Name of the attribute to search. - * This will be <code>"<var>attributeName</var> value"</code> - * in the {@link #getObjectText() object text}. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or empty String if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - */ - @Deprecated @NotNull String getAttributeString(@NotNull String attributeName, @Nullable GameObject archetype); - - /** - * Get the requested attribute value of this GameObject as {@link String}. - * The attribute value is first searched in this GameObject. * If <code>queryArchetype == true</code>, additional search is done: * if the attribute value is not found and this GameObject is not an Archetype itself, * the attribute value is searched in this GameObject's Archetype as well. @@ -71,16 +56,6 @@ /** * Get the requested attribute value of this GameObject as <code>int</code>. * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - * @see #getAttributeString(String, GameObject) - */ - @Deprecated int getAttributeInt(@NotNull String attributeName, @Nullable GameObject archetype); - - /** - * Get the requested attribute value of this GameObject as <code>int</code>. - * @param attributeName Name of the attribute to search. * @param queryArchetype Whether to query the Archetype of this GameObject. * @return attribute value or zero if not found. * @see #getAttributeString(String, boolean) @@ -88,14 +63,12 @@ int getAttributeInt(@NotNull String attributeName, boolean queryArchetype); /** - * Get the requested attribute value of this GameObject as <code>long</code>. + * Get the requested attribute value of this GameObject as <code>int</code>. * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - * @see #getAttributeString(String, GameObject) + * @return Attribute value or zero if not found + * @see #getAttributeString(String) */ - @Deprecated long getAttributeLong(@NotNull String attributeName, @Nullable GameObject archetype); + int getAttributeInt(@NotNull String attributeName); /** * Get the requested attribute value of this GameObject as <code>int</code>. @@ -107,17 +80,15 @@ long getAttributeLong(@NotNull String attributeName, boolean queryArchetype); /** - * Get the requested attribute value of this GameObject as <code>double</code>. + * Get the requested attribute value of this GameObject as <code>long</code>. * @param attributeName Name of the attribute to search. - * @param archetype Archetype of this arch, or <code>null</code> to ignore. - * @return Attribute value or zero if not found. - * @deprecated a GameObject knows its own archetype and there is no purpose for using another GameObject as archetype. Because of that this method will be removed. - * @see #getAttributeString(String, net.sf.gridarta.gameobject.GameObject) + * @return Attribute value or zero if not found + * @see #getAttributeString(String) */ - @Deprecated double getAttributeDouble(@NotNull String attributeName, @Nullable GameObject archetype); + long getAttributeLong(@NotNull String attributeName); /** - * Get the requested attribute value of this GameObject as <code>int</code>. + * Get the requested attribute value of this GameObject as <code>double</code>. * @param attributeName Name of the attribute to search. * @param queryArchetype Whether to query the Archetype of this GameObject. * @return attribute value or zero if not found. @@ -126,6 +97,14 @@ double getAttributeDouble(@NotNull String attributeName, boolean queryArchetype); /** + * Get the requested attribute value of this GameObject as <code>double</code>. + * @param attributeName Name of the attribute to search. + * @return attribute value or zero if not found. + * @see #getAttributeString(String) + */ + double getAttributeDouble(@NotNull String attributeName); + + /** * Returns container of this GameObject. * There are two possibilities for the container: * <ul> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-10-01 18:24:50
|
Revision: 440 http://svn.sourceforge.net/gridarta/?rev=440&view=rev Author: akirschbaum Date: 2006-10-01 11:24:46 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Fix incorrect indentation. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CopyBuffer.java Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-10-01 17:50:49 UTC (rev 439) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-10-01 18:24:46 UTC (rev 440) @@ -371,7 +371,7 @@ if (!mapControl.isPointValid(mapPos)) { // outside map - return; + return; } final GameObject newTail = tmp.createClone(mapPos.x, mapPos.y); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-10-01 17:51:01
|
Revision: 439 http://svn.sourceforge.net/gridarta/?rev=439&view=rev Author: akirschbaum Date: 2006-10-01 10:50:49 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Implement "Random Fill" function. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/map/MapControl.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2006-10-01 16:47:36 UTC (rev 438) +++ trunk/crossfire/ChangeLog 2006-10-01 17:50:49 UTC (rev 439) @@ -1,3 +1,7 @@ +2006-10-01 Andreas Kirschbaum + + * Implement "Random Fill" function. + 2006-09-29 Andreas Kirschbaum * Make deletion of inventory objects from map tile panel work. Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-01 16:47:36 UTC (rev 438) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-01 17:50:49 UTC (rev 439) @@ -42,6 +42,7 @@ import java.util.Enumeration; import java.util.Iterator; import java.util.List; +import java.util.Random; import java.util.Vector; import javax.swing.ImageIcon; import javax.swing.JComponent; @@ -158,6 +159,9 @@ private String strCurrentDir; + /** Global random number generator. */ + public static final Random rnd = new Random(System.currentTimeMillis() + 19580427); + // resource directories private File mapDir; @@ -1638,9 +1642,50 @@ return; // this should never be possible, but I just wanna make sure... } - copybuffer.fill(currentMap, fillBelow); + copybuffer.fill(currentMap, fillBelow, -1); } + /** "Random fill above" was selected from the Edit menu. */ + public void randFillAbove() { + fillRandomWanted(false); + } + + /** "Random fill below" was selected from the Edit menu. */ + public void randFillBelow() { + fillRandomWanted(true); + } + + /** + * "RandomFill" was selected from the Edit menu. + * @param fillBelow true if "Fill Below" was activated, false if "Fill Above" + */ + private void fillRandomWanted(final boolean fillBelow) { + if (currentMap == null || currentMap.getMapView() == null) { + return; // this should never be possible, but I just wanna make sure... + } + + String input = "100"; + for (;;) { + input = (String) JOptionPane.showInputDialog(mainView, "Enter a fill density between 1-100", fillBelow ? "Random fill below" : "Random fill above", JOptionPane.QUESTION_MESSAGE, null, null, input); + if (input == null) { + break; + } + + int rand = -1; + try { + rand = Integer.parseInt(input); + } catch (final NumberFormatException e) { + rand = -1; + } + if (rand < 1 || rand > 100) { + JOptionPane.showMessageDialog(mainView, "The fill density must be between 1-100.", "Illegal Value.", JOptionPane.ERROR_MESSAGE); + } else { + copybuffer.fill(currentMap, fillBelow, rand); + break; + } + } + } + /** "Replace" was selected from the Edit menu. */ public void replaceWanted() { if (currentMap == null || currentMap.getMapView() == null) { Modified: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-10-01 16:47:36 UTC (rev 438) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-10-01 17:50:49 UTC (rev 439) @@ -163,6 +163,10 @@ private SimpleMenuEntry m_fill_below; + private SimpleMenuEntry m_rand_fill_above; + + private SimpleMenuEntry m_rand_fill_below; + private SimpleMenuEntry m_font; private CheckBoxMenuEntry se_monster; @@ -484,6 +488,30 @@ }); menuManager.addMenuEntry("main.edit", m_fill_below); + // Random Fill: + m_rand_fill_above = new SimpleMenuEntry("Random Fill Above"); + m_rand_fill_above.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); + m_rand_fill_above.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, Event.CTRL_MASK)); + m_rand_fill_above.addActionListener( + new ActionListener() { + public void actionPerformed(final ActionEvent event) { + mainControl.randFillAbove(); + } + }); + menuManager.addMenuEntry("main.edit", m_rand_fill_above); + + // Random Fill: + m_rand_fill_below = new SimpleMenuEntry("Random Fill Below"); + m_rand_fill_below.setIcon(CGUIUtils.getIcon(IGUIConstants.EMPTY_SMALLICON)); + m_rand_fill_below.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, Event.CTRL_MASK | Event.SHIFT_MASK)); + m_rand_fill_below.addActionListener( + new ActionListener() { + public void actionPerformed(final ActionEvent event) { + mainControl.randFillBelow(); + } + }); + menuManager.addMenuEntry("main.edit", m_rand_fill_below); + add(entry.getMenuBarComponent()); } Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-10-01 16:47:36 UTC (rev 438) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-10-01 17:50:49 UTC (rev 439) @@ -264,8 +264,10 @@ * @param mapControl MapControl of the active map we paste on * @param fillBelow if true, the filling content is placed *below* the * existing map + * @param density the fill density in percent; -1 to disable + * @todo the fill density is ignored for floodfill */ - public void fill(final MapControl mapControl, final boolean fillBelow) { + public void fill(final MapControl mapControl, final boolean fillBelow, final int density) { final Point startp = mapControl.getMapView().getHighlightStart(); // start of highlighted rect final Point offset = mapControl.getMapView().getHighlightOffset(); // offset of rect from startp final Point pos = new Point(); @@ -304,6 +306,9 @@ // cycle through all tile coordinates which are highlighted: for (pos.x = startp.x; pos.x - startp.x <= offset.x; pos.x++) { for (pos.y = startp.y; pos.y - startp.y <= offset.y; pos.y++) { + if (density != -1 && density != 100 && density < CMainControl.rnd.nextInt(100) + 1) { + continue; + } // Insert the new arch into the map addArchToMap(mapControl, arch, pos, 0, fillBelow); } Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-10-01 16:47:36 UTC (rev 438) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-10-01 17:50:49 UTC (rev 439) @@ -600,6 +600,10 @@ return mapView; } + public MapArchObject getMapArch() { + return mapModel.getMapArchObject(); + } + public File getMapFile() { return mapFile; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-01 16:47:48
|
Revision: 438 http://svn.sourceforge.net/gridarta/?rev=438&view=rev Author: christianhujer Date: 2006-10-01 09:47:36 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Fixed bogus var name: Holds an attribute value, not an archetype or gameObject value. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/daimonin/src/daieditor/CAttribDialog.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-01 16:44:08 UTC (rev 437) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-01 16:47:36 UTC (rev 438) @@ -199,21 +199,21 @@ // check if all the type-attributes match final int argsNum = (int) (tmp.getTypeAttr().length / 2.0); boolean match = true; - String archvalue; + String attrValue; if (log.isDebugEnabled()) { log.debug("# type: " + tmp.getTypeName()); } for (int t = 0; t < argsNum * 2; t += 2) { - archvalue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t], archetype); + attrValue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t], archetype); if (log.isDebugEnabled()) { - log.debug(" arch: '" + archvalue + "', type: '" + tmp.getTypeAttr()[t + 1] + "'"); + log.debug(" arch: '" + attrValue + "', type: '" + tmp.getTypeAttr()[t + 1] + "'"); } - if (!archvalue.equals(tmp.getTypeAttr()[t + 1]) && - !(tmp.getTypeAttr()[t + 1].equals("0") && archvalue.length() == 0)) { + if (!attrValue.equals(tmp.getTypeAttr()[t + 1]) && + !(tmp.getTypeAttr()[t + 1].equals("0") && attrValue.length() == 0)) { match = false; if (log.isDebugEnabled()) { log.debug("-> attr: " + tmp.getTypeAttr()[t] + " NO match"); Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-10-01 16:44:08 UTC (rev 437) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-10-01 16:47:36 UTC (rev 438) @@ -240,11 +240,11 @@ //System.err.println("# type: "+tmp.getTypeName()); for (int t = 0, l = numArgs << 1; t < l; t += 2) { - final String archvalue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t], true); + final String attrValue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t], true); - //System.err.println(" arch: '"+archvalue+"', type: '"+tmp.getTypeAttr()[t+1]+"'"); + //System.err.println(" arch: '"+attrValue+"', type: '"+tmp.getTypeAttr()[t+1]+"'"); - if (!archvalue.equals(tmp.getTypeAttr()[t + 1]) && !("0".equals(tmp.getTypeAttr()[t + 1]) && archvalue.length() == 0)) { + if (!attrValue.equals(tmp.getTypeAttr()[t + 1]) && !("0".equals(tmp.getTypeAttr()[t + 1]) && attrValue.length() == 0)) { match = false; // //System.err.println("-> attr: " + tmp.getTypeAttr()[t] + " NO match"); //} else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-01 16:44:18
|
Revision: 437 http://svn.sourceforge.net/gridarta/?rev=437&view=rev Author: christianhujer Date: 2006-10-01 09:44:08 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Some Unification of CAttribDialog. Changed symbol names to new naming convention (defarch -> archetype, arch -> gameObject). Reworked some comments. Fixed some bogus parameter names (event -> e) to match name in original method description. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/daimonin/src/daieditor/CAttribDialog.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-01 16:03:13 UTC (rev 436) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-01 16:44:08 UTC (rev 437) @@ -114,15 +114,15 @@ private JComboBox typesel; // selection box for type - private JTextField nameTF; // textfield for arch name + private JTextField nameTF; // textfield for gameObject name - private JTextField defarchTF; // textfield for name of default arch + private JTextField defarchTF; // textfield for name of default gameObject private JLabel imagePanel; // panel for object's face (png) - private final GameObject arch; + private final GameObject gameObject; - private final GameObject defarch; + private final GameObject archetype; private CFArchType type; // reference to the type data @@ -154,11 +154,10 @@ * Constructor: Creates the GUI layout and * draws the dialog window. * @param atList the list of CF type-data - * @param aobj the GameObject to be displayed by this dialog - * @param defaobj the default GameObject of 'arch' + * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control */ - CAttribDialog(final CFArchTypeList atList, final GameObject aobj, final CMainControl mainControl) { + CAttribDialog(final CFArchTypeList atList, final GameObject gameObject, final CMainControl mainControl) { super(mainControl.getMainView(), "CF Attribute Dialog", false); // when close-box is selected, execute the 'closeDialog' method and nothing else @@ -178,12 +177,12 @@ CAttribDialog.setDefaultBounds(); // set width/height etc // reference to the GameObject - arch = aobj.getHead(); - defarch = arch.getArchetype(); + this.gameObject = gameObject.getHead(); + archetype = this.gameObject.getArchetype(); /* set frame icon - if (arch.getFaceNr() >= 0) { - setIconImage(mainControl.getArchObjectStack().getFace(arch.getFaceNr()).getImage()); + if (gameObject.getFaceNr() >= 0) { + setIconImage(mainControl.getArchObjectStack().getFace(gameObject.getFaceNr()).getImage()); } */ // check if the type of the object is present in the definitions @@ -192,13 +191,13 @@ type = tmp; boolean typeFound = false; for (int i = 0; tmp != null && !typeFound; tmp = tmp.getNext(), i++) { - if (tmp.getTypeNr() == arch.getArchTypNr()) { + if (tmp.getTypeNr() == this.gameObject.getArchTypNr()) { if (tmp.getTypeAttr() == null) { // no type-attributes, so we only compared type-numbers typeFound = true; } else { // check if all the type-attributes match - final int argsNum = (int) (tmp.getTypeAttr().length / 2.); + final int argsNum = (int) (tmp.getTypeAttr().length / 2.0); boolean match = true; String archvalue; @@ -207,7 +206,7 @@ } for (int t = 0; t < argsNum * 2; t += 2) { - archvalue = arch.getAttributeString(tmp.getTypeAttr()[t], defarch); + archvalue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t], archetype); if (log.isDebugEnabled()) { log.debug(" arch: '" + archvalue + "', type: '" + tmp.getTypeAttr()[t + 1] + "'"); @@ -356,7 +355,7 @@ typesel.setName("Types"); // the listener: - typesel.addItemListener(new TypesBoxAL(this, arch, defarch)); + typesel.addItemListener(new TypesBoxAL(this, gameObject, archetype)); lineLayout.add(typesel); return lineLayout; @@ -369,8 +368,8 @@ */ private JComboBox buildSpellBox(final CFArchAttrib attr) { - // first parse the spell-number value from arch - int spnum = arch.getAttributeInt(attr.getNameOld(), defarch); // spell number + // first parse the spell-number value from gameObject + int spnum = gameObject.getAttributeInt(attr.getNameOld(), archetype); // spell number if (spnum < 0 || spnum >= typelist.getSpellNum().length - 1) { spnum = 0; // undefined spellnumbers be zero @@ -378,7 +377,7 @@ // do we have "none" spell? int active; - if (spnum == 0 && (arch.getAttributeString(attr.getNameOld(), defarch).length() == 0 || attr.getDataType() == CFArchAttrib.T_ZSPELL)) { + if (spnum == 0 && (gameObject.getAttributeString(attr.getNameOld(), archetype).length() == 0 || attr.getDataType() == CFArchAttrib.T_ZSPELL)) { active = 0; } else { // now look up the spell-number in the array of spells @@ -413,7 +412,7 @@ // build the array of list-items final String []array = new String[(int) (listData.size() / 2.)]; boolean hasSelection = false; - int active = arch.getAttributeInt(attr.getNameOld(), defarch); + int active = gameObject.getAttributeInt(attr.getNameOld(), archetype); for (int i = 0; i < array.length; i++) { array[i] = (String) listData.elementAt(i * 2 + 1); // put string to array @@ -448,7 +447,7 @@ */ private void buildBitmask(final CFArchAttrib attr, final BitmaskAttrib guiAttr, final CAttribBitmask bitmask, final JPanel mainPanel) { // initialize bitmask value - guiAttr.setValue(arch.getAttributeInt(attr.getNameOld(), defarch)); + guiAttr.setValue(gameObject.getAttributeInt(attr.getNameOld(), archetype)); guiAttr.bitmask = bitmask; // add button @@ -465,7 +464,7 @@ /** * Construct the upper left part of the attribute dialog, - * containing name, type, defarch name and face. + * containing name, type, archetype name and face. * @return a <code>JScrollPane</code> with the upper left part of the dialog window */ private JScrollPane buildHeader() { @@ -473,7 +472,7 @@ final JPanel layout1 = new JPanel(new BorderLayout()); // face, name & type - imagePanel = new JLabel(mainControl.getArchObjectStack().getFace(arch.getFaceNr())); + imagePanel = new JLabel(mainControl.getArchObjectStack().getFace(gameObject.getFaceNr())); imagePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); layout1.add(imagePanel, BorderLayout.WEST); @@ -482,12 +481,12 @@ final JPanel layout3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); layout3.add(new JLabel("Name: ")); // create label - if (arch.getObjName() != null && arch.getObjName().length() > 0) { - nameTF = new JTextField(arch.getObjName(), 16); - } else if (defarch.getObjName() != null && defarch.getObjName().length() > 0) { - nameTF = new JTextField(defarch.getObjName(), 16); + if (gameObject.getObjName() != null && gameObject.getObjName().length() > 0) { + nameTF = new JTextField(gameObject.getObjName(), 16); + } else if (archetype.getObjName() != null && archetype.getObjName().length() > 0) { + nameTF = new JTextField(archetype.getObjName(), 16); } else { - nameTF = new JTextField(defarch.getArchetypeName(), 16); + nameTF = new JTextField(archetype.getArchetypeName(), 16); } nameTF.setEditable(false); layout3.add(nameTF); @@ -502,8 +501,8 @@ header.add(layout1); final JPanel layout4 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - layout4.add(new JLabel("Default Arch: ")); // create label - defarchTF = new JTextField(defarch.getArchetypeName(), 16); + layout4.add(new JLabel("Archetype: ")); // create label + defarchTF = new JTextField(archetype.getArchetypeName(), 16); defarchTF.setEditable(false); layout4.add(defarchTF); @@ -542,7 +541,7 @@ /** * Construct the central part of the attribute dialog, containing the - * object's arch attributes. + * object's gameObject attributes. * @return When this method is called the first time: a <code>JScrollPane</code> * with the central part of the dialog window. * All further calls rebuild the existing tabbedpane and return null. @@ -638,11 +637,11 @@ // note that the textarea is initialized with rows/columns: 1, 1 // this is pretty weird, but seems the only way to achieve desired behaviour if (type.getAttr()[i].getNameOld().equalsIgnoreCase("msg")) { - if (defarch.getMsgText() != null && defarch.getMsgText().length() > 0 - && (arch.getMsgText() == null || arch.getMsgText().trim().length() == 0)) { - input = new JTextArea(defarch.getMsgText(), 1, 1); + if (archetype.getMsgText() != null && archetype.getMsgText().length() > 0 + && (gameObject.getMsgText() == null || gameObject.getMsgText().trim().length() == 0)) { + input = new JTextArea(archetype.getMsgText(), 1, 1); } else { - input = new JTextArea(arch.getMsgText(), 1, 1); + input = new JTextArea(gameObject.getMsgText(), 1, 1); } } else { input = new JTextArea(1, 1); @@ -678,16 +677,16 @@ final JCheckBox input; if (dType == CFArchAttrib.T_BOOL) { // normal bool - input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (arch.getAttributeInt(type.getAttr()[i].getNameOld(), defarch) == 1)); + input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (gameObject.getAttributeInt(type.getAttr()[i].getNameOld(), archetype) == 1)); } else { // parse values for customized bool final String trueVal = type.getAttr()[i].getMisc()[0]; if (trueVal.equals("0")) { - final String attrString = arch.getAttributeString(type.getAttr()[i].getNameOld(), defarch); + final String attrString = gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype); input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (attrString.length() == 0 || attrString.equals("0"))); } else { - input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (arch.getAttributeString(type.getAttr()[i].getNameOld(), defarch).equals(trueVal))); + input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype).equals(trueVal))); } } @@ -717,9 +716,9 @@ newAttr.ref = type.getAttr()[i]; final JTextField input; - // parse value from arch + // parse value from gameObject final int fieldLength = (type.getAttr()[i].getInputLength() == 0 ? textFieldColumns : type.getAttr()[i].getInputLength()); - final int attrval = arch.getAttributeInt(type.getAttr()[i].getNameOld(), defarch); + final int attrval = gameObject.getAttributeInt(type.getAttr()[i].getNameOld(), archetype); if (attrval != 0) { input = new JTextField(String.valueOf(attrval), fieldLength); } else { @@ -762,24 +761,24 @@ newAttr.ref = type.getAttr()[i]; final JTextField input; - // parse String from arch + // parse String from gameObject final String dtxt; if (type.getAttr()[i].getNameOld().equalsIgnoreCase("name")) { - if (arch.getObjName() != null && arch.getObjName().length() > 0) { - dtxt = arch.getObjName(); - } else if (defarch.getObjName() != null && defarch.getObjName().length() > 0) { - dtxt = defarch.getObjName(); + if (gameObject.getObjName() != null && gameObject.getObjName().length() > 0) { + dtxt = gameObject.getObjName(); + } else if (archetype.getObjName() != null && archetype.getObjName().length() > 0) { + dtxt = archetype.getObjName(); } else { - dtxt = defarch.getArchetypeName(); + dtxt = archetype.getArchetypeName(); } } else if (type.getAttr()[i].getNameOld().equalsIgnoreCase("face")) { - if (arch.getFaceName() != null && arch.getFaceName().length() > 0) { - dtxt = arch.getFaceName(); + if (gameObject.getFaceName() != null && gameObject.getFaceName().length() > 0) { + dtxt = gameObject.getFaceName(); } else { - dtxt = defarch.getFaceName(); + dtxt = archetype.getFaceName(); } } else { - dtxt = arch.getAttributeString(type.getAttr()[i].getNameOld(), defarch); + dtxt = gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype); } input = new JTextField(dtxt, textFieldColumns); @@ -896,7 +895,7 @@ // textfield (no direct input, text is set by the treasurelist dialog) final JTextField input; - String treasureName = arch.getAttributeString(type.getAttr()[i].getNameOld(), defarch); + String treasureName = gameObject.getAttributeString(type.getAttr()[i].getNameOld(), archetype); if (treasureName.trim().length() == 0 || treasureName.trim().equalsIgnoreCase("none")) { treasureName = CFTreasureListTree.NONE_SYM; } @@ -1178,9 +1177,9 @@ * @return true if the settings were applied, false if error occurred */ private boolean applySettings() { - final String oldArchText = arch.getObjectText(); // the old ArchText - final String oldMsg = arch.getMsgText(); // old arch msg - final CFArchType typeStruct = typelist.getTypeOfArch(arch); // the type structure for this arch + final String oldArchText = gameObject.getObjectText(); // the old ArchText + final String oldMsg = gameObject.getMsgText(); // old gameObject msg + final CFArchType typeStruct = typelist.getTypeOfArch(gameObject); // the type structure for this gameObject try { String newArchText = ""; @@ -1193,7 +1192,7 @@ if (dType == CFArchAttrib.T_BOOL) { // a boolean attribute (flag) if (((BoolAttrib) attr).input.isSelected() != - (defarch.getAttributeInt(attr.ref.getNameOld(), null) == 1)) { + (archetype.getAttributeInt(attr.ref.getNameOld(), null) == 1)) { newArchText = newArchText + attr.ref.getNameOld() + " " + (((BoolAttrib) attr).input.isSelected() ? 1 : 0) + "\n"; } @@ -1206,31 +1205,31 @@ valString = attr.ref.getMisc()[1]; // false string } // now see if we need to write it into the archtext or not - if ((valString.equals("0") && !(defarch.getAttributeString(attr.ref.getNameOld(), null).length() == 0)) || (!valString.equals("0") && !defarch.getAttributeString(attr.ref.getNameOld(), null).equals(valString))) { + if ((valString.equals("0") && !(archetype.getAttributeString(attr.ref.getNameOld(), null).length() == 0)) || (!valString.equals("0") && !archetype.getAttributeString(attr.ref.getNameOld(), null).equals(valString))) { newArchText = newArchText + attr.ref.getNameOld() + " " + valString + "\n"; } } else if (dType == CFArchAttrib.T_INT || dType == CFArchAttrib.T_FLOAT) { // an int attribute if (dType == CFArchAttrib.T_INT && ((IntAttrib) attr).input.getText().trim().length() == 0) { - if (defarch.getAttributeInt(attr.ref.getNameOld(), null) != 0) { + if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0\n"; } } else if (dType == CFArchAttrib.T_FLOAT && ((FloatAttrib) attr).input.getText().trim().length() == 0) { - if (defarch.getAttributeString(attr.ref.getNameOld(), null).length() > 0) { + if (archetype.getAttributeString(attr.ref.getNameOld(), null).length() > 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0.0\n"; } } else { try { if (dType == CFArchAttrib.T_INT) { final int value = Integer.parseInt(((IntAttrib) attr).input.getText().trim()); - if (defarch.getAttributeInt(attr.ref.getNameOld(), null) != value) { + if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != value) { newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } else { // try to parse floating point final double value = Double.parseDouble(((FloatAttrib) attr).input.getText().trim()); - final String defValueStr = defarch.getAttributeString(attr.ref.getNameOld(), null).trim(); + final String defValueStr = archetype.getAttributeString(attr.ref.getNameOld(), null).trim(); final double defValue; if (defValueStr.length() > 0) { defValue = Double.parseDouble(defValueStr); @@ -1256,27 +1255,27 @@ if (inline != null) { if (attr.ref.getNameOld().equalsIgnoreCase("name")) { // special case #1: "name"-textfield - if (defarch.getObjName() != null && defarch.getObjName().length() > 0) { - if (!inline.equals(defarch.getObjName())) { + if (archetype.getObjName() != null && archetype.getObjName().length() > 0) { + if (!inline.equals(archetype.getObjName())) { newName = inline; } else { newName = ""; } - } else if (!inline.equals(defarch.getArchetypeName())) { + } else if (!inline.equals(archetype.getArchetypeName())) { newName = inline; } else { newName = ""; } } else if (attr.ref.getNameOld().equalsIgnoreCase("face")) { // special case #2: "face"-textfield - if (defarch.getFaceName() != null && defarch.getFaceName().length() > 0 && - !inline.equals(defarch.getFaceName())) { + if (archetype.getFaceName() != null && archetype.getFaceName().length() > 0 && + !inline.equals(archetype.getFaceName())) { newFace = inline; } else { newFace = ""; } } else { - if (!inline.equals(defarch.getAttributeString(attr.ref.getNameOld(), null))) { + if (!inline.equals(archetype.getAttributeString(attr.ref.getNameOld(), null))) { newArchText = newArchText + attr.ref.getNameOld() + " " + inline + "\n"; } } @@ -1289,7 +1288,7 @@ } } else if (dType == CFArchAttrib.T_SPELL || dType == CFArchAttrib.T_ZSPELL || dType == CFArchAttrib.T_LIST) { - // get attribute value that should go into the arch + // get attribute value that should go into the gameObject final int attrVal; // attribute value if (dType == CFArchAttrib.T_SPELL || dType == CFArchAttrib.T_ZSPELL) { attrVal = typelist.getSpellNum()[((ListAttrib) attr).input.getSelectedIndex()]; @@ -1302,19 +1301,19 @@ if (attrVal == -1 || (attrVal == 0 && dType != CFArchAttrib.T_SPELL && dType != CFArchAttrib.T_ZSPELL)) { - if (defarch.getAttributeInt(attr.ref.getNameOld(), null) != 0) { + if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0\n"; } } else if (attrVal == 0) { newArchText = newArchText + attr.ref.getNameOld() + " 0\n"; - } else if (defarch.getAttributeInt(attr.ref.getNameOld(), null) != attrVal) { + } else if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != attrVal) { newArchText = newArchText + attr.ref.getNameOld() + " " + attrVal + "\n"; } } else if (dType == CFArchAttrib.T_BITMASK) { // a bitmask attribute (similar to integer, but easier because no parsing needed) final int value = ((BitmaskAttrib) attr).getValue(); // get bitmask value - if (defarch.getAttributeInt(attr.ref.getNameOld(), null) != value) { + if (archetype.getAttributeInt(attr.ref.getNameOld(), null) != value) { newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } else if (dType == CFArchAttrib.T_TREASURE) { @@ -1325,17 +1324,17 @@ final boolean isNone = inline.equals(CFTreasureListTree.NONE_SYM) || inline.length() == 0; if (!isNone && !CFTreasureListTree.getInstance().containsTreasureList(inline) && - !inline.equalsIgnoreCase(defarch.getAttributeString(attr.ref.getNameOld(), null))) { + !inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld(), null))) { // The user has specified a WRONG treasurelist name, and it does not come - // from the default arch. -> Error and out. + // from the default gameObject. -> Error and out. JOptionPane.showMessageDialog(this, "In attribute '" + attr.ref.getNameNew() + "':\n" + "'" + inline + "' is not a known treasurelist name!", "Input Error", JOptionPane.ERROR_MESSAGE); throw new GridderException(""); // bail out } - if (!inline.equalsIgnoreCase(defarch.getAttributeString(attr.ref.getNameOld(), null)) - && !(isNone && defarch.getAttributeString(attr.ref.getNameOld(), null).length() == 0)) { + if (!inline.equalsIgnoreCase(archetype.getAttributeString(attr.ref.getNameOld(), null)) + && !(isNone && archetype.getAttributeString(attr.ref.getNameOld(), null).length() == 0)) { if (isNone) { newArchText = newArchText + attr.ref.getNameOld() + " none\n"; } else { @@ -1349,13 +1348,13 @@ // Also write all the 'fixed' attributes into the archtext for (int i = 0; type.getAttr().length > i; i++) { if (type.getAttr()[i].getDataType() == CFArchAttrib.T_FIXED) { - final String defaultValue = defarch.getAttributeString(type.getAttr()[i].getNameOld(), null); - if (defaultValue.length() == 0 || (arch.getArchTypNr() != defarch.getArchTypNr() && + final String defaultValue = archetype.getAttributeString(type.getAttr()[i].getNameOld(), null); + if (defaultValue.length() == 0 || (gameObject.getArchTypNr() != archetype.getArchTypNr() && !defaultValue.equalsIgnoreCase(type.getAttr()[i].getNameNew()))) { - // usually, fixed attributes are only applied when *not* defined in the defarch. - // the reason behind this is: if the default arch violates our fixed attribute, - // we assume the default arch is "right" and we are "wrong". The typedefs aren't that trustworthy. - // BUT - if the arch has a changed type, the defarch has lost it's credibility. + // usually, fixed attributes are only applied when *not* defined in the archetype. + // the reason behind this is: if the default gameObject violates our fixed attribute, + // we assume the default gameObject is "right" and we are "wrong". The typedefs aren't that trustworthy. + // BUT - if the gameObject has a changed type, the archetype has lost it's credibility. // So, in this special case, the fixed attribute applies always. newArchText = newArchText + type.getAttr()[i].getNameOld() + " " + type.getAttr()[i].getNameNew() + "\n"; @@ -1365,61 +1364,60 @@ // before we modify the archtext, we look for errors and save them. // later the user must confirm whether to keep or dump those errors - String errors = null; - errors = arch.getSyntaxErrors(typeStruct); + final String errors = gameObject.getSyntaxErrors(typeStruct); - // --- parsing succeeded, now we write it into the arch/map --- - arch.setObjectText(newArchText); - //arch.setArchTypNr(); + // --- parsing succeeded, now we write it into the gameObject/map --- + gameObject.setObjectText(newArchText); + //gameObject.setArchTypNr(); if (newName != null) { if (newName.length() == 0) { - arch.setObjName(null); + gameObject.setObjName(null); } else { - arch.setObjName(newName); + gameObject.setObjName(newName); } } if (newFace != null) { boolean faceChanged = false; // check if face changed - if ((arch.getFaceName() != null && arch.getFaceName().length() > 0 && !newFace.equals(arch.getFaceName())) || (newFace.length() > 0 && (arch.getFaceName() == null || arch.getFaceName().length() == 0))) { + if ((gameObject.getFaceName() != null && gameObject.getFaceName().length() > 0 && !newFace.equals(gameObject.getFaceName())) || (newFace.length() > 0 && (gameObject.getFaceName() == null || gameObject.getFaceName().length() == 0))) { faceChanged = true; } if (newFace.length() == 0) { - arch.setFaceName(null); + gameObject.setFaceName(null); } else { - arch.setFaceName(newFace); + gameObject.setFaceName(newFace); } // now, if neccessary, set new face if (faceChanged) { - if (arch.getFaceName() != null) { + if (gameObject.getFaceName() != null) { // we have a non-default face - final int index = ArchetypeSet.getFaceIndex(arch.getFaceName()); - arch.setFaceNr(index); + final int index = ArchetypeSet.getFaceIndex(gameObject.getFaceName()); + gameObject.setFaceNr(index); } else { // we have the default face - final int index = ArchetypeSet.getFaceIndex(defarch.getFaceName()); - arch.setFaceNr(index); + final int index = ArchetypeSet.getFaceIndex(archetype.getFaceName()); + gameObject.setFaceNr(index); } mainControl.getCurrentMap().repaint(); // repaint map } } if (newMsg != null) { - // set new msg text only when it is not equal to default arch - if (!newMsg.trim().equals(defarch.getMsgText() == null ? "" : defarch.getMsgText().trim())) { - arch.deleteMsgText(); - arch.addMsgText(newMsg); + // set new msg text only when it is not equal to default gameObject + if (!newMsg.trim().equals(archetype.getMsgText() == null ? "" : archetype.getMsgText().trim())) { + gameObject.deleteMsgText(); + gameObject.addMsgText(newMsg); } else { - arch.deleteMsgText(); + gameObject.deleteMsgText(); } - } else if (defarch.getMsgText() != null && defarch.getMsgText().trim().length() > 0) { - // we must override defarch msg by an empty msg - arch.deleteMsgText(); - arch.addMsgText(""); + } else if (archetype.getMsgText() != null && archetype.getMsgText().trim().length() > 0) { + // we must override archetype msg by an empty msg + gameObject.deleteMsgText(); + gameObject.addMsgText(""); } else { - arch.deleteMsgText(); // all empty + gameObject.deleteMsgText(); // all empty } // deal with syntax errors now @@ -1427,7 +1425,7 @@ if (typeStruct == typelist.getHead().getNext()) { // for generic (misc) type, all errors are automatically kept. // "misc" is no real type - it is more a default mask for unknown types - arch.addArchText(errors.trim() + "\n"); + gameObject.addArchText(errors.trim() + "\n"); } else { // open a popup dialog and ask user to decide what to do with his errors askConfirmErrors(errors); @@ -1435,15 +1433,15 @@ } // if the archtext changed, set the map changed flag - if ((oldArchText != null && !oldArchText.equals(arch.getObjectText())) || - (oldArchText == null && arch.getObjectText() != null) || - (oldMsg != null && !oldMsg.equals(arch.getMsgText())) || - (oldMsg == null && arch.getMsgText() != null)) { + if ((oldArchText != null && !oldArchText.equals(gameObject.getObjectText())) || + (oldArchText == null && gameObject.getObjectText() != null) || + (oldMsg != null && !oldMsg.equals(gameObject.getMsgText())) || + (oldMsg == null && gameObject.getMsgText() != null)) { mainControl.getCurrentMap().setLevelChangedFlag(); } // recalculate the editType value - arch.calculateEditType(mainControl.getCurrentMap().getActiveEditType()); + gameObject.calculateEditType(mainControl.getCurrentMap().getActiveEditType()); mainControl.getMainView().refreshMapArchPanel(); return true; // apply succeeded @@ -1496,7 +1494,7 @@ buttonPanel.add(keepButton); // attach actionlistener to the buttons (and the frame) - final ConfirmErrorsAL listener = new ConfirmErrorsAL(frame, arch, errors, keepButton, textarea); + final ConfirmErrorsAL listener = new ConfirmErrorsAL(frame, gameObject, errors, keepButton, textarea); keepButton.addActionListener(listener); dumpButton.addActionListener(listener); frame.addWindowListener(listener); @@ -1517,7 +1515,7 @@ frame.setVisible(true); } - /** close this dialog frame */ + /** Close this dialog frame. */ private void closeDialog() { // if a treasurelist window is attached to this dialog, hide it if (CFTreasureListTree.getParentDialog() == this) { @@ -1530,14 +1528,14 @@ } - /** This (Sub)Class contains the data of one arch attribute. */ - public class DialogAttrib { + /** A single Attribute, combining the CFArchAttrib with its input component(s). */ + private static class DialogAttrib { - public CFArchAttrib ref; // reference to the attribute data + CFArchAttrib ref; // reference to the attribute data - public DialogAttrib next; // next element in the list + DialogAttrib next; // next element in the list - public JButton helpButton; // help button + JButton helpButton; // help button /** Constructor */ DialogAttrib() { @@ -1550,56 +1548,56 @@ /** This (Sub)Class implements the dialog attribute of type BOOL. */ - public final class BoolAttrib extends DialogAttrib { + private static final class BoolAttrib extends DialogAttrib { - public JCheckBox input; // the input means of bool is a checkbox - } + JCheckBox input; // the input means of bool is a checkbox + } // class BoolAttrib /** This (Sub)Class implements the dialog attribute of type INT. */ - public final class IntAttrib extends DialogAttrib { + private static final class IntAttrib extends DialogAttrib { - public JTextField input; // the input means of int is a textfield - } + JTextField input; // the input means of int is a textfield + } // class IntAttrib /** This (Sub)Class implements the dialog attribute of type FLOAT. */ - public final class FloatAttrib extends DialogAttrib { + private static final class FloatAttrib extends DialogAttrib { - public JTextField input; // the input means of int is a textfield - } + JTextField input; // the input means of int is a textfield + } // class FloatAttrib /** This (Sub)Class implements the dialog attribute of type STRING. */ - public final class StringAttrib extends DialogAttrib { + private static final class StringAttrib extends DialogAttrib { - public JTextField input; // the input means of string is a textfield - } + JTextField input; // the input means of string is a textfield + } // class StringAttrib /** This (Sub)Class implements the dialog attribute of type TEXT. */ - public final class TextAttrib extends DialogAttrib { + private static final class TextAttrib extends DialogAttrib { - public JTextArea input; // the input means of text is a textarea - } + JTextArea input; // the input means of text is a textarea + } // class TextAttrib /** * This (Sub)Class implements the dialog attribute of types with * selection lists (ComboBoxes) to choose from. */ - public final class ListAttrib extends DialogAttrib { + private static final class ListAttrib extends DialogAttrib { - public JComboBox input; // the input means of spell is a combo box + JComboBox input; // the input means of spell is a combo box } /** DialogAttrib for types with bitmasks to choose from. */ - public final class BitmaskAttrib extends DialogAttrib { + static final class BitmaskAttrib extends DialogAttrib { - public JTextArea text; // the display component for bitmask-contents + JTextArea text; // the display component for bitmask-contents - public int value; // the active bitmask value + int value; // the active bitmask value private CAttribBitmask bitmask; // reference to the bitmask data @@ -1622,17 +1620,14 @@ /** * Constructor. - * @param a the arch attribute where this help button belongs to + * @param a the gameObject attribute where this help button belongs to */ public HelpAL(final CFArchAttrib a) { attrib = a; } - /** - * help button was pressed - * @param event the occured <code>ActionEvent</code> (button pressed) - */ - public void actionPerformed(final ActionEvent event) { + /** {@inheritDoc} */ + public void actionPerformed(final ActionEvent e) { if (attrib != null) { popupHelp(attrib.getNameNew(), attrib.getText()); } @@ -1657,11 +1652,8 @@ dialog = newDialog; } - /** - * help button was pressed - * @param event the occured <code>ActionEvent</code> (button pressed) - */ - public void actionPerformed(final ActionEvent event) { + /** {@inheritDoc} */ + public void actionPerformed(final ActionEvent e) { if (bmAttr != null) { bmAttr.bitmask.popupFrame(dialog, bmAttr); } @@ -1689,11 +1681,8 @@ this.dialog = dialog; } - /** - * treasurelist button was pressed - * @param event the occured <code>ActionEvent</code> (button pressed) - */ - public void actionPerformed(final ActionEvent event) { + /** {@inheritDoc} */ + public void actionPerformed(final ActionEvent e) { if (strAttr != null) { CFTreasureListTree.getInstance().showDialog(strAttr.input, dialog); } @@ -1715,14 +1704,14 @@ final JTextArea text; // textfield containing the error-text to keep - final GameObject arch; // the according arch + final GameObject arch; // the according gameObject final String allErrors; // list of all errors /** * Constructor. * @param dl the popup dialog - * @param archNew the arch which has the error to be added + * @param archNew the gameObject which has the error to be added * @param errors list of all errors (= initial content of the textarea) * @param keepB button "keep what is in the textfield" * @param textNew textfield containing the error-text to keep @@ -1735,12 +1724,9 @@ allErrors = errors; } - /** - * a button was pressed - * @param event the occured <code>ActionEvent</code> (button pressed) - */ - public void actionPerformed(final ActionEvent event) { - if (event.getSource() == keepButton) { + /** {@inheritDoc} */ + public void actionPerformed(final ActionEvent e) { + if (e.getSource() == keepButton) { // the user pressed "keep", so we append the contents // of the textfield to the archtext if (text.getText() != null && text.getText().trim().length() > 0) { @@ -1754,12 +1740,11 @@ } /** - * user wants to kill the window via closebox - - * in this case, we keep all errors in the arch because it must + * {@inheritDoc} + * In this case, we keep all errors in the gameObject because it must * be assumed that the user did not properly think about them yet. - * @param event the occured <code>WindowEvent</code> */ - public void windowClosing(final WindowEvent event) { + public void windowClosing(final WindowEvent e) { arch.addArchText(allErrors.trim() + "\n"); // nuke the popup dialog @@ -1767,22 +1752,28 @@ dialog = null; } - public void windowDeactivated(final WindowEvent event) { + /** {@inheritDoc} */ + public void windowDeactivated(final WindowEvent e) { } - public void windowActivated(final WindowEvent event) { + /** {@inheritDoc} */ + public void windowActivated(final WindowEvent e) { } - public void windowClosed(final WindowEvent event) { + /** {@inheritDoc} */ + public void windowClosed(final WindowEvent e) { } - public void windowOpened(final WindowEvent event) { + /** {@inheritDoc} */ + public void windowOpened(final WindowEvent e) { } - public void windowIconified(final WindowEvent event) { + /** {@inheritDoc} */ + public void windowIconified(final WindowEvent e) { } - public void windowDeiconified(final WindowEvent event) { + /** {@inheritDoc} */ + public void windowDeiconified(final WindowEvent e) { } } // class ConfirmErrorsAL @@ -1793,9 +1784,9 @@ final CAttribDialog frame; // the entire frame - final GameObject arch; // the according arch + final GameObject arch; // the according gameObject - final GameObject defarch; // default arch of 'arch' + final GameObject defarch; // default gameObject of 'gameObject' String deselected; // the latest deselected item @@ -1804,8 +1795,8 @@ /** * Constructor. * @param frameNew the attribute-dialog mainframe - * @param archNew the arch which has the error to be added - * @param defarchNew the default arch of 'arch' + * @param archNew the gameObject which has the error to be added + * @param defarchNew the default gameObject of 'gameObject' */ public TypesBoxAL(final CAttribDialog frameNew, final GameObject archNew, final GameObject defarchNew) { frame = frameNew; @@ -1814,22 +1805,19 @@ ignoreEvent = false; } - /** - * a (new) type has been selected in the box - * @param event the occured <code>ItemEvent</code> (button pressed) - */ - public void itemStateChanged(final ItemEvent event) { + /** {@inheritDoc} */ + public void itemStateChanged(final ItemEvent e) { if (ignoreEvent) { return; } - if (event.getStateChange() == ItemEvent.DESELECTED) { + if (e.getStateChange() == ItemEvent.DESELECTED) { // remember the deselected type - deselected = ((String) event.getItem()).trim(); - } else if (event.getStateChange() == ItemEvent.SELECTED && !event.getItem().equals(deselected)) { + deselected = ((String) e.getItem()).trim(); + } else if (e.getStateChange() == ItemEvent.SELECTED && !e.getItem().equals(deselected)) { // new type was selected // first, get new type structure - final CFArchType newType = typelist.getTypeByName((String) event.getItem()); + final CFArchType newType = typelist.getTypeByName((String) e.getItem()); frame.typesel.hidePopup(); frame.update(frame.getGraphics()); @@ -1842,7 +1830,7 @@ // change is confirmed, now get it on... frame.type = newType; // set new type structure - // change the arch to be of the new type: + // change the gameObject to be of the new type: arch.setArchTypNr(newType.getTypeNr()); attrHead = null; // clear list of attributes @@ -1856,7 +1844,7 @@ // recalculate the editType value arch.calculateEditType(mainControl.getCurrentMap().getActiveEditType()); - // also update the arch panel (bottom) + // also update the gameObject panel (bottom) mainControl.getMainView().refreshMapArchPanel(); // map content has changed mainControl.getCurrentMap().setLevelChangedFlag(); @@ -1883,13 +1871,14 @@ private static final class StringKeyManager implements JComboBox.KeySelectionManager { /** JComboBox reference. */ - final JComboBox box; + private final JComboBox box; public StringKeyManager(final JComboBox myBox) { box = myBox; } - /* + /** + * {@inheritDoc} * For any key, we select the first entry with * identical first character (after ' ') */ Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-10-01 16:03:13 UTC (rev 436) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-10-01 16:44:08 UTC (rev 437) @@ -136,15 +136,15 @@ private JComboBox typesel; // selection box for type - private JTextField nameTF; // textfield for arch name + private JTextField nameTF; // textfield for gameObject name - private JTextField defarchTF; // textfield for name of default arch + private JTextField defarchTF; // textfield for name of default gameObject private JLabel imagePanel; // panel for object's face (png) - private final GameObject arch; + private final GameObject gameObject; - private final GameObject defarch; + private final GameObject archetype; private CFArchType type; // reference to the type data @@ -178,28 +178,28 @@ /** Text pane where the summary is displayed. */ private final JTextPane summaryTP; - /** The arch objects that already are shown, to avoid opening a dialog twice. */ + /** The gameObject objects that already are shown, to avoid opening a dialog twice. */ private static final Map<GameObject, JDialog> dialogs = new HashMap<GameObject, JDialog>(); /** * Wrapper method for the constructor. - * This method only creates a CAttribDialog if there's no dialog for the same arch already. + * This method only creates a CAttribDialog if there's no dialog for the same gameObject already. * @param atList the list of CF type-data - * @param aobj the GameObject to be displayed by this dialog + * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control */ - public static void showAttribDialog(final CFArchTypeList atList, final GameObject aobj, final CMainControl mainControl) { + public static void showAttribDialog(final CFArchTypeList atList, final GameObject gameObject, final CMainControl mainControl) { synchronized (dialogs) { - if (dialogs.containsKey(aobj)) { - dialogs.get(aobj).toFront(); + if (dialogs.containsKey(gameObject)) { + dialogs.get(gameObject).toFront(); } else { - final CAttribDialog pane = new CAttribDialog(atList, aobj, mainControl); - final JDialog dialog = pane.createDialog(mainControl.getMainView(), "Dummy arch attributes"); + final CAttribDialog pane = new CAttribDialog(atList, gameObject, mainControl); + final JDialog dialog = pane.createDialog(mainControl.getMainView(), "Dummy gameObject attributes"); dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); dialog.setModal(false); dialog.setVisible(true); - dialogs.put(pane.arch, dialog); + dialogs.put(pane.gameObject, dialog); } } } @@ -207,18 +207,18 @@ /** * Constructor, creates the GUI layout. * @param atList the list of CF type-data - * @param aobj the GameObject to be displayed by this dialog + * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control */ - private CAttribDialog(final CFArchTypeList atList, final GameObject aobj, final CMainControl mainControl) { + private CAttribDialog(final CFArchTypeList atList, final GameObject gameObject, final CMainControl mainControl) { listNr = 0; this.mainControl = mainControl; // reference to the main control typelist = atList; // reference to the typelist // reference to the GameObject - arch = aobj.getHead(); - defarch = arch.getArchetype(); + this.gameObject = gameObject.getHead(); + archetype = this.gameObject.getArchetype(); // check if the type of the object is present in the definitions //typeNr = 0; // for invalid types, we take "type 0" @@ -228,7 +228,7 @@ if (typeFound) { break; } - if (tmp.getTypeNr() == arch.getArchTypNr()) { + if (tmp.getTypeNr() == this.gameObject.getArchTypNr()) { if (tmp.getTypeAttr() == null) { // no type-attributes, so we only compared type-numbers typeFound = true; @@ -240,7 +240,7 @@ //System.err.println("# type: "+tmp.getTypeName()); for (int t = 0, l = numArgs << 1; t < l; t += 2) { - final String archvalue = arch.getAttributeString(tmp.getTypeAttr()[t], true); + final String archvalue = this.gameObject.getAttributeString(tmp.getTypeAttr()[t], true); //System.err.println(" arch: '"+archvalue+"', type: '"+tmp.getTypeAttr()[t+1]+"'"); @@ -313,7 +313,7 @@ @Override public void setValue(final Object newValue) { super.setValue(newValue); if (newValue != UNINITIALIZED_VALUE) { - dialogs.remove(arch).dispose(); + dialogs.remove(gameObject).dispose(); } } @@ -341,7 +341,7 @@ typesel.setName("Types"); // the listener: - typesel.addItemListener(new TypesBoxAL(this, arch)); + typesel.addItemListener(new TypesBoxAL(this, gameObject)); return typesel; } @@ -352,8 +352,8 @@ */ private JComboBox buildSpellBox(final CFArchAttrib attr) { - // first parse the spell-number value from arch - int spnum = arch.getAttributeInt(attr.getNameOld(), true); // spell number + // first parse the spell-number value from gameObject + int spnum = gameObject.getAttributeInt(attr.getNameOld(), true); // spell number if (spnum < 0 || spnum >= CFArchTypeList.getSpells().getSpellNumbers().length - 1) { spnum = 0; // undefined spellnumbers be zero @@ -361,7 +361,7 @@ // do we have "none" spell? final int active; - if (spnum == 0 && (arch.getAttributeString(attr.getNameOld(), true).length() == 0 || attr.getDataType() == ZSPELL)) { + if (spnum == 0 && (gameObject.getAttributeString(attr.getNameOld(), true).length() == 0 || attr.getDataType() == ZSPELL)) { active = 0; } else { // now look up the spell-number in the array of spells @@ -389,7 +389,7 @@ // build the array of list-items final String[] array = new String[(int) (listData.size() / 2.0)]; boolean hasSelection = false; - int active = arch.getAttributeInt(attr.getNameOld(), true); + int active = gameObject.getAttributeInt(attr.getNameOld(), true); for (int i = 0; i < array.length; i++) { array[i] = (String) listData.get((i << 1) + 1); // put string to array @@ -415,7 +415,7 @@ /** * Construct the upper left part of the attribute dialog, - * containing name, type, defarch name and face. + * containing name, type, archetype name and face. * @return a <code>JScrollPane</code> with the upper left part of the dialog window */ private JComponent buildHeader() { @@ -428,7 +428,7 @@ gbc.weightx = 0.0; gbc.weighty = 3.0; gbc.gridheight = 3; - imagePanel = new JLabel(mainControl.getArchObjectStack().getFace(arch.getFaceObjName())); + imagePanel = new JLabel(mainControl.getArchObjectStack().getFace(gameObject.getFaceObjName())); imagePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); header.add(imagePanel, gbc); gbc.gridheight = 1; @@ -442,25 +442,25 @@ gbc.gridy++; header.add(new JLabel("Type: ", TRAILING), gbc); gbc.gridy++; - header.add(new JLabel("Default Arch: ", TRAILING), gbc); // create label + header.add(new JLabel("Archetype: ", TRAILING), gbc); // create label gbc.gridx = 3; gbc.gridy = 1; gbc.weightx = 1.0; - if (arch.getObjName() != null && arch.getObjName().length() > 0) { - nameTF = new JTextField(arch.getObjName(), 16); - } else if (defarch.getObjName() != null && defarch.getObjName().length() > 0) { - nameTF = new JTextField(defarch.getObjName(), 16); + if (gameObject.getObjName() != null && gameObject.getObjName().length() > 0) { + nameTF = new JTextField(gameObject.getObjName(), 16); + } else if (archetype.getObjName() != null && archetype.getObjName().length() > 0) { + nameTF = new JTextField(archetype.getObjName(), 16); } else { - nameTF = new JTextField(defarch.getArchetypeName(), 16); + nameTF = new JTextField(archetype.getArchetypeName(), 16); } nameTF.setEditable(false); header.add(nameTF, gbc); gbc.gridy++; header.add(buildTypesBox(), gbc); // build type-selection box gbc.gridy++; - defarchTF = new JTextField(defarch.getArchetypeName(), 16); + defarchTF = new JTextField(archetype.getArchetypeName(), 16); defarchTF.setEditable(false); header.add(defarchTF, gbc); @@ -487,7 +487,7 @@ /** * Construct the central part of the attribute dialog, containing the - * object's arch attributes. + * object's gameObject attributes. * @return When this method is called the first time: a <code>JScrollPane</code> * with the central part of the dialog window. * All further calls rebuild the existing tabbedpane and return null. @@ -591,11 +591,11 @@ newAttr = new DialogAttrib<JTextArea>(attrib); String text = ""; if ("msg".equalsIgnoreCase(nameOld)) { - if (defarch.getMsgText() != null && defarch.getMsgText().length() > 0 && (arch.getMsgText() == null || arch.getMsgText().trim().length() == 0)) + if (archetype.getMsgText() != null && archetype.getMsgText().length() > 0 && (gameObject.getMsgText() == null || gameObject.getMsgText().trim().length() == 0)) { - text = defarch.getMsgText(); + text = archetype.getMsgText(); } else { - text = arch.getMsgText(); + text = gameObject.getMsgText(); } } final JTextArea input = new JTextArea(text, 10, 20); @@ -614,16 +614,16 @@ final JCheckBox input; if (dType == BOOL) { // normal bool - input = new JCheckBox(attrib.getNameNew(), arch.getAttributeInt(nameOld, true) == 1); + input = new JCheckBox(attrib.getNameNew(), gameObject.getAttributeInt(nameOld, true) == 1); } else { assert dType == BOOL_SPEC; // parse values for customized bool final String trueVal = attrib.getMisc()[0]; if ("0".equals(trueVal)) { - final String attrString = arch.getAttributeString(nameOld, true); + final String attrString = gameObject.getAttributeString(nameOld, true); input = new JCheckBox(attrib.getNameNew(), attrString.length() == 0 || "0".equals(attrString)); } else { - input = new JCheckBox(attrib.getNameNew(), arch.getAttributeString(nameOld, true).equals(trueVal)); + input = new JCheckBox(attrib.getNameNew(), gameObject.getAttributeString(nameOld, true).equals(trueVal)); } } ((DialogAttrib<JCheckBox>) newAttr).input = input; @@ -647,17 +647,17 @@ format.setGroupingUsed(false); final NumberFormatter formatter = new NumberFormatter(format); final DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter); - // parse value from arch + // parse value from gameObject Number value = null; switch (dType) { case INT: - value = arch.getAttributeInt(nameOld, true); + value = gameObject.getAttributeInt(nameOld, true); break; case LONG: - value = arch.getAttributeLong(nameOld, true); + value = gameObject.getAttributeLong(nameOld, true); break; case FLOAT: - value = arch.getAttributeDouble(nameOld, true); + value = gameObject.getAttributeDouble(nameOld, true); break; } final JFormattedTextField input = new JFormattedTextField(factory, value); @@ -671,21 +671,21 @@ case ANIMNAME: { final String dtxt; if ("name".equalsIgnoreCase(nameOld)) { - if (arch.getObjName() != null && arch.getObjName().length() > 0) { - dtxt = arch.getObjN... [truncated message content] |
From: <chr...@us...> - 2006-10-01 16:03:34
|
Revision: 436 http://svn.sourceforge.net/gridarta/?rev=436&view=rev Author: christianhujer Date: 2006-10-01 09:03:13 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Cosmetic improvements. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/CUndoStack.java trunk/src/app/net/sf/gridarta/CommonConstants.java trunk/src/app/net/sf/gridarta/Size2D.java Modified: trunk/src/app/net/sf/gridarta/CUndoStack.java =================================================================== --- trunk/src/app/net/sf/gridarta/CUndoStack.java 2006-10-01 08:36:39 UTC (rev 435) +++ trunk/src/app/net/sf/gridarta/CUndoStack.java 2006-10-01 16:03:13 UTC (rev 436) @@ -117,12 +117,8 @@ * undone, <code>false</code> if not */ public boolean canUndo() { - if (undoStack.size() > 0) { - final Undoable op = undoStack.get(undoStack.size() - 1); - return op.isUndoable(); - } + return undoStack.size() > 0 && undoStack.get(undoStack.size() - 1).isUndoable(); - return false; } /** @@ -130,12 +126,7 @@ * @return the name of the last operation in the undo stack */ public String getUndoName() { - if (canUndo()) { - final Undoable op = undoStack.get(undoStack.size() - 1); - return op.getName(); - } - - return ""; + return canUndo() ? undoStack.get(undoStack.size() - 1).getName() : ""; } /** Undoes the last operation in the undo stack. */ @@ -158,12 +149,8 @@ * redone, <code>false</code> if not */ public boolean canRedo() { - if (redoStack.size() > 0) { - final Undoable op = redoStack.get(redoStack.size() - 1); - return op.isRedoable(); - } + return redoStack.size() > 0 && redoStack.get(redoStack.size() - 1).isRedoable(); - return false; } /** @@ -171,12 +158,7 @@ * @return the name of the last operation in the redo stack */ public String getRedoName() { - if (canRedo()) { - final Undoable op = redoStack.get(redoStack.size() - 1); - return op.getName(); - } - - return ""; + return canRedo() ? redoStack.get(redoStack.size() - 1).getName() : ""; } /** Redoes the last operation in the redo stack. */ Modified: trunk/src/app/net/sf/gridarta/CommonConstants.java =================================================================== --- trunk/src/app/net/sf/gridarta/CommonConstants.java 2006-10-01 08:36:39 UTC (rev 435) +++ trunk/src/app/net/sf/gridarta/CommonConstants.java 2006-10-01 16:03:13 UTC (rev 436) @@ -36,5 +36,7 @@ /** The directory that contains all (html) help files. */ String HELP_DIR = "resource" + separator + "HelpFiles"; - String PYTHONMENU_FILE = "cfpython_menu.def"; // python menu definitions + /** Python menu definitions. */ + String PYTHONMENU_FILE = "cfpython_menu.def"; + } // interface CommonConstants Modified: trunk/src/app/net/sf/gridarta/Size2D.java =================================================================== --- trunk/src/app/net/sf/gridarta/Size2D.java 2006-10-01 08:36:39 UTC (rev 435) +++ trunk/src/app/net/sf/gridarta/Size2D.java 2006-10-01 16:03:13 UTC (rev 436) @@ -39,6 +39,7 @@ * The width of the area. * It is always greater than zero. * @invariant width > 0 + * @serial include */ private final int width; @@ -46,6 +47,7 @@ * The height of the area. * It is always greater than zero. * @invariant height > 0 + * @serial include */ private final int height; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-10-01 08:47:08
|
Revision: 435 http://svn.sourceforge.net/gridarta/?rev=435&view=rev Author: akirschbaum Date: 2006-10-01 01:36:39 -0700 (Sun, 01 Oct 2006) Log Message: ----------- Unify comments and variable names. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchType.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFArchType.java trunk/daimonin/src/daieditor/CFArchTypeList.java trunk/daimonin/src/daieditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CPickmapPanel.java trunk/daimonin/src/daieditor/CopyBuffer.java trunk/daimonin/src/daieditor/ReplaceDialog.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-10-01 08:36:39 UTC (rev 435) @@ -150,7 +150,6 @@ mainControl.showArchPanelQuickObject(arch); // send it to quick view } - /** * Add this arch to list of (this) Jlist list. * @param archname name of the arch to add Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-10-01 08:36:39 UTC (rev 435) @@ -1529,7 +1529,6 @@ dispose(); } - // ============================ Subclasses ============================ /** This (Sub)Class contains the data of one arch attribute. */ public class DialogAttrib { @@ -1549,36 +1548,42 @@ } // class DialogAttrib + /** This (Sub)Class implements the dialog attribute of type BOOL. */ public final class BoolAttrib extends DialogAttrib { public JCheckBox input; // the input means of bool is a checkbox } + /** This (Sub)Class implements the dialog attribute of type INT. */ public final class IntAttrib extends DialogAttrib { public JTextField input; // the input means of int is a textfield } + /** This (Sub)Class implements the dialog attribute of type FLOAT. */ public final class FloatAttrib extends DialogAttrib { public JTextField input; // the input means of int is a textfield } + /** This (Sub)Class implements the dialog attribute of type STRING. */ public final class StringAttrib extends DialogAttrib { public JTextField input; // the input means of string is a textfield } + /** This (Sub)Class implements the dialog attribute of type TEXT. */ public final class TextAttrib extends DialogAttrib { public JTextArea input; // the input means of text is a textarea } + /** * This (Sub)Class implements the dialog attribute of types with * selection lists (ComboBoxes) to choose from. @@ -1588,10 +1593,8 @@ public JComboBox input; // the input means of spell is a combo box } - /** - * This (Sub)Class implements the dialog attribute of types with - * bitmasks to choose from. - */ + + /** DialogAttrib for types with bitmasks to choose from. */ public final class BitmaskAttrib extends DialogAttrib { public JTextArea text; // the display component for bitmask-contents @@ -1610,13 +1613,15 @@ } // class BitmaskAttrib - /** ActionListener for help-buttons */ + + /** ActionListener for help-buttons. */ private class HelpAL implements ActionListener { + /** CFArchAttrib which contains help information. */ CFArchAttrib attrib; // attribute structure /** - * construktor + * Constructor. * @param a the arch attribute where this help button belongs to */ public HelpAL(final CFArchAttrib a) { @@ -1635,6 +1640,7 @@ } // class HelpAL + /** ActionListener for the change buttons of bitmasks. */ public final class MaskChangeAL implements ActionListener { @@ -1663,6 +1669,7 @@ } // class MaskChangeAL + /** * ActionListener for the buttons on treasurelists. When such a button is * pressed, the dialog with treasurelists pops up. @@ -1694,6 +1701,7 @@ } // class ViewTreasurelistAL + /** * ActionListener for the buttons in the ConfirmErrors popup dialog and * also WindowListener for the closebox of the dialog (which would equal a @@ -1779,6 +1787,7 @@ } // class ConfirmErrorsAL + /** ItemListener for the type-selection box on the attribute-dialog. */ private class TypesBoxAL implements ItemListener { @@ -1862,6 +1871,7 @@ } // class TypesBoxAL + /** * KeySelectionManager to manage the select-per-keystroke in a JComboBox * (The default KeySelectionManager fails because all strings start with Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-10-01 08:36:39 UTC (rev 435) @@ -97,7 +97,7 @@ /** * Constructor. - * @param defaultArchType the head element of the list + * @param defaultArchType default archetype */ public CFArchType(final CFArchType defaultArchType) { next = null; Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-10-01 08:36:39 UTC (rev 435) @@ -211,7 +211,7 @@ /** * Parse a list vector from an xml list element. - * @param root + * @param root element to parse */ private Vector parseListFromElement(final Element root) { final Vector list = new Vector(); // list vector @@ -236,7 +236,6 @@ } } } - return list; } @@ -265,6 +264,10 @@ return spellNum; } + /** + * Return the bitmask table which contains all definitions of bitmask types for arch attributes. + * @return bitmask table + */ public Map<String, CAttribBitmask> getBitmaskTable() { return bitmaskTable; } @@ -273,6 +276,10 @@ return listTable; } + /** + * Return the ignore list table which contains all definitions of ignore lists for arch attributes. + * @return ignore list table + */ public Map<String, Vector<String>> getIgnoreListTable() { return ignoreListTable; } Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-10-01 08:36:39 UTC (rev 435) @@ -86,7 +86,7 @@ private Hashtable<String, TreasureTreeNode> specialTreasureLists = null; // all syntax-errors encountered during datafile-parsing get written in this log - private StringBuffer errorLog = null; + private final StringBuffer errorLog = new StringBuffer(); private Vector<TreasureTreeNode> needSecondLink; @@ -125,7 +125,6 @@ isEmpty = true; // three is empty hasBeenDisplayed = false; tListCount = 0; - errorLog = new StringBuffer(""); parentDialog = null; // draw thin blue lines connecting the nodes @@ -371,7 +370,7 @@ } } - final double corrector = 100. / sumChances; // corrector value + final double corrector = 100.0 / sumChances; // now apply the correcting factor to all chances for (Enumeration clist = listNode.children(); clist != null && clist.hasMoreElements();) { @@ -724,7 +723,6 @@ /** Construct tree node with specified content object */ public TreasureTreeNode(final TreasureObj content) { - super(); this.content = content; } @@ -734,7 +732,6 @@ * @param type type of content object (see TreasureObj constants) */ public TreasureTreeNode(final String name, final int type) { - super(); this.content = new TreasureObj(name, type); } @@ -1008,7 +1005,7 @@ } } else { // parent is not root - final TreasureTreeNode parent = (TreasureTreeNode) (node.getParent()); + final TreasureTreeNode parent = (TreasureTreeNode) node.getParent(); if (parent.getTreasureObj().getType() == TreasureObj.FOLDER) { setFont(bold); } Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-10-01 08:36:39 UTC (rev 435) @@ -178,7 +178,7 @@ //private boolean isoMapViewDefault; private String imageSet; // Name of used Image Set (null = none) - private boolean loadFromarchive = true; // do we load arches from the collected archives? + private boolean loadFromArchive = true; // do we load arches from the collected archives? private boolean autoPopupDocu = false; // time for an automated docu popup? @@ -191,10 +191,10 @@ private final CopyBuffer copybuffer = new CopyBuffer(this); // head of linked list, containing the autojoin data - private AutojoinList joinlist = null; + private AutojoinList joinList = null; // the list of archtype-data (loaded from "types.txt") - private CFArchTypeList typelist = null; + private CFArchTypeList typeList = null; // pickmaps cannot be edited while lockedPickmaps is true private boolean pickmapsLocked = false; @@ -281,8 +281,8 @@ //loadTypeDef(); // load the list with archtype-data from "types.txt" - typelist = new CFArchTypeList(); - GameObject.setTypeList(typelist); // set reference in GameObject + typeList = new CFArchTypeList(); + GameObject.setTypeList(typeList); // set reference in GameObject // now collect all arch you can find in the arch path!! System.gc(); @@ -290,14 +290,14 @@ } /** - * Loading the joinlist from file and attaching all to 'joinlist'. + * Loading the joinList from file and attaching all to 'joinlist'. * (This method must not be called before all arches are loaded * into the ArchetypeSet 'archList'!) */ public void loadJoinlist() { - joinlist = new AutojoinList(); - if (!joinlist.loadList(archList)) { - joinlist = null; + joinList = new AutojoinList(); + if (!joinList.loadList(archList)) { + joinList = null; } } @@ -473,7 +473,7 @@ imageSet = null; } - loadFromarchive = new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(LOAD_ARCH_COLL, "true")).booleanValue(); + loadFromArchive = new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(LOAD_ARCH_COLL, "true")).booleanValue(); this.getMainView().setMapTileListBottom(new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(CMainView.MAPTILE_BOTTOM_KEY, "false")).booleanValue()); @@ -531,7 +531,7 @@ } public boolean isArchLoadedFromCollection() { - return loadFromarchive; + return loadFromArchive; } public boolean isPickmapsLocked() { @@ -720,11 +720,9 @@ /** * Begins the editing of a new Map. - * @param objects the list of map objects, or <code>null</code> for new empty - * maps + * @param objects the list of map objects, or <code>null</code> for new empty maps * @param maparch map arch - * @param initial the view position to show initially; null=show top - * left corner + * @param initial the view position to show initially; null=show top left corner * @return map control of new map */ public MapControl newLevel(final List<GameObject> objects, final MapArchObject maparch, final Point initial) { @@ -733,13 +731,10 @@ /** * Begins the editing of a new Map. - * @param objects the list of map objects, or <code>null</code> for new empty - * maps + * @param objects the list of map objects, or <code>null</code> for new empty maps * @param maparch map arch - * @param show if true, map is added to main view. - * Set to false to load silently - * @param initial the view position to show initially; null=show top - * left corner + * @param show if true, map is added to main view. Set to false to load silently + * @param initial the view position to show initially; null=show top left corner * @return map control of new map */ public MapControl newLevel(final List<GameObject> objects, final MapArchObject maparch, final boolean show, final Point initial) { @@ -1014,11 +1009,11 @@ * @param arch attr. window is opened for this arch */ public void openAttrDialog(final GameObject arch) { - if (typelist.isEmpty()) { + if (typeList.isEmpty()) { // types.txt is missing! showMessage("File Missing", "The definitions-file \"types.txt\" is missing! The\nattribute interface doesn't work without that file."); } else if (arch != null && arch.getArchetypeName() != null) { - final CAttribDialog dwin = new CAttribDialog(typelist, arch, this); + final CAttribDialog dwin = new CAttribDialog(typeList, arch, this); } } @@ -1315,7 +1310,9 @@ System.exit(0); } - /** Try to load the map where the selected map-exit points to. */ + /** + * Try to load the map where the selected map-exit points to. + */ public void enterExitWanted() { final GameObject exit = currentMap.getMapModel().getExit(); if (exit == null) { @@ -1596,7 +1593,7 @@ return false; } - /** "Clear" was selected from the Edit menu */ + /** "Clear" was selected from the Edit menu. */ public void clearWanted() { if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... @@ -1605,7 +1602,7 @@ copybuffer.clear(currentMap); } - /** "Cut" was selected from the Edit menu */ + /** "Cut" was selected from the Edit menu. */ public void cutWanted() { if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... @@ -1614,7 +1611,7 @@ copybuffer.cut(currentMap); } - /** "Copy" was selected from the Edit menu */ + /** "Copy" was selected from the Edit menu. */ public void copyWanted() { if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... @@ -1623,7 +1620,7 @@ copybuffer.copy(currentMap); } - /** "Paste" was selected from the Edit menu */ + /** "Paste" was selected from the Edit menu. */ public void pasteWanted() { if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... @@ -1633,7 +1630,7 @@ } /** - * "Fill" was selected from the Edit menu + * "Fill" was selected from the Edit menu. * @param fillBelow true if "Fill Below" was activated, false if "Fill Above" */ public void fillWanted(final boolean fillBelow) { @@ -1644,7 +1641,7 @@ copybuffer.fill(currentMap, fillBelow); } - /** "Replace" was selected from the Edit menu */ + /** "Replace" was selected from the Edit menu. */ public void replaceWanted() { if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... @@ -1859,11 +1856,11 @@ } public CFArchTypeList getTypelist() { - return typelist; + return typeList; } public AutojoinList getJoinlist() { - return joinlist; + return joinList; } public CMapFileDecode getMapFileDecoder() { Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-10-01 08:36:39 UTC (rev 435) @@ -359,9 +359,9 @@ /** * Add inventory objects to an arch in the MapTileList recursively. - * @param node the arch where the inventory gets added - * @param archid object id of the highlighted arch (?) - * @param indent indentation; 1=minimal indentation + * @param node the arch where the inventory gets added + * @param archid object id of the highlighted arch (?) + * @param indent indentation; 1=minimal indentation */ private void addInvObjects(final GameObject node, final int archid, final int indent) { final String indentStr = Integer.toString(indent); Modified: trunk/crossfire/src/cfeditor/CPickmapPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-10-01 08:36:39 UTC (rev 435) @@ -260,8 +260,8 @@ /** update info which pickmap is currently on top */ private void updateActivePickmap() { - if (tabpane == null) { // for safety, shouldn't happen - return; + if (tabpane == null) { + return; // for safety, shouldn't happen } if (pickmaps.size() == 0) { @@ -294,8 +294,7 @@ * @todo this method's name is a Bad Thing */ public void addPickmapSelectionListener(final JTabbedPane pickpane) { - pickpane.addChangeListener(new PickmapSelectionListener( - pickpane)); + pickpane.addChangeListener(new PickmapSelectionListener(pickpane)); } /** Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-10-01 08:36:39 UTC (rev 435) @@ -122,7 +122,7 @@ * copyNCut implements clear, cut and copy in one function (since they are * so similar). * @param mapControl MapControl of the active map where we copy from - * @param mode defines if we have a cut, copy or paste action + * @param mode defines if we have a cut, copy or paste action */ private void CopyNCut(final MapControl mapControl, final int mode) { final Point startp = mapControl.getMapView().getHighlightStart(); // start of highlighted rect @@ -261,8 +261,8 @@ /** * Excecuting the Fill command. - * @param mapControl MapControl of the active map we paste on - * @param fillBelow if true, the filling content is placed *below* the + * @param mapControl MapControl of the active map we paste on + * @param fillBelow if true, the filling content is placed *below* the * existing map */ public void fill(final MapControl mapControl, final boolean fillBelow) { @@ -320,26 +320,26 @@ * <p/> * Okay, yes, this algorithm is as inefficient as it could be. But it is * short and easy. And CF maps are so small anyways. - * @param mapControl MapControl of the active map we paste on - * @param x starting x-coord for floodfill - * @param y starting y-coord for floodfill + * @param mapControl MapControl of the active map we paste on + * @param startX starting x-coord for floodfill + * @param startY starting y-coord for floodfill * @param arch GameObject to fill with */ - private void floodfill(final MapControl mapControl, final int x, final int y, final GameObject arch) { - addArchToMap(mapControl, arch, new Point(x, y), 0, false); + private void floodfill(final MapControl mapControl, final int startX, final int startY, final GameObject arch) { + addArchToMap(mapControl, arch, new Point(startX, startY), 0, false); // now go recursive into all four directions - if (mapControl.isPointValid(x - 1, y) && !mapControl.containsArchObject(x - 1, y)) { - floodfill(mapControl, x - 1, y, arch); + if (mapControl.isPointValid(startX - 1, startY) && !mapControl.containsArchObject(startX - 1, startY)) { + floodfill(mapControl, startX - 1, startY, arch); } - if (mapControl.isPointValid(x, y - 1) && !mapControl.containsArchObject(x, y - 1)) { - floodfill(mapControl, x, y - 1, arch); + if (mapControl.isPointValid(startX, startY - 1) && !mapControl.containsArchObject(startX, startY - 1)) { + floodfill(mapControl, startX, startY - 1, arch); } - if (mapControl.isPointValid(x + 1, y) && !mapControl.containsArchObject(x + 1, y)) { - floodfill(mapControl, x + 1, y, arch); + if (mapControl.isPointValid(startX + 1, startY) && !mapControl.containsArchObject(startX + 1, startY)) { + floodfill(mapControl, startX + 1, startY, arch); } - if (mapControl.isPointValid(x, y + 1) && !mapControl.containsArchObject(x, y + 1)) { - floodfill(mapControl, x, y + 1, arch); + if (mapControl.isPointValid(startX, startY + 1) && !mapControl.containsArchObject(startX, startY + 1)) { + floodfill(mapControl, startX, startY + 1, arch); } } Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-10-01 08:36:39 UTC (rev 435) @@ -331,12 +331,12 @@ * Check if a given archetype fits within map bounds. Multi tiles can't be * set if going out of borders. * @param archnanme the archetype to check - * @param xx the x-coordinate to place archname - * @param yy the y-coordinate to place archname + * @param xx the x-coordinate to place archName + * @param yy the y-coordinate to place archName * @param intern ??? */ - private boolean testArchToMap(final String archname, final int xx, final int yy, final int intern) { - for (GameObject part = getDefaultArch(archname); part != null; part = part.getMultiNext()) { + private boolean testArchToMap(final String archName, final int xx, final int yy, final int intern) { + for (GameObject part = getDefaultArch(archName); part != null; part = part.getMultiNext()) { final int mapx = xx + part.getMultiX(); final int mapy = yy + part.getMultiY(); if (!isPointValid(mapx, mapy)) { @@ -442,14 +442,14 @@ } } - @Deprecated public boolean addArchToMap(final String archname, final int xx, final int yy, final int intern, final boolean join, final boolean insertBelow) { - return addArchToMap(archname, new Point(xx, yy), intern, join, insertBelow); + @Deprecated public boolean addArchToMap(final String archName, final int xx, final int yy, final int intern, final boolean join, final boolean insertBelow) { + return addArchToMap(archName, new Point(xx, yy), intern, join, insertBelow); } /** * Add a new arch to the map. Including multi tile arches. This function - * allows only to choose from the default arches (->archname). - * @param archname Name of a default arch on the ArchetypeSet + * allows only to choose from the default arches (->archName). + * @param archName Name of a default arch on the ArchetypeSet * @param pos insert-location on this map * @param intern if NOT '-1': only one arch of the same kind can be * inserted per square @@ -459,19 +459,19 @@ * inserted below * @return true if insertion successful, false if not */ - public boolean addArchToMap(String archname, final Point pos, final int intern, final boolean join, final boolean insertBelow) { + public boolean addArchToMap(String archName, final Point pos, final int intern, final boolean join, final boolean insertBelow) { GameObject newarch, oldarch, startarch; // our new suckers (copys, not ref ptrs) - if (archname == null || !isPointValid(pos)) { + if (archName == null || !isPointValid(pos)) { // invalid parameter return false; } - if (!testArchToMap(archname, pos.x, pos.y, intern)) { + if (!testArchToMap(archName, pos.x, pos.y, intern)) { // does not fit on map return false; } - newarch = getDefaultArch(archname); // temp. store this arch + newarch = getDefaultArch(archName); // temp. store this arch if (newarch == null) { return false; } @@ -479,11 +479,11 @@ if (mainControl.getAutojoin() && join == JOIN_ENABLE && mainControl.getJoinlist() != null && newarch.getJoinList() != null && !newarch.isMulti()) { // do autojoining if enabled - archname = newarch.getJoinList().joinInsert(this, pos.x, pos.y); - if (archname == null) { + archName = newarch.getJoinList().joinInsert(this, pos.x, pos.y); + if (archName == null) { return false; // only one autojoin type per square allowed } - newarch = getDefaultArch(archname); + newarch = getDefaultArch(archName); } GameObject newHead = null; @@ -530,19 +530,19 @@ return true; } - @Deprecated public boolean insertArchToMap(final GameObject newarch, final String archname, final GameObject next, final int mapx, final int mapy, final boolean join) { - return insertArchToMap(newarch, archname, next, new Point(mapx, mapy), join); + @Deprecated public boolean insertArchToMap(final GameObject newarch, final String archName, final GameObject next, final int mapx, final int mapy, final boolean join) { + return insertArchToMap(newarch, archName, next, new Point(mapx, mapy), join); } /** * Insert a new arch to the map at a specified position. This function - * allows either to choose from the default arches (->archname) or to insert + * allows either to choose from the default arches (->archName) or to insert * a copy from an existing arch (->newarch). It also works for * container-inventory. * @param newarch A clone copy of this GameObject gets inserted to the map. * It can be an arch directly from a pickmap or even a * default arch. if ('newarch'==null) the default arch of - * number 'archname' gets inserted - * @param archname Name of a default arch to get inserted. This value gets + * number 'archName' gets inserted + * @param archName Name of a default arch to get inserted. This value gets * used ONLY when 'newarch' is null * @param next the new arch gets inserted before 'next' if * ('next'==null) the arch gets inserted at bottom @@ -551,7 +551,7 @@ * @param join if set to JOIN_ENABLE auto-joining is supported * @return true if insertion was successful */ - public boolean insertArchToMap(GameObject newarch, String archname, final GameObject next, final Point pos, final boolean join) { + public boolean insertArchToMap(GameObject newarch, String archName, final GameObject next, final Point pos, final boolean join) { // map coords must be valid if (!mapControl.isPointValid(pos)) { return false; @@ -564,10 +564,10 @@ if (newarch == null || newarch.isArchetype()) { // just make sure we never insert an uninitialized default arch from the stack if (newarch != null && newarch.isArchetype()) { - archname = newarch.getArchetypeName(); + archName = newarch.getArchetypeName(); } - // insert a new instance of the default arch (number 'archname') - if (!mapControl.addArchToMap(archname, pos, -1, join)) { + // insert a new instance of the default arch (number 'archName') + if (!mapControl.addArchToMap(archName, pos, -1, join)) { return false; } } else { @@ -599,10 +599,10 @@ final GameObject invnew; // new arch to be inserted if (newarch == null || newarch.isArchetype()) { if (newarch != null && newarch.isArchetype()) { - archname = newarch.getArchetypeName(); + archName = newarch.getArchetypeName(); } // create a new copy of a default arch - invnew = getDefaultArch(archname).createArch(); + invnew = getDefaultArch(archName).createArch(); } else { // create clone from a pickmap if (!newarch.isMulti()) { @@ -1192,13 +1192,13 @@ /** * Get a default {@link GameObject} instance. * - * @param archname arch naem + * @param archName arch naem * * @return the default arch object instance corresponding to - * <code>archname</code>, or <code>null</code> if it does not exist + * <code>archName</code>, or <code>null</code> if it does not exist */ - private GameObject getDefaultArch(final String archname) { - return mainControl.getArchObjectStack().getArch(archname); + private GameObject getDefaultArch(final String archName) { + return mainControl.getArchObjectStack().getArch(archName); } } // class DefaultMapModel Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-10-01 08:36:39 UTC (rev 435) @@ -101,8 +101,7 @@ * Constructs a new Map. * @param mainControl the CMainControl * @param maparch the <code>MapArchObject</code> of the map - * @param objects list of Objects (ArchObjects) which should be filled - * in map or <code>null</code> for empty + * @param objects list of Objects (ArchObjects) which should be filled in map or <code>null</code> for empty * @param isPickmap true if this is a pickmap * @param initial the view position to show initially */ Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-10-01 08:36:39 UTC (rev 435) @@ -1420,6 +1420,7 @@ } // class BitmaskAttrib + /** ActionListener for help-buttons. */ private final class HelpActionListener implements ActionListener { @@ -1516,6 +1517,7 @@ } // class ViewTreasurelistAL + /** * ActionListener for the buttons in the ConfirmErrors popup dialog and * also WindowListener for the closebox of the dialog (which would equal a @@ -1650,6 +1652,7 @@ } // class TypesBoxAL + /** * KeySelectionManager to manage the select-per-keystroke in a JComboBox * (The default KeySelectionManager fails because all strings start with Modified: trunk/daimonin/src/daieditor/CFArchType.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchType.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/CFArchType.java 2006-10-01 08:36:39 UTC (rev 435) @@ -93,7 +93,7 @@ /** * Constructor. - * @param defaultArchType default ArchType + * @param defaultArchType default archetype */ public CFArchType(final CFArchType defaultArchType) { typeName = ""; Modified: trunk/daimonin/src/daieditor/CFArchTypeList.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-10-01 08:36:39 UTC (rev 435) @@ -292,7 +292,7 @@ } /** - * Returns the bitmask table which contains all definitions of bitmask types for arch attributes. + * Return the bitmask table which contains all definitions of bitmask types for arch attributes. * @return bitmask table */ public Map<String, CAttribBitmask> getBitmaskTable() { @@ -304,7 +304,7 @@ } /** - * Returns the ignore list table which contains all definitions of ignore lists for arch attributes. + * Return the ignore list table which contains all definitions of ignore lists for arch attributes. * @return ignore list table */ public Map<String, List<String>> getIgnoreListTable() { Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-10-01 08:36:39 UTC (rev 435) @@ -98,7 +98,7 @@ private Map<String, TreasureTreeNode> specialTreasureLists; // all syntax-errors encountered during datafile-parsing get written in this log - private StringBuffer errorLog; + private final StringBuffer errorLog = new StringBuffer(); private List<TreasureTreeNode> needSecondLink; @@ -131,7 +131,6 @@ super(root); hasBeenDisplayed = false; tListCount = 0; - errorLog = new StringBuffer(); parentDialog = null; putClientProperty("JTree.lineStyle", "Angled"); @@ -193,9 +192,9 @@ @Nullable public static CAttribDialog getParentDialog() { if (instance != null && instance.frame != null && instance.frame.isShowing()) { return instance.parentDialog; - } else { - return null; } + + return null; } /** Hide the Treasurelists window, if not already hidden. */ Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-10-01 08:36:39 UTC (rev 435) @@ -1311,9 +1311,11 @@ archObjectParser.expandMulti(arch, tailList); } + for (final GameObject tail : tailList) { objects.add(tail); } + if (noarchcount > 0) { ACTION_FACTORY.showMessageDialog(mainView, "collectTemplistAutodelete", file.getName(), noarchcount, noarch); } @@ -1360,6 +1362,7 @@ log.log(Level.WARNING, "saveLevelAsWithNull"); return false; } + final JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Save Map Or Script As"); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); @@ -1821,7 +1824,7 @@ return false; } - /** "Clear" was selected from the Edit menu */ + /** "Clear" was selected from the Edit menu. */ public void clear() { if (currentMap == null || currentMap.getMapViewFrame() == null) { return; // this should never be possible, but I just wanna make sure... @@ -1830,7 +1833,7 @@ copybuffer.clear(currentMap); } - /** "Cut" was selected from the Edit menu */ + /** "Cut" was selected from the Edit menu. */ public void cut() { if (currentMap == null || currentMap.getMapViewFrame() == null) { return; // this should never be possible, but I just wanna make sure... @@ -1868,7 +1871,7 @@ } /** - * "Fill" was selected from the Edit menu + * "Fill" was selected from the Edit menu. * @param fillBelow true if "Fill Below" was activated, false if "Fill Above" */ private void fillWanted(final boolean fillBelow) { Modified: trunk/daimonin/src/daieditor/CPickmapPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-10-01 08:36:39 UTC (rev 435) @@ -56,7 +56,7 @@ private boolean loadComplete; // true when all pickmaps have been loaded (at least one) - private JTabbedPane tabpane; // tab pane with pickmaps + private JTabbedPane tabpane = null; // tab pane with pickmaps /** All open pickmaps (the map controllers get stored in the vector). */ private final List<MapControl> pickmaps = new ArrayList<MapControl>(); @@ -289,10 +289,12 @@ if (tabpane == null) { return; // for safety, shouldn't happen } + if (pickmaps.size() == 0) { currentPickMap = null; return; } + boolean foundMap = false; final String newName = File.separator + tabpane.getTitleAt(tabpane.getSelectedIndex()); @@ -364,7 +366,7 @@ */ private static final class ArchNPickChangeListener implements ChangeListener { - private final CMainView mainview; // main view + private final CMainView mainView; // main view private final JTabbedPane tabpane; // parent pane for archlist & pickmaps @@ -376,7 +378,7 @@ * @param pane the JTabbedPane containing both archlist and pickmaps */ public ArchNPickChangeListener(final CMainView mainView, final JTabbedPane pane) { - mainview = mainView; + this.mainView = mainView; tabpane = pane; selectedIndex = tabpane.getSelectedIndex(); } @@ -385,9 +387,9 @@ if (tabpane.getSelectedIndex() != selectedIndex) { // the state has changed, user has switched panels if (tabpane.getSelectedIndex() == 0) { - mainview.setPickmapActive(false); + mainView.setPickmapActive(false); } else { - mainview.setPickmapActive(true); + mainView.setPickmapActive(true); } selectedIndex = tabpane.getSelectedIndex(); // save new state Modified: trunk/daimonin/src/daieditor/CopyBuffer.java =================================================================== --- trunk/daimonin/src/daieditor/CopyBuffer.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/CopyBuffer.java 2006-10-01 08:36:39 UTC (rev 435) @@ -235,7 +235,7 @@ /** * Excecuting the Fill command. * @param mapControl MapControl of the active map we paste on - * @param fillBelow if true, the filling content is placed *below* the + * @param fillBelow if true, the filling content is placed *below* the * existing map */ public void fill(final MapControl mapControl, final boolean fillBelow, final MapControl seed, final int rand) { @@ -373,7 +373,7 @@ private static final byte BLOCKED = (byte) 3; /** - * Floodfill the map, starting at the highlighted square + * Floodfill the map, starting at the highlighted square. * @param mapControl MapControl of the active map we paste on * @param startX starting x-coord for floodfill * @param startY starting y-coord for floodfill Modified: trunk/daimonin/src/daieditor/ReplaceDialog.java =================================================================== --- trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-10-01 08:36:39 UTC (rev 435) @@ -156,7 +156,7 @@ } line1.add(replaceEntireBox); line1.add(Box.createVerticalStrut(3)); - rfHeading = new JLabel('\"' + mapControl.getMapFileName() + "\":"); + rfHeading = new JLabel("\"" + mapControl.getMapFileName() + "\":"); line1.add(rfHeading); mainPanel.add(line1); @@ -197,7 +197,7 @@ if (replaceArch != null) { colonLabel = new JLabel(":"); iconLabel.setIcon(mainControl.getArchObjectStack().getFace(replaceArch.getFaceObjName())); - rfArchName = new JLabel(' ' + replaceArch.getBestName()); + rfArchName = new JLabel(" " + replaceArch.getBestName()); } else { colonLabel = new JLabel(""); rfArchName = new JLabel(""); @@ -220,7 +220,7 @@ isBuilt = true; } else { // just set fields and show - rfHeading.setText('\"' + mapControl.getMapFileName() + "\":"); + rfHeading.setText("\"" + mapControl.getMapFileName() + "\":"); replaceInput1.setText(""); this.mapControl = mapControl; @@ -232,7 +232,7 @@ } else { replaceWithBox.setSelectedIndex(0); iconLabel.setIcon(mainControl.getArchObjectStack().getFace(replaceArch.getFaceObjName())); - rfArchName.setText(' ' + replaceArch.getBestName()); + rfArchName.setText(" " + replaceArch.getBestName()); colonLabel.setText(":"); } final MapViewIFrame mapViewIFrame = mapControl.getMapViewFrame(); @@ -262,7 +262,7 @@ final Icon oldIcon = iconLabel.getIcon(); iconLabel.setIcon(mainControl.getArchObjectStack().getFace(newArch.getFaceObjName())); - rfArchName.setText(' ' + newArch.getBestName()); + rfArchName.setText(" " + newArch.getBestName()); colonLabel.setText(":"); // pack frame only if height of icon changed Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-09-30 10:39:11 UTC (rev 434) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-10-01 08:36:39 UTC (rev 435) @@ -217,8 +217,8 @@ } /** {@inheritDoc} */ - public boolean isMultiArchFittingToMap(final String archname, final Point pos, final boolean allowDouble) { - final GameObject head = getDefaultArch(archname); + public boolean isMultiArchFittingToMap(final String archName, final Point pos, final boolean allowDouble) { + final GameObject head = getDefaultArch(archName); final Point mapH = new Point(head.getMultiX(), head.getMultiY()); mapH.translate(pos.x, pos.y); if (!isPointValid(mapH)) { @@ -244,15 +244,15 @@ } /** {@inheritDoc} */ - public boolean addArchToMap(final String archname, final Point pos, final boolean allowDouble, final boolean insertBelow) { - if (archname == null || archname.length() == 0 || pos.x == -1 || pos.y == -1 || pos.x >= mapSize.getWidth() || pos.y >= mapSize.getHeight()) { + public boolean addArchToMap(final String archName, final Point pos, final boolean allowDouble, final boolean insertBelow) { + if (archName == null || archName.length() == 0 || pos.x == -1 || pos.y == -1 || pos.x >= mapSize.getWidth() || pos.y >= mapSize.getHeight()) { return false; } - if (!isMultiArchFittingToMap(archname, pos, allowDouble)) { + if (!isMultiArchFittingToMap(archName, pos, allowDouble)) { return false; } - final GameObject defaultArch = getDefaultArch(archname); + final GameObject defaultArch = getDefaultArch(archName); // FIXME: Check maximum RefX and RefY to check whether the multitile arch fits on the map. if (pos.x + defaultArch.getMinX() < 0 || pos.y + defaultArch.getMinY() < 0 || pos.x + defaultArch.getMaxX() > mapSize.getWidth() || pos.y + defaultArch.getMaxY() > mapSize.getHeight()) { @@ -295,7 +295,7 @@ * {@inheritDoc} * @xxx I'm too complex */ - public boolean insertArchToMap(GameObject newarch, String archname, final GameObject next, final Point pos) { + public boolean insertArchToMap(GameObject newarch, String archName, final GameObject next, final Point pos) { // map coords must be valid if (!isPointValid(pos)) { return false; @@ -307,10 +307,10 @@ if (newarch == null || newarch.isArchetype()) { // just make sure we never insert an uninitialized default arch from the stack if (newarch != null && newarch.isArchetype()) { - archname = newarch.getArchetypeName(); + archName = newarch.getArchetypeName(); } - // insert a new instance of the default arch (number 'archname') - if (!addArchToMap(archname, pos, true, false)) { + // insert a new instance of the default arch (number 'archName') + if (!addArchToMap(archName, pos, true, false)) { return false; } } else { @@ -340,10 +340,10 @@ final GameObject invnew; // new arch to be inserted if (newarch == null || newarch.isArchetype()) { if (newarch != null && newarch.isArchetype()) { - archname = newarch.getArchetypeName(); + archName = newarch.getArchetypeName(); } // create a new copy of a default arch - invnew = getDefaultArch(archname).createArch(); + invnew = getDefaultArch(archName).createArch(); } else { // create clone from a pickmap if (!newarch.isMulti()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |