changeset 595:b23bebfdfaba

Untabify
author Chris Cannam
date Thu, 01 Mar 2018 18:02:22 +0000
parents 72b4870f0e6b
children c99892f0c5c3
files audio/AudioCallbackPlaySource.cpp audio/AudioCallbackPlaySource.h audio/AudioGenerator.cpp audio/AudioGenerator.h audio/ClipMixer.cpp audio/ClipMixer.h framework/Align.cpp framework/Document.cpp framework/Document.h framework/MainWindowBase.cpp framework/MainWindowBase.h framework/SVFileReader.cpp framework/SVFileReader.h framework/TransformUserConfigurator.cpp framework/TransformUserConfigurator.h framework/VersionTester.cpp
diffstat 16 files changed, 1153 insertions(+), 1153 deletions(-) [+]
line wrap: on
line diff
--- a/audio/AudioCallbackPlaySource.cpp	Tue Mar 07 11:48:29 2017 +0000
+++ b/audio/AudioCallbackPlaySource.cpp	Thu Mar 01 18:02:22 2018 +0000
@@ -90,18 +90,18 @@
     m_viewManager->setAudioPlaySource(this);
 
     connect(m_viewManager, SIGNAL(selectionChanged()),
-	    this, SLOT(selectionChanged()));
+            this, SLOT(selectionChanged()));
     connect(m_viewManager, SIGNAL(playLoopModeChanged()),
-	    this, SLOT(playLoopModeChanged()));
+            this, SLOT(playLoopModeChanged()));
     connect(m_viewManager, SIGNAL(playSelectionModeChanged()),
-	    this, SLOT(playSelectionModeChanged()));
+            this, SLOT(playSelectionModeChanged()));
 
     connect(this, SIGNAL(playStatusChanged(bool)),
             m_viewManager, SLOT(playStatusChanged(bool)));
 
     connect(PlayParameterRepository::getInstance(),
-	    SIGNAL(playParametersChanged(PlayParameters *)),
-	    this, SLOT(playParametersChanged(PlayParameters *)));
+            SIGNAL(playParametersChanged(PlayParameters *)),
+            this, SLOT(playParametersChanged(PlayParameters *)));
 
     connect(Preferences::getInstance(),
             SIGNAL(propertyChanged(PropertyContainer::PropertyName)),
@@ -120,14 +120,14 @@
     cout << "AudioCallbackPlaySource dtor: awakening thread" << endl;
 #endif
         m_condition.wakeAll();
-	m_fillThread->wait();
-	delete m_fillThread;
+        m_fillThread->wait();
+        delete m_fillThread;
     }
 
     clearModels();
     
     if (m_readBuffers != m_writeBuffers) {
-	delete m_readBuffers;
+        delete m_readBuffers;
     }
 
     delete m_writeBuffers;
@@ -161,7 +161,7 @@
 
     m_models.insert(model);
     if (model->getEndFrame() > m_lastModelEndFrame) {
-	m_lastModelEndFrame = model->getEndFrame();
+        m_lastModelEndFrame = model->getEndFrame();
     }
 
     bool buffersIncreased = false, srChanged = false;
@@ -170,7 +170,7 @@
     ReadOnlyWaveFileModel *rowfm = qobject_cast<ReadOnlyWaveFileModel *>(model);
     if (rowfm) modelChannels = rowfm->getChannelCount();
     if (modelChannels > m_sourceChannelCount) {
-	m_sourceChannelCount = modelChannels;
+        m_sourceChannelCount = modelChannels;
     }
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
@@ -182,8 +182,8 @@
         SVDEBUG << "AudioCallbackPlaySource::addModel: Source rate changing from 0 to "
             << model->getSampleRate() << endl;
 
-	m_sourceSampleRate = model->getSampleRate();
-	srChanged = true;
+        m_sourceSampleRate = model->getSampleRate();
+        srChanged = true;
 
     } else if (model->getSampleRate() != m_sourceSampleRate) {
 
@@ -238,10 +238,10 @@
     if (!m_writeBuffers || (int)m_writeBuffers->size() < getTargetChannelCount()) {
         cerr << "m_writeBuffers size = " << (m_writeBuffers ? m_writeBuffers->size() : 0) << endl;
         cerr << "target channel count = " << (getTargetChannelCount()) << endl;
-	clearRingBuffers(true, getTargetChannelCount());
-	buffersIncreased = true;
+        clearRingBuffers(true, getTargetChannelCount());
+        buffersIncreased = true;
     } else {
-	if (willPlay) clearRingBuffers(true);
+        if (willPlay) clearRingBuffers(true);
     }
 
     if (srChanged) {
@@ -283,8 +283,8 @@
     }
     
     if (!m_fillThread) {
-	m_fillThread = new FillThread(*this);
-	m_fillThread->start();
+        m_fillThread = new FillThread(*this);
+        m_fillThread->start();
     }
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
@@ -338,20 +338,20 @@
     // last one, then we save work by not having reset this here
     //
 //    if (m_models.empty()) {
-//	m_sourceSampleRate = 0;
+//        m_sourceSampleRate = 0;
 //    }
 
     sv_frame_t lastEnd = 0;
     for (std::set<Model *>::const_iterator i = m_models.begin();
-	 i != m_models.end(); ++i) {
+         i != m_models.end(); ++i) {
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
-	cout << "AudioCallbackPlaySource::removeModel(" << model << "): checking end frame on model " << *i << endl;
+        cout << "AudioCallbackPlaySource::removeModel(" << model << "): checking end frame on model " << *i << endl;
 #endif
-	if ((*i)->getEndFrame() > lastEnd) {
+        if ((*i)->getEndFrame() > lastEnd) {
             lastEnd = (*i)->getEndFrame();
         }
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
-	cout << "(done, lastEnd now " << lastEnd << ")" << endl;
+        cout << "(done, lastEnd now " << lastEnd << ")" << endl;
 #endif
     }
     m_lastModelEndFrame = lastEnd;
@@ -397,7 +397,7 @@
     rebuildRangeLists();
 
     if (count == 0) {
-	if (m_writeBuffers) count = int(m_writeBuffers->size());
+        if (m_writeBuffers) count = int(m_writeBuffers->size());
     }
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
@@ -413,22 +413,22 @@
 #endif
 
     if (m_readBuffers != m_writeBuffers) {
-	delete m_writeBuffers;
+        delete m_writeBuffers;
     }
 
     m_writeBuffers = new RingBufferVector;
 
     for (int i = 0; i < count; ++i) {
-	m_writeBuffers->push_back(new RingBuffer<float>(m_ringBufferSize));
+        m_writeBuffers->push_back(new RingBuffer<float>(m_ringBufferSize));
     }
 
     m_audioGenerator->reset();
     
 //    cout << "AudioCallbackPlaySource::clearRingBuffers: Created "
-//	      << count << " write buffers" << endl;
+//              << count << " write buffers" << endl;
 
     if (!haveLock) {
-	m_mutex.unlock();
+        m_mutex.unlock();
     }
 }
 
@@ -443,7 +443,7 @@
     }
     
     if (m_viewManager->getPlaySelectionMode() &&
-	!m_viewManager->getSelections().empty()) {
+        !m_viewManager->getSelections().empty()) {
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
         cout << "AudioCallbackPlaySource::play: constraining frame " << startFrame << " to selection = ";
@@ -459,9 +459,9 @@
         if (startFrame < 0) {
             startFrame = 0;
         }
-	if (startFrame >= m_lastModelEndFrame) {
-	    startFrame = 0;
-	}
+        if (startFrame >= m_lastModelEndFrame) {
+            startFrame = 0;
+        }
     }
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
@@ -556,7 +556,7 @@
 AudioCallbackPlaySource::selectionChanged()
 {
     if (m_viewManager->getPlaySelectionMode()) {
-	clearRingBuffers();
+        clearRingBuffers();
     }
 }
 
@@ -570,7 +570,7 @@
 AudioCallbackPlaySource::playSelectionModeChanged()
 {
     if (!m_viewManager->getSelections().empty()) {
-	clearRingBuffers();
+        clearRingBuffers();
     }
 }
 
@@ -712,11 +712,11 @@
     int inbuffer = 0; // at target rate
 
     for (int c = 0; c < getTargetChannelCount(); ++c) {
-	RingBuffer<float> *rb = getReadRingBuffer(c);
-	if (rb) {
-	    int here = rb->getReadSpace();
-	    if (c == 0 || here < inbuffer) inbuffer = here;
-	}
+        RingBuffer<float> *rb = getReadRingBuffer(c);
+        if (rb) {
+            int here = rb->getReadSpace();
+            if (c == 0 || here < inbuffer) inbuffer = here;
+        }
     }
 
     sv_frame_t readBufferFill = m_readBufferFill;
@@ -1144,7 +1144,7 @@
         cout << "AudioCallbackPlaySource::getSourceSamples: Not playing" << endl;
 #endif
         v_zero_channels(buffer, requestedChannels, count);
