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 609f481ee..c4a141d68 100644
--- a/data/locale/de.ts
+++ b/data/locale/de.ts
@@ -6637,7 +6637,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 93948360a..7c606078c 100644
--- a/data/locale/zh.ts
+++ b/data/locale/zh.ts
@@ -5079,7 +5079,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 89%
rename from include/pattern.h
rename to include/Pattern.h
index 802e02430..7211fc8e8 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,14 +137,18 @@ private:
NoteVector m_notes;
int m_steps;
- friend class patternView;
+ friend class PatternView;
friend class bbEditor;
+
+signals:
+ void destroyedPattern( Pattern* );
+
} ;
-class patternView : public trackContentObjectView
+class PatternView : public trackContentObjectView
{
Q_OBJECT
@@ -152,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:
@@ -186,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 99ddea4ef..e3bf46e07 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,6 +164,9 @@ protected slots:
void changeNoteEditMode( int i );
void markSemiTone( int i );
+ void hidePattern( Pattern* pattern );
+
+
signals:
void currentPatternChanged();
void semiToneMarkerMenuScaleSetEnabled(bool);
@@ -291,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 e5f938712..1979bd02e 100644
--- a/include/song.h
+++ b/include/song.h
@@ -35,7 +35,7 @@
#include "VstSyncController.h"
class AutomationTrack;
-class pattern;
+class Pattern;
class timeLine;
@@ -263,7 +263,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();
@@ -354,7 +354,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/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/HydrogenImport/HydrogenImport.cpp b/plugins/HydrogenImport/HydrogenImport.cpp
index 29c8279de..96fcee8d3 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/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 99%
rename from plugins/midi_import/MidiImport.cpp
rename to plugins/MidiImport/MidiImport.cpp
index 807c57043..bdbf7e7ca 100644
--- a/plugins/midi_import/MidiImport.cpp
+++ b/plugins/MidiImport/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/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
diff --git a/plugins/flp_import/FlpImport.cpp b/plugins/flp_import/FlpImport.cpp
index 3dc60a3c2..5669ab496 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/vst_base/CMakeLists.txt b/plugins/vst_base/CMakeLists.txt
index 8ed62856c..8f29acc7a 100644
--- a/plugins/vst_base/CMakeLists.txt
+++ b/plugins/vst_base/CMakeLists.txt
@@ -40,7 +40,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
diff --git a/src/core/SamplePlayHandle.cpp b/src/core/SamplePlayHandle.cpp
index c29552d09..4fe72742e 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 981998469..cfaecc285 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"
@@ -473,14 +473,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 b9e6c746d..02b9af5d6 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 f676d919f..ebe72ab69 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,19 +787,27 @@ PianoRoll::~PianoRoll()
}
-void PianoRoll::setCurrentPattern( pattern * _new_pattern )
+void PianoRoll::setCurrentPattern( Pattern* newPattern )
{
- if( validPattern() )
+ if( hasValidPattern() )
{
m_pattern->instrumentTrack()->disconnect( this );
}
- m_pattern = _new_pattern;
+ // 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 = 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" ) );
@@ -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* pattern )
+{
+ if( m_pattern == pattern )
+ {
+ setCurrentPattern( NULL );
+ }
+}
+
+
void PianoRoll::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
@@ -1192,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;
@@ -1468,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;
@@ -1490,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();
}
@@ -1570,7 +1590,7 @@ void PianoRoll::mousePressEvent( QMouseEvent * _me )
{
m_startedWithShift = _me->modifiers() & Qt::ShiftModifier;
- if( validPattern() == false )
+ if( hasValidPattern() == false )
{
return;
}
@@ -1684,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
@@ -1952,7 +1972,7 @@ void PianoRoll::mousePressEvent( QMouseEvent * _me )
void PianoRoll::mouseDoubleClickEvent( QMouseEvent * _me )
{
- if( validPattern() == false )
+ if( hasValidPattern() == false )
{
return;
}
@@ -2114,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();
@@ -2216,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();
@@ -2257,7 +2277,7 @@ void PianoRoll::mouseReleaseEvent( QMouseEvent * _me )
void PianoRoll::mouseMoveEvent( QMouseEvent * _me )
{
- if( validPattern() == false )
+ if( hasValidPattern() == false )
{
update();
return;
@@ -3011,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 );
}
@@ -3027,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 );
}
@@ -3100,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 ) -
@@ -3237,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,
@@ -3371,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 )
@@ -3384,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 *
@@ -3640,7 +3660,7 @@ song::PlayModes PianoRoll::desiredPlayModeForAccompany() const
void PianoRoll::play()
{
- if( validPattern() == false )
+ if( hasValidPattern() == false )
{
return;
}
@@ -3664,7 +3684,7 @@ void PianoRoll::record()
{
stop();
}
- if( m_recording == true || validPattern() == false )
+ if( m_recording == true || hasValidPattern() == false )
{
return;
}
@@ -3683,7 +3703,7 @@ void PianoRoll::recordAccompany()
{
stop();
}
- if( m_recording == true || validPattern() == false )
+ if( m_recording == true || hasValidPattern() == false )
{
return;
}
@@ -3716,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() ||
@@ -3743,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() ||
@@ -3828,7 +3848,7 @@ void PianoRoll::detuneButtonToggled()
void PianoRoll::selectAll()
{
- if( validPattern() == false )
+ if( hasValidPattern() == false )
{
return;
}
@@ -3886,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;
}
@@ -3989,7 +4009,7 @@ void PianoRoll::copySelectedNotes()
void PianoRoll::cutSelectedNotes()
{
- if( validPattern() == false )
+ if( hasValidPattern() == false )
{
return;
}
@@ -4021,7 +4041,7 @@ void PianoRoll::cutSelectedNotes()
void PianoRoll::pasteNotes()
{
- if( validPattern() == false )
+ if( hasValidPattern() == false )
{
return;
}
@@ -4073,7 +4093,7 @@ void PianoRoll::pasteNotes()
void PianoRoll::deleteSelectedNotes()
{
- if( validPattern() == false )
+ if( hasValidPattern() == false )
{
return;
}
@@ -4156,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;
@@ -4248,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 9552df580..1ae7d417f 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 cf02a5726..37479f9ca 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"
@@ -514,7 +514,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 );
@@ -630,7 +630,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() )
{
@@ -695,7 +695,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 88%
rename from src/tracks/pattern.cpp
rename to src/tracks/Pattern.cpp
index 3ec7213f2..15c0481ec 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,8 +86,10 @@ pattern::pattern( const pattern & _pat_to_copy ) :
}
-pattern::~pattern()
+Pattern::~Pattern()
{
+ emit destroyedPattern( this );
+
for( NoteVector::Iterator it = m_notes.begin();
it != m_notes.end(); ++it )
{
@@ -101,7 +102,7 @@ pattern::~pattern()
-void pattern::init()
+void Pattern::init()
{
connect( engine::getSong(), SIGNAL( timeSignatureChanged( int, int ) ),
this, SLOT( changeTimeSignature() ) );
@@ -116,7 +117,7 @@ void pattern::init()
-MidiTime pattern::length() const
+MidiTime Pattern::length() const
{
if( m_patternType == BeatPattern )
{
@@ -141,7 +142,7 @@ MidiTime pattern::length() const
-MidiTime pattern::beatPatternLength() const
+MidiTime Pattern::beatPatternLength() const
{
tick_t max_length = MidiTime::ticksPerTact();
@@ -166,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() )
@@ -212,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 )
{
instrumentTrack()->lock();
NoteVector::Iterator it = m_notes.begin();
@@ -239,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 )
@@ -253,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
@@ -266,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 );
@@ -274,7 +275,7 @@ void pattern::rearrangeAllNotes()
-void pattern::clearNotes()
+void Pattern::clearNotes()
{
instrumentTrack()->lock();
for( NoteVector::Iterator it = m_notes.begin(); it != m_notes.end();
@@ -292,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 )
@@ -309,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 )
@@ -321,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() );
@@ -373,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() );
@@ -420,7 +421,7 @@ void pattern::loadSettings( const QDomElement & _this )
-void pattern::clear()
+void Pattern::clear()
{
addJournalCheckPoint();
clearNotes();
@@ -430,7 +431,7 @@ void pattern::clear()
-void pattern::addSteps()
+void Pattern::addSteps()
{
m_steps += MidiTime::stepsPerTact();
ensureBeatNotes();
@@ -441,7 +442,7 @@ void pattern::addSteps()
-void pattern::removeSteps()
+void Pattern::removeSteps()
{
int _n = MidiTime::stepsPerTact();
if( _n < m_steps )
@@ -470,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 )
@@ -531,7 +532,7 @@ void pattern::ensureBeatNotes()
-void pattern::updateBBTrack()
+void Pattern::updateBBTrack()
{
if( getTrack()->trackContainer() == engine::getBBTrackContainer() )
{
@@ -547,7 +548,7 @@ void pattern::updateBBTrack()
-bool pattern::empty()
+bool Pattern::empty()
{
for( NoteVector::ConstIterator it = m_notes.begin();
it != m_notes.end(); ++it )
@@ -563,7 +564,7 @@ bool pattern::empty()
-void pattern::changeTimeSignature()
+void Pattern::changeTimeSignature()
{
MidiTime last_pos = MidiTime::ticksPerTact();
for( NoteVector::ConstIterator cit = m_notes.begin();
@@ -600,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 )
{
@@ -647,29 +648,15 @@ patternView::patternView( pattern * _pattern, trackView * _parent ) :
-patternView::~patternView()
+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 );
- }
- }
}
-void patternView::update()
+void PatternView::update()
{
m_needsUpdate = true;
m_pat->changeLength( m_pat->length() );
@@ -679,7 +666,7 @@ void patternView::update()
-void patternView::openInPianoRoll()
+void PatternView::openInPianoRoll()
{
engine::pianoRoll()->setCurrentPattern( m_pat );
engine::pianoRoll()->parentWidget()->show();
@@ -689,7 +676,7 @@ void patternView::openInPianoRoll()
-void patternView::resetName()
+void PatternView::resetName()
{
m_pat->setName( m_pat->m_instrumentTrack->name() );
}
@@ -697,7 +684,7 @@ void patternView::resetName()
-void patternView::changeName()
+void PatternView::changeName()
{
QString s = m_pat->name();
renameDialog rename_dlg( s );
@@ -708,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 );
@@ -739,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() ) )
@@ -759,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() )
@@ -831,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() )
@@ -891,7 +878,7 @@ void patternView::wheelEvent( QWheelEvent * _we )
-void patternView::paintEvent( QPaintEvent * )
+void PatternView::paintEvent( QPaintEvent * )
{
if( m_needsUpdate == false )
{
@@ -918,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 );
@@ -937,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 ) );
@@ -974,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 )
{
@@ -1064,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() ) )
{
@@ -1159,8 +1146,3 @@ void patternView::paintEvent( QPaintEvent * )
}
-
-
-
-
-