本文整理汇总了C++中MarkerList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ MarkerList::begin方法的具体用法?C++ MarkerList::begin怎么用?C++ MarkerList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MarkerList
的用法示例。
在下文中一共展示了MarkerList::begin方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateMarkers
void CanvasNavigator::updateMarkers()
{
MarkerList* markers = song->marker();
for (iMarker m = markers->begin(); m != markers->end(); ++m)
{
QPointF point(calcSize(m->second.tick()), 0.0);
QGraphicsRectItem* marker = m_markers.value(m->second.id());
if(marker)
marker->setPos(point);
}
}
示例2: prevMarker
void MarkerView::prevMarker()
{
unsigned int curPos = song->cpos(); //prevent compiler warning: comparison of sigend/unsigned
unsigned int nextPos = 0;
MarkerList* marker = song->marker();
for (iMarker i = marker->begin(); i != marker->end(); ++i)
{
if (i->second.tick() < curPos && i->second.tick() > nextPos)
nextPos = i->second.tick();
}
/* if (nextPos == 0)
return;*/
Pos p(nextPos, true);
song->setPos(0, p, true, true, false);
}
示例3: markerChanged
void MarkerView::markerChanged(int val)
{
//if (val != Song::MARKER_CUR)
// return;
// p3.3.43
switch (val)
{
// MARKER_CUR, MARKER_ADD, MARKER_REMOVE, MARKER_NAME,
// MARKER_TICK, MARKER_LOCK
case Song::MARKER_ADD:
case Song::MARKER_REMOVE:
updateList();
break; // Try falling through and let it try to select something. No, let updateList() do it...
case Song::MARKER_CUR:
{
MarkerList* marker = song->marker();
for (iMarker i = marker->begin(); i != marker->end(); ++i)
{
if (i->second.current())
{
MarkerItem* item = (MarkerItem*) table->topLevelItem(0);
while (item)
{
if (item->marker() == &i->second)
{
table->setCurrentItem(item);
return;
}
item = (MarkerItem*) table->itemBelow(item);
}
}
}
}
break;
default:
break;
}
}
示例4: updateList
void MarkerView::updateList()
{
// Added p3.3.43 Manage selected item, due to clearing of table...
MarkerList* marker = song->marker();
MarkerItem* selitem = (MarkerItem*) table->currentItem();
Marker* selm = selitem ? selitem->marker() : 0;
// p3.3.44 Look for removed markers before added markers...
if (selitem)
{
MarkerItem* mitem = (MarkerItem*) table->topLevelItem(0);
while (mitem)
{
bool found = false;
for (iMarker i = marker->begin(); i != marker->end(); ++i)
{
Marker* m = &i->second;
if (m == mitem->marker())
{
found = true;
break;
}
}
// Anything removed from the marker list?
if (!found)
{
// If it is the current selected item, it no longer exists. Make the next item be selected.
if (mitem == selitem)
{
MarkerItem* mi = (MarkerItem*) table->itemBelow(selitem);
if (mi)
{
selitem = mi;
selm = selitem->marker();
}
}
}
mitem = (MarkerItem*) table->itemBelow(mitem);
}
}
// Look for added markers...
for (iMarker i = marker->begin(); i != marker->end(); ++i)
{
Marker* m = &i->second;
bool found = false;
MarkerItem* item = (MarkerItem*) table->topLevelItem(0);
while (item)
{
if (item->marker() == m)
{
found = true;
break;
}
item = (MarkerItem*) table->itemBelow(item);
}
// Anything new found in the marker list?
if (!found)
selm = m;
}
// Block signals added. Triggers itemSelectionChanged() causing crash. Tim.
table->blockSignals(true);
table->clear();
table->blockSignals(false);
//MarkerList* marker = song->marker();
for (iMarker i = marker->begin(); i != marker->end(); ++i)
{
Marker* m = &i->second;
// Changed p3.3.43
//QString tick;
//tick.setNum(i->first);
//new MarkerItem(table, m);
MarkerItem* item = new MarkerItem(table, m);
if (m == selm)
{
m->setCurrent(true);
table->setCurrentItem(item);
}
else
{
m->setCurrent(false);
}
}
}
示例5: pdraw
void MTScale::pdraw(QPainter& p, const QRect& r)
{
QColor colTimeLine = QColor(172,181,176);
int x = r.x();
int w = r.width();
//printf("MTScale::pdraw x:%d w:%d\n", x, w);
x -= 20;
w += 40; // wg. Text
//---------------------------------------------------
// draw Marker
//---------------------------------------------------
int y = 12;
p.setPen(colTimeLine);
p.setFont(QFont("fixed-width", 9, QFont::Bold));
p.drawLine(r.x(), y + 1, r.x() + r.width(), y + 1);
QRect tr(r);
tr.setHeight(12);
MarkerList* marker = song->marker();
for (iMarker m = marker->begin(); m != marker->end(); ++m)
{
int xp;
if (waveMode)
xp = mapx(m->second.frame());
else
xp = mapx(m->second.tick());
if (xp > x + w)
break;
int xe = r.x() + r.width();
iMarker mm = m;
++mm;
if (mm != marker->end())
{
if (waveMode)
xe = mapx(tempomap.tick2frame(mm->first));
else
xe = mapx(mm->first);
}
QRect tr(xp, 0, xe - xp, 13);
QRect wr = r.intersect(tr);
if (!wr.isEmpty())
{
if (m->second.current())
{
p.fillRect(wr, QColor(89, 89, 102));
}
int x2;
if (mm != marker->end())
{
if (waveMode)
x2 = mapx(tempomap.tick2frame(mm->first));
else
x2 = mapx(mm->first);
}
else
x2 = xp + 200;
//printf("MTScale::pdraw marker %s xp:%d y:%d h:%d r.x:%d r.w:%d\n", m->second.name().toLatin1(), xp, height(), y, r.x(), r.width());
// Must be reasonable about very low negative x values! With long songs > 15min
// and with high horizontal magnification, 'ghost' drawings appeared,
// apparently the result of truncation later (xp = -65006 caused ghosting
// at bar 245 with magnification at max.), even with correct clipping region
// applied to painter in View::paint(). Tim. Apr 5 2009
// Quote: "Warning: Note that QPainter does not attempt to work around
// coordinate limitations in the underlying window system. Some platforms may
// behave incorrectly with coordinates as small as +/-4000."
if (xp >= -32)
p.drawPixmap(xp, 0, *flagIconS);
if (xp >= -1023)
{
QRect r = QRect(xp + 10, 0, x2 - xp, 12);
p.setPen(colTimeLine);
p.drawText(r, Qt::AlignLeft | Qt::AlignVCenter, m->second.name());
}
if (xp >= 0)
{
p.setPen(colTimeLine);
p.drawLine(xp, y, xp, height());
}
}
}
unsigned ctick;
int bar1, bar2, beat;
unsigned tick;
if (waveMode)
{
ctick = tempomap.frame2tick(mapxDev(x));
AL::sigmap.tickValues(ctick, &bar1, &beat, &tick);
//.........这里部分代码省略.........
示例6: adjustGlobalLists
void adjustGlobalLists(Undo& operations, int startPos, int diff)
{
const TempoList* t = &MusEGlobal::tempomap;
const AL::SigList* s = &AL::sigmap;
const KeyList* k = &MusEGlobal::keymap;
criTEvent it = t->rbegin();
AL::criSigEvent is = s->rbegin();
criKeyEvent ik = k->rbegin();
// key
for (; ik != k->rend(); ik++) {
const KeyEvent &ev = (KeyEvent)ik->second;
int tick = ev.tick;
int key = ev.key;
if (tick < startPos )
break;
if (tick > startPos && tick +diff < startPos ) { // remove
operations.push_back(UndoOp(UndoOp::DeleteKey, tick, key));
}
else {
operations.push_back(UndoOp(UndoOp::DeleteKey,tick, key));
operations.push_back(UndoOp(UndoOp::AddKey,tick+diff, key));
}
}
// tempo
for (; it != t->rend(); it++) {
const TEvent* ev = (TEvent*)it->second;
int tick = ev->tick;
int tempo = ev->tempo;
if (tick < startPos )
break;
if (tick > startPos && tick +diff < startPos ) { // remove
operations.push_back(UndoOp(UndoOp::DeleteTempo,tick, tempo));
}
else {
operations.push_back(UndoOp(UndoOp::DeleteTempo,tick, tempo));
operations.push_back(UndoOp(UndoOp::AddTempo,tick+diff, tempo));
}
}
// sig
for (; is != s->rend(); is++) {
const AL::SigEvent* ev = (AL::SigEvent*)is->second;
int tick = ev->tick;
if (tick < startPos )
break;
int z = ev->sig.z;
int n = ev->sig.n;
if (tick > startPos && tick +diff < startPos ) { // remove
operations.push_back(UndoOp(UndoOp::DeleteSig,tick, z, n));
}
else {
operations.push_back(UndoOp(UndoOp::DeleteSig,tick, z, n));
operations.push_back(UndoOp(UndoOp::AddSig,tick+diff, z, n));
}
}
MarkerList *markerlist = MusEGlobal::song->marker();
for(iMarker i = markerlist->begin(); i != markerlist->end(); ++i)
{
Marker* m = &i->second;
int tick = m->tick();
if (tick > startPos)
{
if (tick + diff < startPos ) { // these ticks should be removed
operations.push_back(UndoOp(UndoOp::ModifyMarker, 0, m));
} else {
Marker *newMarker = new Marker();
*newMarker = *m;
newMarker->setTick(tick + diff);
operations.push_back(UndoOp(UndoOp::ModifyMarker, newMarker, m));
}
}
}
}
示例7: updateParts
void CanvasNavigator::updateParts()/*{{{*/
{
m_editing = true;
m_playhead = 0;
m_start = 0;
m_canvasBox = 0;
m_punchIn = 0;
m_punchOut = 0;
m_parts.clear();
m_markers.clear();
m_scene->clear();
/*foreach(PartItem* i, m_parts)
m_scene->removeItem(i);
while(m_parts.size())
delete m_parts.takeFirst();*/
m_heightList.clear();
m_scene->setSceneRect(QRectF());
int index = 1;
//QList<QGraphicsItem*> group;
MidiTrackList* tl = song->visibletracks();
ciMidiTrack ci = tl->begin();
for(; ci != tl->end(); ci++)
{
m_heightList.append((*ci)->height());
}
ci = tl->begin();
if(ci != tl->end())
{
int mh = (*ci)->height();
double partHeight = (mh * 8)/100;
m_start = m_scene->addRect(0.0, 0.0, calcSize(song->len()), partHeight);
m_start->setBrush(QColor(63, 63, 63));
m_start->setPen(QPen(QColor(63, 63, 63)));
m_start->setZValue(-50);
ci++;//Special case for master
}
for(; ci != tl->end(); ci++)
{
MidiTrack* track = *ci;
if(track)
{
QList<int> list = m_heightList.mid(0, index);
int ypos = 0;
foreach(int i, list)
ypos += i;
ypos = (ypos * 8)/100;
int ih = m_heightList.at(index);
double partHeight = (ih * 8)/100;
//qDebug("CanvasNavigator::updateParts: partHeight: %2f, ypos: %d", partHeight, ypos);
PartList* parts = track->parts();
if(parts && !parts->empty())
{
for(iPart p = parts->begin(); p != parts->end(); p++)
{
Part *part = p->second;
int tick, len;
if(part)
{
tick = part->tick();
len = part->lenTick();
}
double w = calcSize(len);
double pos = calcSize(tick);
PartItem* item = new PartItem(pos, ypos, w, partHeight);
item->setPart(part);
m_parts.append(item);
//group.append((QGraphicsItem*)item);
int i = part->colorIndex();
QColor partWaveColor(config.partWaveColors[i]);
QColor partColor(config.partColors[i]);
//partWaveColor.setAlpha(150);
partColor.setAlpha(150);
item->setBrush(part->selected() ? partWaveColor : partColor);
item->setPen(part->selected() ? partColor : partWaveColor);
m_scene->addItem(item);
}
}
++index;
}
}
QColor colTimeLine = QColor(0, 186, 255);
int kpos = 0;
foreach(int i, m_heightList)
kpos += i;
//kpos = ((kpos + 400) * 8)/100;
kpos = ((kpos + 400) * 8)/100;
m_playhead = new QGraphicsRectItem(0, 0, 1, kpos);
m_playhead->setBrush(colTimeLine);
m_playhead->setPen(Qt::NoPen);
m_playhead->setZValue(124001.0f);
m_playhead->setFlags(QGraphicsItem::ItemIgnoresTransformations);
m_scene->addItem(m_playhead);
QColor loopColor(139, 225, 69);
QColor markerColor(243,191,124);
MarkerList* markers = song->marker();
for (iMarker m = markers->begin(); m != markers->end(); ++m)
//.........这里部分代码省略.........