-	return 0;
+        return 0;
     }
     if (requestedChannels < channels) {
         SVDEBUG << "AudioCallbackPlaySource::getSourceSamples: Not enough device channels (" << requestedChannels << ", need " << channels << "); hoping device is about to be reopened" << endl;
@@ -1223,36 +1223,36 @@
 
     if (!ts || ratio == 1.f) {
 
-	int got = 0;
+        int got = 0;
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING
         cout << "channels == " << channels << endl;
 #endif
         
-	for (int ch = 0; ch < channels; ++ch) {
+        for (int ch = 0; ch < channels; ++ch) {
 
-	    RingBuffer<float> *rb = getReadRingBuffer(ch);
+            RingBuffer<float> *rb = getReadRingBuffer(ch);
 
-	    if (rb) {
+            if (rb) {
 
-		// this is marginally more likely to leave our channels in
-		// sync after a processing failure than just passing "count":
-		sv_frame_t request = count;
-		if (ch > 0) request = got;
+                // this is marginally more likely to leave our channels in
+                // sync after a processing failure than just passing "count":
+                sv_frame_t request = count;
+                if (ch > 0) request = got;
 
-		got = rb->read(buffer[ch], int(request));
-	    
+                got = rb->read(buffer[ch], int(request));
+            
 #ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING
-		cout << "AudioCallbackPlaySource::getSamples: got " << got << " (of " << count << ") samples on channel " << ch << ", signalling for more (possibly)" << endl;
+                cout << "AudioCallbackPlaySource::getSamples: got " << got << " (of " << count << ") samples on channel " << ch << ", signalling for more (possibly)" << endl;
 #endif
-	    }
+            }
 
-	    for (int ch = 0; ch < channels; ++ch) {
-		for (int i = got; i < count; ++i) {
-		    buffer[ch][i] = 0.0;
-		}
-	    }
-	}
+            for (int ch = 0; ch < channels; ++ch) {
+                for (int i = got; i < count; ++i) {
+                    buffer[ch][i] = 0.0;
+                }
+            }
+        }
 
         applyAuditioningEffect(count, buffer);
 
@@ -1262,7 +1262,7 @@
 
         m_condition.wakeAll();
 
-	return got;
+        return got;
     }
 
     sv_frame_t available;
@@ -1405,11 +1405,11 @@
 
     sv_frame_t space = 0;
     for (int c = 0; c < getTargetChannelCount(); ++c) {
-	RingBuffer<float> *wb = getWriteRingBuffer(c);
-	if (wb) {
-	    sv_frame_t spaceHere = wb->getWriteSpace();
-	    if (c == 0 || spaceHere < space) space = spaceHere;
-	}
+        RingBuffer<float> *wb = getWriteRingBuffer(c);
+        if (wb) {
+            sv_frame_t spaceHere = wb->getWriteSpace();
+            if (c == 0 || spaceHere < space) space = spaceHere;
+        }
     }
     
     if (space == 0) {
@@ -1423,7 +1423,7 @@
     // channel's write ringbuffer
     
     sv_frame_t f = m_writeBufferFill;
-	
+        
     bool readWriteEqual = (m_readBuffers == m_writeBuffers);
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
@@ -1443,9 +1443,9 @@
     static int bufferPtrCount = 0;
 
     if (bufferPtrCount < channels) {
-	if (bufferPtrs) delete[] bufferPtrs;
-	bufferPtrs = new float *[channels];
-	bufferPtrCount = channels;
+        if (bufferPtrs) delete[] bufferPtrs;
+        bufferPtrs = new float *[channels];
+        bufferPtrCount = channels;
     }
 
     sv_frame_t generatorBlockSize = m_audioGenerator->getBlockSize();
@@ -1471,7 +1471,7 @@
     for (int c = 0; c < channels; ++c) {
 
         bufferPtrs[c] = tmp + c * space;
-	    
+            
         for (int i = 0; i < space; ++i) {
             tmp[c * space + i] = 0.0f;
         }
@@ -1521,7 +1521,7 @@
     
     bool looping = m_viewManager->getPlayLoopMode();
     bool constrained = (m_viewManager->getPlaySelectionMode() &&
-			!m_viewManager->getSelections().empty());
+                        !m_viewManager->getSelections().empty());
 
     int channels = getTargetChannelCount();
 
@@ -1543,137 +1543,137 @@
     static int chunkBufferPtrCount = 0;
 
     if (chunkBufferPtrCount < channels) {
-	if (chunkBufferPtrs) delete[] chunkBufferPtrs;
-	chunkBufferPtrs = new float *[channels];
-	chunkBufferPtrCount = channels;
+        if (chunkBufferPtrs) delete[] chunkBufferPtrs;
+        chunkBufferPtrs = new float *[channels];
+        chunkBufferPtrCount = channels;
     }
 
     for (int c = 0; c < channels; ++c) {
-	chunkBufferPtrs[c] = buffers[c];
+        chunkBufferPtrs[c] = buffers[c];
     }
 
     while (processed < count) {
-	
-	chunkSize = count - processed;
-	nextChunkStart = chunkStart + chunkSize;
-	selectionSize = 0;
+        
+        chunkSize = count - processed;
+        nextChunkStart = chunkStart + chunkSize;
+        selectionSize = 0;
 
-	sv_frame_t fadeIn = 0, fadeOut = 0;
+        sv_frame_t fadeIn = 0, fadeOut = 0;
 
-	if (constrained) {
+        if (constrained) {
 
             sv_frame_t rChunkStart =
                 m_viewManager->alignPlaybackFrameToReference(chunkStart);
-	    
-	    Selection selection =
-		m_viewManager->getContainingSelection(rChunkStart, true);
-	    
-	    if (selection.isEmpty()) {
-		if (looping) {
-		    selection = *m_viewManager->getSelections().begin();
-		    chunkStart = m_viewManager->alignReferenceToPlaybackFrame
+            
+            Selection selection =
+                m_viewManager->getContainingSelection(rChunkStart, true);
+            
+            if (selection.isEmpty()) {
+                if (looping) {
+                    selection = *m_viewManager->getSelections().begin();
+                    chunkStart = m_viewManager->alignReferenceToPlaybackFrame
                         (selection.getStartFrame());
-		    fadeIn = 50;
-		}
-	    }
+                    fadeIn = 50;
+                }
+            }
 
-	    if (selection.isEmpty()) {
+            if (selection.isEmpty()) {
 
-		chunkSize = 0;
-		nextChunkStart = chunkStart;
+                chunkSize = 0;
+                nextChunkStart = chunkStart;
 
-	    } else {
+            } else {
 
                 sv_frame_t sf = m_viewManager->alignReferenceToPlaybackFrame
                     (selection.getStartFrame());
                 sv_frame_t ef = m_viewManager->alignReferenceToPlaybackFrame
                     (selection.getEndFrame());
 
-		selectionSize = ef - sf;
+                selectionSize = ef - sf;
 
-		if (chunkStart < sf) {
-		    chunkStart = sf;
-		    fadeIn = 50;
-		}
+                if (chunkStart < sf) {
+                    chunkStart = sf;
+                    fadeIn = 50;
+                }
 
-		nextChunkStart = chunkStart + chunkSize;
+                nextChunkStart = chunkStart + chunkSize;
 
-		if (nextChunkStart >= ef) {
-		    nextChunkStart = ef;
-		    fadeOut = 50;
-		}
+                if (nextChunkStart >= ef) {
+                    nextChunkStart = ef;
+                    fadeOut = 50;
+                }
 
-		chunkSize = nextChunkStart - chunkStart;
-	    }
-	
-	} else if (looping && m_lastModelEndFrame > 0) {
+                chunkSize = nextChunkStart - chunkStart;
+            }
+        
+        } else if (looping && m_lastModelEndFrame > 0) {
 
-	    if (chunkStart >= m_lastModelEndFrame) {
-		chunkStart = 0;
-	    }
-	    if (chunkSize > m_lastModelEndFrame - chunkStart) {
-		chunkSize = m_lastModelEndFrame - chunkStart;
-	    }
-	    nextChunkStart = chunkStart + chunkSize;
-	}
+            if (chunkStart >= m_lastModelEndFrame) {
+                chunkStart = 0;
+            }
+            if (chunkSize > m_lastModelEndFrame - chunkStart) {
+                chunkSize = m_lastModelEndFrame - chunkStart;
+            }
+            nextChunkStart = chunkStart + chunkSize;
+        }
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING
-	cout << "chunkStart " << chunkStart << ", chunkSize " << chunkSize << ", nextChunkStart " << nextChunkStart << ", frame " << frame << ", count " << count << ", processed " << processed << endl;
+        cout << "chunkStart " << chunkStart << ", chunkSize " << chunkSize << ", nextChunkStart " << nextChunkStart << ", frame " << frame << ", count " << count << ", processed " << processed << endl;
 #endif
         
-	if (!chunkSize) {
-	    // We need to maintain full buffers so that the other
-	    // thread can tell where it's got to in the playback -- so
-	    // return the full amount here
-	    frame = frame + count;
+        if (!chunkSize) {
+            // We need to maintain full buffers so that the other
+            // thread can tell where it's got to in the playback -- so
+            // return the full amount here
+            frame = frame + count;
             if (frame < nextChunkStart) {
                 frame = nextChunkStart;
             }
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
-	    cout << "mixModels: ending at " << nextChunkStart << ", returning frame as "
+            cout << "mixModels: ending at " << nextChunkStart << ", returning frame as "
                  << frame << endl;
 #endif
-	    return count;
-	}
+            return count;
+        }
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
-	cout << "mixModels: chunk at " << chunkStart << " -> " << nextChunkStart << " (size " << chunkSize << ")" << endl;
+        cout << "mixModels: chunk at " << chunkStart << " -> " << nextChunkStart << " (size " << chunkSize << ")" << endl;
 #endif
 
-	if (selectionSize < 100) {
-	    fadeIn = 0;
-	    fadeOut = 0;
-	} else if (selectionSize < 300) {
-	    if (fadeIn > 0) fadeIn = 10;
-	    if (fadeOut > 0) fadeOut = 10;
-	}
+        if (selectionSize < 100) {
+            fadeIn = 0;
+            fadeOut = 0;
+        } else if (selectionSize < 300) {
+            if (fadeIn > 0) fadeIn = 10;
+            if (fadeOut > 0) fadeOut = 10;
+        }
 
-	if (fadeIn > 0) {
-	    if (processed * 2 < fadeIn) {
-		fadeIn = processed * 2;
-	    }
-	}
+        if (fadeIn > 0) {
+            if (processed * 2 < fadeIn) {
+                fadeIn = processed * 2;
+            }
+        }
 
-	if (fadeOut > 0) {
-	    if ((count - processed - chunkSize) * 2 < fadeOut) {
-		fadeOut = (count - processed - chunkSize) * 2;
-	    }
-	}
+        if (fadeOut > 0) {
+            if ((count - processed - chunkSize) * 2 < fadeOut) {
+                fadeOut = (count - processed - chunkSize) * 2;
+            }
+        }
 
-	for (std::set<Model *>::iterator mi = m_models.begin();
-	     mi != m_models.end(); ++mi) {
-	    
-	    (void) m_audioGenerator->mixModel(*mi, chunkStart, 
+        for (std::set<Model *>::iterator mi = m_models.begin();
+             mi != m_models.end(); ++mi) {
+            
+            (void) m_audioGenerator->mixModel(*mi, chunkStart, 
                                               chunkSize, chunkBufferPtrs,
                                               fadeIn, fadeOut);
-	}
+        }
 
-	for (int c = 0; c < channels; ++c) {
-	    chunkBufferPtrs[c] += chunkSize;
-	}
+        for (int c = 0; c < channels; ++c) {
+            chunkBufferPtrs[c] += chunkSize;
+        }
 
-	processed += chunkSize;
-	chunkStart = nextChunkStart;
+        processed += chunkSize;
+        chunkStart = nextChunkStart;
     }
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
@@ -1691,31 +1691,31 @@
 
     // only unify if there will be something to read
     for (int c = 0; c < getTargetChannelCount(); ++c) {
-	RingBuffer<float> *wb = getWriteRingBuffer(c);
-	if (wb) {
-	    if (wb->getReadSpace() < m_blockSize * 2) {
-		if ((m_writeBufferFill + m_blockSize * 2) < 
-		    m_lastModelEndFrame) {
-		    // OK, we don't have enough and there's more to
-		    // read -- don't unify until we can do better
+        RingBuffer<float> *wb = getWriteRingBuffer(c);
+        if (wb) {
+            if (wb->getReadSpace() < m_blockSize * 2) {
+                if ((m_writeBufferFill + m_blockSize * 2) < 
+                    m_lastModelEndFrame) {
+                    // OK, we don't have enough and there's more to
+                    // read -- don't unify until we can do better
 #ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING
                     cout << "AudioCallbackPlaySource::unifyRingBuffers: Not unifying: write buffer has less (" << wb->getReadSpace() << ") than " << m_blockSize*2 << " to read and write buffer fill (" << m_writeBufferFill << ") is not close to end frame (" << m_lastModelEndFrame << ")" << endl;
 #endif
-		    return;
-		}
-	    }
-	    break;
-	}
+                    return;
+                }
+            }
+            break;
+        }
     }
 
     sv_frame_t rf = m_readBufferFill;
     RingBuffer<float> *rb = getReadRingBuffer(0);
     if (rb) {
-	int rs = rb->getReadSpace();
-	//!!! incorrect when in non-contiguous selection, see comments elsewhere
-//	cout << "rs = " << rs << endl;
-	if (rs < rf) rf -= rs;
-	else rf = 0;
+        int rs = rb->getReadSpace();
+        //!!! incorrect when in non-contiguous selection, see comments elsewhere
+//        cout << "rs = " << rs << endl;
+        if (rs < rf) rf -= rs;
+        else rf = 0;
     }
     
 #ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING
@@ -1725,26 +1725,26 @@
     sv_frame_t wf = m_writeBufferFill;
     sv_frame_t skip = 0;
     for (int c = 0; c < getTargetChannelCount(); ++c) {
-	RingBuffer<float> *wb = getWriteRingBuffer(c);
-	if (wb) {
-	    if (c == 0) {
-		
-		int wrs = wb->getReadSpace();
-//		cout << "wrs = " << wrs << endl;
+        RingBuffer<float> *wb = getWriteRingBuffer(c);
+        if (wb) {
+            if (c == 0) {
+                
+                int wrs = wb->getReadSpace();
+//                cout << "wrs = " << wrs << endl;
 
-		if (wrs < wf) wf -= wrs;
-		else wf = 0;
-//		cout << "wf = " << wf << endl;
-		
-		if (wf < rf) skip = rf - wf;
-		if (skip == 0) break;
-	    }
+                if (wrs < wf) wf -= wrs;
+                else wf = 0;
+//                cout << "wf = " << wf << endl;
+                
+                if (wf < rf) skip = rf - wf;
+                if (skip == 0) break;
+            }
 
-//	    cout << "skipping " << skip << endl;
-	    wb->skip(int(skip));
-	}
+//            cout << "skipping " << skip << endl;
+            wb->skip(int(skip));
+        }
     }
-		    
+                    
     m_bufferScavenger.claim(m_readBuffers);
     m_readBuffers = m_writeBuffers;
     m_readBufferFill = m_writeBufferFill;
@@ -1769,63 +1769,63 @@
 
     while (!s.m_exiting) {
 
-	s.unifyRingBuffers();
-	s.m_bufferScavenger.scavenge();
+        s.unifyRingBuffers();
+        s.m_bufferScavenger.scavenge();
         s.m_pluginScavenger.scavenge();
 
-	if (work && s.m_playing && s.getSourceSampleRate()) {
-	    
+        if (work && s.m_playing && s.getSourceSampleRate()) {
+            
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
-	    cout << "AudioCallbackPlaySourceFillThread: not waiting" << endl;
+            cout << "AudioCallbackPlaySourceFillThread: not waiting" << endl;
 #endif
 
-	    s.m_mutex.unlock();
-	    s.m_mutex.lock();
+            s.m_mutex.unlock();
+            s.m_mutex.lock();
 
-	} else {
-	    
-	    double ms = 100;
-	    if (s.getSourceSampleRate() > 0) {
-		ms = double(s.m_ringBufferSize) / s.getSourceSampleRate() * 1000.0;
-	    }
-	    
-	    if (s.m_playing) ms /= 10;
+        } else {
+            
+            double ms = 100;
+            if (s.getSourceSampleRate() > 0) {
+                ms = double(s.m_ringBufferSize) / s.getSourceSampleRate() * 1000.0;
+            }
+            
+            if (s.m_playing) ms /= 10;
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
             if (!s.m_playing) cout << endl;
-	    cout << "AudioCallbackPlaySourceFillThread: waiting for " << ms << "ms..." << endl;
+            cout << "AudioCallbackPlaySourceFillThread: waiting for " << ms << "ms..." << endl;
 #endif
-	    
-	    s.m_condition.wait(&s.m_mutex, int(ms));
-	}
+            
+            s.m_condition.wait(&s.m_mutex, int(ms));
+        }
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
-	cout << "AudioCallbackPlaySourceFillThread: awoken" << endl;
+        cout << "AudioCallbackPlaySourceFillThread: awoken" << endl;
 #endif
 
-	work = false;
+        work = false;
 
-	if (!s.getSourceSampleRate()) {
+        if (!s.getSourceSampleRate()) {
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
             cout << "AudioCallbackPlaySourceFillThread: source sample rate is zero" << endl;
 #endif
             continue;
         }
 
-	bool playing = s.m_playing;
+        bool playing = s.m_playing;
 
-	if (playing && !previouslyPlaying) {
+        if (playing && !previouslyPlaying) {
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
-	    cout << "AudioCallbackPlaySourceFillThread: playback state changed, resetting" << endl;
+            cout << "AudioCallbackPlaySourceFillThread: playback state changed, resetting" << endl;
 #endif
-	    for (int c = 0; c < s.getTargetChannelCount(); ++c) {
-		RingBuffer<float> *rb = s.getReadRingBuffer(c);
-		if (rb) rb->reset();
-	    }
-	}
-	previouslyPlaying = playing;
+            for (int c = 0; c < s.getTargetChannelCount(); ++c) {
+                RingBuffer<float> *rb = s.getReadRingBuffer(c);
+                if (rb) rb->reset();
+            }
+        }
+        previouslyPlaying = playing;
 
-	work = s.fillBuffers();
+        work = s.fillBuffers();
     }
 
     s.m_mutex.unlock();
--- a/audio/AudioCallbackPlaySource.h	Tue Mar 07 11:48:29 2017 +0000
+++ b/audio/AudioCallbackPlaySource.h	Thu Mar 01 18:02:22 2018 +0000
@@ -58,7 +58,7 @@
  * available sample data from these buffers.
  */
 class AudioCallbackPlaySource : public QObject,
-				public AudioPlaySource,
+                                public AudioPlaySource,
                                 public breakfastquay::ApplicationPlaybackSource
 {
     Q_OBJECT
@@ -336,12 +336,12 @@
 
     class RingBufferVector : public std::vector<RingBuffer<float> *> {
     public:
-	virtual ~RingBufferVector() {
-	    while (!empty()) {
-		delete *begin();
-		erase(begin());
-	    }
-	}
+        virtual ~RingBufferVector() {
+            while (!empty()) {
+                delete *begin();
+                erase(begin());
+            }
+        }
     };
 
     std::set<Model *>                 m_models;
@@ -376,20 +376,20 @@
     RealTime                          m_playStartedAt;
 
     RingBuffer<float> *getWriteRingBuffer(int c) {
-	if (m_writeBuffers && c < (int)m_writeBuffers->size()) {
-	    return (*m_writeBuffers)[c];
-	} else {
-	    return 0;
-	}
+        if (m_writeBuffers && c < (int)m_writeBuffers->size()) {
+            return (*m_writeBuffers)[c];
+        } else {
+            return 0;
+        }
     }
 
     RingBuffer<float> *getReadRingBuffer(int c) {
-	RingBufferVector *rb = m_readBuffers;
-	if (rb && c < (int)rb->size()) {
-	    return (*rb)[c];
-	} else {
-	    return 0;
-	}
+        RingBufferVector *rb = m_readBuffers;
+        if (rb && c < (int)rb->size()) {
+            return (*rb)[c];
+        } else {
+            return 0;
+        }
     }
 
     void clearRingBuffers(bool haveLock = false, int count = 0);
@@ -427,14 +427,14 @@
     class FillThread : public Thread
     {
     public:
-	FillThread(AudioCallbackPlaySource &source) :
+        FillThread(AudioCallbackPlaySource &source) :
             Thread(Thread::NonRTThread),
-	    m_source(source) { }
+            m_source(source) { }
 
-	virtual void run();
+        virtual void run();
 
     protected:
-	AudioCallbackPlaySource &m_source;
+        AudioCallbackPlaySource &m_source;
     };
 
     QMutex m_mutex;
--- a/audio/AudioGenerator.cpp	Tue Mar 07 11:48:29 2017 +0000
+++ b/audio/AudioGenerator.cpp	Thu Mar 01 18:02:22 2018 +0000
@@ -116,24 +116,24 @@
 {
     if (m_sourceSampleRate == 0) {
 
-	m_sourceSampleRate = model->getSampleRate();
+        m_sourceSampleRate = model->getSampleRate();
 
     } else {
 
-	DenseTimeValueModel *dtvm =
-	    dynamic_cast<DenseTimeValueModel *>(model);
+        DenseTimeValueModel *dtvm =
+            dynamic_cast<DenseTimeValueModel *>(model);
 
-	if (dtvm) {
-	    m_sourceSampleRate = model->getSampleRate();
-	    return true;
-	}
+        if (dtvm) {
+            m_sourceSampleRate = model->getSampleRate();
+            return true;
+        }
     }
 
     const Playable *playable = model;
     if (!playable || !playable->canPlay()) return 0;
 
     PlayParameters *parameters =
-	PlayParameterRepository::getInstance()->getPlayParameters(playable);
+        PlayParameterRepository::getInstance()->getPlayParameters(playable);
 
     bool willPlay = !parameters->isPlayMuted();
     
@@ -217,7 +217,7 @@
     if (!playable || !playable->canPlay()) return 0;
 
     PlayParameters *parameters =
-	PlayParameterRepository::getInstance()->getPlayParameters(playable);
+        PlayParameterRepository::getInstance()->getPlayParameters(playable);
     if (parameters) {
         clipId = parameters->getPlayClipId();
     }
@@ -274,7 +274,7 @@
 AudioGenerator::removeModel(Model *model)
 {
     SparseOneDimensionalModel *sodm =
-	dynamic_cast<SparseOneDimensionalModel *>(model);
+        dynamic_cast<SparseOneDimensionalModel *>(model);
     if (!sodm) return; // nothing to do
 
     QMutexLocker locker(&m_mutex);
@@ -293,8 +293,8 @@
 
     while (!m_clipMixerMap.empty()) {
         ClipMixer *mixer = m_clipMixerMap.begin()->second;
-	m_clipMixerMap.erase(m_clipMixerMap.begin());
-	delete mixer;
+        m_clipMixerMap.erase(m_clipMixerMap.begin());
+        delete mixer;
     }
 }    
 
@@ -308,9 +308,9 @@
 #endif
 
     for (ClipMixerMap::iterator i = m_clipMixerMap.begin(); i != m_clipMixerMap.end(); ++i) {
-	if (i->second) {
-	    i->second->reset();
-	}
+        if (i->second) {
+            i->second->reset();
+        }
     }
 
     m_noteOffs.clear();
@@ -327,7 +327,7 @@
     m_targetChannelCount = targetChannelCount;
 
     for (ClipMixerMap::iterator i = m_clipMixerMap.begin(); i != m_clipMixerMap.end(); ++i) {
-	if (i->second) i->second->setChannelCount(targetChannelCount);
+        if (i->second) i->second->setChannelCount(targetChannelCount);
     }
 }
 
@@ -357,11 +357,11 @@
 
 sv_frame_t
 AudioGenerator::mixModel(Model *model, sv_frame_t startFrame, sv_frame_t frameCount,
-			 float **buffer, sv_frame_t fadeIn, sv_frame_t fadeOut)
+                         float **buffer, sv_frame_t fadeIn, sv_frame_t fadeOut)
 {
     if (m_sourceSampleRate == 0) {
-	cerr << "WARNING: AudioGenerator::mixModel: No base source sample rate available" << endl;
-	return frameCount;
+        cerr << "WARNING: AudioGenerator::mixModel: No base source sample rate available" << endl;
+        return frameCount;
     }
 
     QMutexLocker locker(&m_mutex);
@@ -370,7 +370,7 @@
     if (!playable || !playable->canPlay()) return frameCount;
 
     PlayParameters *parameters =
-	PlayParameterRepository::getInstance()->getPlayParameters(playable);
+        PlayParameterRepository::getInstance()->getPlayParameters(playable);
     if (!parameters) return frameCount;
 
     bool playing = !parameters->isPlayMuted();
@@ -395,8 +395,8 @@
 
     DenseTimeValueModel *dtvm = dynamic_cast<DenseTimeValueModel *>(model);
     if (dtvm) {
-	return mixDenseTimeValueModel(dtvm, startFrame, frameCount,
-				      buffer, gain, pan, fadeIn, fadeOut);
+        return mixDenseTimeValueModel(dtvm, startFrame, frameCount,
+                                      buffer, gain, pan, fadeIn, fadeOut);
     }
 
     if (usesClipMixer(model)) {
@@ -416,9 +416,9 @@
 
 sv_frame_t
 AudioGenerator::mixDenseTimeValueModel(DenseTimeValueModel *dtvm,
-				       sv_frame_t startFrame, sv_frame_t frames,
-				       float **buffer, float gain, float pan,
-				       sv_frame_t fadeIn, sv_frame_t fadeOut)
+                                       sv_frame_t startFrame, sv_frame_t frames,
+                                       float **buffer, float gain, float pan,
+                                       sv_frame_t fadeIn, sv_frame_t fadeOut)
 {
     sv_frame_t maxFrames = frames + std::max(fadeIn, fadeOut);
 
@@ -430,7 +430,7 @@
             delete[] m_channelBuffer[c];
         }
 
-	delete[] m_channelBuffer;
+        delete[] m_channelBuffer;
         m_channelBuffer = new float *[modelChannels];
 
         for (int c = 0; c < modelChannels; ++c) {
@@ -438,7 +438,7 @@
         }
 
         m_channelBufCount = modelChannels;
-	m_channelBufSiz = maxFrames;
+        m_channelBufSiz = maxFrames;
     }
 
     sv_frame_t got = 0;
@@ -473,43 +473,43 @@
         }
 
         got = data[0].size() + missing;
-    }	    
+    }            
 
     for (int c = 0; c < m_targetChannelCount; ++c) {
 
-	int sourceChannel = (c % modelChannels);
+        int sourceChannel = (c % modelChannels);
 
-//	SVDEBUG << "mixing channel " << c << " from source channel " << sourceChannel << endl;
+//        SVDEBUG << "mixing channel " << c << " from source channel " << sourceChannel << endl;
 
-	float channelGain = gain;
-	if (pan != 0.0) {
-	    if (c == 0) {
-		if (pan > 0.0) channelGain *= 1.0f - pan;
-	    } else {
-		if (pan < 0.0) channelGain *= pan + 1.0f;
-	    }
-	}
+        float channelGain = gain;
+        if (pan != 0.0) {
+            if (c == 0) {
+                if (pan > 0.0) channelGain *= 1.0f - pan;
+            } else {
+                if (pan < 0.0) channelGain *= pan + 1.0f;
+            }
+        }
 
-	for (sv_frame_t i = 0; i < fadeIn/2; ++i) {
-	    float *back = buffer[c];
-	    back -= fadeIn/2;
-	    back[i] +=
+        for (sv_frame_t i = 0; i < fadeIn/2; ++i) {
+            float *back = buffer[c];
+            back -= fadeIn/2;
+            back[i] +=
                 (channelGain * m_channelBuffer[sourceChannel][i] * float(i))
                 / float(fadeIn);
-	}
+        }
 
-	for (sv_frame_t i = 0; i < frames + fadeOut/2; ++i) {
-	    float mult = channelGain;
-	    if (i < fadeIn/2) {
-		mult = (mult * float(i)) / float(fadeIn);
-	    }
-	    if (i > frames - fadeOut/2) {
-		mult = (mult * float((frames + fadeOut/2) - i)) / float(fadeOut);
-	    }
+        for (sv_frame_t i = 0; i < frames + fadeOut/2; ++i) {
+            float mult = channelGain;
+            if (i < fadeIn/2) {
+                mult = (mult * float(i)) / float(fadeIn);
+            }
+            if (i > frames - fadeOut/2) {
+                mult = (mult * float((frames + fadeOut/2) - i)) / float(fadeOut);
+            }
             float val = m_channelBuffer[sourceChannel][i];
             if (i >= got) val = 0.f;
-	    buffer[c][i] += mult * val;
-	}
+            buffer[c][i] += mult * val;
+        }
     }
 
     return got;
@@ -554,7 +554,7 @@
 
     for (int i = 0; i < blocks; ++i) {
 
-	sv_frame_t reqStart = startFrame + i * m_processingBlockSize;
+        sv_frame_t reqStart = startFrame + i * m_processingBlockSize;
 
         NoteList notes;
         NoteExportable *exportable = dynamic_cast<NoteExportable *>(model);
@@ -566,16 +566,16 @@
         std::vector<ClipMixer::NoteStart> starts;
         std::vector<ClipMixer::NoteEnd> ends;
 
-	for (NoteList::const_iterator ni = notes.begin();
+        for (NoteList::const_iterator ni = notes.begin();
              ni != notes.end(); ++ni) {
 
-	    sv_frame_t noteFrame = ni->start;
+            sv_frame_t noteFrame = ni->start;
 
-	    if (noteFrame < reqStart ||
-		noteFrame >= reqStart + m_processingBlockSize) continue;
+            if (noteFrame < reqStart ||
+                noteFrame >= reqStart + m_processingBlockSize) continue;
 
-	    while (noteOffs.begin() != noteOffs.end() &&
-		   noteOffs.begin()->frame <= noteFrame) {
+            while (noteOffs.begin() != noteOffs.end() &&
+                   noteOffs.begin()->frame <= noteFrame) {
 
                 sv_frame_t eventFrame = noteOffs.begin()->frame;
                 if (eventFrame < reqStart) eventFrame = reqStart;
@@ -584,12 +584,12 @@
                 off.frequency = noteOffs.begin()->frequency;
 
 #ifdef DEBUG_AUDIO_GENERATOR
-		cerr << "mixModel [clip]: adding note-off at frame " << eventFrame << " frame offset " << off.frameOffset << " frequency " << off.frequency << endl;
+                cerr << "mixModel [clip]: adding note-off at frame " << eventFrame << " frame offset " << off.frameOffset << " frequency " << off.frequency << endl;
 #endif
 
                 ends.push_back(off);
-		noteOffs.erase(noteOffs.begin());
-	    }
+                noteOffs.erase(noteOffs.begin());
+            }
 
             on.frameOffset = noteFrame - reqStart;
             on.frequency = ni->getFrequency();
@@ -597,16 +597,16 @@
             on.pan = pan;
 
 #ifdef DEBUG_AUDIO_GENERATOR
-	    cout << "mixModel [clip]: adding note at frame " << noteFrame << ", frame offset " << on.frameOffset << " frequency " << on.frequency << ", level " << on.level << endl;
+            cout << "mixModel [clip]: adding note at frame " << noteFrame << ", frame offset " << on.frameOffset << " frequency " << on.frequency << ", level " << on.level << endl;
 #endif
-	    
+            
             starts.push_back(on);
-	    noteOffs.insert
+            noteOffs.insert
                 (NoteOff(on.frequency, noteFrame + ni->duration));
-	}
+        }
 
-	while (noteOffs.begin() != noteOffs.end() &&
-	       noteOffs.begin()->frame <= reqStart + m_processingBlockSize) {
+        while (noteOffs.begin() != noteOffs.end() &&
+               noteOffs.begin()->frame <= reqStart + m_processingBlockSize) {
 
             sv_frame_t eventFrame = noteOffs.begin()->frame;
             if (eventFrame < reqStart) eventFrame = reqStart;
@@ -620,9 +620,9 @@
 
             ends.push_back(off);
             noteOffs.erase(noteOffs.begin());
-	}
+        }
 
-	for (int c = 0; c < m_targetChannelCount; ++c) {
+        for (int c = 0; c < m_targetChannelCount; ++c) {
             bufferIndexes[c] = buffer[c] + i * m_processingBlockSize;
         }
 
@@ -657,16 +657,16 @@
 
 #ifdef DEBUG_AUDIO_GENERATOR
     cout << "mixModel [synth]: frames " << frames
-	      << ", blocks " << blocks << endl;
+              << ", blocks " << blocks << endl;
 #endif
     
     float **bufferIndexes = new float *[m_targetChannelCount];
 
     for (int i = 0; i < blocks; ++i) {
 
-	sv_frame_t reqStart = startFrame + i * m_processingBlockSize;
+        sv_frame_t reqStart = startFrame + i * m_processingBlockSize;
 
-	for (int c = 0; c < m_targetChannelCount; ++c) {
+        for (int c = 0; c < m_targetChannelCount; ++c) {
             bufferIndexes[c] = buffer[c] + i * m_processingBlockSize;
         }
 
--- a/audio/AudioGenerator.h	Tue Mar 07 11:48:29 2017 +0000
+++ b/audio/AudioGenerator.h	Thu Mar 01 18:02:22 2018 +0000
@@ -82,7 +82,7 @@
      * Mix a single model into an output buffer.
      */
     virtual sv_frame_t mixModel(Model *model, sv_frame_t startFrame, sv_frame_t frameCount,
-			    float **buffer, sv_frame_t fadeIn = 0, sv_frame_t fadeOut = 0);
+                            float **buffer, sv_frame_t fadeIn = 0, sv_frame_t fadeOut = 0);
 
     /**
      * Specify that only the given set of models should be played.
@@ -111,13 +111,13 @@
         NoteOff(float _freq, sv_frame_t _frame) : frequency(_freq), frame(_frame) { }
 
         float frequency;
-	sv_frame_t frame;
+        sv_frame_t frame;
 
-	struct Comparator {
-	    bool operator()(const NoteOff &n1, const NoteOff &n2) const {
-		return n1.frame < n2.frame;
-	    }
-	};
+        struct Comparator {
+            bool operator()(const NoteOff &n1, const NoteOff &n2) const {
+                return n1.frame < n2.frame;
+            }
+        };
     };
 
 
--- a/audio/ClipMixer.cpp	Tue Mar 07 11:48:29 2017 +0000
+++ b/audio/ClipMixer.cpp	Thu Mar 01 18:02:22 2018 +0000
@@ -60,9 +60,9 @@
     info.format = 0;
     file = sf_open(path.toLocal8Bit().data(), SFM_READ, &info);
     if (!file) {
-	cerr << "ClipMixer::loadClipData: Failed to open file path \""
+        cerr << "ClipMixer::loadClipData: Failed to open file path \""
              << path << "\": " << sf_strerror(file) << endl;
-	return false;
+        return false;
     }
 
     tmpFrames = (float *)malloc(info.frames * info.channels * sizeof(float));
@@ -77,16 +77,16 @@
     m_clipData = (float *)malloc(info.frames * sizeof(float));
     if (!m_clipData) {
         cerr << "ClipMixer::loadClipData: malloc(" << info.frames * sizeof(float) << ") failed" << endl;
-	free(tmpFrames);
-	return false;
+        free(tmpFrames);
+        return false;
     }
 
     for (i = 0; i < info.frames; ++i) {
-	int j;
-	m_clipData[i] = 0.0f;
-	for (j = 0; j < info.channels; ++j) {
-	    m_clipData[i] += tmpFrames[i * info.channels + j] * float(level);
-	}
+        int j;
+        m_clipData[i] = 0.0f;
+        for (j = 0; j < info.channels; ++j) {
+            m_clipData[i] += tmpFrames[i * info.channels + j] * float(level);
+        }
     }
 
     free(tmpFrames);
--- a/audio/ClipMixer.h	Tue Mar 07 11:48:29 2017 +0000
+++ b/audio/ClipMixer.h	Thu Mar 01 18:02:22 2018 +0000
@@ -48,21 +48,21 @@
     void reset(); // discarding any playing notes
 
     struct NoteStart {
-	sv_frame_t frameOffset; // within current processing block
-	float frequency; // Hz
-	float level; // volume in range (0,1]
-	float pan; // range [-1,1]
+        sv_frame_t frameOffset; // within current processing block
+        float frequency; // Hz
+        float level; // volume in range (0,1]
+        float pan; // range [-1,1]
     };
 
     struct NoteEnd {
-	sv_frame_t frameOffset; // in current processing block
+        sv_frame_t frameOffset; // in current processing block
         float frequency; // matching note start
     };
 
     void mix(float **toBuffers, 
              float gain,
-	     std::vector<NoteStart> newNotes, 
-	     std::vector<NoteEnd> endingNotes);
+             std::vector<NoteStart> newNotes, 
+             std::vector<NoteEnd> endingNotes);
 
 private:
     int m_channels;
--- a/framework/Align.cpp	Tue Mar 07 11:48:29 2017 +0000
+++ b/framework/Align.cpp	Thu Mar 01 18:02:22 2018 +0000
@@ -139,7 +139,7 @@
         cerr << "Align::alignModel: ERROR: Failed to create alignment path (no MATCH plugin?)" << endl;
         delete transformOutput;
         delete aggregateModel;
-	m_error = message;
+        m_error = message;
         return false;
     }
 
@@ -197,8 +197,8 @@
     QString otherPath = rorm->getLocalFilename();
 
     if (refPath == "" || otherPath == "") {
-	m_error = "Failed to find local filepath for wave-file model";
-	return false;
+        m_error = "Failed to find local filepath for wave-file model";
+        return false;
     }
 
     m_error = "";
@@ -247,47 +247,47 @@
     
     if (exitCode == 0 && status == 0) {
 
-	CSVFormat format;
-	format.setModelType(CSVFormat::TwoDimensionalModel);
-	format.setTimingType(CSVFormat::ExplicitTiming);
-	format.setTimeUnits(CSVFormat::TimeSeconds);
-	format.setColumnCount(2);
+        CSVFormat format;
+        format.setModelType(CSVFormat::TwoDimensionalModel);
+        format.setTimingType(CSVFormat::ExplicitTiming);
+        format.setTimeUnits(CSVFormat::TimeSeconds);
+        format.setColumnCount(2);
         // The output format has time in the reference file first, and
         // time in the "other" file in the second column. This is a
         // more natural approach for a command-line alignment tool,
         // but it's the opposite of what we expect for native
         // alignment paths, which map from "other" file to
         // reference. These column purpose settings reflect that.
-	format.setColumnPurpose(1, CSVFormat::ColumnStartTime);
-	format.setColumnPurpose(0, CSVFormat::ColumnValue);
-	format.setAllowQuoting(false);
-	format.setSeparator(',');
+        format.setColumnPurpose(1, CSVFormat::ColumnStartTime);
+        format.setColumnPurpose(0, CSVFormat::ColumnValue);
+        format.setAllowQuoting(false);
+        format.setSeparator(',');
 
-	CSVFileReader reader(process, format, alignmentModel->getSampleRate());
-	if (!reader.isOK()) {
+        CSVFileReader reader(process, format, alignmentModel->getSampleRate());
+        if (!reader.isOK()) {
             cerr << "ERROR: Align::alignmentProgramFinished: Failed to parse output"
                  << endl;
-	    m_error = QString("Failed to parse output of program: %1")
-		.arg(reader.getError());
+            m_error = QString("Failed to parse output of program: %1")
+                .arg(reader.getError());
             goto done;
-	}
+        }
 
-	Model *csvOutput = reader.load();
+        Model *csvOutput = reader.load();
 
-	SparseTimeValueModel *path = qobject_cast<SparseTimeValueModel *>(csvOutput);
-	if (!path) {
+        SparseTimeValueModel *path = qobject_cast<SparseTimeValueModel *>(csvOutput);
+        if (!path) {
             cerr << "ERROR: Align::alignmentProgramFinished: Output did not convert to sparse time-value model"
                  << endl;
-	    m_error = QString("Output of program did not produce sparse time-value model");
+            m_error = QString("Output of program did not produce sparse time-value model");
             goto done;
-	}
+        }
 
-	if (path->getPoints().empty()) {
+        if (path->getPoints().empty()) {
             cerr << "ERROR: Align::alignmentProgramFinished: Output contained no mappings"
                  << endl;
-	    m_error = QString("Output of alignment program contained no mappings");
+            m_error = QString("Output of alignment program contained no mappings");
             goto done;
-	}
+        }
 
         cerr << "Align::alignmentProgramFinished: Setting alignment path ("
              << path->getPoints().size() << " point(s))" << endl;
@@ -300,7 +300,7 @@
         cerr << "ERROR: Align::alignmentProgramFinished: Aligner program "
              << "failed: exit code " << exitCode << ", status " << status
              << endl;
-	m_error = "Aligner process returned non-zero exit status";
+        m_error = "Aligner process returned non-zero exit status";
     }
 
 done:
--- a/framework/Document.cpp	Tue Mar 07 11:48:29 2017 +0000
+++ b/framework/Document.cpp	Thu Mar 01 18:02:22 2018 +0000
@@ -82,32 +82,32 @@
     SVDEBUG << "Document::~Document: about to delete layers" << endl;
 #endif
     while (!m_layers.empty()) {
-	deleteLayer(*m_layers.begin(), true);
+        deleteLayer(*m_layers.begin(), true);
     }
 
     if (!m_models.empty()) {
-	SVDEBUG << "Document::~Document: WARNING: " 
-		  << m_models.size() << " model(s) still remain -- "
-		  << "should have been garbage collected when deleting layers"
-		  << endl;
-	while (!m_models.empty()) {
+        SVDEBUG << "Document::~Document: WARNING: " 
+                  << m_models.size() << " model(s) still remain -- "
+                  << "should have been garbage collected when deleting layers"
+                  << endl;
+        while (!m_models.empty()) {
             Model *model = m_models.begin()->first;
-	    if (model == m_mainModel) {
-		// just in case!
-		SVDEBUG << "Document::~Document: WARNING: Main model is also"
-			  << " in models list!" << endl;
-	    } else if (model) {
+            if (model == m_mainModel) {
+                // just in case!
+                SVDEBUG << "Document::~Document: WARNING: Main model is also"
+                          << " in models list!" << endl;
+            } else if (model) {
                 model->aboutToDelete();
-		emit modelAboutToBeDeleted(model);
-		delete model;
-	    }
-	    m_models.erase(m_models.begin());
-	}
+                emit modelAboutToBeDeleted(model);
+                delete model;
+            }
+            m_models.erase(m_models.begin());
+        }
     }
 
 #ifdef DEBUG_DOCUMENT
     SVDEBUG << "Document::~Document: About to get rid of main model"
-	      << endl;
+              << endl;
 #endif
     if (m_mainModel) {
         m_mainModel->aboutToDelete();
@@ -151,11 +151,11 @@
 Document::createImportedLayer(Model *model)
 {
     LayerFactory::LayerTypeSet types =
-	LayerFactory::getInstance()->getValidLayerTypes(model);
+        LayerFactory::getInstance()->getValidLayerTypes(model);
 
     if (types.empty()) {
-	cerr << "WARNING: Document::importLayer: no valid display layer for model" << endl;
-	return 0;
+        cerr << "WARNING: Document::importLayer: no valid display layer for model" << endl;
+        return 0;
     }
 
     //!!! for now, just use the first suitable layer type
@@ -189,13 +189,13 @@
     if (!m_mainModel) return 0;
 
     Model *newModel =
-	LayerFactory::getInstance()->createEmptyModel(type, m_mainModel);
+        LayerFactory::getInstance()->createEmptyModel(type, m_mainModel);
     if (!newModel) return 0;
 
     Layer *newLayer = createLayer(type);
     if (!newLayer) {
-	delete newModel;
-	return 0;
+        delete newModel;
+        return 0;
     }
 
     addImportedModel(newModel);
@@ -206,7 +206,7 @@
 
 Layer *
 Document::createDerivedLayer(LayerFactory::LayerType type,
-			     TransformId transform)
+                             TransformId transform)
 {
     Layer *newLayer = createLayer(type);
     if (!newLayer) return 0;
@@ -444,8 +444,8 @@
 
     for (LayerSet::iterator i = m_layers.begin(); i != m_layers.end(); ++i) {
 
-	Layer *layer = *i;
-	Model *model = layer->getModel();
+        Layer *layer = *i;
+        Model *model = layer->getModel();
 
 #ifdef DEBUG_DOCUMENT
         cerr << "Document::setMainModel: inspecting model "
@@ -453,56 +453,56 @@
                   << layer->objectName() << endl;
 #endif
 
-	if (model == oldMainModel) {
+        if (model == oldMainModel) {
 #ifdef DEBUG_DOCUMENT
             cerr << "... it uses the old main model, replacing" << endl;
 #endif
-	    LayerFactory::getInstance()->setModel(layer, m_mainModel);
-	    continue;
-	}
+            LayerFactory::getInstance()->setModel(layer, m_mainModel);
+            continue;
+        }
 
         if (!model) {
             cerr << "WARNING: Document::setMainModel: Null model in layer "
                       << layer << endl;
-	    // get rid of this hideous degenerate
-	    obsoleteLayers.push_back(layer);
-	    continue;
-	}
+            // get rid of this hideous degenerate
+            obsoleteLayers.push_back(layer);
+            continue;
+        }
 
-	if (m_models.find(model) == m_models.end()) {
-	    cerr << "WARNING: Document::setMainModel: Unknown model "
-		      << model << " in layer " << layer << endl;
-	    // and this one
-	    obsoleteLayers.push_back(layer);
-	    continue;
-	}
-	    
-	if (m_models[model].source &&
+        if (m_models.find(model) == m_models.end()) {
+            cerr << "WARNING: Document::setMainModel: Unknown model "
+                      << model << " in layer " << layer << endl;
+            // and this one
+            obsoleteLayers.push_back(layer);
+            continue;
+        }
+            
+        if (m_models[model].source &&
             (m_models[model].source == oldMainModel)) {
 
 #ifdef DEBUG_DOCUMENT
             cerr << "... it uses a model derived from the old main model, regenerating" << endl;
 #endif
 
-	    // This model was derived from the previous main
-	    // model: regenerate it.
-	    
-	    const Transform &transform = m_models[model].transform;
+            // This model was derived from the previous main
+            // model: regenerate it.
+            
+            const Transform &transform = m_models[model].transform;
             QString transformId = transform.getIdentifier();
-	    
+            
             //!!! We have a problem here if the number of channels in
             //the main model has changed.
 
             QString message;
-	    Model *replacementModel =
+            Model *replacementModel =
                 addDerivedModel(transform,
                                 ModelTransformer::Input
                                 (m_mainModel, m_models[model].channel),
                                 message);
-	    
-	    if (!replacementModel) {
-		cerr << "WARNING: Document::setMainModel: Failed to regenerate model for transform \""
-			  << transformId << "\"" << " in layer " << layer << endl;
+            
+            if (!replacementModel) {
+                cerr << "WARNING: Document::setMainModel: Failed to regenerate model for transform \""
+                          << transformId << "\"" << " in layer " << layer << endl;
                 if (failedTransformers.find(transformId)
                     == failedTransformers.end()) {
                     emit modelRegenerationFailed(layer->objectName(),
@@ -510,8 +510,8 @@
                                                  message);
                     failedTransformers.insert(transformId);
                 }
-		obsoleteLayers.push_back(layer);
-	    } else {
+                obsoleteLayers.push_back(layer);
+            } else {
                 if (message != "") {
                     emit modelRegenerationWarning(layer->objectName(),
                                                   transformId,
@@ -533,13 +533,13 @@
                     cerr << "new model " << replacementModel << " is not a RangeSummarisableTimeValueModel!" << endl;
                 }
 #endif
-		setModel(layer, replacementModel);
-	    }
-	}	    
+                setModel(layer, replacementModel);
+            }
+        }            
     }
 
     for (size_t k = 0; k < obsoleteLayers.size(); ++k) {
-	deleteLayer(obsoleteLayers[k], true);
+        deleteLayer(obsoleteLayers[k], true);
     }
 
     for (ModelMap::iterator i = m_models.begin(); i != m_models.end(); ++i) {
@@ -592,9 +592,9 @@
                                  Model *outputModelToAdd)
 {
     if (m_models.find(outputModelToAdd) != m_models.end()) {
-	cerr << "WARNING: Document::addAlreadyDerivedModel: Model already added"
-		  << endl;
-	return;
+        cerr << "WARNING: Document::addAlreadyDerivedModel: Model already added"
+                  << endl;
+        return;
     }
 
 #ifdef DEBUG_DOCUMENT
@@ -633,9 +633,9 @@
 Document::addImportedModel(Model *model)
 {
     if (m_models.find(model) != m_models.end()) {
-	cerr << "WARNING: Document::addImportedModel: Model already added"
-		  << endl;
-	return;
+        cerr << "WARNING: Document::addImportedModel: Model already added"
+                  << endl;
+        return;
     }
 
     ModelRecord rec;
@@ -669,9 +669,9 @@
 Document::addAdditionalModel(Model *model)
 {
     if (m_models.find(model) != m_models.end()) {
-	cerr << "WARNING: Document::addAdditionalModel: Model already added"
-		  << endl;
-	return;
+        cerr << "WARNING: Document::addAdditionalModel: Model already added"
+                  << endl;
+        return;
     }
 
     ModelRecord rec;
@@ -775,7 +775,7 @@
             addAlreadyDerivedModel(applied, input, model);
         }
     }
-	
+        
     return mm;
 }
 
@@ -783,54 +783,54 @@
 Document::releaseModel(Model *model) // Will _not_ release main model!
 {
     if (model == 0) {
-	return;
+        return;
     }
 
     if (model == m_mainModel) {
-	return;
+        return;
     }
 
     bool toDelete = false;
 
     if (m_models.find(model) != m_models.end()) {
-	if (m_models[model].refcount == 0) {
-	    SVCERR << "WARNING: Document::releaseModel: model " << model
+        if (m_models[model].refcount == 0) {
+            SVCERR << "WARNING: Document::releaseModel: model " << model
                    << " reference count is zero already!" << endl;
-	} else {
-	    if (--m_models[model].refcount == 0) {
-		toDelete = true;
-	    }
-	}
+        } else {
+            if (--m_models[model].refcount == 0) {
+                toDelete = true;
+            }
+        }
     } else if (m_aggregateModels.find(model) != m_aggregateModels.end()) {
         SVDEBUG << "Document::releaseModel: is an aggregate model" << endl;
         toDelete = true;
     } else { 
-	SVCERR << "WARNING: Document::releaseModel: Unfound model "
+        SVCERR << "WARNING: Document::releaseModel: Unfound model "
                << model << endl;
-	toDelete = true;
+        toDelete = true;
     }
 
     if (toDelete) {
 
-	int sourceCount = 0;
+        int sourceCount = 0;
 
-	for (ModelMap::iterator i = m_models.begin(); i != m_models.end(); ++i) {
-	    if (i->second.source == model) {
-		++sourceCount;
-		i->second.source = 0;
-	    }
-	}
+        for (ModelMap::iterator i = m_models.begin(); i != m_models.end(); ++i) {
+            if (i->second.source == model) {
+                ++sourceCount;
+                i->second.source = 0;
+            }
+        }
 
-	if (sourceCount > 0) {
-	    SVDEBUG << "Document::releaseModel: Deleting model "
+        if (sourceCount > 0) {
+            SVDEBUG << "Document::releaseModel: Deleting model "
                     << model << " even though it is source for "
                     << sourceCount << " other derived model(s) -- resetting "
                     << "their source fields appropriately" << endl;
-	}
+        }
 
         model->aboutToDelete();
-	emit modelAboutToBeDeleted(model);
-	m_models.erase(model);
+        emit modelAboutToBeDeleted(model);
+        m_models.erase(model);
 
 #ifdef DEBUG_DOCUMENT
         SVDEBUG << "Document::releaseModel: Deleted model " << model << endl;
@@ -841,7 +841,7 @@
         cerr << endl;
 #endif
 
-	delete model;
+        delete model;
     }
 }
 
@@ -849,39 +849,39 @@
 Document::deleteLayer(Layer *layer, bool force)
 {
     if (m_layerViewMap.find(layer) != m_layerViewMap.end() &&
-	m_layerViewMap[layer].size() > 0) {
+        m_layerViewMap[layer].size() > 0) {
 
-	cerr << "WARNING: Document::deleteLayer: Layer "
-		  << layer << " [" << layer->objectName() << "]"
-		  << " is still used in " << m_layerViewMap[layer].size()
-		  << " views!" << endl;
+        cerr << "WARNING: Document::deleteLayer: Layer "
+                  << layer << " [" << layer->objectName() << "]"
+                  << " is still used in " << m_layerViewMap[layer].size()
+                  << " views!" << endl;
 
-	if (force) {
+        if (force) {
 
 #ifdef DEBUG_DOCUMENT
-	    cerr << "(force flag set -- deleting from all views)" << endl;
+            cerr << "(force flag set -- deleting from all views)" << endl;
 #endif
 
-	    for (std::set<View *>::iterator j = m_layerViewMap[layer].begin();
-		 j != m_layerViewMap[layer].end(); ++j) {
-		// don't use removeLayerFromView, as it issues a command
-		layer->setLayerDormant(*j, true);
-		(*j)->removeLayer(layer);
-	    }
-	    
-	    m_layerViewMap.erase(layer);
+            for (std::set<View *>::iterator j = m_layerViewMap[layer].begin();
+                 j != m_layerViewMap[layer].end(); ++j) {
+                // don't use removeLayerFromView, as it issues a command
+                layer->setLayerDormant(*j, true);
+                (*j)->removeLayer(layer);
+            }
+            
+            m_layerViewMap.erase(layer);
 
-	} else {
-	    return;
-	}
+        } else {
+            return;
+        }
     }
 
     if (m_layers.find(layer) == m_layers.end()) {
-	SVDEBUG << "Document::deleteLayer: Layer "
+        SVDEBUG << "Document::deleteLayer: Layer "
                   << layer << " (" << typeid(layer).name() <<
                   ") does not exist, or has already been deleted "
-		  << "(this may not be as serious as it sounds)" << endl;
-	return;
+                  << "(this may not be as serious as it sounds)" << endl;
+        return;
     }
 
     m_layers.erase(layer);
@@ -901,14 +901,14 @@
 Document::setModel(Layer *layer, Model *model)
 {
     if (model && 
-	model != m_mainModel &&
-	m_models.find(model) == m_models.end()) {
-	cerr << "ERROR: Document::setModel: Layer " << layer
-		  << " (\"" << layer->objectName()
+        model != m_mainModel &&
+        m_models.find(model) == m_models.end()) {
+        cerr << "ERROR: Document::setModel: Layer " << layer
+                  << " (\"" << layer->objectName()
                   << "\") wants to use unregistered model " << model
-		  << ": register the layer's model before setting it!"
-		  << endl;
-	return;
+                  << ": register the layer's model before setting it!"
+                  << endl;
+        return;
     }
 
     Model *previousModel = layer->getModel();
@@ -923,7 +923,7 @@
     }
 
     if (model && model != m_mainModel) {
-	m_models[model].refcount ++;
+        m_models[model].refcount ++;
     }
 
     if (model && previousModel) {
@@ -932,7 +932,7 @@
     }
 
     LayerFactory::getInstance()->setModel(layer, model);
-	// std::cerr << "layer type: " << LayerFactory::getInstance()->getLayerTypeName(LayerFactory::getInstance()->getLayerType(layer)) << std::endl;
+        // std::cerr << "layer type: " << LayerFactory::getInstance()->getLayerTypeName(LayerFactory::getInstance()->getLayerType(layer)) << std::endl;
 
     if (previousModel) {
         releaseModel(previousModel);
@@ -951,29 +951,29 @@
     Model *model = layer->getModel();
     if (!model) {
 #ifdef DEBUG_DOCUMENT
-	SVDEBUG << "Document::addLayerToView: Layer (\""
+        SVDEBUG << "Document::addLayerToView: Layer (\""
                   << layer->objectName()                  << "\") with no model being added to view: "
                   << "normally you want to set the model first" << endl;
 #endif
     } else {
-	if (model != m_mainModel &&
-	    m_models.find(model) == m_models.end()) {
-	    cerr << "ERROR: Document::addLayerToView: Layer " << layer
-		      << " has unregistered model " << model
-		      << " -- register the layer's model before adding the layer!" << endl;
-	    return;
-	}
+        if (model != m_mainModel &&
+            m_models.find(model) == m_models.end()) {
+            cerr << "ERROR: Document::addLayerToView: Layer " << layer
+                      << " has unregistered model " << model
+                      << " -- register the layer's model before adding the layer!" << endl;
+            return;
+        }
     }
 
     CommandHistory::getInstance()->addCommand
-	(new Document::AddLayerCommand(this, view, layer));
+        (new Document::AddLayerCommand(this, view, layer));
 }
 
 void
 Document::removeLayerFromView(View *view, Layer *layer)
 {
     CommandHistory::getInstance()->addCommand
-	(new Document::RemoveLayerCommand(this, view, layer));
+        (new Document::RemoveLayerCommand(this, view, layer));
 }
 
 void
@@ -983,10 +983,10 @@
                       m_layerViewMap[layer].empty());
 
     if (m_layerViewMap[layer].find(view) !=
-	m_layerViewMap[layer].end()) {
-	cerr << "WARNING: Document::addToLayerViewMap:"
-		  << " Layer " << layer << " -> view " << view << " already in"
-		  << " layer view map -- internal inconsistency" << endl;
+        m_layerViewMap[layer].end()) {
+        cerr << "WARNING: Document::addToLayerViewMap:"
+                  << " Layer " << layer << " -> view " << view << " already in"
+                  << " layer view map -- internal inconsistency" << endl;
     }
 
     m_layerViewMap[layer].insert(view);
@@ -998,10 +998,10 @@
 Document::removeFromLayerViewMap(Layer *layer, View *view)
 {
     if (m_layerViewMap[layer].find(view) ==
-	m_layerViewMap[layer].end()) {
-	cerr << "WARNING: Document::removeFromLayerViewMap:"
-		  << " Layer " << layer << " -> view " << view << " not in"
-		  << " layer view map -- internal inconsistency" << endl;
+        m_layerViewMap[layer].end()) {
+        cerr << "WARNING: Document::removeFromLayerViewMap:"
+                  << " Layer " << layer << " -> view " << view << " not in"
+                  << " layer view map -- internal inconsistency" << endl;
     }
 
     m_layerViewMap[layer].erase(view);
@@ -1120,8 +1120,8 @@
 }
 
 Document::AddLayerCommand::AddLayerCommand(Document *d,
-					   View *view,
-					   Layer *layer) :
+                                           View *view,
+                                           Layer *layer) :
     m_d(d),
     m_view(view),
     m_layer(layer),
@@ -1136,7 +1136,7 @@
     SVDEBUG << "Document::AddLayerCommand::~AddLayerCommand" << endl;
 #endif
     if (!m_added) {
-	m_d->deleteLayer(m_layer);
+        m_d->deleteLayer(m_layer);
     }
 }
 
@@ -1154,12 +1154,12 @@
 Document::AddLayerCommand::execute()
 {
     for (int i = 0; i < m_view->getLayerCount(); ++i) {
-	if (m_view->getLayer(i) == m_layer) {
-	    // already there
-	    m_layer->setLayerDormant(m_view, false);
-	    m_added = true;
-	    return;
-	}
+        if (m_view->getLayer(i) == m_layer) {
+            // already there
+            m_layer->setLayerDormant(m_view, false);
+            m_added = true;
+            return;
+        }
     }
 
     m_view->addLayer(m_layer);
@@ -1180,8 +1180,8 @@
 }
 
 Document::RemoveLayerCommand::RemoveLayerCommand(Document *d,
-						 View *view,
-						 Layer *layer) :
+                                                 View *view,
+                                                 Layer *layer) :
     m_d(d),
     m_view(view),
     m_layer(layer),
@@ -1197,7 +1197,7 @@
     SVDEBUG << "Document::RemoveLayerCommand::~RemoveLayerCommand" << endl;
 #endif
     if (!m_added) {
-	m_d->deleteLayer(m_layer);
+        m_d->deleteLayer(m_layer);
     }
 }
 
@@ -1216,16 +1216,16 @@
 {
     bool have = false;
     for (int i = 0; i < m_view->getLayerCount(); ++i) {
-	if (m_view->getLayer(i) == m_layer) {
-	    have = true;
-	    break;
-	}
+        if (m_view->getLayer(i) == m_layer) {
+            have = true;
+            break;
+        }
     }
 
     if (!have) { // not there!
-	m_layer->setLayerDormant(m_view, true);
-	m_added = false;
-	return;
+        m_layer->setLayerDormant(m_view, true);
+        m_added = false;
+        return;
     }
 
     m_view->removeLayer(m_layer);
@@ -1325,10 +1325,10 @@
     std::set<Model *> written;
 
     for (ModelMap::const_iterator i = m_models.begin();
-	 i != m_models.end(); ++i) {
+         i != m_models.end(); ++i) {
 
         Model *model = i->first;
-	const ModelRecord &rec = i->second;
+        const ModelRecord &rec = i->second;
 
         if (used.find(model) == used.end()) continue;
         
@@ -1365,10 +1365,10 @@
             written.insert(model);
         }
 
-	if (haveDerivation) {
+        if (haveDerivation) {
             writeBackwardCompatibleDerivation(out, indent + "  ",
                                               model, rec);
-	}
+        }
 
         //!!! We should probably own the PlayParameterRepository
         PlayParameters *playParameters =
@@ -1390,7 +1390,7 @@
     // should probably wait for it if it isn't already by this point.
 
     for (std::set<Model *>::const_iterator i = written.begin();
-	 i != written.end(); ++i) {
+         i != written.end(); ++i) {
 
         const Model *model = *i;
         const AlignmentModel *alignment = model->getAlignment();
@@ -1400,9 +1400,9 @@
     }
 
     for (LayerSet::const_iterator i = m_layers.begin();
-	 i != m_layers.end(); ++i) {
+         i != m_layers.end(); ++i) {
 
-	(*i)->toXml(out, indent + "  ");
+        (*i)->toXml(out, indent + "  ");
     }
 
     out << indent + "</data>\n";
@@ -1471,7 +1471,7 @@
             .arg(RealTime::realTime2Frame(transform.getDuration(),
                                           targetModel->getSampleRate()));
     }
-	    
+            
     out << indent;
     out << QString("<derivation type=\"transform\" source=\"%1\" "
                    "model=\"%2\" channel=\"%3\" domain=\"%4\" "
--- a/framework/Document.h	Tue Mar 07 11:48:29 2017 +0000
+++ b/framework/Document.h	Thu Mar 01 18:02:22 2018 +0000
@@ -69,7 +69,7 @@
  */
 
 class Document : public QObject,
-		 public XmlExportable
+                 public XmlExportable
 {
     Q_OBJECT
 
@@ -350,24 +350,24 @@
 
     struct ModelRecord
     {
-	// Information associated with a non-main model.  If this
-	// model is derived from another, then source will be non-NULL
-	// and the transform name will be set appropriately.  If the
-	// transform name is set but source is NULL, then there was a
-	// transform involved but the (target) model has been modified
-	// since being generated from it.
+        // Information associated with a non-main model.  If this
+        // model is derived from another, then source will be non-NULL
+        // and the transform name will be set appropriately.  If the
+        // transform name is set but source is NULL, then there was a
+        // transform involved but the (target) model has been modified
+        // since being generated from it.
         
         // This does not use ModelTransformer::Input, because it would
         // be confusing to have Input objects hanging around with NULL
         // models in them.
 
-	const Model *source;
+        const Model *source;
         int channel;
         Transform transform;
         bool additional;
 
-	// Count of the number of layers using this model.
-	int refcount;
+        // Count of the number of layers using this model.
+        int refcount;
     };
 
     typedef std::map<Model *, ModelRecord> ModelMap;
@@ -384,38 +384,38 @@
     class AddLayerCommand : public Command
     {
     public:
-	AddLayerCommand(Document *d, View *view, Layer *layer);
-	virtual ~AddLayerCommand();
-	
-	virtual void execute();
-	virtual void unexecute();
-	virtual QString getName() const;
+        AddLayerCommand(Document *d, View *view, Layer *layer);
+        virtual ~AddLayerCommand();
+        
+        virtual void execute();
+        virtual void unexecute();
+        virtual QString getName() const;
 
     protected:
-	Document *m_d;
-	View *m_view; // I don't own this
-	Layer *m_layer; // Document owns this, but I determine its lifespan
-	QString m_name;
-	bool m_added;
+        Document *m_d;
+        View *m_view; // I don't own this
+        Layer *m_layer; // Document owns this, but I determine its lifespan
+        QString m_name;
+        bool m_added;
     };
 
     class RemoveLayerCommand : public Command
     {
     public:
-	RemoveLayerCommand(Document *d, View *view, Layer *layer);
-	virtual ~RemoveLayerCommand();
-	
-	virtual void execute();
-	virtual void unexecute();
-	virtual QString getName() const;
+        RemoveLayerCommand(Document *d, View *view, Layer *layer);
+        virtual ~RemoveLayerCommand();
+        
+        virtual void execute();
+        virtual void unexecute();
+        virtual QString getName() const;
 
     protected:
-	Document *m_d;
-	View *m_view; // I don't own this
-	Layer *m_layer; // Document owns this, but I determine its lifespan
+        Document *m_d;
+        View *m_view; // I don't own this
+        Layer *m_layer; // Document owns this, but I determine its lifespan
         bool m_wasDormant;
-	QString m_name;
-	bool m_added;
+        QString m_name;
+        bool m_added;
     };
 
     typedef std::map<Layer *, std::set<View *> > LayerViewMap;
--- a/framework/MainWindowBase.cpp	Tue Mar 07 11:48:29 2017 +0000
+++ b/framework/MainWindowBase.cpp	Thu Mar 01 18:02:22 2018 +0000
@@ -124,10 +124,10 @@
     char errstr[256];
     XGetErrorText(dpy, err->error_code, errstr, 256);
     if (err->error_code != BadWindow) {
-	cerr << "Sonic Visualiser: X Error: "
-		  << errstr << " " << int(err->error_code)
-		  << "\nin major opcode:  "
-		  << int(err->request_code) << endl;
+        cerr << "Sonic Visualiser: X Error: "
+                  << errstr << " " << int(err->error_code)
+                  << "\nin major opcode:  "
+                  << int(err->request_code) << endl;
     }
     return 0;
 }
@@ -182,17 +182,17 @@
     connect(this, SIGNAL(hideSplash()), this, SLOT(emitHideSplash()));
     
     connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()),
-	    this, SLOT(documentModified()));
+            this, SLOT(documentModified()));
     connect(CommandHistory::getInstance(), SIGNAL(documentRestored()),
-	    this, SLOT(documentRestored()));
+            this, SLOT(documentRestored()));
     
     SVDEBUG << "MainWindowBase: Creating view manager" << endl;
 
     m_viewManager = new ViewManager();
     connect(m_viewManager, SIGNAL(selectionChanged()),
-	    this, SLOT(updateMenuStates()));
+            this, SLOT(updateMenuStates()));
     connect(m_viewManager, SIGNAL(inProgressSelectionChanged()),
-	    this, SLOT(inProgressSelectionChanged()));
+            this, SLOT(inProgressSelectionChanged()));
 
     SVDEBUG << "MainWindowBase: Calculating view font size" << endl;
 
