Exemplo n.º 1
0
void ItemPageUI::PopulateComboBox()
{
	ItemMap items;
	m_itemList->GetItems(items);

	for (ItemMap::iterator i = items.begin(); i != items.end(); ++i)
	{
		m_itemComboBox->AppendItem(i->second.name);
	}
}
Exemplo n.º 2
0
void ItemDocument::slotUpdateZOrdering() {

	{ //begin WORKAROUND
 // remove zeros, Where are these zeros coming from??? they shouldn't be here!!!
		ItemMap::iterator end = m_itemList.end();
		ItemMap::iterator it = m_itemList.begin();

		while(it != end) {
			if(!(it->second)) {
				ItemMap::iterator toRemove = it; 
				it++;
				m_itemList.erase(toRemove);
			} else it++;
		}
	} //END WORKAROUND

	ItemMap toAdd = m_itemList;

	IntItemMap newZOrder;
	int atLevel = 0;

	IntItemMap::iterator zEnd = m_zOrder.end();
	for (IntItemMap::iterator it = m_zOrder.begin(); it != zEnd; ++it) {
		Item *item = it->second;

assert(item->itemDocument() == this); 

		toAdd.erase(item->id());

		if (!item->parentItem() && item->isMovable())
			newZOrder[atLevel++] = item;
	}

	{
		ItemMap::iterator addEnd = toAdd.end();
		for (ItemMap::iterator it = toAdd.begin(); it != addEnd; ++it) {
			Item *item = it->second;
assert(item && item->itemDocument() == this);
			if (item->parentItem() || !item->isMovable())
				continue;

			newZOrder[atLevel++] = item;
		}
	}

	m_zOrder = newZOrder;

	for (IntItemMap::iterator it = m_zOrder.begin(); it != zEnd; ++it)
		it->second->updateZ(it->first); // valgrind says there's a FIXME here. =\ "invalid read of size 4"
}