Mercurial > hg > svgui
changeset 625:1336439dc055 tonioni
fixed flexi note layer and propagated model selection to analyser
author | gyorgyf |
---|---|
date | Sat, 13 Apr 2013 13:39:17 +0100 |
parents | 49afde2dd704 |
children | 7256926d3af1 |
files | layer/FlexiNoteLayer.cpp layer/LayerFactory.cpp layer/NoteLayer.cpp |
diffstat | 3 files changed, 46 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/FlexiNoteLayer.cpp Tue Mar 26 20:14:08 2013 +0000 +++ b/layer/FlexiNoteLayer.cpp Sat Apr 13 13:39:17 2013 +0100 @@ -39,21 +39,33 @@ #include <utility> FlexiNoteLayer::FlexiNoteLayer() : - SingleColourLayer(), - m_model(0), - m_editing(false), - m_originalPoint(0, 0.0, 0, 1.f, tr("New Point")), - m_editingPoint(0, 0.0, 0, 1.f, tr("New Point")), - m_editingCommand(0), - m_verticalScale(MIDIRangeScale), - m_scaleMinimum(34), - m_scaleMaximum(77) + SingleColourLayer(), + + m_model(0), + m_editing(false), + m_originalPoint(0, 0.0, 0, 1.f, tr("New Point")), + m_editingPoint(0, 0.0, 0, 1.f, tr("New Point")), + m_editingCommand(0), + m_verticalScale(AutoAlignScale), + m_scaleMinimum(0), + m_scaleMaximum(0) + + // m_model(0), + // m_editing(false), + // m_originalPoint(0, 0.0, 0, 1.f, tr("New Point")), + // m_editingPoint(0, 0.0, 0, 1.f, tr("New Point")), + // m_editingCommand(0), + // m_verticalScale(MIDIRangeScale), + // m_scaleMinimum(34), + // m_scaleMaximum(77) { + std::cerr << "NOTE: constructed FlexiNoteLayer" << std::endl; } void -FlexiNoteLayer::setModel(FlexiNoteModel *model) +FlexiNoteLayer::setModel(FlexiNoteModel *model) // THIS FUNCTION FAILS { + std::cerr << "NOTE: FlexiNoteLayer::setModel called" << std::endl; //delete this!! if (m_model == model) return; m_model = model; @@ -63,6 +75,7 @@ m_scaleMinimum = 0; m_scaleMaximum = 0; + std::cerr << "NOTE: FlexiNoteLayer::NoteModel set" << std::endl; //delete this!! emit modelReplaced(); }
--- a/layer/LayerFactory.cpp Tue Mar 26 20:14:08 2013 +0000 +++ b/layer/LayerFactory.cpp Sat Apr 13 13:39:17 2013 +0100 @@ -75,7 +75,7 @@ case TimeInstants: return Layer::tr("Time Instants"); case TimeValues: return Layer::tr("Time Values"); case Notes: return Layer::tr("Notes"); - case FlexiNotes: return Layer::tr("flexible Notes"); + case FlexiNotes: return Layer::tr("Flexible Notes"); case Regions: return Layer::tr("Regions"); case Text: return Layer::tr("Text"); case Image: return Layer::tr("Images"); @@ -161,13 +161,13 @@ } if (dynamic_cast<NoteModel *>(model)) { - types.insert(FlexiNotes); + // types.insert(FlexiNotes); types.insert(Notes); } if (dynamic_cast<FlexiNoteModel *>(model)) { types.insert(FlexiNotes); - types.insert(Notes); + // types.insert(Notes); } if (dynamic_cast<RegionModel *>(model)) { @@ -295,6 +295,8 @@ { // if (trySetModel<WaveformLayer, RangeSummarisableTimeValueModel>(layer, model)) // return; + + std::cerr << "LayerFactory::setModel called... " << std::endl; if (trySetModel<WaveformLayer, WaveFileModel>(layer, model)) return; @@ -314,11 +316,19 @@ if (trySetModel<TimeValueLayer, SparseTimeValueModel>(layer, model)) return; - if (trySetModel<NoteLayer, NoteModel>(layer, model)) - return; + if (trySetModel<NoteLayer, NoteModel>(layer, model)) { + std::cerr << "trying to set note layer model" << std::endl; + return; } - if (trySetModel<FlexiNoteLayer, FlexiNoteModel>(layer, model)) - return; + if (trySetModel<FlexiNoteLayer, FlexiNoteModel>(layer, model)) { + std::cerr << "trying to set flexi note layer model" << std::endl; + return; } + + FlexiNoteLayer *clayer = dynamic_cast<FlexiNoteLayer *>(layer); + if (!clayer) { std::cerr << "layer cast failed" << std::endl; return; } + FlexiNoteModel *cmodel = dynamic_cast<FlexiNoteModel *>(model); + if (!cmodel) { std::cerr << "model cast failed" << std::endl; return; } + clayer->setModel(cmodel); if (trySetModel<RegionLayer, RegionModel>(layer, model)) return; @@ -340,6 +350,7 @@ // if (trySetModel<SliceLayer, DenseThreeDimensionalModel>(layer, model)) // return; + std::cerr << "LayerFactory::setModel done... " << std::endl; } Model *
--- a/layer/NoteLayer.cpp Tue Mar 26 20:14:08 2013 +0000 +++ b/layer/NoteLayer.cpp Sat Apr 13 13:39:17 2013 +0100 @@ -49,12 +49,14 @@ m_scaleMinimum(0), m_scaleMaximum(0) { - + SVDEBUG << "constructed NoteLayer" << endl; } void NoteLayer::setModel(NoteModel *model) { + std::cerr << "NOTE: called NoteLayer::setModel" << std::endl; //delete this!! + if (m_model == model) return; m_model = model; @@ -65,6 +67,8 @@ m_scaleMinimum = 0; m_scaleMaximum = 0; + std::cerr << "NOTE: NoteLayer::NoteModel set" << std::endl; //delete this!! + emit modelReplaced(); }