~ubuntu-branches/ubuntu/trusty/lmms/trusty

« back to all changes in this revision

Viewing changes to src/core/track.cpp

  • Committer: Package Import Robot
  • Author(s): Israel Dahl
  • Date: 2013-02-28 20:58:18 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20130228205818-spbc545gwofxkkif
Tags: 0.4.14-0ubuntu1
* New upstream release.
  - Graphically enhanced AudioFileProcessor plugin
  - Fixed bug with magnetic knobs
  - Fixed various crashes
  - Completely revised VST support (improved VST effect support,
  timesync support and many more)
  - Added multitrack export
  - Added Hydrogen song import plugin
  - Fixed wrong chords
  - Improvements to automation framework
* debian/lmms.install debian/lmms-common.install
  - moved /usr/share/applications to lmms.install
* debian/control
  - updated Standards-Version to 3.9.4
* debian/copyright
  - updated to make current
* debian/rules
  - fixed Lintian errors during build

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * track.cpp - implementation of classes concerning tracks -> necessary for
3
3
 *             all track-like objects (beat/bassline, sample-track...)
4
4
 *
5
 
 * Copyright (c) 2004-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
 
5
 * Copyright (c) 2004-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
6
6
 *
7
7
 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
8
8
 *
31
31
 * \mainpage Track classes
32
32
 *
33
33
 * \section introduction Introduction
34
 
 * 
 
34
 *
35
35
 * \todo fill this out
36
36
 */
37
37
 
80
80
const Uint16 TRACK_OP_BTN_WIDTH = 20;
81
81
const Uint16 TRACK_OP_BTN_HEIGHT = 14;
82
82
 
83
 
/*! The minimum track height in pixels
84
 
 *
85
 
 * Tracks can be resized by shift-dragging anywhere inside the track
86
 
 * display.  This sets the minimum size in pixels for a track.
87
 
 */
88
 
const Uint16 MINIMAL_TRACK_HEIGHT = 32;
89
 
 
90
83
 
91
84
/*! A pointer for that text bubble used when moving segments, etc.
92
85
 *
644
637
 *  * If in move mode, move ourselves in the track,
645
638
 *  * or if in move-selection mode, move the entire selection,
646
639
 *  * or if in resize mode, resize ourselves,
647
 
 *  * otherwise ??? 
 
640
 *  * otherwise ???
648
641
 *
649
642
 * \param _me The QMouseEvent to handle.
650
643
 * \todo what does the final else case do here?
1199
1192
        // Don't draw background on BB-Editor
1200
1193
        if( m_trackView->getTrackContainerView() != engine::getBBEditor() )
1201
1194
        {
1202
 
                p.drawTiledPixmap( rect(), m_background, QPoint( 
 
1195
                p.drawTiledPixmap( rect(), m_background, QPoint(
1203
1196
                                tcv->currentPosition().getTact() * ppt, 0 ) );
1204
1197
        }
1205
1198
}
1563
1556
        m_trackContentObjects()         /*!< The track content objects (segments) */
1564
1557
{
1565
1558
        m_trackContainer->addTrack( this );
 
1559
        m_height = -1;
1566
1560
}
1567
1561
 
1568
1562
 
1679
1673
        _this.setAttribute( "type", type() );
1680
1674
        _this.setAttribute( "name", name() );
1681
1675
        _this.setAttribute( "muted", isMuted() );
1682
 
// ### TODO
1683
 
//      _this.setAttribute( "height", m_trackView->height() );
 
1676
        if( m_height >= MINIMAL_TRACK_HEIGHT )
 
1677
        {
 
1678
                _this.setAttribute( "height", m_height );
 
1679
        }
1684
1680
 
1685
1681
        QDomElement ts_de = _doc.createElement( nodeName() );
1686
1682
        // let actual track (InstrumentTrack, bbTrack, sampleTrack etc.) save
1772
1768
                        }
1773
1769
                }
1774
1770
                node = node.nextSibling();
1775
 
        }
1776
 
