* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_5;
+package org.altusmetrum.altoslib_7;
import java.io.*;
import java.util.*;
public final static String unitsPreference = "IMPERIAL-UNITS";
+ /* Maps cache size preference name */
+ final static String mapCachePreference = "MAP-CACHE";
+
+ static LinkedList<AltosMapCacheListener> map_cache_listeners;
+
+ public static int map_cache = 9;
+
public static AltosFrequency[] load_common_frequencies() {
AltosFrequency[] frequencies = null;
boolean existing = false;
common_frequencies = load_common_frequencies();
AltosConvert.imperial_units = backend.getBoolean(unitsPreference, false);
+
+ map_cache = backend.getInt(mapCachePreference, 9);
+ map_cache_listeners = new LinkedList<AltosMapCacheListener>();
}
public static void flush_preferences() {
units_listeners.remove(l);
}
}
+
+
+ public static void register_map_cache_listener(AltosMapCacheListener l) {
+ synchronized(backend) {
+ map_cache_listeners.add(l);
+ }
+ }
+
+ public static void unregister_map_cache_listener(AltosMapCacheListener 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 (AltosMapCacheListener l: map_cache_listeners)
+ l.map_cache_changed(map_cache);
+ }
+ }
+
+ public static int map_cache() {
+ synchronized(backend) {
+ return map_cache;
+ }
+ }
}