Rename Beat/Bassline to Pattern (#6284)

- BB* -> Pattern*
- BBTrackContainer -> PatternStore
- BBTrackContainerView -> PatternEditor
- BBEditor -> PatternEditorWindow

Does not touch save files
This commit is contained in:
Alex
2022-02-13 09:03:37 +01:00
committed by GitHub
parent 8a0f1dd95b
commit dc73911391
81 changed files with 1201 additions and 1200 deletions

View File

@@ -218,7 +218,7 @@ private:
void drawCross(QPainter & p );
void drawAutomationPoint( QPainter & p, timeMap::iterator it );
bool inBBEditor();
bool inPatternEditor();
QColor m_barLineColor;
QColor m_beatLineColor;

View File

@@ -1,82 +0,0 @@
/*
* BBTrackContainer.h - model-component of BB-Editor
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef BB_TRACK_CONTAINER_H
#define BB_TRACK_CONTAINER_H
#include "TrackContainer.h"
#include "ComboBoxModel.h"
class LMMS_EXPORT BBTrackContainer : public TrackContainer
{
Q_OBJECT
mapPropertyFromModel(int,currentBB,setCurrentBB,m_bbComboBoxModel);
public:
BBTrackContainer();
virtual ~BBTrackContainer();
virtual bool play(TimePos start, const fpp_t frames, const f_cnt_t frameBase, int clipNum = -1);
void updateAfterTrackAdd() override;
inline QString nodeName() const override
{
return "bbtrackcontainer";
}
bar_t lengthOfBB(int bb) const;
inline bar_t lengthOfCurrentBB()
{
return lengthOfBB(currentBB());
}
int numOfBBs() const;
void removeBB(int bb);
void swapBB(int bb1, int bb2);
void updateBBTrack(Clip * clip);
void fixIncorrectPositions();
void createClipsForBB(int bb);
AutomatedValueMap automatedValuesAt(TimePos time, int clipNum) const override;
public slots:
void play();
void stop();
void updateComboBox();
void currentBBChanged();
private:
ComboBoxModel m_bbComboBoxModel;
friend class BBEditor;
} ;
#endif

View File

@@ -53,7 +53,7 @@ class ClipView : public selectableObject, public ModelView
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
Q_PROPERTY( QColor textBackgroundColor READ textBackgroundColor WRITE setTextBackgroundColor )
Q_PROPERTY( QColor textShadowColor READ textShadowColor WRITE setTextShadowColor )
Q_PROPERTY( QColor BBClipBackground READ BBClipBackground WRITE setBBClipBackground )
Q_PROPERTY( QColor patternClipBackground READ patternClipBackground WRITE setPatternClipBackground )
Q_PROPERTY( bool gradient READ gradient WRITE setGradient )
// We have to use a QSize here because using QPoint isn't supported.
// width -> x, height -> y
@@ -83,7 +83,7 @@ public:
QColor textColor() const;
QColor textBackgroundColor() const;
QColor textShadowColor() const;
QColor BBClipBackground() const;
QColor patternClipBackground() const;
bool gradient() const;
void setMutedColor( const QColor & c );
void setMutedBackgroundColor( const QColor & c );
@@ -91,7 +91,7 @@ public:
void setTextColor( const QColor & c );
void setTextBackgroundColor( const QColor & c );
void setTextShadowColor( const QColor & c );
void setBBClipBackground( const QColor & c );
void setPatternClipBackground(const QColor& c);
void setGradient( const bool & b );
// access needsUpdate member variable
@@ -211,7 +211,7 @@ private:
QColor m_textColor;
QColor m_textBackgroundColor;
QColor m_textShadowColor;
QColor m_BBClipBackground;
QColor m_patternClipBackground;
bool m_gradient;
QSize m_mouseHotspotHand; // QSize must be used because QPoint
QSize m_mouseHotspotKnife; // isn't supported by property system

View File

@@ -35,8 +35,8 @@
#include "lmms_basics.h"
class AudioEngine;
class BBTrackContainer;
class Mixer;
class PatternStore;
class ProjectJournal;
class Song;
class Ladspa2LMMS;
@@ -77,9 +77,9 @@ public:
return s_song;
}
static BBTrackContainer * getBBTrackContainer()
static PatternStore * patternStore()
{
return s_bbTrackContainer;
return s_patternStore;
}
static ProjectJournal * projectJournal()
@@ -143,7 +143,7 @@ private:
static AudioEngine *s_audioEngine;
static Mixer * s_mixer;
static Song * s_song;
static BBTrackContainer * s_bbTrackContainer;
static PatternStore * s_patternStore;
static ProjectJournal * s_projectJournal;
#ifdef LMMS_HAVE_LV2

View File

@@ -40,7 +40,7 @@ public:
virtual bool tryExport(const TrackContainer::TrackList &tracks,
const TrackContainer::TrackList &tracksBB,
const TrackContainer::TrackList &patternTracks,
int tempo, int masterPitch, const QString &filename ) = 0;
protected:

View File

@@ -33,11 +33,11 @@
class QLabel;
class AutomationEditorWindow;
class BBEditor;
class ControllerRackView;
class MixerView;
class MainWindow;
class MicrotunerConfig;
class PatternEditorWindow;
class PianoRollWindow;
class ProjectNotes;
class SongEditorWindow;
@@ -57,7 +57,7 @@ public:
MainWindow* mainWindow() { return m_mainWindow; }
MixerView* mixerView() { return m_mixerView; }
SongEditorWindow* songEditor() { return m_songEditor; }
BBEditor* getBBEditor() { return m_bbEditor; }
PatternEditorWindow* patternEditor() { return m_patternEditor; }
PianoRollWindow* pianoRoll() { return m_pianoRoll; }
ProjectNotes* getProjectNotes() { return m_projectNotes; }
MicrotunerConfig* getMicrotunerConfig() { return m_microtunerConfig; }
@@ -77,7 +77,7 @@ private:
MixerView* m_mixerView;
SongEditorWindow* m_songEditor;
AutomationEditorWindow* m_automationEditor;
BBEditor* m_bbEditor;
PatternEditorWindow* m_patternEditor;
PianoRollWindow* m_pianoRoll;
ProjectNotes* m_projectNotes;
MicrotunerConfig* m_microtunerConfig;

View File

@@ -149,7 +149,7 @@ public slots:
void aboutLMMS();
void help();
void toggleAutomationEditorWin();
void toggleBBEditorWin( bool forceShow = false );
void togglePatternEditorWin(bool forceShow = false);
void toggleSongEditorWin();
void toggleProjectNotesWin();
void toggleMicrotunerWin();

View File

@@ -108,16 +108,16 @@ public:
using Model::dataChanged;
protected:
void updateBBTrack();
protected slots:
public slots:
void addSteps();
void cloneSteps();
void removeSteps();
void clear();
protected:
void updatePatternTrack();
protected slots:
void changeTimeSignature();
@@ -140,7 +140,6 @@ private:
MidiClip * adjacentMidiClipByOffset(int offset) const;
friend class MidiClipView;
friend class BBTrackContainerView;
signals:

View File

@@ -93,7 +93,7 @@ private:
QStaticText m_staticTextName;
bool m_legacySEBB;
bool m_legacySEPattern;
} ;

View File

@@ -231,16 +231,16 @@ public:
/*! Returns whether given NotePlayHandle instance is equal to *this */
bool operator==( const NotePlayHandle & _nph ) const;
/*! Returns whether NotePlayHandle belongs to BB track and BB track is muted */
bool isBbTrackMuted()
/*! Returns whether NotePlayHandle belongs to pattern track and pattern track is muted */
bool isPatternTrackMuted()
{
return m_bbTrack && m_bbTrack->isMuted();
return m_patternTrack && m_patternTrack->isMuted();
}
/*! Sets attached BB track */
void setBBTrack( Track* t )
/*! Sets attached pattern track */
void setPatternTrack(Track* t)
{
m_bbTrack = t;
m_patternTrack = t;
}
/*! Process note detuning automation */
@@ -311,7 +311,7 @@ private:
NotePlayHandle * m_parent; // parent note
bool m_hadChildren;
bool m_muted; // indicates whether note is muted
Track* m_bbTrack; // related BB track
Track* m_patternTrack; // related pattern track
// tempo reaction
bpm_t m_origTempo; // original tempo

View File

@@ -1,5 +1,5 @@
/*
* BBClip.h
* PatternClip.h
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -23,33 +23,37 @@
*/
#ifndef BB_CLIP_H
#define BB_CLIP_H
#ifndef PATTERN_CLIP_H
#define PATTERN_CLIP_H
#include "ClipView.h"
class BBClip : public Clip
/*! \brief Dummy clip for PatternTracks
*
* Only used in the Song (Editor). See PatternStore.h for more info.
*/
class PatternClip : public Clip
{
public:
BBClip( Track * _track );
virtual ~BBClip() = default;
PatternClip(Track* track);
virtual ~PatternClip() = default;
void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;
inline QString nodeName() const override
{
return( "bbtco" );
return( "bbtco" ); // TODO rename to patternclip
}
int bbTrackIndex();
int patternIndex();
ClipView * createView( TrackView * _tv ) override;
private:
friend class BBClipView;
friend class PatternClipView;
} ;
#endif
#endif

View File

@@ -1,5 +1,5 @@
/*
* BBClipView.h
* PatternClipView.h
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -23,27 +23,27 @@
*/
#ifndef BB_CLIP_VIEW_H
#define BB_CLIP_VIEW_H
#ifndef PATTERN_CLIP_VIEW_H
#define PATTERN_CLIP_VIEW_H
#include "BBClip.h"
#include "PatternClip.h"
#include <QStaticText>
class BBClipView : public ClipView
class PatternClipView : public ClipView
{
Q_OBJECT
public:
BBClipView( Clip * _clip, TrackView * _tv );
virtual ~BBClipView() = default;
PatternClipView(Clip* clip, TrackView* tv);
virtual ~PatternClipView() = default;
public slots:
void update() override;
protected slots:
void openInBBEditor();
void openInPatternEditor();
void resetName();
void changeName();
@@ -55,7 +55,7 @@ protected:
private:
BBClip * m_bbClip;
PatternClip* m_patternClip;
QPixmap m_paintPixmap;
QStaticText m_staticTextName;
@@ -63,4 +63,4 @@ private:
#endif
#endif

View File

@@ -1,5 +1,5 @@
/*
* BBEditor.h - view-component of BB-Editor
* PatternEditor.h - basic main-window for editing patterns
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -23,60 +23,30 @@
*/
#ifndef BB_EDITOR_H
#define BB_EDITOR_H
#ifndef PATTERN_EDITOR_H
#define PATTERN_EDITOR_H
#include "Editor.h"
#include "TrackContainerView.h"
class BBTrackContainer;
class PatternStore;
class ComboBox;
class BBTrackContainerView;
class BBEditor : public Editor
class PatternEditor : public TrackContainerView
{
Q_OBJECT
public:
BBEditor( BBTrackContainer * _tc );
~BBEditor();
QSize sizeHint() const override;
const BBTrackContainerView* trackContainerView() const {
return m_trackContainerView;
}
BBTrackContainerView* trackContainerView() {
return m_trackContainerView;
}
void removeBBView( int bb );
public slots:
void play() override;
void stop() override;
private:
BBTrackContainerView* m_trackContainerView;
ComboBox * m_bbComboBox;
} ;
class BBTrackContainerView : public TrackContainerView
{
Q_OBJECT
public:
BBTrackContainerView(BBTrackContainer* tc);
PatternEditor(PatternStore* ps);
bool fixedClips() const override
{
return true;
}
void removeBBView(int bb);
void removeViewsForPattern(int pattern);
void saveSettings(QDomDocument& doc, QDomElement& element) override;
void loadSettings(const QDomElement& element) override;
@@ -94,9 +64,30 @@ protected slots:
void updatePosition();
private:
BBTrackContainer * m_bbtc;
PatternStore* m_ps;
void makeSteps( bool clone );
};
class PatternEditorWindow : public Editor
{
Q_OBJECT
public:
PatternEditorWindow(PatternStore* ps);
~PatternEditorWindow();
QSize sizeHint() const override;
PatternEditor* m_editor;
public slots:
void play() override;
void stop() override;
private:
ComboBox* m_patternComboBox;
};
#endif

108
include/PatternStore.h Normal file
View File

@@ -0,0 +1,108 @@
/*
* PatternStore.h - model-component of Pattern Editor
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef PATTERN_STORE_H
#define PATTERN_STORE_H
#include "TrackContainer.h"
#include "ComboBoxModel.h"
/*
* PatternStore is the backend of Pattern Editor:
*
* +----------------------------------+
* | PatternStore (TrackContainer) |
* | |
* | +------------------------------+ |
* | | Track 1 [Clip A] [Clip B] | |
* | +------------------------------+ |
* | |
* | +------------------------------+ |
* | | Track 2 [Clip C] [Clip D] | |
* | +------------------------------+ |
* +----------------------------------+
*
* There is only one PatternStore which holds all patterns, and it's very similar to the Song Editor.
* Think of it as a table - tracks are rows, bars are columns and clips are cells.
* With this logic a "pattern" is a column, i.e. all clips on the same bar.
* In the Pattern Editor you can select which pattern (column) you want to see, using the combo box at the top.
* In the illustration above, Clip A and Clip C start on bar 1, thus they are "Pattern 1".
*
* Do not confuse tracks and clips in the PatternStore with PatternTracks and PatternClips.
* - PatternTracks are used in the Song Editor. Each one reference a "pattern" in the PatternStore.
* - PatternClips are stored inside PatternTracks. They are just empty placeholders.
*/
class LMMS_EXPORT PatternStore : public TrackContainer
{
Q_OBJECT
mapPropertyFromModel(int, currentPattern, setCurrentPattern, m_patternComboBoxModel);
public:
PatternStore();
virtual ~PatternStore();
virtual bool play(TimePos start, const fpp_t frames, const f_cnt_t frameBase, int clipNum = -1);
void updateAfterTrackAdd() override;
inline QString nodeName() const override
{
return "bbtrackcontainer"; // TODO rename to patternstore
}
bar_t lengthOfPattern(int pattern) const;
inline bar_t lengthOfCurrentPattern()
{
return lengthOfPattern(currentPattern());
}
int numOfPatterns() const;
void removePattern(int pattern);
void swapPattern(int p1, int p2);
void updatePatternTrack(Clip* clip);
void fixIncorrectPositions();
void createClipsForPattern(int pattern);
AutomatedValueMap automatedValuesAt(TimePos time, int clipNum) const override;
public slots:
void play();
void stop();
void updateComboBox();
void currentPatternChanged();
private:
ComboBoxModel m_patternComboBoxModel;
// Where the pattern selection combo box is
friend class PatternEditorWindow;
} ;
#endif

View File

@@ -1,6 +1,5 @@
/*
* BBTrack.h - class BBTrack, a wrapper for using bbEditor
* (which is a singleton-class) as track
* PatternTrack.h - a track representing a pattern in the PatternStore
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -24,25 +23,26 @@
*/
#ifndef BB_TRACK_H
#define BB_TRACK_H
#ifndef PATTERN_TRACK_H
#define PATTERN_TRACK_H
#include <QtCore/QMap>
#include "BBClipView.h"
#include "PatternClipView.h"
#include "Track.h"
class TrackLabelButton;
class TrackContainer;
class LMMS_EXPORT BBTrack : public Track
/*! Track type used in the Song (Editor) to reference a pattern in the PatternStore */
class LMMS_EXPORT PatternTrack : public Track
{
Q_OBJECT
public:
BBTrack( TrackContainer* tc );
virtual ~BBTrack();
PatternTrack(TrackContainer* tc);
virtual ~PatternTrack();
virtual bool play( const TimePos & _start, const fpp_t _frames,
const f_cnt_t _frame_base, int _clip_num = -1 ) override;
@@ -53,10 +53,10 @@ public:
QDomElement & _parent ) override;
void loadTrackSpecificSettings( const QDomElement & _this ) override;
static BBTrack * findBBTrack( int _bb_num );
static void swapBBTracks( Track * _track1, Track * _track2 );
static PatternTrack* findPatternTrack(int pattern_num);
static void swapPatternTracks(Track* track1, Track* track2);
int index()
int patternIndex()
{
return s_infoMap[this];
}
@@ -77,17 +77,17 @@ public:
protected:
inline QString nodeName() const override
{
return( "bbtrack" );
return( "bbtrack" ); //TODO rename to patterntrack
}
private:
QList<Track *> m_disabledTracks;
typedef QMap<BBTrack *, int> infoMap;
typedef QMap<PatternTrack*, int> infoMap;
static infoMap s_infoMap;
friend class BBTrackView;
friend class PatternTrackView;
} ;

View File

@@ -1,5 +1,5 @@
/*
* BBTrackView.h
* PatternTrackView.h
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -23,27 +23,27 @@
*/
#ifndef BB_TRACK_VIEW_H
#define BB_TRACK_VIEW_H
#ifndef PATTERN_TRACK_VIEW_H
#define PATTERN_TRACK_VIEW_H
#include <QtCore/QObject>
#include "BBTrack.h"
#include "PatternTrack.h"
#include "TrackView.h"
class BBTrackView : public TrackView
class PatternTrackView : public TrackView
{
Q_OBJECT
public:
BBTrackView( BBTrack* bbt, TrackContainerView* tcv );
virtual ~BBTrackView();
PatternTrackView(PatternTrack* pt, TrackContainerView* tcv);
virtual ~PatternTrackView();
bool close() override;
const BBTrack * getBBTrack() const
const PatternTrack* getPatternTrack() const
{
return( m_bbTrack );
return (m_patternTrack);
}
@@ -52,10 +52,10 @@ public slots:
private:
BBTrack * m_bbTrack;
PatternTrack* m_patternTrack;
TrackLabelButton * m_trackLabel;
} ;
#endif
#endif

View File

@@ -30,7 +30,7 @@
#include "AutomatableModel.h"
#include "PlayHandle.h"
class BBTrack;
class PatternTrack;
class SampleClip;
class Track;
class AudioPort;
@@ -65,9 +65,9 @@ public:
m_doneMayReturnTrue = _enable;
}
void setBBTrack( BBTrack * _bb_track )
void setPatternTrack(PatternTrack* pt)
{
m_bbTrack = _bb_track;
m_patternTrack = pt;
}
void setVolumeModel( FloatModel * _model )
@@ -89,7 +89,7 @@ private:
FloatModel * m_volumeModel;
Track * m_track;
BBTrack * m_bbTrack;
PatternTrack* m_patternTrack;
} ;