/*
1777
 
        if( _this.attribute( "height" ).toInt() >= MINIMAL_TRACK_HEIGHT )
 
1771
        }
 
1772
 
 
1773
        if( _this.attribute( "height" ).toInt() >= MINIMAL_TRACK_HEIGHT &&
 
1774
                _this.attribute( "height" ).toInt() <= DEFAULT_TRACK_HEIGHT )   // workaround for #3585927, tobydox/2012-11-11
1778
1775
        {
1779
 
                m_trackView->setFixedHeight(
1780
 
                                        _this.attribute( "height" ).toInt() );
1781
 
        }*/
 
1776
                m_height = _this.attribute( "height" ).toInt();
 
1777
        }
1782
1778
}
1783
1779
 
1784
1780
 
2122
2118
        layout->addWidget( &m_trackOperationsWidget );
2123
2119
        layout->addWidget( &m_trackSettingsWidget );
2124
2120
        layout->addWidget( &m_trackContentWidget, 1 );
 
2121
        setFixedHeight( m_track->getHeight() );
2125
2122
 
2126
2123
        resizeEvent( NULL );
2127
2124
 
2225
2222
        connect( m_track, SIGNAL( destroyedTrack() ), this, SLOT( close() ) );
2226
2223
        m_trackOperationsWidget.m_muteBtn->setModel( &m_track->m_mutedModel );
2227
2224
        m_trackOperationsWidget.m_soloBtn->setModel( &m_track->m_soloModel );
2228
 
        ModelView::modelChanged();
 
2225
        ModelView::modelChanged();      
 
2226
        setFixedHeight( m_track->getHeight() );
2229
2227
}
2230
2228
 
2231
2229
 
2256
2254
                                                MINIMAL_TRACK_HEIGHT ) );
2257
2255
                        m_trackContainerView->realignTracks();
2258
2256
                        break;
 
2257
                        /*case RestoreTrack:
 
2258
                        setFixedHeight( DEFAULT_TRACK_HEIGHT );
 
2259
                        m_trackContainerView->realignTracks();
 
2260
                        break; */
2259
2261
        }
2260
2262
        restoreJournallingState();
2261
2263
}
2331
2333
 */
2332
2334
void trackView::mousePressEvent( QMouseEvent * _me )
2333
2335
{
 
2336
        // If previously dragged too small, restore on shift-leftclick
 
2337
        if( height() < DEFAULT_TRACK_HEIGHT &&
 
2338
                _me->modifiers() & Qt::ShiftModifier &&
 
2339
                _me->button() == Qt::LeftButton )
 
2340
        {
 
2341
                setFixedHeight( DEFAULT_TRACK_HEIGHT );
 
2342
                m_track->setHeight( DEFAULT_TRACK_HEIGHT );
 
2343
        }
 
2344
 
 
2345
 
2334
2346
        if( m_trackContainerView->allowRubberband() == true )
2335
2347
        {
2336
2348
                QWidget::mousePressEvent( _me );
2385
2397
 */
2386
2398
void trackView::mouseMoveEvent( QMouseEvent * _me )
2387
2399
{
 
2400
 
2388
2401
        if( m_trackContainerView->allowRubberband() == true )
2389
2402
        {
2390
2403
                QWidget::mouseMoveEvent( _me );
2415
2428
        {
2416
2429
                setFixedHeight( qMax<int>( _me->y(), MINIMAL_TRACK_HEIGHT ) );
2417
2430
                m_trackContainerView->realignTracks();
 
2431
                m_track->setHeight( height() );
 
2432
        }
 
2433
 
 
2434
        if( height() < DEFAULT_TRACK_HEIGHT )
 
2435
        {
 
2436
                toolTip::add( this, m_track->m_name );
2418
2437
        }
2419
2438
}
2420
2439
 
2421
2440
 
2422
2441
 
2423
 
 
2424
2442
/*! \brief Handle a mouse release event on this track View.
2425
2443
 *
2426
2444
 *  \param _me the MouseEvent to handle.