X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosuilib%2FAltosUIUnitsIndicator.java;h=dc5cb11c6c6f8bb728c58491ca42969e95076267;hp=b58cd1cc7c8488e7c19f0bd0a3591be62e582e03;hb=1085ec5d57e0ed5d132f2bbdac1a0b6a32c0ab4a;hpb=87c8bb3956897830da1f7aaca2990a9571767b73 diff --git a/altosuilib/AltosUIUnitsIndicator.java b/altosuilib/AltosUIUnitsIndicator.java index b58cd1cc..dc5cb11c 100644 --- a/altosuilib/AltosUIUnitsIndicator.java +++ b/altosuilib/AltosUIUnitsIndicator.java @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,11 +16,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_8; +package org.altusmetrum.altosuilib_11; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_8.*; +import org.altusmetrum.altoslib_11.*; public abstract class AltosUIUnitsIndicator extends AltosUIIndicator { @@ -46,10 +47,10 @@ public abstract class AltosUIUnitsIndicator extends AltosUIIndicator { public double[] last_values; - public void show(double... v) { + private void show(boolean force, double... v) { show(); for (int i = 0; i < values.length; i++) { - if (v[i] != last_values[i]) { + if (force || v[i] != last_values[i]) { String value_text; boolean good = false; @@ -68,13 +69,19 @@ public abstract class AltosUIUnitsIndicator extends AltosUIIndicator { } } + boolean hide = false; + + public void show(double... v) { + show(false, v); + } + public void units_changed(boolean imperial_units) { - show(last_values); + if (!hide) + show(true, last_values); } public void show (AltosState state, AltosListenerState listener_state) { double[] v = new double[values.length]; - boolean hide = false; for (int i = 0; i < values.length; i++) { if (state != null) @@ -93,7 +100,7 @@ public abstract class AltosUIUnitsIndicator extends AltosUIIndicator { public void reset() { for (int i = 0; i < last_values.length; i++) - last_values[i] = AltosLib.MISSING - 1; + last_values[i] = AltosLib.MISSING; } public AltosUIUnitsIndicator (Container container, int x, int y, int label_width, AltosUnits units, String name, int number_values, boolean has_lights, int width) { @@ -101,7 +108,7 @@ public abstract class AltosUIUnitsIndicator extends AltosUIIndicator { this.units = units; last_values = new double[values.length]; for (int i = 0; i < last_values.length; i++) - last_values[i] = AltosLib.MISSING - 1; + last_values[i] = AltosLib.MISSING; } public AltosUIUnitsIndicator (Container container, int x, int y, AltosUnits units, String name, int number_values, boolean has_lights, int width) {