From 016ecd8acdaf4d4e3365fb506447d1e3893525d0 Mon Sep 17 00:00:00 2001 From: gered Date: Sun, 3 Jan 2016 16:03:12 -0500 Subject: [PATCH] add missing settings for various colors. resolves #9 --- .../java/org/fenix/llanfair/Language.java | 7 ++++-- .../org/fenix/llanfair/config/Settings.java | 14 ++++++++---- .../java/org/fenix/llanfair/gui/Core.java | 10 ++++----- .../java/org/fenix/llanfair/gui/Footer.java | 8 +++---- .../java/org/fenix/llanfair/gui/Graph.java | 8 +++---- .../java/org/fenix/llanfair/gui/History.java | 22 +++++++------------ src/main/resources/language.properties | 7 ++++-- 7 files changed, 41 insertions(+), 35 deletions(-) diff --git a/src/main/java/org/fenix/llanfair/Language.java b/src/main/java/org/fenix/llanfair/Language.java index 92c5169..f8d40b7 100644 --- a/src/main/java/org/fenix/llanfair/Language.java +++ b/src/main/java/org/fenix/llanfair/Language.java @@ -34,8 +34,11 @@ public enum Language { setting_color_foreground, setting_color_time, setting_color_timer, - setting_color_timeGained, - setting_color_timeLost, + setting_color_negativeTime, + setting_color_timeGainedWhileAhead, + setting_color_timeLostWhileAhead, + setting_color_timeGainedWhileBehind, + setting_color_timeLostWhileBehind, setting_color_newRecord, setting_color_title, setting_color_subTitle, diff --git a/src/main/java/org/fenix/llanfair/config/Settings.java b/src/main/java/org/fenix/llanfair/config/Settings.java index b1e1afb..de8d5c8 100644 --- a/src/main/java/org/fenix/llanfair/config/Settings.java +++ b/src/main/java/org/fenix/llanfair/config/Settings.java @@ -44,8 +44,11 @@ public class Settings { public static final Property colorForeground = new Property<>( "color.foreground" ); public static final Property colorTime = new Property<>( "color.time" ); public static final Property colorTimer = new Property<>( "color.timer" ); - public static final Property colorTimeGained = new Property<>( "color.timeGained" ); - public static final Property colorTimeLost = new Property<>( "color.timeLost" ); + public static final Property colorNegativeTime = new Property<>( "color.negativeTime" ); + public static final Property colorTimeGainedWhileAhead = new Property<>( "color.timeGainedWhileAhead" ); + public static final Property colorTimeLostWhileAhead = new Property<>( "color.timeLostWhileAhead" ); + public static final Property colorTimeGainedWhileBehind = new Property<>( "color.timeGainedWhileBehind" ); + public static final Property colorTimeLostWhileBehind = new Property<>( "color.timeLostWhileBehind" ); public static final Property colorNewRecord = new Property<>( "color.newRecord" ); public static final Property colorTitle = new Property<>( "color.title" ); public static final Property colorSubTitle = new Property<>( "color.subTitle" ); @@ -213,8 +216,11 @@ public class Settings { global.put( colorForeground.key, Color.decode( "0xc0c0c0" ) ); global.put( colorTime.key, Color.decode( "0xffffff" ) ); global.put( colorTimer.key, Color.decode( "0x22cc22" ) ); - global.put( colorTimeGained.key, Color.decode( "0x6295fc" ) ); - global.put( colorTimeLost.key, Color.decode( "0xe82323" ) ); + global.put( colorNegativeTime.key, Color.decode ("0x808080" ) ); + global.put( colorTimeGainedWhileAhead.key, Color.decode( "0x6295fc" ) ); + global.put( colorTimeLostWhileAhead.key, Color.decode( "0x99ccff" ) ); + global.put( colorTimeGainedWhileBehind.key, Color.decode( "0xff8e8e" ) ); + global.put( colorTimeLostWhileBehind.key, Color.decode( "0xe82323" ) ); global.put( colorNewRecord.key, Color.decode( "0xf0b012" ) ); global.put( colorTitle.key, Color.decode( "0xf0b012" ) ); global.put( colorSubTitle.key, Color.decode( "0xffffff" ) ); diff --git a/src/main/java/org/fenix/llanfair/gui/Core.java b/src/main/java/org/fenix/llanfair/gui/Core.java index da4354d..d090656 100644 --- a/src/main/java/org/fenix/llanfair/gui/Core.java +++ b/src/main/java/org/fenix/llanfair/gui/Core.java @@ -308,7 +308,7 @@ class Core extends JPanel implements ActionListener { Time segmentElapsed = new Time(now - current.getStartTime()); if (splitElapsed.getMilliseconds() < 0) - splitTimer.setForeground(Color.GRAY); + splitTimer.setForeground(Settings.colorNegativeTime.get()); else splitTimer.setForeground(Settings.colorTimer.get()); @@ -318,7 +318,7 @@ class Core extends JPanel implements ActionListener { Color bg = Settings.colorBackground.get(); if (splitTimer.getForeground().equals(bg)) { if (pauseTime.compareTo(splitTime) > 0) { - splitTimer.setForeground(Settings.colorTimeLost.get()); + splitTimer.setForeground(Settings.colorTimeGainedWhileBehind.get()); } else { splitTimer.setForeground(Settings.colorTimer.get()); } @@ -338,11 +338,11 @@ class Core extends JPanel implements ActionListener { if (!splitLoss && splitElapsed.compareTo(splitTime) > 0) { splitLoss = true; - splitTimer.setForeground(Settings.colorTimeLost.get()); + splitTimer.setForeground(Settings.colorTimeGainedWhileBehind.get()); } if (!segmentLoss && segmentElapsed.compareTo(segmentTime) > 0) { segmentLoss = true; - segmentTimer.setForeground(Settings.colorTimeLost.get()); + segmentTimer.setForeground(Settings.colorTimeGainedWhileBehind.get()); } } } @@ -605,7 +605,7 @@ class Core extends JPanel implements ActionListener { synchronized (this) { Color color = Settings.colorTimer.get(); if (isShowingNegativeTime() && run.getState() == State.READY) - splitTimer.setForeground(Color.GRAY); + splitTimer.setForeground(Settings.colorNegativeTime.get()); else splitTimer.setForeground(color); segmentTimer.setForeground(color); diff --git a/src/main/java/org/fenix/llanfair/gui/Footer.java b/src/main/java/org/fenix/llanfair/gui/Footer.java index 474346c..37f9025 100644 --- a/src/main/java/org/fenix/llanfair/gui/Footer.java +++ b/src/main/java/org/fenix/llanfair/gui/Footer.java @@ -179,8 +179,8 @@ class Footer extends JPanel { updateValues(ALL & ~TEXT); updateColors(TIME | DELTA); updateVisibility(ALL); - } else if (Settings.colorTimeLost.equals(property) - || Settings.colorTimeGained.equals(property)) { + } else if (Settings.colorTimeGainedWhileBehind.equals(property) + || Settings.colorTimeGainedWhileAhead.equals(property)) { updateColors(DELTA); } else if (Settings.colorTime.equals(property) @@ -363,9 +363,9 @@ class Footer extends JPanel { } else { int compare = tmDlta.compareTo(Time.ZERO); if (compare > 0) { - delta.setForeground(Settings.colorTimeLost.get()); + delta.setForeground(Settings.colorTimeGainedWhileBehind.get()); } else { - delta.setForeground(Settings.colorTimeGained.get()); + 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 69c7723..a578668 100644 --- a/src/main/java/org/fenix/llanfair/gui/Graph.java +++ b/src/main/java/org/fenix/llanfair/gui/Graph.java @@ -148,8 +148,8 @@ class Graph extends JPanel { // Settings.COLOR_BACKGROUND, COLOR_TIME_LOST, COLOR_TIME_GAINED // or Run.CURRENT_SEGMENT_PROPERTY } else if (Settings.colorBackground.equals(property) - || Settings.colorTimeLost.equals(property) - || Settings.colorTimeGained.equals(property) + || Settings.colorTimeGainedWhileBehind.equals(property) + || Settings.colorTimeGainedWhileAhead.equals(property) || Settings.colorNewRecord.equals(property) || Run.CURRENT_SEGMENT_PROPERTY.equals(property)) { canvas.repaint(); @@ -310,8 +310,8 @@ class Graph extends JPanel { g2.fillRect(0, 0, clipW, clipH); Color colorFG = Settings.colorForeground.get(); - Color colorTG = Settings.colorTimeGained.get(); - Color colorTL = Settings.colorTimeLost.get(); + Color colorTG = Settings.colorTimeGainedWhileAhead.get(); + Color colorTL = Settings.colorTimeGainedWhileBehind.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 c09e210..6a96c69 100644 --- a/src/main/java/org/fenix/llanfair/gui/History.java +++ b/src/main/java/org/fenix/llanfair/gui/History.java @@ -255,8 +255,8 @@ public class History extends JPanel { } else if (Settings.historyRowCount.equals(property) || Settings.historyBlankRows.equals(property)) { populateRows(); - } else if (Settings.colorTimeGained.equals(property) - || Settings.colorTimeLost.equals(property) + } else if (Settings.colorTimeGainedWhileAhead.equals(property) + || Settings.colorTimeGainedWhileBehind.equals(property) || Settings.colorNewRecord.equals(property)) { updateColors(LIVE); } else if (Settings.colorHighlight.equals(property)) { @@ -611,18 +611,12 @@ public class History extends JPanel { } } if ((identifier & LIVE) == LIVE && (index > -1)) { - Color lost = Settings.colorTimeLost.get(); - Color gain = Settings.colorTimeGained.get(); + Color lost = Settings.colorTimeGainedWhileBehind.get(); + Color gain = Settings.colorTimeGainedWhileAhead.get(); Color neut = Settings.colorTime.get(); Color recd = Settings.colorNewRecord.get(); int prev = run.getPrevious(); - // TODO: replace with color settings the user can set themselves - Color lostWhileAhead = gain.brighter(); - Color gainWhileAhead = gain; //.darker(); - Color lostWhileBehind = lost.brighter(); - Color gainWhileBehind = lost; //.darker(); - Merge merge = Settings.historyMerge.get(); JLabel realDelta = (merge == Merge.DELTA) ? time : delta; JLabel realLive = (merge == Merge.LIVE ) ? time : live; @@ -643,16 +637,16 @@ public class History extends JPanel { boolean isGainingTime = run.isBetterSegment(run.getPrevious()); if (compare > 0) { if (isGainingTime) - realDelta.setForeground(gainWhileBehind); + realDelta.setForeground(Settings.colorTimeGainedWhileBehind.get()); else - realDelta.setForeground(lostWhileBehind); + realDelta.setForeground(Settings.colorTimeLostWhileBehind.get()); realLive.setForeground(lost); } else { if (isGainingTime) - realDelta.setForeground(gainWhileAhead); + realDelta.setForeground(Settings.colorTimeGainedWhileAhead.get()); else - realDelta.setForeground(lostWhileAhead); + realDelta.setForeground(Settings.colorTimeLostWhileAhead.get()); realLive.setForeground(gain); } diff --git a/src/main/resources/language.properties b/src/main/resources/language.properties index fc4399c..e159cc4 100644 --- a/src/main/resources/language.properties +++ b/src/main/resources/language.properties @@ -15,8 +15,11 @@ setting_color_background = Background setting_color_foreground = Foreground setting_color_time = Time setting_color_timer = Timer -setting_color_timeGained = Time Gained -setting_color_timeLost = Time Lost +setting_color_negativeTime = Negative Time +setting_color_timeGainedWhileAhead = Time Gained (While Ahead) +setting_color_timeLostWhileAhead = Time Lost (While Ahead) +setting_color_timeGainedWhileBehind = Time Gained (While Behind) +setting_color_timeLostWhileBehind = Time Lost (While Behind) setting_color_newRecord = New Record setting_color_title = Title setting_color_subTitle = Sub Title