Mercurial > hg > svgui
changeset 765:410816717c2c tony_integration
Merge from tonioni branch
author | Chris Cannam |
---|---|
date | Wed, 07 May 2014 15:12:13 +0100 |
parents | 2cd6d2d17437 (current diff) 6388ddae6ce3 (diff) |
children | 65eb27ea08fd |
files | layer/SpectrogramLayer.cpp view/Pane.cpp |
diffstat | 9 files changed, 108 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/FlexiNoteLayer.cpp Wed Apr 02 08:53:32 2014 +0100 +++ b/layer/FlexiNoteLayer.cpp Wed May 07 15:12:13 2014 +0100 @@ -1141,6 +1141,7 @@ break; } } + updateNoteValue(v, m_editingPoint); m_editingCommand->addPoint(m_editingPoint); std::cerr << "added new point(" << m_editingPoint.frame << "," << m_editingPoint.duration << ")" << std::endl; @@ -1354,9 +1355,7 @@ command->deletePoint(note); - if (updateNoteValue(v, newNote)) { - command->addPoint(newNote); - } + } finish(command);
--- a/layer/LayerFactory.cpp Wed Apr 02 08:53:32 2014 +0100 +++ b/layer/LayerFactory.cpp Wed May 07 15:12:13 2014 +0100 @@ -197,7 +197,7 @@ LayerTypeSet types; types.insert(TimeInstants); types.insert(TimeValues); - types.insert(FlexiNotes); + types.insert(FlexiNotes); types.insert(Notes); types.insert(Regions); types.insert(Text); @@ -214,7 +214,7 @@ if (dynamic_cast<const TimeRulerLayer *>(layer)) return TimeRuler; if (dynamic_cast<const TimeInstantLayer *>(layer)) return TimeInstants; if (dynamic_cast<const TimeValueLayer *>(layer)) return TimeValues; - if (dynamic_cast<const FlexiNoteLayer *>(layer)) return FlexiNotes; + if (dynamic_cast<const FlexiNoteLayer *>(layer)) return FlexiNotes; if (dynamic_cast<const NoteLayer *>(layer)) return Notes; if (dynamic_cast<const RegionLayer *>(layer)) return Regions; if (dynamic_cast<const TextLayer *>(layer)) return Text; @@ -235,7 +235,7 @@ case TimeInstants: return "instants"; case TimeValues: return "values"; case Notes: return "notes"; - case FlexiNotes: return "flexible notes"; + case FlexiNotes: return "flexinotes"; case Regions: return "regions"; case Text: return "text"; case Image: return "image"; @@ -349,7 +349,7 @@ return new SparseOneDimensionalModel(baseModel->getSampleRate(), 1); } else if (layerType == TimeValues) { return new SparseTimeValueModel(baseModel->getSampleRate(), 1, true); - } else if (layerType == FlexiNotes) { + } else if (layerType == FlexiNotes) { return new FlexiNoteModel(baseModel->getSampleRate(), 1, true); } else if (layerType == Notes) { return new NoteModel(baseModel->getSampleRate(), 1, true);
--- a/layer/SpectrogramLayer.cpp Wed Apr 02 08:53:32 2014 +0100 +++ b/layer/SpectrogramLayer.cpp Wed May 07 15:12:13 2014 +0100 @@ -3657,18 +3657,21 @@ "colourScheme=\"%4\" " "colourRotation=\"%5\" " "frequencyScale=\"%6\" " - "binDisplay=\"%7\" " - "normalizeColumns=\"%8\" " - "normalizeVisibleArea=\"%9\"") + "binDisplay=\"%7\" ") .arg(m_minFrequency) .arg(m_maxFrequency) .arg(m_colourScale) .arg(m_colourMap) .arg(m_colourRotation) .arg(m_frequencyScale) - .arg(m_binDisplay) + .arg(m_binDisplay); + + s += QString("normalizeColumns=\"%1\" " + "normalizeVisibleArea=\"%2\" " + "normalizeHybrid=\"%3\" ") .arg(m_normalizeColumns ? "true" : "false") - .arg(m_normalizeVisibleArea ? "true" : "false"); + .arg(m_normalizeVisibleArea ? "true" : "false") + .arg(m_normalizeHybrid ? "true" : "false"); Layer::toXml(stream, indent, extraAttributes + " " + s); } @@ -3741,5 +3744,9 @@ bool normalizeVisibleArea = (attributes.value("normalizeVisibleArea").trimmed() == "true"); setNormalizeVisibleArea(normalizeVisibleArea); + + bool normalizeHybrid = + (attributes.value("normalizeHybrid").trimmed() == "true"); + setNormalizeHybrid(normalizeHybrid); }
--- a/view/Pane.cpp Wed Apr 02 08:53:32 2014 +0100 +++ b/view/Pane.cpp Wed May 07 15:12:13 2014 +0100 @@ -465,6 +465,10 @@ m_scaleWidth = 0; + if (workModel) { + drawModelTimeExtents(r, paint, workModel); + } + if (m_manager && m_manager->shouldShowVerticalScale() && topLayer) { drawVerticalScale(r, topLayer, paint); } @@ -775,6 +779,39 @@ } void +Pane::drawModelTimeExtents(QRect r, QPainter &paint, const Model *model) +{ + int x0 = getXForFrame(model->getStartFrame()); + int x1 = getXForFrame(model->getEndFrame()); + + int lw = 10; + + paint.save(); + + QBrush brush; + + if (hasLightBackground()) { + brush = QBrush(QColor("#f8f8f8")); + paint.setPen(Qt::black); + } else { + brush = QBrush(QColor("#101010")); + paint.setPen(Qt::white); + } + + if (x0 > r.x()) { + paint.fillRect(0, 0, x0, height(), brush); + paint.drawLine(x0, 0, x0, height()); + } + + if (x1 < r.x() + r.width()) { + paint.fillRect(x1, 0, width() - x1, height(), brush); + paint.drawLine(x1, 0, x1, height()); + } + + paint.restore(); +} + +void Pane::drawAlignmentStatus(QRect r, QPainter &paint, const Model *model, bool down) {
--- a/view/Pane.h Wed Apr 02 08:53:32 2014 +0100 +++ b/view/Pane.h Wed May 07 15:12:13 2014 +0100 @@ -107,6 +107,7 @@ void drawVerticalScale(QRect r, Layer *, QPainter &); void drawFeatureDescription(Layer *, QPainter &); void drawCentreLine(int, QPainter &, bool omitLine); + void drawModelTimeExtents(QRect, QPainter &, const Model *); void drawDurationAndRate(QRect, const Model *, int, QPainter &); void drawWorkTitle(QRect, QPainter &, const Model *); void drawLayerNames(QRect, QPainter &);
--- a/view/ViewManager.cpp Wed Apr 02 08:53:32 2014 +0100 +++ b/view/ViewManager.cpp Wed May 07 15:12:13 2014 +0100 @@ -258,6 +258,14 @@ } void +ViewManager::addSelectionQuietly(const Selection &selection) +{ + MultiSelection ms(m_selections); + ms.addSelection(selection); + setSelections(ms, true); +} + +void ViewManager::removeSelection(const Selection &selection) { MultiSelection ms(m_selections); @@ -274,12 +282,14 @@ } void -ViewManager::setSelections(const MultiSelection &ms) +ViewManager::setSelections(const MultiSelection &ms, bool quietly) { if (m_selections.getSelections() == ms.getSelections()) return; SetSelectionCommand *command = new SetSelectionCommand(this, ms); CommandHistory::getInstance()->addCommand(command); - emit selectionChangedByUser(); + if (!quietly) { + emit selectionChangedByUser(); + } } size_t
--- a/view/ViewManager.h Wed Apr 02 08:53:32 2014 +0100 +++ b/view/ViewManager.h Wed May 07 15:12:13 2014 +0100 @@ -86,6 +86,13 @@ size_t constrainFrameToSelection(size_t frame) const; /** + * Adding a selection normally emits the selectionChangedByUser + * signal. Call this to add a selection without emitting that signal. + * This is used in session file load, for example. + */ + void addSelectionQuietly(const Selection &selection); + + /** * Return the selection that contains a given frame. * If defaultToFollowing is true, and if the frame is not in a * selected area, return the next selection after the given frame. @@ -297,7 +304,7 @@ bool m_playSoloMode; bool m_alignMode; - void setSelections(const MultiSelection &ms); + void setSelections(const MultiSelection &ms, bool quietly = false); void signalSelectionChange(); class SetSelectionCommand : public Command
--- a/widgets/InteractiveFileFinder.cpp Wed Apr 02 08:53:32 2014 +0100 +++ b/widgets/InteractiveFileFinder.cpp Wed May 07 15:12:13 2014 +0100 @@ -33,6 +33,7 @@ InteractiveFileFinder::m_instance; InteractiveFileFinder::InteractiveFileFinder() : + m_sessionExtension("sv"), m_lastLocatedLocation("") { SVDEBUG << "Registering interactive file finder" << endl; @@ -43,6 +44,12 @@ { } +void +InteractiveFileFinder::setApplicationSessionExtension(QString extension) +{ + m_sessionExtension = extension; +} + QString InteractiveFileFinder::getOpenFileName(FileType type, QString fallbackLocation) { @@ -57,7 +64,10 @@ case SessionFile: settingsKey = "sessionpath"; title = tr("Select a session file"); - filter = tr("Sonic Visualiser session files (*.sv)\nRDF files (%1)\nAll files (*.*)").arg(RDFImporter::getKnownExtensions()); + filter = tr("%1 session files (*.%1)\nRDF files (%3)\nAll files (*.*)") + .arg(QApplication::applicationName()) + .arg(m_sessionExtension) + .arg(RDFImporter::getKnownExtensions()); break; case AudioFile: @@ -97,9 +107,11 @@ case SessionOrAudioFile: settingsKey = "lastpath"; - filter = tr("All supported files (*.sv %1 %2)\nSonic Visualiser session files (*.sv)\nAudio files (%2)\nRDF files (%1)\nAll files (*.*)") + filter = tr("All supported files (*.sv %1 %2)\n%3 session files (*.%4)\nAudio files (%2)\nRDF files (%1)\nAll files (*.*)") .arg(RDFImporter::getKnownExtensions()) - .arg(AudioFileReaderFactory::getKnownExtensions()); + .arg(AudioFileReaderFactory::getKnownExtensions()) + .arg(QApplication::applicationName()) + .arg(m_sessionExtension); break; case ImageFile: @@ -123,10 +135,12 @@ case AnyFile: settingsKey = "lastpath"; - filter = tr("All supported files (*.sv %1 %2 %3)\nSonic Visualiser session files (*.sv)\nAudio files (%1)\nLayer files (%2)\nRDF files (%3)\nAll files (*.*)") + filter = tr("All supported files (*.sv %1 %2 %3)\n%4 session files (*.%5)\nAudio files (%1)\nLayer files (%2)\nRDF files (%3)\nAll files (*.*)") .arg(AudioFileReaderFactory::getKnownExtensions()) .arg(DataFileReaderFactory::getKnownExtensions()) - .arg(RDFImporter::getKnownExtensions()); + .arg(RDFImporter::getKnownExtensions()) + .arg(QApplication::applicationName()) + .arg(m_sessionExtension); break; }; @@ -216,7 +230,8 @@ case SessionFile: settingsKey = "savesessionpath"; title = tr("Select a session file"); - filter = tr("Sonic Visualiser session files (*.sv)\nAll files (*.*)"); + filter = tr("%1 session files (*.%2)\nAll files (*.*)") + .arg(QApplication::applicationName()).arg(m_sessionExtension); break; case AudioFile: @@ -300,7 +315,7 @@ dialog.setConfirmOverwrite(false); // we'll do that if (type == SessionFile) { - dialog.setDefaultSuffix("sv"); + dialog.setDefaultSuffix(m_sessionExtension); } else if (type == AudioFile) { dialog.setDefaultSuffix("wav"); } else if (type == ImageFile) {
--- a/widgets/InteractiveFileFinder.h Wed Apr 02 08:53:32 2014 +0100 +++ b/widgets/InteractiveFileFinder.h Wed May 07 15:12:13 2014 +0100 @@ -18,6 +18,7 @@ #include "data/fileio/FileFinder.h" +#include <QApplication> #include <QString> #include <QObject> @@ -29,6 +30,14 @@ public: virtual ~InteractiveFileFinder(); + /// Specify the extension for this application's session files + /// (without the dot) + void setApplicationSessionExtension(QString extension); + + QString getApplicationSessionExtension() const { + return m_sessionExtension; + } + QString getOpenFileName(FileType type, QString fallbackLocation = ""); QString getSaveFileName(FileType type, QString fallbackLocation = ""); void registerLastOpenedFilePath(FileType type, QString path); @@ -44,6 +53,7 @@ QString findRelative(QString location, QString relativeTo); QString locateInteractive(FileType type, QString thing); + QString m_sessionExtension; QString m_lastLocatedLocation; };