当前位置: 首页>>代码示例>>C++>>正文


C++ MarkerList类代码示例

本文整理汇总了C++中MarkerList的典型用法代码示例。如果您正苦于以下问题:C++ MarkerList类的具体用法?C++ MarkerList怎么用?C++ MarkerList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MarkerList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ASSERT

Vector<IntRect> DocumentMarkerController::renderedRectsForMarkers(DocumentMarker::MarkerType markerType)
{
    Vector<IntRect> result;

    if (!possiblyHasMarkers(markerType))
        return result;
    ASSERT(!(m_markers.isEmpty()));

    // outer loop: process each node
    MarkerMap::iterator end = m_markers.end();
    for (MarkerMap::iterator nodeIterator = m_markers.begin(); nodeIterator != end; ++nodeIterator) {
        // inner loop; process each marker in this node
        MarkerList* list = nodeIterator->value;
        unsigned markerCount = list->size();
        for (unsigned markerIndex = 0; markerIndex < markerCount; ++markerIndex) {
            const RenderedDocumentMarker& marker = list->at(markerIndex);

            // skip marker that is wrong type
            if (marker.type() != markerType)
                continue;

            if (!marker.isRendered())
                continue;

            result.append(marker.renderedRect());
        }
    }

    return result;
}
开发者ID:mychangle123,项目名称:Chromium-WebCL,代码行数:30,代码来源:DocumentMarkerController.cpp

示例2: ASSERT

void DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange(Range* range, DocumentMarker::MarkerTypes markerTypes)
{
    if (!possiblyHasMarkers(markerTypes))
        return;
    ASSERT(!m_markers.isEmpty());

    Node* startContainer = range->startContainer();
    Node* endContainer = range->endContainer();

    Node* pastLastNode = range->pastLastNode();
    for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTraversal::next(node)) {
        unsigned startOffset = node == startContainer ? range->startOffset() : 0;
        unsigned endOffset = node == endContainer ? static_cast<unsigned>(range->endOffset()) : std::numeric_limits<unsigned>::max();
        MarkerList* list = m_markers.get(node);
        if (!list)
            continue;

        for (size_t i = 0; i < list->size(); ++i) {
            DocumentMarker& marker = list->at(i);

            // markers are returned in order, so stop if we are now past the specified range
            if (marker.startOffset() >= endOffset)
                break;

            // skip marker that is wrong type or before target
            if (marker.endOffset() <= startOffset || !markerTypes.contains(marker.type())) {
                i++;
                continue;
            }

            marker.clearDetails();
        }
    }
}
开发者ID:webOS-ports,项目名称:webkit,代码行数:34,代码来源:DocumentMarkerController.cpp

示例3: setMarkersActive

void DocumentMarkerController::setMarkersActive(Node* node, unsigned startOffset, unsigned endOffset, bool active)
{
    MarkerList* list = m_markers.get(node);
    if (!list)
        return;

    bool docDirty = false;
    for (size_t i = 0; i != list->size(); ++i) {
        DocumentMarker& marker = list->at(i);

        // Markers are returned in order, so stop if we are now past the specified range.
        if (marker.startOffset() >= endOffset)
            break;

        // Skip marker that is wrong type or before target.
        if (marker.endOffset() < startOffset || marker.type() != DocumentMarker::TextMatch)
            continue;

        marker.setActiveMatch(active);
        docDirty = true;
    }

    // repaint the affected node
    if (docDirty && node->renderer())
        node->renderer()->repaint();
}
开发者ID:webOS-ports,项目名称:webkit,代码行数:26,代码来源:DocumentMarkerController.cpp

示例4: setMarker

void MarkerList::ValueTreeWrapper::readFrom (const MarkerList& markerList, UndoManager* undoManager)
{
    state.removeAllChildren (undoManager);

    for (int i = 0; i < markerList.getNumMarkers(); ++i)
        setMarker (*markerList.getMarker(i), undoManager);
}
开发者ID:Theadd,项目名称:MultipurposeButton,代码行数:7,代码来源:juce_MarkerList.cpp

示例5: 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);
    }
}
开发者ID:falkTX,项目名称:los,代码行数:11,代码来源:CanvasNavigator.cpp

示例6: invalidateRenderedRectsForMarkersInRect

void DocumentMarkerController::invalidateRenderedRectsForMarkersInRect(const LayoutRect& r)
{
    // outer loop: process each markered node in the document
    MarkerMap::iterator end = m_markers.end();
    for (MarkerMap::iterator i = m_markers.begin(); i != end; ++i) {

        // inner loop: process each rect in the current node
        MarkerList* list = i->value.get();
        for (size_t listIndex = 0; listIndex < list->size(); ++listIndex)
            list->at(listIndex).invalidate(r);
    }
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:12,代码来源:DocumentMarkerController.cpp

示例7:

Vector<RenderedDocumentMarker*> DocumentMarkerController::markersFor(Node* node, DocumentMarker::MarkerTypes markerTypes)
{
    Vector<RenderedDocumentMarker*> result;
    MarkerList* list = m_markers.get(node);
    if (!list)
        return result;

    for (size_t i = 0; i < list->size(); ++i) {
        if (markerTypes.contains(list->at(i).type()))
            result.append(&(list->at(i)));
    }

    return result;
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:14,代码来源:DocumentMarkerController.cpp

示例8: 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);
}
开发者ID:faesong,项目名称:oom,代码行数:15,代码来源:markerview.cpp

