X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fsave%2FExifSaver.java;h=d17c5d48fe4ca951ae58518b408c3724d7fbd5e5;hb=326f489e36aa7f235bc19409a57bf4955cd50f24;hp=986a07ee3052eaa33e3d5ad6e2626f93ca282d34;hpb=1ee49ae3c8ef3aa2e63eadd458531e5f8bd4f92c;p=GpsPrune.git diff --git a/tim/prune/save/ExifSaver.java b/tim/prune/save/ExifSaver.java index 986a07e..d17c5d4 100644 --- a/tim/prune/save/ExifSaver.java +++ b/tim/prune/save/ExifSaver.java @@ -8,6 +8,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; +import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -23,7 +24,6 @@ import tim.prune.ExternalTools; import tim.prune.I18nManager; import tim.prune.UpdateMessageBroker; import tim.prune.config.Config; -import tim.prune.data.Altitude; import tim.prune.data.Coordinate; import tim.prune.data.DataPoint; import tim.prune.data.Photo; @@ -129,7 +129,10 @@ public class ExifSaver implements Runnable { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); - panel.add(new JLabel(I18nManager.getText("dialog.saveexif.intro")), BorderLayout.NORTH); + // Label at top + JLabel topLabel = new JLabel(I18nManager.getText("dialog.saveexif.intro")); + topLabel.setBorder(BorderFactory.createEmptyBorder(8, 6, 5, 6)); + panel.add(topLabel, BorderLayout.NORTH); // centre panel with most controls JPanel centrePanel = new JPanel(); centrePanel.setLayout(new BorderLayout()); @@ -240,7 +243,7 @@ public class ExifSaver implements Runnable { // Only look at photos which are selected and whose status has changed since load photo = entry.getPhoto(); - if (photo != null && photo.getOriginalStatus() != photo.getCurrentStatus()) + if (photo != null && photo.isModified()) { // Increment counter if save successful if (savePhoto(photo, overwriteFlag, false)) { @@ -262,20 +265,17 @@ public class ExifSaver implements Runnable } _progressBar.setVisible(false); // Show confirmation - UpdateMessageBroker.informSubscribers(I18nManager.getText("confirm.saveexif.ok1") + " " - + numSaved + " " + I18nManager.getText("confirm.saveexif.ok2")); + UpdateMessageBroker.informSubscribers(I18nManager.getTextWithNumber("confirm.saveexif.ok", numSaved)); if (numFailed > 0) { JOptionPane.showMessageDialog(_parentFrame, - I18nManager.getText("error.saveexif.failed1") + " " + numFailed + " " - + I18nManager.getText("error.saveexif.failed2"), + I18nManager.getTextWithNumber("error.saveexif.failed", numFailed), I18nManager.getText("dialog.saveexif.title"), JOptionPane.ERROR_MESSAGE); } if (numForced > 0) { JOptionPane.showMessageDialog(_parentFrame, - I18nManager.getText("error.saveexif.forced1") + " " + numForced + " " - + I18nManager.getText("error.saveexif.forced2"), + I18nManager.getTextWithNumber("error.saveexif.forced", numForced), I18nManager.getText("dialog.saveexif.title"), JOptionPane.WARNING_MESSAGE); } // close dialog, all finished @@ -292,6 +292,10 @@ public class ExifSaver implements Runnable */ private boolean savePhoto(Photo inPhoto, boolean inOverwriteFlag, boolean inForceFlag) { + // If photos don't have a file, then can't save them + if (inPhoto.getFile() == null) { + return false; + } // Check whether photo file still exists if (!inPhoto.getFile().exists()) { @@ -407,7 +411,7 @@ public class ExifSaver implements Runnable result[paramOffset + 3] = "-GPSLongitudeRef=" + inPoint.getLongitude().output(Coordinate.FORMAT_CARDINAL); // add altitude if it has it result[paramOffset + 4] = "-GPSAltitude=" - + (inPoint.hasAltitude()?inPoint.getAltitude().getValue(Altitude.Format.METRES):0); + + (inPoint.hasAltitude()?inPoint.getAltitude().getMetricValue():0); result[paramOffset + 5] = "-GPSAltitudeRef='Above Sea Level'"; // add the filename to modify result[paramOffset + 6] = inFile.getAbsolutePath();