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

« back to all changes in this revision

Viewing changes to src/core/midi_tab_widget.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:
4
4
 * midi_tab_widget.cpp - tab-widget in channel-track-window for setting up
5
5
 *                       MIDI-related stuff
6
6
 *
7
 
 * Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
 
7
 * Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
8
8
 * 
9
9
 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
10
10
 *
20
20
 *
21
21
 * You should have received a copy of the GNU General Public
22
22
 * License along with this program (see COPYING); if not, write to the
23
 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24
 
 * Boston, MA 02111-1307, USA.
 
23
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
24
 * Boston, MA 02110-1301 USA.
25
25
 *
26
26
 */
27
27
 
48
48
 
49
49
 
50
50
#include "midi_tab_widget.h"
 
51
#include "embed.h"
 
52
#include "engine.h"
 
53
#include "gui_templates.h"
51
54
#include "instrument_track.h"
 
55
#include "midi_client.h"
52
56
#include "midi_port.h"
53
 
#include "tab_widget.h"
54
57
#include "led_checkbox.h"
55
58
#include "lcd_spinbox.h"
 
59
#include "song_editor.h"
 
60
#include "tab_widget.h"
56
61
#include "tooltip.h"
57
 
#include "song_editor.h"
58
 
#include "midi_client.h"
59
 
#include "embed.h"
60
62
 
61
63
 
62
64
 
63
65
midiTabWidget::midiTabWidget( instrumentTrack * _instrument_track,
64
66
                                                        midiPort * _port ) :
65
67
        QWidget( _instrument_track->tabWidgetParent() ),
66
 
        journallingObject( _instrument_track->eng() ),
67
68
        m_instrumentTrack( _instrument_track ),
68
69
        m_midiPort( _port ),
69
70
        m_readablePorts( NULL ),
75
76
 
76
77
 
77
78
        m_inputChannelSpinBox = new lcdSpinBox( 0, MIDI_CHANNEL_COUNT, 3,
78
 
                                                m_setupTabWidget,
79
 
                                                tr( "Input channel" ),
80
 
                                                eng(), _instrument_track );
 
79
                                                        m_setupTabWidget,
 
80
                                                        tr( "Input channel" ),
 
81
                                                        _instrument_track );
81
82
        m_inputChannelSpinBox->addTextForValue( 0, "---" );
82
83
        m_inputChannelSpinBox->setValue( m_midiPort->inputChannel() + 1 );
83
84
        m_inputChannelSpinBox->setLabel( tr( "CHANNEL" ) );
84
85
        m_inputChannelSpinBox->move( 28, 52 );
 
86
        m_inputChannelSpinBox->setEnabled( FALSE );
85
87
        connect( m_inputChannelSpinBox, SIGNAL( valueChanged( int ) ),
86
88
                                this, SLOT( inputChannelChanged( int ) ) );
87
89
        inputChannelChanged( m_inputChannelSpinBox->value() );
88
90
 
89
91
        m_outputChannelSpinBox = new lcdSpinBox( 1, MIDI_CHANNEL_COUNT, 3,
90
 
                                                m_setupTabWidget,
91
 
                                                tr( "Output channel" ),
92
 
                                                eng(), _instrument_track );
 
92
                                                        m_setupTabWidget,
 
93
                                                        tr( "Output channel" ),
 
94
                                                        _instrument_track );
93
95
        m_outputChannelSpinBox->setValue( m_midiPort->outputChannel() + 1 );
94
96
        //m_outputChannelSpinBox->addTextForValue( 0, "---" );
95
97
        m_outputChannelSpinBox->setLabel( tr( "CHANNEL" ) );
96
98
        m_outputChannelSpinBox->move( 28, 132 );
 
99
        m_outputChannelSpinBox->setEnabled( FALSE );
97
100
        connect( m_outputChannelSpinBox, SIGNAL( valueChanged( int ) ),
98
101
                                this, SLOT( outputChannelChanged( int ) ) );
99
102
        outputChannelChanged( m_outputChannelSpinBox->value() );
102
105
        m_receiveCheckBox = new ledCheckBox( tr( "Receive MIDI-events" ),
103
106
                                                m_setupTabWidget,
104
107
                                                tr( "Receive MIDI-events" ),
105
 
                                                eng(), _instrument_track );
 
108
                                                _instrument_track );
106
109
        m_receiveCheckBox->move( 10, 34 );
107
110
        connect( m_receiveCheckBox, SIGNAL( toggled( bool ) ),
108
111
                                this, SLOT( midiPortModeToggled( bool ) ) );
113
116
                                                "for all input-events" ),
114
117
                                                m_setupTabWidget,
115
118
                                                tr( "Default input velocity" ),
116
 
                                                eng(), _instrument_track );
 
119
                                                _instrument_track );
117
120
        m_defaultVelocityInCheckBox->move( 28, 84 );
118
121
        connect( m_defaultVelocityInCheckBox, SIGNAL( toggled( bool ) ),
119
122
                                this, SLOT( defaultVelInChanged( bool ) ) );
