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:
Tobias Doerffel
2008-06-06 11:42:02 +00:00
parent 7cd212a335
commit d5ee064c3c
11 changed files with 226 additions and 97 deletions

View File

@@ -257,7 +257,7 @@ private:
class instrumentTrackWindow : public QWidget, public modelView,
public journallingObjectHook
public serializingObjectHook
{
Q_OBJECT
public:

View File

@@ -26,29 +26,18 @@
#ifndef _JOURNALLING_OBJECT_H
#define _JOURNALLING_OBJECT_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "types.h"
#include "export.h"
#include "serializing_object.h"
#include <QtCore/QVariant>
#include <QtCore/QVector>
#include <QtCore/QStack>
class QDomDocument;
class QDomElement;
typedef uint32_t t_action_id;
class journallingObject;
class journallingObjectHook;
class journalEntry
{
public:
@@ -99,7 +88,7 @@ private:
typedef QVector<journalEntry> journalEntryVector;
class EXPORT journallingObject
class EXPORT journallingObject : public serializingObject
{
public:
journallingObject( void );
@@ -144,9 +133,6 @@ public:
virtual void restoreState( const QDomElement & _this );
// to be implemented by actual object
virtual QString nodeName( void ) const = 0;
inline bool isJournalling( void ) const
{
return( m_journalling );
@@ -164,26 +150,11 @@ public:
return( old_journalling );
}
void setHook( journallingObjectHook * _hook );
journallingObjectHook * getHook( void )
{
return( m_hook );
}
protected:
void addJournalEntry( const journalEntry & _je );
// to be implemented by sub-objects
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this )
{
}
virtual void loadSettings( const QDomElement & _this )
{
}
virtual void undoStep( journalEntry & _je )
{
}
@@ -206,34 +177,6 @@ private:
QStack<bool> m_journallingStateStack;
journallingObjectHook * m_hook;
} ;
class journallingObjectHook
{
public:
journallingObjectHook() :
m_hookedIn( NULL )
{
}
virtual ~journallingObjectHook()
{
if( m_hookedIn != NULL )
{
m_hookedIn->setHook( NULL );
}
}
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this ) = 0;
virtual void loadSettings( const QDomElement & _this ) = 0;
private:
journallingObject * m_hookedIn;
friend class journallingObject;
} ;

View File

@@ -36,7 +36,7 @@
#include "volume.h"
#include "panning.h"
#include "midi_time.h"
#include "journalling_object.h"
#include "serializing_object.h"
class detuningHelper;
@@ -83,7 +83,7 @@ const float MaxDetuning = 4 * 12.0f;
class EXPORT note : public journallingObject
class EXPORT note : public serializingObject
{
public:
note( const midiTime & _length = 0,
@@ -165,19 +165,19 @@ protected:
QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
virtual void undoStep( journalEntry & _je );
virtual void redoStep( journalEntry & _je );
/* virtual void undoStep( journalEntry & _je );
virtual void redoStep( journalEntry & _je );*/
private:
enum Actions
/* enum Actions
{
ChangeKey,
ChangeVolume,
ChangePanning,
ChangeLength,
ChangePosition
} ;
} ;*/
int m_key;

View File

@@ -27,6 +27,7 @@
#define _SAMPLE_BUFFER_H
#include <QtCore/QObject>
#include <QtCore/QRect>
#ifdef HAVE_CONFIG_H
#include <config.h>

View File

@@ -0,0 +1,107 @@
/*
* serializing_object.h - declaration of class 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.
*
*/
#ifndef _SERIALIZING_OBJECT_H
#define _SERIALIZING_OBJECT_H
#include <QtCore/QString>
#include "export.h"
class QDomDocument;
class QDomElement;
class serializingObjectHook;
class EXPORT serializingObject
{
public:
serializingObject( void );
virtual ~serializingObject();
virtual QDomElement saveState( QDomDocument & _doc,
QDomElement & _parent );
virtual void restoreState( const QDomElement & _this );
// to be implemented by actual object
virtual QString nodeName( void ) const = 0;
void setHook( serializingObjectHook * _hook );
serializingObjectHook * getHook( void )
{
return( m_hook );
}
protected:
// to be implemented by sub-objects
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this )
{
}
virtual void loadSettings( const QDomElement & _this )
{
}
private:
serializingObjectHook * m_hook;
} ;
class serializingObjectHook
{
public:
serializingObjectHook() :
m_hookedIn( NULL )
{
}
virtual ~serializingObjectHook()
{
if( m_hookedIn != NULL )
{
m_hookedIn->setHook( NULL );
}
}
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this ) = 0;
virtual void loadSettings( const QDomElement & _this ) = 0;
private:
serializingObject * m_hookedIn;
friend class serializingObject;
} ;
#endif