Hello everybody!
I have a midi -sequencer like GUI where single notes can be drag’n’dropped to manipulate real audio data in my model. The GUI notes are represented by juce::Component’s. After a drag they call a PluginProcessor member function (changeNote) which manipulates the data in the model.
Now I tried this in the GUI note’s mouseUp method:
[code]void GraphicNote::mouseUp(const MouseEvent& event){
Point<int> sequencerDimension;
sequencerDimension.setX(getParentWidth());
sequencerDimension.setY(getParentHeight());
dynamic_cast<NewProjectAudioProcessor*>(dynamic_cast<NewProjectAudioProcessorEditor*>(getTopLevelComponent())->getAudioProcessor())
->changeNote(noteNumber, this->getPosition(), sequencerDimension);
}[/code]
This looks totally ugly and the NewProjectAudioProcessor::changeNote method can’t access PluginEditor’s members. But without the casts I can not call the specific methods I need.
How would I elegantly do this? (I’m a beginner and try to implement the Model-View-Contoller pattern we were taught at University)
Regards
oliver