improved undo/redo-system
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@109 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "settings.h"
|
||||
#include "journalling_object.h"
|
||||
#include "types.h"
|
||||
#include "engine.h"
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
class QPixmap;
|
||||
|
||||
class automatableButtonGroup;
|
||||
class channelTrack;
|
||||
class instrumentTrack;
|
||||
class comboBox;
|
||||
class groupBox;
|
||||
class knob;
|
||||
@@ -62,12 +62,11 @@ class tempoSyncKnob;
|
||||
const int MAX_CHORD_POLYPHONY = 10;
|
||||
|
||||
|
||||
class arpAndChordsTabWidget : public QWidget, public settings,
|
||||
public engineObject
|
||||
class arpAndChordsTabWidget : public QWidget, public journallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
arpAndChordsTabWidget( channelTrack * _channel_track );
|
||||
arpAndChordsTabWidget( instrumentTrack * _channel_track );
|
||||
virtual ~arpAndChordsTabWidget();
|
||||
|
||||
static struct chord
|
||||
|
||||
@@ -61,10 +61,15 @@ public:
|
||||
|
||||
virtual void setValue( const bool _on );
|
||||
|
||||
inline void setToggleButton( bool _on )
|
||||
inline void setCheckable( bool _on )
|
||||
{
|
||||
m_toggleButton = _on;
|
||||
setStepRecording( m_toggleButton );
|
||||
m_checkable = _on;
|
||||
setJournalling( m_checkable );
|
||||
}
|
||||
|
||||
inline bool isCheckable( void ) const
|
||||
{
|
||||
return( m_checkable );
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +88,7 @@ protected:
|
||||
|
||||
private:
|
||||
automatableButtonGroup * m_group;
|
||||
bool m_toggleButton;
|
||||
bool m_checkable;
|
||||
|
||||
|
||||
friend class automatableButtonGroup;
|
||||
|
||||
@@ -28,12 +28,22 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "editable_object.h"
|
||||
#include "journalling_object.h"
|
||||
#include "templates.h"
|
||||
|
||||
#ifndef QT3
|
||||
|
||||
#include <Qt/QtXml>
|
||||
|
||||
#else
|
||||
|
||||
#include <qdom.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
template<typename T, typename EDIT_STEP_TYPE = T>
|
||||
class automatableObject : public editableObject
|
||||
class automatableObject : public journallingObject
|
||||
{
|
||||
public:
|
||||
typedef automatableObject<T, EDIT_STEP_TYPE> autoObj;
|
||||
@@ -41,7 +51,7 @@ public:
|
||||
automatableObject( engine * _engine, const T _val = 0, const T _min = 0,
|
||||
const T _max = 0,
|
||||
const T _step = defaultRelStep() ) :
|
||||
editableObject( _engine ),
|
||||
journallingObject( _engine ),
|
||||
m_oldValue( _val ),
|
||||
m_value( _val ),
|
||||
m_minValue( _min ),
|
||||
@@ -127,9 +137,9 @@ public:
|
||||
|
||||
inline virtual void setInitValue( const T _value )
|
||||
{
|
||||
saveStepRecordingState( FALSE );
|
||||
saveJournallingState( FALSE );
|
||||
setValue( _value );
|
||||
restoreStepRecordingState();
|
||||
restoreJournallingState();
|
||||
}
|
||||
|
||||
inline virtual void setValue( const T _value )
|
||||
@@ -140,10 +150,9 @@ public:
|
||||
if( old_val != m_value )
|
||||
{
|
||||
// add changes to history so user can undo it
|
||||
addStep( editStep( 0, static_cast<EDIT_STEP_TYPE>(
|
||||
m_value ) -
|
||||
static_cast<EDIT_STEP_TYPE>(
|
||||
old_val ) ) );
|
||||
addJournalEntry( journalEntry( 0,
|
||||
static_cast<EDIT_STEP_TYPE>( m_value ) -
|
||||
static_cast<EDIT_STEP_TYPE>( old_val ) ) );
|
||||
|
||||
// notify linked objects
|
||||
|
||||
@@ -158,10 +167,10 @@ public:
|
||||
it->fittedValue( value() ) !=
|
||||
it->value() )
|
||||
{
|
||||
it->saveStepRecordingState(
|
||||
isRecordingSteps() );
|
||||
it->saveJournallingState(
|
||||
isJournalling() );
|
||||
it->setValue( value() );
|
||||
it->restoreStepRecordingState();
|
||||
it->restoreJournallingState();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -238,39 +247,57 @@ public:
|
||||
_object2->linkObject( _object1 );
|
||||
}
|
||||
|
||||
virtual QString nodeName( void ) const
|
||||
{
|
||||
return( "automatableobject" );
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
virtual void redoStep( const editStep & _edit_step )
|
||||
virtual void redoStep( journalEntry & _je )
|
||||
{
|
||||
saveStepRecordingState( FALSE );
|
||||
saveJournallingState( FALSE );
|
||||
#ifndef QT3
|
||||
setValue( static_cast<T>( value() +
|
||||
_edit_step.data().value<EDIT_STEP_TYPE>() ) );
|
||||
_je.data().value<EDIT_STEP_TYPE>() ) );
|
||||
#else
|
||||
setValue( static_cast<T>( value() + static_cast<EDIT_STEP_TYPE>(
|
||||
_edit_step.data().toDouble() ) ) );
|
||||
_je.data().toDouble() ) ) );
|
||||
#endif
|
||||
restoreStepRecordingState();
|
||||
restoreJournallingState();
|
||||
}
|
||||
|
||||
virtual void undoStep( const editStep & _edit_step )
|
||||
virtual void undoStep( journalEntry & _je )
|
||||
{
|
||||
journalEntry je( _je.actionID(),
|
||||
#ifndef QT3
|
||||
redoStep( editStep( _edit_step.actionID(),
|
||||
-_edit_step.data().value<EDIT_STEP_TYPE>() ) );
|
||||
-_je.data().value<EDIT_STEP_TYPE>();
|
||||
#else
|
||||
redoStep( editStep( _edit_step.actionID(),
|
||||
static_cast<EDIT_STEP_TYPE>(
|
||||
-_edit_step.data().toDouble() ) ) );
|
||||
static_cast<EDIT_STEP_TYPE>( -_je.data().toDouble() )
|
||||
#endif
|
||||
);
|
||||
redoStep( je );
|
||||
}
|
||||
|
||||
virtual void FASTCALL saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _this )
|
||||
{
|
||||
_this.setAttribute( "value", value() );
|
||||
}
|
||||
|
||||
virtual void FASTCALL loadSettings( const QDomElement & _this )
|
||||
{
|
||||
setValue( static_cast<T>(
|
||||
_this.attribute( "value" ).toDouble() ) );
|
||||
}
|
||||
|
||||
|
||||
// most objects will need this temporarily
|
||||
T m_oldValue;
|
||||
|
||||
inline void addStepFromOldToCurVal( void )
|
||||
inline void addJournalEntryFromOldToCurVal( void )
|
||||
{
|
||||
addStep( editStep( 0, value() - m_oldValue ) );
|
||||
addJournalEntry( journalEntry( 0, value() - m_oldValue ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
class QVariant;
|
||||
|
||||
|
||||
namespace base64
|
||||
{
|
||||
#ifndef QT3
|
||||
@@ -55,6 +58,9 @@ namespace base64
|
||||
void encode( const char * _data, const int _size, QString & _dst );
|
||||
void decode( const QString & _b64, char * * _data, int * _size );
|
||||
#endif
|
||||
QString encode( const QVariant & _data );
|
||||
QVariant decode( const QString & _b64 );
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* clipboard.h - the clipboard for patterns, notes etc.
|
||||
*
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -46,14 +46,14 @@
|
||||
#endif
|
||||
|
||||
|
||||
class settings;
|
||||
class journallingObject;
|
||||
|
||||
namespace clipboard
|
||||
{
|
||||
typedef QMap<QString, QDomElement> map;
|
||||
extern map content;
|
||||
|
||||
void FASTCALL copy( settings * _settings_object );
|
||||
void FASTCALL copy( journallingObject * _object );
|
||||
const QDomElement * FASTCALL getContent( const QString & _node_name );
|
||||
} ;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
class dummyInstrument : public instrument
|
||||
{
|
||||
public:
|
||||
inline dummyInstrument( channelTrack * _channel_track ) :
|
||||
inline dummyInstrument( instrumentTrack * _channel_track ) :
|
||||
instrument( _channel_track, NULL )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#define _ENGINE_H
|
||||
|
||||
class bbEditor;
|
||||
class editHistory;
|
||||
class projectJournal;
|
||||
class mainWindow;
|
||||
class mixer;
|
||||
class pianoRoll;
|
||||
@@ -92,9 +92,9 @@ public:
|
||||
return( m_projectNotes );
|
||||
}
|
||||
|
||||
inline editHistory * getEditHistory( void )
|
||||
inline projectJournal * getProjectJournal( void )
|
||||
{
|
||||
return( m_editHistory );
|
||||
return( m_projectJournal );
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ private:
|
||||
bbEditor * m_bbEditor;
|
||||
pianoRoll * m_pianoRoll;
|
||||
projectNotes * m_projectNotes;
|
||||
editHistory * m_editHistory;
|
||||
projectJournal * m_projectJournal;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include "settings.h"
|
||||
#include "journalling_object.h"
|
||||
#include "types.h"
|
||||
#include "spc_bg_hndl_widget.h"
|
||||
#include "sample_buffer.h"
|
||||
@@ -67,9 +67,8 @@ class tempoSyncKnob;
|
||||
|
||||
|
||||
|
||||
class envelopeAndLFOWidget : public QWidget, public settings,
|
||||
public specialBgHandlingWidget,
|
||||
public engineObject
|
||||
class envelopeAndLFOWidget : public QWidget, public journallingObject,
|
||||
public specialBgHandlingWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -41,14 +41,13 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include "settings.h"
|
||||
#include "basic_filters.h"
|
||||
#include "envelope_and_lfo_widget.h"
|
||||
|
||||
|
||||
class QLabel;
|
||||
|
||||
class channelTrack;
|
||||
class instrumentTrack;
|
||||
class comboBox;
|
||||
class groupBox;
|
||||
class knob;
|
||||
@@ -57,12 +56,11 @@ class pixmapButton;
|
||||
class tabWidget;
|
||||
|
||||
|
||||
class envelopeTabWidget : public QWidget, public settings,
|
||||
public engineObject
|
||||
class envelopeTabWidget : public QWidget, public journallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
envelopeTabWidget( channelTrack * _channel_track );
|
||||
envelopeTabWidget( instrumentTrack * _channel_track );
|
||||
virtual ~envelopeTabWidget();
|
||||
|
||||
void FASTCALL processAudioBuffer( sampleFrame * _ab,
|
||||
|
||||
@@ -79,14 +79,14 @@ protected slots:
|
||||
void contextMenuRequest( QListViewItem * _i, const QPoint & _pos,
|
||||
int _col );
|
||||
#endif
|
||||
void sendToActiveChannel( void );
|
||||
void openInNewChannelSE( void );
|
||||
void openInNewChannelBBE( void );
|
||||
void sendToActiveInstrumentTrack( void );
|
||||
void openInNewInstrumentTrackSE( void );
|
||||
void openInNewInstrumentTrackBBE( void );
|
||||
|
||||
|
||||
private:
|
||||
virtual void keyPressEvent( QKeyEvent * _ke );
|
||||
void openInNewChannel( trackContainer * _tc );
|
||||
void openInNewInstrumentTrack( trackContainer * _tc );
|
||||
|
||||
listView * m_l;
|
||||
fileItem * m_contextMenuItem;
|
||||
|
||||
@@ -53,14 +53,14 @@
|
||||
|
||||
|
||||
// forward-declarations
|
||||
class channelTrack;
|
||||
class instrumentTrack;
|
||||
class notePlayHandle;
|
||||
|
||||
|
||||
class instrument : public QWidget, public plugin
|
||||
{
|
||||
public:
|
||||
instrument( channelTrack * _channel_track,
|
||||
instrument( instrumentTrack * _channel_track,
|
||||
const descriptor * _descriptor );
|
||||
virtual ~instrument();
|
||||
|
||||
@@ -96,12 +96,12 @@ public:
|
||||
// instantiate instrument-plugin with given name or return NULL
|
||||
// on failure
|
||||
static instrument * FASTCALL instantiate( const QString & _plugin_name,
|
||||
channelTrack * _channel_track );
|
||||
instrumentTrack * _channel_track );
|
||||
|
||||
protected:
|
||||
inline channelTrack * getChannelTrack( void ) const
|
||||
inline instrumentTrack * getInstrumentTrack( void ) const
|
||||
{
|
||||
return( m_channelTrack );
|
||||
return( m_instrumentTrack );
|
||||
}
|
||||
|
||||
// instruments can use this for invalidating themselves, which is for
|
||||
@@ -115,7 +115,7 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
channelTrack * m_channelTrack;
|
||||
instrumentTrack * m_instrumentTrack;
|
||||
bool m_valid;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -34,7 +34,7 @@ class instrumentPlayHandle : public playHandle
|
||||
{
|
||||
public:
|
||||
inline instrumentPlayHandle( instrument * _instrument ) :
|
||||
playHandle( INSTRUMENT_PLAY_HANDLE, _instrument->eng() ),
|
||||
playHandle( INSTRUMENT_PLAY_HANDLE ),
|
||||
m_instrument( _instrument )
|
||||
{
|
||||
}
|
||||
|
||||
306
include/instrument_track.h
Executable file
306
include/instrument_track.h
Executable file
@@ -0,0 +1,306 @@
|
||||
/*
|
||||
* instrument_track.h - declaration of class instrumentTrack, a track + window
|
||||
* which holds an instrument-plugin
|
||||
*
|
||||
* Copyright (c) 2004-2006 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., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _INSTRUMENT_TRACK_H
|
||||
#define _INSTRUMENT_TRACK_H
|
||||
|
||||
#include "qt3support.h"
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <QApplication>
|
||||
#include <QPushButton>
|
||||
#include <QPainter>
|
||||
#include <QMutex>
|
||||
|
||||
#else
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qpainter.h>
|
||||
#include <qmutex.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "track.h"
|
||||
#include "mixer.h"
|
||||
#include "midi_event_processor.h"
|
||||
#include "gui_templates.h"
|
||||
#include "tab_widget.h"
|
||||
#include "engine.h"
|
||||
|
||||
|
||||
class QLineEdit;
|
||||
class arpAndChordsTabWidget;
|
||||
class audioPort;
|
||||
class instrumentTrackButton;
|
||||
class envelopeTabWidget;
|
||||
class fadeButton;
|
||||
class instrument;
|
||||
class knob;
|
||||
class lcdSpinBox;
|
||||
class midiPort;
|
||||
class midiTabWidget;
|
||||
class notePlayHandle;
|
||||
class pianoWidget;
|
||||
class presetPreviewPlayHandle;
|
||||
class surroundArea;
|
||||
|
||||
|
||||
|
||||
class instrumentTrack : public QWidget, public track, public midiEventProcessor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
instrumentTrack( trackContainer * _tc );
|
||||
virtual ~instrumentTrack();
|
||||
|
||||
inline virtual trackTypes type( void ) const
|
||||
{
|
||||
return( m_trackType );
|
||||
}
|
||||
|
||||
|
||||
// used by instrument
|
||||
void FASTCALL processAudioBuffer( sampleFrame * _buf,
|
||||
const fpab_t _frames,
|
||||
notePlayHandle * _n );
|
||||
|
||||
virtual void FASTCALL processInEvent( const midiEvent & _me,
|
||||
const midiTime & _time );
|
||||
virtual void FASTCALL processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time );
|
||||
|
||||
// returns the frequency of a given tone & octave.
|
||||
// This function also includes base_tone & base_octave in
|
||||
// its calculations
|
||||
float FASTCALL frequency( notePlayHandle * _n ) const;
|
||||
f_cnt_t FASTCALL beatLen( notePlayHandle * _n ) const;
|
||||
|
||||
|
||||
// for capturing note-play-events -> need that for arpeggio,
|
||||
// filter and so on
|
||||
void FASTCALL playNote( notePlayHandle * _n );
|
||||
|
||||
QString instrumentName( void ) const;
|
||||
void FASTCALL deleteNotePluginData( notePlayHandle * _n );
|
||||
|
||||
// name-stuff
|
||||
inline const QString & name( void ) const
|
||||
{
|
||||
return( m_name );
|
||||
}
|
||||
void FASTCALL setName( const QString & _new_name );
|
||||
|
||||
// volume & surround-position-stuff
|
||||
void FASTCALL setVolume( volume _new_volume );
|
||||
volume getVolume( void ) const;
|
||||
void FASTCALL setSurroundAreaPos( const QPoint & _p );
|
||||
const QPoint & surroundAreaPos( void ) const;
|
||||
|
||||
// base-tone stuff
|
||||
void FASTCALL setBaseTone( tones _new_tone );
|
||||
void FASTCALL setBaseOctave( octaves _new_octave );
|
||||
|
||||
inline tones baseTone( void ) const
|
||||
{
|
||||
return( m_baseTone );
|
||||
}
|
||||
|
||||
inline octaves baseOctave( void ) const
|
||||
{
|
||||
return( m_baseOctave );
|
||||
}
|
||||
|
||||
int FASTCALL masterKey( notePlayHandle * _n ) const;
|
||||
|
||||
|
||||
// play everything in given frame-range - creates note-play-handles
|
||||
virtual bool FASTCALL play( const midiTime & _start,
|
||||
const f_cnt_t _start_frame,
|
||||
const fpab_t _frames,
|
||||
const f_cnt_t _frame_base,
|
||||
Sint16 _tco_num = -1 );
|
||||
// create new track-content-object = pattern
|
||||
virtual trackContentObject * FASTCALL createTCO( const midiTime &
|
||||
_pos );
|
||||
|
||||
|
||||
// called by track
|
||||
virtual void FASTCALL saveTrackSpecificSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
virtual void FASTCALL loadTrackSpecificSettings( const QDomElement &
|
||||
_this );
|
||||
|
||||
// load instrument whose name matches given one
|
||||
instrument * FASTCALL loadInstrument( const QString &
|
||||
_instrument_name );
|
||||
|
||||
// parent for all internal tab-widgets
|
||||
QWidget * tabWidgetParent( void )
|
||||
{
|
||||
return( m_tabWidget );
|
||||
}
|
||||
|
||||
|
||||
public slots:
|
||||
void surroundAreaPosChanged( const QPoint & _new_p );
|
||||
void textChanged( const QString & _new_name );
|
||||
void toggledInstrumentTrackButton( bool _on );
|
||||
|
||||
|
||||
protected:
|
||||
// capture close-events for toggling instrument-track-button
|
||||
virtual void closeEvent( QCloseEvent * _ce );
|
||||
virtual void dragEnterEvent( QDragEnterEvent * _dee );
|
||||
virtual void dropEvent( QDropEvent * _de );
|
||||
virtual void focusInEvent( QFocusEvent * _fe );
|
||||
|
||||
inline virtual QString nodeName( void ) const
|
||||
{
|
||||
return( "instrumenttrack" );
|
||||
}
|
||||
// invalidates all note-play-handles linked to this instrument
|
||||
void invalidateAllMyNPH( void );
|
||||
|
||||
|
||||
protected slots:
|
||||
void saveSettingsBtnClicked( void );
|
||||
void activityIndicatorPressed( void );
|
||||
void activityIndicatorReleased( void );
|
||||
void midiInSelected( void );
|
||||
void midiOutSelected( void );
|
||||
void midiConfigChanged( bool );
|
||||
|
||||
|
||||
private:
|
||||
trackTypes m_trackType;
|
||||
|
||||
midiPort * m_midiPort;
|
||||
|
||||
audioPort * m_audioPort;
|
||||
|
||||
|
||||
notePlayHandle * m_notes[NOTES_PER_OCTAVE * OCTAVES];
|
||||
|
||||
QMutex m_notesMutex;
|
||||
|
||||
|
||||
tones m_baseTone;
|
||||
octaves m_baseOctave;
|
||||
|
||||
QString m_name;
|
||||
|
||||
|
||||
// widgets on the top of a instrument-track-window
|
||||
tabWidget * m_generalSettingsWidget;
|
||||
QLineEdit * m_instrumentNameLE;
|
||||
knob * m_volumeKnob;
|
||||
surroundArea * m_surroundArea;
|
||||
lcdSpinBox * m_effectChannelNumber;
|
||||
QPushButton * m_saveSettingsBtn;
|
||||
|
||||
|
||||
// tab-widget with all children
|
||||
tabWidget * m_tabWidget;
|
||||
instrument * m_instrument;
|
||||
envelopeTabWidget * m_envWidget;
|
||||
arpAndChordsTabWidget * m_arpWidget;
|
||||
midiTabWidget * m_midiWidget;
|
||||
|
||||
|
||||
// test-piano at the bottom of every instrument-settings-window
|
||||
pianoWidget * m_pianoWidget;
|
||||
|
||||
|
||||
// widgets in track-settings-widget
|
||||
knob * m_tswVolumeKnob;
|
||||
fadeButton * m_tswActivityIndicator;
|
||||
instrumentTrackButton * m_tswInstrumentTrackButton;
|
||||
QMenu * m_tswMidiMenu;
|
||||
#ifdef QT4
|
||||
QAction * m_midiInputAction;
|
||||
QAction * m_midiOutputAction;
|
||||
#else
|
||||
int m_midiInputID;
|
||||
int m_midiOutputID;
|
||||
#endif
|
||||
|
||||
friend class instrumentTrackButton;
|
||||
friend class notePlayHandle;
|
||||
friend class presetPreviewPlayHandle;
|
||||
|
||||
|
||||
signals:
|
||||
void noteDone( const note & _n );
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
class instrumentTrackButton : public QPushButton
|
||||
{
|
||||
public:
|
||||
instrumentTrackButton( instrumentTrack * _instrument_track );
|
||||
virtual ~instrumentTrackButton();
|
||||
|
||||
#ifdef QT3
|
||||
inline void setChecked( bool _on )
|
||||
{
|
||||
setOn( _on );
|
||||
}
|
||||
|
||||
inline bool isChecked( void ) const
|
||||
{
|
||||
return( isOn() );
|
||||
}
|
||||
|
||||
inline void setCheckable( bool _on )
|
||||
{
|
||||
QPushButton::setToggleButton( _on );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
protected:
|
||||
// since we want to draw a special label (instrument- and instrument-
|
||||
// name) on our button, we have to re-implement this for doing so
|
||||
virtual void drawButtonLabel( QPainter * _p );
|
||||
|
||||
// allow drops on this button - we simply forward them to
|
||||
// instrument-track
|
||||
virtual void dragEnterEvent( QDragEnterEvent * _dee );
|
||||
virtual void dropEvent( QDropEvent * _de );
|
||||
|
||||
|
||||
private:
|
||||
instrumentTrack * m_instrumentTrack;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
213
include/journalling_object.h
Executable file
213
include/journalling_object.h
Executable file
@@ -0,0 +1,213 @@
|
||||
/*
|
||||
* journalling_object.h - declaration of class journallingObject
|
||||
*
|
||||
* Copyright (c) 2006 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., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _JOURNALLING_OBJECT_H
|
||||
#define _JOURNALLING_OBJECT_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
#include "engine.h"
|
||||
#include "qt3support.h"
|
||||
|
||||
#ifndef QT3
|
||||
|
||||
#include <QVariant>
|
||||
#include <QVector>
|
||||
#include <QStack>
|
||||
|
||||
#else
|
||||
|
||||
#include <qvariant.h>
|
||||
#include <qvaluevector.h>
|
||||
#include <qvaluestack.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
class QDomDocument;
|
||||
class QDomElement;
|
||||
|
||||
|
||||
typedef Uint32 t_action_id;
|
||||
|
||||
|
||||
class journallingObject;
|
||||
|
||||
|
||||
class journalEntry
|
||||
{
|
||||
public:
|
||||
journalEntry( const t_action_id _action_id, const QVariant & _data ) :
|
||||
m_actionID( _action_id ),
|
||||
m_data( _data )
|
||||
{
|
||||
}
|
||||
|
||||
journalEntry( void ) :
|
||||
m_actionID( 0 ),
|
||||
m_data( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
~journalEntry()
|
||||
{
|
||||
}
|
||||
|
||||
t_action_id actionID( void ) const
|
||||
{
|
||||
return( m_actionID );
|
||||
}
|
||||
|
||||
t_action_id & actionID( void )
|
||||
{
|
||||
return( m_actionID );
|
||||
}
|
||||
|
||||
const QVariant & data( void ) const
|
||||
{
|
||||
return( m_data );
|
||||
}
|
||||
|
||||
QVariant & data( void )
|
||||
{
|
||||
return( m_data );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
t_action_id m_actionID;
|
||||
QVariant m_data;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
typedef vvector<journalEntry> journalEntryVector;
|
||||
|
||||
|
||||
|
||||
class journallingObject : public engineObject
|
||||
{
|
||||
public:
|
||||
journallingObject( engine * _engine );
|
||||
virtual ~journallingObject();
|
||||
|
||||
inline const jo_id_t id( void ) const
|
||||
{
|
||||
return( m_id );
|
||||
}
|
||||
|
||||
void undo( void );
|
||||
void redo( void );
|
||||
|
||||
void clear( void )
|
||||
{
|
||||
m_journalEntries.clear();
|
||||
m_currentJournalEntry = m_journalEntries.end();
|
||||
}
|
||||
|
||||
void clearRedoSteps( void )
|
||||
{
|
||||
m_journalEntries.erase( m_currentJournalEntry,
|
||||
m_journalEntries.end() );
|
||||
m_currentJournalEntry = m_journalEntries.end();
|
||||
|
||||
}
|
||||
|
||||
void saveJournallingState( const bool _new_state )
|
||||
{
|
||||
m_journallingStateStack.push( m_journalling );
|
||||
m_journalling = _new_state;
|
||||
}
|
||||
|
||||
void restoreJournallingState( void )
|
||||
{
|
||||
m_journalling = m_journallingStateStack.pop();
|
||||
}
|
||||
|
||||
virtual QDomElement FASTCALL saveState( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
|
||||
virtual void FASTCALL restoreState( const QDomElement & _this );
|
||||
|
||||
|
||||
// to be implemented by actual object
|
||||
virtual QString nodeName( void ) const = 0;
|
||||
|
||||
|
||||
protected:
|
||||
void addJournalEntry( const journalEntry & _je );
|
||||
|
||||
inline bool isJournalling( void ) const
|
||||
{
|
||||
return( m_journalling );
|
||||
}
|
||||
|
||||
inline void setJournalling( const bool _sr )
|
||||
{
|
||||
m_journalling = _sr;
|
||||
}
|
||||
|
||||
|
||||
// to be implemented by sub-objects
|
||||
virtual void FASTCALL saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _this )
|
||||
{
|
||||
}
|
||||
|
||||
virtual void FASTCALL loadSettings( const QDomElement & _this )
|
||||
{
|
||||
}
|
||||
|
||||
virtual void undoStep( journalEntry & _je )
|
||||
{
|
||||
}
|
||||
virtual void redoStep( journalEntry & _je )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
vstack<bool> m_journallingStateStack;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "settings.h"
|
||||
#include "journalling_object.h"
|
||||
#include "engine.h"
|
||||
|
||||
|
||||
@@ -51,18 +51,18 @@ class QMenu;
|
||||
class QPixmap;
|
||||
class QAction;
|
||||
|
||||
class channelTrack;
|
||||
class instrumentTrack;
|
||||
class tabWidget;
|
||||
class ledCheckBox;
|
||||
class lcdSpinBox;
|
||||
class midiPort;
|
||||
|
||||
|
||||
class midiTabWidget : public QWidget, public settings, public engineObject
|
||||
class midiTabWidget : public QWidget, public journallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
midiTabWidget( channelTrack * _channel_track, midiPort * _port );
|
||||
midiTabWidget( instrumentTrack * _channel_track, midiPort * _port );
|
||||
virtual ~midiTabWidget();
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ protected slots:
|
||||
void activatedWriteablePort( int _id );
|
||||
|
||||
private:
|
||||
channelTrack * m_channelTrack;
|
||||
instrumentTrack * m_instrumentTrack;
|
||||
midiPort * m_midiPort;
|
||||
|
||||
tabWidget * m_setupTabWidget;
|
||||
@@ -103,7 +103,7 @@ private:
|
||||
QMenu * m_readablePorts;
|
||||
QMenu * m_writeablePorts;
|
||||
|
||||
friend class channelTrack;
|
||||
friend class instrumentTrack;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -50,12 +50,13 @@ public:
|
||||
UNKNOWN,
|
||||
SONG_PROJECT,
|
||||
SONG_PROJECT_TEMPLATE,
|
||||
CHANNEL_SETTINGS,
|
||||
INSTRUMENT_TRACK_SETTINGS,
|
||||
DRAG_N_DROP_DATA,
|
||||
JOURNAL_DATA,
|
||||
EFFECT_SETTINGS,
|
||||
VIDEO_PROJECT, // will come later...
|
||||
BURN_PROJECT, // will come later...
|
||||
PLAYLIST, // will come later...
|
||||
VIDEO_PROJECT, // might come later...
|
||||
BURN_PROJECT, // might come later...
|
||||
PLAYLIST, // might come later...
|
||||
PROJ_TYPE_COUNT
|
||||
} ;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include "volume.h"
|
||||
#include "panning.h"
|
||||
#include "midi_time.h"
|
||||
#include "settings.h"
|
||||
#include "journalling_object.h"
|
||||
|
||||
enum tones
|
||||
{
|
||||
@@ -89,15 +89,18 @@ const int OCTAVES = 9;
|
||||
|
||||
|
||||
|
||||
class note : public settings
|
||||
class note : public journallingObject
|
||||
{
|
||||
public:
|
||||
note( const midiTime & _length = 0, const midiTime & _pos = 0,
|
||||
tones _tone = A, octaves _octave = DEFAULT_OCTAVE,
|
||||
note( engine * _engine = NULL,
|
||||
const midiTime & _length = 0,
|
||||
const midiTime & _pos = 0,
|
||||
tones _tone = A,
|
||||
octaves _octave = DEFAULT_OCTAVE,
|
||||
volume _volume = DEFAULT_VOLUME,
|
||||
panning _panning = DEFAULT_PANNING ) FASTCALL;
|
||||
|
||||
~note();
|
||||
virtual ~note();
|
||||
|
||||
void FASTCALL setLength( const midiTime & _length );
|
||||
void FASTCALL setPos( const midiTime & _pos );
|
||||
@@ -154,18 +157,31 @@ public:
|
||||
return( m_panning );
|
||||
}
|
||||
|
||||
virtual void FASTCALL saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
virtual void FASTCALL loadSettings( const QDomElement & _this );
|
||||
inline virtual QString nodeName( void ) const
|
||||
{
|
||||
return( "note" );
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
virtual void FASTCALL saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
virtual void FASTCALL loadSettings( const QDomElement & _this );
|
||||
|
||||
virtual void undoStep( journalEntry & _je );
|
||||
virtual void redoStep( journalEntry & _je );
|
||||
|
||||
|
||||
private:
|
||||
midiTime FASTCALL quantized( const midiTime & _m, const int _q_grid );
|
||||
|
||||
enum actions
|
||||
{
|
||||
CHANGE_KEY, CHANGE_VOLUME, CHANGE_PANNING,
|
||||
CHANGE_LENGTH, CHANGE_POSITION
|
||||
} ;
|
||||
|
||||
|
||||
tones m_tone;
|
||||
octaves m_octave;
|
||||
volume m_volume;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "note.h"
|
||||
|
||||
|
||||
class channelTrack;
|
||||
class instrumentTrack;
|
||||
class notePlayHandle;
|
||||
|
||||
typedef vvector<notePlayHandle *> notePlayHandleVector;
|
||||
@@ -45,8 +45,8 @@ public:
|
||||
void * m_pluginData;
|
||||
basicFilters<> * m_filter;
|
||||
|
||||
notePlayHandle( channelTrack * _chnl_trk, const f_cnt_t _frames_ahead,
|
||||
const f_cnt_t _frames, note * _n,
|
||||
notePlayHandle( instrumentTrack * _chnl_trk, const f_cnt_t _frames_ahead,
|
||||
const f_cnt_t _frames, const note & _n,
|
||||
const bool _arp_note = FALSE );
|
||||
virtual ~notePlayHandle();
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
{
|
||||
return( ( m_released && m_framesBeforeRelease == 0 &&
|
||||
m_releaseFramesDone >= m_releaseFramesToDo ) ||
|
||||
m_channelTrack == NULL );
|
||||
m_instrumentTrack == NULL );
|
||||
}
|
||||
|
||||
virtual void checkValidity( void );
|
||||
@@ -118,10 +118,10 @@ public:
|
||||
m_arpNote = _n->arpNote() && baseNote();
|
||||
}
|
||||
|
||||
// returns channel-track this note-play-handle plays
|
||||
inline channelTrack * getChannelTrack( void )
|
||||
// returns instrument-track this note-play-handle plays
|
||||
inline instrumentTrack * getInstrumentTrack( void )
|
||||
{
|
||||
return( m_channelTrack );
|
||||
return( m_instrumentTrack );
|
||||
}
|
||||
|
||||
// returns whether note is a base-note, e.g. is not part of an arpeggio
|
||||
@@ -161,15 +161,15 @@ public:
|
||||
|
||||
// note-play-handles belonging to given channel
|
||||
static constNotePlayHandleVector nphsOfChannelTrack(
|
||||
const channelTrack * _ct );
|
||||
const instrumentTrack * _ct );
|
||||
|
||||
// return whether given note-play-handle is equal to *this
|
||||
bool operator==( const notePlayHandle & _nph ) const;
|
||||
|
||||
|
||||
private:
|
||||
channelTrack * m_channelTrack; // needed for calling
|
||||
// channelTrack::playNote
|
||||
instrumentTrack * m_instrumentTrack; // needed for calling
|
||||
// instrumentTrack::playNote
|
||||
f_cnt_t m_frames; // total frames to play
|
||||
f_cnt_t m_framesAhead; // numbers of frames ahead in buffer
|
||||
// to mix in
|
||||
|
||||
@@ -59,7 +59,7 @@ class QAction;
|
||||
class QProgressBar;
|
||||
class QPushButton;
|
||||
|
||||
class channelTrack;
|
||||
class instrumentTrack;
|
||||
class patternFreezeThread;
|
||||
class sampleBuffer;
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
BEAT_PATTERN, MELODY_PATTERN/*, AUTOMATION_PATTERN*/
|
||||
} ;
|
||||
|
||||
pattern( channelTrack * _channel_track );
|
||||
pattern( instrumentTrack * _channel_track );
|
||||
pattern( const pattern & _pat_to_copy );
|
||||
virtual ~pattern();
|
||||
|
||||
@@ -154,9 +154,9 @@ public:
|
||||
return( "pattern" );
|
||||
}
|
||||
|
||||
inline channelTrack * getChannelTrack( void )
|
||||
inline instrumentTrack * getInstrumentTrack( void )
|
||||
{
|
||||
return( m_channelTrack );
|
||||
return( m_instrumentTrack );
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ private:
|
||||
bool m_needsUpdate;
|
||||
|
||||
// general stuff
|
||||
channelTrack * m_channelTrack;
|
||||
instrumentTrack * m_instrumentTrack;
|
||||
|
||||
patternTypes m_patternType;
|
||||
QString m_name;
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include "types.h"
|
||||
#include "note.h"
|
||||
#include "engine.h"
|
||||
#include "settings.h"
|
||||
#include "journalling_object.h"
|
||||
|
||||
|
||||
class QPainter;
|
||||
@@ -60,7 +60,7 @@ class timeLine;
|
||||
class toolButton;
|
||||
|
||||
|
||||
class pianoRoll : public QWidget, public engineObject, public settings
|
||||
class pianoRoll : public QWidget, public journallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include "templates.h"
|
||||
|
||||
|
||||
class channelTrack;
|
||||
class instrumentTrack;
|
||||
class notePlayHandle;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class pianoWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
pianoWidget( channelTrack * _channel_track );
|
||||
pianoWidget( instrumentTrack * _channel_track );
|
||||
virtual ~pianoWidget();
|
||||
|
||||
inline void setKeyState( int _key, bool _on = FALSE )
|
||||
@@ -97,7 +97,7 @@ private:
|
||||
bool m_pressedKeys[NOTES_PER_OCTAVE * OCTAVES];
|
||||
|
||||
QScrollBar * m_pianoScroll;
|
||||
channelTrack * m_channelTrack;
|
||||
instrumentTrack * m_instrumentTrack;
|
||||
tones m_startTone; // first key when drawing
|
||||
octaves m_startOctave;
|
||||
|
||||
|
||||
@@ -44,10 +44,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include "engine.h"
|
||||
|
||||
|
||||
class playHandle : public engineObject
|
||||
class playHandle
|
||||
{
|
||||
public:
|
||||
enum types
|
||||
@@ -56,8 +53,7 @@ public:
|
||||
PRESET_PREVIEW_PLAY_HANDLE
|
||||
} ;
|
||||
|
||||
playHandle( const types _type, engine * _engine ) :
|
||||
engineObject( _engine ),
|
||||
playHandle( const types _type ) :
|
||||
m_type( _type )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -47,9 +47,8 @@
|
||||
|
||||
|
||||
#include "types.h"
|
||||
#include "settings.h"
|
||||
#include "journalling_object.h"
|
||||
#include "embed.h"
|
||||
#include "engine.h"
|
||||
|
||||
|
||||
#define STRINGIFY_PLUGIN_NAME(s) STR(s)
|
||||
@@ -59,7 +58,7 @@
|
||||
class QPixmap;
|
||||
|
||||
|
||||
class plugin : public settings, public engineObject
|
||||
class plugin : public journallingObject
|
||||
{
|
||||
public:
|
||||
enum pluginTypes
|
||||
|
||||
@@ -31,25 +31,25 @@
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <QMutex>
|
||||
#include <QMap>
|
||||
|
||||
#else
|
||||
|
||||
#include <qmutex.h>
|
||||
#include <qmap.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include "note_play_handle.h"
|
||||
#include "engine.h"
|
||||
|
||||
|
||||
class instrumentTrack;
|
||||
class notePlayHandle;
|
||||
class previewTrackContainer;
|
||||
class channelTrack;
|
||||
|
||||
|
||||
class presetPreviewPlayHandle : public playHandle
|
||||
class presetPreviewPlayHandle : public playHandle, public engineObject
|
||||
{
|
||||
public:
|
||||
presetPreviewPlayHandle( const QString & _preset_file,
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
|
||||
static void cleanUp( engine * _engine );
|
||||
static constNotePlayHandleVector nphsOfChannelTrack(
|
||||
const channelTrack * _ct );
|
||||
const instrumentTrack * _ct );
|
||||
|
||||
private:
|
||||
inline previewTrackContainer * previewTC( void )
|
||||
|
||||
120
include/project_journal.h
Executable file
120
include/project_journal.h
Executable file
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* project_journal.h - declaration of class projectJournal
|
||||
*
|
||||
* Copyright (c) 2006 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., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _PROJECT_JOURNAL_H
|
||||
#define _PROJECT_JOURNAL_H
|
||||
|
||||
#include "types.h"
|
||||
#include "engine.h"
|
||||
#include "qt3support.h"
|
||||
|
||||
#ifndef QT3
|
||||
|
||||
#include <QVariant>
|
||||
#include <QVector>
|
||||
#include <QMap>
|
||||
|
||||
#else
|
||||
|
||||
#include <qvariant.h>
|
||||
#include <qvaluevector.h>
|
||||
#include <qmap.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
class journallingObject;
|
||||
|
||||
|
||||
class projectJournal : public engineObject
|
||||
{
|
||||
public:
|
||||
projectJournal( engine * _engine );
|
||||
virtual ~projectJournal();
|
||||
|
||||
void undo( void );
|
||||
void redo( void );
|
||||
|
||||
// tell history that a new journal entry was added to object with ID _id
|
||||
void journalEntryAdded( const jo_id_t _id );
|
||||
|
||||
bool isJournalling( void ) const
|
||||
{
|
||||
return( m_journalling );
|
||||
}
|
||||
|
||||
void setJournalling( const bool _on )
|
||||
{
|
||||
m_journalling = _on;
|
||||
}
|
||||
|
||||
// alloc new ID and register object _obj to it
|
||||
jo_id_t allocID( journallingObject * _obj );
|
||||
|
||||
// if there's already something known about ID _id, but it is currently
|
||||
// unused (e.g. after jouralling object was deleted), register object
|
||||
// _obj to this id
|
||||
void reallocID( const jo_id_t _id, journallingObject * _obj );
|
||||
|
||||
// make ID _id unused, but keep all global journalling information
|
||||
// (order of journalling entries etc.) referring to _id - needed for
|
||||
// restoring a journalling object later
|
||||
void freeID( const jo_id_t _id )
|
||||
{
|
||||
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 clear( void );
|
||||
|
||||
journallingObject * getJournallingObject( const jo_id_t _id )
|
||||
{
|
||||
if( m_joIDs.contains( _id ) )
|
||||
{
|
||||
return( m_joIDs[_id] );
|
||||
}
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
typedef QMap<jo_id_t, journallingObject *> joIDMap;
|
||||
typedef vvector<jo_id_t> journalEntryVector;
|
||||
|
||||
joIDMap m_joIDs;
|
||||
|
||||
journalEntryVector m_journalEntries;
|
||||
journalEntryVector::iterator m_currentJournalEntry;
|
||||
|
||||
bool m_journalling;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
#include "settings.h"
|
||||
#include "journalling_object.h"
|
||||
#include "engine.h"
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class QComboBox;
|
||||
class QTextEdit;
|
||||
|
||||
|
||||
class projectNotes : public QMainWindow, public settings, public engineObject
|
||||
class projectNotes : public QMainWindow, public journallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -130,8 +130,6 @@ inline QString baseName( const QString & _file )
|
||||
|
||||
|
||||
// QAbstractButton/QButton
|
||||
#define setCheckable setToggleButton
|
||||
#define isCheckable isToggleButton
|
||||
#define setShortcut setAccel
|
||||
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@
|
||||
|
||||
#include "play_handle.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "engine.h"
|
||||
|
||||
class sampleBuffer;
|
||||
class audioPort;
|
||||
|
||||
|
||||
class samplePlayHandle : public playHandle
|
||||
class samplePlayHandle : public playHandle, public engineObject
|
||||
{
|
||||
public:
|
||||
samplePlayHandle( const QString & _sample_file, engine * _engine );
|
||||
|
||||
@@ -150,9 +150,7 @@ public:
|
||||
{
|
||||
return( m_fileName );
|
||||
}
|
||||
virtual void FASTCALL saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
virtual void FASTCALL loadSettings( const QDomElement & _this );
|
||||
|
||||
inline virtual QString nodeName( void ) const
|
||||
{
|
||||
return( "songeditor" );
|
||||
|
||||
@@ -48,7 +48,11 @@ public:
|
||||
QPushButton( _text, _parent ),
|
||||
m_id( _id )
|
||||
{
|
||||
#ifndef QT3
|
||||
setCheckable( TRUE );
|
||||
#else
|
||||
setToggleButton( TRUE );
|
||||
#endif
|
||||
connect( this, SIGNAL( clicked() ), this,
|
||||
SLOT( slotClicked() ) );
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class nStateButton;
|
||||
class textFloat;
|
||||
|
||||
|
||||
class timeLine : public QWidget, public engineObject, public settings
|
||||
class timeLine : public QWidget, public journallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -54,10 +54,9 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "midi_time.h"
|
||||
#include "settings.h"
|
||||
#include "rubberband.h"
|
||||
#include "engine.h"
|
||||
#include "editable_object.h"
|
||||
#include "journalling_object.h"
|
||||
|
||||
|
||||
class QMenu;
|
||||
@@ -79,8 +78,8 @@ const Uint16 TRACK_OP_WIDTH = 70;
|
||||
const Uint16 TCO_BORDER_WIDTH = 1;
|
||||
|
||||
|
||||
class trackContentObject : public selectableObject, public settings,
|
||||
public editableObject
|
||||
class trackContentObject : public selectableObject,
|
||||
public journallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -130,8 +129,8 @@ protected:
|
||||
void setAutoResizeEnabled( bool _e = FALSE );
|
||||
float pixelsPerTact( void );
|
||||
|
||||
virtual void undoStep( const editStep & _edit_step );
|
||||
virtual void redoStep( const editStep & _edit_step );
|
||||
virtual void undoStep( journalEntry & _edit_step );
|
||||
virtual void redoStep( journalEntry & _edit_step );
|
||||
|
||||
|
||||
protected slots:
|
||||
@@ -164,7 +163,7 @@ private:
|
||||
|
||||
|
||||
|
||||
class trackContentWidget : public QWidget, public editableObject
|
||||
class trackContentWidget : public QWidget, public journallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -206,8 +205,13 @@ protected:
|
||||
virtual void paintEvent( QPaintEvent * _pe );
|
||||
virtual void resizeEvent( QResizeEvent * _re );
|
||||
|
||||
virtual void undoStep( const editStep & _edit_step );
|
||||
virtual void redoStep( const editStep & _edit_step );
|
||||
virtual QString nodeName( void ) const
|
||||
{
|
||||
return( "trackcontentwidget" );
|
||||
}
|
||||
|
||||
virtual void undoStep( journalEntry & _edit_step );
|
||||
virtual void redoStep( journalEntry & _edit_step );
|
||||
|
||||
|
||||
private:
|
||||
@@ -364,7 +368,7 @@ private:
|
||||
|
||||
|
||||
// base-class for all tracks
|
||||
class track : public settings, public engineObject
|
||||
class track : public journallingObject
|
||||
{
|
||||
public:
|
||||
enum trackTypes
|
||||
@@ -419,7 +423,7 @@ public:
|
||||
|
||||
|
||||
virtual void FASTCALL saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
QDomElement & _this );
|
||||
virtual void FASTCALL loadSettings( const QDomElement & _this );
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
|
||||
#include "track.h"
|
||||
#include "settings.h"
|
||||
#include "journalling_object.h"
|
||||
#include "rubberband.h"
|
||||
#include "engine.h"
|
||||
|
||||
@@ -56,7 +56,7 @@ const Uint16 DEFAULT_SCROLLBAR_SIZE = 16;
|
||||
|
||||
|
||||
|
||||
class trackContainer : public QMainWindow, public settings, public engineObject
|
||||
class trackContainer : public QMainWindow, public journallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -54,6 +54,6 @@ typedef Uint16 bpm_t; // tempo (MIN_BPM to MAX_BPM)
|
||||
typedef Uint16 bitrate_t; // bitrate in kbps
|
||||
typedef Sint8 fx_ch_t; // FX-channel (0 to MAX_EFFECT_CHANNEL)
|
||||
|
||||
typedef Uint32 eo_id_t; // (unique) ID of an editable object
|
||||
typedef Uint32 jo_id_t; // (unique) ID of an journalling object
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user