View File

@@ -32,7 +32,7 @@
#include "PlayHandle.h"
#include "TimePos.h"
class BBTrack;
class PatternTrack;
class SampleBuffer;
class SampleClip;
class Track;
@@ -63,7 +63,7 @@ private:
TimePos m_minLength;
Track * m_track;
BBTrack * m_bbTrack;
PatternTrack* m_patternTrack;
SampleClip * m_clip;
} ;

View File

@@ -65,7 +65,7 @@ public:
{
Mode_None,
Mode_PlaySong,
Mode_PlayBB,
Mode_PlayPattern,
Mode_PlayMidiClip,
Mode_PlayAutomationClip,
Mode_Count
@@ -363,7 +363,7 @@ public slots:
void playSong();
void record();
void playAndRecord();
void playBB();
void playPattern();
void playMidiClip( const MidiClip * midiClipToPlay, bool loop = true );
void togglePause();
void stop();
@@ -376,7 +376,7 @@ public slots:
void clearProject();
void addBBTrack();
void addPatternTrack();
private slots:

View File

@@ -198,7 +198,7 @@ signals:
void resized();
private:
QAction* m_addBBTrackAction;
QAction* m_addPatternTrackAction;
QAction* m_addSampleTrackAction;
QAction* m_addAutomationTrackAction;
QAction* m_setProportionalSnapAction;

View File

@@ -65,7 +65,7 @@ public:
enum TrackTypes
{
InstrumentTrack,
BBTrack,
PatternTrack,
SampleTrack,
EventTrack,
VideoTrack,
@@ -127,7 +127,7 @@ public:
const TimePos & end );
void swapPositionOfClips( int clipNum1, int clipNum2 );
void createClipsForBB( int bb );
void createClipsForPattern(int pattern);
void insertBar( const TimePos & pos );

View File

@@ -1,6 +1,6 @@
/*
* TrackContainer.h - base-class for all track-containers like Song-Editor,
* BB-Editor...
* Pattern Editor...
*
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -44,7 +44,7 @@ public:
typedef QVector<Track *> TrackList;
enum TrackContainerTypes
{
BBContainer,
PatternContainer,
SongContainer
} ;