Changeset 7310 in josm


Ignore:
Timestamp:
2014-07-15T15:30:05+02:00 (10 years ago)
Author:
Don-vip
Message:

fix #10266 - fix issue with audio marker synchronisation

Location:
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java

    r7005 r7310  
    7171    public GpxLayer fromLayer = null;
    7272    private Marker currentMarker;
     73    public AudioMarker syncAudioMarker = null;
    7374
    7475    public MarkerLayer(GpxData indata, String name, File associatedFile, GpxLayer fromLayer) {
     
    258259    }
    259260
    260     public boolean synchronizeAudioMarkers(AudioMarker startMarker) {
    261         if (startMarker != null && ! data.contains(startMarker)) {
    262             startMarker = null;
    263         }
    264         if (startMarker == null) {
     261    public boolean synchronizeAudioMarkers(final AudioMarker startMarker) {
     262        syncAudioMarker = startMarker;
     263        if (syncAudioMarker != null && ! data.contains(syncAudioMarker)) {
     264            syncAudioMarker = null;
     265        }
     266        if (syncAudioMarker == null) {
    265267            // find the first audioMarker in this layer
    266268            for (Marker m : data) {
    267269                if (m instanceof AudioMarker) {
    268                     startMarker = (AudioMarker) m;
     270                    syncAudioMarker = (AudioMarker) m;
    269271                    break;
    270272                }
    271273            }
    272274        }
    273         if (startMarker == null)
     275        if (syncAudioMarker == null)
    274276            return false;
    275277
    276278        // apply adjustment to all subsequent audio markers in the layer
    277         double adjustment = AudioPlayer.position() - startMarker.offset; // in seconds
     279        double adjustment = AudioPlayer.position() - syncAudioMarker.offset; // in seconds
    278280        boolean seenStart = false;
    279281        try {
    280             URI uri = startMarker.url().toURI();
     282            URI uri = syncAudioMarker.url().toURI();
    281283            for (Marker m : data) {
    282                 if (m == startMarker) {
     284                if (m == syncAudioMarker) {
    283285                    seenStart = true;
    284286                }
     
    516518                JOptionPane.showMessageDialog(
    517519                        Main.parent,
    518                         tr("Audio synchronized at point {0}.", recent.getText()),
     520                        tr("Audio synchronized at point {0}.", syncAudioMarker.getText()),
    519521                        tr("Information"),
    520522                        JOptionPane.INFORMATION_MESSAGE
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java

    r7094 r7310  
    247247            JOptionPane.showMessageDialog(
    248248                    Main.parent,
    249                     tr("Audio synchronized at point {0}.", ca.getText()),
     249                    tr("Audio synchronized at point {0}.", recent.parentLayer.syncAudioMarker.getText()),
    250250                    tr("Information"),
    251251                    JOptionPane.INFORMATION_MESSAGE
    252252                    );
    253             setCoor(ca.getCoor());
     253            setCoor(recent.parentLayer.syncAudioMarker.getCoor());
    254254            endDrag(false);
    255255        } else {
Note: See TracChangeset for help on using the changeset viewer.