@@ -219,9 +219,9 @@
 
     m_paneStack = new PaneStack(0, m_viewManager);
     connect(m_paneStack, SIGNAL(currentPaneChanged(Pane *)),
-	    this, SLOT(currentPaneChanged(Pane *)));
+            this, SLOT(currentPaneChanged(Pane *)));
     connect(m_paneStack, SIGNAL(currentLayerChanged(Pane *, Layer *)),
-	    this, SLOT(currentLayerChanged(Pane *, Layer *)));
+            this, SLOT(currentLayerChanged(Pane *, Layer *)));
     connect(m_paneStack, SIGNAL(rightButtonMenuRequested(Pane *, QPoint)),
             this, SLOT(rightButtonMenuRequested(Pane *, QPoint)));
     connect(m_paneStack, SIGNAL(contextHelpChanged(const QString &)),
@@ -264,7 +264,7 @@
             this,           SLOT(audioTimeStretchMultiChannelDisabled()));
 
     connect(m_viewManager, SIGNAL(monitoringLevelsChanged(float, float)),
-	    this, SLOT(monitoringLevelsChanged(float, float)));
+            this, SLOT(monitoringLevelsChanged(float, float)));
 
     connect(m_viewManager, SIGNAL(playbackFrameChanged(sv_frame_t)),
             this, SLOT(playbackFrameChanged(sv_frame_t)));
