本文整理汇总了C++中EventSelection::getStartTime方法的典型用法代码示例。如果您正苦于以下问题:C++ EventSelection::getStartTime方法的具体用法?C++ EventSelection::getStartTime怎么用?C++ EventSelection::getStartTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventSelection
的用法示例。
在下文中一共展示了EventSelection::getStartTime方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BasicCommand
CollapseRestsCommand::CollapseRestsCommand
(EventSelection &selection) :
BasicCommand(getGlobalName(),
selection.getSegment(),
selection.getStartTime(),
selection.getEndTime())
{
// nothing else
}
示例2: MacroCommand
CutAndCloseCommand::CutAndCloseCommand(EventSelection &selection,
Clipboard *clipboard) :
MacroCommand(getGlobalName())
{
addCommand(new CutCommand(selection, clipboard));
addCommand(new CloseCommand(&selection.getSegment(),
selection.getEndTime(),
selection.getStartTime()));
}
示例3: BasicCommand
BasicSelectionCommand::BasicSelectionCommand(const QString &name,
EventSelection &selection,
bool bruteForceRedo) :
BasicCommand(name,
selection.getSegment(),
selection.getStartTime(),
selection.getEndTime(),
bruteForceRedo)
{
// nothing
}
示例4: BasicCommand
EventUnquantizeCommand::EventUnquantizeCommand(
EventSelection &selection,
Quantizer *quantizer) :
BasicCommand(tr("Unquantize Events"),
selection.getSegment(),
selection.getStartTime(),
selection.getEndTime(),
true), // bruteForceRedo
m_quantizer(quantizer),
m_selection(&selection)
{
// nothing else
}
示例5: BasicCommand
AddIndicationCommand::AddIndicationCommand(std::string indicationType,
EventSelection &selection) :
BasicCommand(getGlobalName(indicationType),
selection.getSegment(),
std::min(selection.getStartTime(), selection.getNotationStartTime()),
std::max(selection.getEndTime(), selection.getNotationEndTime())),
m_indicationType(indicationType),
m_indicationStart(selection.getNotationStartTime()),
m_indicationDuration(selection.getTotalNotationDuration()),
m_lastInsertedEvent(0)
{
if (!canExecute()) {
throw CommandFailed
//!!! need to use text from trunk/src/gui/editors/notation/NotationView.cpp (but this requires an informal human-readable version of the indication name)
(qstrtostr(tr("Can't add identical overlapping indications")));
}
}
示例6: tr
void
MatrixMover::handleMouseRelease(const MatrixMouseEvent *e)
{
if (!e) return;
MATRIX_DEBUG << "MatrixMover::handleMouseRelease() - newPitch = "
<< e->pitch << endl;
if (!m_currentElement || !m_currentViewSegment) return;
timeT newTime = m_currentElement->getViewAbsoluteTime() +
(e->snappedLeftTime - m_clickSnappedLeftTime);
int newPitch = e->pitch;
if (newPitch > 127) newPitch = 127;
if (newPitch < 0) newPitch = 0;
// get a basic pitch difference calculation comparing the current element's
// pitch to the pitch the mouse was released at (see note in
// handleMouseMove)
using BaseProperties::PITCH;
timeT diffTime = newTime - m_currentElement->getViewAbsoluteTime();
int diffPitch = 0;
if (m_currentElement->event()->has(PITCH)) {
diffPitch = newPitch - m_currentElement->event()->get<Int>(PITCH);
}
EventSelection* selection = m_scene->getSelection();
// factor in transpose to adjust the height calculation
long pitchOffset = selection->getSegment().getTranspose();
diffPitch += (pitchOffset * -1);
if ((diffTime == 0 && diffPitch == 0) || selection->getAddedEvents() == 0) {
for (size_t i = 0; i < m_duplicateElements.size(); ++i) {
delete m_duplicateElements[i]->event();
delete m_duplicateElements[i];
}
m_duplicateElements.clear();
m_currentElement = 0;
return;
}
if (newPitch != m_lastPlayedPitch) {
long velocity = m_widget->getCurrentVelocity();
m_currentElement->event()->get<Int>(BaseProperties::VELOCITY, velocity);
m_scene->playNote(m_currentViewSegment->getSegment(), newPitch + (pitchOffset * -1), velocity);
m_lastPlayedPitch = newPitch;
}
QString commandLabel;
if (m_quickCopy) {
if (selection->getAddedEvents() < 2) {
commandLabel = tr("Copy and Move Event");
} else {
commandLabel = tr("Copy and Move Events");
}
} else {
if (selection->getAddedEvents() < 2) {
commandLabel = tr("Move Event");
} else {
commandLabel = tr("Move Events");
}
}
MacroCommand *macro = new MacroCommand(commandLabel);
EventSelection::eventcontainer::iterator it =
selection->getSegmentEvents().begin();
Segment &segment = m_currentViewSegment->getSegment();
EventSelection *newSelection = new EventSelection(segment);
timeT normalizeStart = selection->getStartTime();
timeT normalizeEnd = selection->getEndTime();
if (m_quickCopy) {
for (size_t i = 0; i < m_duplicateElements.size(); ++i) {
timeT time = m_duplicateElements[i]->getViewAbsoluteTime();
timeT endTime = time + m_duplicateElements[i]->getViewDuration();
if (time < normalizeStart) normalizeStart = time;
if (endTime > normalizeEnd) normalizeEnd = endTime;
macro->addCommand(new MatrixInsertionCommand
(segment, time, endTime,
m_duplicateElements[i]->event()));
delete m_duplicateElements[i]->event();
delete m_duplicateElements[i];
}
m_duplicateElements.clear();
m_quickCopy = false;
}
for (; it != selection->getSegmentEvents().end(); ++it) {
timeT newTime = (*it)->getAbsoluteTime() + diffTime;
int newPitch = 60;
if ((*it)->has(PITCH)) {
newPitch = (*it)->get<Int>(PITCH) + diffPitch;
//.........这里部分代码省略.........
示例7: tr
void
MatrixResizer::handleMouseRelease(const MatrixMouseEvent *e)
{
if (!e || !m_currentElement || !m_currentViewSegment) return;
// snap in the closest direction
timeT snapTime = e->snappedLeftTime;
if (e->snappedRightTime - e->time < e->time - e->snappedLeftTime) {
snapTime = e->snappedRightTime;
}
timeT newDuration = snapTime - m_currentElement->getViewAbsoluteTime();
timeT durationDiff = newDuration - m_currentElement->getViewDuration();
EventSelection *selection = m_scene->getSelection();
if (!selection || selection->getAddedEvents() == 0) return;
QString commandLabel = tr("Resize Event");
if (selection->getAddedEvents() > 1) commandLabel = tr("Resize Events");
MacroCommand *macro = new MacroCommand(commandLabel);
EventSelection::eventcontainer::iterator it =
selection->getSegmentEvents().begin();
Segment &segment = m_currentViewSegment->getSegment();
EventSelection *newSelection = new EventSelection(segment);
timeT normalizeStart = selection->getStartTime();
timeT normalizeEnd = selection->getEndTime();
for (; it != selection->getSegmentEvents().end(); ++it) {
timeT t = (*it)->getAbsoluteTime();
timeT d = (*it)->getDuration();
MATRIX_DEBUG << "MatrixResizer::handleMouseRelease - "
<< "Time = " << t
<< ", Duration = " << d << endl;
d = d + durationDiff;
if (d < 0) {
t = t + d;
d = -d;
} else if (d == 0) {
d = getSnapGrid()->getSnapTime(t);
}
if (t + d > segment.getEndMarkerTime()) {
d = segment.getEndMarkerTime() - t;
if (d <= 0) {
d = segment.getEndMarkerTime();
t = d - getSnapGrid()->getSnapTime(t);
}
}
Event *newEvent = new Event(**it, t, d);
macro->addCommand(new MatrixModifyCommand(segment,
*it,
newEvent,
false,
false));
newSelection->addEvent(newEvent);
}
normalizeStart = std::min(normalizeStart, newSelection->getStartTime());
normalizeEnd = std::max(normalizeEnd, newSelection->getEndTime());
macro->addCommand(new NormalizeRestsCommand(segment,
normalizeStart,
normalizeEnd));
m_scene->setSelection(0, false);
CommandHistory::getInstance()->addCommand(macro);
m_scene->setSelection(newSelection, false);
// m_mParentView->update();
m_currentElement = 0;
setBasicContextHelp();
}