From: <wak...@gm...> - 2008-11-21 21:05:13
|
It's easier to work with diffs outside of Eclipse. I generally apply patches with the linux patch command and then have Eclipse reload its code view. ---Brett Sent via BlackBerry from T-Mobile -----Original Message----- From: "Erik Vos" <eri...@hc...> Date: Fri, 21 Nov 2008 21:50:34 To: 'Development list for Rails: an 18xx game'<rai...@li...> Subject: Re: [Rails-devel] delurking with a quick ReportWindow fix OK, I have picked up and committed these changes. One comment: It took me some trouble to apply these patches (I must add immediately that I have never worked with diff patches before). On lines like --- 18xx.orig/rails/ui/swing/GameUIManager.java 2008-06-30 13:35:29.000000000 -0700 it seems that Eclipse considers the date/time stuff as a part of the filename; I had to remove that. And the "orig" part I had to remove as well. Otherwise, thanks. Erik. > -----Original Message----- > From: Jonathan Ferro [mailto:jon...@ya...] > Sent: Wednesday 19 November 2008 23:50 > To: Development list for Rails: an 18xx game > Subject: Re: [Rails-devel] delurking with a quick ReportWindow fix > > > If you know a better way than a JLabel to achieve the same > effect, I'd like > > > to know it. This was the only way I could manage it. > > OK, done (appended) and it was much easier than I thought. > In the process I destaticified some things, which felt like > the right thing to do but please check it over. > > > I think a separate and well-readable window report is > needed for various > > reasons, not the least one being that, certainly in > internet play, players > > would like to see a written account of the game actions, > not cluttered by > > other log info. > > The format is like game reports I have seen published on > the Internet, and > > indeed intended to be suitable for saving, emailing (PBEM), > publishing etc. > > I think a next step might be to have the "game report" be > separated from other debug logging by having it be completely > regenerable from the same game history that undo uses. I've > lost track--does the undo trail now include the entire game, > or are there still unundoable actions that cause it to be truncated? > > -- Jonathan > > diff -r -x CVS -u --strip-trailing-cr > 18xx.orig/rails/ui/swing/GameUIManager.java > 18xx/rails/ui/swing/GameUIManager.java > --- 18xx.orig/rails/ui/swing/GameUIManager.java 2008-06-30 > 13:35:29.000000000 -0700 > +++ 18xx/rails/ui/swing/GameUIManager.java 2008-11-19 > 13:52:56.640625000 -0800 > @@ -124,7 +124,7 @@ > log.debug("==Result from server: " + result); > activeWindow.displayServerMessage(); > > - ReportWindow.addLog(); > + reportWindow.addLog(); > > // End of game checks > if (gameManager.isGameOver()) { > diff -r -x CVS -u --strip-trailing-cr > 18xx.orig/rails/ui/swing/ORUIManager.java > 18xx/rails/ui/swing/ORUIManager.java > --- 18xx.orig/rails/ui/swing/ORUIManager.java 2008-10-12 > 07:36:44.000000000 -0700 > +++ 18xx/rails/ui/swing/ORUIManager.java 2008-11-19 > 13:54:08.859375000 -0800 > @@ -350,7 +350,7 @@ > displayRemainingTiles(); > } > > - ReportWindow.addLog(); > + gameUIManager.reportWindow.addLog(); > } > > /** Stub, can be overridden in subclasses */ > diff -r -x CVS -u --strip-trailing-cr > 18xx.orig/rails/ui/swing/ORWindow.java > 18xx/rails/ui/swing/ORWindow.java > --- 18xx.orig/rails/ui/swing/ORWindow.java 2008-06-30 > 13:35:29.000000000 -0700 > +++ 18xx/rails/ui/swing/ORWindow.java 2008-11-19 > 13:54:20.078125000 -0800 > @@ -77,7 +77,7 @@ > setSize(800, 600); > addWindowListener(this); > > - ReportWindow.addLog(); > + gameUIManager.reportWindow.addLog(); > } > > public ORUIManager getORUIManager() { > diff -r -x CVS -u --strip-trailing-cr > 18xx.orig/rails/ui/swing/ReportWindow.java > 18xx/rails/ui/swing/ReportWindow.java > --- 18xx.orig/rails/ui/swing/ReportWindow.java 2008-11-18 > 14:12:50.000000000 -0800 > +++ 18xx/rails/ui/swing/ReportWindow.java 2008-11-19 > 13:57:43.781250000 -0800 > @@ -15,29 +15,28 @@ > public class ReportWindow extends JFrame implements > WindowListener, KeyListener { > > private static final long serialVersionUID = 1L; > - private JLabel message; > + private JTextArea message; > private JScrollPane messageScroller; > private JScrollBar vbar; > private JPanel messagePanel; > - private static ReportWindow messageWindow; > + private ReportWindow messageWindow; > private GameManager gameManager; > > - private static StringBuffer buffer = new > StringBuffer("<html></html>"); > - > public ReportWindow(GameManager gameManager) { > messageWindow = this; > this.gameManager = gameManager; > > - message = new JLabel(""); > + message = new JTextArea(); > + message.setEditable(false); > + message.setLineWrap(false); > message.setBackground(Color.WHITE); > message.setOpaque(true); > - message.setVerticalAlignment(SwingConstants.TOP); > message.setBorder(BorderFactory.createEmptyBorder(5, > 5, 5, 5)); > > messagePanel = new JPanel(new GridBagLayout()); > messageScroller = > new JScrollPane(message, > - > ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, > + > ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, > > ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); > vbar = messageScroller.getVerticalScrollBar(); > GridBagConstraints gbc = new GridBagConstraints(); > @@ -55,12 +54,10 @@ > > } > > - public static void addLog() { > + public void addLog() { > String newText = ReportBuffer.get(); > if (newText.length() > 0) { > - buffer.insert(buffer.length() - 7, > newText.replaceAll("\n", "<br>")); > - > - messageWindow.message.setText(buffer.toString()); > + message.append(newText); > SwingUtilities.invokeLater(new Runnable() { > public void run() { > > messageWindow.vbar.setValue(messageWindow.vbar.getMaximum()); > > > -------------------------------------------------------------- > ----------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK & > win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Rails-devel mailing list Rai...@li... https://lists.sourceforge.net/lists/listinfo/rails-devel |