From: <ste...@us...> - 2010-08-04 22:06:03
|
Revision: 1368 http://rails.svn.sourceforge.net/rails/?rev=1368&view=rev Author: stefanfrey Date: 2010-08-04 22:05:57 +0000 (Wed, 04 Aug 2010) Log Message: ----------- Further updates to configuration dialog Modified Paths: -------------- trunk/18xx/LocalisedText.properties trunk/18xx/data/Properties.xml trunk/18xx/rails/ui/swing/GameUIManager.java trunk/18xx/rails/util/ConfigItem.java Modified: trunk/18xx/LocalisedText.properties =================================================================== --- trunk/18xx/LocalisedText.properties 2010-08-01 21:30:16 UTC (rev 1367) +++ trunk/18xx/LocalisedText.properties 2010-08-04 22:05:57 UTC (rev 1368) @@ -154,8 +154,31 @@ Config.infoText.default_players=Enter player names separated by commas. Config.label.default_game=Default game Config.label.default_players=Default players +Config.label.font.ui.name=Font selection +Config.label.font.ui.scale=Font scaling +Config.label.font.ui.style=Font style Config.label.local.player.name=Local player (for pbem) -Config.label.locale=Language Setting +Config.label.locale=Language setting +Config.label.map.autoscroll=Map autoscroll +Config.label.map.zoomstep=Map zoomstep +Config.label.money_format=Money format +Config.label.or.number_format=Number format +Config.label.report.directory=Report directory +Config.label.report.filename.date_time_pattern=Report filename date pattern +Config.label.report.filename.extension=Report filename extension +Config.label.report.window.open=Report window open +Config.label.report.window.editable=Report window editable +Config.label.route.colour.1=Route color for first train +Config.label.route.colour.2=Route color for second train +Config.label.route.colour.3=Route color for third train +Config.label.route.colour.4=Route color for fourth train +Config.label.stockchart.window.open=Stockchart open +Config.label.save.directory=Save folder +Config.label.save.filename.date_time_pattern=Filename date pattern +Config.label.save.filename.suffix=Filename suffix +Config.label.save.filename.extension=Filename extension +Config.label.save.recovery.active=Automatic save +Config.label.save.recovery.filepath=Automatic save filepath Config.toolTip.local.player.name=Player name used as suffix for game save Config.section.Format=Format/Colors Config.section.General=General Modified: trunk/18xx/data/Properties.xml =================================================================== --- trunk/18xx/data/Properties.xml 2010-08-01 21:30:16 UTC (rev 1367) +++ trunk/18xx/data/Properties.xml 2010-08-04 22:05:57 UTC (rev 1368) @@ -23,9 +23,12 @@ <Property name="report.window.open" type="BOOLEAN" /> <Property name="report.window.editable" type="BOOLEAN" /> <Property name="stockchart.window.open" type="BOOLEAN" /> - <Property name="font.ui.scale" type="PERCENT" /> - <Property name="font.ui.name" type="FONT" /> - <Property name="font.ui.style" type="LIST" values="plain,bold" /> + <Property name="font.ui.scale" type="PERCENT" + initClass="rails.ui.swing.GameUIManager" initMethod="updateUILookAndFeel" initParameter="no" /> + <Property name="font.ui.name" type="FONT" + initClass="rails.ui.swing.GameUIManager" initMethod="updateUILookAndFeel" initParameter="no" /> + <Property name="font.ui.style" type="LIST" values="plain,bold" + initClass="rails.ui.swing.GameUIManager" initMethod="updateUILookAndFeel" initParameter="no" /> </Section> <Section name="Map"> <Property name="map.autoscroll" type="BOOLEAN" /> Modified: trunk/18xx/rails/ui/swing/GameUIManager.java =================================================================== --- trunk/18xx/rails/ui/swing/GameUIManager.java 2010-08-01 21:30:16 UTC (rev 1367) +++ trunk/18xx/rails/ui/swing/GameUIManager.java 2010-08-04 22:05:57 UTC (rev 1368) @@ -1,5 +1,6 @@ package rails.ui.swing; +import java.awt.EventQueue; import java.awt.Font; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; @@ -87,6 +88,14 @@ this.gameManager = gameManager; uiHints = gameManager.getUIHints(); + initSaveSettings(); + initFontSettings(); + + configuredStockChartVisibility = "yes".equalsIgnoreCase(Config.get("stockchart.window.open")); + + } + + private void initSaveSettings() { saveDirectory = Config.get("save.directory"); if (!Util.hasValue(saveDirectory)) { saveDirectory = DEFAULT_SAVE_DIRECTORY; @@ -109,9 +118,10 @@ if (Util.hasValue(saveSuffixSpec) && !saveSuffixSpec.equals(NEXT_PLAYER_SUFFIX)) { saveSuffix = "_" + saveSuffixSpec; } + } - configuredStockChartVisibility = "yes".equalsIgnoreCase(Config.get("stockchart.window.open")); - + private void initFontSettings() { + // font settings, can be game specific String fontType = Config.getGameSpecific("font.ui.name"); Font font = null; @@ -120,7 +130,7 @@ String fontStyle = Config.getGameSpecific("font.ui.style"); if (Util.hasValue(fontStyle)) { if (fontStyle.equalsIgnoreCase("plain")) { - boldStyle = false; + boldStyle = false; } } if (boldStyle) { @@ -141,6 +151,7 @@ } } } + public void gameUIInit() { @@ -807,5 +818,31 @@ public boolean getGameParameterAsBoolean (GuiDef.Parm key) { return (Boolean) getGameParameter(key); } - + + private void updateWindowsLookAndFeel() { + SwingUtilities.updateComponentTreeUI(statusWindow); + statusWindow.pack(); + SwingUtilities.updateComponentTreeUI(orWindow); + orWindow.pack(); + SwingUtilities.updateComponentTreeUI(reportWindow); + reportWindow.pack(); + SwingUtilities.updateComponentTreeUI(configWindow); + configWindow.pack(); + SwingUtilities.updateComponentTreeUI(stockChart); + stockChart.pack(); + } + + /** update fonts settings + * (after configuration changes) + */ + public static void updateUILookAndFeel() { + instance.initFontSettings(); + instance.updateWindowsLookAndFeel(); + +// EventQueue.invokeLater(new Runnable() { +// public void run() { +// instance.repaintWindows(); +// } +// }); + } } Modified: trunk/18xx/rails/util/ConfigItem.java =================================================================== --- trunk/18xx/rails/util/ConfigItem.java 2010-08-01 21:30:16 UTC (rev 1367) +++ trunk/18xx/rails/util/ConfigItem.java 2010-08-04 22:05:57 UTC (rev 1368) @@ -121,7 +121,7 @@ clazz.getMethod(initMethod).invoke(null); } } catch (Exception e) { - log.error("Config profile: cannot call initMethod"); + log.error("Config profile: cannot call initMethod, Exception = " + e.toString()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |