Example #1
0
//
//	Import the specified range of data into the sequence so we have our own private copy
//
bool sequence::import_buffer (const seqchar *buf, size_t len, size_t *buffer_offset)
{
	buffer_control *bc;
	
	// get the current modify-buffer
	bc = buffer_list[modifybuffer_id];

	// if there isn't room then allocate a new modify-buffer
	if(bc->length + len >= bc->maxsize)
	{
		bc = alloc_modifybuffer(len + 0x10000);
		
		// make sure that no old spans use this buffer
		record_action(action_invalid, 0);
	}

	if(bc == 0)
		return false;

	// import the data
	memcpy(bc->buffer + bc->length, buf, len * sizeof(seqchar));
	
	*buffer_offset = bc->length;
	bc->length += len;

	return true;
}
Example #2
0
bool sequence::init ()
{
	sequence_length = 0;

	if(!alloc_modifybuffer(0x10000))
		return false;

	record_action(action_invalid, 0);
	group_id		= 0;
	group_refcount	= 0;
	undoredo_index	= 0;
	undoredo_length = 0;

	return true;
}
Example #3
0
bool sequence::init (const seqchar *buffer, size_t length)
{
	clear();

	if(!init())
		return false;

	buffer_control *bc = alloc_modifybuffer(length);
	memcpy(bc->buffer, buffer, length * sizeof(seqchar));
	bc->length = length;

	span *sptr = new span(0, length, bc->id, tail, head);
	head->next = sptr;
	tail->prev = sptr;

	sequence_length = length;
	return true;
}
Example #4
0
bool sequence::init ()
{
	sequence_length  = 0;
	origfile_id		 = -1;
	origfile_name[0] = '\0';
	can_quicksave    = false;

	if(!alloc_modifybuffer(0x10000))
		return false;

	record_action(action_invalid, 0);
	group_id		= 0;
	group_refcount	= 0;
	undoredo_index	= 0;
	undoredo_length = 0;
	undoredo_datalength = 0;

	return true;
}