示例9: marker

//==============================================================================
void MarkerList::ValueTreeWrapper::applyTo (MarkerList& markerList)
{
    const int numMarkers = getNumMarkers();

    StringArray updatedMarkers;

    for (int i = 0; i < numMarkers; ++i)
    {
        const ValueTree marker (state.getChild (i));
        const String name (marker [nameProperty].toString());
        markerList.setMarker (name, RelativeCoordinate (marker [posProperty].toString()));
        updatedMarkers.add (name);
    }

    for (int i = markerList.getNumMarkers(); --i >= 0;)
        if (! updatedMarkers.contains (markerList.getMarker (i)->name))
            markerList.removeMarker (i);
}
开发者ID:Theadd,项目名称:MultipurposeButton,代码行数:19,代码来源:juce_MarkerList.cpp

示例10: switch

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;
	}
}
开发者ID:faesong,项目名称:oom,代码行数:41,代码来源:markerview.cpp

示例11: ASSERT

// copies markers from srcNode to dstNode, applying the specified shift delta to the copies.  The shift is
// useful if, e.g., the caller has created the dstNode from a non-prefix substring of the srcNode.
void DocumentMarkerController::copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstNode, int delta)
{
    if (length <= 0)
        return;

    if (!possiblyHasMarkers(DocumentMarker::AllMarkers()))
        return;
    ASSERT(!m_markers.isEmpty());

    MarkerList* list = m_markers.get(srcNode);
    if (!list)
        return;

    bool docDirty = false;
    unsigned endOffset = startOffset + length - 1;
    for (size_t i = 0; i != list->size(); ++i) {
        DocumentMarker marker = list->at(i);

        // stop if we are now past the specified range
        if (marker.startOffset() > endOffset)
            break;

        // skip marker that is before the specified range or is the wrong type
        if (marker.endOffset() < startOffset)
            continue;

        // pin the marker to the specified range and apply the shift delta
        docDirty = true;
        if (marker.startOffset() < startOffset)
            marker.setStartOffset(startOffset);
        if (marker.endOffset() > endOffset)
            marker.setEndOffset(endOffset);
        marker.shiftOffsets(delta);

        addMarker(dstNode, marker);
    }

    // repaint the affected node
    if (docDirty && dstNode->renderer())
        dstNode->renderer()->repaint();
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:43,代码来源:DocumentMarkerController.cpp

示例12: removeMarkersFromList

void DocumentMarkerController::removeMarkersFromList(MarkerMap::iterator iterator, DocumentMarker::MarkerTypes markerTypes)
{
    bool needsRepainting = false;
    bool listCanBeRemoved;

    if (markerTypes == DocumentMarker::AllMarkers()) {
        needsRepainting = true;
        listCanBeRemoved = true;
    } else {
        MarkerList* list = iterator->value.get();

        for (size_t i = 0; i != list->size(); ) {
            DocumentMarker marker = list->at(i);

            // skip nodes that are not of the specified type
            if (!markerTypes.contains(marker.type())) {
                ++i;
                continue;
            }

            // pitch the old marker
            list->remove(i);
            needsRepainting = true;
            // i now is the index of the next marker
        }

        listCanBeRemoved = list->isEmpty();
    }

    if (needsRepainting) {
        if (auto renderer = iterator->key->renderer())
            renderer->repaint();
    }

    if (listCanBeRemoved) {
        m_markers.remove(iterator);
        if (m_markers.isEmpty())
            m_possiblyExistingMarkerTypes = 0;
    }
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:40,代码来源:DocumentMarkerController.cpp

示例13: jassert

bool MarkerList::operator== (const MarkerList& other) const noexcept
{
    if (other.markers.size() != markers.size())
        return false;

    for (int i = markers.size(); --i >= 0;)
    {
        const Marker* const m1 = markers.getUnchecked(i);
        jassert (m1 != nullptr);

        const Marker* const m2 = other.getMarker (m1->name);

        if (m2 == nullptr || *m1 != *m2)
            return false;
    }

    return true;
}
开发者ID:pingdynasty,项目名称:BlipZones,代码行数:18,代码来源:juce_MarkerList.cpp

示例14: while

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);
		}
	}
}
开发者ID:faesong,项目名称:oom,代码行数:85,代码来源:markerview.cpp

示例15: while

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)
//.........这里部分代码省略.........
开发者ID:falkTX,项目名称:los,代码行数:101,代码来源:CanvasNavigator.cpp


注:本文中的MarkerList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。