@@ -607,22 +607,22 @@
         (haveCurrentPane &&
          (currentLayer != 0));
     bool haveMainModel =
-	(getMainModel() != 0);
+        (getMainModel() != 0);
     bool havePlayTarget =
-	(m_playTarget != 0 || m_audioIO != 0);
+        (m_playTarget != 0 || m_audioIO != 0);
     bool haveSelection = 
-	(m_viewManager &&
-	 !m_viewManager->getSelections().empty());
+        (m_viewManager &&
+         !m_viewManager->getSelections().empty());
     bool haveCurrentEditableLayer =
-	(haveCurrentLayer &&
-	 currentLayer->isLayerEditable());
+        (haveCurrentLayer &&
+         currentLayer->isLayerEditable());
     bool haveCurrentTimeInstantsLayer = 
-	(haveCurrentLayer &&
-	 dynamic_cast<TimeInstantLayer *>(currentLayer));
+        (haveCurrentLayer &&
+         dynamic_cast<TimeInstantLayer *>(currentLayer));
     bool haveCurrentDurationLayer = 
-	(haveCurrentLayer &&
-	 (dynamic_cast<NoteLayer *>(currentLayer) ||
-	  dynamic_cast<FlexiNoteLayer *>(currentLayer) ||
+        (haveCurrentLayer &&
+         (dynamic_cast<NoteLayer *>(currentLayer) ||
+          dynamic_cast<FlexiNoteLayer *>(currentLayer) ||
           dynamic_cast<RegionLayer *>(currentLayer)));
     bool haveCurrentColour3DPlot =
         (haveCurrentLayer &&
@@ -693,7 +693,7 @@
 
     if (!m_documentModified) {
         //!!! this in subclass implementation?
-	setWindowTitle(tr("%1 (modified)").arg(windowTitle()));
+        setWindowTitle(tr("%1 (modified)").arg(windowTitle()));
     }
 
     m_documentModified = true;
@@ -707,9 +707,9 @@
 
     if (m_documentModified) {
         //!!! this in subclass implementation?
-	QString wt(windowTitle());
-	wt.replace(tr(" (modified)"), "");
-	setWindowTitle(wt);
+        QString wt(windowTitle());
+        wt.replace(tr(" (modified)"), "");
+        setWindowTitle(wt);
     }
 
     m_documentModified = false;
@@ -722,9 +722,9 @@
     QAction *action = dynamic_cast<QAction *>(sender());
     
     if (action) {
-	m_viewManager->setPlayLoopMode(action->isChecked());
+        m_viewManager->setPlayLoopMode(action->isChecked());
     } else {
-	m_viewManager->setPlayLoopMode(!m_viewManager->getPlayLoopMode());
+        m_viewManager->setPlayLoopMode(!m_viewManager->getPlayLoopMode());
     }
 }
 
@@ -734,9 +734,9 @@
     QAction *action = dynamic_cast<QAction *>(sender());
     
     if (action) {
-	m_viewManager->setPlaySelectionMode(action->isChecked());
+        m_viewManager->setPlaySelectionMode(action->isChecked());
     } else {
-	m_viewManager->setPlaySelectionMode(!m_viewManager->getPlaySelectionMode());
+        m_viewManager->setPlaySelectionMode(!m_viewManager->getPlaySelectionMode());
     }
 }
 
@@ -746,9 +746,9 @@
     QAction *action = dynamic_cast<QAction *>(sender());
     
     if (action) {
-	m_viewManager->setPlaySoloMode(action->isChecked());
+        m_viewManager->setPlaySoloMode(action->isChecked());
     } else {
-	m_viewManager->setPlaySoloMode(!m_viewManager->getPlaySoloMode());
+        m_viewManager->setPlaySoloMode(!m_viewManager->getPlaySoloMode());
     }
 
     if (m_viewManager->getPlaySoloMode()) {
@@ -847,7 +847,7 @@
 {
     if (!getMainModel()) return;
     m_viewManager->setSelection(Selection(getMainModel()->getStartFrame(),
-					  getMainModel()->getEndFrame()));
+                                          getMainModel()->getEndFrame()));
 }
 
 void
