本文整理汇总了C++中EventSelection::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ EventSelection::contains方法的具体用法?C++ EventSelection::contains怎么用?C++ EventSelection::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventSelection
的用法示例。
在下文中一共展示了EventSelection::contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EventSelection
void
MatrixResizer::handleLeftButtonPress(const MatrixMouseEvent *e)
{
MATRIX_DEBUG << "MatrixResizer::handleLeftButtonPress() : el = "
<< e->element << endl;
if (!e->element) return;
m_currentViewSegment = e->viewSegment;
m_currentElement = e->element;
// Add this element and allow movement
//
EventSelection* selection = m_scene->getSelection();
Event *event = m_currentElement->event();
if (selection) {
EventSelection *newSelection;
if ((e->modifiers & Qt::ShiftModifier) ||
selection->contains(event)) {
newSelection = new EventSelection(*selection);
} else {
newSelection = new EventSelection(m_currentViewSegment->getSegment());
}
newSelection->addEvent(event);
m_scene->setSelection(newSelection, true);
// m_mParentView->canvas()->update();
} else {
m_scene->setSingleSelectedEvent(m_currentViewSegment,
m_currentElement,
true);
// m_mParentView->canvas()->update();
}
}
示例2: EventSelection
void
MatrixMover::handleLeftButtonPress(const MatrixMouseEvent *e)
{
MATRIX_DEBUG << "MatrixMover::handleLeftButtonPress() : snapped time = " << e->snappedLeftTime << ", el = " << e->element << endl;
if (!e->element) return;
// Check the scene's current segment (apparently not necessarily the same
// segment referred to by the scene's current view segment) for this event;
// return if not found, indicating that this event is from some other,
// non-active segment.
//
// I think notation just makes whatever segment active when you click an
// event outside the active segment, and I think that's what this code
// attempted to do too. I couldn't get that to work at all. This is better
// than being able to click on non-active elements to create new events by
// accident, and will probably fly. Especially since the multi-segment
// matrix is new, and we're defining the terms of how it works.
Segment *segment = m_scene->getCurrentSegment();
if (!segment) return;
bool found = false;
for (Segment::iterator i = segment->begin(); i != segment->end(); ++i) {
if ((*i) == e->element->event()) found = true;
}
if (!found) {
MATRIX_DEBUG << "Clicked element not owned by active segment. Returning..." << endl;
return;
}
m_currentViewSegment = e->viewSegment;
m_currentElement = e->element;
m_clickSnappedLeftTime = e->snappedLeftTime;
m_quickCopy = (e->modifiers & Qt::ControlModifier);
if (!m_duplicateElements.empty()) {
for (size_t i = 0; i < m_duplicateElements.size(); ++i) {
delete m_duplicateElements[i]->event();
delete m_duplicateElements[i];
}
m_duplicateElements.clear();
}
// Add this element and allow movement
//
EventSelection* selection = m_scene->getSelection();
Event *event = m_currentElement->event();
if (selection) {
EventSelection *newSelection;
if ((e->modifiers & Qt::ShiftModifier) ||
selection->contains(event)) {
newSelection = new EventSelection(*selection);
} else {
newSelection = new EventSelection(m_currentViewSegment->getSegment());
}
// if the selection already contains the event, remove it from the
// selection if shift is pressed
if (selection->contains(event)) {
if (e->modifiers & Qt::ShiftModifier) {
newSelection->removeEvent(event);
}
} else {
newSelection->addEvent(event);
}
m_scene->setSelection(newSelection, true);
selection = newSelection;
} else {
m_scene->setSingleSelectedEvent(m_currentViewSegment,
m_currentElement, true);
}
long velocity = m_widget->getCurrentVelocity();
event->get<Int>(BaseProperties::VELOCITY, velocity);
long pitchOffset = m_currentViewSegment->getSegment().getTranspose();
long pitch = 60;
event->get<Int>(BaseProperties::PITCH, pitch);
// We used to m_scene->playNote() here, but the new concert pitch matrix was
// playing chords the first time I clicked a note. Investigation with
// KMidiMon revealed two notes firing nearly simultaneously, and with
// segments of 0 transpose, they were simply identical to each other. One
// of them came from here, and this was the one sounding at the wrong pitch
// in transposed segments. I've simply removed it with no apparent ill side
// effects, and a problem solved super cheap.
m_lastPlayedPitch = pitch;
if (m_quickCopy && selection) {
for (EventSelection::eventcontainer::iterator i =
selection->getSegmentEvents().begin();
i != selection->getSegmentEvents().end(); ++i) {
MatrixElement *duplicate = new MatrixElement
//.........这里部分代码省略.........