Merge remote-tracking branch 'origin/stable-0.4-undo-redo'
Conflicts: include/AutomatableModel.h include/MidiPort.h include/TrackContainerView.h include/surround_area.h include/track.h src/core/AutomatableModel.cpp src/core/TrackContainer.cpp src/core/note.cpp src/core/track.cpp src/gui/PianoRoll.cpp src/gui/TrackContainerView.cpp src/gui/widgets/LcdSpinBox.cpp
This commit is contained in:
@@ -206,11 +206,6 @@ public:
|
||||
return "automatablemodel";
|
||||
}
|
||||
|
||||
void prepareJournalEntryFromOldVal();
|
||||
|
||||
void addJournalEntryFromOldToCurVal();
|
||||
|
||||
|
||||
QString displayValue( const float val ) const
|
||||
{
|
||||
switch( m_dataType )
|
||||
@@ -236,9 +231,6 @@ public slots:
|
||||
|
||||
|
||||
protected:
|
||||
virtual void redoStep( JournalEntry& je );
|
||||
virtual void undoStep( JournalEntry& je );
|
||||
|
||||
float fittedValue( float value ) const;
|
||||
|
||||
|
||||
@@ -269,7 +261,6 @@ private:
|
||||
// most objects will need this temporarily (until sampleExact is
|
||||
// standard)
|
||||
float m_oldValue;
|
||||
bool m_journalEntryReady;
|
||||
int m_setValueDepth;
|
||||
|
||||
AutoModelVector m_linkedModels;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#ifndef AUTOMATION_PATTERN_H
|
||||
#define AUTOMATION_PATTERN_H
|
||||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QPointer>
|
||||
|
||||
#include "track.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* JournallingObject.h - declaration of class JournallingObject
|
||||
*
|
||||
* Copyright (c) 2006-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -25,66 +25,10 @@
|
||||
#ifndef _JOURNALLING_OBJECT_H
|
||||
#define _JOURNALLING_OBJECT_H
|
||||
|
||||
#include "lmms_basics.h"
|
||||
#include "export.h"
|
||||
#include "SerializingObject.h"
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QStack>
|
||||
|
||||
|
||||
typedef uint32_t t_action_id;
|
||||
|
||||
|
||||
class JournalEntry
|
||||
{
|
||||
public:
|
||||
JournalEntry( const t_action_id _action_id, const QVariant & _data ) :
|
||||
m_actionID( _action_id ),
|
||||
m_data( _data )
|
||||
{
|
||||
}
|
||||
|
||||
JournalEntry() :
|
||||
m_actionID( 0 ),
|
||||
m_data( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
~JournalEntry()
|
||||
{
|
||||
}
|
||||
|
||||
t_action_id actionID() const
|
||||
{
|
||||
return m_actionID;
|
||||
}
|
||||
|
||||
t_action_id & actionID()
|
||||
{
|
||||
return m_actionID;
|
||||
}
|
||||
|
||||
const QVariant & data() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
QVariant & data()
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
t_action_id m_actionID;
|
||||
QVariant m_data;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
typedef QVector<JournalEntry> JournalEntryVector;
|
||||
#include "lmms_basics.h"
|
||||
#include "SerializingObject.h"
|
||||
|
||||
|
||||
class EXPORT JournallingObject : public SerializingObject
|
||||
@@ -98,27 +42,10 @@ public:
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void undo();
|
||||
void redo();
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_journalEntries.clear();
|
||||
m_currentJournalEntry = m_journalEntries.end();
|
||||
}
|
||||
|
||||
void clearRedoSteps()
|
||||
{
|
||||
m_journalEntries.erase( m_currentJournalEntry,
|
||||
m_journalEntries.end() );
|
||||
m_currentJournalEntry = m_journalEntries.end();
|
||||
|
||||
}
|
||||
|
||||
void saveJournallingState( const bool _new_state )
|
||||
void saveJournallingState( const bool newState )
|
||||
{
|
||||
m_journallingStateStack.push( m_journalling );
|
||||
m_journalling = _new_state;
|
||||
m_journalling = newState;
|
||||
}
|
||||
|
||||
void restoreJournallingState()
|
||||
@@ -126,12 +53,13 @@ public:
|
||||
m_journalling = m_journallingStateStack.pop();
|
||||
}
|
||||
|
||||
void addJournalCheckPoint();
|
||||
|
||||
virtual QDomElement saveState( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
QDomElement & _parent );
|
||||
|
||||
virtual void restoreState( const QDomElement & _this );
|
||||
|
||||
|
||||
inline bool isJournalling() const
|
||||
{
|
||||
return m_journalling;
|
||||
@@ -142,10 +70,10 @@ public:
|
||||
m_journalling = _sr;
|
||||
}
|
||||
|
||||
inline bool testAndSetJournalling( const bool _sr )
|
||||
inline bool testAndSetJournalling( const bool newState )
|
||||
{
|
||||
const bool oldJournalling = m_journalling;
|
||||
m_journalling = _sr;
|
||||
m_journalling = newState;
|
||||
return oldJournalling;
|
||||
}
|
||||
|
||||
@@ -153,27 +81,10 @@ public:
|
||||
protected:
|
||||
void changeID( jo_id_t _id );
|
||||
|
||||
void addJournalEntry( const JournalEntry & _je );
|
||||
|
||||
// to be implemented by sub-objects
|
||||
virtual void undoStep( JournalEntry & )
|
||||
{
|
||||
}
|
||||
virtual void redoStep( JournalEntry & )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void saveJournal( QDomDocument & _doc, QDomElement & _parent );
|
||||
void loadJournal( const QDomElement & _this );
|
||||
|
||||
|
||||
jo_id_t m_id;
|
||||
|
||||
JournalEntryVector m_journalEntries;
|
||||
JournalEntryVector::Iterator m_currentJournalEntry;
|
||||
|
||||
bool m_journalling;
|
||||
|
||||
QStack<bool> m_journallingStateStack;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ProjectJournal.h - declaration of class ProjectJournal
|
||||
*
|
||||
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2006-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -26,10 +26,10 @@
|
||||
#define _PROJECT_JOURNAL_H
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QStack>
|
||||
|
||||
#include "lmms_basics.h"
|
||||
#include "DataFile.h"
|
||||
|
||||
class JournallingObject;
|
||||
|
||||
@@ -43,8 +43,7 @@ public:
|
||||
void undo();
|
||||
void redo();
|
||||
|
||||
// tell history that a new journal entry was added to object with ID _id
|
||||
void journalEntryAdded( const jo_id_t _id );
|
||||
void addJournalCheckPoint( JournallingObject *jo );
|
||||
|
||||
bool isJournalling() const
|
||||
{
|
||||
@@ -72,10 +71,6 @@ public:
|
||||
reallocID( _id, NULL );
|
||||
}
|
||||
|
||||
// completely remove everything linked with ID _id - all global
|
||||
// journalling information about the ID get's lost
|
||||
void forgetAboutID( const jo_id_t _id );
|
||||
|
||||
void clearJournal();
|
||||
|
||||
JournallingObject * journallingObject( const jo_id_t _id )
|
||||
@@ -90,12 +85,23 @@ public:
|
||||
|
||||
private:
|
||||
typedef QHash<jo_id_t, JournallingObject *> JoIdMap;
|
||||
typedef QVector<jo_id_t> JournalEntryVector;
|
||||
|
||||
struct CheckPoint
|
||||
{
|
||||
CheckPoint( jo_id_t initID = 0, const DataFile&initData = DataFile( DataFile::JournalData ) ) :
|
||||
joID( initID ),
|
||||
data( initData )
|
||||
{
|
||||
}
|
||||
jo_id_t joID;
|
||||
DataFile data;
|
||||
} ;
|
||||
typedef QStack<CheckPoint> CheckPointStack;
|
||||
|
||||
JoIdMap m_joIDs;
|
||||
|
||||
JournalEntryVector m_journalEntries;
|
||||
JournalEntryVector::Iterator m_currentJournalEntry;
|
||||
CheckPointStack m_undoCheckPoints;
|
||||
CheckPointStack m_redoCheckPoints;
|
||||
|
||||
bool m_journalling;
|
||||
|
||||
|
||||
@@ -139,9 +139,6 @@ protected:
|
||||
virtual void mouseReleaseEvent( QMouseEvent * _me );
|
||||
virtual void resizeEvent( QResizeEvent * );
|
||||
|
||||
virtual void undoStep( JournalEntry & _je );
|
||||
virtual void redoStep( JournalEntry & _je );
|
||||
|
||||
MidiTime m_currentPosition;
|
||||
|
||||
|
||||
|
||||
113
include/mmp.h
113
include/mmp.h
@@ -1,113 +0,0 @@
|
||||
/*
|
||||
* mmp.h - class for reading and writing multimedia-project-files
|
||||
*
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2012-2013 Paul Giblock <p/at/pgiblock.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 _MMP_H
|
||||
#define _MMP_H
|
||||
|
||||
#include <QtXml/QDomDocument>
|
||||
#include <QTextStream>
|
||||
|
||||
#include "export.h"
|
||||
#include "lmms_basics.h"
|
||||
|
||||
|
||||
class EXPORT multimediaProject : public QDomDocument
|
||||
{
|
||||
public:
|
||||
enum ProjectTypes
|
||||
{
|
||||
UnknownType,
|
||||
SongProject,
|
||||
SongProjectTemplate,
|
||||
InstrumentTrackSettings,
|
||||
DragNDropData,
|
||||
ClipboardData,
|
||||
JournalData,
|
||||
EffectSettings,
|
||||
VideoProject, // might come later...
|
||||
BurnProject, // might come later...
|
||||
Playlist, // might come later...
|
||||
NumProjectTypes
|
||||
} ;
|
||||
|
||||
|
||||
multimediaProject( const QString & _fileName );
|
||||
multimediaProject( const QByteArray & _data );
|
||||
multimediaProject( ProjectTypes _project_type );
|
||||
virtual ~multimediaProject();
|
||||
|
||||
QString nameWithExtension( const QString & _fn ) const;
|
||||
|
||||
void write( QTextStream & _strm );
|
||||
bool writeFile( const QString & _fn );
|
||||
|
||||
inline QDomElement & content()
|
||||
{
|
||||
return( m_content );
|
||||
}
|
||||
inline QDomElement & head()
|
||||
{
|
||||
return( m_head );
|
||||
}
|
||||
|
||||
inline ProjectTypes type() const
|
||||
{
|
||||
return( m_type );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
static ProjectTypes type( const QString & _type_name );
|
||||
static QString typeName( ProjectTypes _project_type );
|
||||
|
||||
void cleanMetaNodes( QDomElement _de );
|
||||
|
||||
void upgrade();
|
||||
|
||||
void loadData( const QByteArray & _data, const QString & _sourceFile );
|
||||
|
||||
|
||||
struct EXPORT typeDescStruct
|
||||
{
|
||||
ProjectTypes m_type;
|
||||
QString m_name;
|
||||
} ;
|
||||
static typeDescStruct s_types[NumProjectTypes];
|
||||
|
||||
QDomElement m_content;
|
||||
QDomElement m_head;
|
||||
ProjectTypes m_type;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
const int MMP_MAJOR_VERSION = 1;
|
||||
const int MMP_MINOR_VERSION = 0;
|
||||
const QString MMP_VERSION_STRING = QString::number( MMP_MAJOR_VERSION ) + "." + QString::number( MMP_MINOR_VERSION );
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* note.h - declaration of class note which contains all informations about a
|
||||
* note + definitions of several constants and enums
|
||||
*
|
||||
* Copyright (c) 2004-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -213,21 +213,8 @@ protected:
|
||||
QDomElement & _parent );
|
||||
virtual void loadSettings( const QDomElement & _this );
|
||||
|
||||
/* virtual void undoStep( JournalEntry & _je );
|
||||
virtual void redoStep( JournalEntry & _je );*/
|
||||
|
||||
|
||||
private:
|
||||
/* enum Actions
|
||||
{
|
||||
ChangeKey,
|
||||
ChangeVolume,
|
||||
ChangePanning,
|
||||
ChangeLength,
|
||||
ChangePosition
|
||||
} ;*/
|
||||
|
||||
|
||||
// for piano roll editing
|
||||
bool m_selected;
|
||||
int m_oldKey;
|
||||
|
||||
@@ -129,11 +129,6 @@ public slots:
|
||||
void toggleMute();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void undoStep( JournalEntry & _je );
|
||||
virtual void redoStep( JournalEntry & _je );
|
||||
|
||||
|
||||
signals:
|
||||
void lengthChanged();
|
||||
void positionChanged();
|
||||
@@ -288,17 +283,8 @@ protected:
|
||||
Q_UNUSED(element)
|
||||
}
|
||||
|
||||
virtual void undoStep( JournalEntry & _je );
|
||||
virtual void redoStep( JournalEntry & _je );
|
||||
|
||||
|
||||
private:
|
||||
enum Actions
|
||||
{
|
||||
AddTrackContentObject,
|
||||
RemoveTrackContentObject
|
||||
} ;
|
||||
|
||||
track * getTrack();
|
||||
MidiTime getPosition( int _mouse_x );
|
||||
|
||||
@@ -550,8 +536,6 @@ public slots:
|
||||
|
||||
protected:
|
||||
virtual void modelChanged();
|
||||
virtual void undoStep( JournalEntry & _je );
|
||||
virtual void redoStep( JournalEntry & _je );
|
||||
|
||||
virtual void saveSettings( QDomDocument& doc, QDomElement& element )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user