X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Ffunction%2Fcharts%2FCharter.java;h=01bf16c48d27a6f6b5b22bfc1ed4a080dcd9c55e;hp=a3348c8ce0e35e8da11c4aa39062b9b18abdab28;hb=112bb0c9b46894adca9a33ed8c99ea712b253185;hpb=54b9d8bc8f0025ccf97a67d9dd217ef1f9cf082f diff --git a/tim/prune/function/charts/Charter.java b/tim/prune/function/charts/Charter.java index a3348c8..01bf16c 100644 --- a/tim/prune/function/charts/Charter.java +++ b/tim/prune/function/charts/Charter.java @@ -87,6 +87,12 @@ public class Charter extends GenericFunction */ public void begin() { + // First check if gnuplot is available + if (!ExternalTools.isToolInstalled(ExternalTools.TOOL_GNUPLOT)) + { + _app.showErrorMessage(getNameKey(), "dialog.charts.gnuplotnotfound"); + return; + } // Make dialog window if (_dialog == null) { @@ -183,14 +189,6 @@ public class Charter extends GenericFunction // button panel on bottom JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); - // Gnuplot button - JButton gnuplotButton = new JButton(I18nManager.getText("button.gnuplotpath")); - gnuplotButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - setGnuplotPath(); - } - }); - buttonPanel.add(gnuplotButton); // Cancel button JButton cancelButton = new JButton(I18nManager.getText("button.cancel")); cancelButton.addActionListener(new ActionListener() { @@ -277,7 +275,8 @@ public class Charter extends GenericFunction OutputStreamWriter writer = null; try { - Process process = Runtime.getRuntime().exec(Config.getGnuplotPath() + " -persist"); + final String gnuplotPath = Config.getConfigString(Config.KEY_GNUPLOT_PATH); + Process process = Runtime.getRuntime().exec(gnuplotPath + " -persist"); writer = new OutputStreamWriter(process.getOutputStream()); if (showSvg) { @@ -439,7 +438,7 @@ public class Charter extends GenericFunction */ private static String getUnitsLabel(String inMetric, String inImperial) { - String key = Config.getUseMetricUnits()?inMetric:inImperial; + String key = Config.getConfigBoolean(Config.KEY_METRIC_UNITS)?inMetric:inImperial; return I18nManager.getText(key); } @@ -462,7 +461,7 @@ public class Charter extends GenericFunction { totalRads += DataPoint.calculateRadiansBetween(prevPoint, currPoint); } - if (Config.getUseMetricUnits()) { + if (Config.getConfigBoolean(Config.KEY_METRIC_UNITS)) { values.setData(i, Distance.convertRadiansToDistance(totalRads, Units.KILOMETRES)); } else { values.setData(i, Distance.convertRadiansToDistance(totalRads, Units.MILES)); @@ -507,7 +506,7 @@ public class Charter extends GenericFunction private static ChartSeries getAltitudeValues(Track inTrack) { ChartSeries values = new ChartSeries(inTrack.getNumPoints()); - Altitude.Format altFormat = Config.getUseMetricUnits()?Altitude.Format.METRES:Altitude.Format.FEET; + Altitude.Format altFormat = Config.getConfigBoolean(Config.KEY_METRIC_UNITS)?Altitude.Format.METRES:Altitude.Format.FEET; for (int i=0; i