splitted basic functionality of journallingObject into serializingObject so that creating note objects, notePlayHandles etc. does not have all the journalling-overhead (assigning/freeing ID etc.)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1084 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -39,8 +39,7 @@ journallingObject::journallingObject( void ) :
|
||||
m_journalEntries(),
|
||||
m_currentJournalEntry( m_journalEntries.end() ),
|
||||
m_journalling( TRUE ),
|
||||
m_journallingStateStack(),
|
||||
m_hook( NULL )
|
||||
m_journallingStateStack()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -49,10 +48,6 @@ journallingObject::journallingObject( void ) :
|
||||
|
||||
journallingObject::~journallingObject()
|
||||
{
|
||||
if( m_hook )
|
||||
{
|
||||
m_hook->m_hookedIn = NULL;
|
||||
}
|
||||
if( engine::getProjectJournal() )
|
||||
{
|
||||
engine::getProjectJournal()->freeID( id() );
|
||||
@@ -97,9 +92,7 @@ void journallingObject::redo( void )
|
||||
QDomElement journallingObject::saveState( QDomDocument & _doc,
|
||||
QDomElement & _parent )
|
||||
{
|
||||
QDomElement _this = _doc.createElement( nodeName() );
|
||||
_parent.appendChild( _this );
|
||||
saveSettings( _doc, _this );
|
||||
QDomElement _this = serializingObject::saveState( _doc, _parent );
|
||||
saveJournal( _doc, _this );
|
||||
return( _this );
|
||||
}
|
||||
@@ -109,10 +102,9 @@ QDomElement journallingObject::saveState( QDomDocument & _doc,
|
||||
|
||||
void journallingObject::restoreState( const QDomElement & _this )
|
||||
{
|
||||
saveJournallingState( FALSE );
|
||||
serializingObject::restoreState( _this );
|
||||
|
||||
// load actual settings
|
||||
loadSettings( _this );
|
||||
saveJournallingState( FALSE );
|
||||
|
||||
// search for journal-node
|
||||
QDomNode node = _this.firstChild();
|
||||
@@ -131,15 +123,6 @@ void journallingObject::restoreState( const QDomElement & _this )
|
||||
|
||||
|
||||
|
||||
void journallingObject::setHook( journallingObjectHook * _hook )
|
||||
{
|
||||
m_hook = _hook;
|
||||
m_hook->m_hookedIn = this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void journallingObject::addJournalEntry( const journalEntry & _je )
|
||||
{
|
||||
if( engine::getProjectJournal()->isJournalling() && isJournalling() )
|
||||
|
||||
@@ -47,7 +47,7 @@ note::note( const midiTime & _length, const midiTime & _pos,
|
||||
m_pos( _pos )
|
||||
{
|
||||
//saveJournallingState( FALSE );
|
||||
setJournalling( FALSE );
|
||||
// setJournalling( FALSE );
|
||||
|
||||
if( _detuning )
|
||||
{
|
||||
@@ -64,7 +64,7 @@ note::note( const midiTime & _length, const midiTime & _pos,
|
||||
|
||||
|
||||
note::note( const note & _note ) :
|
||||
journallingObject( _note ),
|
||||
serializingObject( _note ),
|
||||
m_key( _note.m_key),
|
||||
m_volume( _note.m_volume ),
|
||||
m_panning( _note.m_panning ),
|
||||
@@ -87,7 +87,7 @@ note::~note()
|
||||
|
||||
void note::setLength( const midiTime & _length )
|
||||
{
|
||||
addJournalEntry( journalEntry( ChangeLength, m_length - _length ) );
|
||||
// addJournalEntry( journalEntry( ChangeLength, m_length - _length ) );
|
||||
m_length = _length;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ void note::setLength( const midiTime & _length )
|
||||
|
||||
void note::setPos( const midiTime & _pos )
|
||||
{
|
||||
addJournalEntry( journalEntry( ChangePosition, m_pos - _pos ) );
|
||||
// addJournalEntry( journalEntry( ChangePosition, m_pos - _pos ) );
|
||||
m_pos = _pos;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ void note::setPos( const midiTime & _pos )
|
||||
void note::setKey( const int _key )
|
||||
{
|
||||
const int k = tLimit( _key, 0, NumKeys );
|
||||
addJournalEntry( journalEntry( ChangeKey, m_key - k ) );
|
||||
// addJournalEntry( journalEntry( ChangeKey, m_key - k ) );
|
||||
m_key = k;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ void note::setKey( const int _key )
|
||||
void note::setVolume( const volume _volume )
|
||||
{
|
||||
const volume v = tLimit( _volume, MinVolume, MaxVolume );
|
||||
addJournalEntry( journalEntry( ChangeVolume, (int) m_volume - v ) );
|
||||
// addJournalEntry( journalEntry( ChangeVolume, (int) m_volume - v ) );
|
||||
m_volume = v;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ void note::setVolume( const volume _volume )
|
||||
void note::setPanning( const panning _panning )
|
||||
{
|
||||
const panning p = tLimit( _panning, PanningLeft, PanningRight );
|
||||
addJournalEntry( journalEntry( ChangePanning, (int) m_panning - p ) );
|
||||
// addJournalEntry( journalEntry( ChangePanning, (int) m_panning - p ) );
|
||||
m_panning = p;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ void note::loadSettings( const QDomElement & _this )
|
||||
|
||||
|
||||
|
||||
void note::undoStep( journalEntry & _je )
|
||||
/*void note::undoStep( journalEntry & _je )
|
||||
{
|
||||
saveJournallingState( FALSE );
|
||||
switch( static_cast<Actions>( _je.actionID() ) )
|
||||
@@ -232,7 +232,7 @@ void note::redoStep( journalEntry & _je )
|
||||
{
|
||||
journalEntry je( _je.actionID(), -_je.data().toInt() );
|
||||
undoStep( je );
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
|
||||
78
src/core/serializing_object.cpp
Normal file
78
src/core/serializing_object.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* serializing_object.cpp - implementation of serializingObject
|
||||
*
|
||||
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <Qt/QtXml>
|
||||
|
||||
#include "serializing_object.h"
|
||||
|
||||
|
||||
|
||||
serializingObject::serializingObject( void ) :
|
||||
m_hook( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
serializingObject::~serializingObject()
|
||||
{
|
||||
if( m_hook )
|
||||
{
|
||||
m_hook->m_hookedIn = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QDomElement serializingObject::saveState( QDomDocument & _doc,
|
||||
QDomElement & _parent )
|
||||
{
|
||||
QDomElement _this = _doc.createElement( nodeName() );
|
||||
_parent.appendChild( _this );
|
||||
saveSettings( _doc, _this );
|
||||
return( _this );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void serializingObject::restoreState( const QDomElement & _this )
|
||||
{
|
||||
// load actual settings
|
||||
loadSettings( _this );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void serializingObject::setHook( serializingObjectHook * _hook )
|
||||
{
|
||||
m_hook = _hook;
|
||||
m_hook->m_hookedIn = this;
|
||||
}
|
||||
|
||||
|
||||
@@ -396,7 +396,6 @@ void automationEditor::setCurrentPattern( automationPattern * _new_pattern )
|
||||
m_step = m_pattern->object()->step<float>();
|
||||
m_scrollLevel = ( m_minLevel + m_maxLevel ) / 2;
|
||||
|
||||
timeMap & time_map = m_pattern->getTimeMap();
|
||||
// resizeEvent() does the rest for us (scrolling, range-checking
|
||||
// of levels and so on...)
|
||||
resizeEvent( NULL );
|
||||
|
||||
Reference in New Issue
Block a user