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

« back to all changes in this revision

Viewing changes to src/core/timeline.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
 * timeline.cpp - class timeLine, representing a time-line with position marker
5
5
 *
6
 
 * Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
 
6
 * Copyright (c) 2004-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
 
49
49
 
50
50
#include "timeline.h"
51
51
#include "embed.h"
 
52
#include "engine.h"
52
53
#include "templates.h"
53
54
#include "nstate_button.h"
54
55
#include "main_window.h"
64
65
 
65
66
timeLine::timeLine( const int _xoff, const int _yoff, const float _ppt,
66
67
                        songEditor::playPos & _pos, const midiTime & _begin,
67
 
                                        QWidget * _parent, engine * _engine ) :
 
68
                                                        QWidget * _parent ) :
68
69
        QWidget( _parent ),
69
 
        journallingObject( _engine ),
70
70
        m_autoScroll( AUTOSCROLL_ENABLED ),
71
71
        m_loopPoints( LOOP_POINTS_DISABLED ),
72
72
        m_behaviourAtStop( BACK_TO_ZERO ),
128
128
 
129
129
timeLine::~timeLine()
130
130
{
131
 
        m_pos.m_timeLine = NULL;
 
131
        if( engine::getSongEditor() )
 
132
        {
 
133
                m_pos.m_timeLine = NULL;
 
134
        }
132
135
        delete m_hint;
133
136
}
134
137
 
137
140
 
138
141
void timeLine::addToolButtons( QWidget * _tool_bar )
139
142
{
140
 
        nStateButton * m_autoScroll = new nStateButton( _tool_bar );
141
 
        m_autoScroll->setGeneralToolTip( tr( "Enable/disable "
142
 
                                                        "auto-scrolling" ) );
143
 
        m_autoScroll->addState( embed::getIconPixmap( "autoscroll_on" ) );
144
 
        m_autoScroll->addState( embed::getIconPixmap( "autoscroll_off" ) );
145
 
        connect( m_autoScroll, SIGNAL( changedState( int ) ), this,
 
143
        nStateButton * autoScroll = new nStateButton( _tool_bar );
 
144
        autoScroll->setGeneralToolTip( tr( "Enable/disable auto-scrolling" ) );
 
145
        autoScroll->addState( embed::getIconPixmap( "autoscroll_on" ) );
 
146
        autoScroll->addState( embed::getIconPixmap( "autoscroll_off" ) );
 
147
        connect( autoScroll, SIGNAL( changedState( int ) ), this,
146
148
                                        SLOT( toggleAutoScroll( int ) ) );
147
149
 
148
 
        nStateButton * m_loopPoints = new nStateButton( _tool_bar );
149
 
        m_loopPoints->setGeneralToolTip( tr( "Enable/disable loop-points" ) );
150
 
        m_loopPoints->addState( embed::getIconPixmap( "loop_points_off" ) );
151
 
        m_loopPoints->addState( embed::getIconPixmap( "loop_points_on" ) );
152
 
        connect( m_loopPoints, SIGNAL( changedState( int ) ), this,
 
150
        nStateButton * loopPoints = new nStateButton( _tool_bar );
 
151
        loopPoints->setGeneralToolTip( tr( "Enable/disable loop-points" ) );
 
152
        loopPoints->addState( embed::getIconPixmap( "loop_points_off" ) );
 
153
        loopPoints->addState( embed::getIconPixmap( "loop_points_on" ) );
 
154
        connect( loopPoints, SIGNAL( changedState( int ) ), this,
153
155
                                        SLOT( toggleLoopPoints( int ) ) );
 
156
        connect( this, SIGNAL( loopPointStateLoaded( int ) ), loopPoints,
 
157
                                        SLOT( changeState( int ) ) );
154
158
 
155
 
        nStateButton * m_behaviourAtStop = new nStateButton( _tool_bar );
156
 
        m_behaviourAtStop ->addState( embed::getIconPixmap( "back_to_zero" ),
 
159
        nStateButton * behaviourAtStop = new nStateButton( _tool_bar );
 
160
        behaviourAtStop->addState( embed::getIconPixmap( "back_to_zero" ),
157
161
                                        tr( "After stopping go back to begin" )
158
162
                                                                        );
159
 
        m_behaviourAtStop ->addState( embed::getIconPixmap(
160
 
                                                        "back_to_start" ),
 
163
        behaviourAtStop->addState( embed::getIconPixmap( "back_to_start" ),
161
164
                                        tr( "After stopping go back to "
162
165
                                                "position at which playing was "
163
166
                                                "started" ) );
164
 
        m_behaviourAtStop ->addState( embed::getIconPixmap(
165
 
                                                "keep_stop_position" ),
 
167
        behaviourAtStop->addState( embed::getIconPixmap( "keep_stop_position" ),
166
168
                                        tr( "After stopping keep position" ) );
167
 
        connect( m_behaviourAtStop, SIGNAL( changedState( int ) ), this,
 
169
        connect( behaviourAtStop, SIGNAL( changedState( int ) ), this,
168
170
                                        SLOT( toggleBehaviourAtStop( int ) ) );
169
171
 
170
172
        QBoxLayout * layout = dynamic_cast<QBoxLayout *>( _tool_bar->layout() );
171
 
        layout->addWidget( m_autoScroll );
172
 
        layout->addWidget( m_loopPoints );
173
 
        layout->addWidget( m_behaviourAtStop );
 
173
        layout->addWidget( autoScroll );
 
174
        layout->addWidget( loopPoints );
 
175
        layout->addWidget( behaviourAtStop );
174
176
}
175
177
 
176
178
 
193
195
        m_loopPoints = static_cast<loopPointStates>(
194
196
                                        _this.attribute( "lpstate" ).toInt() );
195
197
        update();
 
198
        emit loopPointStateLoaded( m_loopPoints );
196
199
}
197
200
 
198
201
 
361
364
                case MOVE_LOOP_END:
362
365
                {
363
366
                        const Uint8 i = m_action - MOVE_LOOP_BEGIN;
364
 
                        if( eng()->getMainWindow()->isCtrlPressed() == TRUE )
 
367
                        if( engine::getMainWindow()->isCtrlPressed() == TRUE )
365
368
                        {
366
369
                                // no ctrl-press-hint when having ctrl pressed
367
370
                                delete m_hint;