~ubuntu-branches/ubuntu/hardy/lmms/hardy

« back to all changes in this revision

Viewing changes to src/lib/journalling_object.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Tobias Doerffel
  • Date: 2007-09-17 15:00:24 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070917150024-mo0zk4ks81jawqii
Tags: 0.3.0-1ubuntu1
* Resynchronized with Debian (LP: #139759, LP: #90806, LP: #102639,
  LP: #113447, LP: #121172, LP: #124890)
* reverted changes from 0.2.1-1.1ubuntu1 as upstream merged/included them

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
/*
4
4
 * journalling_object.cpp - implementation of journalling-object related stuff
5
5
 *
6
 
 * Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
 
6
 * Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
7
7
 * 
8
8
 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
9
9
 *
19
19
 *
20
20
 * You should have received a copy of the GNU General Public
21
21
 * License along with this program (see COPYING); if not, write to the
22
 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23
 
 * Boston, MA 02111-1307, USA.
 
22
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
23
 * Boston, MA 02110-1301 USA.
24
24
 *
25
25
 */
26
26
 
28
28
#include "journalling_object.h"
29
29
#include "project_journal.h"
30
30
#include "base64.h"
 
31
#include "engine.h"
31
32
 
32
33
#include "qt3support.h"
33
34
 
43
44
 
44
45
 
45
46
 
46
 
journallingObject::journallingObject( engine * _engine ) :
47
 
        engineObject( _engine ),
48
 
        m_id( ( eng() != NULL ) ? eng()->getProjectJournal()->allocID( this ) :
49
 
                                                                        0 ),
 
47
journallingObject::journallingObject( void ) :
 
48
        m_id( engine::getProjectJournal()->allocID( this ) ),
50
49
        m_journalEntries(),
51
50
        m_currentJournalEntry( m_journalEntries.end() ),
52
51
        m_journalling( TRUE )
58
57
 
59
58
journallingObject::~journallingObject()
60
59
{
61
 
        if( eng() && eng()->getProjectJournal() )
 
60
        if( engine::getProjectJournal() )
62
61
        {
63
 
                eng()->getProjectJournal()->freeID( id() );
 
62
                engine::getProjectJournal()->freeID( id() );
64
63
        }
65
64
}
66
65
 
69
68
 
70
69
void journallingObject::undo( void )
71
70
{
72
 
        printf("undo: %d\n", id() );
73
71
        if( m_journalEntries.empty() == TRUE )
74
72
        {
75
73
                return;
86
84
 
87
85
void journallingObject::redo( void )
88
86
{
89
 
        printf("undo: %d\n", id() );
90
87
        if( m_journalEntries.empty() == TRUE )
91
88
        {
92
89
                return;
140
137
 
141
138
void journallingObject::addJournalEntry( const journalEntry & _je )
142
139
{
143
 
        if( !( eng() == NULL ||
144
 
                eng()->getProjectJournal()->isJournalling() == FALSE ||
145
 
                isJournalling() == FALSE ) )
 
140
        if( engine::getProjectJournal()->isJournalling() && isJournalling() )
146
141
        {
147
142
                m_journalEntries.erase( m_currentJournalEntry,
148
143
                                                m_journalEntries.end() );
149
144
                m_journalEntries.push_back( _je );
150
145
                m_currentJournalEntry = m_journalEntries.end();
151
 
                eng()->getProjectJournal()->journalEntryAdded( id() );
 
146
                engine::getProjectJournal()->journalEntryAdded( id() );
152
147
        }
153
148
}
154
149
 
199
194
 
200
195
        if( id() != new_id )
201
196
        {
202
 
                eng()->getProjectJournal()->forgetAboutID( id() );
203
 
                eng()->getProjectJournal()->reallocID( new_id, this );
 
197
                engine::getProjectJournal()->forgetAboutID( id() );
 
198
                engine::getProjectJournal()->reallocID( new_id, this );
204
199
                m_id = new_id;
205
200
        }
206
201