Exemplo n.º 1
0
void JournallingObject::addJournalCheckPoint()
{
	if( isJournalling() )
	{
		Engine::projectJournal()->addJournalCheckPoint( this );
	}
}
Exemplo n.º 2
0
void AutomatableModel::setValue( const float value )
{
	++m_setValueDepth;
	const float old_val = m_value;

	m_value = fittedValue( value );
	if( old_val != m_value )
	{
		// add changes to history so user can undo it
		addJournalCheckPoint();

		// notify linked models
		for( AutoModelVector::Iterator it = m_linkedModels.begin(); it != m_linkedModels.end(); ++it )
		{
			if( (*it)->m_setValueDepth < 1 && (*it)->fittedValue( value ) != (*it)->m_value )
			{
				bool journalling = (*it)->testAndSetJournalling( isJournalling() );
				(*it)->setValue( value );
				(*it)->setJournalling( journalling );
			}
		}
		emit dataChanged();
	}
	else
	{
		emit dataUnchanged();
	}
	--m_setValueDepth;
}
Exemplo n.º 3
0
void ProjectJournal::addJournalCheckPoint( JournallingObject *jo )
{
	if( isJournalling() )
	{
		m_redoCheckPoints.clear();

		DataFile dataFile( DataFile::JournalData );
		jo->saveState( dataFile, dataFile.content() );

		m_undoCheckPoints.push( CheckPoint( jo->id(), dataFile ) );
	}
}
Exemplo n.º 4
0
QDomElement JournallingObject::saveState( QDomDocument & _doc,
							QDomElement & _parent )
{
	if( isJournalling() )
	{
		QDomElement _this = SerializingObject::saveState( _doc, _parent );

		QDomElement journalNode = _doc.createElement( "journallingObject" );
		journalNode.setAttribute( "id", id() );
		journalNode.setAttribute( "metadata", true );
		_this.appendChild( journalNode );

		return _this;
	} else {
		return QDomElement();
	}
}
Exemplo n.º 5
0
void ProjectJournal::redo()
{
	while( !m_redoCheckPoints.isEmpty() )
	{
		CheckPoint c = m_redoCheckPoints.pop();
		JournallingObject *jo = m_joIDs[c.joID];

		if( jo )
		{
			DataFile curState( DataFile::JournalData );
			jo->saveState( curState, curState.content() );
			m_undoCheckPoints.push( CheckPoint( c.joID, curState ) );

			bool prev = isJournalling();
			setJournalling( false );
			jo->restoreState( c.data.content().firstChildElement() );
			setJournalling( prev );
			engine::getSong()->setModified();
			break;
		}
	}
}