From 53f240852dab8d04c73aab26cce7166ed506c57e Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sun, 28 Sep 2014 18:18:31 +0200 Subject: [PATCH 1/4] RemoteVstPlugin: build with -ansi option Work around a known bug in GCC headers which can lead to compile errors in cstdlib header file when using the -m32 compiler flag. Closes #1181. --- plugins/vst_base/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/vst_base/CMakeLists.txt b/plugins/vst_base/CMakeLists.txt index 750ca9022..9706667ae 100644 --- a/plugins/vst_base/CMakeLists.txt +++ b/plugins/vst_base/CMakeLists.txt @@ -35,7 +35,7 @@ ENDIF(LMMS_HOST_X86_64) ADD_CUSTOM_COMMAND( SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/RemoteVstPlugin.cpp" COMMAND ${WINE_CXX} - ARGS "-I\"${CMAKE_BINARY_DIR}\"" "-I\"${CMAKE_SOURCE_DIR}/include\"" "-I\"${CMAKE_INSTALL_PREFIX}/include/wine/windows\"" "-I\"${CMAKE_INSTALL_PREFIX}/include\"" -I/usr/include/wine/windows "\"${CMAKE_CURRENT_SOURCE_DIR}/RemoteVstPlugin.cpp\"" -mwindows -lpthread ${EXTRA_FLAGS} -o RemoteVstPlugin + ARGS "-I\"${CMAKE_BINARY_DIR}\"" "-I\"${CMAKE_SOURCE_DIR}/include\"" "-I\"${CMAKE_INSTALL_PREFIX}/include/wine/windows\"" "-I\"${CMAKE_INSTALL_PREFIX}/include\"" -I/usr/include/wine/windows "\"${CMAKE_CURRENT_SOURCE_DIR}/RemoteVstPlugin.cpp\"" -ansi -mwindows -lpthread ${EXTRA_FLAGS} -o RemoteVstPlugin COMMAND find -name RemoteVstPlugin.exe -exec mv "'{}'" RemoteVstPlugin "';'" TARGET vstbase OUTPUTS RemoteVstPlugin From fab7f8fea8cceac7ea6f7015ffb7cd8b9a51cefd Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Tue, 30 Sep 2014 22:34:01 +0200 Subject: [PATCH 2/4] PianoRoll, Pattern: manage reset of currently edited pattern more reliably Introduce one central signal in the pattern class which is emitted before the pattern object is being destroyed. This way we can easily and more reliably hide this pattern in the PianoRoll without any race conditions or other glitches. Closes #1089. --- include/PianoRoll.h | 3 +++ include/pattern.h | 4 ++++ src/gui/PianoRoll.cpp | 20 ++++++++++++++++++++ src/tracks/pattern.cpp | 16 ++-------------- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/include/PianoRoll.h b/include/PianoRoll.h index 157f3b051..ea9aa0387 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -164,6 +164,9 @@ protected slots: void changeNoteEditMode( int i ); void markSemiTone( int i ); + void hidePattern( pattern* p ); + + signals: void currentPatternChanged(); void semiToneMarkerMenuScaleSetEnabled(bool); diff --git a/include/pattern.h b/include/pattern.h index 2fff9697e..8db698370 100644 --- a/include/pattern.h +++ b/include/pattern.h @@ -140,6 +140,10 @@ private: friend class patternView; friend class bbEditor; + +signals: + void destroyedPattern( pattern* ); + } ; diff --git a/src/gui/PianoRoll.cpp b/src/gui/PianoRoll.cpp index 3fb1c64e6..abccc5e87 100644 --- a/src/gui/PianoRoll.cpp +++ b/src/gui/PianoRoll.cpp @@ -794,6 +794,14 @@ void PianoRoll::setCurrentPattern( pattern * _new_pattern ) m_pattern->instrumentTrack()->disconnect( this ); } + // force the song-editor to stop playing if it played pattern before + if( engine::getSong()->isPlaying() && + engine::getSong()->playMode() == song::Mode_PlayPattern ) + { + engine::getSong()->playPattern( NULL ); + } + + // set new data m_pattern = _new_pattern; m_currentPosition = 0; m_currentNote = NULL; @@ -840,6 +848,9 @@ void PianoRoll::setCurrentPattern( pattern * _new_pattern ) // of start-notes and so on...) 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->instrumentTrack(), SIGNAL( midiNoteOn( const note& ) ), this, SLOT( startRecordNote( const note& ) ) ); connect( m_pattern->instrumentTrack(), SIGNAL( midiNoteOff( const note& ) ), this, SLOT( finishRecordNote( const note& ) ) ); connect( m_pattern->instrumentTrack()->pianoModel(), SIGNAL( dataChanged() ), this, SLOT( update() ) ); @@ -852,6 +863,15 @@ void PianoRoll::setCurrentPattern( pattern * _new_pattern ) +void PianoRoll::hidePattern( pattern* p ) +{ + if( m_pattern == p ) + { + setCurrentPattern( NULL ); + } +} + + void PianoRoll::saveSettings( QDomDocument & _doc, QDomElement & _this ) { diff --git a/src/tracks/pattern.cpp b/src/tracks/pattern.cpp index ae38f9651..fe74d1872 100644 --- a/src/tracks/pattern.cpp +++ b/src/tracks/pattern.cpp @@ -89,6 +89,8 @@ pattern::pattern( const pattern & _pat_to_copy ) : pattern::~pattern() { + emit destroyedPattern( this ); + for( NoteVector::Iterator it = m_notes.begin(); it != m_notes.end(); ++it ) { @@ -649,20 +651,6 @@ patternView::patternView( pattern * _pattern, trackView * _parent ) : patternView::~patternView() { - if( engine::pianoRoll()->currentPattern() == m_pat ) - { - engine::pianoRoll()->disconnect( this ); - - engine::pianoRoll()->setCurrentPattern( NULL ); - // we have to have the song-editor to stop playing if it played - // us before - if( engine::getSong()->isPlaying() && - engine::getSong()->playMode() == - song::Mode_PlayPattern ) - { - engine::getSong()->playPattern( NULL ); - } - } } From de457183517d0b962997b62419428991c93d9213 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Tue, 30 Sep 2014 22:49:16 +0200 Subject: [PATCH 3/4] Renamed pattern/patternView to Pattern/PatternView --- data/locale/ca.ts | 2 +- data/locale/cs.ts | 2 +- data/locale/de.ts | 2 +- data/locale/en.ts | 2 +- data/locale/es.ts | 2 +- data/locale/fa.ts | 2 +- data/locale/fr.ts | 2 +- data/locale/gl.ts | 2 +- data/locale/it.ts | 2 +- data/locale/ja.ts | 2 +- data/locale/ko.ts | 2 +- data/locale/nl.ts | 2 +- data/locale/pl.ts | 2 +- data/locale/pt.ts | 2 +- data/locale/ru.ts | 2 +- data/locale/sv.ts | 2 +- data/locale/zh.ts | 2 +- data/themes/default/style.css | 2 +- include/{pattern.h => Pattern.h} | 22 ++-- include/PianoRoll.h | 12 +-- include/SampleRecordHandle.h | 1 - include/song.h | 6 +- plugins/HydrogenImport/HydrogenImport.cpp | 4 +- plugins/flp_import/FlpImport.cpp | 7 +- plugins/midi_import/MidiImport.cpp | 6 +- src/core/SamplePlayHandle.cpp | 2 +- src/core/SampleRecordHandle.cpp | 2 +- src/core/engine.cpp | 2 +- src/core/song.cpp | 6 +- src/gui/AutomationEditor.cpp | 4 +- src/gui/PianoRoll.cpp | 70 ++++++------ src/gui/bb_editor.cpp | 8 +- src/tracks/InstrumentTrack.cpp | 8 +- src/tracks/{pattern.cpp => Pattern.cpp} | 125 +++++++++++----------- 34 files changed, 158 insertions(+), 163 deletions(-) rename include/{pattern.h => Pattern.h} (88%) rename src/tracks/{pattern.cpp => Pattern.cpp} (89%) diff --git a/data/locale/ca.ts b/data/locale/ca.ts index 54936274e..794f420ba 100644 --- a/data/locale/ca.ts +++ b/data/locale/ca.ts @@ -5092,7 +5092,7 @@ Fent doble clic a qualsevol connector mostrarà informació sobre els ports. - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/locale/cs.ts b/data/locale/cs.ts index 500edb7fd..a40430965 100644 --- a/data/locale/cs.ts +++ b/data/locale/cs.ts @@ -5093,7 +5093,7 @@ Dvojitým kliknutím na kterýkoli z modulů se zobrazí informace o portech. - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/locale/de.ts b/data/locale/de.ts index 171c0ce8e..59e76daba 100644 --- a/data/locale/de.ts +++ b/data/locale/de.ts @@ -5700,7 +5700,7 @@ Doppelklicken auf eines der Plugins zeigt Informaitonen über die Ports an. - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/locale/en.ts b/data/locale/en.ts index f2aca61f0..f1b0bfca4 100644 --- a/data/locale/en.ts +++ b/data/locale/en.ts @@ -5074,7 +5074,7 @@ Double clicking any of the plugins will bring up information on the ports. - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/locale/es.ts b/data/locale/es.ts index 4bb9f5e1e..7963d5088 100644 --- a/data/locale/es.ts +++ b/data/locale/es.ts @@ -5075,7 +5075,7 @@ Double clicking any of the plugins will bring up information on the ports. - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/locale/fa.ts b/data/locale/fa.ts index 24fee5a2a..602f1e1e4 100644 --- a/data/locale/fa.ts +++ b/data/locale/fa.ts @@ -5074,7 +5074,7 @@ Double clicking any of the plugins will bring up information on the ports. - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/locale/fr.ts b/data/locale/fr.ts index fc9015c97..4826235c3 100644 --- a/data/locale/fr.ts +++ b/data/locale/fr.ts @@ -5107,7 +5107,7 @@ En double-cliquant sur ces greffons vous ferez apparaître des informations sur - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/locale/gl.ts b/data/locale/gl.ts index d830c5586..1fb6a0258 100644 --- a/data/locale/gl.ts +++ b/data/locale/gl.ts @@ -5106,7 +5106,7 @@ Facendo duplo clic sobre calquera dos engadidos mostra información sobre os por - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/locale/it.ts b/data/locale/it.ts index 64d6537fe..2cfc4cf24 100644 --- a/data/locale/it.ts +++ b/data/locale/it.ts @@ -5109,7 +5109,7 @@ Facendo doppio click sui plugin verranno fornite informazioni sulle relative por - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/locale/ja.ts b/data/locale/ja.ts index 0298ffba6..3b1422f9b 100644 --- a/data/locale/ja.ts +++ b/data/locale/ja.ts @@ -5105,7 +5105,7 @@ Double clicking any of the plugins will bring up information on the ports. - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/locale/ko.ts b/data/locale/ko.ts index 423a25fe3..bf66bf573 100644 --- a/data/locale/ko.ts +++ b/data/locale/ko.ts @@ -5076,7 +5076,7 @@ Double clicking any of the plugins will bring up information on the ports. - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/locale/nl.ts b/data/locale/nl.ts index b9605d9cd..d7e56656c 100644 --- a/data/locale/nl.ts +++ b/data/locale/nl.ts @@ -5077,7 +5077,7 @@ Double clicking any of the plugins will bring up information on the ports. - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/locale/pl.ts b/data/locale/pl.ts index fee00bae0..0a7f3c978 100644 --- a/data/locale/pl.ts +++ b/data/locale/pl.ts @@ -5112,7 +5112,7 @@ Podwójne kliknięcie na którejkolwiek wtyczce otworzy okienko z informacjami o - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/locale/pt.ts b/data/locale/pt.ts index 2675b9958..6f8f5ef34 100644 --- a/data/locale/pt.ts +++ b/data/locale/pt.ts @@ -5400,7 +5400,7 @@ Clicando duas vezes com o mouse em qualquer plugin, voc6e terá informações so - patternView + PatternView Open in piano-roll Abrir no Editor de Notas MIDI diff --git a/data/locale/ru.ts b/data/locale/ru.ts index d56f75375..4da0226f6 100644 --- a/data/locale/ru.ts +++ b/data/locale/ru.ts @@ -5144,7 +5144,7 @@ Double clicking any of the plugins will bring up information on the ports. - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/locale/sv.ts b/data/locale/sv.ts index f33000c02..991af824d 100644 --- a/data/locale/sv.ts +++ b/data/locale/sv.ts @@ -5077,7 +5077,7 @@ Double clicking any of the plugins will bring up information on the ports. - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/locale/zh.ts b/data/locale/zh.ts index e549cd69d..a41bd9fe5 100644 --- a/data/locale/zh.ts +++ b/data/locale/zh.ts @@ -6799,7 +6799,7 @@ Double clicking any of the plugins will bring up information on the ports. - patternView + PatternView double-click to open this pattern in piano-roll use mouse wheel to set volume of a step diff --git a/data/themes/default/style.css b/data/themes/default/style.css index fd96384ae..1598264b9 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -517,7 +517,7 @@ TrackContainerView QLabel /* Patterns */ /* instrument pattern */ -patternView { +PatternView { color: rgb( 119, 199, 216 ); qproperty-fgColor: rgb( 187, 227, 236 ); qproperty-textColor: rgb( 255, 255, 255 ); diff --git a/include/pattern.h b/include/Pattern.h similarity index 88% rename from include/pattern.h rename to include/Pattern.h index 8db698370..3d0f0991c 100644 --- a/include/pattern.h +++ b/include/Pattern.h @@ -1,5 +1,5 @@ /* - * pattern.h - declaration of class pattern, which contains all informations + * Pattern.h - declaration of class Pattern, which contains all information * about a pattern * * Copyright (c) 2004-2014 Tobias Doerffel @@ -46,7 +46,7 @@ class SampleBuffer; -class EXPORT pattern : public trackContentObject +class EXPORT Pattern : public trackContentObject { Q_OBJECT public: @@ -56,9 +56,9 @@ public: MelodyPattern } ; - pattern( InstrumentTrack * _instrument_track ); - pattern( const pattern & _pat_to_copy ); - virtual ~pattern(); + Pattern( InstrumentTrack* instrumentTrack ); + Pattern( const Pattern& other ); + virtual ~Pattern(); void init(); @@ -137,18 +137,18 @@ private: NoteVector m_notes; int m_steps; - friend class patternView; + friend class PatternView; friend class bbEditor; signals: - void destroyedPattern( pattern* ); + void destroyedPattern( Pattern* ); } ; -class patternView : public trackContentObjectView +class PatternView : public trackContentObjectView { Q_OBJECT @@ -156,8 +156,8 @@ class patternView : public trackContentObjectView Q_PROPERTY( QColor fgColor READ fgColor WRITE setFgColor ) Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor ) public: - patternView( pattern * _pattern, trackView * _parent ); - virtual ~patternView(); + PatternView( Pattern* pattern, trackView* parent ); + virtual ~PatternView(); public slots: @@ -190,7 +190,7 @@ private: static QPixmap * s_stepBtnOff; static QPixmap * s_stepBtnOffLight; - pattern * m_pat; + Pattern* m_pat; QPixmap m_paintPixmap; bool m_needsUpdate; } ; diff --git a/include/PianoRoll.h b/include/PianoRoll.h index ea9aa0387..183a8b99b 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -46,7 +46,7 @@ class QSignalMapper; class comboBox; class NotePlayHandle; -class pattern; +class Pattern; class timeLine; class toolButton; @@ -61,7 +61,7 @@ public: /*! \brief Resets settings to default when e.g. creating a new project */ void reset(); - void setCurrentPattern( pattern * _new_pattern ); + void setCurrentPattern( Pattern* newPattern ); inline void stopRecording() { @@ -73,12 +73,12 @@ public: return m_recording; } - inline const pattern * currentPattern() const + const Pattern* currentPattern() const { return m_pattern; } - inline bool validPattern() const + bool hasValidPattern() const { return m_pattern != NULL; } @@ -164,7 +164,7 @@ protected slots: void changeNoteEditMode( int i ); void markSemiTone( int i ); - void hidePattern( pattern* p ); + void hidePattern( Pattern* pattern ); signals: @@ -294,7 +294,7 @@ private: - pattern * m_pattern; + Pattern* m_pattern; QScrollBar * m_leftRightScroll; QScrollBar * m_topBottomScroll; diff --git a/include/SampleRecordHandle.h b/include/SampleRecordHandle.h index 9e50699ca..14b71df4e 100644 --- a/include/SampleRecordHandle.h +++ b/include/SampleRecordHandle.h @@ -33,7 +33,6 @@ #include "SampleBuffer.h" class bbTrack; -class pattern; class SampleTCO; class track; diff --git a/include/song.h b/include/song.h index dc58a8d94..e0b703bb0 100644 --- a/include/song.h +++ b/include/song.h @@ -35,7 +35,7 @@ #include "VstSyncController.h" class AutomationTrack; -class pattern; +class Pattern; class timeLine; @@ -259,7 +259,7 @@ public slots: void playAndRecord(); void playTrack( track * _trackToPlay ); void playBB(); - void playPattern( pattern * _patternToPlay, bool _loop = true ); + void playPattern( Pattern* patternToPlay, bool _loop = true ); void togglePause(); void stop(); @@ -344,7 +344,7 @@ private: tact_t m_length; track * m_trackToPlay; - pattern * m_patternToPlay; + Pattern* m_patternToPlay; bool m_loopPattern; double m_elapsedMilliSeconds; diff --git a/plugins/HydrogenImport/HydrogenImport.cpp b/plugins/HydrogenImport/HydrogenImport.cpp index 1c33d42ff..81b4e8918 100644 --- a/plugins/HydrogenImport/HydrogenImport.cpp +++ b/plugins/HydrogenImport/HydrogenImport.cpp @@ -13,7 +13,7 @@ #include "Instrument.h" #include "InstrumentTrack.h" #include "note.h" -#include "pattern.h" +#include "Pattern.h" #include "track.h" #include "bb_track.h" #include "bb_track_container.h" @@ -270,7 +270,7 @@ bool HydrogenImport::readSong() QString instrId = LocalFileMng::readXmlString( noteNode, "instrument", 0,false, false ); int i = pattern_count - 1 + nbb; pattern_id[sName] = pattern_count - 1; - pattern *p = dynamic_cast( drum_track[instrId]->getTCO( i ) ); + Pattern*p = dynamic_cast( drum_track[instrId]->getTCO( i ) ); note n; n.setPos( nPosition ); if ( (nPosition + 48) <= nSize ) diff --git a/plugins/flp_import/FlpImport.cpp b/plugins/flp_import/FlpImport.cpp index db566564f..6368540a4 100644 --- a/plugins/flp_import/FlpImport.cpp +++ b/plugins/flp_import/FlpImport.cpp @@ -48,7 +48,7 @@ #include "EnvelopeAndLfoParameters.h" #include "knob.h" #include "Oscillator.h" -#include "pattern.h" +#include "Pattern.h" #include "Piano.h" #include "ProjectJournal.h" #include "project_notes.h" @@ -1542,8 +1542,7 @@ else { const int pat = *jt / 256; const int pos = *jt % 256; - pattern * p = - dynamic_cast( t->getTCO( pat ) ); + Pattern* p = dynamic_cast( t->getTCO( pat ) ); if( p == NULL ) { continue; @@ -1567,7 +1566,7 @@ else { continue; } - pattern * p = dynamic_cast( t->getTCO( pat ) ); + Pattern* p = dynamic_cast( t->getTCO( pat ) ); if( p != NULL ) { p->addNote( jt->second, false ); diff --git a/plugins/midi_import/MidiImport.cpp b/plugins/midi_import/MidiImport.cpp index 0444ce51a..ec354fa36 100644 --- a/plugins/midi_import/MidiImport.cpp +++ b/plugins/midi_import/MidiImport.cpp @@ -35,7 +35,7 @@ #include "AutomationTrack.h" #include "AutomationPattern.h" #include "config_mgr.h" -#include "pattern.h" +#include "Pattern.h" #include "Instrument.h" #include "MainWindow.h" #include "MidiTime.h" @@ -209,7 +209,7 @@ public: { } InstrumentTrack * it; - pattern * p; + Pattern* p; Instrument * it_inst; bool isSF2; bool hasNotes; @@ -249,7 +249,7 @@ public: if( !p || n.pos() > lastEnd + DefaultTicksPerTact ) { MidiTime pPos = MidiTime( n.pos().getTact(), 0 ); - p = dynamic_cast( it->createTCO( 0 ) ); + p = dynamic_cast( it->createTCO( 0 ) ); p->movePosition( pPos ); } hasNotes = true; diff --git a/src/core/SamplePlayHandle.cpp b/src/core/SamplePlayHandle.cpp index 95613952e..1d9e8e3f9 100644 --- a/src/core/SamplePlayHandle.cpp +++ b/src/core/SamplePlayHandle.cpp @@ -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" diff --git a/src/core/SampleRecordHandle.cpp b/src/core/SampleRecordHandle.cpp index edae63072..5abc8b3d4 100644 --- a/src/core/SampleRecordHandle.cpp +++ b/src/core/SampleRecordHandle.cpp @@ -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" diff --git a/src/core/engine.cpp b/src/core/engine.cpp index 182855ce8..506ee4da4 100644 --- a/src/core/engine.cpp +++ b/src/core/engine.cpp @@ -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" diff --git a/src/core/song.cpp b/src/core/song.cpp index f62cadf19..59dde12b4 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -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 ) diff --git a/src/gui/AutomationEditor.cpp b/src/gui/AutomationEditor.cpp index 7e65b0031..bb689eb72 100644 --- a/src/gui/AutomationEditor.cpp +++ b/src/gui/AutomationEditor.cpp @@ -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() ) diff --git a/src/gui/PianoRoll.cpp b/src/gui/PianoRoll.cpp index abccc5e87..3ff30e65e 100644 --- a/src/gui/PianoRoll.cpp +++ b/src/gui/PianoRoll.cpp @@ -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; } diff --git a/src/gui/bb_editor.cpp b/src/gui/bb_editor.cpp index 7a2087454..b0df317e1 100644 --- a/src/gui/bb_editor.cpp +++ b/src/gui/bb_editor.cpp @@ -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( - ( *it )->getTCO( m_bbtc->currentBB() ) ); + Pattern* p = static_cast( ( *it )->getTCO( m_bbtc->currentBB() ) ); p->addSteps(); } } @@ -275,8 +274,7 @@ void bbEditor::removeSteps() { if( ( *it )->type() == track::InstrumentTrack ) { - pattern * p = static_cast( - ( *it )->getTCO( m_bbtc->currentBB() ) ); + Pattern* p = static_cast( ( *it )->getTCO( m_bbtc->currentBB() ) ); p->removeSteps(); } } diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index c6e5f2c1c..74a3378e8 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -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( getTCO( i ) ); + Pattern* p = dynamic_cast( 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( *it ); + Pattern* p = dynamic_cast( *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 ); } diff --git a/src/tracks/pattern.cpp b/src/tracks/Pattern.cpp similarity index 89% rename from src/tracks/pattern.cpp rename to src/tracks/Pattern.cpp index fe74d1872..0ccccec43 100644 --- a/src/tracks/pattern.cpp +++ b/src/tracks/Pattern.cpp @@ -33,7 +33,7 @@ #include #include -#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( _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" From 0055fe13b1f672a5d17db57c907bc764d744b676 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Tue, 30 Sep 2014 22:50:38 +0200 Subject: [PATCH 4/4] MidiImport: fixed plugin folder name --- plugins/CMakeLists.txt | 2 +- plugins/{midi_import => MidiImport}/CMakeLists.txt | 0 plugins/{midi_import => MidiImport}/MidiImport.cpp | 0 plugins/{midi_import => MidiImport}/MidiImport.h | 0 plugins/{midi_import => MidiImport}/portsmf/README.txt | 0 plugins/{midi_import => MidiImport}/portsmf/algrd_internal.h | 0 plugins/{midi_import => MidiImport}/portsmf/algsmfrd_internal.h | 0 plugins/{midi_import => MidiImport}/portsmf/allegro.cpp | 0 plugins/{midi_import => MidiImport}/portsmf/allegro.h | 0 plugins/{midi_import => MidiImport}/portsmf/allegrord.cpp | 0 plugins/{midi_import => MidiImport}/portsmf/allegroserial.cpp | 0 plugins/{midi_import => MidiImport}/portsmf/allegrosmfrd.cpp | 0 plugins/{midi_import => MidiImport}/portsmf/allegrosmfwr.cpp | 0 plugins/{midi_import => MidiImport}/portsmf/allegrowr.cpp | 0 plugins/{midi_import => MidiImport}/portsmf/license.txt | 0 plugins/{midi_import => MidiImport}/portsmf/mfmidi.cpp | 0 plugins/{midi_import => MidiImport}/portsmf/mfmidi.h | 0 plugins/{midi_import => MidiImport}/portsmf/strparse.cpp | 0 plugins/{midi_import => MidiImport}/portsmf/strparse.h | 0 plugins/{midi_import => MidiImport}/portsmf/trace.cpp | 0 plugins/{midi_import => MidiImport}/portsmf/trace.h | 0 21 files changed, 1 insertion(+), 1 deletion(-) rename plugins/{midi_import => MidiImport}/CMakeLists.txt (100%) rename plugins/{midi_import => MidiImport}/MidiImport.cpp (100%) rename plugins/{midi_import => MidiImport}/MidiImport.h (100%) rename plugins/{midi_import => MidiImport}/portsmf/README.txt (100%) rename plugins/{midi_import => MidiImport}/portsmf/algrd_internal.h (100%) rename plugins/{midi_import => MidiImport}/portsmf/algsmfrd_internal.h (100%) rename plugins/{midi_import => MidiImport}/portsmf/allegro.cpp (100%) rename plugins/{midi_import => MidiImport}/portsmf/allegro.h (100%) rename plugins/{midi_import => MidiImport}/portsmf/allegrord.cpp (100%) rename plugins/{midi_import => MidiImport}/portsmf/allegroserial.cpp (100%) rename plugins/{midi_import => MidiImport}/portsmf/allegrosmfrd.cpp (100%) rename plugins/{midi_import => MidiImport}/portsmf/allegrosmfwr.cpp (100%) rename plugins/{midi_import => MidiImport}/portsmf/allegrowr.cpp (100%) rename plugins/{midi_import => MidiImport}/portsmf/license.txt (100%) rename plugins/{midi_import => MidiImport}/portsmf/mfmidi.cpp (100%) rename plugins/{midi_import => MidiImport}/portsmf/mfmidi.h (100%) rename plugins/{midi_import => MidiImport}/portsmf/strparse.cpp (100%) rename plugins/{midi_import => MidiImport}/portsmf/strparse.h (100%) rename plugins/{midi_import => MidiImport}/portsmf/trace.cpp (100%) rename plugins/{midi_import => MidiImport}/portsmf/trace.h (100%) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 24eeef641..8311c4fa6 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -14,7 +14,7 @@ ADD_SUBDIRECTORY(ladspa_browser) ADD_SUBDIRECTORY(LadspaEffect) ADD_SUBDIRECTORY(lb302) #ADD_SUBDIRECTORY(lb303) -ADD_SUBDIRECTORY(midi_import) +ADD_SUBDIRECTORY(MidiImport) ADD_SUBDIRECTORY(monstro) ADD_SUBDIRECTORY(nes) ADD_SUBDIRECTORY(opl2) diff --git a/plugins/midi_import/CMakeLists.txt b/plugins/MidiImport/CMakeLists.txt similarity index 100% rename from plugins/midi_import/CMakeLists.txt rename to plugins/MidiImport/CMakeLists.txt diff --git a/plugins/midi_import/MidiImport.cpp b/plugins/MidiImport/MidiImport.cpp similarity index 100% rename from plugins/midi_import/MidiImport.cpp rename to plugins/MidiImport/MidiImport.cpp diff --git a/plugins/midi_import/MidiImport.h b/plugins/MidiImport/MidiImport.h similarity index 100% rename from plugins/midi_import/MidiImport.h rename to plugins/MidiImport/MidiImport.h diff --git a/plugins/midi_import/portsmf/README.txt b/plugins/MidiImport/portsmf/README.txt similarity index 100% rename from plugins/midi_import/portsmf/README.txt rename to plugins/MidiImport/portsmf/README.txt diff --git a/plugins/midi_import/portsmf/algrd_internal.h b/plugins/MidiImport/portsmf/algrd_internal.h similarity index 100% rename from plugins/midi_import/portsmf/algrd_internal.h rename to plugins/MidiImport/portsmf/algrd_internal.h diff --git a/plugins/midi_import/portsmf/algsmfrd_internal.h b/plugins/MidiImport/portsmf/algsmfrd_internal.h similarity index 100% rename from plugins/midi_import/portsmf/algsmfrd_internal.h rename to plugins/MidiImport/portsmf/algsmfrd_internal.h diff --git a/plugins/midi_import/portsmf/allegro.cpp b/plugins/MidiImport/portsmf/allegro.cpp similarity index 100% rename from plugins/midi_import/portsmf/allegro.cpp rename to plugins/MidiImport/portsmf/allegro.cpp diff --git a/plugins/midi_import/portsmf/allegro.h b/plugins/MidiImport/portsmf/allegro.h similarity index 100% rename from plugins/midi_import/portsmf/allegro.h rename to plugins/MidiImport/portsmf/allegro.h diff --git a/plugins/midi_import/portsmf/allegrord.cpp b/plugins/MidiImport/portsmf/allegrord.cpp similarity index 100% rename from plugins/midi_import/portsmf/allegrord.cpp rename to plugins/MidiImport/portsmf/allegrord.cpp diff --git a/plugins/midi_import/portsmf/allegroserial.cpp b/plugins/MidiImport/portsmf/allegroserial.cpp similarity index 100% rename from plugins/midi_import/portsmf/allegroserial.cpp rename to plugins/MidiImport/portsmf/allegroserial.cpp diff --git a/plugins/midi_import/portsmf/allegrosmfrd.cpp b/plugins/MidiImport/portsmf/allegrosmfrd.cpp similarity index 100% rename from plugins/midi_import/portsmf/allegrosmfrd.cpp rename to plugins/MidiImport/portsmf/allegrosmfrd.cpp diff --git a/plugins/midi_import/portsmf/allegrosmfwr.cpp b/plugins/MidiImport/portsmf/allegrosmfwr.cpp similarity index 100% rename from plugins/midi_import/portsmf/allegrosmfwr.cpp rename to plugins/MidiImport/portsmf/allegrosmfwr.cpp diff --git a/plugins/midi_import/portsmf/allegrowr.cpp b/plugins/MidiImport/portsmf/allegrowr.cpp similarity index 100% rename from plugins/midi_import/portsmf/allegrowr.cpp rename to plugins/MidiImport/portsmf/allegrowr.cpp diff --git a/plugins/midi_import/portsmf/license.txt b/plugins/MidiImport/portsmf/license.txt similarity index 100% rename from plugins/midi_import/portsmf/license.txt rename to plugins/MidiImport/portsmf/license.txt diff --git a/plugins/midi_import/portsmf/mfmidi.cpp b/plugins/MidiImport/portsmf/mfmidi.cpp similarity index 100% rename from plugins/midi_import/portsmf/mfmidi.cpp rename to plugins/MidiImport/portsmf/mfmidi.cpp diff --git a/plugins/midi_import/portsmf/mfmidi.h b/plugins/MidiImport/portsmf/mfmidi.h similarity index 100% rename from plugins/midi_import/portsmf/mfmidi.h rename to plugins/MidiImport/portsmf/mfmidi.h diff --git a/plugins/midi_import/portsmf/strparse.cpp b/plugins/MidiImport/portsmf/strparse.cpp similarity index 100% rename from plugins/midi_import/portsmf/strparse.cpp rename to plugins/MidiImport/portsmf/strparse.cpp diff --git a/plugins/midi_import/portsmf/strparse.h b/plugins/MidiImport/portsmf/strparse.h similarity index 100% rename from plugins/midi_import/portsmf/strparse.h rename to plugins/MidiImport/portsmf/strparse.h diff --git a/plugins/midi_import/portsmf/trace.cpp b/plugins/MidiImport/portsmf/trace.cpp similarity index 100% rename from plugins/midi_import/portsmf/trace.cpp rename to plugins/MidiImport/portsmf/trace.cpp diff --git a/plugins/midi_import/portsmf/trace.h b/plugins/MidiImport/portsmf/trace.h similarity index 100% rename from plugins/midi_import/portsmf/trace.h rename to plugins/MidiImport/portsmf/trace.h