@@ -855,7 +855,7 @@
 {
     if (!getMainModel()) return;
     m_viewManager->setSelection(Selection(getMainModel()->getStartFrame(),
-					  m_viewManager->getGlobalCentreFrame()));
+                                          m_viewManager->getGlobalCentreFrame()));
 }
 
 void
@@ -863,7 +863,7 @@
 {
     if (!getMainModel()) return;
     m_viewManager->setSelection(Selection(m_viewManager->getGlobalCentreFrame(),
-					  getMainModel()->getEndFrame()));
+                                          getMainModel()->getEndFrame()));
 }
 
 void
@@ -1005,7 +1005,7 @@
 MainWindowBase::deleteSelected()
 {
     if (m_paneStack->getCurrentPane() &&
-	m_paneStack->getCurrentPane()->getSelectedLayer()) {
+        m_paneStack->getCurrentPane()->getSelectedLayer()) {
         
         Layer *layer = m_paneStack->getCurrentPane()->getSelectedLayer();
 
@@ -1025,7 +1025,7 @@
                     layer->deleteSelection(*i);
                 }
             }
-	}
+        }
     }
 }
 
@@ -1459,7 +1459,7 @@
     ReadOnlyWaveFileModel *newModel = new ReadOnlyWaveFileModel(source, rate);
 
     if (!newModel->isOK()) {
-	delete newModel;
+        delete newModel;
         m_openingAudioFile = false;
         if (source.wasCancelled()) {
             return FileOpenCancelled;
@@ -1582,28 +1582,28 @@
 
         SVDEBUG << "SV about to call setMainModel(" << newModel << "): prevMain is " << prevMain << endl;
 
-	m_document->setMainModel(newModel);
-
-	setupMenus();
-
-	if (loadedTemplate || (m_sessionFile == "")) {
+        m_document->setMainModel(newModel);
+
+        setupMenus();
+
+        if (loadedTemplate || (m_sessionFile == "")) {
             //!!! shouldn't be dealing directly with title from here -- call a method
-	    setWindowTitle(tr("%1: %2")
+            setWindowTitle(tr("%1: %2")
                            .arg(QApplication::applicationName())
                            .arg(source.getLocation()));
-	    CommandHistory::getInstance()->clear();
-	    CommandHistory::getInstance()->documentSaved();
-	    m_documentModified = false;
-	} else {
-	    setWindowTitle(tr("%1: %2 [%3]")
+            CommandHistory::getInstance()->clear();
+            CommandHistory::getInstance()->documentSaved();
+            m_documentModified = false;
+        } else {
+            setWindowTitle(tr("%1: %2 [%3]")
                            .arg(QApplication::applicationName())
-			   .arg(QFileInfo(m_sessionFile).fileName())
-			   .arg(source.getLocation()));
-	    if (m_documentModified) {
-		m_documentModified = false;
-		documentModified(); // so as to restore "(modified)" window title
-	    }
-	}
+                           .arg(QFileInfo(m_sessionFile).fileName())
+                           .arg(source.getLocation()));
+            if (m_documentModified) {
+                m_documentModified = false;
+                documentModified(); // so as to restore "(modified)" window title
+            }
+        }
 
         if (!source.isRemote()) m_audioFile = source.getLocalFilename();
 
@@ -1611,15 +1611,15 @@
 
         SVCERR << "Mode is CreateAdditionalModel" << endl;
         
-	CommandHistory::getInstance()->startCompoundOperation
-	    (tr("Import \"%1\"").arg(source.getBasename()), true);
-
-	m_document->addImportedModel(newModel);
-
-	AddPaneCommand *command = new AddPaneCommand(this);
-	CommandHistory::getInstance()->addCommand(command);
-
-	Pane *pane = command->getPane();
+        CommandHistory::getInstance()->startCompoundOperation
+            (tr("Import \"%1\"").arg(source.getBasename()), true);
+
+        m_document->addImportedModel(newModel);
+
+        AddPaneCommand *command = new AddPaneCommand(this);
+        CommandHistory::getInstance()->addCommand(command);
+
+        Pane *pane = command->getPane();
 
         if (m_timeRulerLayer) {
             SVCERR << "Have time ruler, adding it" << endl;
@@ -1628,13 +1628,13 @@
             SVCERR << "Do not have time ruler" << endl;
         }
 
-	Layer *newLayer = m_document->createImportedLayer(newModel);
-
-	if (newLayer) {
-	    m_document->addLayerToView(pane, newLayer);
-	}
-	
-	CommandHistory::getInstance()->endCompoundOperation();
+        Layer *newLayer = m_document->createImportedLayer(newModel);
+
+        if (newLayer) {
+            m_document->addLayerToView(pane, newLayer);
+        }
+        
+        CommandHistory::getInstance()->endCompoundOperation();
 
     } else if (mode == ReplaceCurrentPane) {
 
@@ -1655,22 +1655,22 @@
             }
         }
 
-	CommandHistory::getInstance()->startCompoundOperation
-	    (tr("Import \"%1\"").arg(source.getBasename()), true);
-
-	m_document->addImportedModel(newModel);
+        CommandHistory::getInstance()->startCompoundOperation
+            (tr("Import \"%1\"").arg(source.getBasename()), true);
+
+        m_document->addImportedModel(newModel);
 
         if (replace) {
             m_document->removeLayerFromView(pane, replace);
         }
 
-	Layer *newLayer = m_document->createImportedLayer(newModel);
-
-	if (newLayer) {
-	    m_document->addLayerToView(pane, newLayer);
-	}
-	
-	CommandHistory::getInstance()->endCompoundOperation();
+        Layer *newLayer = m_document->createImportedLayer(newModel);
+
+        if (newLayer) {
+            m_document->addLayerToView(pane, newLayer);
+        }
+        
+        CommandHistory::getInstance()->endCompoundOperation();
     }
 
     updateMenuStates();
@@ -1738,15 +1738,15 @@
     Pane *pane = m_paneStack->getCurrentPane();
     
     if (!pane) {
-	// shouldn't happen, as the menu action should have been disabled
-	cerr << "WARNING: MainWindowBase::openLayer: no current pane" << endl;
-	return FileOpenWrongMode;
+        // shouldn't happen, as the menu action should have been disabled
+        cerr << "WARNING: MainWindowBase::openLayer: no current pane" << endl;
+        return FileOpenWrongMode;
     }
 
     if (!getMainModel()) {
-	// shouldn't happen, as the menu action should have been disabled
-	cerr << "WARNING: MainWindowBase::openLayer: No main model -- hence no default sample rate available" << endl;
-	return FileOpenWrongMode;
+        // shouldn't happen, as the menu action should have been disabled
+        cerr << "WARNING: MainWindowBase::openLayer: No main model -- hence no default sample rate available" << endl;
+        return FileOpenWrongMode;
     }
 
     if (!source.isAvailable()) return FileOpenFailed;
@@ -1870,9 +1870,9 @@
     Pane *pane = m_paneStack->getCurrentPane();
     
     if (!pane) {
-	// shouldn't happen, as the menu action should have been disabled
-	cerr << "WARNING: MainWindowBase::openImage: no current pane" << endl;
-	return FileOpenWrongMode;
+        // shouldn't happen, as the menu action should have been disabled
+        cerr << "WARNING: MainWindowBase::openImage: no current pane" << endl;
+        return FileOpenWrongMode;
     }
 
     if (!m_document->getMainModel()) {
@@ -2062,19 +2062,19 @@
 
         emit activity(tr("Import session file \"%1\"").arg(source.getLocation()));
 
-	setWindowTitle(tr("%1: %2")
+        setWindowTitle(tr("%1: %2")
                        .arg(QApplication::applicationName())
-		       .arg(source.getLocation()));
-
-	if (!source.isRemote()) m_sessionFile = source.getLocalFilename();
-
-	setupMenus();
+                       .arg(source.getLocation()));
+
+        if (!source.isRemote()) m_sessionFile = source.getLocalFilename();
+
+        setupMenus();
         findTimeRulerLayer();
 
-	CommandHistory::getInstance()->clear();
-	CommandHistory::getInstance()->documentSaved();
-	m_documentModified = false;
-	updateMenuStates();
+        CommandHistory::getInstance()->clear();
+        CommandHistory::getInstance()->documentSaved();
+        m_documentModified = false;
+        updateMenuStates();
 
         m_recentFiles.addFile(source.getLocation());
 
@@ -2087,7 +2087,7 @@
         emit sessionLoaded();
 
     } else {
-	setWindowTitle(QApplication::applicationName());
+        setWindowTitle(QApplication::applicationName());
     }
 
     return ok ? FileOpenSucceeded : FileOpenFailed;
@@ -2161,13 +2161,13 @@
 
         emit activity(tr("Open session template \"%1\"").arg(source.getLocation()));
 
-	setupMenus();
+        setupMenus();
         findTimeRulerLayer();
 
-	CommandHistory::getInstance()->clear();
-	CommandHistory::getInstance()->documentSaved();
-	m_documentModified = false;
-	updateMenuStates();
+        CommandHistory::getInstance()->clear();
+        CommandHistory::getInstance()->documentSaved();
+        m_documentModified = false;
+        updateMenuStates();
 
         emit sessionLoaded();
     }
@@ -2530,20 +2530,20 @@
     m_document = new Document;
 
     connect(m_document, SIGNAL(layerAdded(Layer *)),
-	    this, SLOT(layerAdded(Layer *)));
+            this, SLOT(layerAdded(Layer *)));
     connect(m_document, SIGNAL(layerRemoved(Layer *)),
-	    this, SLOT(layerRemoved(Layer *)));
+            this, SLOT(layerRemoved(Layer *)));
     connect(m_document, SIGNAL(layerAboutToBeDeleted(Layer *)),
-	    this, SLOT(layerAboutToBeDeleted(Layer *)));
+            this, SLOT(layerAboutToBeDeleted(Layer *)));
     connect(m_document, SIGNAL(layerInAView(Layer *, bool)),
-	    this, SLOT(layerInAView(Layer *, bool)));
+            this, SLOT(layerInAView(Layer *, bool)));
 
     connect(m_document, SIGNAL(modelAdded(Model *)),
-	    this, SLOT(modelAdded(Model *)));
+            this, SLOT(modelAdded(Model *)));
     connect(m_document, SIGNAL(mainModelChanged(WaveFileModel *)),
-	    this, SLOT(mainModelChanged(WaveFileModel *)));
+            this, SLOT(mainModelChanged(WaveFileModel *)));
     connect(m_document, SIGNAL(modelAboutToBeDeleted(Model *)),
-	    this, SLOT(modelAboutToBeDeleted(Model *)));
+            this, SLOT(modelAboutToBeDeleted(Model *)));
 
     connect(m_document, SIGNAL(modelGenerationFailed(QString, QString)),
             this, SLOT(modelGenerationFailed(QString, QString)));
@@ -2659,15 +2659,15 @@
     out << "<display>\n";
 
     out << QString("  <window width=\"%1\" height=\"%2\"/>\n")
-	.arg(width()).arg(height());
+        .arg(width()).arg(height());
 
     for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
 
-	Pane *pane = m_paneStack->getPane(i);
-
-	if (pane) {
+        Pane *pane = m_paneStack->getPane(i);
+
+        if (pane) {
             pane->toXml(out, indent);
-	}
+        }
     }
 
     out << "</display>\n";
@@ -2965,7 +2965,7 @@
         if (m_audioIO) m_audioIO->resume();
         else if (m_playTarget) m_playTarget->resume();
         playbackFrameChanged(m_viewManager->getPlaybackFrame());
-	m_playSource->play(m_viewManager->getPlaybackFrame());
+        m_playSource->play(m_viewManager->getPlaybackFrame());
     }
 }
 
@@ -3082,24 +3082,24 @@
         setupMenus();
         findTimeRulerLayer();
 
