Merge remote-tracking branch 'origin/stable-1.1'
Conflicts: data/locale/de.qm data/locale/de.ts
This commit is contained in:
@@ -432,7 +432,7 @@ float AutomatableModel::fittedValue( float value, bool forceStep ) const
|
||||
|
||||
void AutomatableModel::linkModel( AutomatableModel* model )
|
||||
{
|
||||
if( !m_linkedModels.contains( model ) )
|
||||
if( !m_linkedModels.contains( model ) && model != this )
|
||||
{
|
||||
m_linkedModels.push_back( model );
|
||||
m_hasLinkedModels = true;
|
||||
@@ -464,8 +464,8 @@ void AutomatableModel::unlinkModel( AutomatableModel* model )
|
||||
|
||||
void AutomatableModel::linkModels( AutomatableModel* model1, AutomatableModel* model2 )
|
||||
{
|
||||
model1->linkModel( model2 );
|
||||
model2->linkModel( model1 );
|
||||
model1->linkModel( model2 );
|
||||
model2->linkModel( model1 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include "ProjectJournal.h"
|
||||
#include "bb_track_container.h"
|
||||
#include "song.h"
|
||||
#include "text_float.h"
|
||||
#include "embed.h"
|
||||
|
||||
|
||||
const float AutomationPattern::DEFAULT_MIN_VALUE = 0;
|
||||
@@ -96,8 +98,8 @@ void AutomationPattern::addObject( AutomatableModel * _obj, bool _search_dup )
|
||||
{
|
||||
if( *it == _obj )
|
||||
{
|
||||
// Already exists
|
||||
// TODO: Maybe let the user know in some non-annoying way
|
||||
textFloat::displayMessage( _obj->displayName(), tr( "Model is already connected "
|
||||
"to this pattern." ), embed::getIconPixmap( "automation" ), 2000 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -683,18 +683,6 @@ void DataFile::upgrade()
|
||||
|
||||
}
|
||||
|
||||
// new default colour for B&B tracks
|
||||
QDomNodeList list = elementsByTagName( "bbtco" );
|
||||
for( int i = 0; !list.item( i ).isNull(); ++i )
|
||||
{
|
||||
QDomElement el = list.item( i ).toElement();
|
||||
unsigned int rgb = el.attribute( "color" ).toUInt();
|
||||
if( rgb == qRgb( 64, 128, 255 ) )
|
||||
{
|
||||
el.setAttribute( "color", bbTCO::defaultColor() );
|
||||
}
|
||||
}
|
||||
|
||||
// Time-signature
|
||||
if ( !m_head.hasAttribute( "timesig_numerator" ) )
|
||||
{
|
||||
|
||||
@@ -223,13 +223,13 @@ void FxMixer::deleteChannel(int index)
|
||||
}
|
||||
|
||||
// delete all of this channel's sends and receives
|
||||
for(int i=0; i<m_fxChannels[index]->m_sends.size(); ++i)
|
||||
while( ! m_fxChannels[index]->m_sends.isEmpty() )
|
||||
{
|
||||
deleteChannelSend(index, m_fxChannels[index]->m_sends[i]);
|
||||
deleteChannelSend( index, m_fxChannels[index]->m_sends.first() );
|
||||
}
|
||||
for(int i=0; i<m_fxChannels[index]->m_receives.size(); ++i)
|
||||
while( ! m_fxChannels[index]->m_receives.isEmpty() )
|
||||
{
|
||||
deleteChannelSend(m_fxChannels[index]->m_receives[i], index);
|
||||
deleteChannelSend( m_fxChannels[index]->m_receives.first(), index );
|
||||
}
|
||||
|
||||
for(int i=0; i<m_fxChannels.size(); ++i)
|
||||
@@ -268,7 +268,7 @@ void FxMixer::moveChannelLeft(int index)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_sendsMutex.lock();
|
||||
// channels to swap
|
||||
int a = index - 1, b = index;
|
||||
|
||||
@@ -330,6 +330,7 @@ void FxMixer::moveChannelLeft(int index)
|
||||
FxChannel * tmpChannel = m_fxChannels[a];
|
||||
m_fxChannels[a] = m_fxChannels[b];
|
||||
m_fxChannels[b] = tmpChannel;
|
||||
m_sendsMutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -356,7 +357,7 @@ void FxMixer::createChannelSend(fx_ch_t fromChannel, fx_ch_t toChannel,
|
||||
}
|
||||
|
||||
// connection does not exist. create a new one
|
||||
|
||||
m_sendsMutex.lock();
|
||||
// add to from's sends
|
||||
from->m_sends.push_back(toChannel);
|
||||
from->m_sendAmount.push_back(new FloatModel(amount, 0, 1, 0.001, NULL,
|
||||
@@ -364,7 +365,7 @@ void FxMixer::createChannelSend(fx_ch_t fromChannel, fx_ch_t toChannel,
|
||||
|
||||
// add to to's receives
|
||||
m_fxChannels[toChannel]->m_receives.push_back(fromChannel);
|
||||
|
||||
m_sendsMutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -375,7 +376,7 @@ void FxMixer::deleteChannelSend(fx_ch_t fromChannel, fx_ch_t toChannel)
|
||||
// delete the send
|
||||
FxChannel * from = m_fxChannels[fromChannel];
|
||||
FxChannel * to = m_fxChannels[toChannel];
|
||||
|
||||
m_sendsMutex.lock();
|
||||
// find and delete the send entry
|
||||
for(int i=0; i<from->m_sends.size(); ++i) {
|
||||
if( from->m_sends[i] == toChannel )
|
||||
@@ -398,6 +399,7 @@ void FxMixer::deleteChannelSend(fx_ch_t fromChannel, fx_ch_t toChannel)
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_sendsMutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -496,6 +498,7 @@ void FxMixer::masterMix( sampleFrame * _buf )
|
||||
// and add all channels to job list that have no dependencies
|
||||
// when the channel completes it will check its parent to see if it needs
|
||||
// to be processed.
|
||||
m_sendsMutex.lock();
|
||||
MixerWorkerThread::resetJobQueue( MixerWorkerThread::JobQueue::Dynamic );
|
||||
addChannelLeaf( 0, _buf );
|
||||
while( m_fxChannels[0]->state() != ThreadableJob::Done )
|
||||
@@ -503,6 +506,7 @@ void FxMixer::masterMix( sampleFrame * _buf )
|
||||
MixerWorkerThread::startAndWaitForJobs();
|
||||
}
|
||||
//m_fxChannels[0]->doProcessing( NULL );
|
||||
m_sendsMutex.unlock();
|
||||
|
||||
// handle sample-exact data in master volume fader
|
||||
ValueBuffer * volBuf = m_fxChannels[0]->m_volumeModel.hasSampleExactData()
|
||||
@@ -566,9 +570,9 @@ void FxMixer::clearChannel(fx_ch_t index)
|
||||
if( index > 0)
|
||||
{
|
||||
// delete existing sends
|
||||
for( int i=0; i<ch->m_sends.size(); ++i)
|
||||
while( ! ch->m_sends.isEmpty() )
|
||||
{
|
||||
deleteChannelSend(index, ch->m_sends[i]);
|
||||
deleteChannelSend( index, ch->m_sends.first() );
|
||||
}
|
||||
|
||||
// add send to master
|
||||
@@ -576,11 +580,10 @@ void FxMixer::clearChannel(fx_ch_t index)
|
||||
}
|
||||
|
||||
// delete receives
|
||||
for( int i=0; i<ch->m_receives.size(); ++i)
|
||||
while( ! ch->m_receives.isEmpty() )
|
||||
{
|
||||
deleteChannelSend(ch->m_receives[i], index);
|
||||
deleteChannelSend( ch->m_receives.first(), index );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FxMixer::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
|
||||
@@ -235,7 +235,7 @@ void InstrumentFunctionNoteStacking::processNote( NotePlayHandle * _n )
|
||||
// time an audio-buffer is rendered...
|
||||
if( ( _n->origin() == NotePlayHandle::OriginArpeggio || ( _n->hasParent() == false && _n->instrumentTrack()->isArpeggioEnabled() == false ) ) &&
|
||||
_n->totalFramesPlayed() == 0 &&
|
||||
m_chordsEnabledModel.value() == true )
|
||||
m_chordsEnabledModel.value() == true && ! _n->isReleased() )
|
||||
{
|
||||
// then insert sub-notes for chord
|
||||
const int selected_chord = m_chordsModel.value();
|
||||
|
||||
@@ -686,13 +686,13 @@ void Mixer::removePlayHandle( PlayHandle * _ph )
|
||||
|
||||
|
||||
|
||||
void Mixer::removePlayHandles( track * _track )
|
||||
void Mixer::removePlayHandles( track * _track, bool removeIPHs )
|
||||
{
|
||||
lock();
|
||||
PlayHandleList::Iterator it = m_playHandles.begin();
|
||||
while( it != m_playHandles.end() )
|
||||
{
|
||||
if( ( *it )->isFromTrack( _track ) )
|
||||
if( ( *it )->isFromTrack( _track ) && ( removeIPHs || ( *it )->type() != PlayHandle::TypeInstrumentPlayHandle ) )
|
||||
{
|
||||
delete *it;
|
||||
it = m_playHandles.erase( it );
|
||||
|
||||
@@ -61,13 +61,14 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
|
||||
m_framesBeforeRelease( 0 ),
|
||||
m_releaseFramesToDo( 0 ),
|
||||
m_releaseFramesDone( 0 ),
|
||||
m_scheduledNoteOff( -1 ),
|
||||
m_released( false ),
|
||||
m_hasParent( parent != NULL ),
|
||||
m_hadChildren( false ),
|
||||
m_muted( false ),
|
||||
m_bbTrack( NULL ),
|
||||
m_origTempo( engine::getSong()->getTempo() ),
|
||||
m_origBaseNote( instrumentTrack->baseNoteModel()->value() ),
|
||||
m_origBaseNote( instrumentTrack->baseNote() ),
|
||||
m_frequency( 0 ),
|
||||
m_unpitchedFrequency( 0 ),
|
||||
m_baseDetuning( NULL ),
|
||||
@@ -100,14 +101,15 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
|
||||
m_instrumentTrack->midiNoteOn( *this );
|
||||
}
|
||||
|
||||
if( !isMasterNote() || !instrumentTrack->isArpeggioEnabled() )
|
||||
if( hasParent() || ! m_instrumentTrack->isArpeggioEnabled() )
|
||||
{
|
||||
const int baseVelocity = m_instrumentTrack->midiPort()->baseVelocity();
|
||||
|
||||
// send MidiNoteOn event
|
||||
m_instrumentTrack->processOutEvent(
|
||||
MidiEvent( MidiNoteOn, midiChannel(), midiKey(), midiVelocity( baseVelocity ) ),
|
||||
MidiTime::fromFrames( offset(), engine::framesPerTick() ) );
|
||||
MidiTime::fromFrames( offset(), engine::framesPerTick() ),
|
||||
offset() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +119,14 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
|
||||
NotePlayHandle::~NotePlayHandle()
|
||||
{
|
||||
noteOff( 0 );
|
||||
|
||||
if( m_scheduledNoteOff >= 0 ) // ensure that scheduled noteoffs get triggered if somehow the nph got destructed prematurely
|
||||
{
|
||||
m_instrumentTrack->processOutEvent(
|
||||
MidiEvent( MidiNoteOff, midiChannel(), midiKey(), 0 ),
|
||||
MidiTime::fromFrames( m_scheduledNoteOff, engine::framesPerTick() ),
|
||||
m_scheduledNoteOff );
|
||||
}
|
||||
|
||||
if( hasParent() == false )
|
||||
{
|
||||
delete m_baseDetuning;
|
||||
@@ -173,7 +182,7 @@ void NotePlayHandle::setPanning( panning_t panning )
|
||||
|
||||
int NotePlayHandle::midiKey() const
|
||||
{
|
||||
return key() - m_origBaseNote + instrumentTrack()->baseNoteModel()->value();
|
||||
return key() - m_origBaseNote + instrumentTrack()->baseNote();
|
||||
}
|
||||
|
||||
|
||||
@@ -181,6 +190,15 @@ int NotePlayHandle::midiKey() const
|
||||
|
||||
void NotePlayHandle::play( sampleFrame * _working_buffer )
|
||||
{
|
||||
if( m_scheduledNoteOff >= 0 ) // always trigger scheduled noteoffs, because they're only scheduled if the note is released
|
||||
{
|
||||
m_instrumentTrack->processOutEvent(
|
||||
MidiEvent( MidiNoteOff, midiChannel(), midiKey(), 0 ),
|
||||
MidiTime::fromFrames( m_scheduledNoteOff, engine::framesPerTick() ),
|
||||
m_scheduledNoteOff );
|
||||
m_scheduledNoteOff = -1;
|
||||
}
|
||||
|
||||
if( m_muted )
|
||||
{
|
||||
return;
|
||||
@@ -188,7 +206,7 @@ void NotePlayHandle::play( sampleFrame * _working_buffer )
|
||||
|
||||
if( m_released == false &&
|
||||
instrumentTrack()->isSustainPedalPressed() == false &&
|
||||
m_totalFramesPlayed + engine::mixer()->framesPerPeriod() >= m_frames )
|
||||
m_totalFramesPlayed + engine::mixer()->framesPerPeriod() > m_frames )
|
||||
{
|
||||
noteOff( m_frames - m_totalFramesPlayed );
|
||||
}
|
||||
@@ -211,7 +229,7 @@ void NotePlayHandle::play( sampleFrame * _working_buffer )
|
||||
// because we do not allow NotePlayHandle::isFinished() to be true
|
||||
// until all sub-notes are completely played and no new ones
|
||||
// are inserted by arpAndChordsTabWidget::processNote()
|
||||
if( isMasterNote() )
|
||||
if( ! m_subNotes.isEmpty() )
|
||||
{
|
||||
m_releaseFramesToDo = m_releaseFramesDone + 2 * engine::mixer()->framesPerPeriod();
|
||||
}
|
||||
@@ -288,9 +306,9 @@ f_cnt_t NotePlayHandle::framesLeft() const
|
||||
{
|
||||
return m_framesBeforeRelease;
|
||||
}
|
||||
else if( m_released && actualReleaseFramesToDo() >= m_releaseFramesDone )
|
||||
else if( m_released )
|
||||
{
|
||||
return m_framesBeforeRelease + actualReleaseFramesToDo() - m_releaseFramesDone;
|
||||
return m_framesBeforeRelease + m_releaseFramesToDo - m_releaseFramesDone;
|
||||
}
|
||||
return m_frames+actualReleaseFramesToDo()-m_totalFramesPlayed;
|
||||
}
|
||||
@@ -329,14 +347,23 @@ void NotePlayHandle::noteOff( const f_cnt_t _s )
|
||||
|
||||
// then set some variables indicating release-state
|
||||
m_framesBeforeRelease = _s;
|
||||
m_releaseFramesToDo = qMax<f_cnt_t>( 0, m_instrumentTrack->m_soundShaping.releaseFrames() );
|
||||
m_releaseFramesToDo = qMax<f_cnt_t>( 0, actualReleaseFramesToDo() );
|
||||
|
||||
if( hasParent() || !instrumentTrack()->isArpeggioEnabled() )
|
||||
if( hasParent() || ! m_instrumentTrack->isArpeggioEnabled() )
|
||||
{
|
||||
// send MidiNoteOff event
|
||||
m_instrumentTrack->processOutEvent(
|
||||
MidiEvent( MidiNoteOff, midiChannel(), midiKey(), 0 ),
|
||||
MidiTime::fromFrames( m_framesBeforeRelease, engine::framesPerTick() ) );
|
||||
f_cnt_t realOffset = offset() + _s; // get actual frameoffset of release, in global time
|
||||
if( realOffset < engine::mixer()->framesPerPeriod() ) // if release happens during this period, trigger midievent
|
||||
{
|
||||
m_instrumentTrack->processOutEvent(
|
||||
MidiEvent( MidiNoteOff, midiChannel(), midiKey(), 0 ),
|
||||
MidiTime::fromFrames( realOffset, engine::framesPerTick() ),
|
||||
realOffset );
|
||||
}
|
||||
else // if release flows over to next period, use m_scheduledNoteOff to trigger it later
|
||||
{
|
||||
m_scheduledNoteOff = realOffset - engine::mixer()->framesPerPeriod();
|
||||
}
|
||||
}
|
||||
|
||||
// inform attached components about MIDI finished (used for recording in Piano Roll)
|
||||
|
||||
@@ -46,10 +46,11 @@ ladspaManager::ladspaManager()
|
||||
ladspaDirectories.push_back( configManager::inst()->pluginDir() + "ladspa" );
|
||||
#ifndef LMMS_BUILD_WIN32
|
||||
ladspaDirectories.push_back( qApp->applicationDirPath() + '/' + LIB_DIR + "ladspa" );
|
||||
ladspaDirectories.push_back( "/usr/lib/lmms/ladspa" );
|
||||
ladspaDirectories.push_back( "/usr/local/lib/lmms/ladspa" );
|
||||
ladspaDirectories.push_back( "/usr/lib/ladspa" );
|
||||
ladspaDirectories.push_back( "/usr/lib64/ladspa" );
|
||||
ladspaDirectories.push_back( "/usr/local/lib/ladspa" );
|
||||
ladspaDirectories.push_back( "/usr/local/lib64/ladspa" );
|
||||
ladspaDirectories.push_back( "/Library/Audio/Plug-Ins/LADSPA" );
|
||||
#endif
|
||||
|
||||
for( QStringList::iterator it = ladspaDirectories.begin();
|
||||
|
||||
@@ -81,7 +81,7 @@ void MidiController::updateName()
|
||||
|
||||
|
||||
|
||||
void MidiController::processInEvent( const MidiEvent& event, const MidiTime& time )
|
||||
void MidiController::processInEvent( const MidiEvent& event, const MidiTime& time, f_cnt_t offset )
|
||||
{
|
||||
unsigned char controllerNum;
|
||||
switch( event.type() )
|
||||
|
||||
@@ -1201,12 +1201,28 @@ void song::exportProject(bool multiExport)
|
||||
efd.setAcceptMode( FileDialog::AcceptSave );
|
||||
|
||||
|
||||
if( efd.exec() == QDialog::Accepted &&
|
||||
!efd.selectedFiles().isEmpty() && !efd.selectedFiles()[0].isEmpty() )
|
||||
if( efd.exec() == QDialog::Accepted && !efd.selectedFiles().isEmpty() && !efd.selectedFiles()[0].isEmpty() )
|
||||
{
|
||||
const QString export_file_name = efd.selectedFiles()[0];
|
||||
exportProjectDialog epd( export_file_name,
|
||||
engine::mainWindow(), multiExport );
|
||||
QString suffix = "";
|
||||
if ( !multiExport )
|
||||
{
|
||||
int stx = efd.selectedNameFilter().indexOf( "(*." );
|
||||
int etx = efd.selectedNameFilter().indexOf( ")" );
|
||||
|
||||
if ( stx > 0 && etx > stx )
|
||||
{
|
||||
// Get first extension from selected dropdown.
|
||||
// i.e. ".wav" from "WAV-File (*.wav), Dummy-File (*.dum)"
|
||||
suffix = efd.selectedNameFilter().mid( stx + 2, etx - stx - 2 ).split( " " )[0].trimmed();
|
||||
if ( efd.selectedFiles()[0].endsWith( suffix ) )
|
||||
{
|
||||
suffix = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const QString export_file_name = efd.selectedFiles()[0] + suffix;
|
||||
exportProjectDialog epd( export_file_name, engine::mainWindow(), multiExport );
|
||||
epd.exec();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -998,14 +998,7 @@ bool trackContentObjectView::mouseMovedDistance( QMouseEvent * _me, int distance
|
||||
*/
|
||||
trackContentWidget::trackContentWidget( trackView * _parent ) :
|
||||
QWidget( _parent ),
|
||||
m_trackView( _parent ),
|
||||
m_darkerColor1( 0, 0, 0 ),
|
||||
m_darkerColor2( 0, 0, 0 ),
|
||||
m_darkerColor3( 0, 0, 0 ),
|
||||
m_lighterColor1( 0, 0, 0 ),
|
||||
m_lighterColor2( 0, 0, 0 ),
|
||||
m_lighterColor3( 0, 0, 0 ),
|
||||
m_gradMidPoint( 0.0f )
|
||||
m_trackView( _parent )
|
||||
{
|
||||
setAcceptDrops( true );
|
||||
|
||||
@@ -1045,17 +1038,8 @@ void trackContentWidget::updateBackground()
|
||||
m_background = QPixmap( w * 2, height() );
|
||||
QPainter pmp( &m_background );
|
||||
|
||||
QLinearGradient grad( 0,0, 0, h );
|
||||
grad.setColorAt( 0.0, darkerColor1() );
|
||||
grad.setColorAt( gradMidPoint(), darkerColor2() );
|
||||
grad.setColorAt( 1.0, darkerColor3() );
|
||||
pmp.fillRect( 0, 0, w, h, grad );
|
||||
|
||||
QLinearGradient grad2( 0,0, 0, h );
|
||||
grad2.setColorAt( 0.0, lighterColor1() );
|
||||
grad2.setColorAt( gradMidPoint(), lighterColor2() );
|
||||
grad2.setColorAt( 1.0, lighterColor3() );
|
||||
pmp.fillRect( w, 0, w , h, grad2 );
|
||||
pmp.fillRect( 0, 0, w, h, darkerColor() );
|
||||
pmp.fillRect( w, 0, w , h, lighterColor() );
|
||||
|
||||
// draw lines
|
||||
pmp.setPen( QPen( QColor( 0, 0, 0, 160 ), 1 ) );
|
||||
@@ -1534,61 +1518,20 @@ MidiTime trackContentWidget::endPosition( const MidiTime & _pos_start )
|
||||
|
||||
// qproperty access methods
|
||||
//! \brief CSS theming qproperty access method
|
||||
QColor trackContentWidget::darkerColor1() const
|
||||
{ return m_darkerColor1; }
|
||||
QBrush trackContentWidget::darkerColor() const
|
||||
{ return m_darkerColor; }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
QColor trackContentWidget::darkerColor2() const
|
||||
{ return m_darkerColor2; }
|
||||
QBrush trackContentWidget::lighterColor() const
|
||||
{ return m_lighterColor; }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
QColor trackContentWidget::darkerColor3() const
|
||||
{ return m_darkerColor3; }
|
||||
void trackContentWidget::setDarkerColor( const QBrush & c )
|
||||
{ m_darkerColor = c; }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
QColor trackContentWidget::lighterColor1() const
|
||||
{ return m_lighterColor1; }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
QColor trackContentWidget::lighterColor2() const
|
||||
{ return m_lighterColor2; }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
QColor trackContentWidget::lighterColor3() const
|
||||
{ return m_lighterColor3; }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentWidget::setDarkerColor1( const QColor & _c )
|
||||
{ m_darkerColor1 = QColor( _c ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentWidget::setDarkerColor2( const QColor & _c )
|
||||
{ m_darkerColor2 = QColor( _c ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentWidget::setDarkerColor3( const QColor & _c )
|
||||
{ m_darkerColor3 = QColor( _c ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentWidget::setLighterColor1( const QColor & _c )
|
||||
{ m_lighterColor1 = QColor( _c ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentWidget::setLighterColor2( const QColor & _c )
|
||||
{ m_lighterColor2 = QColor( _c ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentWidget::setLighterColor3( const QColor & _c )
|
||||
{ m_lighterColor3 = QColor( _c ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
float trackContentWidget::gradMidPoint() const
|
||||
{ return m_gradMidPoint; }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentWidget::setGradMidPoint( float _g )
|
||||
{ m_gradMidPoint = _g; }
|
||||
|
||||
void trackContentWidget::setLighterColor( const QBrush & c )
|
||||
{ m_lighterColor = c; }
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* AutomationEditor.cpp - implementation of AutomationEditor which is used for
|
||||
* actual setting of dynamic values
|
||||
* actual setting of dynamic values
|
||||
*
|
||||
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2008-2013 Paul Giblock <pgib/at/users.sourceforge.net>
|
||||
@@ -71,8 +71,6 @@ QPixmap * AutomationEditor::s_toolSelect = NULL;
|
||||
QPixmap * AutomationEditor::s_toolMove = NULL;
|
||||
|
||||
|
||||
const QColor DRAGGABLE_PIN_COLOR = QColor( 0xFF, 0x00, 0x00 );
|
||||
const QColor DRAGGABLE_PIN_BORDER_COLOR = QColor( 0xFF, 0xFF, 0xFF );
|
||||
|
||||
|
||||
AutomationEditor::AutomationEditor() :
|
||||
@@ -98,7 +96,11 @@ AutomationEditor::AutomationEditor() :
|
||||
m_y_delta( DEFAULT_Y_DELTA ),
|
||||
m_y_auto( TRUE ),
|
||||
m_editMode( DRAW ),
|
||||
m_scrollBack( FALSE )
|
||||
m_scrollBack( FALSE ),
|
||||
m_gridColor( 0,0,0 ),
|
||||
m_graphColor(),
|
||||
m_vertexColor( 0,0,0 ),
|
||||
m_scaleColor()
|
||||
{
|
||||
connect( this, SIGNAL( currentPatternChanged() ),
|
||||
this, SLOT( updateAfterPatternChange() ),
|
||||
@@ -358,7 +360,7 @@ AutomationEditor::AutomationEditor() :
|
||||
m_zoomingYComboBox->setFixedSize( 80, 22 );
|
||||
|
||||
m_zoomingYModel.addItem( "Auto" );
|
||||
for( int i = 0; i < 6; ++i )
|
||||
for( int i = 0; i < 7; ++i )
|
||||
{
|
||||
m_zoomingYModel.addItem( QString::number( 25 << i ) + "%" );
|
||||
}
|
||||
@@ -377,15 +379,13 @@ AutomationEditor::AutomationEditor() :
|
||||
m_quantizeComboBox = new comboBox( m_toolBar );
|
||||
m_quantizeComboBox->setFixedSize( 60, 22 );
|
||||
|
||||
// TODO: leak
|
||||
ComboBoxModel * quantize_model = new ComboBoxModel( /* this */ );
|
||||
for( int i = 0; i < 7; ++i )
|
||||
{
|
||||
quantize_model->addItem( "1/" + QString::number( 1 << i ) );
|
||||
m_quantizeModel.addItem( "1/" + QString::number( 1 << i ) );
|
||||
}
|
||||
quantize_model->setValue( quantize_model->findText( "1/16" ) );
|
||||
m_quantizeModel.setValue( m_quantizeModel.findText( "1/16" ) );
|
||||
|
||||
m_quantizeComboBox->setModel( quantize_model );
|
||||
m_quantizeComboBox->setModel( &m_quantizeModel );
|
||||
|
||||
|
||||
tb_layout->addSpacing( 5 );
|
||||
@@ -456,6 +456,7 @@ AutomationEditor::~AutomationEditor()
|
||||
{
|
||||
m_zoomingXModel.disconnect();
|
||||
m_zoomingYModel.disconnect();
|
||||
m_quantizeModel.disconnect();
|
||||
m_tensionModel->disconnect();
|
||||
}
|
||||
|
||||
@@ -502,6 +503,24 @@ void AutomationEditor::setPauseIcon( bool pause )
|
||||
}
|
||||
}
|
||||
|
||||
// qproperty access methods
|
||||
|
||||
QColor AutomationEditor::gridColor() const
|
||||
{ return m_gridColor; }
|
||||
QBrush AutomationEditor::graphColor() const
|
||||
{ return m_graphColor; }
|
||||
QColor AutomationEditor::vertexColor() const
|
||||
{ return m_vertexColor; }
|
||||
QBrush AutomationEditor::scaleColor() const
|
||||
{ return m_scaleColor; }
|
||||
void AutomationEditor::setGridColor( const QColor & c )
|
||||
{ m_gridColor = c; }
|
||||
void AutomationEditor::setGraphColor( const QBrush & c )
|
||||
{ m_graphColor = c; }
|
||||
void AutomationEditor::setVertexColor( const QColor & c )
|
||||
{ m_vertexColor = c; }
|
||||
void AutomationEditor::setScaleColor( const QBrush & c )
|
||||
{ m_scaleColor = c; }
|
||||
|
||||
|
||||
|
||||
@@ -1350,13 +1369,10 @@ inline void AutomationEditor::drawAutomationPoint( QPainter & p, timeMap::iterat
|
||||
{
|
||||
int x = xCoordOfTick( it.key() );
|
||||
int y = yCoordOfLevel( it.value() );
|
||||
int outerRadius = qMin( 8, m_ppt/quantization() );
|
||||
int innerRadius = qMax( 0, outerRadius-2 );
|
||||
p.setBrush( QBrush( DRAGGABLE_PIN_BORDER_COLOR ) );
|
||||
p.drawEllipse( x-outerRadius/2, y-outerRadius/2, outerRadius, outerRadius );
|
||||
p.setBrush( QBrush( DRAGGABLE_PIN_COLOR ) );
|
||||
p.drawEllipse( x-innerRadius/2, y-innerRadius/2, innerRadius, innerRadius );
|
||||
p.setBrush( QBrush() );
|
||||
const int outerRadius = qBound( 2, ( m_ppt * quantization() ) / 576, 5 ); // man, getting this calculation right took forever
|
||||
p.setPen( QPen( vertexColor().lighter( 200 ) ) );
|
||||
p.setBrush( QBrush( vertexColor() ) );
|
||||
p.drawEllipse( x - outerRadius, y - outerRadius, outerRadius * 2, outerRadius * 2 );
|
||||
}
|
||||
|
||||
|
||||
@@ -1371,6 +1387,12 @@ void AutomationEditor::paintEvent( QPaintEvent * _pe )
|
||||
QPainter p( this );
|
||||
style()->drawPrimitive( QStyle::PE_Widget, &opt, &p, this );
|
||||
|
||||
// get foreground color
|
||||
QColor fgColor = p.pen().brush().color();
|
||||
// get background color and fill background
|
||||
QBrush bgColor = p.background();
|
||||
p.fillRect( 0, 0, width(), height(), bgColor );
|
||||
|
||||
// set font-size to 8
|
||||
p.setFont( pointSize<8>( p.font() ) );
|
||||
|
||||
@@ -1380,7 +1402,7 @@ void AutomationEditor::paintEvent( QPaintEvent * _pe )
|
||||
int grid_bottom = height() - SCROLLBAR_SIZE - 1;
|
||||
|
||||
p.fillRect( 0, TOP_MARGIN, VALUES_WIDTH, height() - TOP_MARGIN,
|
||||
QColor( 0x33, 0x33, 0x33 ) );
|
||||
scaleColor() );
|
||||
|
||||
// print value numbers
|
||||
int font_height = p.fontMetrics().height();
|
||||
@@ -1397,11 +1419,12 @@ void AutomationEditor::paintEvent( QPaintEvent * _pe )
|
||||
{
|
||||
const QString & label = m_pattern->firstObject()
|
||||
->displayValue( level[i] );
|
||||
p.setPen( QColor( 240, 240, 240 ) );
|
||||
p.setPen( QApplication::palette().color( QPalette::Active,
|
||||
QPalette::Shadow ) );
|
||||
p.drawText( 1, y[i] - font_height + 1,
|
||||
VALUES_WIDTH - 10, 2 * font_height,
|
||||
text_flags, label );
|
||||
p.setPen( QColor( 0, 0, 0 ) );
|
||||
p.setPen( fgColor );
|
||||
p.drawText( 0, y[i] - font_height,
|
||||
VALUES_WIDTH - 10, 2 * font_height,
|
||||
text_flags, label );
|
||||
@@ -1425,11 +1448,12 @@ void AutomationEditor::paintEvent( QPaintEvent * _pe )
|
||||
const QString & label = m_pattern->firstObject()
|
||||
->displayValue( level );
|
||||
y = yCoordOfLevel( level );
|
||||
p.setPen( QColor( 240, 240, 240 ) );
|
||||
p.setPen( QApplication::palette().color( QPalette::Active,
|
||||
QPalette::Shadow ) );
|
||||
p.drawText( 1, y - font_height + 1,
|
||||
VALUES_WIDTH - 10, 2 * font_height,
|
||||
text_flags, label );
|
||||
p.setPen( QColor( 0, 0, 0 ) );
|
||||
p.setPen( fgColor );
|
||||
p.drawText( 0, y - font_height,
|
||||
VALUES_WIDTH - 10, 2 * font_height,
|
||||
text_flags, label );
|
||||
@@ -1443,6 +1467,7 @@ void AutomationEditor::paintEvent( QPaintEvent * _pe )
|
||||
grid_height );
|
||||
|
||||
// draw vertical raster
|
||||
QColor lineColor = QColor( gridColor() );
|
||||
if( m_pattern )
|
||||
{
|
||||
int tick, x;
|
||||
@@ -1454,38 +1479,42 @@ void AutomationEditor::paintEvent( QPaintEvent * _pe )
|
||||
// exotic denominators (e.g. 7/11 time), which are allowed ATM.
|
||||
// First quantization grid...
|
||||
for( tick = m_currentPosition - m_currentPosition % quantization(),
|
||||
x = xCoordOfTick( tick );
|
||||
x<=width();
|
||||
tick += quantization(), x = xCoordOfTick( tick ) )
|
||||
{
|
||||
p.setPen( QColor( 0x2F, 0x2F, 0x2F ) );
|
||||
x = xCoordOfTick( tick );
|
||||
x<=width();
|
||||
tick += quantization(), x = xCoordOfTick( tick ) )
|
||||
{
|
||||
lineColor.setAlpha( 80 );
|
||||
p.setPen( lineColor );
|
||||
p.drawLine( x, grid_bottom, x, x_line_end );
|
||||
}
|
||||
// Then beat grid
|
||||
int ticksPerBeat = DefaultTicksPerTact /
|
||||
// Then beat grid
|
||||
int ticksPerBeat = DefaultTicksPerTact /
|
||||
engine::getSong()->getTimeSigModel().getDenominator();
|
||||
for( tick = m_currentPosition - m_currentPosition % ticksPerBeat,
|
||||
x = xCoordOfTick( tick );
|
||||
x<=width();
|
||||
tick += ticksPerBeat, x = xCoordOfTick( tick ) )
|
||||
{
|
||||
p.setPen( QColor( 0x5F, 0x5F, 0x5F ) );
|
||||
x = xCoordOfTick( tick );
|
||||
x<=width();
|
||||
tick += ticksPerBeat, x = xCoordOfTick( tick ) )
|
||||
{
|
||||
lineColor.setAlpha( 160 );
|
||||
p.setPen( lineColor );
|
||||
p.drawLine( x, grid_bottom, x, x_line_end );
|
||||
}
|
||||
// and finally bars
|
||||
for( tick = m_currentPosition - m_currentPosition % MidiTime::ticksPerTact(),
|
||||
x = xCoordOfTick( tick );
|
||||
x<=width();
|
||||
tick += MidiTime::ticksPerTact(), x = xCoordOfTick( tick ) )
|
||||
x = xCoordOfTick( tick );
|
||||
x<=width();
|
||||
tick += MidiTime::ticksPerTact(), x = xCoordOfTick( tick ) )
|
||||
{
|
||||
p.setPen( QColor( 0x7F, 0x7F, 0x7F ) );
|
||||
lineColor.setAlpha( 255 );
|
||||
p.setPen( lineColor );
|
||||
p.drawLine( x, grid_bottom, x, x_line_end );
|
||||
}
|
||||
|
||||
|
||||
/// \todo move this horizontal line drawing code into the same loop as the value ticks?
|
||||
if( m_y_auto )
|
||||
{
|
||||
QPen pen( QColor( 0x4F, 0x4F, 0x4F ) );
|
||||
lineColor.setAlpha( 160 );
|
||||
QPen pen( lineColor );
|
||||
p.setPen( pen );
|
||||
p.drawLine( VALUES_WIDTH, grid_bottom, width(),
|
||||
grid_bottom );
|
||||
@@ -1506,11 +1535,13 @@ void AutomationEditor::paintEvent( QPaintEvent * _pe )
|
||||
y = yCoordOfLevel( (float)level );
|
||||
if( level % 5 == 0 )
|
||||
{
|
||||
p.setPen( QColor( 0x4F, 0x4F, 0x4F ) );
|
||||
lineColor.setAlpha( 160 );
|
||||
p.setPen( lineColor );
|
||||
}
|
||||
else
|
||||
{
|
||||
p.setPen( QColor( 0x3F, 0x3F, 0x3F ) );
|
||||
lineColor.setAlpha( 80 );
|
||||
p.setPen( lineColor );
|
||||
}
|
||||
|
||||
// draw level line
|
||||
@@ -1547,8 +1578,7 @@ void AutomationEditor::paintEvent( QPaintEvent * _pe )
|
||||
//Don't bother doing/rendering anything if there is no automation points
|
||||
if( time_map.size() > 0 )
|
||||
{
|
||||
timeMap::iterator it = time_map.begin();
|
||||
p.setPen( QColor( 0xCF, 0xD9, 0xFF ) );
|
||||
timeMap::iterator it = time_map.begin();
|
||||
while( it+1 != time_map.end() )
|
||||
{
|
||||
// skip this section if it occurs completely before the
|
||||
@@ -1585,10 +1615,11 @@ void AutomationEditor::paintEvent( QPaintEvent * _pe )
|
||||
{
|
||||
is_selected = TRUE;
|
||||
}
|
||||
|
||||
|
||||
float *values = m_pattern->valuesAfter( it.key() );
|
||||
for( int i = 0; i < (it+1).key() - it.key(); i++ )
|
||||
{
|
||||
|
||||
drawLevelTick( p, it.key() + i, values[i],
|
||||
is_selected );
|
||||
}
|
||||
@@ -1617,7 +1648,8 @@ void AutomationEditor::paintEvent( QPaintEvent * _pe )
|
||||
QFont f = p.font();
|
||||
f.setBold( TRUE );
|
||||
p.setFont( pointSize<14>( f ) );
|
||||
p.setPen( QColor( 74, 253, 133 ) );
|
||||
p.setPen( QApplication::palette().color( QPalette::Active,
|
||||
QPalette::BrightText ) );
|
||||
p.drawText( VALUES_WIDTH + 20, TOP_MARGIN + 40,
|
||||
width() - VALUES_WIDTH - 20 - SCROLLBAR_SIZE,
|
||||
grid_height - 40, Qt::TextWordWrap,
|
||||
@@ -1736,17 +1768,18 @@ void AutomationEditor::drawLevelTick( QPainter & _p, int _tick, float _level,
|
||||
rect_height = (int)( _level * m_y_delta );
|
||||
}
|
||||
|
||||
QColor current_color( 0x9F, 0xAF, 0xFF );
|
||||
if( _is_selected == TRUE )
|
||||
{
|
||||
current_color.setRgb( 0x00, 0x40, 0xC0 );
|
||||
}
|
||||
_p.fillRect( x, y_start, rect_width, rect_height, current_color );
|
||||
QBrush currentColor = _is_selected
|
||||
? QBrush( QColor( 0x00, 0x40, 0xC0 ) )
|
||||
: graphColor();
|
||||
|
||||
_p.fillRect( x, y_start, rect_width, rect_height, currentColor );
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
printf("not in range\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1798,26 +1831,49 @@ void AutomationEditor::resizeEvent( QResizeEvent * )
|
||||
void AutomationEditor::wheelEvent( QWheelEvent * _we )
|
||||
{
|
||||
_we->accept();
|
||||
if( _we->modifiers() & Qt::ControlModifier )
|
||||
if( _we->modifiers() & Qt::ControlModifier && _we->modifiers() & Qt::ShiftModifier )
|
||||
{
|
||||
int y = m_zoomingYModel.value();
|
||||
if( _we->delta() > 0 )
|
||||
{
|
||||
m_ppt = qMin( m_ppt * 2, m_y_delta *
|
||||
DEFAULT_STEPS_PER_TACT * 8 );
|
||||
y++;
|
||||
}
|
||||
else if( m_ppt >= 72 )
|
||||
if( _we->delta() < 0 )
|
||||
{
|
||||
m_ppt /= 2;
|
||||
y--;
|
||||
}
|
||||
// update combobox with zooming-factor
|
||||
m_zoomingXComboBox->model()->setValue(
|
||||
m_zoomingXComboBox->model()->findText( QString::number(
|
||||
qRound( m_ppt * 100 /
|
||||
DEFAULT_PPT ) ) +"%" ) );
|
||||
// update timeline
|
||||
m_timeLine->setPixelsPerTact( m_ppt );
|
||||
y = qBound( 0, y, m_zoomingYModel.size() - 1 );
|
||||
m_zoomingYModel.setValue( y );
|
||||
}
|
||||
else if( _we->modifiers() & Qt::ControlModifier && _we->modifiers() & Qt::AltModifier )
|
||||
{
|
||||
int q = m_quantizeModel.value();
|
||||
if( _we->delta() > 0 )
|
||||
{
|
||||
q--;
|
||||
}
|
||||
if( _we->delta() < 0 )
|
||||
{
|
||||
q++;
|
||||
}
|
||||
q = qBound( 0, q, m_quantizeModel.size() - 1 );
|
||||
m_quantizeModel.setValue( q );
|
||||
update();
|
||||
}
|
||||
else if( _we->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
int x = m_zoomingXModel.value();
|
||||
if( _we->delta() > 0 )
|
||||
{
|
||||
x++;
|
||||
}
|
||||
if( _we->delta() < 0 )
|
||||
{
|
||||
x--;
|
||||
}
|
||||
x = qBound( 0, x, m_zoomingXModel.size() - 1 );
|
||||
m_zoomingXModel.setValue( x );
|
||||
}
|
||||
else if( _we->modifiers() & Qt::ShiftModifier
|
||||
|| _we->orientation() == Qt::Horizontal )
|
||||
{
|
||||
|
||||
@@ -391,14 +391,6 @@ void AutomationPatternView::dropEvent( QDropEvent * _de )
|
||||
{
|
||||
engine::automationEditor()->setCurrentPattern( m_pat );
|
||||
}
|
||||
|
||||
//This is the only model that's just added to AutomationPattern.
|
||||
if( m_pat->m_objects.size() == 1 )
|
||||
{
|
||||
//scale the points to fit the new min. and max. value
|
||||
this->scaleTimemapToFit( AutomationPattern::DEFAULT_MIN_VALUE,
|
||||
AutomationPattern::DEFAULT_MAX_VALUE );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QtGui/QStackedLayout>
|
||||
#include <QtGui/QScrollArea>
|
||||
#include <QtGui/QStyle>
|
||||
#include <QtGui/QKeyEvent>
|
||||
@@ -48,7 +47,6 @@
|
||||
#include "song.h"
|
||||
#include "bb_track_container.h"
|
||||
|
||||
|
||||
FxMixerView::FxMixerView() :
|
||||
QWidget(),
|
||||
ModelView( NULL, this ),
|
||||
@@ -77,10 +75,18 @@ FxMixerView::FxMixerView() :
|
||||
chLayout->setMargin( 0 );
|
||||
m_channelAreaWidget->setLayout(chLayout);
|
||||
|
||||
// create rack layout before creating the first channel
|
||||
m_racksWidget = new QWidget;
|
||||
m_racksLayout = new QStackedLayout( m_racksWidget );
|
||||
m_racksLayout->setContentsMargins( 0, 0, 0, 0 );
|
||||
m_racksWidget->setLayout( m_racksLayout );
|
||||
|
||||
// add master channel
|
||||
m_fxChannelViews.resize( m->numChannels() );
|
||||
m_fxChannelViews[0] = new FxChannelView( this, this, 0 );
|
||||
|
||||
m_racksLayout->addWidget( m_fxChannelViews[0]->m_rackView );
|
||||
|
||||
FxChannelView * masterView = m_fxChannelViews[0];
|
||||
ml->addWidget( masterView->m_fxLine, 0, Qt::AlignTop );
|
||||
|
||||
@@ -118,17 +124,15 @@ FxMixerView::FxMixerView() :
|
||||
ml->addWidget(channelArea);
|
||||
|
||||
// show the add new effect channel button
|
||||
QPushButton * newChannelBtn = new QPushButton("new", this );
|
||||
newChannelBtn->setFont(QFont("sans-serif", 10, 1, false));
|
||||
newChannelBtn->setFixedSize(fxLineSize);
|
||||
connect( newChannelBtn, SIGNAL(clicked()), this, SLOT(addNewChannel()));
|
||||
QPushButton * newChannelBtn = new QPushButton( embed::getIconPixmap( "new_channel" ), QString::null, this );
|
||||
newChannelBtn->setObjectName( "newChannelBtn" );
|
||||
newChannelBtn->setFixedSize( fxLineSize );
|
||||
connect( newChannelBtn, SIGNAL( clicked() ), this, SLOT( addNewChannel() ) );
|
||||
ml->addWidget( newChannelBtn, 0, Qt::AlignTop );
|
||||
|
||||
|
||||
// Create EffectRack and set initial index to master channel
|
||||
m_rackView = new EffectRackView( &m->m_fxChannels[0]->m_fxChain, this );
|
||||
m_rackView->setFixedSize( 245, fxLineSize.height() );
|
||||
ml->addWidget( m_rackView, 0, Qt::AlignTop );
|
||||
// add the stacked layout for the effect racks of fx channels
|
||||
ml->addWidget( m_racksWidget, 0, Qt::AlignTop );
|
||||
|
||||
setCurrentFxLine( m_fxChannelViews[0]->m_fxLine );
|
||||
|
||||
@@ -170,7 +174,8 @@ void FxMixerView::addNewChannel()
|
||||
int newChannelIndex = mix->createChannel();
|
||||
m_fxChannelViews.push_back(new FxChannelView(m_channelAreaWidget, this,
|
||||
newChannelIndex));
|
||||
chLayout->addWidget(m_fxChannelViews[newChannelIndex]->m_fxLine);
|
||||
chLayout->addWidget( m_fxChannelViews[newChannelIndex]->m_fxLine );
|
||||
m_racksLayout->addWidget( m_fxChannelViews[newChannelIndex]->m_rackView );
|
||||
|
||||
updateFxLine(newChannelIndex);
|
||||
|
||||
@@ -188,6 +193,7 @@ void FxMixerView::refreshDisplay()
|
||||
delete m_fxChannelViews[i]->m_muteBtn;
|
||||
delete m_fxChannelViews[i]->m_fxLine;
|
||||
delete m_fxChannelViews[i];
|
||||
m_racksLayout->removeWidget( m_fxChannelViews[i]->m_rackView );
|
||||
}
|
||||
m_channelAreaWidget->adjustSize();
|
||||
|
||||
@@ -197,6 +203,7 @@ void FxMixerView::refreshDisplay()
|
||||
{
|
||||
m_fxChannelViews[i] = new FxChannelView(m_channelAreaWidget, this, i);
|
||||
chLayout->addWidget(m_fxChannelViews[i]->m_fxLine);
|
||||
m_racksLayout->addWidget( m_fxChannelViews[i]->m_rackView );
|
||||
}
|
||||
|
||||
// set selected fx line to 0
|
||||
@@ -257,7 +264,7 @@ FxMixerView::FxChannelView::FxChannelView(QWidget * _parent, FxMixerView * _mv,
|
||||
FxMixer * m = engine::fxMixer();
|
||||
m_fader = new fader( &m->effectChannel(_chIndex)->m_volumeModel,
|
||||
tr( "FX Fader %1" ).arg( _chIndex ), m_fxLine );
|
||||
m_fader->move( 15-m_fader->width()/2,
|
||||
m_fader->move( 16-m_fader->width()/2,
|
||||
m_fxLine->height()-
|
||||
m_fader->height()-5 );
|
||||
|
||||
@@ -270,6 +277,10 @@ FxMixerView::FxChannelView::FxChannelView(QWidget * _parent, FxMixerView * _mv,
|
||||
m_muteBtn->setCheckable( true );
|
||||
m_muteBtn->move( 9, m_fader->y()-16);
|
||||
toolTip::add( m_muteBtn, tr( "Mute this FX channel" ) );
|
||||
|
||||
// Create EffectRack for the channel
|
||||
m_rackView = new EffectRackView( &m->effectChannel(_chIndex)->m_fxChain, _mv->m_racksWidget );
|
||||
m_rackView->setFixedSize( 245, FxLine::FxLineHeight );
|
||||
}
|
||||
|
||||
|
||||
@@ -277,7 +288,7 @@ void FxMixerView::setCurrentFxLine( FxLine * _line )
|
||||
{
|
||||
// select
|
||||
m_currentFxLine = _line;
|
||||
m_rackView->setModel( &engine::fxMixer()->m_fxChannels[_line->channelIndex()]->m_fxChain );
|
||||
m_racksLayout->setCurrentWidget( m_fxChannelViews[ _line->channelIndex() ]->m_rackView );
|
||||
|
||||
// set up send knob
|
||||
for(int i = 0; i < m_fxChannelViews.size(); ++i)
|
||||
@@ -333,6 +344,9 @@ void FxMixerView::deleteChannel(int index)
|
||||
delete m_fxChannelViews[index];
|
||||
m_channelAreaWidget->adjustSize();
|
||||
|
||||
// delete the fx rack
|
||||
m_racksLayout->removeWidget( m_fxChannelViews[index]->m_rackView );
|
||||
|
||||
// make sure every channel knows what index it is
|
||||
for(int i=0; i<m_fxChannelViews.size(); ++i)
|
||||
{
|
||||
@@ -376,10 +390,12 @@ void FxMixerView::moveChannelLeft(int index)
|
||||
delete m_fxChannelViews[i]->m_muteBtn;
|
||||
delete m_fxChannelViews[i]->m_fxLine;
|
||||
delete m_fxChannelViews[i];
|
||||
m_racksLayout->removeWidget( m_fxChannelViews[i]->m_rackView );
|
||||
|
||||
// add it again
|
||||
m_fxChannelViews[i] = new FxChannelView(m_channelAreaWidget, this, i);
|
||||
chLayout->insertWidget(replaceIndex, m_fxChannelViews[i]->m_fxLine);
|
||||
m_fxChannelViews[i] = new FxChannelView( m_channelAreaWidget, this, i );
|
||||
chLayout->insertWidget( replaceIndex, m_fxChannelViews[i]->m_fxLine );
|
||||
m_racksLayout->insertWidget( replaceIndex, m_fxChannelViews[i]->m_rackView );
|
||||
}
|
||||
|
||||
// keep selected channel
|
||||
@@ -449,8 +465,6 @@ void FxMixerView::setCurrentFxLine( int _line )
|
||||
|
||||
void FxMixerView::clear()
|
||||
{
|
||||
m_rackView->clearViews();
|
||||
|
||||
engine::fxMixer()->clear();
|
||||
|
||||
refreshDisplay();
|
||||
|
||||
@@ -172,7 +172,11 @@ PianoRoll::PianoRoll() :
|
||||
m_editMode( ModeDraw ),
|
||||
m_mouseDownLeft( false ),
|
||||
m_mouseDownRight( false ),
|
||||
m_scrollBack( false )
|
||||
m_scrollBack( false ),
|
||||
m_gridColor( 0, 0, 0 ),
|
||||
m_noteModeColor( 0, 0, 0 ),
|
||||
m_noteColor( 0, 0, 0 ),
|
||||
m_barColor( 0, 0, 0 )
|
||||
{
|
||||
// gui names of edit modes
|
||||
m_nemStr.push_back( tr( "Note Volume" ) );
|
||||
@@ -832,10 +836,36 @@ void PianoRoll::setPauseIcon( bool pause )
|
||||
}
|
||||
|
||||
|
||||
/** \brief qproperty access implementation */
|
||||
|
||||
QColor PianoRoll::gridColor() const
|
||||
{ return m_gridColor; }
|
||||
|
||||
void PianoRoll::setGridColor( const QColor & c )
|
||||
{ m_gridColor = c; }
|
||||
|
||||
QColor PianoRoll::noteModeColor() const
|
||||
{ return m_noteModeColor; }
|
||||
|
||||
void PianoRoll::setNoteModeColor( const QColor & c )
|
||||
{ m_noteModeColor = c; }
|
||||
|
||||
QColor PianoRoll::noteColor() const
|
||||
{ return m_noteColor; }
|
||||
|
||||
void PianoRoll::setNoteColor( const QColor & c )
|
||||
{ m_noteColor = c; }
|
||||
|
||||
QColor PianoRoll::barColor() const
|
||||
{ return m_barColor; }
|
||||
|
||||
void PianoRoll::setBarColor( const QColor & c )
|
||||
{ m_barColor = c; }
|
||||
|
||||
|
||||
|
||||
inline void PianoRoll::drawNoteRect( QPainter & _p, int _x, int _y,
|
||||
int _width, note * _n )
|
||||
int _width, note * _n, const QColor & noteCol )
|
||||
{
|
||||
++_x;
|
||||
++_y;
|
||||
@@ -846,9 +876,8 @@ inline void PianoRoll::drawNoteRect( QPainter & _p, int _x, int _y,
|
||||
_width = 2;
|
||||
}
|
||||
|
||||
int volVal = qMin( 255, (int) (
|
||||
( (float)( _n->getVolume() - MinVolume ) ) /
|
||||
( (float)( MaxVolume - MinVolume ) ) * 255.0f) );
|
||||
int volVal = qMin( 255, 25 + (int) ( ( (float)( _n->getVolume() - MinVolume ) ) /
|
||||
( (float)( MaxVolume - MinVolume ) ) * 230.0f) );
|
||||
float rightPercent = qMin<float>( 1.0f,
|
||||
( (float)( _n->getPanning() - PanningLeft ) ) /
|
||||
( (float)( PanningRight - PanningLeft ) ) * 2.0f );
|
||||
@@ -857,8 +886,7 @@ inline void PianoRoll::drawNoteRect( QPainter & _p, int _x, int _y,
|
||||
( (float)( PanningRight - _n->getPanning() ) ) /
|
||||
( (float)( PanningRight - PanningLeft ) ) * 2.0f );
|
||||
|
||||
const QColor defaultNoteColor( 0x77, 0xC7, 0xD8 );
|
||||
QColor col = defaultNoteColor;
|
||||
QColor col = QColor( noteCol );
|
||||
|
||||
if( _n->length() < 0 )
|
||||
{
|
||||
@@ -894,13 +922,13 @@ inline void PianoRoll::drawNoteRect( QPainter & _p, int _x, int _y,
|
||||
_p.setPen( Qt::SolidLine );
|
||||
_p.setBrush( Qt::NoBrush );
|
||||
|
||||
col = defaultNoteColor;
|
||||
col = QColor( noteCol );
|
||||
_p.setPen( QColor::fromHsv( col.hue(), col.saturation(),
|
||||
qMin<float>( 255, volVal*1.7f ) ) );
|
||||
_p.drawLine( _x, _y, _x + _width, _y );
|
||||
_p.drawLine( _x, _y, _x, _y + KEY_LINE_HEIGHT - 2 );
|
||||
|
||||
col = defaultNoteColor;
|
||||
col = QColor( noteCol );
|
||||
_p.setPen( QColor::fromHsv( col.hue(), col.saturation(), volVal/1.7 ) );
|
||||
_p.drawLine( _x + _width, _y, _x + _width, _y + KEY_LINE_HEIGHT - 2 );
|
||||
_p.drawLine( _x, _y + KEY_LINE_HEIGHT - 2, _x + _width,
|
||||
@@ -908,7 +936,7 @@ inline void PianoRoll::drawNoteRect( QPainter & _p, int _x, int _y,
|
||||
|
||||
// that little tab thing on the end hinting at the user
|
||||
// to resize the note
|
||||
_p.setPen( defaultNoteColor.lighter( 200 ) );
|
||||
_p.setPen( noteCol.lighter( 200 ) );
|
||||
if( _width > 2 )
|
||||
{
|
||||
_p.drawLine( _x + _width - 3, _y + 2, _x + _width - 3,
|
||||
@@ -927,7 +955,7 @@ inline void PianoRoll::drawDetuningInfo( QPainter & _p, note * _n, int _x,
|
||||
int _y )
|
||||
{
|
||||
int middle_y = _y + KEY_LINE_HEIGHT / 2;
|
||||
_p.setPen( QColor( 0x99, 0xAF, 0xFF ) );
|
||||
_p.setPen( noteColor() );
|
||||
|
||||
int old_x = 0;
|
||||
int old_y = 0;
|
||||
@@ -2851,11 +2879,19 @@ static void printNoteHeights(QPainter& p, int bottom, int width, int startKey)
|
||||
|
||||
void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
{
|
||||
QColor horizCol = QColor( gridColor() );
|
||||
QColor vertCol = QColor( gridColor() );
|
||||
|
||||
QStyleOption opt;
|
||||
opt.initFrom( this );
|
||||
QPainter p( this );
|
||||
style()->drawPrimitive( QStyle::PE_Widget, &opt, &p, this );
|
||||
|
||||
QBrush bgColor = p.background();
|
||||
|
||||
// fill with bg color
|
||||
p.fillRect( 0,0, width(), height(), bgColor );
|
||||
|
||||
// set font-size to 8
|
||||
p.setFont( pointSize<8>( p.font() ) );
|
||||
|
||||
@@ -2965,21 +3001,19 @@ void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
// label C-keys...
|
||||
if( static_cast<Keys>( key % KeysPerOctave ) == Key_C )
|
||||
{
|
||||
const QString cLabel = "C" + QString::number( static_cast<int>( key / KeysPerOctave ) );
|
||||
p.setPen( QColor( 240, 240, 240 ) );
|
||||
p.drawText( C_KEY_LABEL_X + 1, y+14, "C" +
|
||||
QString::number( static_cast<int>( key /
|
||||
KeysPerOctave ) ) );
|
||||
p.drawText( C_KEY_LABEL_X + 1, y+14, cLabel );
|
||||
p.setPen( QColor( 0, 0, 0 ) );
|
||||
p.drawText( C_KEY_LABEL_X, y + 13, "C" +
|
||||
QString::number( static_cast<int>( key /
|
||||
KeysPerOctave ) ) );
|
||||
p.setPen( QColor( 0x4F, 0x4F, 0x4F ) );
|
||||
p.drawText( C_KEY_LABEL_X, y + 13, cLabel );
|
||||
horizCol.setAlpha( 192 );
|
||||
}
|
||||
else
|
||||
{
|
||||
p.setPen( QColor( 0x3F, 0x3F, 0x3F ) );
|
||||
horizCol.setAlpha( 128 );
|
||||
}
|
||||
// draw key-line
|
||||
p.setPen( horizCol );
|
||||
p.drawLine( WHITE_KEY_WIDTH, key_line_y, width(), key_line_y );
|
||||
++key;
|
||||
}
|
||||
@@ -3057,14 +3091,13 @@ void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
// erase the area below the piano, because there might be keys that
|
||||
// should be only half-visible
|
||||
p.fillRect( QRect( 0, keyAreaBottom(),
|
||||
WHITE_KEY_WIDTH, noteEditBottom()-keyAreaBottom() ),
|
||||
QColor( 0, 0, 0 ) );
|
||||
WHITE_KEY_WIDTH, noteEditBottom()-keyAreaBottom() ), bgColor );
|
||||
|
||||
// display note editing info
|
||||
QFont f = p.font();
|
||||
f.setBold( false );
|
||||
p.setFont( pointSize<10>( f ) );
|
||||
p.setPen( QColor( 255, 255, 255) );
|
||||
p.setPen( noteModeColor() );
|
||||
p.drawText( QRect( 0, keyAreaBottom(),
|
||||
WHITE_KEY_WIDTH, noteEditBottom() - keyAreaBottom() ),
|
||||
Qt::AlignCenter | Qt::TextWordWrap,
|
||||
@@ -3107,17 +3140,19 @@ void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
// every tact-start needs to be a bright line
|
||||
if( tact_16th % spt == 0 )
|
||||
{
|
||||
p.setPen( QColor( 0x7F, 0x7F, 0x7F ) );
|
||||
p.setPen( gridColor() );
|
||||
}
|
||||
// normal line
|
||||
else if( tact_16th % 4 == 0 )
|
||||
{
|
||||
p.setPen( QColor( 0x5F, 0x5F, 0x5F ) );
|
||||
vertCol.setAlpha( 160 );
|
||||
p.setPen( vertCol );
|
||||
}
|
||||
// weak line
|
||||
else
|
||||
{
|
||||
p.setPen( QColor( 0x3F, 0x3F, 0x3F ) );
|
||||
vertCol.setAlpha( 128 );
|
||||
p.setPen( vertCol );
|
||||
}
|
||||
|
||||
p.drawLine( (int)x, PR_TOP_MARGIN, (int)x, height() -
|
||||
@@ -3126,7 +3161,8 @@ void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
// extra 32nd's line
|
||||
if( show32nds )
|
||||
{
|
||||
p.setPen( QColor( 0x22, 0x22, 0x22 ) );
|
||||
vertCol.setAlpha( 80 );
|
||||
p.setPen( vertCol );
|
||||
p.drawLine( (int)(x + pp16th/2) , PR_TOP_MARGIN,
|
||||
(int)(x + pp16th/2), height() -
|
||||
PR_BOTTOM_MARGIN );
|
||||
@@ -3205,15 +3241,14 @@ void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
// note
|
||||
drawNoteRect( p, x + WHITE_KEY_WIDTH,
|
||||
y_base - key * KEY_LINE_HEIGHT,
|
||||
note_width, *it );
|
||||
note_width, *it, noteColor() );
|
||||
}
|
||||
|
||||
// draw note editing stuff
|
||||
int editHandleTop = 0;
|
||||
if( m_noteEditMode == NoteEditVolume )
|
||||
{
|
||||
QColor color = QColor::fromHsv( 140, 221,
|
||||
qMin(255, 60 + ( *it )->getVolume() ) );
|
||||
QColor color = barColor().lighter( 30 + ( ( *it )->getVolume() * 90 / MaxVolume ) );
|
||||
if( ( *it )->selected() )
|
||||
{
|
||||
color.setRgb( 0x00, 0x40, 0xC0 );
|
||||
@@ -3231,7 +3266,7 @@ void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
}
|
||||
else if( m_noteEditMode == NoteEditPanning )
|
||||
{
|
||||
QColor color( 0x99, 0xAF, 0xFF );
|
||||
QColor color( noteColor() );
|
||||
if( ( *it )->selected() )
|
||||
{
|
||||
color.setRgb( 0x00, 0x40, 0xC0 );
|
||||
@@ -3259,8 +3294,7 @@ void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
}
|
||||
}
|
||||
|
||||
p.setPen( QPen( QColor( 0x99, 0xAF, 0xFF ),
|
||||
NE_LINE_WIDTH+2 ) );
|
||||
p.setPen( QPen( noteColor(), NE_LINE_WIDTH+2 ) );
|
||||
p.drawPoints( editHandles );
|
||||
|
||||
}
|
||||
@@ -3269,7 +3303,8 @@ void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
QFont f = p.font();
|
||||
f.setBold( true );
|
||||
p.setFont( pointSize<14>( f ) );
|
||||
p.setPen( QColor( 0x4A, 0xFD, 0x85 ) );
|
||||
p.setPen( QApplication::palette().color( QPalette::Active,
|
||||
QPalette::BrightText ) );
|
||||
p.drawText( WHITE_KEY_WIDTH + 20, PR_TOP_MARGIN + 40,
|
||||
tr( "Please open a pattern by double-clicking "
|
||||
"on it!" ) );
|
||||
@@ -3299,21 +3334,21 @@ void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
m_leftRightScroll->setPageStep( l );
|
||||
}
|
||||
|
||||
// set alpha for horizontal lines
|
||||
horizCol.setAlpha( 64 );
|
||||
|
||||
// horizontal line for the key under the cursor
|
||||
if( validPattern() == true )
|
||||
{
|
||||
int key_num = getKey( mapFromGlobal( QCursor::pos() ).y() );
|
||||
p.fillRect( 10, keyAreaBottom() + 3 - KEY_LINE_HEIGHT *
|
||||
( key_num - m_startKey + 1 ),
|
||||
width() - 10, KEY_LINE_HEIGHT - 7,
|
||||
QColor( 64, 64, 64 ) );
|
||||
( key_num - m_startKey + 1 ), width() - 10, KEY_LINE_HEIGHT - 7, horizCol );
|
||||
}
|
||||
|
||||
// bar to resize note edit area
|
||||
p.setClipRect( 0, 0, width(), height() );
|
||||
p.fillRect( QRect( 0, keyAreaBottom(),
|
||||
width()-PR_RIGHT_MARGIN, NOTE_EDIT_RESIZE_BAR ),
|
||||
QColor( 64, 64, 64 ) );
|
||||
width()-PR_RIGHT_MARGIN, NOTE_EDIT_RESIZE_BAR ), horizCol );
|
||||
|
||||
const QPixmap * cursor = NULL;
|
||||
// draw current edit-mode-icon below the cursor
|
||||
@@ -3459,27 +3494,50 @@ void PianoRoll::wheelEvent( QWheelEvent * _we )
|
||||
}
|
||||
}
|
||||
|
||||
// not in note edit area, so handle scrolling/zooming
|
||||
// not in note edit area, so handle scrolling/zooming and quantization change
|
||||
else
|
||||
if( _we->modifiers() & Qt::ControlModifier )
|
||||
if( _we->modifiers() & Qt::ControlModifier && _we->modifiers() & Qt::AltModifier )
|
||||
{
|
||||
int q = m_quantizeModel.value();
|
||||
if( _we->delta() > 0 )
|
||||
{
|
||||
m_ppt = qMin( m_ppt * 2, KEY_LINE_HEIGHT *
|
||||
DefaultStepsPerTact * 8 );
|
||||
q--;
|
||||
}
|
||||
else if( m_ppt >= 72 )
|
||||
if( _we->delta() < 0 )
|
||||
{
|
||||
m_ppt /= 2;
|
||||
q++;
|
||||
}
|
||||
q = qBound( 0, q, m_quantizeModel.size() - 1 );
|
||||
m_quantizeModel.setValue( q );
|
||||
}
|
||||
else if( _we->modifiers() & Qt::ControlModifier && _we->modifiers() & Qt::ShiftModifier )
|
||||
{
|
||||
int l = m_noteLenModel.value();
|
||||
if( _we->delta() > 0 )
|
||||
{
|
||||
l--;
|
||||
}
|
||||
if( _we->delta() < 0 )
|
||||
{
|
||||
l++;
|
||||
}
|
||||
l = qBound( 0, l, m_noteLenModel.size() - 1 );
|
||||
m_noteLenModel.setValue( l );
|
||||
}
|
||||
else if( _we->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
int z = m_zoomingModel.value();
|
||||
if( _we->delta() > 0 )
|
||||
{
|
||||
z++;
|
||||
}
|
||||
if( _we->delta() < 0 )
|
||||
{
|
||||
z--;
|
||||
}
|
||||
z = qBound( 0, z, m_zoomingModel.size() - 1 );
|
||||
// update combobox with zooming-factor
|
||||
m_zoomingModel.setValue(
|
||||
m_zoomingModel.findText( QString::number(
|
||||
static_cast<int>( m_ppt * 100 /
|
||||
DEFAULT_PR_PPT ) ) +"%" ) );
|
||||
// update timeline
|
||||
m_timeLine->setPixelsPerTact( m_ppt );
|
||||
update();
|
||||
m_zoomingModel.setValue( z );
|
||||
}
|
||||
else if( _we->modifiers() & Qt::ShiftModifier
|
||||
|| _we->orientation() == Qt::Horizontal )
|
||||
@@ -4088,13 +4146,6 @@ void PianoRoll::zoomingChanged()
|
||||
|
||||
void PianoRoll::quantizeChanged()
|
||||
{
|
||||
if( m_quantizeModel.value() == 0 &&
|
||||
m_noteLenModel.value() == 0 )
|
||||
{
|
||||
m_quantizeModel.setValue( m_quantizeModel.findText( "1/16" ) );
|
||||
return;
|
||||
}
|
||||
// Could be smarter
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -4103,7 +4154,14 @@ int PianoRoll::quantization() const
|
||||
{
|
||||
if( m_quantizeModel.value() == 0 )
|
||||
{
|
||||
return newNoteLen();
|
||||
if( m_noteLenModel.value() > 0 )
|
||||
{
|
||||
return newNoteLen();
|
||||
}
|
||||
else
|
||||
{
|
||||
return DefaultTicksPerTact / 16;
|
||||
}
|
||||
}
|
||||
return DefaultTicksPerTact / m_quantizeModel.currentText().right(
|
||||
m_quantizeModel.currentText().length() -
|
||||
|
||||
@@ -39,25 +39,25 @@
|
||||
#include "gui_templates.h"
|
||||
#include "caption_menu.h"
|
||||
|
||||
const int FxLine::FxLineHeight = 287;
|
||||
|
||||
FxLine::FxLine( QWidget * _parent, FxMixerView * _mv, int _channelIndex) :
|
||||
QWidget( _parent ),
|
||||
m_mv( _mv ),
|
||||
m_channelIndex( _channelIndex )
|
||||
{
|
||||
setFixedSize( 32, 287 );
|
||||
setFixedSize( 33, FxLineHeight );
|
||||
setAttribute( Qt::WA_OpaquePaintEvent, true );
|
||||
setCursor( QCursor( embed::getIconPixmap( "hand" ), 0, 0 ) );
|
||||
|
||||
// mixer sends knob
|
||||
m_sendKnob = new knob( knobBright_26, this, tr("Channel send amount") );
|
||||
m_sendKnob->move(3, 22);
|
||||
m_sendKnob->move( 3, 22 );
|
||||
m_sendKnob->setVisible(false);
|
||||
|
||||
// send button indicator
|
||||
m_sendBtn = new SendButtonIndicator(this, this, m_mv);
|
||||
m_sendBtn->setPixmap(embed::getIconPixmap("mixer_send_off", 23, 16));
|
||||
m_sendBtn->move(4,4);
|
||||
m_sendBtn = new SendButtonIndicator( this, this, m_mv );
|
||||
m_sendBtn->move( 2, 2 );
|
||||
|
||||
// channel number
|
||||
m_lcd = new LcdWidget( 2, this );
|
||||
@@ -97,37 +97,34 @@ void FxLine::setChannelIndex(int index) {
|
||||
}
|
||||
|
||||
|
||||
static void drawFxLine( QPainter* p, const QWidget *fxLine, const QString& name, bool isActive, bool sendToThis )
|
||||
static void drawFxLine( QPainter* p, const FxLine *fxLine, const QString& name, bool isActive, bool sendToThis )
|
||||
{
|
||||
int width = fxLine->rect().width();
|
||||
int height = fxLine->rect().height();
|
||||
|
||||
QColor bg_color = QApplication::palette().color( QPalette::Active,
|
||||
QPalette::Background );
|
||||
QColor sh_color = QApplication::palette().color( QPalette::Active,
|
||||
QPalette::Shadow );
|
||||
QColor te_color = QApplication::palette().color( QPalette::Active,
|
||||
QPalette::Text );
|
||||
QColor te_color = p->pen().brush().color();
|
||||
QColor bt_color = QApplication::palette().color( QPalette::Active,
|
||||
QPalette::BrightText );
|
||||
|
||||
|
||||
p->fillRect( fxLine->rect(), isActive ? bg_color.lighter(130) : bg_color );
|
||||
p->fillRect( fxLine->rect(), isActive ? fxLine->backgroundActive() : p->background() );
|
||||
|
||||
p->setPen( bg_color.darker(130) );
|
||||
p->setPen( QColor( 0, 0, 0, 75 ) );
|
||||
p->drawRect( 0, 0, width-2, height-2 );
|
||||
|
||||
p->setPen( bg_color.lighter(150) );
|
||||
p->drawRect( 1, 1, width-2, height-2 );
|
||||
p->setPen( QColor( 255, 255, 255, 75 ) );
|
||||
p->drawRect( 1, 1, width-3, height-3 );
|
||||
|
||||
p->setPen( isActive ? sh_color : bg_color.darker(130) );
|
||||
p->setPen( isActive ? sh_color : QColor( 0, 0, 0, 50 ) );
|
||||
p->drawRect( 0, 0, width-1, height-1 );
|
||||
|
||||
// draw the mixer send background
|
||||
if( sendToThis )
|
||||
{
|
||||
p->drawPixmap(2, 0, 28, 56,
|
||||
embed::getIconPixmap("send_bg_arrow", 28, 56));
|
||||
p->drawPixmap( 3, 0, 28, 56,
|
||||
embed::getIconPixmap("send_bg_arrow", 28, 56 ) );
|
||||
}
|
||||
|
||||
// draw the channel name
|
||||
@@ -241,5 +238,15 @@ void FxLine::displayHelp()
|
||||
whatsThis() );
|
||||
}
|
||||
|
||||
QBrush FxLine::backgroundActive() const
|
||||
{
|
||||
return m_backgroundActive;
|
||||
}
|
||||
|
||||
void FxLine::setBackgroundActive( const QBrush & c )
|
||||
{
|
||||
m_backgroundActive = c;
|
||||
}
|
||||
|
||||
#include "moc_FxLine.cxx"
|
||||
|
||||
|
||||
@@ -4,19 +4,29 @@
|
||||
#include "FxMixer.h"
|
||||
#include "Model.h"
|
||||
|
||||
QPixmap * SendButtonIndicator::s_qpmOff = NULL;
|
||||
QPixmap * SendButtonIndicator::s_qpmOn = NULL;
|
||||
|
||||
SendButtonIndicator:: SendButtonIndicator( QWidget * _parent, FxLine * _owner,
|
||||
FxMixerView * _mv) :
|
||||
QLabel( _parent ),
|
||||
m_parent( _owner ),
|
||||
m_mv( _mv )
|
||||
{
|
||||
qpmOff = embed::getIconPixmap("mixer_send_off", 23, 16);
|
||||
qpmOn = embed::getIconPixmap("mixer_send_on", 23, 16);
|
||||
|
||||
if( ! s_qpmOff )
|
||||
{
|
||||
s_qpmOff = new QPixmap( embed::getIconPixmap( "mixer_send_off", 29, 20 ) );
|
||||
}
|
||||
|
||||
if( ! s_qpmOn )
|
||||
{
|
||||
s_qpmOn = new QPixmap( embed::getIconPixmap( "mixer_send_on", 29, 20 ) );
|
||||
}
|
||||
|
||||
// don't do any initializing yet, because the FxMixerView and FxLine
|
||||
// that were passed to this constructor are not done with their constructors
|
||||
// yet.
|
||||
|
||||
setPixmap( *s_qpmOff );
|
||||
}
|
||||
|
||||
void SendButtonIndicator::mousePressEvent( QMouseEvent * e )
|
||||
@@ -49,5 +59,5 @@ FloatModel * SendButtonIndicator::getSendModel()
|
||||
|
||||
void SendButtonIndicator::updateLightStatus()
|
||||
{
|
||||
setPixmap( getSendModel() == NULL ? qpmOff : qpmOn );
|
||||
setPixmap( getSendModel() == NULL ? *s_qpmOff : *s_qpmOn );
|
||||
}
|
||||
|
||||
@@ -60,7 +60,9 @@
|
||||
|
||||
|
||||
textFloat * fader::s_textFloat = NULL;
|
||||
|
||||
QPixmap * fader::s_back = NULL;
|
||||
QPixmap * fader::s_leds = NULL;
|
||||
QPixmap * fader::s_knob = NULL;
|
||||
|
||||
fader::fader( FloatModel * _model, const QString & _name, QWidget * _parent ) :
|
||||
QWidget( _parent ),
|
||||
@@ -72,18 +74,30 @@ fader::fader( FloatModel * _model, const QString & _name, QWidget * _parent ) :
|
||||
m_persistentPeak_R( 0.0 ),
|
||||
m_fMinPeak( 0.01f ),
|
||||
m_fMaxPeak( 1.1 ),
|
||||
m_back( embed::getIconPixmap( "fader_background" ) ),
|
||||
m_leds( embed::getIconPixmap( "fader_leds" ) ),
|
||||
m_knob( embed::getIconPixmap( "fader_knob" ) ),
|
||||
m_moveStartPoint( -1 ),
|
||||
m_startValue( 0 )
|
||||
m_startValue( 0 ),
|
||||
m_peakGreen( 0, 0, 0 ),
|
||||
m_peakRed( 0, 0, 0 )
|
||||
{
|
||||
if( s_textFloat == NULL )
|
||||
{
|
||||
s_textFloat = new textFloat;
|
||||
}
|
||||
if( ! s_back )
|
||||
{
|
||||
s_back = new QPixmap( embed::getIconPixmap( "fader_background" ) );
|
||||
}
|
||||
if( ! s_leds )
|
||||
{
|
||||
s_leds = new QPixmap( embed::getIconPixmap( "fader_leds" ) );
|
||||
}
|
||||
if( ! s_knob )
|
||||
{
|
||||
s_knob = new QPixmap( embed::getIconPixmap( "fader_knob" ) );
|
||||
}
|
||||
|
||||
setWindowTitle( _name );
|
||||
setAttribute( Qt::WA_OpaquePaintEvent, true );
|
||||
setAttribute( Qt::WA_OpaquePaintEvent, false );
|
||||
setMinimumSize( 23, 116 );
|
||||
setMaximumSize( 23, 116);
|
||||
resize( 23, 116 );
|
||||
@@ -116,7 +130,7 @@ void fader::mouseMoveEvent( QMouseEvent *mouseEvent )
|
||||
{
|
||||
int dy = m_moveStartPoint - mouseEvent->globalY();
|
||||
|
||||
float delta = dy * ( m_model->maxValue() - m_model->minValue() ) / (float) ( height() - m_knob.height() );
|
||||
float delta = dy * ( m_model->maxValue() - m_model->minValue() ) / (float) ( height() - ( *s_knob ).height() );
|
||||
|
||||
model()->setValue( m_startValue + delta );
|
||||
|
||||
@@ -132,7 +146,7 @@ void fader::mousePressEvent( QMouseEvent* mouseEvent )
|
||||
if( mouseEvent->button() == Qt::LeftButton &&
|
||||
! ( mouseEvent->modifiers() & Qt::ControlModifier ) )
|
||||
{
|
||||
if( mouseEvent->y() >= knobPosY() - m_knob.height() && mouseEvent->y() < knobPosY() )
|
||||
if( mouseEvent->y() >= knobPosY() - ( *s_knob ).height() && mouseEvent->y() < knobPosY() )
|
||||
{
|
||||
updateTextFloat();
|
||||
s_textFloat->show();
|
||||
@@ -260,7 +274,7 @@ void fader::updateTextFloat()
|
||||
{
|
||||
s_textFloat->setText( QString("Volume: %1 %").arg( m_model->value() * 100 ) );
|
||||
}
|
||||
s_textFloat->moveGlobal( this, QPoint( width() - m_knob.width() - 5, knobPosY() - 46 ) );
|
||||
s_textFloat->moveGlobal( this, QPoint( width() - ( *s_knob ).width() - 5, knobPosY() - 46 ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -277,8 +291,7 @@ void fader::paintEvent( QPaintEvent * ev)
|
||||
QPainter painter(this);
|
||||
|
||||
// background
|
||||
// painter.drawPixmap( rect(), m_back, QRect( 0, 0, 23, 116 ) );
|
||||
painter.drawPixmap( ev->rect(), m_back, ev->rect() );
|
||||
painter.drawPixmap( ev->rect(), *s_back, ev->rect() );
|
||||
|
||||
|
||||
// peak leds
|
||||
@@ -286,28 +299,50 @@ void fader::paintEvent( QPaintEvent * ev)
|
||||
|
||||
int peak_L = calculateDisplayPeak( m_fPeakValue_L - m_fMinPeak );
|
||||
int persistentPeak_L = qMax<int>( 3, calculateDisplayPeak( m_persistentPeak_L - m_fMinPeak ) );
|
||||
painter.drawPixmap( QRect( 0, peak_L, 11, 116 - peak_L ), m_leds, QRect( 0, peak_L, 11, 116 - peak_L ) );
|
||||
painter.drawPixmap( QRect( 0, peak_L, 11, 116 - peak_L ), *s_leds, QRect( 0, peak_L, 11, 116 - peak_L ) );
|
||||
|
||||
if( m_persistentPeak_L > 0.05 )
|
||||
{
|
||||
painter.fillRect( QRect( 2, persistentPeak_L, 7, 1 ), (m_persistentPeak_L < 1.0 )? QColor( 74, 253, 133) : QColor( 255, 100, 100));
|
||||
painter.fillRect( QRect( 2, persistentPeak_L, 7, 1 ), ( m_persistentPeak_L < 1.0 )
|
||||
? peakGreen()
|
||||
: peakRed() );
|
||||
}
|
||||
|
||||
int peak_R = calculateDisplayPeak( m_fPeakValue_R - m_fMinPeak );
|
||||
int persistentPeak_R = qMax<int>( 3, calculateDisplayPeak( m_persistentPeak_R - m_fMinPeak ) );
|
||||
painter.drawPixmap( QRect( 11, peak_R, 11, 116 - peak_R ), m_leds, QRect( 11, peak_R, 11, 116 - peak_R ) );
|
||||
painter.drawPixmap( QRect( 11, peak_R, 11, 116 - peak_R ), *s_leds, QRect( 11, peak_R, 11, 116 - peak_R ) );
|
||||
|
||||
if( m_persistentPeak_R > 0.05 )
|
||||
{
|
||||
painter.fillRect( QRect( 14, persistentPeak_R, 7, 1 ), (m_persistentPeak_R < 1.0 )? QColor( 74, 253, 133) : QColor( 255, 100, 100));
|
||||
painter.fillRect( QRect( 14, persistentPeak_R, 7, 1 ), ( m_persistentPeak_R < 1.0 )
|
||||
? peakGreen()
|
||||
: peakRed() );
|
||||
}
|
||||
|
||||
// knob
|
||||
painter.drawPixmap( 0, knobPosY() - m_knob.height(), m_knob );
|
||||
painter.drawPixmap( 0, knobPosY() - ( *s_knob ).height(), *s_knob );
|
||||
}
|
||||
|
||||
|
||||
QColor fader::peakGreen() const
|
||||
{
|
||||
return m_peakGreen;
|
||||
}
|
||||
|
||||
QColor fader::peakRed() const
|
||||
{
|
||||
return m_peakRed;
|
||||
}
|
||||
|
||||
void fader::setPeakGreen( const QColor & c )
|
||||
{
|
||||
m_peakGreen = c;
|
||||
}
|
||||
|
||||
void fader::setPeakRed( const QColor & c )
|
||||
{
|
||||
m_peakRed = c;
|
||||
}
|
||||
|
||||
#include "moc_fader.cxx"
|
||||
|
||||
|
||||
@@ -135,12 +135,17 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) :
|
||||
}
|
||||
|
||||
|
||||
int InstrumentTrack::baseNote() const
|
||||
{
|
||||
return m_baseNoteModel.value() - engine::getSong()->masterPitch();
|
||||
}
|
||||
|
||||
|
||||
|
||||
InstrumentTrack::~InstrumentTrack()
|
||||
{
|
||||
// kill all running notes
|
||||
silenceAllNotes();
|
||||
// kill all running notes and the iph
|
||||
silenceAllNotes( true );
|
||||
|
||||
// now we're save deleting the instrument
|
||||
delete m_instrument;
|
||||
@@ -232,10 +237,9 @@ MidiEvent InstrumentTrack::applyMasterKey( const MidiEvent& event )
|
||||
|
||||
|
||||
|
||||
void InstrumentTrack::processInEvent( const MidiEvent& event, const MidiTime& time )
|
||||
void InstrumentTrack::processInEvent( const MidiEvent& event, const MidiTime& time, f_cnt_t offset )
|
||||
{
|
||||
engine::mixer()->lock();
|
||||
|
||||
bool eventHandled = false;
|
||||
|
||||
switch( event.type() )
|
||||
@@ -335,7 +339,7 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const MidiTime& ti
|
||||
break;
|
||||
}
|
||||
|
||||
if( eventHandled == false && instrument()->handleMidiEvent( event, time ) == false )
|
||||
if( eventHandled == false && instrument()->handleMidiEvent( event, time, offset ) == false )
|
||||
{
|
||||
qWarning( "InstrumentTrack: unhandled MIDI event %d", event.type() );
|
||||
}
|
||||
@@ -346,7 +350,7 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const MidiTime& ti
|
||||
|
||||
|
||||
|
||||
void InstrumentTrack::processOutEvent( const MidiEvent& event, const MidiTime& time )
|
||||
void InstrumentTrack::processOutEvent( const MidiEvent& event, const MidiTime& time, f_cnt_t offset )
|
||||
{
|
||||
// do nothing if we do not have an instrument instance (e.g. when loading settings)
|
||||
if( m_instrument == NULL )
|
||||
@@ -366,10 +370,10 @@ void InstrumentTrack::processOutEvent( const MidiEvent& event, const MidiTime& t
|
||||
{
|
||||
if( m_runningMidiNotes[key] > 0 )
|
||||
{
|
||||
m_instrument->handleMidiEvent( MidiEvent( MidiNoteOff, midiPort()->realOutputChannel(), key, 0 ), time );
|
||||
m_instrument->handleMidiEvent( MidiEvent( MidiNoteOff, midiPort()->realOutputChannel(), key, 0 ), time, offset );
|
||||
}
|
||||
++m_runningMidiNotes[key];
|
||||
m_instrument->handleMidiEvent( MidiEvent( MidiNoteOn, midiPort()->realOutputChannel(), key, event.velocity() ), time );
|
||||
m_instrument->handleMidiEvent( MidiEvent( MidiNoteOn, midiPort()->realOutputChannel(), key, event.velocity() ), time, offset );
|
||||
|
||||
emit newNote();
|
||||
}
|
||||
@@ -381,12 +385,12 @@ void InstrumentTrack::processOutEvent( const MidiEvent& event, const MidiTime& t
|
||||
if( key >= 0 && key < NumKeys && --m_runningMidiNotes[key] <= 0 )
|
||||
{
|
||||
m_runningMidiNotes[key] = qMax( 0, m_runningMidiNotes[key] );
|
||||
m_instrument->handleMidiEvent( MidiEvent( MidiNoteOff, midiPort()->realOutputChannel(), key, 0 ), time );
|
||||
m_instrument->handleMidiEvent( MidiEvent( MidiNoteOff, midiPort()->realOutputChannel(), key, 0 ), time, offset );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
m_instrument->handleMidiEvent( transposedEvent, time );
|
||||
m_instrument->handleMidiEvent( transposedEvent, time, offset );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -397,7 +401,7 @@ void InstrumentTrack::processOutEvent( const MidiEvent& event, const MidiTime& t
|
||||
|
||||
|
||||
|
||||
void InstrumentTrack::silenceAllNotes()
|
||||
void InstrumentTrack::silenceAllNotes( bool removeIPH )
|
||||
{
|
||||
engine::mixer()->lock();
|
||||
for( int i = 0; i < NumKeys; ++i )
|
||||
@@ -408,7 +412,7 @@ void InstrumentTrack::silenceAllNotes()
|
||||
|
||||
// invalidate all NotePlayHandles linked to this track
|
||||
m_processHandles.clear();
|
||||
engine::mixer()->removePlayHandles( this );
|
||||
engine::mixer()->removePlayHandles( this, removeIPH );
|
||||
engine::mixer()->unlock();
|
||||
}
|
||||
|
||||
@@ -537,7 +541,7 @@ void InstrumentTrack::updatePitchRange()
|
||||
|
||||
int InstrumentTrack::masterKey( int _midi_key ) const
|
||||
{
|
||||
int key = m_baseNoteModel.value() - engine::getSong()->masterPitch();
|
||||
int key = baseNote();
|
||||
return tLimit<int>( _midi_key - ( key - DefaultKey ), 0, NumKeys );
|
||||
}
|
||||
|
||||
@@ -695,7 +699,7 @@ void InstrumentTrack::saveTrackSpecificSettings( QDomDocument& doc, QDomElement
|
||||
|
||||
void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & thisElement )
|
||||
{
|
||||
silenceAllNotes();
|
||||
silenceAllNotes( true );
|
||||
|
||||
engine::mixer()->lock();
|
||||
|
||||
@@ -771,7 +775,7 @@ void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & thisElement
|
||||
|
||||
Instrument * InstrumentTrack::loadInstrument( const QString & _plugin_name )
|
||||
{
|
||||
silenceAllNotes();
|
||||
silenceAllNotes( true );
|
||||
|
||||
engine::mixer()->lock();
|
||||
delete m_instrument;
|
||||
@@ -1323,6 +1327,7 @@ void InstrumentTrackWindow::modelChanged()
|
||||
m_pitchKnob->setModel( &m_track->m_pitchModel );
|
||||
m_pitchRangeSpinBox->setModel( &m_track->m_pitchRangeModel );
|
||||
m_pitchKnob->show();
|
||||
m_pitchRangeSpinBox->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -46,9 +46,10 @@
|
||||
bbTrack::infoMap bbTrack::s_infoMap;
|
||||
|
||||
|
||||
bbTCO::bbTCO( track * _track, unsigned int _color ) :
|
||||
bbTCO::bbTCO( track * _track ) :
|
||||
trackContentObject( _track ),
|
||||
m_color( _color > 0 ? _color : defaultColor() )
|
||||
m_color( 128, 128, 128 ),
|
||||
m_useStyleColor( true )
|
||||
{
|
||||
tact_t t = engine::getBBTrackContainer()->lengthOfBB( bbTrackIndex() );
|
||||
if( t > 0 )
|
||||
@@ -69,41 +70,73 @@ bbTCO::~bbTCO()
|
||||
|
||||
|
||||
|
||||
void bbTCO::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
void bbTCO::saveSettings( QDomDocument & doc, QDomElement & element )
|
||||
{
|
||||
_this.setAttribute( "name", name() );
|
||||
if( _this.parentNode().nodeName() == "clipboard" )
|
||||
element.setAttribute( "name", name() );
|
||||
if( element.parentNode().nodeName() == "clipboard" )
|
||||
{
|
||||
_this.setAttribute( "pos", -1 );
|
||||
element.setAttribute( "pos", -1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
_this.setAttribute( "pos", startPosition() );
|
||||
element.setAttribute( "pos", startPosition() );
|
||||
}
|
||||
element.setAttribute( "len", length() );
|
||||
element.setAttribute( "muted", isMuted() );
|
||||
element.setAttribute( "color", color() );
|
||||
|
||||
if( m_useStyleColor )
|
||||
{
|
||||
element.setAttribute( "usestyle", 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
element.setAttribute( "usestyle", 0 );
|
||||
}
|
||||
_this.setAttribute( "len", length() );
|
||||
_this.setAttribute( "muted", isMuted() );
|
||||
_this.setAttribute( "color", m_color );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bbTCO::loadSettings( const QDomElement & _this )
|
||||
void bbTCO::loadSettings( const QDomElement & element )
|
||||
{
|
||||
setName( _this.attribute( "name" ) );
|
||||
if( _this.attribute( "pos" ).toInt() >= 0 )
|
||||
setName( element.attribute( "name" ) );
|
||||
if( element.attribute( "pos" ).toInt() >= 0 )
|
||||
{
|
||||
movePosition( _this.attribute( "pos" ).toInt() );
|
||||
movePosition( element.attribute( "pos" ).toInt() );
|
||||
}
|
||||
changeLength( _this.attribute( "len" ).toInt() );
|
||||
if( _this.attribute( "muted" ).toInt() != isMuted() )
|
||||
changeLength( element.attribute( "len" ).toInt() );
|
||||
if( element.attribute( "muted" ).toInt() != isMuted() )
|
||||
{
|
||||
toggleMute();
|
||||
}
|
||||
|
||||
if( _this.attribute( "color" ).toUInt() != 0 )
|
||||
if( element.hasAttribute( "color" ) )
|
||||
{
|
||||
m_color = _this.attribute( "color" ).toUInt();
|
||||
setColor( QColor( element.attribute( "color" ).toUInt() ) );
|
||||
}
|
||||
|
||||
if( element.hasAttribute( "usestyle" ) )
|
||||
{
|
||||
if( element.attribute( "usestyle" ).toUInt() == 1 )
|
||||
{
|
||||
m_useStyleColor = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_useStyleColor = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_color.rgb() == qRgb( 128, 182, 175 ) || m_color.rgb() == qRgb( 64, 128, 255 ) ) // old or older default color
|
||||
{
|
||||
m_useStyleColor = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_useStyleColor = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +196,8 @@ void bbTCOView::constructContextMenu( QMenu * _cm )
|
||||
this, SLOT( changeName() ) );
|
||||
_cm->addAction( embed::getIconPixmap( "colorize" ),
|
||||
tr( "Change color" ), this, SLOT( changeColor() ) );
|
||||
_cm->addAction( embed::getIconPixmap( "colorize" ),
|
||||
tr( "Reset color to default" ), this, SLOT( resetColor() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +213,12 @@ void bbTCOView::mouseDoubleClickEvent( QMouseEvent * )
|
||||
|
||||
void bbTCOView::paintEvent( QPaintEvent * )
|
||||
{
|
||||
QColor col( m_bbTCO->m_color );
|
||||
QPainter p( this );
|
||||
|
||||
QColor col = m_bbTCO->m_useStyleColor
|
||||
? p.pen().brush().color()
|
||||
: m_bbTCO->colorObj();
|
||||
|
||||
if( m_bbTCO->getTrack()->isMuted() || m_bbTCO->isMuted() )
|
||||
{
|
||||
col = QColor( 160, 160, 160 );
|
||||
@@ -188,7 +228,6 @@ void bbTCOView::paintEvent( QPaintEvent * )
|
||||
col = QColor( qMax( col.red() - 128, 0 ),
|
||||
qMax( col.green() - 128, 0 ), 255 );
|
||||
}
|
||||
QPainter p( this );
|
||||
|
||||
QLinearGradient lingrad( 0, 0, 0, height() );
|
||||
lingrad.setColorAt( 0, col.light( 130 ) );
|
||||
@@ -263,8 +302,8 @@ void bbTCOView::changeName()
|
||||
|
||||
void bbTCOView::changeColor()
|
||||
{
|
||||
QColor _new_color = QColorDialog::getColor( m_bbTCO->m_color );
|
||||
if( !_new_color.isValid() )
|
||||
QColor new_color = QColorDialog::getColor( m_bbTCO->m_color );
|
||||
if( ! new_color.isValid() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -279,34 +318,48 @@ void bbTCOView::changeColor()
|
||||
bbTCOView * bb_tcov = dynamic_cast<bbTCOView *>( *it );
|
||||
if( bb_tcov )
|
||||
{
|
||||
bb_tcov->setColor( _new_color );
|
||||
bb_tcov->setColor( new_color );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setColor( _new_color );
|
||||
setColor( new_color );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bbTCOView::setColor( QColor _new_color )
|
||||
/** \brief Makes the BB pattern use the colour defined in the stylesheet */
|
||||
void bbTCOView::resetColor()
|
||||
{
|
||||
if( _new_color.rgb() != m_bbTCO->m_color )
|
||||
if( ! m_bbTCO->m_useStyleColor )
|
||||
{
|
||||
m_bbTCO->m_color = _new_color.rgb();
|
||||
m_bbTCO->m_useStyleColor = true;
|
||||
engine::getSong()->setModified();
|
||||
update();
|
||||
}
|
||||
bbTrack::clearLastTCOColor();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void bbTCOView::setColor( QColor new_color )
|
||||
{
|
||||
if( new_color.rgb() != m_bbTCO->color() )
|
||||
{
|
||||
m_bbTCO->setColor( new_color );
|
||||
m_bbTCO->m_useStyleColor = false;
|
||||
engine::getSong()->setModified();
|
||||
update();
|
||||
}
|
||||
bbTrack::setLastTCOColor( new_color );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QColor * bbTrack::s_lastTCOColor = NULL;
|
||||
|
||||
bbTrack::bbTrack( TrackContainer* tc ) :
|
||||
track( BBTrack, tc )
|
||||
@@ -404,24 +457,18 @@ trackView * bbTrack::createView( TrackContainerView* tcv )
|
||||
|
||||
trackContentObject * bbTrack::createTCO( const MidiTime & _pos )
|
||||
{
|
||||
// if we're creating a new bbTCO, we colorize it according to the
|
||||
// previous bbTCO, so we have to get all TCOs from 0 to _pos and
|
||||
// pickup the last and take the color if it
|
||||
tcoVector tcos;
|
||||
getTCOsInRange( tcos, 0, _pos );
|
||||
if( tcos.size() > 0 && dynamic_cast<bbTCO *>( tcos.back() ) != NULL )
|
||||
bbTCO * bbtco = new bbTCO( this );
|
||||
if( s_lastTCOColor )
|
||||
{
|
||||
return new bbTCO( this, dynamic_cast<bbTCO *>( tcos.back() )->color() );
|
||||
|
||||
bbtco->setColor( *s_lastTCOColor );
|
||||
bbtco->setUseStyleColor( false );
|
||||
}
|
||||
return new bbTCO( this );
|
||||
return bbtco;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void bbTrack::saveTrackSpecificSettings( QDomDocument & _doc,
|
||||
QDomElement & _this )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user