# HG changeset patch # User gyorgyf # Date 1365856757 -3600 # Node ID 1336439dc05523f28073bbe2e443a1cebef3bbaf # Parent 49afde2dd7048a9ed3fe2e9544fc8f21d2911a88 fixed flexi note layer and propagated model selection to analyser diff -r 49afde2dd704 -r 1336439dc055 layer/FlexiNoteLayer.cpp --- 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 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(); } diff -r 49afde2dd704 -r 1336439dc055 layer/LayerFactory.cpp --- 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(model)) { - types.insert(FlexiNotes); + // types.insert(FlexiNotes); types.insert(Notes); } if (dynamic_cast(model)) { types.insert(FlexiNotes); - types.insert(Notes); + // types.insert(Notes); } if (dynamic_cast(model)) { @@ -295,6 +295,8 @@ { // if (trySetModel(layer, model)) // return; + + std::cerr << "LayerFactory::setModel called... " << std::endl; if (trySetModel(layer, model)) return; @@ -314,11 +316,19 @@ if (trySetModel(layer, model)) return; - if (trySetModel(layer, model)) - return; + if (trySetModel(layer, model)) { + std::cerr << "trying to set note layer model" << std::endl; + return; } - if (trySetModel(layer, model)) - return; + if (trySetModel(layer, model)) { + std::cerr << "trying to set flexi note layer model" << std::endl; + return; } + + FlexiNoteLayer *clayer = dynamic_cast(layer); + if (!clayer) { std::cerr << "layer cast failed" << std::endl; return; } + FlexiNoteModel *cmodel = dynamic_cast(model); + if (!cmodel) { std::cerr << "model cast failed" << std::endl; return; } + clayer->setModel(cmodel); if (trySetModel(layer, model)) return; @@ -340,6 +350,7 @@ // if (trySetModel(layer, model)) // return; + std::cerr << "LayerFactory::setModel done... " << std::endl; } Model * diff -r 49afde2dd704 -r 1336439dc055 layer/NoteLayer.cpp --- 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(); }