-	if (loadedTemplate || (m_sessionFile == "")) {
+        if (loadedTemplate || (m_sessionFile == "")) {
             //!!! shouldn't be dealing directly with title from here -- call a method
-	    setWindowTitle(tr("%1: %2")
+            setWindowTitle(tr("%1: %2")
                            .arg(QApplication::applicationName())
                            .arg(model->getLocation()));
-	    CommandHistory::getInstance()->clear();
-	    CommandHistory::getInstance()->documentSaved();
-	    m_documentModified = false;
-	} else {
-	    setWindowTitle(tr("%1: %2 [%3]")
+            CommandHistory::getInstance()->clear();
+            CommandHistory::getInstance()->documentSaved();
+            m_documentModified = false;
+        } else {
+            setWindowTitle(tr("%1: %2 [%3]")
                            .arg(QApplication::applicationName())
-			   .arg(QFileInfo(m_sessionFile).fileName())
-			   .arg(model->getLocation()));
-	    if (m_documentModified) {
-		m_documentModified = false;
-		documentModified(); // so as to restore "(modified)" window title
-	    }
-	}
+                           .arg(QFileInfo(m_sessionFile).fileName())
+                           .arg(model->getLocation()));
+            if (m_documentModified) {
+                m_documentModified = false;
+                documentModified(); // so as to restore "(modified)" window title
+            }
+        }
 
     } else {
 
@@ -3122,7 +3122,7 @@
         if (newLayer) {
             m_document->addLayerToView(pane, newLayer);
         }
-	
+        
         CommandHistory::getInstance()->endCompoundOperation();
     }
 
@@ -3392,7 +3392,7 @@
 MainWindowBase::AddPaneCommand::~AddPaneCommand()
 {
     if (m_pane && !m_added) {
-	m_mw->m_paneStack->deletePane(m_pane);
+        m_mw->m_paneStack->deletePane(m_pane);
     }
 }
 
@@ -3406,13 +3406,13 @@
 MainWindowBase::AddPaneCommand::execute()
 {
     if (!m_pane) {
-	m_prevCurrentPane = m_mw->m_paneStack->getCurrentPane();
-	m_pane = m_mw->m_paneStack->addPane();
+        m_prevCurrentPane = m_mw->m_paneStack->getCurrentPane();
+        m_pane = m_mw->m_paneStack->addPane();
 
         connect(m_pane, SIGNAL(contextHelpChanged(const QString &)),
                 m_mw, SLOT(contextHelpChanged(const QString &)));
     } else {
-	m_mw->m_paneStack->showPane(m_pane);
+        m_mw->m_paneStack->showPane(m_pane);
     }
 
     m_mw->m_paneStack->setCurrentPane(m_pane);
@@ -3438,7 +3438,7 @@
 MainWindowBase::RemovePaneCommand::~RemovePaneCommand()
 {
     if (m_pane && !m_added) {
-	m_mw->m_paneStack->deletePane(m_pane);
+        m_mw->m_paneStack->deletePane(m_pane);
     }
 }
 
@@ -3468,21 +3468,21 @@
 MainWindowBase::deleteCurrentPane()
 {
     CommandHistory::getInstance()->startCompoundOperation
-	(tr("Delete Pane"), true);
+        (tr("Delete Pane"), true);
 
     Pane *pane = m_paneStack->getCurrentPane();
     if (pane) {
-	while (pane->getLayerCount() > 0) {
-	    Layer *layer = pane->getLayer(0);
-	    if (layer) {
-		m_document->removeLayerFromView(pane, layer);
-	    } else {
-		break;
-	    }
-	}
-
-	RemovePaneCommand *command = new RemovePaneCommand(this, pane);
-	CommandHistory::getInstance()->addCommand(command);
+        while (pane->getLayerCount() > 0) {
+            Layer *layer = pane->getLayer(0);
+            if (layer) {
+                m_document->removeLayerFromView(pane, layer);
+            } else {
+                break;
+            }
+        }
+
+        RemovePaneCommand *command = new RemovePaneCommand(this, pane);
+        CommandHistory::getInstance()->addCommand(command);
     }
 
     CommandHistory::getInstance()->endCompoundOperation();
@@ -3495,10 +3495,10 @@
 {
     Pane *pane = m_paneStack->getCurrentPane();
     if (pane) {
-	Layer *layer = pane->getSelectedLayer();
-	if (layer) {
-	    m_document->removeLayerFromView(pane, layer);
-	}
+        Layer *layer = pane->getSelectedLayer();
+        if (layer) {
+            m_document->removeLayerFromView(pane, layer);
+        }
     }
     updateMenuStates();
 }
@@ -3779,8 +3779,8 @@
     removeLayerEditDialog(layer);
 
     if (m_timeRulerLayer && (layer == m_timeRulerLayer)) {
-//	cerr << "(this is the time ruler layer)" << endl;
-	m_timeRulerLayer = 0;
+//        cerr << "(this is the time ruler layer)" << endl;
+        m_timeRulerLayer = 0;
     }
 }
 
@@ -3842,7 +3842,7 @@
 MainWindowBase::modelAdded(Model *model)
 {
 //    SVDEBUG << "MainWindowBase::modelAdded(" << model << ")" << endl;
-	std::cerr << "\nAdding model " << model->getTypeName() << " to playsource " << std::endl;
+        std::cerr << "\nAdding model " << model->getTypeName() << " to playsource " << std::endl;
     m_playSource->addModel(model);
 }
 
@@ -3885,7 +3885,7 @@
     }
 
     CommandHistory::getInstance()->startCompoundOperation
