From: Keith Packard Date: Wed, 17 Apr 2013 17:41:05 +0000 (-0700) Subject: Merge branch 'master' into droid-gps X-Git-Tag: altosdroid_v1.2-1~9^2~8 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=ff332e640b27c6be37dabef58ebac350ac2347b2;hp=b3000609e4010ff4d29debe72ea1866e775af539 Merge branch 'master' into droid-gps --- diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index 4fd0647e..11f40593 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -719,6 +719,7 @@ public class AltosConfigUI public void set_main_deploy(int new_main_deploy) { main_deploy_value.setSelectedItem(Integer.toString(new_main_deploy)); + main_deploy_value.setEnabled(new_main_deploy >= 0); } public int main_deploy() { diff --git a/altosui/AltosSiteMap.java b/altosui/AltosSiteMap.java index 5bf02e54..23085f3e 100644 --- a/altosui/AltosSiteMap.java +++ b/altosui/AltosSiteMap.java @@ -220,6 +220,16 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay { return pngfile.toString(); } + public void initAndFinishMapAsync (final AltosSiteMapTile tile, final Point offset) { + Thread thread = new Thread() { + public void run() { + initMap(offset); + finishTileLater(tile, offset); + } + }; + thread.start(); + } + public void setBaseLocation(double lat, double lng) { for (Point k : mapTiles.keySet()) { AltosSiteMapTile tile = mapTiles.get(k); @@ -308,8 +318,7 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay { AltosSiteMapTile tile = createTile(offset); tile.show(state, listener_state, lref, ref); - initMap(offset); - finishTileLater(tile, offset); + initAndFinishMapAsync(tile, offset); } scrollRocketToVisible(pt); @@ -370,8 +379,7 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay { if (mapTiles.containsKey(offset)) continue; AltosSiteMapTile tile = createTile(offset); - initMap(offset); - finishTileLater(tile, offset); + initAndFinishMapAsync(tile, offset); } } } diff --git a/altosui/AltosSiteMapCache.java b/altosui/AltosSiteMapCache.java index 617ed4a9..40c8ff6b 100644 --- a/altosui/AltosSiteMapCache.java +++ b/altosui/AltosSiteMapCache.java @@ -19,6 +19,7 @@ package altosui; import javax.swing.*; import javax.imageio.ImageIO; +import java.awt.image.*; import java.io.*; import java.net.URL; import java.net.URLConnection; @@ -87,7 +88,14 @@ public class AltosSiteMapCache extends JLabel { } try { - return new ImageIcon(ImageIO.read(pngfile)); + BufferedImage img; + + img = ImageIO.read(pngfile); + if (img == null) { + System.out.printf("# Can't read pngfile %s\n", pngfile); + return null; + } + return new ImageIcon(img); } catch (IOException e) { System.out.printf("# IO error trying to load %s\n", pngfile); return null;