122
125
        m_sendCheckBox = new ledCheckBox( tr( "Send MIDI-events" ),
123
126
                                                m_setupTabWidget,
124
127
                                                tr( "Send MIDI-events" ),
125
 
                                                eng(), _instrument_track );
 
128
                                                _instrument_track );
126
129
        m_sendCheckBox->move( 10, 114 );
127
130
        connect( m_sendCheckBox, SIGNAL( toggled( bool ) ),
128
131
                                this, SLOT( midiPortModeToggled( bool ) ) );
133
136
                                                "for all output-events" ),
134
137
                                                m_setupTabWidget,
135
138
                                                tr( "Default output velocity" ),
136
 
                                                eng(), _instrument_track );
 
139
                                                _instrument_track );
137
140
        m_defaultVelocityOutCheckBox->move( 28, 164 );
138
141
        connect( m_defaultVelocityOutCheckBox, SIGNAL( toggled( bool ) ),
139
142
                                this, SLOT( defaultVelOutChanged( bool ) ) );
147
150
 
148
151
        // when using with non-raw-clients we can provide buttons showing
149
152
        // our port-menus when being clicked
150
 
        midiClient * mc = eng()->getMixer()->getMIDIClient();
 
153
        midiClient * mc = engine::getMixer()->getMIDIClient();
151
154
        if( mc->isRaw() == FALSE )
152
155
        {
153
156
                m_readablePorts = new QMenu( m_setupTabWidget );
374
377
void midiTabWidget::inputChannelChanged( int _new_chnl )
375
378
{
376
379
        m_midiPort->setInputChannel( _new_chnl - 1 );
377
 
        eng()->getSongEditor()->setModified();
 
380
        engine::getSongEditor()->setModified();
378
381
}
379
382
 
380
383
 
383
386
void midiTabWidget::outputChannelChanged( int _new_chnl )
384
387
{
385
388
        m_midiPort->setOutputChannel( _new_chnl - 1 );
386
 
        eng()->getSongEditor()->setModified();
 
389
        engine::getSongEditor()->setModified();
387
390
}
388
391
 
389
392
 
465
468
                }
466
469
#endif
467
470
        }
468
 
        eng()->getSongEditor()->setModified();
 
471
        engine::getSongEditor()->setModified();
469
472
}
470
473
 
471
474
 
497
500
#endif
498
501
 
499
502
        m_readablePorts->clear();
500
 
        const QStringList & rp = eng()->getMixer()->getMIDIClient()->
 
503
        const QStringList & rp = engine::getMixer()->getMIDIClient()->
501
504
                                                                readablePorts();
502
505
        // now insert new ports and restore selections
503
506
        for( QStringList::const_iterator it = rp.begin(); it != rp.end(); ++it )
549
552
#endif
550
553
 
551
554
        m_writeablePorts->clear();
552
 
        const QStringList & wp = eng()->getMixer()->getMIDIClient()->
 
555
        const QStringList & wp = engine::getMixer()->getMIDIClient()->
553
556
                                                        writeablePorts();
554
557
        // now insert new ports and restore selections
555
558
        for( QStringList::const_iterator it = wp.begin(); it != wp.end(); ++it )
584
587
        {
585
588
                m_receiveCheckBox->setChecked( TRUE );
586
589
        }
587
 
        eng()->getMixer()->getMIDIClient()->subscribeReadablePort( m_midiPort,
 
590
        engine::getMixer()->getMIDIClient()->subscribeReadablePort( m_midiPort,
588
591
                                _item->text(), !_item->isChecked() );
589
592
}
590
593
 
600
603
        {
601
604
                m_sendCheckBox->setChecked( TRUE );
602
605
        }
603
 
        eng()->getMixer()->getMIDIClient()->subscribeWriteablePort( m_midiPort,
 
606
        engine::getMixer()->getMIDIClient()->subscribeWriteablePort( m_midiPort,
604
607
                                _item->text(), !_item->isChecked() );
605
608
}
606
609
 
622
625
        }
623
626
        m_readablePorts->setItemChecked( _id,
624
627
                                !m_readablePorts->isItemChecked( _id ) );
625
 
        eng()->getMixer()->getMIDIClient()->subscribeReadablePort(
 
628
        engine::getMixer()->getMIDIClient()->subscribeReadablePort(
626
629
                                m_midiPort, m_readablePorts->text( _id ),
627
630
                                !m_readablePorts->isItemChecked( _id ) );
628
631
}
641
644
        }
642
645
        m_writeablePorts->setItemChecked( _id,
643
646
                                !m_writeablePorts->isItemChecked( _id ) );
644
 
        eng()->getMixer()->getMIDIClient()->subscribeWriteablePort(
 
647
        engine::getMixer()->getMIDIClient()->subscribeWriteablePort(
645
648
                                m_midiPort, m_writeablePorts->text( _id ),
646
649
                                !m_writeablePorts->isItemChecked( _id ) );
647
650
}