-	(tr("Delete Pane"), true);
+        (tr("Delete Pane"), true);
 
     while (pane->getLayerCount() > 0) {
         Layer *layer = pane->getLayer(0);
--- a/framework/MainWindowBase.h	Tue Mar 07 11:48:29 2017 +0000
+++ b/framework/MainWindowBase.h	Thu Mar 01 18:02:22 2018 +0000
@@ -411,52 +411,52 @@
     class PaneCallback : public SVFileReaderPaneCallback
     {
     public:
-	PaneCallback(MainWindowBase *mw) : m_mw(mw) { }
-	virtual Pane *addPane() { return m_mw->addPaneToStack(); }
-	virtual void setWindowSize(int width, int height) {
-	    m_mw->resizeConstrained(QSize(width, height));
-	}
-	virtual void addSelection(sv_frame_t start, sv_frame_t end) {
-	    m_mw->m_viewManager->addSelectionQuietly(Selection(start, end));
-	}
+        PaneCallback(MainWindowBase *mw) : m_mw(mw) { }
+        virtual Pane *addPane() { return m_mw->addPaneToStack(); }
+        virtual void setWindowSize(int width, int height) {
+            m_mw->resizeConstrained(QSize(width, height));
+        }
+        virtual void addSelection(sv_frame_t start, sv_frame_t end) {
+            m_mw->m_viewManager->addSelectionQuietly(Selection(start, end));
+        }
     protected:
-	MainWindowBase *m_mw;
+        MainWindowBase *m_mw;
     };
 
     class AddPaneCommand : public Command
     {
     public:
-	AddPaneCommand(MainWindowBase *mw);
-	virtual ~AddPaneCommand();
-	
-	virtual void execute();
-	virtual void unexecute();
-	virtual QString getName() const;
+        AddPaneCommand(MainWindowBase *mw);
+        virtual ~AddPaneCommand();
+        
+        virtual void execute();
+        virtual void unexecute();
+        virtual QString getName() const;
 
-	Pane *getPane() { return m_pane; }
+        Pane *getPane() { return m_pane; }
 
     protected:
-	MainWindowBase *m_mw;
-	Pane *m_pane; // Main window owns this, but I determine its lifespan
-	Pane *m_prevCurrentPane; // I don't own this
-	bool m_added;
+        MainWindowBase *m_mw;
+        Pane *m_pane; // Main window owns this, but I determine its lifespan
+        Pane *m_prevCurrentPane; // I don't own this
+        bool m_added;
     };
 
     class RemovePaneCommand : public Command
     {
     public:
-	RemovePaneCommand(MainWindowBase *mw, Pane *pane);
-	virtual ~RemovePaneCommand();
-	
-	virtual void execute();
-	virtual void unexecute();
-	virtual QString getName() const;
+        RemovePaneCommand(MainWindowBase *mw, Pane *pane);
+        virtual ~RemovePaneCommand();
+        
+        virtual void execute();
+        virtual void unexecute();
+        virtual QString getName() const;
 
     protected:
-	MainWindowBase *m_mw;
-	Pane *m_pane; // Main window owns this, but I determine its lifespan
-	Pane *m_prevCurrentPane; // I don't own this
-	bool m_added;
+        MainWindowBase *m_mw;
+        Pane *m_pane; // Main window owns this, but I determine its lifespan
+        Pane *m_prevCurrentPane; // I don't own this
+        bool m_added;
     };
 
     virtual bool checkSaveModified() = 0;
--- a/framework/SVFileReader.cpp	Tue Mar 07 11:48:29 2017 +0000
+++ b/framework/SVFileReader.cpp	Thu Mar 01 18:02:22 2018 +0000
@@ -52,7 +52,7 @@
 #include <iostream>
 
 SVFileReader::SVFileReader(Document *document,
-			   SVFileReaderPaneCallback &callback,
+                           SVFileReaderPaneCallback &callback,
                            QString location) :
     m_document(document),
     m_paneCallback(callback),
@@ -99,39 +99,39 @@
 {
     return m_ok;
 }
-	
+        
 SVFileReader::~SVFileReader()
 {
     if (!m_awaitingDatasets.empty()) {
-	cerr << "WARNING: SV-XML: File ended with "
-		  << m_awaitingDatasets.size() << " unfilled model dataset(s)"
-		  << endl;
+        cerr << "WARNING: SV-XML: File ended with "
+                  << m_awaitingDatasets.size() << " unfilled model dataset(s)"
+                  << endl;
     }
 
     std::set<Model *> unaddedModels;
 
     for (std::map<int, Model *>::iterator i = m_models.begin();
-	 i != m_models.end(); ++i) {
-	if (m_addedModels.find(i->second) == m_addedModels.end()) {
-	    unaddedModels.insert(i->second);
-	}
+         i != m_models.end(); ++i) {
+        if (m_addedModels.find(i->second) == m_addedModels.end()) {
+            unaddedModels.insert(i->second);
+        }
     }
 
     if (!unaddedModels.empty()) {
-	cerr << "WARNING: SV-XML: File contained "
-		  << unaddedModels.size() << " unused models"
-		  << endl;
-	while (!unaddedModels.empty()) {
-	    delete *unaddedModels.begin();
-	    unaddedModels.erase(unaddedModels.begin());
-	}
-    }	
+        cerr << "WARNING: SV-XML: File contained "
+                  << unaddedModels.size() << " unused models"
+                  << endl;
+        while (!unaddedModels.empty()) {
+            delete *unaddedModels.begin();
+            unaddedModels.erase(unaddedModels.begin());
+        }
+    }        
 }
 
 bool
 SVFileReader::startElement(const QString &, const QString &,
-			   const QString &qName,
-			   const QXmlAttributes &attributes)
+                           const QString &qName,
+                           const QXmlAttributes &attributes)
 {
     QString name = qName.toLower();
 
@@ -159,57 +159,57 @@
 
     if (name == "sv") {
 
-	// nothing needed
-	ok = true;
+        // nothing needed
+        ok = true;
 
     } else if (name == "data") {
 
-	// nothing needed
-	m_inData = true;
-	ok = true;
+        // nothing needed
+        m_inData = true;
+        ok = true;
 
     } else if (name == "display") {
 
-	// nothing needed
-	ok = true;
+        // nothing needed
+        ok = true;
 
     } else if (name == "window") {
 
-	ok = readWindow(attributes);
+        ok = readWindow(attributes);
 
     } else if (name == "model") {
 
-	ok = readModel(attributes);
+        ok = readModel(attributes);
     
     } else if (name == "dataset") {
-	
-	ok = readDatasetStart(attributes);
+        
+        ok = readDatasetStart(attributes);
 
     } else if (name == "bin") {
-	
-	ok = addBinToDataset(attributes);
+        
+        ok = addBinToDataset(attributes);
     
     } else if (name == "point") {
-	
-	ok = addPointToDataset(attributes);
+        
+        ok = addPointToDataset(attributes);
 
     } else if (name == "row") {
 
-	ok = addRowToDataset(attributes);
+        ok = addRowToDataset(attributes);
 
     } else if (name == "layer") {
 
         addUnaddedModels(); // all models must be specified before first layer
-	ok = readLayer(attributes);
+        ok = readLayer(attributes);
 
     } else if (name == "view") {
 
-	m_inView = true;
-	ok = readView(attributes);
+        m_inView = true;
+        ok = readView(attributes);
 
     } else if (name == "derivation") {
 
-	ok = readDerivation(attributes);
+        ok = readDerivation(attributes);
 
     } else if (name == "playparameters") {
         
@@ -217,16 +217,16 @@
 
     } else if (name == "plugin") {
 
-	ok = readPlugin(attributes);
+        ok = readPlugin(attributes);
 
     } else if (name == "selections") {
 
-	m_inSelections = true;
-	ok = true;
+        m_inSelections = true;
+        ok = true;
 
     } else if (name == "selection") {
 
-	ok = readSelection(attributes);
+        ok = readSelection(attributes);
 
     } else if (name == "measurement") {
 
@@ -246,8 +246,8 @@
     }
 
     if (!ok) {
-	cerr << "WARNING: SV-XML: Failed to completely process element \""
-		  << name << "\"" << endl;
+        cerr << "WARNING: SV-XML: Failed to completely process element \""
+                  << name << "\"" << endl;
     }
 
     return true;
@@ -259,10 +259,10 @@
     bool ok = false;
 
     if (m_inRow) {
-	ok = readRowData(text);
-	if (!ok) {
-	    cerr << "WARNING: SV-XML: Failed to read row data content for row " << m_rowNumber << endl;
-	}
+        ok = readRowData(text);
+        if (!ok) {
+            cerr << "WARNING: SV-XML: Failed to read row data content for row " << m_rowNumber << endl;
+        }
     }
 
     return true;
@@ -270,37 +270,37 @@
 
 bool
 SVFileReader::endElement(const QString &, const QString &,
-			 const QString &qName)
+                         const QString &qName)
 {
     QString name = qName.toLower();
 
     if (name == "dataset") {
 
-	if (m_currentDataset) {
-	    
-	    bool foundInAwaiting = false;
+        if (m_currentDataset) {
+            
+            bool foundInAwaiting = false;
 
-	    for (std::map<int, int>::iterator i = m_awaitingDatasets.begin();
-		 i != m_awaitingDatasets.end(); ++i) {
-		if (haveModel(i->second) &&
+            for (std::map<int, int>::iterator i = m_awaitingDatasets.begin();
+                 i != m_awaitingDatasets.end(); ++i) {
+                if (haveModel(i->second) &&
                     m_models[i->second] == m_currentDataset) {
-		    m_awaitingDatasets.erase(i);
-		    foundInAwaiting = true;
-		    break;
-		}
-	    }
+                    m_awaitingDatasets.erase(i);
+                    foundInAwaiting = true;
+                    break;
+                }
+            }
 
-	    if (!foundInAwaiting) {
-		cerr << "WARNING: SV-XML: Dataset precedes model, or no model uses dataset" << endl;
-	    }
-	}
+            if (!foundInAwaiting) {
+                cerr << "WARNING: SV-XML: Dataset precedes model, or no model uses dataset" << endl;
+            }
+        }
 
-	m_currentDataset = 0;
+        m_currentDataset = 0;
 
     } else if (name == "data") {
 
         addUnaddedModels();
-	m_inData = false;
+        m_inData = false;
 
     } else if (name == "derivation") {
 
@@ -346,13 +346,13 @@
         m_currentTransformChannel = -1;
 
     } else if (name == "row") {
-	m_inRow = false;
+        m_inRow = false;
     } else if (name == "layer") {
         m_inLayer = false;
     } else if (name == "view") {
-	m_inView = false;
+        m_inView = false;
     } else if (name == "selections") {
-	m_inSelections = false;
+        m_inSelections = false;
     } else if (name == "playparameters") {
         m_currentPlayParameters = 0;
     }
@@ -364,10 +364,10 @@
 SVFileReader::error(const QXmlParseException &exception)
 {
     m_errorString =
-	QString("ERROR: SV-XML: %1 at line %2, column %3")
-	.arg(exception.message())
-	.arg(exception.lineNumber())
-	.arg(exception.columnNumber());
+        QString("ERROR: SV-XML: %1 at line %2, column %3")
+        .arg(exception.message())
+        .arg(exception.lineNumber())
+        .arg(exception.columnNumber());
     cerr << m_errorString << endl;
     return QXmlDefaultHandler::error(exception);
 }
@@ -376,20 +376,20 @@
 SVFileReader::fatalError(const QXmlParseException &exception)
 {
     m_errorString =
-	QString("FATAL ERROR: SV-XML: %1 at line %2, column %3")
-	.arg(exception.message())
-	.arg(exception.lineNumber())
-	.arg(exception.columnNumber());
+        QString("FATAL ERROR: SV-XML: %1 at line %2, column %3")
+        .arg(exception.message())
+        .arg(exception.lineNumber())
+        .arg(exception.columnNumber());
     cerr << m_errorString << endl;
     return QXmlDefaultHandler::fatalError(exception);
 }
 
 
-#define READ_MANDATORY(TYPE, NAME, CONVERSION)		      \
+#define READ_MANDATORY(TYPE, NAME, CONVERSION)                      \
     TYPE NAME = attributes.value(#NAME).trimmed().CONVERSION(&ok); \
     if (!ok) { \
-	cerr << "WARNING: SV-XML: Missing or invalid mandatory " #TYPE " attribute \"" #NAME "\"" << endl; \
-	return false; \
+        cerr << "WARNING: SV-XML: Missing or invalid mandatory " #TYPE " attribute \"" #NAME "\"" << endl; \
+        return false; \
     }
 
 bool
@@ -439,9 +439,9 @@
     READ_MANDATORY(int, id, toInt);
 
     if (haveModel(id)) {
-	cerr << "WARNING: SV-XML: Ignoring duplicate model id " << id
-		  << endl;
-	return false;
+        cerr << "WARNING: SV-XML: Ignoring duplicate model id " << id
+                  << endl;
+        return false;
     }
 
     QString name = attributes.value("name");
@@ -454,7 +454,7 @@
     bool isMainModel = (attributes.value("mainModel").trimmed() == "true");
 
     if (type == "wavefile") {
-	
+        
         WaveFileModel *model = 0;
         FileFinder *ff = FileFinder::getInstance();
         QString originalPath = attributes.value("file");
@@ -497,63 +497,63 @@
         if (!model) return false;
 
         model->setObjectName(name);
-	m_models[id] = model;
-	if (isMainModel) {
-	    m_document->setMainModel(model);
-	    m_addedModels.insert(model);
-	}
-	// Derived models will be added when their derivation
-	// is found.
+        m_models[id] = model;
+        if (isMainModel) {
+            m_document->setMainModel(model);
+            m_addedModels.insert(model);
+        }
+        // Derived models will be added when their derivation
+        // is found.
 
-	return true;
+        return true;
 
     } else if (type == "dense") {
-	
-	READ_MANDATORY(int, dimensions, toInt);
-		    
-	// Currently the only dense model we support here is the dense
-	// 3d model.  Dense time-value models are always file-backed
-	// waveform data, at this point, and they come in as wavefile
-	// models.
-	
-	if (dimensions == 3) {
-	    
-	    READ_MANDATORY(int, windowSize, toInt);
-	    READ_MANDATORY(int, yBinCount, toInt);
-	    
+        
+        READ_MANDATORY(int, dimensions, toInt);
+                    
+        // Currently the only dense model we support here is the dense
+        // 3d model.  Dense time-value models are always file-backed
+        // waveform data, at this point, and they come in as wavefile
+        // models.
+        
+        if (dimensions == 3) {
+            
+            READ_MANDATORY(int, windowSize, toInt);
+            READ_MANDATORY(int, yBinCount, toInt);
+            
             EditableDenseThreeDimensionalModel *model =
-		new EditableDenseThreeDimensionalModel
+                new EditableDenseThreeDimensionalModel
                 (sampleRate, windowSize, yBinCount,
                  EditableDenseThreeDimensionalModel::NoCompression);
-	    
-	    float minimum = attributes.value("minimum").trimmed().toFloat(&ok);
-	    if (ok) model->setMinimumLevel(minimum);
-	    
-	    float maximum = attributes.value("maximum").trimmed().toFloat(&ok);
-	    if (ok) model->setMaximumLevel(maximum);
+            
+            float minimum = attributes.value("minimum").trimmed().toFloat(&ok);
+            if (ok) model->setMinimumLevel(minimum);
+            
+            float maximum = attributes.value("maximum").trimmed().toFloat(&ok);
+            if (ok) model->setMaximumLevel(maximum);
 
-	    int dataset = attributes.value("dataset").trimmed().toInt(&ok);
-	    if (ok) m_awaitingDatasets[dataset] = id;
+            int dataset = attributes.value("dataset").trimmed().toInt(&ok);
+            if (ok) m_awaitingDatasets[dataset] = id;
 
             int startFrame = attributes.value("startFrame").trimmed().toInt(&ok);
             if (ok) model->setStartFrame(startFrame);
 
             model->setObjectName(name);
-	    m_models[id] = model;
-	    return true;
+            m_models[id] = model;
+            return true;
 
-	} else {
+        } else {
 
-	    cerr << "WARNING: SV-XML: Unexpected dense model dimension ("
-		      << dimensions << ")" << endl;
-	}
+            cerr << "WARNING: SV-XML: Unexpected dense model dimension ("
+                      << dimensions << ")" << endl;
+        }
     } else if (type == "sparse") {
 
-	READ_MANDATORY(int, dimensions, toInt);
-		  
-	if (dimensions == 1) {
-	    
-	    READ_MANDATORY(int, resolution, toInt);
+        READ_MANDATORY(int, dimensions, toInt);
+                  
+        if (dimensions == 1) {
+            
+            READ_MANDATORY(int, resolution, toInt);
 
             if (attributes.value("subtype") == "image") {
 
@@ -571,41 +571,41 @@
                 m_models[id] = model;
             }
 
-	    int dataset = attributes.value("dataset").trimmed().toInt(&ok);
-	    if (ok) m_awaitingDatasets[dataset] = id;
+            int dataset = attributes.value("dataset").trimmed().toInt(&ok);
+            if (ok) m_awaitingDatasets[dataset] = id;
 
-	    return true;
+            return true;
 
-	} else if (dimensions == 2 || dimensions == 3) {
-	    
-	    READ_MANDATORY(int, resolution, toInt);
+        } else if (dimensions == 2 || dimensions == 3) {
+            
+            READ_MANDATORY(int, resolution, toInt);
 
             bool haveMinMax = true;
-	    float minimum = attributes.value("minimum").trimmed().toFloat(&ok);
+            float minimum = attributes.value("minimum").trimmed().toFloat(&ok);
             if (!ok) haveMinMax = false;
-	    float maximum = attributes.value("maximum").trimmed().toFloat(&ok);
+            float maximum = attributes.value("maximum").trimmed().toFloat(&ok);
             if (!ok) haveMinMax = false;
 
-	    float valueQuantization =
-		attributes.value("valueQuantization").trimmed().toFloat(&ok);
+            float valueQuantization =
+                attributes.value("valueQuantization").trimmed().toFloat(&ok);
 
-	    bool notifyOnAdd = (attributes.value("notifyOnAdd") == "true");
+            bool notifyOnAdd = (attributes.value("notifyOnAdd") == "true");
 
             QString units = attributes.value("units");
 
-	    if (dimensions == 2) {
-		if (attributes.value("subtype") == "text") {
-		    TextModel *model = new TextModel
-			(sampleRate, resolution, notifyOnAdd);
+            if (dimensions == 2) {
+                if (attributes.value("subtype") == "text") {
+                    TextModel *model = new TextModel
+                        (sampleRate, resolution, notifyOnAdd);
                     model->setObjectName(name);
-		    m_models[id] = model;
+                    m_models[id] = model;
                 } else if (attributes.value("subtype") == "path") {
                     PathModel *model = new PathModel
                         (sampleRate, resolution, notifyOnAdd);
                     model->setObjectName(name);
                     m_models[id] = model;
-		} else {
-		    SparseTimeValueModel *model;
+                } else {
+                    SparseTimeValueModel *model;
                     if (haveMinMax) {
                         model = new SparseTimeValueModel
                             (sampleRate, resolution, minimum, maximum, notifyOnAdd);
@@ -615,9 +615,9 @@
                     }
                     model->setScaleUnits(units);
                     model->setObjectName(name);
-		    m_models[id] = model;
-		}
-	    } else {
+                    m_models[id] = model;
+                }
+            } else {
                 if (attributes.value("subtype") == "region") {
                     RegionModel *model;
                     if (haveMinMax) {
@@ -662,16 +662,16 @@
                 }
             }
 
-	    int dataset = attributes.value("dataset").trimmed().toInt(&ok);
-	    if (ok) m_awaitingDatasets[dataset] = id;
+            int dataset = attributes.value("dataset").trimmed().toInt(&ok);
+            if (ok) m_awaitingDatasets[dataset] = id;
 
-	    return true;
+            return true;
 
-	} else {
+        } else {
 
-	    cerr << "WARNING: SV-XML: Unexpected sparse model dimension ("
-		      << dimensions << ")" << endl;
-	}
+            cerr << "WARNING: SV-XML: Unexpected sparse model dimension ("
+                      << dimensions << ")" << endl;
+        }
 
     } else if (type == "alignment") {
 
@@ -739,9 +739,9 @@
     m_currentPane = 0;
     
     if (type != "pane") {
-	cerr << "WARNING: SV-XML: Unexpected view type \""
-		  << type << "\"" << endl;
-	return false;
+        cerr << "WARNING: SV-XML: Unexpected view type \""
+                  << type << "\"" << endl;
+        return false;
     }
 
     m_currentPane = m_paneCallback.addPane();
@@ -749,9 +749,9 @@
     cerr << "SVFileReader::addPane: pane is " << m_currentPane << endl;
 
     if (!m_currentPane) {
-	cerr << "WARNING: SV-XML: Internal error: Failed to add pane!"
-		  << endl;
-	return false;
+        cerr << "WARNING: SV-XML: Internal error: Failed to add pane!"
+                  << endl;
+        return false;
     }
 
     bool ok = false;
@@ -770,9 +770,9 @@
     view->setFollowGlobalPan(followPan);
     view->setFollowGlobalZoom(followZoom);
     view->setPlaybackFollow(tracking == "scroll" ? PlaybackScrollContinuous :
-			    tracking == "page" ? PlaybackScrollPageWithCentre :
-			    tracking == "daw" ? PlaybackScrollPage
-			    : PlaybackIgnore);
+                            tracking == "page" ? PlaybackScrollPageWithCentre :
+                            tracking == "daw" ? PlaybackScrollPage
+                            : PlaybackIgnore);
 
     // Then set these values
     view->setCentreFrame(centre);
@@ -784,7 +784,7 @@
 
     int height = attributes.value("height").toInt(&ok);
     if (ok) {
-	m_currentPane->resize(m_currentPane->width(), height);
+        m_currentPane->resize(m_currentPane->width(), height);
     }
 
     return true;
@@ -800,10 +800,10 @@
     id = attributes.value("id").trimmed().toInt(&ok);
 
     if (!ok) {
-	cerr << "WARNING: SV-XML: No layer id for layer of type \""
-		  << type
-		  << "\"" << endl;
-	return false;
+        cerr << "WARNING: SV-XML: No layer id for layer of type \""
+                  << type
+                  << "\"" << endl;
+        return false;
     }
 
     Layer *layer = 0;
@@ -817,73 +817,73 @@
 
     if (m_inData) {
 
-	if (m_layers.find(id) != m_layers.end()) {
-	    cerr << "WARNING: SV-XML: Ignoring duplicate layer id " << id
-		      << " in data section" << endl;
-	    return false;
-	}
+        if (m_layers.find(id) != m_layers.end()) {
+            cerr << "WARNING: SV-XML: Ignoring duplicate layer id " << id
+                      << " in data section" << endl;
+            return false;
+        }
 
-	layer = m_layers[id] = m_document->createLayer
-	    (LayerFactory::getInstance()->getLayerTypeForName(type));
+        layer = m_layers[id] = m_document->createLayer
+            (LayerFactory::getInstance()->getLayerTypeForName(type));
 
-	if (layer) {
-	    m_layers[id] = layer;
-	    isNewLayer = true;
-	}
+        if (layer) {
+            m_layers[id] = layer;
+            isNewLayer = true;
+        }
 
     } else {
 
-	if (!m_currentPane) {
-	    cerr << "WARNING: SV-XML: No current pane for layer " << id
-		      << " in view section" << endl;
-	    return false;
-	}
+        if (!m_currentPane) {
+            cerr << "WARNING: SV-XML: No current pane for layer " << id
+                      << " in view section" << endl;
+            return false;
+        }
 
-	if (m_layers.find(id) != m_layers.end()) {
-	    
-	    layer = m_layers[id];
-	
-	} else {
-	    cerr << "WARNING: SV-XML: Layer id " << id 
-		      << " in view section has not been defined -- defining it here"
-		      << endl;
+        if (m_layers.find(id) != m_layers.end()) {
+            
+            layer = m_layers[id];
+        
+        } else {
+            cerr << "WARNING: SV-XML: Layer id " << id 
+                      << " in view section has not been defined -- defining it here"
+                      << endl;
 
-	    layer = m_document->createLayer
-		(LayerFactory::getInstance()->getLayerTypeForName(type));
+            layer = m_document->createLayer
+                (LayerFactory::getInstance()->getLayerTypeForName(type));
 
-	    if (layer) {
-		m_layers[id] = layer;
-		isNewLayer = true;
-	    }
-	}
+            if (layer) {
+                m_layers[id] = layer;
+                isNewLayer = true;
+            }
+        }
     }
-	    
+            
     if (!layer) {
-	cerr << "WARNING: SV-XML: Failed to add layer of type \""
-		  << type
-		  << "\"" << endl;
-	return false;
+        cerr << "WARNING: SV-XML: Failed to add layer of type \""
+                  << type
+                  << "\"" << endl;
+        return false;
     }
 
     if (isNewLayer) {
 
-	QString name = attributes.value("name");
-	layer->setObjectName(name);
+        QString name = attributes.value("name");
+        layer->setObjectName(name);
 
         QString presentationName = attributes.value("presentationName");
         layer->setPresentationName(presentationName);
 
-	int modelId;
-	bool modelOk = false;
-	modelId = attributes.value("model").trimmed().toInt(&modelOk);
+        int modelId;
+        bool modelOk = false;
+        modelId = attributes.value("model").trimmed().toInt(&modelOk);
 
-	if (modelOk) {
-	    if (haveModel(modelId)) {
-		Model *model = m_models[modelId];
-		m_document->setModel(layer, model);
-	    } else {
-		cerr << "WARNING: SV-XML: Unknown model id " << modelId
-			  << " in layer definition" << endl;
+        if (modelOk) {
+            if (haveModel(modelId)) {
+                Model *model = m_models[modelId];
+                m_document->setModel(layer, model);
+            } else {
+                cerr << "WARNING: SV-XML: Unknown model id " << modelId
+                          << " in layer definition" << endl;
                 if (!layer->canExistWithoutModel()) {
                     // Don't add a layer with an unknown model id
                     // unless it explicitly supports this state
@@ -892,7 +892,7 @@
                     return false;
                 }
             }
-	}
+        }
 
         if (layer) layer->setProperties(attributes);
     }
@@ -911,7 +911,7 @@
         // again afterwards too.  Hm
         layer->setLayerDormant(m_currentPane, dormant);
 
-	m_document->addLayerToView(m_currentPane, layer);
+        m_document->addLayerToView(m_currentPane, layer);
 
         layer->setLayerDormant(m_currentPane, dormant);
     }
@@ -931,50 +931,50 @@
     READ_MANDATORY(int, dimensions, toInt);
     
     if (m_awaitingDatasets.find(id) == m_awaitingDatasets.end()) {
-	cerr << "WARNING: SV-XML: Unwanted dataset " << id << endl;
-	return false;
+        cerr << "WARNING: SV-XML: Unwanted dataset " << id << endl;
+        return false;
     }
     
     int modelId = m_awaitingDatasets[id];
     
     Model *model = 0;
     if (haveModel(modelId)) {
-	model = m_models[modelId];
+        model = m_models[modelId];
     } else {
-	cerr << "WARNING: SV-XML: Internal error: Unknown model " << modelId
-		  << " expecting dataset " << id << endl;
-	return false;
+        cerr << "WARNING: SV-XML: Internal error: Unknown model " << modelId
+                  << " expecting dataset " << id << endl;
+        return false;
     }
 
     bool good = false;
 
     switch (dimensions) {
     case 1:
-	if (dynamic_cast<SparseOneDimensionalModel *>(model)) good = true;
+        if (dynamic_cast<SparseOneDimensionalModel *>(model)) good = true;
         else if (dynamic_cast<ImageModel *>(model)) good = true;
-	break;
+        break;
 
     case 2:
-	if (dynamic_cast<SparseTimeValueModel *>(model)) good = true;
-	else if (dynamic_cast<TextModel *>(model)) good = true;
-	else if (dynamic_cast<PathModel *>(model)) good = true;
-	break;
+        if (dynamic_cast<SparseTimeValueModel *>(model)) good = true;
+        else if (dynamic_cast<TextModel *>(model)) good = true;
+        else if (dynamic_cast<PathModel *>(model)) good = true;
+        break;
 
     case 3:
-	if (dynamic_cast<NoteModel *>(model)) good = true;
-	else if (dynamic_cast<FlexiNoteModel *>(model)) good = true;
-	else if (dynamic_cast<RegionModel *>(model)) good = true;
-	else if (dynamic_cast<EditableDenseThreeDimensionalModel *>(model)) {
-	    m_datasetSeparator = attributes.value("separator");
-	    good = true;
-	}
-	break;
+        if (dynamic_cast<NoteModel *>(model)) good = true;
+        else if (dynamic_cast<FlexiNoteModel *>(model)) good = true;
+        else if (dynamic_cast<RegionModel *>(model)) good = true;
+        else if (dynamic_cast<EditableDenseThreeDimensionalModel *>(model)) {
+            m_datasetSeparator = attributes.value("separator");
+            good = true;
+        }
+        break;
     }
 
     if (!good) {
-	cerr << "WARNING: SV-XML: Model id " << modelId << " has wrong number of dimensions or inappropriate type for " << dimensions << "-D dataset " << id << endl;
-	m_currentDataset = 0;
-	return false;
+        cerr << "WARNING: SV-XML: Model id " << modelId << " has wrong number of dimensions or inappropriate type for " << dimensions << "-D dataset " << id << endl;
+        m_currentDataset = 0;
+        return false;
     }
 
     m_currentDataset = model;
@@ -991,86 +991,86 @@
 //    SVDEBUG << "SVFileReader::addPointToDataset: frame = " << frame << endl;
 
     SparseOneDimensionalModel *sodm = dynamic_cast<SparseOneDimensionalModel *>
-	(m_currentDataset);
+        (m_currentDataset);
 
     if (sodm) {
 //        cerr << "Current dataset is a sparse one dimensional model" << endl;
-	QString label = attributes.value("label");
-	sodm->addPoint(SparseOneDimensionalModel::Point(frame, label));
-	return true;
+        QString label = attributes.value("label");
+        sodm->addPoint(SparseOneDimensionalModel::Point(frame, label));
+        return true;
     }
 
     SparseTimeValueModel *stvm = dynamic_cast<SparseTimeValueModel *>
-	(m_currentDataset);
+        (m_currentDataset);
 
     if (stvm) {
 //        cerr << "Current dataset is a sparse time-value model" << endl;
-	float value = 0.0;
-	value = attributes.value("value").trimmed().toFloat(&ok);
-	QString label = attributes.value("label");
-	stvm->addPoint(SparseTimeValueModel::Point(frame, value, label));
-	return ok;
+        float value = 0.0;
+        value = attributes.value("value").trimmed().toFloat(&ok);
+        QString label = attributes.value("label");
+        stvm->addPoint(SparseTimeValueModel::Point(frame, value, label));
+        return ok;
     }
-	
+        
     NoteModel *nm = dynamic_cast<NoteModel *>(m_currentDataset);
 
     if (nm) {
 //        cerr << "Current dataset is a note model" << endl;
-	float value = 0.0;
-	value = attributes.value("value").trimmed().toFloat(&ok);
-	int duration = 0;
-	duration = attributes.value("duration").trimmed().toInt(&ok);
-	QString label = attributes.value("label");
+        float value = 0.0;
+        value = attributes.value("value").trimmed().toFloat(&ok);
+        int duration = 0;
+        duration = attributes.value("duration").trimmed().toInt(&ok);
+        QString label = attributes.value("label");
         float level = attributes.value("level").trimmed().toFloat(&ok);
         if (!ok) { // level is optional
             level = 1.f;
             ok = true;
         }
-	nm->addPoint(NoteModel::Point(frame, value, duration, level, label));
-	return ok;
+        nm->addPoint(NoteModel::Point(frame, value, duration, level, label));
+        return ok;
     }
 
     FlexiNoteModel *fnm = dynamic_cast<FlexiNoteModel *>(m_currentDataset);
 
     if (fnm) {
 //        cerr << "Current dataset is a flexinote model" << endl;
-	float value = 0.0;
-	value = attributes.value("value").trimmed().toFloat(&ok);
-	int duration = 0;
-	duration = attributes.value("duration").trimmed().toInt(&ok);
-	QString label = attributes.value("label");
+        float value = 0.0;
+        value = attributes.value("value").trimmed().toFloat(&ok);
+        int duration = 0;
+        duration = attributes.value("duration").trimmed().toInt(&ok);
+        QString label = attributes.value("label");
         float level = attributes.value("level").trimmed().toFloat(&ok);
         if (!ok) { // level is optional
             level = 1.f;
             ok = true;
         }
-	fnm->addPoint(FlexiNoteModel::Point(frame, value, duration, level, label));
-	return ok;
+        fnm->addPoint(FlexiNoteModel::Point(frame, value, duration, level, label));
+        return ok;
     }
 
     RegionModel *rm = dynamic_cast<RegionModel *>(m_currentDataset);
 
     if (rm) {
 //        cerr << "Current dataset is a region model" << endl;
-	float value = 0.0;
-	value = attributes.value("value").trimmed().toFloat(&ok);
-	int duration = 0;
-	duration = attributes.value("duration").trimmed().toInt(&ok);
-	QString label = attributes.value("label");
-	rm->addPoint(RegionModel::Point(frame, value, duration, label));
-	return ok;
+        float value = 0.0;
+        value = attributes.value("value").trimmed().toFloat(&ok);
+        int duration = 0;
+        duration = attributes.value("duration").trimmed().toInt(&ok);
+        QString label = attributes.value("label");
+        rm->addPoint(RegionModel::Point(frame, value, duration, label));
+        return ok;
     }
 
     TextModel *tm = dynamic_cast<TextModel *>(m_currentDataset);
 
     if (tm) {
 //        cerr << "Current dataset is a text model" << endl;
-	float height = 0.0;
-	height = attributes.value("height").trimmed().toFloat(&ok);
-	QString label = attributes.value("label");
+        float height = 0.0;
+        height = attributes.value("height").trimmed().toFloat(&ok);
+        QString label = attributes.value("label");
 //        SVDEBUG << "SVFileReader::addPointToDataset: TextModel: frame = " << frame << ", height = " << height << ", label = " << label << ", ok = " << ok << endl;
-	tm->addPoint(TextModel::Point(frame, height, label));
-	return ok;
+        tm->addPoint(TextModel::Point(frame, height, label));
+        return ok;
     }
 
     PathModel *pm = dynamic_cast<PathModel *>(m_currentDataset);
@@ -1079,19 +1079,19 @@
 //        cerr << "Current dataset is a path model" << endl;
         int mapframe = attributes.value("mapframe").trimmed().toInt(&ok);
 //        SVDEBUG << "SVFileReader::addPointToDataset: PathModel: frame = " << frame << ", mapframe = " << mapframe << ", ok = " << ok << endl;
-	pm->addPoint(PathModel::Point(frame, mapframe));
-	return ok;
+        pm->addPoint(PathModel::Point(frame, mapframe));
+        return ok;
     }
 
     ImageModel *im = dynamic_cast<ImageModel *>(m_currentDataset);
 
     if (im) {
 //        cerr << "Current dataset is an image model" << endl;
-	QString image = attributes.value("image");
-	QString label = attributes.value("label");
+        QString image = attributes.value("image");
+        QString label = attributes.value("label");
 //        SVDEBUG << "SVFileReader::addPointToDataset: ImageModel: frame = " << frame << ", image = " << image << ", label = " << label << ", ok = " << ok << endl;
-	im->addPoint(ImageModel::Point(frame, image, label));
-	return ok;
+        im->addPoint(ImageModel::Point(frame, image, label));
+        return ok;
     }
 
     cerr << "WARNING: SV-XML: Point element found in non-point dataset" << endl;
@@ -1104,22 +1104,22 @@
 {
     EditableDenseThreeDimensionalModel *dtdm = 
         dynamic_cast<EditableDenseThreeDimensionalModel *>
-	(m_currentDataset);
+        (m_currentDataset);
 
     if (dtdm) {
 
-	bool ok = false;
-	int n = attributes.value("number").trimmed().toInt(&ok);
-	if (!ok) {
-	    cerr << "WARNING: SV-XML: Missing or invalid bin number"
-		      << endl;
-	    return false;
-	}
+        bool ok = false;
+        int n = attributes.value("number").trimmed().toInt(&ok);
+        if (!ok) {
+            cerr << "WARNING: SV-XML: Missing or invalid bin number"
+                      << endl;
+            return false;
+        }
 
-	QString name = attributes.value("name");
+        QString name = attributes.value("name");
 
-	dtdm->setBinName(n, name);
-	return true;
+        dtdm->setBinName(n, name);
+        return true;
     }
 
     cerr << "WARNING: SV-XML: Bin definition found in incompatible dataset" << endl;
@@ -1136,9 +1136,9 @@
     bool ok = false;
     m_rowNumber = attributes.value("n").trimmed().toInt(&ok);
     if (!ok) {
-	cerr << "WARNING: SV-XML: Missing or invalid row number"
-		  << endl;
-	return false;
+        cerr << "WARNING: SV-XML: Missing or invalid row number"
+                  << endl;
+        return false;
     }
     
     m_inRow = true;
@@ -1153,38 +1153,38 @@
 {
     EditableDenseThreeDimensionalModel *dtdm =
         dynamic_cast<EditableDenseThreeDimensionalModel *>
-	(m_currentDataset);
+        (m_currentDataset);
 
     bool warned = false;
 
     if (dtdm) {
-	QStringList data = text.split(m_datasetSeparator);
+        QStringList data = text.split(m_datasetSeparator);
 
-	DenseThreeDimensionalModel::Column values;
+        DenseThreeDimensionalModel::Column values;
 
-	for (QStringList::iterator i = data.begin(); i != data.end(); ++i) {
+        for (QStringList::iterator i = data.begin(); i != data.end(); ++i) {
 
-	    if (int(values.size()) == dtdm->getHeight()) {
-		if (!warned) {
-		    cerr << "WARNING: SV-XML: Too many y-bins in 3-D dataset row "
-			      << m_rowNumber << endl;
-		    warned = true;
-		}
-	    }
+            if (int(values.size()) == dtdm->getHeight()) {
+                if (!warned) {
+                    cerr << "WARNING: SV-XML: Too many y-bins in 3-D dataset row "
+                              << m_rowNumber << endl;
+                    warned = true;
+                }
+            }
 
-	    bool ok;
-	    float value = i->toFloat(&ok);
-	    if (!ok) {
-		cerr << "WARNING: SV-XML: Bad floating-point value "
-			  << i->toLocal8Bit().data()
-			  << " in row data" << endl;
-	    } else {
-		values.push_back(value);
-	    }
-	}
+            bool ok;
+            float value = i->toFloat(&ok);
+            if (!ok) {
+                cerr << "WARNING: SV-XML: Bad floating-point value "
+                          << i->toLocal8Bit().data()
+                          << " in row data" << endl;
+            } else {
+                values.push_back(value);
+            }
+        }
 
-	dtdm->setColumn(m_rowNumber, values);
-	return true;
+        dtdm->setColumn(m_rowNumber, values);
+        return true;
     }
 
     cerr << "WARNING: SV-XML: Row data found in non-row dataset" << endl;
@@ -1200,8 +1200,8 @@
     modelId = attributes.value("model").trimmed().toInt(&modelOk);
 
     if (!modelOk) {
-	cerr << "WARNING: SV-XML: No model id specified for derivation" << endl;
-	return false;
+        cerr << "WARNING: SV-XML: No model id specified for derivation" << endl;
+        return false;
     }
 
     if (haveModel(modelId)) {
@@ -1294,8 +1294,8 @@
     modelId = attributes.value("model").trimmed().toInt(&modelOk);
 
     if (!modelOk) {
-	cerr << "WARNING: SV-XML: No model id specified for play parameters" << endl;
-	return false;
+        cerr << "WARNING: SV-XML: No model id specified for play parameters" << endl;
+        return false;
     }
 
     if (haveModel(modelId)) {
@@ -1331,8 +1331,8 @@
 
     } else {
 
-	cerr << "WARNING: SV-XML: Unknown model " << modelId
-		  << " for play parameters" << endl;
+        cerr << "WARNING: SV-XML: Unknown model " << modelId
+                  << " for play parameters" << endl;
         return false;
     }
 
@@ -1477,9 +1477,9 @@
     SVFileReader::FileType getType() const { return m_type; }
 
     virtual bool startElement(const QString &,
-			      const QString &,
-			      const QString &qName,
-			      const QXmlAttributes& atts)
+                              const QString &,
+                              const QString &qName,
+                              const QXmlAttributes& atts)
     {
         QString name = qName.toLower();
 
@@ -1513,8 +1513,8 @@
     }
 
     virtual bool endElement(const QString &,
-			    const QString &,
-			    const QString &qName)
+                            const QString &,
+                            const QString &qName)
     {
         QString name = qName.toLower();
 
--- a/framework/SVFileReader.h	Tue Mar 07 11:48:29 2017 +0000
+++ b/framework/SVFileReader.h	Thu Mar 01 18:02:22 2018 +0000
@@ -168,7 +168,7 @@
 
 public:
     SVFileReader(Document *document,
-		 SVFileReaderPaneCallback &callback,
+                 SVFileReaderPaneCallback &callback,
                  QString location = ""); // for audio file locate mechanism
     virtual ~SVFileReader();
 
@@ -182,15 +182,15 @@
     void setCurrentPane(Pane *pane) { m_currentPane = pane; }
     
     virtual bool startElement(const QString &namespaceURI,
-			      const QString &localName,
-			      const QString &qName,
-			      const QXmlAttributes& atts);
+                              const QString &localName,
+                              const QString &qName,
+                              const QXmlAttributes& atts);
 
     virtual bool characters(const QString &);
 
     virtual bool endElement(const QString &namespaceURI,
-			    const QString &localName,
-			    const QString &qName);
+                            const QString &localName,
+                            const QString &qName);
 
     bool error(const QXmlParseException &exception);
     bool fatalError(const QXmlParseException &exception);
--- a/framework/TransformUserConfigurator.cpp	Tue Mar 07 11:48:29 2017 +0000
+++ b/framework/TransformUserConfigurator.cpp	Thu Mar 01 18:02:22 2018 +0000
@@ -40,17 +40,17 @@
 
 bool
 TransformUserConfigurator::getChannelRange(TransformId identifier,
-					   Vamp::PluginBase *plugin,
-					   int &minChannels, int &maxChannels)
+                                           Vamp::PluginBase *plugin,
+                                           int &minChannels, int &maxChannels)
 {
     if (plugin && plugin->getType() == "Feature Extraction Plugin") {
-	Vamp::Plugin *vp = static_cast<Vamp::Plugin *>(plugin);
-	SVDEBUG << "TransformUserConfigurator::getChannelRange: is a Vamp plugin" << endl;
+        Vamp::Plugin *vp = static_cast<Vamp::Plugin *>(plugin);
+        SVDEBUG << "TransformUserConfigurator::getChannelRange: is a Vamp plugin" << endl;
         minChannels = int(vp->getMinChannelCount());
         maxChannels = int(vp->getMaxChannelCount());
         return true;
     } else {
-	SVDEBUG << "TransformUserConfigurator::getChannelRange: is not a Vamp plugin" << endl;
+        SVDEBUG << "TransformUserConfigurator::getChannelRange: is not a Vamp plugin" << endl;
         return TransformFactory::getInstance()->
             getTransformChannelRange(identifier, minChannels, maxChannels);
     }
@@ -58,15 +58,15 @@
 
 bool
 TransformUserConfigurator::configure(ModelTransformer::Input &input,
-				     Transform &transform,
-				     Vamp::PluginBase *plugin,
+                                     Transform &transform,
+                                     Vamp::PluginBase *plugin,
                                      Model *&inputModel,
-				     AudioPlaySource *source,
-				     sv_frame_t startFrame,
-				     sv_frame_t duration,
-				     const QMap<QString, Model *> &modelMap,
-				     QStringList candidateModelNames,
-				     QString defaultModelName)
+                                     AudioPlaySource *source,
+                                     sv_frame_t startFrame,
+                                     sv_frame_t duration,
+                                     const QMap<QString, Model *> &modelMap,
+                                     QStringList candidateModelNames,
+                                     QString defaultModelName)
 {
     bool ok = false;
     QString id = transform.getPluginIdentifier();
@@ -108,7 +108,7 @@
             static_cast<RealTimePluginInstance *>(plugin);
 
         if (effect && source) {
-	    SVDEBUG << "Setting auditioning effect" << endl;
+            SVDEBUG << "Setting auditioning effect" << endl;
             source->setAuditioningEffect(rtp);
         }
 
@@ -116,38 +116,38 @@
 
         Vamp::Plugin *vp = static_cast<Vamp::Plugin *>(plugin);
 
-	frequency = (vp->getInputDomain() == Vamp::Plugin::FrequencyDomain);
+        frequency = (vp->getInputDomain() == Vamp::Plugin::FrequencyDomain);
 
-	std::vector<Vamp::Plugin::OutputDescriptor> od =
-	    vp->getOutputDescriptors();
+        std::vector<Vamp::Plugin::OutputDescriptor> od =
+            vp->getOutputDescriptors();
 
-//	cerr << "configure: looking for output: " << output << endl;
+//        cerr << "configure: looking for output: " << output << endl;
 
-	if (od.size() > 1) {
-	    for (size_t i = 0; i < od.size(); ++i) {
-		if (od[i].identifier == output.toStdString()) {
-		    outputLabel = od[i].name.c_str();
-		    outputDescription = od[i].description.c_str();
-		    break;
-		}
-	    }
+        if (od.size() > 1) {
+            for (size_t i = 0; i < od.size(); ++i) {
+                if (od[i].identifier == output.toStdString()) {
+                    outputLabel = od[i].name.c_str();
+                    outputDescription = od[i].description.c_str();
+                    break;
+                }
+            }
         }
     }
     
     int sourceChannels = 1;
     if (dynamic_cast<DenseTimeValueModel *>(inputModel)) {
-	sourceChannels = dynamic_cast<DenseTimeValueModel *>(inputModel)
-	    ->getChannelCount();
+        sourceChannels = dynamic_cast<DenseTimeValueModel *>(inputModel)
+            ->getChannelCount();
     }
 
     int minChannels = 1, maxChannels = sourceChannels;
     getChannelRange(transform.getIdentifier(), plugin,
-		    minChannels, maxChannels);
+                    minChannels, maxChannels);
 
     int targetChannels = sourceChannels;
     if (!effect) {
-	if (sourceChannels < minChannels) targetChannels = minChannels;
-	if (sourceChannels > maxChannels) targetChannels = maxChannels;
+        if (sourceChannels < minChannels) targetChannels = minChannels;
+        if (sourceChannels > maxChannels) targetChannels = maxChannels;
     }
 
     int defaultChannel = -1; //!!! no longer saved! [was context.channel]
@@ -156,20 +156,20 @@
         (plugin, parentWidget);
 
     dialog->setMoreInfoUrl(TransformFactory::getInstance()->
-			   getTransformInfoUrl(transform.getIdentifier()));
+                           getTransformInfoUrl(transform.getIdentifier()));
 
     if (candidateModelNames.size() > 1 && !generator) {
-	dialog->setCandidateInputModels(candidateModelNames,
-					defaultModelName);
+        dialog->setCandidateInputModels(candidateModelNames,
+                                        defaultModelName);
     }
 
     if (startFrame != 0 || duration != 0) {
-	dialog->setShowSelectionOnlyOption(true);
+        dialog->setShowSelectionOnlyOption(true);
     }
 
     if (targetChannels > 0) {
-	dialog->setChannelArrangement(sourceChannels, targetChannels,
-				      defaultChannel);
+        dialog->setChannelArrangement(sourceChannels, targetChannels,
+                                      defaultChannel);
     }
         
     dialog->setOutputLabel(outputLabel, outputDescription);
@@ -177,24 +177,24 @@
     dialog->setShowProcessingOptions(true, frequency);
 
     if (dialog->exec() == QDialog::Accepted) {
-	ok = true;
+        ok = true;
     }
 
     QString selectedInput = dialog->getInputModel();
     if (selectedInput != "") {
-	if (modelMap.contains(selectedInput)) {
-	    inputModel = modelMap.value(selectedInput);
-	    SVDEBUG << "Found selected input \"" << selectedInput << "\" in model map, result is " << inputModel << endl;
-	} else {
-	    SVDEBUG << "Failed to find selected input \"" << selectedInput << "\" in model map" << endl;
-	}
+        if (modelMap.contains(selectedInput)) {
+            inputModel = modelMap.value(selectedInput);
+            SVDEBUG << "Found selected input \"" << selectedInput << "\" in model map, result is " << inputModel << endl;
+        } else {
+            SVDEBUG << "Failed to find selected input \"" << selectedInput << "\" in model map" << endl;
+        }
     } else {
-	SVDEBUG << "Selected input empty: \"" << selectedInput << "\"" << endl;
+        SVDEBUG << "Selected input empty: \"" << selectedInput << "\"" << endl;
     }
         
     // Write parameters back to transform object
     TransformFactory::getInstance()->
-	setParametersFromPlugin(transform, plugin);
+        setParametersFromPlugin(transform, plugin);
 
     input.setChannel(dialog->getChannel());
         
@@ -204,20 +204,20 @@
     //(whenever that may be)
 
     if (startFrame != 0 || duration != 0) {
-	if (dialog->getSelectionOnly()) {
-	    transform.setStartTime(RealTime::frame2RealTime
-				   (startFrame, inputModel->getSampleRate()));
-	    transform.setDuration(RealTime::frame2RealTime
-				  (duration, inputModel->getSampleRate()));
-	}
+        if (dialog->getSelectionOnly()) {
+            transform.setStartTime(RealTime::frame2RealTime
+                                   (startFrame, inputModel->getSampleRate()));
+            transform.setDuration(RealTime::frame2RealTime
+                                  (duration, inputModel->getSampleRate()));
+        }
     }
 
     int stepSize = 0, blockSize = 0;
     WindowType windowType = HanningWindow;
 
     dialog->getProcessingParameters(stepSize,
-				    blockSize,
-				    windowType);
+                                    blockSize,
+                                    windowType);
 
     transform.setStepSize(stepSize);
     transform.setBlockSize(blockSize);
