From 1338ce5d3efdaca292a420bac59756311efc0a3c Mon Sep 17 00:00:00 2001 From: Marko Živković Date: Thu, 26 Feb 2015 23:35:42 +0000 Subject: Separeted selection for gui language and logo language git-svn-id: https://svn.code.sf.net/p/xlogo4schools/svn/trunk@29 3b0d7934-f7ef-4143-9606-b51f2e2281fd --- logo/src/xlogo/AppSettings.java | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'logo/src/xlogo/AppSettings.java') diff --git a/logo/src/xlogo/AppSettings.java b/logo/src/xlogo/AppSettings.java index 8a8d2da..aa1beba 100644 --- a/logo/src/xlogo/AppSettings.java +++ b/logo/src/xlogo/AppSettings.java @@ -11,6 +11,7 @@ import xlogo.storage.WSManager; import xlogo.storage.global.GlobalConfig; import xlogo.storage.global.GlobalConfig.GlobalProperty; import xlogo.storage.workspace.Language; +import xlogo.storage.workspace.LogoLanguage; import xlogo.storage.workspace.SyntaxHighlightConfig; import xlogo.storage.workspace.WorkspaceConfig; import xlogo.storage.workspace.WorkspaceConfig.WorkspaceProperty; @@ -39,6 +40,10 @@ public class AppSettings implements Observable{ setLanguage(wc.getLanguage()); }; + private PropertyChangeListener logoLanguageListener= () -> { + setLogoLanguage(wc.getLogoLanguage()); + }; + private PropertyChangeListener syntaxListener = () -> { setSyntaxHighlightingStyles(wc.getSyntaxHighlightStyles()); }; @@ -67,6 +72,7 @@ public class AppSettings implements Observable{ if (wc != null) { wc.removePropertyChangeListener(WorkspaceProperty.LANGUAGE, languageListener); + wc.removePropertyChangeListener(WorkspaceProperty.LOGO_LANGUAGE, logoLanguageListener); wc.removePropertyChangeListener(WorkspaceProperty.SYNTAX_HIGHLIGHTING, syntaxListener); } @@ -74,9 +80,11 @@ public class AppSettings implements Observable{ if (wc != null) { setLanguage(wc.getLanguage()); + setLogoLanguage(wc.getLogoLanguage()); setSyntaxHighlightingStyles(wc.getSyntaxHighlightStyles()); wc.addPropertyChangeListener(WorkspaceProperty.LANGUAGE, languageListener); + wc.addPropertyChangeListener(WorkspaceProperty.LOGO_LANGUAGE, logoLanguageListener); wc.addPropertyChangeListener(WorkspaceProperty.SYNTAX_HIGHLIGHTING, syntaxListener); } publisher.publishEvent(AppProperty.WORKSPACE); @@ -104,6 +112,26 @@ public class AppSettings implements Observable{ Logo.generateLanguage(language); publisher.publishEvent(AppProperty.LANGUAGE); } + + + /* * * * * * * + * LANGUAGE + * * * * * * */ + + private LogoLanguage logoLanguage = LogoLanguage.ENGLISH; + + public LogoLanguage getLogoLanguage() { + return logoLanguage; + } + + protected void setLogoLanguage(LogoLanguage language) { + if (language == this.logoLanguage) + return; + logger.trace("Change language from " + this.language + " to " + language); + this.logoLanguage = language; + Logo.generateLogoLanguage(language); + publisher.publishEvent(AppProperty.LOGO_LANGUAGE); + } /** * Translate the key into the current language. @@ -157,7 +185,7 @@ public class AppSettings implements Observable{ * * * * * * */ public enum AppProperty { - LANGUAGE, SYNTAX_HIGHLIGHTING, FONT, WORKSPACE; + LANGUAGE, LOGO_LANGUAGE, SYNTAX_HIGHLIGHTING, FONT, WORKSPACE; } private transient final PropertyChangePublisher publisher = new PropertyChangePublisher<>(); -- cgit v1.2.3