Renamed pattern/patternView to Pattern/PatternView
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
#include "bb_track.h"
|
||||
#include "engine.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "pattern.h"
|
||||
#include "Pattern.h"
|
||||
#include "SampleBuffer.h"
|
||||
#include "SampleTrack.h"
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "bb_track.h"
|
||||
#include "engine.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "pattern.h"
|
||||
#include "Pattern.h"
|
||||
#include "SampleBuffer.h"
|
||||
#include "SampleTrack.h"
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "ladspa_2_lmms.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Mixer.h"
|
||||
#include "pattern.h"
|
||||
#include "Pattern.h"
|
||||
#include "PianoRoll.h"
|
||||
#include "PresetPreviewPlayHandle.h"
|
||||
#include "ProjectJournal.h"
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
#include "MidiClient.h"
|
||||
#include "DataFile.h"
|
||||
#include "NotePlayHandle.h"
|
||||
#include "pattern.h"
|
||||
#include "Pattern.h"
|
||||
#include "PianoRoll.h"
|
||||
#include "ProjectJournal.h"
|
||||
#include "project_notes.h"
|
||||
@@ -471,14 +471,14 @@ void song::playBB()
|
||||
|
||||
|
||||
|
||||
void song::playPattern( pattern * _patternToPlay, bool _loop )
|
||||
void song::playPattern( Pattern* patternToPlay, bool _loop )
|
||||
{
|
||||
if( isStopped() == false )
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
m_patternToPlay = _patternToPlay;
|
||||
m_patternToPlay = patternToPlay;
|
||||
m_loopPattern = _loop;
|
||||
|
||||
if( m_patternToPlay != NULL )
|
||||
|
||||
@@ -1932,7 +1932,7 @@ void AutomationEditor::play()
|
||||
if( engine::getSong()->playMode() != song::Mode_PlayPattern )
|
||||
{
|
||||
engine::getSong()->stop();
|
||||
engine::getSong()->playPattern( (pattern *) engine::pianoRoll()->currentPattern() );
|
||||
engine::getSong()->playPattern( (Pattern *) engine::pianoRoll()->currentPattern() );
|
||||
}
|
||||
else if( engine::getSong()->isStopped() == false )
|
||||
{
|
||||
@@ -1940,7 +1940,7 @@ void AutomationEditor::play()
|
||||
}
|
||||
else
|
||||
{
|
||||
engine::getSong()->playPattern( (pattern *) engine::pianoRoll()->currentPattern() );
|
||||
engine::getSong()->playPattern( (Pattern *) engine::pianoRoll()->currentPattern() );
|
||||
}
|
||||
}
|
||||
else if( inBBEditor() )
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
#include "MainWindow.h"
|
||||
#include "MidiEvent.h"
|
||||
#include "DataFile.h"
|
||||
#include "pattern.h"
|
||||
#include "Pattern.h"
|
||||
#include "Piano.h"
|
||||
#include "pixmap_button.h"
|
||||
#include "song.h"
|
||||
@@ -787,9 +787,9 @@ PianoRoll::~PianoRoll()
|
||||
}
|
||||
|
||||
|
||||
void PianoRoll::setCurrentPattern( pattern * _new_pattern )
|
||||
void PianoRoll::setCurrentPattern( Pattern* newPattern )
|
||||
{
|
||||
if( validPattern() )
|
||||
if( hasValidPattern() )
|
||||
{
|
||||
m_pattern->instrumentTrack()->disconnect( this );
|
||||
}
|
||||
@@ -802,12 +802,12 @@ void PianoRoll::setCurrentPattern( pattern * _new_pattern )
|
||||
}
|
||||
|
||||
// set new data
|
||||
m_pattern = _new_pattern;
|
||||
m_pattern = newPattern;
|
||||
m_currentPosition = 0;
|
||||
m_currentNote = NULL;
|
||||
m_startKey = INITIAL_START_KEY;
|
||||
|
||||
if( validPattern() == false )
|
||||
if( hasValidPattern() == false )
|
||||
{
|
||||
//resizeEvent( NULL );
|
||||
setWindowTitle( tr( "Piano-Roll - no pattern" ) );
|
||||
@@ -849,7 +849,7 @@ void PianoRoll::setCurrentPattern( pattern * _new_pattern )
|
||||
resizeEvent( NULL );
|
||||
|
||||
// make sure to always get informed about the pattern being destroyed
|
||||
connect( m_pattern, SIGNAL( destroyedPattern( pattern* ) ), this, SLOT( hidePattern( pattern* ) ) );
|
||||
connect( m_pattern, SIGNAL( destroyedPattern( Pattern* ) ), this, SLOT( hidePattern( Pattern* ) ) );
|
||||
|
||||
connect( m_pattern->instrumentTrack(), SIGNAL( midiNoteOn( const note& ) ), this, SLOT( startRecordNote( const note& ) ) );
|
||||
connect( m_pattern->instrumentTrack(), SIGNAL( midiNoteOff( const note& ) ), this, SLOT( finishRecordNote( const note& ) ) );
|
||||
@@ -863,9 +863,9 @@ void PianoRoll::setCurrentPattern( pattern * _new_pattern )
|
||||
|
||||
|
||||
|
||||
void PianoRoll::hidePattern( pattern* p )
|
||||
void PianoRoll::hidePattern( Pattern* pattern )
|
||||
{
|
||||
if( m_pattern == p )
|
||||
if( m_pattern == pattern )
|
||||
{
|
||||
setCurrentPattern( NULL );
|
||||
}
|
||||
@@ -1212,7 +1212,7 @@ int PianoRoll::selectionCount() const // how many notes are selected?
|
||||
|
||||
void PianoRoll::keyPressEvent( QKeyEvent* event )
|
||||
{
|
||||
if( validPattern() && event->modifiers() == Qt::NoModifier )
|
||||
if( hasValidPattern() && event->modifiers() == Qt::NoModifier )
|
||||
{
|
||||
const int key_num = PianoView::getKeyFromKeyEvent( event ) + ( DefaultOctave - 1 ) * KeysPerOctave;
|
||||
|
||||
@@ -1488,7 +1488,7 @@ void PianoRoll::keyPressEvent( QKeyEvent* event )
|
||||
|
||||
void PianoRoll::keyReleaseEvent( QKeyEvent* event )
|
||||
{
|
||||
if( validPattern() && event->modifiers() == Qt::NoModifier )
|
||||
if( hasValidPattern() && event->modifiers() == Qt::NoModifier )
|
||||
{
|
||||
const int key_num = PianoView::getKeyFromKeyEvent( event ) + ( DefaultOctave - 1 ) * KeysPerOctave;
|
||||
|
||||
@@ -1510,7 +1510,7 @@ void PianoRoll::keyReleaseEvent( QKeyEvent* event )
|
||||
// update after undo/redo
|
||||
case Qt::Key_Z:
|
||||
case Qt::Key_R:
|
||||
if( validPattern() && event->modifiers() == Qt::ControlModifier )
|
||||
if( hasValidPattern() && event->modifiers() == Qt::ControlModifier )
|
||||
{
|
||||
update();
|
||||
}
|
||||
@@ -1590,7 +1590,7 @@ void PianoRoll::mousePressEvent( QMouseEvent * _me )
|
||||
{
|
||||
m_startedWithShift = _me->modifiers() & Qt::ShiftModifier;
|
||||
|
||||
if( validPattern() == false )
|
||||
if( hasValidPattern() == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1704,7 +1704,7 @@ void PianoRoll::mousePressEvent( QMouseEvent * _me )
|
||||
{
|
||||
is_new_note = true;
|
||||
m_pattern->addJournalCheckPoint();
|
||||
m_pattern->setType( pattern::MelodyPattern );
|
||||
m_pattern->setType( Pattern::MelodyPattern );
|
||||
|
||||
// then set new note
|
||||
|
||||
@@ -1972,7 +1972,7 @@ void PianoRoll::mousePressEvent( QMouseEvent * _me )
|
||||
|
||||
void PianoRoll::mouseDoubleClickEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( validPattern() == false )
|
||||
if( hasValidPattern() == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -2134,7 +2134,7 @@ void PianoRoll::computeSelectedNotes(bool shift)
|
||||
}
|
||||
|
||||
//int y_base = noteEditTop() - 1;
|
||||
if( validPattern() == true )
|
||||
if( hasValidPattern() == true )
|
||||
{
|
||||
const NoteVector & notes = m_pattern->notes();
|
||||
|
||||
@@ -2236,7 +2236,7 @@ void PianoRoll::mouseReleaseEvent( QMouseEvent * _me )
|
||||
}
|
||||
|
||||
|
||||
if( validPattern() == true )
|
||||
if( hasValidPattern() == true )
|
||||
{
|
||||
// turn off all notes that are playing
|
||||
const NoteVector & notes = m_pattern->notes();
|
||||
@@ -2277,7 +2277,7 @@ void PianoRoll::mouseReleaseEvent( QMouseEvent * _me )
|
||||
|
||||
void PianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( validPattern() == false )
|
||||
if( hasValidPattern() == false )
|
||||
{
|
||||
update();
|
||||
return;
|
||||
@@ -3031,7 +3031,7 @@ void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
if( prKeyOrder[key % KeysPerOctave] == PR_WHITE_KEY_SMALL )
|
||||
{
|
||||
// draw a small one while checking if it is pressed or not
|
||||
if( validPattern() && m_pattern->instrumentTrack()->pianoModel()->isKeyPressed( key ) )
|
||||
if( hasValidPattern() && m_pattern->instrumentTrack()->pianoModel()->isKeyPressed( key ) )
|
||||
{
|
||||
p.drawPixmap( PIANO_X, y - WHITE_KEY_SMALL_HEIGHT, *s_whiteKeySmallPressedPm );
|
||||
}
|
||||
@@ -3047,7 +3047,7 @@ void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
PR_WHITE_KEY_BIG )
|
||||
{
|
||||
// draw a big one while checking if it is pressed or not
|
||||
if( validPattern() && m_pattern->instrumentTrack()->pianoModel()->isKeyPressed( key ) )
|
||||
if( hasValidPattern() && m_pattern->instrumentTrack()->pianoModel()->isKeyPressed( key ) )
|
||||
{
|
||||
p.drawPixmap( PIANO_X, y - WHITE_KEY_BIG_HEIGHT, *s_whiteKeyBigPressedPm );
|
||||
}
|
||||
@@ -3120,7 +3120,7 @@ void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
// then draw it (calculation of y very complicated,
|
||||
// but that's the only working solution, sorry...)
|
||||
// check if the key is pressed or not
|
||||
if( validPattern() && m_pattern->instrumentTrack()->pianoModel()->isKeyPressed( key ) )
|
||||
if( hasValidPattern() && m_pattern->instrumentTrack()->pianoModel()->isKeyPressed( key ) )
|
||||
{
|
||||
p.drawPixmap( PIANO_X, y - ( first_white_key_height -
|
||||
WHITE_KEY_SMALL_HEIGHT ) -
|
||||
@@ -3257,7 +3257,7 @@ void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
}
|
||||
|
||||
int y_base = keyAreaBottom() - 1;
|
||||
if( validPattern() == true )
|
||||
if( hasValidPattern() == true )
|
||||
{
|
||||
p.setClipRect( WHITE_KEY_WIDTH, PR_TOP_MARGIN,
|
||||
width() - WHITE_KEY_WIDTH,
|
||||
@@ -3391,7 +3391,7 @@ void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
p.drawRect( x + WHITE_KEY_WIDTH, y, w, h );
|
||||
|
||||
// TODO: Get this out of paint event
|
||||
int l = ( validPattern() == true )? (int) m_pattern->length() : 0;
|
||||
int l = ( hasValidPattern() == true )? (int) m_pattern->length() : 0;
|
||||
|
||||
// reset scroll-range
|
||||
if( m_leftRightScroll->maximum() != l )
|
||||
@@ -3404,7 +3404,7 @@ void PianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
horizCol.setAlpha( 64 );
|
||||
|
||||
// horizontal line for the key under the cursor
|
||||
if( validPattern() == true )
|
||||
if( hasValidPattern() == true )
|
||||
{
|
||||
int key_num = getKey( mapFromGlobal( QCursor::pos() ).y() );
|
||||
p.fillRect( 10, keyAreaBottom() + 3 - KEY_LINE_HEIGHT *
|
||||
@@ -3660,7 +3660,7 @@ song::PlayModes PianoRoll::desiredPlayModeForAccompany() const
|
||||
|
||||
void PianoRoll::play()
|
||||
{
|
||||
if( validPattern() == false )
|
||||
if( hasValidPattern() == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -3684,7 +3684,7 @@ void PianoRoll::record()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
if( m_recording == true || validPattern() == false )
|
||||
if( m_recording == true || hasValidPattern() == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -3703,7 +3703,7 @@ void PianoRoll::recordAccompany()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
if( m_recording == true || validPattern() == false )
|
||||
if( m_recording == true || hasValidPattern() == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -3736,7 +3736,7 @@ void PianoRoll::stop()
|
||||
|
||||
void PianoRoll::startRecordNote( const note & _n )
|
||||
{
|
||||
if( m_recording == true && validPattern() == true &&
|
||||
if( m_recording == true && hasValidPattern() == true &&
|
||||
engine::getSong()->isPlaying() &&
|
||||
( engine::getSong()->playMode() ==
|
||||
desiredPlayModeForAccompany() ||
|
||||
@@ -3763,7 +3763,7 @@ void PianoRoll::startRecordNote( const note & _n )
|
||||
|
||||
void PianoRoll::finishRecordNote( const note & _n )
|
||||
{
|
||||
if( m_recording == true && validPattern() == true &&
|
||||
if( m_recording == true && hasValidPattern() == true &&
|
||||
engine::getSong()->isPlaying() &&
|
||||
( engine::getSong()->playMode() ==
|
||||
desiredPlayModeForAccompany() ||
|
||||
@@ -3848,7 +3848,7 @@ void PianoRoll::detuneButtonToggled()
|
||||
|
||||
void PianoRoll::selectAll()
|
||||
{
|
||||
if( validPattern() == false )
|
||||
if( hasValidPattern() == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -3906,7 +3906,7 @@ void PianoRoll::selectAll()
|
||||
// returns vector with pointers to all selected notes
|
||||
void PianoRoll::getSelectedNotes( NoteVector & _selected_notes )
|
||||
{
|
||||
if( validPattern() == false )
|
||||
if( hasValidPattern() == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -4009,7 +4009,7 @@ void PianoRoll::copySelectedNotes()
|
||||
|
||||
void PianoRoll::cutSelectedNotes()
|
||||
{
|
||||
if( validPattern() == false )
|
||||
if( hasValidPattern() == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -4041,7 +4041,7 @@ void PianoRoll::cutSelectedNotes()
|
||||
|
||||
void PianoRoll::pasteNotes()
|
||||
{
|
||||
if( validPattern() == false )
|
||||
if( hasValidPattern() == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -4093,7 +4093,7 @@ void PianoRoll::pasteNotes()
|
||||
|
||||
void PianoRoll::deleteSelectedNotes()
|
||||
{
|
||||
if( validPattern() == false )
|
||||
if( hasValidPattern() == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -4176,7 +4176,7 @@ void PianoRoll::updatePositionAccompany( const MidiTime & _t )
|
||||
{
|
||||
song * s = engine::getSong();
|
||||
|
||||
if( m_recording && validPattern() &&
|
||||
if( m_recording && hasValidPattern() &&
|
||||
s->playMode() != song::Mode_PlayPattern )
|
||||
{
|
||||
MidiTime pos = _t;
|
||||
@@ -4268,7 +4268,7 @@ MidiTime PianoRoll::newNoteLen() const
|
||||
|
||||
bool PianoRoll::mouseOverNote()
|
||||
{
|
||||
return validPattern() && noteUnderMouse() != NULL;
|
||||
return hasValidPattern() && noteUnderMouse() != NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "string_pair_drag.h"
|
||||
|
||||
#include "TrackContainer.h"
|
||||
#include "pattern.h"
|
||||
#include "Pattern.h"
|
||||
|
||||
|
||||
|
||||
@@ -256,8 +256,7 @@ void bbEditor::addSteps()
|
||||
{
|
||||
if( ( *it )->type() == track::InstrumentTrack )
|
||||
{
|
||||
pattern * p = static_cast<pattern *>(
|
||||
( *it )->getTCO( m_bbtc->currentBB() ) );
|
||||
Pattern* p = static_cast<Pattern *>( ( *it )->getTCO( m_bbtc->currentBB() ) );
|
||||
p->addSteps();
|
||||
}
|
||||
}
|
||||
@@ -275,8 +274,7 @@ void bbEditor::removeSteps()
|
||||
{
|
||||
if( ( *it )->type() == track::InstrumentTrack )
|
||||
{
|
||||
pattern * p = static_cast<pattern *>(
|
||||
( *it )->getTCO( m_bbtc->currentBB() ) );
|
||||
Pattern* p = static_cast<Pattern *>( ( *it )->getTCO( m_bbtc->currentBB() ) );
|
||||
p->removeSteps();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
#include "MixHelpers.h"
|
||||
#include "DataFile.h"
|
||||
#include "NotePlayHandle.h"
|
||||
#include "pattern.h"
|
||||
#include "Pattern.h"
|
||||
#include "PluginView.h"
|
||||
#include "SamplePlayHandle.h"
|
||||
#include "song.h"
|
||||
@@ -481,7 +481,7 @@ void InstrumentTrack::setName( const QString & _new_name )
|
||||
// which have the same name as the instrument-track
|
||||
for( int i = 0; i < numOfTCOs(); ++i )
|
||||
{
|
||||
pattern * p = dynamic_cast<pattern *>( getTCO( i ) );
|
||||
Pattern* p = dynamic_cast<Pattern*>( getTCO( i ) );
|
||||
if( ( p != NULL && p->name() == name() ) || p->name() == "" )
|
||||
{
|
||||
p->setName( _new_name );
|
||||
@@ -592,7 +592,7 @@ bool InstrumentTrack::play( const MidiTime & _start, const fpp_t _frames,
|
||||
|
||||
for( tcoVector::Iterator it = tcos.begin(); it != tcos.end(); ++it )
|
||||
{
|
||||
pattern * p = dynamic_cast<pattern *>( *it );
|
||||
Pattern* p = dynamic_cast<Pattern*>( *it );
|
||||
// everything which is not a pattern or muted won't be played
|
||||
if( p == NULL || ( *it )->isMuted() )
|
||||
{
|
||||
@@ -656,7 +656,7 @@ bool InstrumentTrack::play( const MidiTime & _start, const fpp_t _frames,
|
||||
|
||||
trackContentObject * InstrumentTrack::createTCO( const MidiTime & )
|
||||
{
|
||||
return new pattern( this );
|
||||
return new Pattern( this );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtAlgorithms>
|
||||
|
||||
#include "pattern.h"
|
||||
#include "Pattern.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "templates.h"
|
||||
#include "gui_templates.h"
|
||||
@@ -51,14 +51,14 @@
|
||||
#include "MainWindow.h"
|
||||
|
||||
|
||||
QPixmap * patternView::s_stepBtnOn = NULL;
|
||||
QPixmap * patternView::s_stepBtnOverlay = NULL;
|
||||
QPixmap * patternView::s_stepBtnOff = NULL;
|
||||
QPixmap * patternView::s_stepBtnOffLight = NULL;
|
||||
QPixmap * PatternView::s_stepBtnOn = NULL;
|
||||
QPixmap * PatternView::s_stepBtnOverlay = NULL;
|
||||
QPixmap * PatternView::s_stepBtnOff = NULL;
|
||||
QPixmap * PatternView::s_stepBtnOffLight = NULL;
|
||||
|
||||
|
||||
|
||||
pattern::pattern( InstrumentTrack * _instrument_track ) :
|
||||
Pattern::Pattern( InstrumentTrack * _instrument_track ) :
|
||||
trackContentObject( _instrument_track ),
|
||||
m_instrumentTrack( _instrument_track ),
|
||||
m_patternType( BeatPattern ),
|
||||
@@ -71,14 +71,13 @@ pattern::pattern( InstrumentTrack * _instrument_track ) :
|
||||
|
||||
|
||||
|
||||
pattern::pattern( const pattern & _pat_to_copy ) :
|
||||
trackContentObject( _pat_to_copy.m_instrumentTrack ),
|
||||
m_instrumentTrack( _pat_to_copy.m_instrumentTrack ),
|
||||
m_patternType( _pat_to_copy.m_patternType ),
|
||||
m_steps( _pat_to_copy.m_steps )
|
||||
Pattern::Pattern( const Pattern& other ) :
|
||||
trackContentObject( other.m_instrumentTrack ),
|
||||
m_instrumentTrack( other.m_instrumentTrack ),
|
||||
m_patternType( other.m_patternType ),
|
||||
m_steps( other.m_steps )
|
||||
{
|
||||
for( NoteVector::ConstIterator it = _pat_to_copy.m_notes.begin();
|
||||
it != _pat_to_copy.m_notes.end(); ++it )
|
||||
for( NoteVector::ConstIterator it = other.m_notes.begin(); it != other.m_notes.end(); ++it )
|
||||
{
|
||||
m_notes.push_back( new note( **it ) );
|
||||
}
|
||||
@@ -87,7 +86,7 @@ pattern::pattern( const pattern & _pat_to_copy ) :
|
||||
}
|
||||
|
||||
|
||||
pattern::~pattern()
|
||||
Pattern::~Pattern()
|
||||
{
|
||||
emit destroyedPattern( this );
|
||||
|
||||
@@ -103,7 +102,7 @@ pattern::~pattern()
|
||||
|
||||
|
||||
|
||||
void pattern::init()
|
||||
void Pattern::init()
|
||||
{
|
||||
connect( engine::getSong(), SIGNAL( timeSignatureChanged( int, int ) ),
|
||||
this, SLOT( changeTimeSignature() ) );
|
||||
@@ -118,7 +117,7 @@ void pattern::init()
|
||||
|
||||
|
||||
|
||||
MidiTime pattern::length() const
|
||||
MidiTime Pattern::length() const
|
||||
{
|
||||
if( m_patternType == BeatPattern )
|
||||
{
|
||||
@@ -143,7 +142,7 @@ MidiTime pattern::length() const
|
||||
|
||||
|
||||
|
||||
MidiTime pattern::beatPatternLength() const
|
||||
MidiTime Pattern::beatPatternLength() const
|
||||
{
|
||||
tick_t max_length = MidiTime::ticksPerTact();
|
||||
|
||||
@@ -168,7 +167,7 @@ MidiTime pattern::beatPatternLength() const
|
||||
return MidiTime( max_length ).nextFullTact() * MidiTime::ticksPerTact();
|
||||
}
|
||||
|
||||
note * pattern::addNote( const note & _new_note, const bool _quant_pos )
|
||||
note * Pattern::addNote( const note & _new_note, const bool _quant_pos )
|
||||
{
|
||||
note * new_note = new note( _new_note );
|
||||
if( _quant_pos && engine::pianoRoll() )
|
||||
@@ -214,7 +213,7 @@ note * pattern::addNote( const note & _new_note, const bool _quant_pos )
|
||||
|
||||
|
||||
|
||||
void pattern::removeNote( const note * _note_to_del )
|
||||
void Pattern::removeNote( const note * _note_to_del )
|
||||
{
|
||||
engine::mixer()->lock();
|
||||
NoteVector::Iterator it = m_notes.begin();
|
||||
@@ -241,7 +240,7 @@ void pattern::removeNote( const note * _note_to_del )
|
||||
|
||||
// returns a pointer to the note at specified step, or NULL if note doesn't exist
|
||||
|
||||
note * pattern::noteAtStep( int _step )
|
||||
note * Pattern::noteAtStep( int _step )
|
||||
{
|
||||
for( NoteVector::Iterator it = m_notes.begin(); it != m_notes.end();
|
||||
++it )
|
||||
@@ -255,7 +254,7 @@ note * pattern::noteAtStep( int _step )
|
||||
}
|
||||
|
||||
|
||||
note * pattern::rearrangeNote( const note * _note_to_proc,
|
||||
note * Pattern::rearrangeNote( const note * _note_to_proc,
|
||||
const bool _quant_pos )
|
||||
{
|
||||
// just rearrange the position of the note by removing it and adding
|
||||
@@ -268,7 +267,7 @@ note * pattern::rearrangeNote( const note * _note_to_proc,
|
||||
|
||||
|
||||
|
||||
void pattern::rearrangeAllNotes()
|
||||
void Pattern::rearrangeAllNotes()
|
||||
{
|
||||
// sort notes by start time
|
||||
qSort(m_notes.begin(), m_notes.end(), note::lessThan );
|
||||
@@ -276,7 +275,7 @@ void pattern::rearrangeAllNotes()
|
||||
|
||||
|
||||
|
||||
void pattern::clearNotes()
|
||||
void Pattern::clearNotes()
|
||||
{
|
||||
engine::mixer()->lock();
|
||||
for( NoteVector::Iterator it = m_notes.begin(); it != m_notes.end();
|
||||
@@ -294,7 +293,7 @@ void pattern::clearNotes()
|
||||
|
||||
|
||||
|
||||
void pattern::setStep( int _step, bool _enabled )
|
||||
void Pattern::setStep( int _step, bool _enabled )
|
||||
{
|
||||
for( NoteVector::Iterator it = m_notes.begin(); it != m_notes.end();
|
||||
++it )
|
||||
@@ -311,7 +310,7 @@ void pattern::setStep( int _step, bool _enabled )
|
||||
|
||||
|
||||
|
||||
void pattern::setType( PatternTypes _new_pattern_type )
|
||||
void Pattern::setType( PatternTypes _new_pattern_type )
|
||||
{
|
||||
if( _new_pattern_type == BeatPattern ||
|
||||
_new_pattern_type == MelodyPattern )
|
||||
@@ -323,25 +322,25 @@ void pattern::setType( PatternTypes _new_pattern_type )
|
||||
|
||||
|
||||
|
||||
void pattern::checkType()
|
||||
void Pattern::checkType()
|
||||
{
|
||||
NoteVector::Iterator it = m_notes.begin();
|
||||
while( it != m_notes.end() )
|
||||
{
|
||||
if( ( *it )->length() > 0 )
|
||||
{
|
||||
setType( pattern::MelodyPattern );
|
||||
setType( Pattern::MelodyPattern );
|
||||
return;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
setType( pattern::BeatPattern );
|
||||
setType( Pattern::BeatPattern );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void pattern::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
void Pattern::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
_this.setAttribute( "type", m_patternType );
|
||||
_this.setAttribute( "name", name() );
|
||||
@@ -375,7 +374,7 @@ void pattern::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
|
||||
|
||||
|
||||
void pattern::loadSettings( const QDomElement & _this )
|
||||
void Pattern::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
m_patternType = static_cast<PatternTypes>( _this.attribute( "type"
|
||||
).toInt() );
|
||||
@@ -422,7 +421,7 @@ void pattern::loadSettings( const QDomElement & _this )
|
||||
|
||||
|
||||
|
||||
void pattern::clear()
|
||||
void Pattern::clear()
|
||||
{
|
||||
addJournalCheckPoint();
|
||||
clearNotes();
|
||||
@@ -432,7 +431,7 @@ void pattern::clear()
|
||||
|
||||
|
||||
|
||||
void pattern::addSteps()
|
||||
void Pattern::addSteps()
|
||||
{
|
||||
m_steps += MidiTime::stepsPerTact();
|
||||
ensureBeatNotes();
|
||||
@@ -443,7 +442,7 @@ void pattern::addSteps()
|
||||
|
||||
|
||||
|
||||
void pattern::removeSteps()
|
||||
void Pattern::removeSteps()
|
||||
{
|
||||
int _n = MidiTime::stepsPerTact();
|
||||
if( _n < m_steps )
|
||||
@@ -472,16 +471,16 @@ void pattern::removeSteps()
|
||||
|
||||
|
||||
|
||||
trackContentObjectView * pattern::createView( trackView * _tv )
|
||||
trackContentObjectView * Pattern::createView( trackView * _tv )
|
||||
{
|
||||
return new patternView( this, _tv );
|
||||
return new PatternView( this, _tv );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void pattern::ensureBeatNotes()
|
||||
void Pattern::ensureBeatNotes()
|
||||
{
|
||||
// make sure, that all step-note exist
|
||||
for( int i = 0; i < m_steps; ++i )
|
||||
@@ -533,7 +532,7 @@ void pattern::ensureBeatNotes()
|
||||
|
||||
|
||||
|
||||
void pattern::updateBBTrack()
|
||||
void Pattern::updateBBTrack()
|
||||
{
|
||||
if( getTrack()->trackContainer() == engine::getBBTrackContainer() )
|
||||
{
|
||||
@@ -549,7 +548,7 @@ void pattern::updateBBTrack()
|
||||
|
||||
|
||||
|
||||
bool pattern::empty()
|
||||
bool Pattern::empty()
|
||||
{
|
||||
for( NoteVector::ConstIterator it = m_notes.begin();
|
||||
it != m_notes.end(); ++it )
|
||||
@@ -565,7 +564,7 @@ bool pattern::empty()
|
||||
|
||||
|
||||
|
||||
void pattern::changeTimeSignature()
|
||||
void Pattern::changeTimeSignature()
|
||||
{
|
||||
MidiTime last_pos = MidiTime::ticksPerTact();
|
||||
for( NoteVector::ConstIterator cit = m_notes.begin();
|
||||
@@ -602,9 +601,9 @@ void pattern::changeTimeSignature()
|
||||
|
||||
|
||||
|
||||
patternView::patternView( pattern * _pattern, trackView * _parent ) :
|
||||
trackContentObjectView( _pattern, _parent ),
|
||||
m_pat( _pattern ),
|
||||
PatternView::PatternView( Pattern* pattern, trackView* parent ) :
|
||||
trackContentObjectView( pattern, parent ),
|
||||
m_pat( pattern ),
|
||||
m_paintPixmap(),
|
||||
m_needsUpdate( true )
|
||||
{
|
||||
@@ -649,7 +648,7 @@ patternView::patternView( pattern * _pattern, trackView * _parent ) :
|
||||
|
||||
|
||||
|
||||
patternView::~patternView()
|
||||
PatternView::~PatternView()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -657,7 +656,7 @@ patternView::~patternView()
|
||||
|
||||
|
||||
|
||||
void patternView::update()
|
||||
void PatternView::update()
|
||||
{
|
||||
m_needsUpdate = true;
|
||||
m_pat->changeLength( m_pat->length() );
|
||||
@@ -667,7 +666,7 @@ void patternView::update()
|
||||
|
||||
|
||||
|
||||
void patternView::openInPianoRoll()
|
||||
void PatternView::openInPianoRoll()
|
||||
{
|
||||
engine::pianoRoll()->setCurrentPattern( m_pat );
|
||||
engine::pianoRoll()->parentWidget()->show();
|
||||
@@ -677,7 +676,7 @@ void patternView::openInPianoRoll()
|
||||
|
||||
|
||||
|
||||
void patternView::resetName()
|
||||
void PatternView::resetName()
|
||||
{
|
||||
m_pat->setName( m_pat->m_instrumentTrack->name() );
|
||||
}
|
||||
@@ -685,7 +684,7 @@ void patternView::resetName()
|
||||
|
||||
|
||||
|
||||
void patternView::changeName()
|
||||
void PatternView::changeName()
|
||||
{
|
||||
QString s = m_pat->name();
|
||||
renameDialog rename_dlg( s );
|
||||
@@ -696,7 +695,7 @@ void patternView::changeName()
|
||||
|
||||
|
||||
|
||||
void patternView::constructContextMenu( QMenu * _cm )
|
||||
void PatternView::constructContextMenu( QMenu * _cm )
|
||||
{
|
||||
QAction * a = new QAction( embed::getIconPixmap( "piano" ),
|
||||
tr( "Open in piano-roll" ), _cm );
|
||||
@@ -727,15 +726,15 @@ void patternView::constructContextMenu( QMenu * _cm )
|
||||
|
||||
|
||||
|
||||
void patternView::mouseDoubleClickEvent( QMouseEvent * _me )
|
||||
void PatternView::mouseDoubleClickEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( _me->button() != Qt::LeftButton )
|
||||
{
|
||||
_me->ignore();
|
||||
return;
|
||||
}
|
||||
if( m_pat->type() == pattern::MelodyPattern ||
|
||||
!( m_pat->type() == pattern::BeatPattern &&
|
||||
if( m_pat->type() == Pattern::MelodyPattern ||
|
||||
!( m_pat->type() == Pattern::BeatPattern &&
|
||||
( pixelsPerTact() >= 192 ||
|
||||
m_pat->m_steps != MidiTime::stepsPerTact() ) &&
|
||||
_me->y() > height() - s_stepBtnOff->height() ) )
|
||||
@@ -747,10 +746,10 @@ void patternView::mouseDoubleClickEvent( QMouseEvent * _me )
|
||||
|
||||
|
||||
|
||||
void patternView::mousePressEvent( QMouseEvent * _me )
|
||||
void PatternView::mousePressEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( _me->button() == Qt::LeftButton &&
|
||||
m_pat->m_patternType == pattern::BeatPattern &&
|
||||
m_pat->m_patternType == Pattern::BeatPattern &&
|
||||
( fixedTCOs() || pixelsPerTact() >= 96 ||
|
||||
m_pat->m_steps != MidiTime::stepsPerTact() ) &&
|
||||
_me->y() > height() - s_stepBtnOff->height() )
|
||||
@@ -819,9 +818,9 @@ void patternView::mousePressEvent( QMouseEvent * _me )
|
||||
|
||||
|
||||
|
||||
void patternView::wheelEvent( QWheelEvent * _we )
|
||||
void PatternView::wheelEvent( QWheelEvent * _we )
|
||||
{
|
||||
if( m_pat->m_patternType == pattern::BeatPattern &&
|
||||
if( m_pat->m_patternType == Pattern::BeatPattern &&
|
||||
( fixedTCOs() || pixelsPerTact() >= 96 ||
|
||||
m_pat->m_steps != MidiTime::stepsPerTact() ) &&
|
||||
_we->y() > height() - s_stepBtnOff->height() )
|
||||
@@ -879,7 +878,7 @@ void patternView::wheelEvent( QWheelEvent * _we )
|
||||
|
||||
|
||||
|
||||
void patternView::paintEvent( QPaintEvent * )
|
||||
void PatternView::paintEvent( QPaintEvent * )
|
||||
{
|
||||
if( m_needsUpdate == false )
|
||||
{
|
||||
@@ -906,14 +905,14 @@ void patternView::paintEvent( QPaintEvent * )
|
||||
|
||||
QColor c;
|
||||
|
||||
if(( m_pat->m_patternType != pattern::BeatPattern ) &&
|
||||
if(( m_pat->m_patternType != Pattern::BeatPattern ) &&
|
||||
!( m_pat->getTrack()->isMuted() || m_pat->isMuted() ))
|
||||
c = isSelected() ? QColor( 0, 0, 224 )
|
||||
: styleColor;
|
||||
else
|
||||
c = QColor( 80, 80, 80 );
|
||||
|
||||
if( m_pat->m_patternType != pattern::BeatPattern )
|
||||
if( m_pat->m_patternType != Pattern::BeatPattern )
|
||||
{
|
||||
lingrad.setColorAt( 1, c.darker( 300 ) );
|
||||
lingrad.setColorAt( 0, c );
|
||||
@@ -925,14 +924,14 @@ void patternView::paintEvent( QPaintEvent * )
|
||||
}
|
||||
|
||||
p.setBrush( lingrad );
|
||||
if( engine::pianoRoll()->currentPattern() == m_pat && m_pat->m_patternType != pattern::BeatPattern )
|
||||
if( engine::pianoRoll()->currentPattern() == m_pat && m_pat->m_patternType != Pattern::BeatPattern )
|
||||
p.setPen( c.lighter( 130 ) );
|
||||
else
|
||||
p.setPen( c.darker( 300 ) );
|
||||
p.drawRect( QRect( 0, 0, width() - 1, height() - 1 ) );
|
||||
|
||||
p.setBrush( QBrush() );
|
||||
if( m_pat->m_patternType != pattern::BeatPattern )
|
||||
if( m_pat->m_patternType != Pattern::BeatPattern )
|
||||
{
|
||||
if( engine::pianoRoll()->currentPattern() == m_pat )
|
||||
p.setPen( c.lighter( 160 ) );
|
||||
@@ -962,7 +961,7 @@ void patternView::paintEvent( QPaintEvent * )
|
||||
|
||||
// melody pattern paint event
|
||||
|
||||
if( m_pat->m_patternType == pattern::MelodyPattern )
|
||||
if( m_pat->m_patternType == Pattern::MelodyPattern )
|
||||
{
|
||||
if( m_pat->m_notes.size() > 0 )
|
||||
{
|
||||
@@ -1052,7 +1051,7 @@ void patternView::paintEvent( QPaintEvent * )
|
||||
|
||||
// beat pattern paint event
|
||||
|
||||
else if( m_pat->m_patternType == pattern::BeatPattern &&
|
||||
else if( m_pat->m_patternType == Pattern::BeatPattern &&
|
||||
( fixedTCOs() || ppt >= 96
|
||||
|| m_pat->m_steps != MidiTime::stepsPerTact() ) )
|
||||
{
|
||||
@@ -1149,6 +1148,6 @@ void patternView::paintEvent( QPaintEvent * )
|
||||
|
||||
|
||||
|
||||
#include "moc_pattern.cxx"
|
||||
#include "moc_Pattern.cxx"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user