@@ -226,7 +226,7 @@
     delete dialog;
 
     if (effect && source) {
-	source->setAuditioningEffect(0);
+        source->setAuditioningEffect(0);
     }
 
     return ok;
--- a/framework/TransformUserConfigurator.h	Tue Mar 07 11:48:29 2017 +0000
+++ b/framework/TransformUserConfigurator.h	Thu Mar 01 18:02:22 2018 +0000
@@ -26,10 +26,10 @@
                            Transform &transform,
                            Vamp::PluginBase *plugin,
                            Model *&inputModel,
-			   AudioPlaySource *source,
-			   sv_frame_t startFrame,
-			   sv_frame_t duration,
-			   const QMap<QString, Model *> &modelMap,
+                           AudioPlaySource *source,
+                           sv_frame_t startFrame,
+                           sv_frame_t duration,
+                           const QMap<QString, Model *> &modelMap,
                            QStringList candidateModelNames,
                            QString defaultModelName);
 
--- a/framework/VersionTester.cpp	Tue Mar 07 11:48:29 2017 +0000
+++ b/framework/VersionTester.cpp	Thu Mar 01 18:02:22 2018 +0000
@@ -27,7 +27,7 @@
 
 
 VersionTester::VersionTester(QString hostname, QString versionFilePath,
-			     QString myVersion) :
+                             QString myVersion) :
     m_myVersion(myVersion),
     m_reply(0),
     m_httpFailed(false),