Пример #1
0
/*!	\brief Creates and insert an empty table for the given font.
	\param font The font to create the table for.
	\return The index of the newly created table.
*/
int32
WidthBuffer::InsertTable(const BFont *font)
{
	_width_table_ table;

#if USE_DANO_WIDTHBUFFER
	table.font = *font;
#else
	table.fontSize = font->Size();
	table.fontCode = font->FamilyAndStyle();
#endif

	table.hashCount = 0;
	table.tableCount = kTableCount;
	table.widths = new hashed_escapement[kTableCount];

	uint32 position = fItemCount;
	InsertItemsAt(1, position, &table);

	return position;
}
Пример #2
0
int32
_BStyleRecordBuffer_::InsertRecord(const BFont *inFont,
										 const rgb_color *inColor)
{
	int32 index = 0;

	// look for style in buffer
	if (MatchRecord(inFont, inColor, &index))
		return index;

	// style not found, add it
	font_height fh;
	inFont->GetHeight(&fh);
	
	// check if there's any unused space
	for (index = 0; index < fItemCount; index++) {
		if (fBuffer[index].refs < 1) {
			fBuffer[index].refs = 0;
			fBuffer[index].ascent = fh.ascent;
			fBuffer[index].descent = fh.descent + fh.leading;
			fBuffer[index].style.font = *inFont;
			fBuffer[index].style.color = *inColor;
			return index;
		}	
	}
	
	// no unused space, expand the buffer
	index = fItemCount;
	STEStyleRecord 	newRecord;
	newRecord.refs = 0;
	newRecord.ascent = fh.ascent;
	newRecord.descent = fh.descent + fh.leading;
	newRecord.style.font = *inFont;
	newRecord.style.color = *inColor;
	InsertItemsAt(1, index, &newRecord);

	return index;
}
void
CThingyList::ReadStream(LStream& inInputStream, UInt32 streamVersion) {
  #warning TODO: should only update items that are not already in correct position in the list
	RemoveItemsAt(GetCount(), 1);	// clear all the item from the array
	UInt16 numThingys;
	inInputStream >> numThingys;	// read in the object count
	for (long i = 1; i <= numThingys; i++) {	// now read in that many objects
		ThingyRef aRef;
		inInputStream >> aRef;
		DEBUG_OUT(" |-- "<<aRef, DEBUG_TRIVIA | DEBUG_CONTAINMENT );
/*  #warning FIXME: this debug code is correcting errors that will kill a release version
	  #ifdef DEBUG
		ArrayIndexT idx = FetchIndexOf(aRef);
		if (idx != index_Bad) {	// make sure we don't have duplicate entries
			DEBUG_OUT(" |    Duplicate entry "<<aRef <<" in "<<this<<" -- skipped", DEBUG_ERROR | DEBUG_CONTAINMENT );
			continue;
		}
	  #else
	     #error critical debug code not included
	  #endif */
		InsertItemsAt(1, LArray::index_Last, aRef);
	}
}
Пример #4
0
void
BTextView::LineBuffer::InsertLine(STELine* inLine, int32 index)
{
	InsertItemsAt(1, index, inLine);
}
Пример #5
0
void
_BStyleRunDescBuffer_::InsertDesc(STEStyleRunDescPtr inDesc, int32 index)
{
	InsertItemsAt(1, index, inDesc);
}