diff options
| author | Bdale Garbee <bdale@gag.com> | 2014-09-09 23:28:39 -0600 | 
|---|---|---|
| committer | Bdale Garbee <bdale@gag.com> | 2014-09-09 23:28:39 -0600 | 
| commit | 16405fd3eb6f82ef3a709e3ed30fc48faef7b547 (patch) | |
| tree | c111819b3ba0c9357af41c81b798326b9df7adad /altosuilib/AltosUIPreferences.java | |
| parent | 5a2f6ed6210844f7284fbf9f7ecba68c8a14fa52 (diff) | |
| parent | 28bd5057252e61bc5b1a35a00bc1f9fdfde097f7 (diff) | |
Merge branch 'branch-1.5' into debian
Conflicts:
	ChangeLog
	Releasing
	altosui/Instdrv/NSIS/Includes/java.nsh
	altosui/altos-windows.nsi.in
	configure.ac
	doc/Makefile
	doc/altusmetrum.xsl
	micropeak/micropeak-windows.nsi.in
	telegps/telegps-windows.nsi.in
Diffstat (limited to 'altosuilib/AltosUIPreferences.java')
| -rw-r--r-- | altosuilib/AltosUIPreferences.java | 42 | 
1 files changed, 40 insertions, 2 deletions
diff --git a/altosuilib/AltosUIPreferences.java b/altosuilib/AltosUIPreferences.java index 7a582a7d..ecab20d4 100644 --- a/altosuilib/AltosUIPreferences.java +++ b/altosuilib/AltosUIPreferences.java @@ -15,13 +15,13 @@   * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.   */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3;  import java.io.*;  import java.util.*;  import java.awt.Component;  import javax.swing.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*;  public class AltosUIPreferences extends AltosPreferences { @@ -34,6 +34,9 @@ public class AltosUIPreferences extends AltosPreferences {  	/* Window position preference name */  	final static String positionPreference = "POSITION"; +	/* Maps cache size preference name */ +	final static String mapCachePreference = "MAP-CACHE"; +  	/* UI Component to pop dialogs up */  	static Component component; @@ -52,6 +55,10 @@ public class AltosUIPreferences extends AltosPreferences {  	public static int position = AltosUILib.position_top_left; +	static LinkedList<AltosUIMapCacheListener> map_cache_listeners; + +	public static int map_cache = 9; +  	public static void init() {  		AltosPreferences.init(new AltosUIPreferencesBackend()); @@ -68,6 +75,9 @@ public class AltosUIPreferences extends AltosPreferences {  		position = backend.getInt(positionPreference, AltosUILib.position_top_left);  		position_listeners = new LinkedList<AltosPositionListener>(); + +		map_cache = backend.getInt(mapCachePreference, 9); +		map_cache_listeners = new LinkedList<AltosUIMapCacheListener>();  	}  	static { init(); } @@ -215,4 +225,32 @@ public class AltosUIPreferences extends AltosPreferences {  			return position;  		}  	} + +	public static void register_map_cache_listener(AltosUIMapCacheListener l) { +		synchronized(backend) { +			map_cache_listeners.add(l); +		} +	} + +	public static void unregister_map_cache_listener(AltosUIMapCacheListener l) { +		synchronized (backend) { +			map_cache_listeners.remove(l); +		} +	} + +	public static void set_map_cache(int new_map_cache) { +		synchronized(backend) { +			map_cache = new_map_cache; +			backend.putInt(mapCachePreference, map_cache); +			flush_preferences(); +			for (AltosUIMapCacheListener l: map_cache_listeners) +				l.map_cache_changed(map_cache); +		} +	} + +	public static int map_cache() { +		synchronized(backend) { +			return map_cache; +		} +	}  }  | 
