From df5d16793592e43e925ac94cf9668d0478ea76d6 Mon Sep 17 00:00:00 2001 From: gered Date: Tue, 5 Jan 2016 13:35:11 -0500 Subject: [PATCH] fixes for some colour issues --- .../java/org/fenix/llanfair/gui/Core.java | 6 ++--- .../java/org/fenix/llanfair/gui/Footer.java | 6 +++-- .../java/org/fenix/llanfair/gui/Graph.java | 4 +++- .../java/org/fenix/llanfair/gui/History.java | 24 +++++++++++-------- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/fenix/llanfair/gui/Core.java b/src/main/java/org/fenix/llanfair/gui/Core.java index bcae905..b4df794 100644 --- a/src/main/java/org/fenix/llanfair/gui/Core.java +++ b/src/main/java/org/fenix/llanfair/gui/Core.java @@ -320,7 +320,7 @@ final void setRun(Run run) { Color bg = Settings.colorBackground.get(); if (splitTimer.getForeground().equals(bg)) { if (pauseTime.compareTo(splitTime) > 0) { - splitTimer.setForeground(Settings.colorTimeGainedWhileBehind.get()); + splitTimer.setForeground(Settings.colorTimeLostWhileBehind.get()); } else { splitTimer.setForeground(Settings.colorTimer.get()); } @@ -340,11 +340,11 @@ final void setRun(Run run) { if (!splitLoss && splitElapsed.compareTo(splitTime) > 0) { splitLoss = true; - splitTimer.setForeground(Settings.colorTimeGainedWhileBehind.get()); + splitTimer.setForeground(Settings.colorTimeLostWhileBehind.get()); } if (!segmentLoss && segmentElapsed.compareTo(segmentTime) > 0) { segmentLoss = true; - segmentTimer.setForeground(Settings.colorTimeGainedWhileBehind.get()); + segmentTimer.setForeground(Settings.colorTimeLostWhileBehind.get()); } } } diff --git a/src/main/java/org/fenix/llanfair/gui/Footer.java b/src/main/java/org/fenix/llanfair/gui/Footer.java index 058390e..d96b71a 100644 --- a/src/main/java/org/fenix/llanfair/gui/Footer.java +++ b/src/main/java/org/fenix/llanfair/gui/Footer.java @@ -182,7 +182,9 @@ void processPropertyChangeEvent(PropertyChangeEvent event) { updateColors(TIME | DELTA); updateVisibility(ALL); } else if (Settings.colorTimeGainedWhileBehind.equals(property) - || Settings.colorTimeGainedWhileAhead.equals(property)) { + || Settings.colorTimeLostWhileBehind.equals(property) + || Settings.colorTimeLostWhileAhead.equals(property) + || Settings.colorTimeGainedWhileAhead.equals(property)) { updateColors(DELTA); } else if (Settings.colorTime.equals(property) @@ -365,7 +367,7 @@ private void updateColors(int identifier) { } else { int compare = tmDlta.compareTo(Time.ZERO); if (compare > 0) { - delta.setForeground(Settings.colorTimeGainedWhileBehind.get()); + delta.setForeground(Settings.colorTimeLostWhileBehind.get()); } else { delta.setForeground(Settings.colorTimeGainedWhileAhead.get()); } diff --git a/src/main/java/org/fenix/llanfair/gui/Graph.java b/src/main/java/org/fenix/llanfair/gui/Graph.java index a578668..ba50f08 100644 --- a/src/main/java/org/fenix/llanfair/gui/Graph.java +++ b/src/main/java/org/fenix/llanfair/gui/Graph.java @@ -149,7 +149,9 @@ void processPropertyChangeEvent(PropertyChangeEvent event) { // or Run.CURRENT_SEGMENT_PROPERTY } else if (Settings.colorBackground.equals(property) || Settings.colorTimeGainedWhileBehind.equals(property) + || Settings.colorTimeLostWhileBehind.equals(property) || Settings.colorTimeGainedWhileAhead.equals(property) + || Settings.colorTimeLostWhileAhead.equals(property) || Settings.colorNewRecord.equals(property) || Run.CURRENT_SEGMENT_PROPERTY.equals(property)) { canvas.repaint(); @@ -311,7 +313,7 @@ protected class Canvas extends JPanel { Color colorFG = Settings.colorForeground.get(); Color colorTG = Settings.colorTimeGainedWhileAhead.get(); - Color colorTL = Settings.colorTimeGainedWhileBehind.get(); + Color colorTL = Settings.colorTimeLostWhileBehind.get(); Color colorRC = Settings.colorNewRecord.get(); // Draw the axis. diff --git a/src/main/java/org/fenix/llanfair/gui/History.java b/src/main/java/org/fenix/llanfair/gui/History.java index 6a96c69..125f2f9 100644 --- a/src/main/java/org/fenix/llanfair/gui/History.java +++ b/src/main/java/org/fenix/llanfair/gui/History.java @@ -256,8 +256,10 @@ void processPropertyChangeEvent(PropertyChangeEvent event) { || Settings.historyBlankRows.equals(property)) { populateRows(); } else if (Settings.colorTimeGainedWhileAhead.equals(property) - || Settings.colorTimeGainedWhileBehind.equals(property) - || Settings.colorNewRecord.equals(property)) { + || Settings.colorTimeLostWhileAhead.equals(property) + || Settings.colorTimeGainedWhileBehind.equals(property) + || Settings.colorTimeLostWhileBehind.equals(property) + || Settings.colorNewRecord.equals(property)) { updateColors(LIVE); } else if (Settings.colorHighlight.equals(property)) { updateColors(MARKER); @@ -611,8 +613,6 @@ void updateColors(int index, int identifier) { } } if ((identifier & LIVE) == LIVE && (index > -1)) { - Color lost = Settings.colorTimeGainedWhileBehind.get(); - Color gain = Settings.colorTimeGainedWhileAhead.get(); Color neut = Settings.colorTime.get(); Color recd = Settings.colorNewRecord.get(); int prev = run.getPrevious(); @@ -636,19 +636,23 @@ void updateColors(int index, int identifier) { } else { boolean isGainingTime = run.isBetterSegment(run.getPrevious()); if (compare > 0) { + Color color; if (isGainingTime) - realDelta.setForeground(Settings.colorTimeGainedWhileBehind.get()); + color = Settings.colorTimeGainedWhileBehind.get(); else - realDelta.setForeground(Settings.colorTimeLostWhileBehind.get()); + color = Settings.colorTimeLostWhileBehind.get(); - realLive.setForeground(lost); + realDelta.setForeground(color); + realLive.setForeground(color); } else { + Color color; if (isGainingTime) - realDelta.setForeground(Settings.colorTimeGainedWhileAhead.get()); + color = Settings.colorTimeGainedWhileAhead.get(); else - realDelta.setForeground(Settings.colorTimeLostWhileAhead.get()); + color = Settings.colorTimeLostWhileAhead.get(); - realLive.setForeground(gain); + realDelta.setForeground(color); + realLive.setForeground(color); } } } else {