本文整理汇总了C++中CItemList::end方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemList::end方法的具体用法?C++ CItemList::end怎么用?C++ CItemList::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemList
的用法示例。
在下文中一共展示了CItemList::end方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getLeftMostSelected
CItem* EventCanvas::getLeftMostSelected()
{
iCItem i, iLeftmost;
CItem* leftmost = NULL;
// get a list of items that belong to the current part
// since multiple parts have populated the _items list
// we need to filter on the actual current Part!
//CItemList list = getItemlistForCurrentPart();
CItemList list = _items;
if(multiPartSelectionAction && !multiPartSelectionAction->isChecked())
list = getItemlistForCurrentPart();
if (list.size() > 0)
{
i = list.end();
while (i != list.begin())
{
--i;
if (i->second->isSelected())
{
iLeftmost = i;
leftmost = i->second;
}
}
}
return leftmost;
}
示例2: getRightMostSelected
CItem* EventCanvas::getRightMostSelected()
{
iCItem i, iRightmost;
CItem* rightmost = NULL;
// get a list of items that belong to the current part
// since multiple parts have populated the _items list
// we need to filter on the actual current Part!
CItemList list = _items;
if(multiPartSelectionAction && !multiPartSelectionAction->isChecked())
list = getItemlistForCurrentPart();
//CItemList list = getItemlistForCurrentPart();
//Get the rightmost selected note (if any)
i = list.begin();
while (i != list.end())
{
if (i->second->isSelected())
{
iRightmost = i;
rightmost = i->second;
}
++i;
}
return rightmost;
}
示例3:
QList<Event> AbstractMidiEditor::getSelectedEvents()/*{{{*/
{
QList<Event> rv;
if(canvas)
{
CItemList list = canvas->getSelectedItemsForCurrentPart();
for (iCItem k = list.begin(); k != list.end(); ++k)
{
NEvent* nevent = (NEvent*) (k->second);
Event event = nevent->event();
if (event.type() != Note)
continue;
rv.append(event);
}
}
return rv;
}/*}}}*/
示例4: selectAtTick
void EventCanvas::selectAtTick(unsigned int tick)/*{{{*/
{
CItemList list = _items;
if(multiPartSelectionAction && !multiPartSelectionAction->isChecked())
list = getItemlistForCurrentPart();
//CItemList list = getItemlistForCurrentPart();
//Select note nearest tick, if none selected and there are any
if (!list.empty() && selectionSize() == 0)
{
iCItem i = list.begin();
CItem* nearest = i->second;
while (i != list.end())
{
CItem* cur = i->second;
unsigned int curtk = abs(cur->x() + cur->part()->tick() - tick);
unsigned int neartk = abs(nearest->x() + nearest->part()->tick() - tick);
if (curtk < neartk)
{
nearest = cur;
}
i++;
}
if (!nearest->isSelected())
{
selectItem(nearest, true);
if(editor->isGlobalEdit())
populateMultiSelect(nearest);
songChanged(SC_SELECTION);
}
itemPressed(nearest);
m_tempPlayItems.append(nearest);
QTimer::singleShot(NOTE_PLAY_TIME, this, SLOT(playReleaseForItem()));
}
}/*}}}*/
示例5: populateMultiSelect
void EventCanvas::populateMultiSelect(CItem* baseItem)/*{{{*/
{
if(editor->isGlobalEdit() && baseItem)
{
PartList* pl = editor->parts();
int curTranspose = ((MidiTrack*)baseItem->part()->track())->getTransposition();
Event curEvent = baseItem->event();
int curPitch = curEvent.pitch();
int curRawPitch = curPitch - curTranspose;
//int curLen = curEvent.lenTick();
m_multiSelect.clear();
for(iPart p = pl->begin(); p != pl->end(); ++p)
{
if(p->second == _curPart)
continue;
CItemList pitems = getItemlistForPart(p->second);
for (iCItem i = pitems.begin(); i != pitems.end(); ++i)
{
MidiTrack* mtrack = (MidiTrack*)i->second->part()->track();
int transp = mtrack->getTransposition();
Event e = i->second->event();
if(e.empty())
continue;
int pitch = e.pitch();
int rpitch = pitch - transp;
//int len = e.lenTick();
//printf("Current pitch: %d, rawpitch: %d - note pitch: %d, raw: %d\n", curPitch, curRawPitch, pitch, rpitch);
if(e.tick() == curEvent.tick() && rpitch == curRawPitch/*, len == curLen*/)
{
m_multiSelect.add(i->second);
break;
}
}
}
//printf("MultiSelect list size: %d \n", (int)m_multiSelect.size());
}
}/*}}}*/
示例6: actionCommand
void EventCanvas::actionCommand(int action)/*{{{*/
{
switch(action)
{
case LOCATORS_TO_SELECTION:
{
int tick_max = 0;
int tick_min = INT_MAX;
bool found = false;
for (iCItem i = _items.begin(); i != _items.end(); i++)
{
if (!i->second->isSelected())
continue;
int tick = i->second->x();
int len = i->second->event().lenTick();
found = true;
if (tick + len > tick_max)
tick_max = tick + len;
if (tick < tick_min)
tick_min = tick;
}
if (found)
{
Pos p1(tick_min, true);
Pos p2(tick_max, true);
song->setPos(1, p1);
song->setPos(2, p2);
}
}
break;
case SEL_RIGHT ... SEL_RIGHT_ADD:
{
if (action == SEL_RIGHT && allItemsAreSelected())
{
deselectAll();
selectAtTick(song->cpos());
return;
}
iCItem i, iRightmost;
CItem* rightmost = NULL;
// get a list of items that belong to the current part
// since multiple parts have populated the _items list
// we need to filter on the actual current Part!
CItemList list = _items;
if(multiPartSelectionAction && !multiPartSelectionAction->isChecked())
list = getItemlistForCurrentPart();
//Get the rightmost selected note (if any)
i = list.begin();
while (i != list.end())
{
if (i->second->isSelected())
{
iRightmost = i;
rightmost = i->second;
}
++i;
}
if (rightmost)
{
iCItem temp = iRightmost;
temp++;
//If so, deselect current note and select the one to the right
if (temp != list.end())
{
if (action != SEL_RIGHT_ADD)
deselectAll();
iRightmost++;
iRightmost->second->setSelected(true);
itemPressed(iRightmost->second);
m_tempPlayItems.append(iRightmost->second);
QTimer::singleShot(NOTE_PLAY_TIME, this, SLOT(playReleaseForItem()));
if(editor->isGlobalEdit())
populateMultiSelect(iRightmost->second);
updateSelection();
}
}
else // there was no item selected at all? Then select nearest to tick if there is any
{
selectAtTick(song->cpos());
updateSelection();
}
}
break;
case SEL_LEFT ... SEL_LEFT_ADD:
{
if (action == SEL_LEFT && allItemsAreSelected())
{
deselectAll();
selectAtTick(song->cpos());
return;
}
iCItem i, iLeftmost;
//.........这里部分代码省略.........
示例7: viewMousePressEvent
void EventCanvas::viewMousePressEvent(QMouseEvent* event)/*{{{*/
{
///keyState = event->state();
_keyState = ((QInputEvent*) event)->modifiers();
_button = event->button();
//printf("viewMousePressEvent buttons:%x mods:%x button:%x\n", (int)event->buttons(), (int)keyState, event->button());
// special events if right button is clicked while operations
// like moving or drawing lasso is performed.
if (event->buttons() & Qt::RightButton & ~(event->button()))
{
//printf("viewMousePressEvent special buttons:%x mods:%x button:%x\n", (int)event->buttons(), (int)keyState, event->button());
switch (_drag)
{
case DRAG_LASSO:
_drag = DRAG_OFF;
redraw();
return;
case DRAG_MOVE:
_drag = DRAG_OFF;
endMoveItems(_start, MOVE_MOVE, 0);
return;
default:
break;
}
}
// ignore event if (another) button is already active:
if (event->buttons() & (Qt::LeftButton | Qt::RightButton | Qt::MidButton) & ~(event->button()))
{
//printf("viewMousePressEvent ignoring buttons:%x mods:%x button:%x\n", (int)event->buttons(), (int)keyState, event->button());
return;
}
bool shift = _keyState & Qt::ShiftModifier;
bool alt = _keyState & Qt::AltModifier;
bool ctrl = _keyState & Qt::ControlModifier;
_start = event->pos();
//---------------------------------------------------
// set curItem to item mouse is pointing
// (if any)
//---------------------------------------------------
CItemList list = _items;
if(multiPartSelectionAction && !multiPartSelectionAction->isChecked())
list = getItemlistForCurrentPart();
if (virt())
{
_curItem = list.find(_start);//_items.find(_start);
}
else
{
_curItem = 0; //selectAtTick(_start.x());
iCItem ius;
bool usfound = false;
for (iCItem i = list.begin(); i != list.end(); ++i)
{
MidiTrack* mtrack = (MidiTrack*)i->second->part()->track();
int sy = _start.y();
int p = y2pitch(sy);
if(editor->isGlobalEdit())
p += mtrack->getTransposition();
int p2 = pitch2y(p);
QPoint lpos(_start.x(), p2);
QRect box = i->second->bbox();
int x = rmapxDev(box.x());
int y = rmapyDev(box.y());
int w = rmapxDev(box.width());
int h = rmapyDev(box.height());
QRect r(x, y, w, h);
r.translate(i->second->pos().x(), i->second->pos().y());
if(r.contains(lpos))
{
if (i->second->isSelected())
{
_curItem = i->second;
break;
}
else if (!usfound)
{
ius = i;
usfound = true;
}
}
}
if (!_curItem && usfound)
_curItem = ius->second;
}
if(editor->isGlobalEdit() && _curItem)
{
populateMultiSelect(_curItem);
}
if (_curItem && (event->button() == Qt::MidButton))
{
if (!_curItem->isSelected())
{
//.........这里部分代码省略.........
示例8: songChanged
void AbstractMidiEditor::songChanged(int type)/*{{{*/
{
if (type)
{
if (type & (SC_PART_REMOVED | SC_PART_MODIFIED
| SC_PART_INSERTED | SC_TRACK_REMOVED))
{
genPartlist();
// close window if editor has no parts anymore
if (parts()->empty())
{
close();
return;
}
}
if (canvas)
canvas->songChanged(type);
if (type & (SC_PART_REMOVED | SC_PART_MODIFIED
| SC_PART_INSERTED | SC_TRACK_REMOVED))
{
updateHScrollRange();
if (canvas)
setWindowTitle(canvas->getCaption());
if (type & SC_SIG)
time->update();
}
if (type & SC_SELECTION)
{
CItemList list = canvas->getSelectedItemsForCurrentPart();
//Get the rightmost selected note (if any)
iCItem i, iRightmost;
CItem* rightmost = NULL;
i = list.begin();
while (i != list.end())
{
if (i->second->isSelected())
{
iRightmost = i;
rightmost = i->second;
}
++i;
}
if (rightmost)
{
int pos = rightmost->pos().x();
pos = canvas->mapx(pos) + hscroll->offset();
int s = hscroll->offset();
int e = s + canvas->width();
if (pos > e)
hscroll->setOffset(rightmost->pos().x());
if (pos < s)
hscroll->setOffset(rightmost->pos().x());
}
}
}
}/*}}}*/